This commit is contained in:
PQZ 2024-10-30 20:04:51 +08:00
parent 4eec824adf
commit e590c3921c
3 changed files with 22 additions and 5 deletions

View File

@ -440,7 +440,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
// 新增车辆信息 // 新增车辆信息
if (ObjectUtil.isNotEmpty(customerAndCarVO.getCarInfo())) { if (ObjectUtil.isNotEmpty(customerAndCarVO.getCarInfo())) {
if (ObjectUtil.isEmpty(customerAndCarVO.getCarInfo().getId())) { if (ObjectUtil.isEmpty(customerAndCarVO.getCarInfo().getId())) {
customerAndCarVO.getCarInfo().setUserId(Long.valueOf(customerAndCarVO.getUserInfo().getId())); customerAndCarVO.getCarInfo().setUserId(customerAndCarVO.getUserInfo().getUserId());
carMainService.createCarMain(customerAndCarVO.getCarInfo()); carMainService.createCarMain(customerAndCarVO.getCarInfo());
} else { } else {
carMainService.updateCarMain(customerAndCarVO.getCarInfo()); carMainService.updateCarMain(customerAndCarVO.getCarInfo());

View File

@ -245,9 +245,13 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
// 如果是通过并且是领料就还需要把配件信息加入到工单中 // 如果是通过并且是领料就还需要把配件信息加入到工单中
if (ObjectUtil.isNotEmpty(status) && status.equals("02") && type.equals("01")) { if (ObjectUtil.isNotEmpty(status) && status.equals("02") && type.equals("01")) {
// 更新维修工单 // 更新维修工单
if (null == repairItemList || repairItemList.isEmpty()) { if(null!=respVO.getRepairWaresList()){
repairItemList = new ArrayList<>(); repairItemList= new ArrayList<>();
//配件没传去库里面查需要的配件 //走的是更新配件库价格
Map<String,BigDecimal> updateMap = respVO.getRepairWaresList().stream().collect(Collectors.toMap(RepairWares::getId,RepairWares::getPrice));
//更新配件库的价格
List<RepairWares> updateWaresList = new ArrayList<>();
//去库里面查需要的配件
LambdaQueryWrapper<DlTwItem> queryWrapper = new LambdaQueryWrapper<DlTwItem>() LambdaQueryWrapper<DlTwItem> queryWrapper = new LambdaQueryWrapper<DlTwItem>()
.eq(DlTwItem::getTwId, mainId); .eq(DlTwItem::getTwId, mainId);
List<DlTwItem> applyList = twItemService.list(queryWrapper); List<DlTwItem> applyList = twItemService.list(queryWrapper);
@ -262,7 +266,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
repairTitem.setItemCount(item.getWaresCount()); repairTitem.setItemCount(item.getWaresCount());
repairTitem.setItemName(item.getWaresName()); repairTitem.setItemName(item.getWaresName());
repairTitem.setItemUnit(waresMap.get(item.getWaresId()).getUnit()); repairTitem.setItemUnit(waresMap.get(item.getWaresId()).getUnit());
repairTitem.setItemPrice(waresMap.get(item.getWaresId()).getPrice()); //取前端传过来的销售价格
repairTitem.setItemPrice(updateMap.get(item.getId()));
//默认不打折为1 //默认不打折为1
repairTitem.setItemDiscount(new BigDecimal(1)); repairTitem.setItemDiscount(new BigDecimal(1));
repairTitem.setItemMoney(new BigDecimal(repairTitem.getItemCount()).multiply(repairTitem.getItemPrice())); repairTitem.setItemMoney(new BigDecimal(repairTitem.getItemCount()).multiply(repairTitem.getItemPrice()));
@ -271,8 +276,16 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
repairTitem.setPartId(item.getWaresId()); repairTitem.setPartId(item.getWaresId());
repairTitem.setItemStatus(TicketsItemStatusEnum.WAITING_RECEIVE.getCode()); repairTitem.setItemStatus(TicketsItemStatusEnum.WAITING_RECEIVE.getCode());
repairItemList.add(repairTitem); repairItemList.add(repairTitem);
//组装配件库更新价格
RepairWares update = new RepairWares();
update.setId(item.getWaresId());
update.setPrice(updateMap.get(item.getId()));
updateWaresList.add(update);
} }
} }
if(!updateWaresList.isEmpty()){
repairWaresService.updateBatchById(updateWaresList);
}
} }
// 这里是重新计算维修工单中的配件相关的信息写了一个公共的重新计算工单的方法替换掉 // 这里是重新计算维修工单中的配件相关的信息写了一个公共的重新计算工单的方法替换掉
// // 计算配件的总价 // // 计算配件的总价

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.tickets.vo; package cn.iocoder.yudao.module.tickets.vo;
import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo; import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi; import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem; import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
@ -29,4 +30,7 @@ public class DlTicketWaresRespVO extends DlTicketWares {
/** 领料、采购单子表 */ /** 领料、采购单子表 */
private List<DlRepairSoi> repairSois; private List<DlRepairSoi> repairSois;
/** 更新配件库子表价格 */
private List<RepairWares> repairWaresList;
} }