Compare commits
No commits in common. "374a82a78d12fdd2b0c79fb2b4c372f30d032916" and "78147d738215af09a683f6ce02524a246cbb9ed5" have entirely different histories.
374a82a78d
...
78147d7382
@ -48,7 +48,7 @@ public class DlTwItem extends TenantBaseDO {
|
|||||||
private Integer waresCount;
|
private Integer waresCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配件状态(01:已领料,02:未领料,03:已退料,04可确认领料,可确认退料 tw_item_status)
|
* 配件状态(01:已领料,02:未领料,03:已退料 tw_item_status)
|
||||||
*/
|
*/
|
||||||
private String waresStatus;
|
private String waresStatus;
|
||||||
|
|
||||||
@ -57,10 +57,4 @@ public class DlTwItem extends TenantBaseDO {
|
|||||||
|
|
||||||
/** 客户是否可见(字典yes_no);已存在于系统中(是:1,否:0) */
|
/** 客户是否可见(字典yes_no);已存在于系统中(是:1,否:0) */
|
||||||
private String isShow;
|
private String isShow;
|
||||||
|
|
||||||
/** 可领取数量 */
|
|
||||||
private Integer waresCouldCount;
|
|
||||||
|
|
||||||
/** 已领料数量 */
|
|
||||||
private Integer waresAlreadyCount;
|
|
||||||
}
|
}
|
@ -259,11 +259,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
DlRepairTickets dlRepairTickets = baseMapper.selectById(id);
|
DlRepairTickets dlRepairTickets = baseMapper.selectById(id);
|
||||||
DlRepairTicketsRespVO result = BeanUtil.toBean(dlRepairTickets, DlRepairTicketsRespVO.class);
|
DlRepairTicketsRespVO result = BeanUtil.toBean(dlRepairTickets, DlRepairTicketsRespVO.class);
|
||||||
//查车辆
|
//查车辆
|
||||||
if (ObjectUtil.isNotEmpty(dlRepairTickets.getCarId())){
|
|
||||||
CarMainRespVO carInfo = carMainService.queryCarById(dlRepairTickets.getCarId());
|
CarMainRespVO carInfo = carMainService.queryCarById(dlRepairTickets.getCarId());
|
||||||
result.setCarInfo(carInfo);
|
result.setCarInfo(carInfo);
|
||||||
}
|
|
||||||
|
|
||||||
//查用户信息
|
//查用户信息
|
||||||
CustomerMain customerInfo = customerService.getCustomerById(dlRepairTickets.getUserId());
|
CustomerMain customerInfo = customerService.getCustomerById(dlRepairTickets.getUserId());
|
||||||
result.setCustomerInfo(customerInfo);
|
result.setCustomerInfo(customerInfo);
|
||||||
|
@ -36,7 +36,6 @@ import java.math.BigDecimal;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||||
@ -78,16 +77,15 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
@Resource
|
@Resource
|
||||||
@Lazy
|
@Lazy
|
||||||
private RepairWaresService repairWaresService;
|
private RepairWaresService repairWaresService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RepairWorkerService workerService;
|
private RepairWorkerService workerService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*
|
*
|
||||||
* @param reqVO 请求对象
|
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 12:01 2024/10/15
|
* @date 12:01 2024/10/15
|
||||||
|
* @param reqVO 请求对象
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public IPage<DlTicketWares> getPage(DlTicketWaresReqVO reqVO, Page<DlTicketWares> page){
|
public IPage<DlTicketWares> getPage(DlTicketWaresReqVO reqVO, Page<DlTicketWares> page){
|
||||||
@ -151,9 +149,9 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
/**
|
/**
|
||||||
* 新增、修改
|
* 新增、修改
|
||||||
*
|
*
|
||||||
* @param respVO 请求对象
|
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 12:14 2024/10/15
|
* @date 12:14 2024/10/15
|
||||||
|
* @param respVO 请求对象
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
@DSTransactional
|
@DSTransactional
|
||||||
@ -175,9 +173,9 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*
|
*
|
||||||
* @param id id
|
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 12:21 2024/10/15
|
* @date 12:21 2024/10/15
|
||||||
|
* @param id id
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
@DSTransactional
|
@DSTransactional
|
||||||
@ -191,9 +189,9 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
/**
|
/**
|
||||||
* 审核
|
* 审核
|
||||||
*
|
*
|
||||||
* @param respVO 请求对象
|
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 21:15 2024/10/15
|
* @date 21:15 2024/10/15
|
||||||
|
* @param respVO 请求对象
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
@DSTransactional
|
@DSTransactional
|
||||||
@ -282,84 +280,43 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
/**
|
/**
|
||||||
* 仓库通知领料
|
* 仓库通知领料
|
||||||
*
|
*
|
||||||
* @param respVO 请求对象
|
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 20:45 2024/10/16
|
* @date 20:45 2024/10/16
|
||||||
|
* @param respVO 请求对象
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
@DSTransactional
|
@DSTransactional
|
||||||
public void passTicketWares(DlTicketWaresRespVO respVO){
|
public void passTicketWares(DlTicketWaresRespVO respVO){
|
||||||
// 查工单子表中的配件信息
|
// 查工单子表中的配件信息
|
||||||
List<DlRepairTitem> list = repairTitemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(i -> {
|
List<DlRepairTitem> list = repairTitemService.list(new LambdaQueryWrapper<DlRepairTitem>()
|
||||||
i.eq(DlRepairTitem::getTicketId, respVO.getTicketId())
|
.eq(DlRepairTitem::getTicketId, respVO.getTicketId())
|
||||||
.in(DlRepairTitem::getPartId, respVO.getRepairSois()
|
.in(DlRepairTitem::getPartId, respVO.getRepairSois()
|
||||||
.stream()
|
.stream()
|
||||||
.map(DlRepairSoi::getGoodsId)
|
.map(DlRepairSoi::getGoodsId)
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList())));
|
||||||
})
|
|
||||||
);
|
|
||||||
// 计算总价 (通知领料的数量可能和请求的不一样,所以需要这样计算)
|
|
||||||
BigDecimal reduce = list.stream()
|
|
||||||
/*
|
|
||||||
item:维修工单子表中的每一个配件
|
|
||||||
map中是找到与item对应的领料单子表的配件,记soi
|
|
||||||
将item的价格设置给soi的价格
|
|
||||||
*/
|
|
||||||
.map(item -> {
|
|
||||||
DlRepairSoi repairSoi = respVO.getRepairSois().stream()
|
|
||||||
.filter(i -> i.getGoodsId().equals(item.getPartId())).findFirst()
|
|
||||||
.orElse(null);
|
|
||||||
if (repairSoi != null) {
|
|
||||||
repairSoi.setGoodsPrice(item.getItemPrice());
|
|
||||||
}
|
|
||||||
return repairSoi;
|
|
||||||
})
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
// 计算soi的价格
|
|
||||||
.map(i -> new BigDecimal(i.getGoodsCount()).multiply(i.getGoodsPrice()))
|
|
||||||
// 计算总价
|
// 计算总价
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal reduce = list.stream().map(DlRepairTitem::getItemMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
// 生成领料单
|
|
||||||
respVO.getRepairSo().setTotalPrice(reduce);
|
|
||||||
respVO.getRepairSo().setItemCount(list.size());
|
respVO.getRepairSo().setItemCount(list.size());
|
||||||
|
respVO.getRepairSo().setTotalPrice(reduce);
|
||||||
|
// 生成领料单
|
||||||
repairSoService.save(respVO.getRepairSo());
|
repairSoService.save(respVO.getRepairSo());
|
||||||
// 生成领料单子表
|
// 生成领料单子表
|
||||||
respVO.getRepairSois().forEach(item -> {
|
respVO.getRepairSois().forEach(item -> {
|
||||||
item.setSoId(respVO.getRepairSo().getId());
|
item.setSoId(respVO.getRepairSo().getId());
|
||||||
|
DlRepairTitem titem = list.stream().filter(i -> i.getPartId().equals(item.getGoodsId())).collect(Collectors.toList()).get(0);
|
||||||
|
item.setGoodsPrice(titem.getItemPrice());
|
||||||
});
|
});
|
||||||
repairSoiService.saveBatch(respVO.getRepairSois());
|
repairSoiService.saveBatch(respVO.getRepairSois());
|
||||||
// 更新配件申请子表
|
// 更新领料申请子表
|
||||||
/*
|
twItemService.updateBatchById(respVO.getItems());
|
||||||
同理,通知领料的数量可能与实际需要的数量不一致,需要重新计算状态
|
|
||||||
*/
|
|
||||||
// 先查老数据
|
|
||||||
List<DlTwItem> oldData = twItemService.list(new LambdaQueryWrapper<DlTwItem>().in(DlTwItem::getId, respVO.getItems().stream().map(DlTwItem::getId).collect(Collectors.toList())));
|
|
||||||
// 构造新数据
|
|
||||||
List<DlTwItem> newData = oldData.stream().map(item -> {
|
|
||||||
DlTwItem dlTwItem = new DlTwItem();
|
|
||||||
dlTwItem.setId(item.getId());
|
|
||||||
respVO.getRepairSois().stream()
|
|
||||||
.filter(i -> i.getGoodsId().equals(item.getWaresId()))
|
|
||||||
.findFirst()
|
|
||||||
.ifPresent(repairSoi -> {
|
|
||||||
dlTwItem.setWaresCouldCount(repairSoi.getGoodsCount());
|
|
||||||
dlTwItem.setWaresStatus(repairSoi.getGoodsCount().equals(item.getWaresCount()) ? "04" : item.getWaresStatus());
|
|
||||||
});
|
|
||||||
return dlTwItem;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
twItemService.updateBatchById(newData);
|
|
||||||
|
|
||||||
// 通知维修工
|
|
||||||
// 查维修工的userId
|
|
||||||
repairWorkerService.sentMessage(respVO.getRepairId(), "您有新的领料单需要确认");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 员工确认领料
|
* 员工确认领料
|
||||||
*
|
*
|
||||||
* @param respVO 请求对象
|
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 22:07 2024/10/16
|
* @date 22:07 2024/10/16
|
||||||
|
* @param respVO 请求对象
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
@DSTransactional
|
@DSTransactional
|
||||||
@ -384,9 +341,9 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
/**
|
/**
|
||||||
* 仓库确认退料
|
* 仓库确认退料
|
||||||
*
|
*
|
||||||
* @param respVO 请求对象
|
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 22:03 2024/10/17
|
* @date 22:03 2024/10/17
|
||||||
|
* @param respVO 请求对象
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public void passBackTicketWares(DlTicketWaresRespVO respVO){
|
public void passBackTicketWares(DlTicketWaresRespVO respVO){
|
||||||
|
@ -6,13 +6,11 @@ import cn.iocoder.yudao.module.project.entity.RepairWares;
|
|||||||
import cn.iocoder.yudao.module.project.service.RepairWaresService;
|
import cn.iocoder.yudao.module.project.service.RepairWaresService;
|
||||||
import cn.iocoder.yudao.module.tickets.entity.DlTwItem;
|
import cn.iocoder.yudao.module.tickets.entity.DlTwItem;
|
||||||
import cn.iocoder.yudao.module.tickets.mapper.DlTwItemMapper;
|
import cn.iocoder.yudao.module.tickets.mapper.DlTwItemMapper;
|
||||||
import cn.iocoder.yudao.module.tickets.service.DlTicketWaresService;
|
|
||||||
import cn.iocoder.yudao.module.tickets.service.DlTwItemService;
|
import cn.iocoder.yudao.module.tickets.service.DlTwItemService;
|
||||||
import cn.iocoder.yudao.module.tickets.vo.DlTwItemReqVO;
|
import cn.iocoder.yudao.module.tickets.vo.DlTwItemReqVO;
|
||||||
import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO;
|
import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -32,10 +30,6 @@ public class DlTwItemServiceImpl extends ServiceImpl<DlTwItemMapper, DlTwItem>
|
|||||||
@Resource
|
@Resource
|
||||||
private RepairWaresService repairWaresService;
|
private RepairWaresService repairWaresService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
@Lazy
|
|
||||||
private DlTicketWaresService ticketWaresService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据主表查看全部
|
* 根据主表查看全部
|
||||||
*
|
*
|
||||||
|
@ -209,22 +209,11 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="map.userIds != null and map.userIds.size > 0">
|
<if test="map.userIds != null and map.userIds.size > 0">
|
||||||
and (drt.tickets_status = '05')
|
and (drt.tickets_status = '05')
|
||||||
<choose>
|
|
||||||
<when test="map.isFinish == '0'">
|
|
||||||
and (drt.now_repair_id in
|
and (drt.now_repair_id in
|
||||||
<foreach collection="map.userIds" item="item" index="index" open="(" separator="," close=")">
|
<foreach collection="map.userIds" item="item" index="index" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
)
|
)
|
||||||
</when>
|
|
||||||
<when test="map.isFinish == '1'">
|
|
||||||
and (
|
|
||||||
<foreach item="item" collection="map.userIds" index="index" open="" separator="or" close="">
|
|
||||||
find_in_set(#{item}, drti.repair_ids) > 0
|
|
||||||
</foreach>
|
|
||||||
)
|
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
</if>
|
</if>
|
||||||
order by drt.create_time desc
|
order by drt.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
@ -13,15 +13,13 @@
|
|||||||
<result property="waresStatus" column="wares_status" jdbcType="VARCHAR"/>
|
<result property="waresStatus" column="wares_status" jdbcType="VARCHAR"/>
|
||||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||||
<result property="isShow" column="is_show" />
|
<result property="isShow" column="is_show" />
|
||||||
<result property="waresCouldCount" column="wares_could_count" />
|
|
||||||
<result property="waresAlreadyCount" column="wares_already_count" />
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_SQL">
|
<sql id="Base_SQL">
|
||||||
select
|
select
|
||||||
id,tw_id,wares_id,
|
id,tw_id,wares_id,
|
||||||
wares_name,wares_count,wares_status,remark,
|
wares_name,wares_count,wares_status,remark,
|
||||||
is_show,wares_could_count, wares_already_count
|
is_show
|
||||||
from dl_tw_item dti
|
from dl_tw_item dti
|
||||||
where dti.deleted = '0'
|
where dti.deleted = '0'
|
||||||
</sql>
|
</sql>
|
||||||
|
Loading…
Reference in New Issue
Block a user