From 51fad285f6dada8e1b40699e381b7bfda0779c77 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Wed, 16 Oct 2024 22:39:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=93=E5=BA=93=E5=A4=84=E7=90=86=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E3=80=81=E5=91=98=E5=B7=A5=E7=A1=AE=E8=AE=A4=E9=A2=86?= =?UTF-8?q?=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iocoder/yudao/common/RepairConstants.java | 2 + .../admin/DlTicketWaresController.java | 28 ++++++++ .../tickets/service/DlTicketWaresService.java | 18 +++++ .../impl/DlRepairTicketsServiceImpl.java | 4 ++ .../impl/DlTicketWaresServiceImpl.java | 70 +++++++++++++++++++ .../module/tickets/vo/DlTicketWaresReqVO.java | 3 + .../tickets/vo/DlTicketWaresRespVO.java | 8 +++ .../mapper/tickets/DlTicketWaresMapper.xml | 9 +++ 8 files changed, 142 insertions(+) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairConstants.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairConstants.java index e14f8296..0a74788c 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairConstants.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RepairConstants.java @@ -16,4 +16,6 @@ public class RepairConstants { public static final String REPAIR_STAFF = "维修工"; + public static final String REPAIR_WAREHOUSE = "维修仓库管理员"; + } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTicketWaresController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTicketWaresController.java index afb97f4f..b78e3853 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTicketWaresController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlTicketWaresController.java @@ -87,5 +87,33 @@ public class DlTicketWaresController { dlTicketWaresService.auditTicketWares(respVO); return CommonResult.ok(); } + + /** + * 仓库通知领料 + * + * @author 小李 + * @date 20:45 2024/10/16 + * @param respVO 请求对象 + **/ + @PostMapping("/pass") + @Operation(summary = "仓库通知领料") + public CommonResult passTicketWares(@RequestBody DlTicketWaresRespVO respVO){ + dlTicketWaresService.passTicketWares(respVO); + return CommonResult.ok(); + } + + /** + * 员工确认领料 + * + * @author 小李 + * @date 22:07 2024/10/16 + * @param respVO 请求对象 + **/ + @PostMapping("/repairPass") + @Operation(summary = "员工确认领料") + public CommonResult repairPassTicketWares(@RequestBody DlTicketWaresRespVO respVO){ + dlTicketWaresService.repairPassTicketWares(respVO); + return CommonResult.ok(); + } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlTicketWaresService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlTicketWaresService.java index 543123d5..ba5d44d3 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlTicketWaresService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlTicketWaresService.java @@ -50,4 +50,22 @@ public interface DlTicketWaresService extends IService { * @param respVO 请求对象 **/ void auditTicketWares(DlTicketWaresRespVO respVO); + + /** + * 仓库通知领料 + * + * @author 小李 + * @date 20:45 2024/10/16 + * @param respVO 请求对象 + **/ + void passTicketWares(DlTicketWaresRespVO respVO); + + /** + * 员工确认领料 + * + * @author 小李 + * @date 22:07 2024/10/16 + * @param respVO 请求对象 + **/ + void repairPassTicketWares(DlTicketWaresRespVO respVO); } 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 6e6736d2..00e45845 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 @@ -452,6 +452,10 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl list = repairTitemService.list(new LambdaQueryWrapper() + .eq(DlRepairTitem::getTicketId, respVO.getTicketId()) + .in(DlRepairTitem::getPartId, respVO.getRepairSois() + .stream() + .map(DlRepairSoi::getGoodsId) + .collect(Collectors.toList()))); + // 计算总价 + BigDecimal reduce = list.stream().map(DlRepairTitem::getItemMoney).reduce(BigDecimal.ZERO, BigDecimal::add); + respVO.getRepairSo().setItemCount(list.size()); + respVO.getRepairSo().setTotalPrice(reduce); + // 生成领料单 + repairSoService.save(respVO.getRepairSo()); + // 生成领料单子表 + respVO.getRepairSois().forEach(item -> { + 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()); + // 更新领料申请子表 + twItemService.updateBatchById(respVO.getItems()); + } + + /** + * 员工确认领料 + * + * @author 小李 + * @date 22:07 2024/10/16 + * @param respVO 请求对象 + **/ + @Override + @DSTransactional + public void repairPassTicketWares(DlTicketWaresRespVO respVO){ + // 更新领料申请子表 + twItemService.updateBatchById(respVO.getItems()); + // 更新领料申请表 + // 判断是全部完成完成部分完成 + List list = twItemService.list(new LambdaQueryWrapper().eq(DlTwItem::getTwId, respVO.getId())); + List list1 = list.stream().filter(item -> item.getWaresStatus().equals("01")).collect(Collectors.toList()); + respVO.setStatus(list1.size() == list.size() ? "03" : "04"); + baseMapper.updateById(respVO); + } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlTicketWaresReqVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlTicketWaresReqVO.java index 82f0dac8..ff5b88d5 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlTicketWaresReqVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlTicketWaresReqVO.java @@ -19,4 +19,7 @@ public class DlTicketWaresReqVO extends DlTicketWares { /** 查询的时候用,班组长和维修工 */ private List userIds; + + /** 角色 */ + private Integer userRole; } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlTicketWaresRespVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlTicketWaresRespVO.java index fb97629a..64a5b953 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlTicketWaresRespVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlTicketWaresRespVO.java @@ -1,5 +1,7 @@ package cn.iocoder.yudao.module.tickets.vo; +import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo; +import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi; import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem; import cn.iocoder.yudao.module.tickets.entity.DlTicketWares; import cn.iocoder.yudao.module.tickets.entity.DlTwItem; @@ -21,4 +23,10 @@ public class DlTicketWaresRespVO extends DlTicketWares { /** 工单子表需要的记录 */ private List wares; + + /** 领料、采购单 */ + private DlRepairSo repairSo; + + /** 领料、采购单子表 */ + private List repairSois; } diff --git a/dl-module-repair/src/main/resources/mapper/tickets/DlTicketWaresMapper.xml b/dl-module-repair/src/main/resources/mapper/tickets/DlTicketWaresMapper.xml index ceb61f46..e83cffff 100644 --- a/dl-module-repair/src/main/resources/mapper/tickets/DlTicketWaresMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/tickets/DlTicketWaresMapper.xml @@ -56,6 +56,15 @@ ) + + and ( + + + dtw.status not in ('01', '05', '03') + + + ) + and (dtw.adviser_id = #{map.adviserId})