From c08da4f069bdc39f968c2b0f5bb67ea3061587ae Mon Sep 17 00:00:00 2001 From: zhc077 <565291854> Date: Wed, 29 Mar 2023 15:29:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E8=AE=A1=E5=88=92=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=96-=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96=203.29?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ZyProductPlanController.java | 35 +-- .../impl/IZyProductPlanAutoServiceImpl.java | 238 +++++++++--------- .../impl/ZyPlanProcessServiceImpl.java | 44 ++-- .../impl/ZyProductPlanServiceImpl.java | 14 +- 4 files changed, 178 insertions(+), 153 deletions(-) diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanController.java index e4c1e3e3..169a5c0b 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanController.java @@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.modules.productplan.entity.ZyProductPlan; @@ -35,6 +36,7 @@ import javax.jws.Oneway; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Arrays; +import java.util.Optional; /** * @Description: 生产计划 @@ -52,13 +54,9 @@ public class ZyProductPlanController extends JeecgController add(@RequestBody ZyProductPlan zyProductPlan) { -// String productCode = zyProductPlan.getProductCode(); -// ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper().eq(ZyProduct::getWorkOrderId, productCode)); -// zyProductPlan.setProductNo(StringUtils.isNotBlank(zyProduct.getProductCode()) ? zyProduct.getProductCode() : ""); -// zyProductPlan.setProductName(StringUtils.isNotBlank(zyProduct.getProductName()) ? zyProduct.getProductName() : ""); -// if (StringUtils.isNotBlank(zyProduct.getEnterprisesId())) { -// SysDepart sysDepart = iSysDepartService.getById(zyProduct.getEnterprisesId()); -// zyProductPlan.setProductOrg(StringUtils.isNotBlank(sysDepart.getDepartName()) ? sysDepart.getDepartName() : ""); -// } -// SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper().eq(SysUser::getRealname, zyProductPlan.getTeamLeader())); -// zyProductPlan.setTeamLeader(sysUser.getUsername()); -// zyProductPlanService.save(zyProductPlan); -// -// //更新work_order表work_order_status为“1” (不能为其新增生产计划) -// iWorkOrderService.lambdaUpdate().set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.REVIEWED.getCode()).update(); zyProductPlanService.create(zyProductPlan); return Result.OK("添加成功!"); } @@ -127,6 +111,8 @@ public class ZyProductPlanController extends JeecgController edit(@RequestBody ZyProductPlan zyProductPlan) { + SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper().eq(SysUser::getRealname, zyProductPlan.getTeamLeader())); + zyProductPlan.setTeamLeader(sysUser.getUsername()); zyProductPlanService.updateById(zyProductPlan); return Result.OK("编辑成功!"); } @@ -141,9 +127,14 @@ public class ZyProductPlanController extends JeecgController delete(@RequestParam(name = "id", required = true) String id) { + ZyProductPlan zyProductPlan = zyProductPlanService.getById(id); + Optional.ofNullable(zyProductPlan).orElseThrow(() -> new JeecgBootException("生产计划不存在")); zyProductPlanService.removeById(id); //更新work_order表work_order_status为“0” (可以为其新增生产计划) - iWorkOrderService.lambdaUpdate().set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.UNAUDITED.getCode()).update(); + iWorkOrderService.lambdaUpdate() + .set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.UNAUDITED.getCode()) + .eq(WorkOrder::getProductCode, zyProductPlan.getProductCode()) + .update(); return Result.OK("删除成功!"); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/IZyProductPlanAutoServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/IZyProductPlanAutoServiceImpl.java index ac9475f9..67f7fcd5 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/IZyProductPlanAutoServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/IZyProductPlanAutoServiceImpl.java @@ -88,73 +88,79 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl zyProductPlanProductCodes = new LinkedHashSet<>(); + Set zyProductPlanProductNos = new LinkedHashSet<>(); List sysDepartList = iSysDepartService.list(new LambdaQueryWrapper().eq(SysDepart::getOrgCategory, "2")); List sysDepartList2 = this.copyList(workOrderList, sysDepartList); AtomicInteger i = new AtomicInteger(0); workOrderList.stream().forEach(e -> { - String productCode = e.getProductCode(); - ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper() - .eq(ZyProduct::getWorkOrderId, productCode)); - Optional.ofNullable(zyProduct).orElseThrow(() -> new JeecgBootException(productCode + ":产品不存在")); - - //2,保存生产计划 - ZyProductPlan zyProductPlan = new ZyProductPlan(); - zyProductPlan.setProductCode(productCode); - zyProductPlan.setProductNo(zyProduct.getProductCode()); - zyProductPlan.setProductName(zyProduct.getProductName()); - - if (StringUtils.isNotBlank(zyProduct.getEnterprisesId())) { - SysDepart sysDepart = iSysDepartService.getById(zyProduct.getEnterprisesId()); - //生产企业 - zyProductPlan.setProductOrg(StringUtils.isNotBlank(sysDepart.getDepartName()) ? sysDepart.getDepartName() : ""); - } - //生产时长,取zy_product表生产时间 - zyProductPlan.setDuration(zyProduct.getProduceTime()); - SysDepart sysDepart = sysDepartList2.get(i.get()); - i.set(i.get() + 1); - List sysDeparts = new LinkedList<>(); - sysDeparts.add(sysDepart.getId()); - List sysUserList = iSysUserService.getUserByDepIds(sysDeparts, null); - if (!ObjectUtils.isEmpty(sysUserList)) { - SysUser sysUser = sysUserList.get(0); - //车间负责人 - zyProductPlan.setResponsiblePerson(sysUser.getUsername()); - } - //车间 - zyProductPlan.setWorkshopId(sysDepart.getId()); - List groupxList = iGroupxService.list(new LambdaQueryWrapper().eq(Groupx::getDepartId, sysDepart.getId())); - if (!ObjectUtils.isEmpty(groupxList)) { - Groupx groupx = groupxList.get(0); - //班组 - zyProductPlan.setTeamId(groupx.getId()); - //班长 - SysUser sysUser = iSysUserService.getById(groupx.getEnterprisesManager()); - zyProductPlan.setTeamLeader(sysUser.getUsername()); + //工单id + String workOrderId = e.getId(); + //一个工单对应一个产品 + ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper().eq(ZyProduct::getWorkOrderId, workOrderId)); + if (!ObjectUtils.isEmpty(zyProduct)) { + //2,保存生产计划 + ZyProductPlan zyProductPlan = new ZyProductPlan(); + //工单编号 + zyProductPlan.setProductCode(e.getProductCode()); + //产品编号 + zyProductPlan.setProductNo(zyProduct.getProductCode()); + zyProductPlan.setProductName(zyProduct.getProductName()); + + if (StringUtils.isNotBlank(zyProduct.getEnterprisesId())) { + SysDepart sysDepart = iSysDepartService.getById(zyProduct.getEnterprisesId()); + //生产企业 + zyProductPlan.setProductOrg(StringUtils.isNotBlank(sysDepart.getDepartName()) ? sysDepart.getDepartName() : ""); + } + //生产时长,取zy_product表生产时间 + zyProductPlan.setDuration(zyProduct.getProduceTime()); + SysDepart sysDepart = sysDepartList2.get(i.get()); + i.set(i.get() + 1); + List sysDeparts = new LinkedList<>(); + sysDeparts.add(sysDepart.getId()); + List sysUserList = iSysUserService.getUserByDepIds(sysDeparts, null); + if (!ObjectUtils.isEmpty(sysUserList)) { + SysUser sysUser = sysUserList.get(0); + //车间负责人 + zyProductPlan.setResponsiblePerson(sysUser.getUsername()); + } + //车间 + zyProductPlan.setWorkshopId(sysDepart.getId()); + List groupxList = iGroupxService.list(new LambdaQueryWrapper().eq(Groupx::getDepartId, sysDepart.getId())); + if (!ObjectUtils.isEmpty(groupxList)) { + Groupx groupx = groupxList.get(0); + //班组 + zyProductPlan.setTeamId(groupx.getId()); + //班长 + SysUser sysUser = iSysUserService.getById(groupx.getEnterprisesManager()); + zyProductPlan.setTeamLeader(sysUser.getUsername()); + } + Date date = new Date(); + //开始时间 + zyProductPlan.setWorkTime(date); + //审核人 + zyProductPlan.setAuditBy("admin"); + //审核时间 + zyProductPlan.setAuditTimr(date); + //生产计划状态为未审核 + zyProductPlan.setStatus(new Integer(ProductPlanStatusEnum.UNAUDITED.getCode())); + //保存生产计划 + iZyProductPlanService.save(zyProductPlan); + + //更新work_order表work_order_status为“1” (不能为其新增生产计划) + iWorkOrderService.lambdaUpdate() + .set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.REVIEWED.getCode()) + .eq(WorkOrder::getProductCode, zyProductPlan.getProductCode()) + .update(); + zyProductPlanProductNos.add(zyProduct.getProductCode()); } - Date date = new Date(); - //开始时间 - zyProductPlan.setWorkTime(date); - //审核人 - zyProductPlan.setAuditBy("admin"); - //审核时间 - zyProductPlan.setAuditTimr(date); - //生产计划状态为未审核 - zyProductPlan.setStatus(new Integer(ProductPlanStatusEnum.UNAUDITED.getCode())); - //保存生产计划 - iZyProductPlanService.save(zyProductPlan); - - //更新work_order表work_order_status为“1” (不能为其新增生产计划) - iWorkOrderService.lambdaUpdate().set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.REVIEWED.getCode()).update(); - - zyProductPlanProductCodes.add(productCode); + }); - //根据productCode,查询本次创建生产计划 + //根据产品编号,查询本次创建成功的生产计划 List productPlanList = iZyProductPlanService.list(new LambdaQueryWrapper() .eq(ZyProductPlan::getStatus, ProductPlanStatusEnum.UNAUDITED.getCode()) - .in(ZyProductPlan::getStatus, zyProductPlanProductCodes)); + .in(ZyProductPlan::getProductNo, zyProductPlanProductNos)); return productPlanList; } @@ -168,72 +174,78 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl saveProductPlan4Mock(List workOrderList) { if (ObjectUtils.isEmpty(workOrderList)) return Collections.EMPTY_LIST; - Set zyProductPlanProductCodes = new LinkedHashSet<>(); + Set zyProductPlanProductNos = new LinkedHashSet<>(); /** * 模拟测试 车间、负责人、班组、组长使用固定值 */ workOrderList.stream().forEach(e -> { - String productCode = e.getProductCode(); + // 工单编号 + String productCode = e.getId(); ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper() - .eq(ZyProduct::getWorkOrderId, productCode)); - Optional.ofNullable(zyProduct).orElseThrow(() -> new JeecgBootException(productCode + ":产品不存在")); - - //2,保存生产计划 - ZyProductPlan zyProductPlan = new ZyProductPlan(); - zyProductPlan.setProductCode(productCode); - zyProductPlan.setProductNo(zyProduct.getProductCode()); - zyProductPlan.setProductName(zyProduct.getProductName()); - - if (StringUtils.isNotBlank(zyProduct.getEnterprisesId())) { - SysDepart sysDepart = iSysDepartService.getById(zyProduct.getEnterprisesId()); - //生产企业 - zyProductPlan.setProductOrg(StringUtils.isNotBlank(sysDepart.getDepartName()) ? sysDepart.getDepartName() : ""); + .eq(ZyProduct::getWorkOrderId, productCode) + ); + if (!ObjectUtils.isEmpty(zyProduct)) { + //2,保存生产计划 + ZyProductPlan zyProductPlan = new ZyProductPlan(); + zyProductPlan.setProductCode(e.getProductCode()); + zyProductPlan.setProductNo(zyProduct.getProductCode()); + zyProductPlan.setProductName(zyProduct.getProductName()); + + if (StringUtils.isNotBlank(zyProduct.getEnterprisesId())) { + SysDepart sysDepart = iSysDepartService.getById(zyProduct.getEnterprisesId()); + //生产企业 + zyProductPlan.setProductOrg(StringUtils.isNotBlank(sysDepart.getDepartName()) ? sysDepart.getDepartName() : ""); + } + //生产时长,取zy_product表生产时间 + zyProductPlan.setDuration(zyProduct.getProduceTime()); + + SysDepart sysDepart = iSysDepartService.getOne(new LambdaQueryWrapper() + .eq(SysDepart::getOrgCategory, "2") + .eq(SysDepart::getDepartName, "测试生产企业")); + if (ObjectUtils.isEmpty(sysDepart)) + throw new JeecgBootException("生产计划自动化-mock-[企业信息]数据异常!"); + + //车间 + zyProductPlan.setWorkshopId(sysDepart.getId()); + List sysDepartIds = new LinkedList<>(); + sysDepartIds.add(sysDepart.getId()); + List sysUserList = iSysUserService.getUserByDepIds(sysDepartIds, null); + //车间负责人 + zyProductPlan.setResponsiblePerson(sysUserList.get(0).getUsername()); + Groupx groupx = iGroupxService.getOne(new LambdaQueryWrapper().eq(Groupx::getDepartId, sysDepart.getId()).eq(Groupx::getGroupName, "测试班组")); + if (ObjectUtils.isEmpty(groupx)) throw new JeecgBootException("生产计划自动化-mock-[班组]数据异常!"); + //班组 + zyProductPlan.setTeamId(groupx.getId()); + //班长 + SysUser sysUser = iSysUserService.getById(groupx.getEnterprisesManager()); + zyProductPlan.setTeamLeader(sysUser.getUsername()); + Date date = new Date(); + //开始时间 + zyProductPlan.setWorkTime(date); + //审核人 + zyProductPlan.setAuditBy("admin"); + //审核时间 + zyProductPlan.setAuditTimr(date); + //生产计划状态为未审核 + zyProductPlan.setStatus(new Integer(ProductPlanStatusEnum.UNAUDITED.getCode())); + //保存生产计划 + iZyProductPlanService.save(zyProductPlan); + + //更新work_order表work_order_status为“1” (不能为其新增生产计划) + iWorkOrderService.lambdaUpdate() + .set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.REVIEWED.getCode()) + .eq(WorkOrder::getProductCode, zyProductPlan.getProductCode()) + .update(); + + zyProductPlanProductNos.add(zyProduct.getProductCode()); } - //生产时长,取zy_product表生产时间 - zyProductPlan.setDuration(zyProduct.getProduceTime()); - - SysDepart sysDepart = iSysDepartService.getOne(new LambdaQueryWrapper() - .eq(SysDepart::getOrgCategory, "2") - .eq(SysDepart::getDepartName, "测试生产企业")); - if (ObjectUtils.isEmpty(sysDepart)) throw new JeecgBootException("生产计划自动化-mock-[企业信息]数据异常!"); - - //车间 - zyProductPlan.setWorkshopId(sysDepart.getId()); - List sysDepartIds = new LinkedList<>(); - sysDepartIds.add(sysDepart.getId()); - List sysUserList = iSysUserService.getUserByDepIds(sysDepartIds, null); - //车间负责人 - zyProductPlan.setResponsiblePerson(sysUserList.get(0).getUsername()); - Groupx groupx = iGroupxService.getOne(new LambdaQueryWrapper().eq(Groupx::getDepartId, sysDepart.getId()).eq(Groupx::getGroupName, "测试班组")); - if (ObjectUtils.isEmpty(groupx)) throw new JeecgBootException("生产计划自动化-mock-[班组]数据异常!"); - //班组 - zyProductPlan.setTeamId(groupx.getId()); - //班长 - SysUser sysUser = iSysUserService.getById(groupx.getEnterprisesManager()); - zyProductPlan.setTeamLeader(sysUser.getUsername()); - Date date = new Date(); - //开始时间 - zyProductPlan.setWorkTime(date); - //审核人 - zyProductPlan.setAuditBy("admin"); - //审核时间 - zyProductPlan.setAuditTimr(date); - //生产计划状态为未审核 - zyProductPlan.setStatus(new Integer(ProductPlanStatusEnum.UNAUDITED.getCode())); - //保存生产计划 - iZyProductPlanService.save(zyProductPlan); - - //更新work_order表work_order_status为“1” (不能为其新增生产计划) - iWorkOrderService.lambdaUpdate().set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.REVIEWED.getCode()).update(); - - zyProductPlanProductCodes.add(productCode); }); //根据productCode,查询本次创建生产计划 List productPlanList = iZyProductPlanService.list(new LambdaQueryWrapper() .eq(ZyProductPlan::getStatus, ProductPlanStatusEnum.UNAUDITED.getCode()) - .in(ZyProductPlan::getStatus, zyProductPlanProductCodes)); + .eq(ZyProductPlan::getProductNo, zyProductPlanProductNos)); return productPlanList; } @@ -270,9 +282,9 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl productPlanList = this.saveProductPlan(workOrderList); + List productPlanList = this.saveProductPlan(workOrderList); //TODO - List productPlanList = this.saveProductPlan4Mock(workOrderList); +// List productPlanList = this.saveProductPlan4Mock(workOrderList); if (ObjectUtils.isEmpty(productPlanList)) return Collections.EMPTY_LIST; //3,同步计划生产工序、同步生产计划工序面料、同步生产计划辅料 diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java index 7591baab..9739143d 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java @@ -170,10 +170,14 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl().eq(WorkOrder::getProductCode, productCode)); + if (ObjectUtils.isEmpty(workOrder)) { + throw new JeecgBootException("工单不存在!"); + } String departId = zyProductPlan.getWorkshopId(); - ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper().eq(ZyProduct::getWorkOrderId, workOrderId)); + ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper().eq(ZyProduct::getWorkOrderId, workOrder.getId())); if (ObjectUtils.isEmpty(zyProduct)) { throw new JeecgBootException("产品不存在!"); } @@ -192,7 +196,13 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl().eq(Groupx::getDepartId, departId).eq(Groupx::getId, zyProductPlan.getTeamId())); + if (ObjectUtils.isEmpty(groupx)) { + throw new JeecgBootException("班组不存在!"); + } List groupMembers = iGroupxMemberService.list(new LambdaQueryWrapper().eq(GroupxMember::getGroupxId, groupx.getId())); + if (ObjectUtils.isEmpty(groupMembers)) { + throw new JeecgBootException("班组成员不存在!"); + } List groupxMemeberVoList = new LinkedList<>(); if (!ObjectUtils.isEmpty(groupMembers)) { @@ -323,7 +333,7 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl() - .eq(ZyProduct::getWorkOrderId, zyProductPlan.getProductCode()) +// .eq(ZyProduct::getWorkOrderId, zyProductPlan.getProductCode()) .eq(ZyProduct::getProductCode, zyProductPlan.getProductNo())); if (ObjectUtils.isEmpty(zyProduct)) { throw new JeecgBootException(zyProductPlan.getProductNo() + "产品不存在"); @@ -479,19 +489,17 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl().eq(WorkOrder::getProductCode, productCode)); + if (ObjectUtils.isEmpty(workOrder)) { + throw new JeecgBootException("工单不存在!"); + } String departId = zyProductPlan.getWorkshopId(); - ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper().eq(ZyProduct::getWorkOrderId, workOrderId)); + ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper().eq(ZyProduct::getWorkOrderId, workOrder.getId())); if (ObjectUtils.isEmpty(zyProduct)) { throw new JeecgBootException("产品不存在!"); } -// 工单信息 - WorkOrder workOrder = iWorkOrderService.getOne(new LambdaQueryWrapper().eq(WorkOrder::getProductCode, zyProductPlan.getProductCode())); - if (ObjectUtils.isEmpty(workOrder)) - throw new JeecgBootException(zyProductPlan.getProductCode() + "工单信息不存在"); - String ordersId = workOrder.getOrdersId(); //订单信息 OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper().eq(OrderGoods::getOrdersId, ordersId)); @@ -501,13 +509,19 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl result = new HashMap<>(); - result.put("productCode", zyProduct.getProductCode()); + result.put("productCode", zyProductPlan.getProductCode()); result.put("productName", zyProduct.getProductName()); result.put("productOrg", zyProductPlan.getProductOrg()); result.put("productName", zyProductPlan.getProductName()); - result.put("productNo", zyProductPlan.getProductNo()); + result.put("productNo", zyProduct.getProductCode()); SysDepart depart = iSysDepartService.getById(departId); + if (ObjectUtils.isEmpty(depart)) { + throw new JeecgBootException("部门不存在!"); + } Groupx groupx = iGroupxService.getById(zyProductPlan.getTeamId()); + if (ObjectUtils.isEmpty(groupx)) { + throw new JeecgBootException("班组不存在!"); + } result.put("workshop", depart.getDepartName()); result.put("team", groupx.getGroupName()); result.put("teamLade", iSysUserService.getById(groupx.getEnterprisesManager()).getRealname()); diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyProductPlanServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyProductPlanServiceImpl.java index 311523d5..b9855198 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyProductPlanServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyProductPlanServiceImpl.java @@ -20,6 +20,7 @@ import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.service.ISysDepartService; import org.jeecg.modules.system.service.ISysUserService; import org.jeecg.modules.team.entity.Groupx; +import org.jeecg.modules.team.entity.Station; import org.jeecg.modules.team.service.IGroupxService; import org.jeecg.modules.workorder.entity.WorkOrder; import org.jeecg.modules.workorder.enums.WorkOrderStatusEnum; @@ -33,6 +34,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; import java.util.Arrays; +import java.util.LinkedList; import java.util.List; import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; @@ -123,9 +125,12 @@ public class ZyProductPlanServiceImpl extends ServiceImpl().eq(ZyProduct::getWorkOrderId, productCode)); - Optional.ofNullable(zyProduct).orElseThrow(() -> new JeecgBootException(productCode + ":产品不存在")); + WorkOrder workOrder = iWorkOrderService.getOne(new LambdaQueryWrapper().eq(WorkOrder::getProductCode, productCode)); + Optional.ofNullable(workOrder).orElseThrow(() -> new JeecgBootException(productCode + ":工单编号不存在")); + ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper().eq(ZyProduct::getWorkOrderId, workOrder.getId())); + Optional.ofNullable(zyProduct).orElseThrow(() -> new JeecgBootException(productCode + ":工单对应的产品不存在")); zyProductPlan.setProductNo(StringUtils.isNotBlank(zyProduct.getProductCode()) ? zyProduct.getProductCode() : ""); zyProductPlan.setProductName(StringUtils.isNotBlank(zyProduct.getProductName()) ? zyProduct.getProductName() : ""); if (StringUtils.isNotBlank(zyProduct.getEnterprisesId())) { @@ -138,6 +143,9 @@ public class ZyProductPlanServiceImpl extends ServiceImpl