diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CarMainController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CarMainController.java index 4026042e..4d5fa91c 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CarMainController.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CarMainController.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.custom.controller.admin; +import cn.hutool.core.collection.CollectionUtil; import cn.iocoder.yudao.module.custom.entity.CarMain; import cn.iocoder.yudao.module.custom.service.CarMainService; import cn.iocoder.yudao.module.custom.service.UserCarService; @@ -215,8 +216,10 @@ public class CarMainController { @PostMapping("/getByLicenseNumber") @Operation(summary = "根据车牌查单条记录") public CommonResult getByLicenseNumber(@RequestBody CarMain carMain) { - CarMain one = carMainService.getOne(new LambdaQueryWrapper().eq(CarMain::getLicenseNumber, carMain.getLicenseNumber())); - return success(one); + // 可能查到多条,只用一条就是,理论上讲是不会有多条的 +// CarMain one = carMainService.list(new LambdaQueryWrapper().eq(CarMain::getLicenseNumber, carMain.getLicenseNumber())); + List list = carMainService.list(new LambdaQueryWrapper().eq(CarMain::getLicenseNumber, carMain.getLicenseNumber()).last("limit 1")); + return success(CollectionUtil.isNotEmpty(list) ? list.get(0) : null); } /** diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/TicketsServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/TicketsServiceImpl.java index c7655f73..59e73fd7 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/TicketsServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/TicketsServiceImpl.java @@ -29,7 +29,8 @@ public class TicketsServiceImpl extends ServiceImpl impl baseMapper.update(new LambdaUpdateWrapper() .in(Tickets::getId, ticketIds) .set(Tickets::getTicketsStatus, "02") - .set(Tickets::getIsFinish, "1") + // 不在这儿结束 +// .set(Tickets::getIsFinish, "1") ); } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java index 6e420e7f..f4cef3dc 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java @@ -242,7 +242,8 @@ public class DlRepairSoServiceImpl extends ServiceImpl i.getGoodsId().equals(item.getWaresId())).findFirst().ifPresent(repairSoiByTwItem -> { if (so.getSoType().equals("02")){ dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoiByTwItem.getGoodsCount()); - dlTwItem.setWaresStatus("02"); + // 不操作配件申请表子表的状态 +// dlTwItem.setWaresStatus("02"); }else { dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() + repairSoiByTwItem.getGoodsCount()); } @@ -325,13 +326,13 @@ public class DlRepairSoServiceImpl extends ServiceImpl list = twItemService.list(new LambdaQueryWrapper().eq(DlTwItem::getTwId, so.getTwId())); - // 判断是部分完成还是全部完成 - DlTicketWares dlTicketWares = new DlTicketWares(); - dlTicketWares.setId(so.getTwId()); - List flag = list.stream().filter(item -> !item.getWaresStatus().equals("01")).collect(Collectors.toList()); - dlTicketWares.setStatus(CollectionUtil.isEmpty(flag) ? "03" : "04"); + // 判断是部分完成还是全部完成----不需要判断了 +// DlTicketWares dlTicketWares = new DlTicketWares(); +// dlTicketWares.setId(so.getTwId()); +// List flag = list.stream().filter(item -> !item.getWaresStatus().equals("01")).collect(Collectors.toList()); +// dlTicketWares.setStatus(CollectionUtil.isEmpty(flag) ? "03" : "04"); // 更新主表的状态 - ticketWaresService.updateById(dlTicketWares); +// ticketWaresService.updateById(dlTicketWares); // 通知仓库 repairWorkerService.sentMessage(Long.valueOf(so.getCreator()), so.getUserName() + "已确认领料单:" + so.getSoNo()); @@ -447,8 +448,8 @@ public class DlRepairSoServiceImpl extends ServiceImpl hasPrice(@RequestParam("id")String id){ + return success(dlRepairTicketsService.hasPrice(id)); + } + /** * 新增工单子项 * diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java index 64af5c95..cfe2fc56 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java @@ -243,4 +243,13 @@ public interface DlRepairTicketsService extends IService { * @param respVO **/ void overOrder(DlRepairTicketsRespVO respVO); + + /** + * 判断是否工单子表的任何一个类目没有价格或价格为0 + * + * @param id 工单ID + * @author 小李 + * @date 15:00 2024/11/16 + **/ + Boolean hasPrice(String id); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 3efcceb2..d36d62e7 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -222,7 +222,6 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl { item.setTicketId(ticketsRespVO.getId()); - if(null==item.getSaleId()){ + if (null == item.getSaleId()) { //默认销售人员是当前用户 item.setSaleId(loginUser.getId()); item.setSaleName(loginUser.getInfo().get("nickname")); @@ -415,7 +414,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl() .set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.RECEIVED.getCode()) @@ -1007,16 +1007,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl list = repairWorkerService.list(); //查询当前工单下所有项目 LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(DlRepairTitem::getTicketId,ticketId); + lambdaQueryWrapper.eq(DlRepairTitem::getTicketId, ticketId); List itemList = titemService.list(lambdaQueryWrapper); //过滤出不包括当前指派人的值 List filterList = itemList.stream().filter(item -> !item.getRepairNames().contains(nowRepairName)).collect(Collectors.toList()); List saveList = new ArrayList<>(); //当前处理人工作组 - Map workerMap = list.stream().collect(Collectors.toMap(RepairWorker::getUserId,worker -> worker)); + Map workerMap = list.stream().collect(Collectors.toMap(RepairWorker::getUserId, worker -> worker)); String workType = workerMap.get(nowRepairId).getWorkType(); filterList.forEach(item -> { //深拷贝 - DlRepairTitem saveItem = BeanUtils.toBean(item,DlRepairTitem.class); - if (StringUtils.isNotEmpty(saveItem.getRepairIds())){ + DlRepairTitem saveItem = BeanUtils.toBean(item, DlRepairTitem.class); + if (StringUtils.isNotEmpty(saveItem.getRepairIds())) { //取出用户id List repairIds = Arrays.stream(saveItem.getRepairIds().split(",")).map(Long::parseLong).collect(Collectors.toList()); repairIds.forEach(idItem -> { @@ -1062,7 +1063,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl { - String newRepairId = item.getRepairIds()+","+nowRepairId; + String newRepairId = item.getRepairIds() + "," + nowRepairId; String newRepairName = item.getRepairNames() + "," + nowRepairName; item.setRepairIds(newRepairId); item.setRepairNames(newRepairName); @@ -1123,7 +1124,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()).last("limit 1")); List dataList = dictDataApi.getDictDataList("repair_work_type"); @@ -1282,11 +1283,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl() - // 因为完成状态需要在交车之后,所以注掉这个 + // 因为完成状态需要在交车之后,所以注掉这个 // .set(DlRepairTickets::getIsFinish, "1") - .setSql("now_repair_id = adviser_id") - .setSql("now_repair_name = adviser_name") - .eq(DlRepairTickets::getId, respVO.getId()) + .setSql("now_repair_id = adviser_id") + .setSql("now_repair_name = adviser_name") + .eq(DlRepairTickets::getId, respVO.getId()) ); boolean flag = syncTicketWaresToTicket(respVO.getId()); @@ -1469,6 +1470,29 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl titems = titemService.list(new LambdaQueryWrapper().in(DlRepairTitem::getTicketId, id)); + for (DlRepairTitem item : titems) { + // 如果有为空的,直接报错 + if (ObjectUtil.isEmpty(item.getItemPrice())) { + throw exception0(500, "工单中有项目或配件没有设置价格,请服务顾问填写项目价格,仓库填写配件价格"); + } + // 如果有为0的,那就提示,让操作人选择 + if (item.getItemPrice().equals(new BigDecimal("0.00"))){ + return false; + } + } + return true; + } + /** * 重新计算工单的一些数值,子表也要重新计算 * @@ -1715,7 +1739,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl