diff --git a/ant-design-vue-jeecg/src/views/productplan/ProductplanManage.vue b/ant-design-vue-jeecg/src/views/productplan/ProductplanManage.vue index 68dd8ea5..86aaa60e 100644 --- a/ant-design-vue-jeecg/src/views/productplan/ProductplanManage.vue +++ b/ant-design-vue-jeecg/src/views/productplan/ProductplanManage.vue @@ -150,6 +150,8 @@ export default { }, {key: 'inputProduct', title: '输入产品', width: '150', type: JVXETypes.input}, {key: 'semiProduct', title: '成品/半成品', width: '150', type: JVXETypes.input}, + {key: 'totalMachine', title: '机器时长', width: '150', type: JVXETypes.normal}, + {key: 'totalMaunal', title: '人工时长', width: '150', type: JVXETypes.normal}, ], url: { list: "/org.jeecg.modules.productplan/zyPlanProcess/getProcessDatalist", diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcess.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcess.java index 2e8939f4..d8f38ce1 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcess.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcess.java @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import io.swagger.models.auth.In; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -145,4 +146,13 @@ public class ZyPlanProcess implements Serializable { @Excel(name = "成品/半成品", width = 15) @ApiModelProperty(value = "成品/半成品") private String semiProduct; + + @Excel(name = "人工时长", width = 15) + @ApiModelProperty(value = "人工时长") + private Integer totalMaunal; + + + @Excel(name = "机器时长", width = 15) + @ApiModelProperty(value = "机器时长") + private Integer totalMachine; } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcessAccessories.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcessAccessories.java index 9454b84e..93cd611e 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcessAccessories.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcessAccessories.java @@ -76,6 +76,8 @@ public class ZyPlanProcessAccessories implements Serializable { @ApiModelProperty(value = "辅料id") @Dict(dictTable = "zy_accessories", dicText = "contents", dicCode = "id") private String accessoriesId; + + private String accessoriesName; /** * 用量 */ diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcessFabric.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcessFabric.java index 3d8cbf05..b951bab8 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcessFabric.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcessFabric.java @@ -76,6 +76,8 @@ public class ZyPlanProcessFabric implements Serializable { @ApiModelProperty(value = "面料id") @Dict(dictTable = "zy_fabric", dicText = "name", dicCode = "id") private String fabricId; + + private String fabricName; /** * 用量 */ 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 99a3ece4..9999390a 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 @@ -5,20 +5,36 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.exception.JeecgBootException; +import org.jeecg.modules.demo.accessories.entity.ZyAccessories; +import org.jeecg.modules.demo.accessories.service.IZyAccessoriesService; import org.jeecg.modules.demo.base.entity.ZyProcess; import org.jeecg.modules.demo.base.service.IZyProcessService; +import org.jeecg.modules.demo.fabric.entity.ZyFabric; +import org.jeecg.modules.demo.fabric.service.IZyFabricService; import org.jeecg.modules.demo.ordergoods.entity.OrderGoods; import org.jeecg.modules.demo.ordergoods.service.IOrderGoodsService; +import org.jeecg.modules.demo.pro.entity.ZyProcessAccessories; +import org.jeecg.modules.demo.pro.entity.ZyProcessFabric; +import org.jeecg.modules.demo.pro.service.IZyProcessAccessoriesService; +import org.jeecg.modules.demo.pro.service.IZyProcessFabricService; import org.jeecg.modules.demo.zyorders.entity.ZyOrders; import org.jeecg.modules.demo.zyorders.service.IZyOrdersService; +import org.jeecg.modules.product.pdaccessories.entity.ProductAccessories; +import org.jeecg.modules.product.pdaccessories.service.IProductAccessoriesService; +import org.jeecg.modules.product.pdfabric.entity.ProductFabric; +import org.jeecg.modules.product.pdfabric.service.IProductFabricService; import org.jeecg.modules.product.zyproductprocess.entity.ZyProductProcess; import org.jeecg.modules.product.zyproductprocess.service.IZyProductProcessService; import org.jeecg.modules.productplan.entity.ZyPlanProcess; +import org.jeecg.modules.productplan.entity.ZyPlanProcessAccessories; +import org.jeecg.modules.productplan.entity.ZyPlanProcessFabric; import org.jeecg.modules.productplan.entity.ZyProductPlan; import org.jeecg.modules.productplan.entity.vo.PaiWeiTuVo; import org.jeecg.modules.productplan.entity.vo.ProcessDataVo; import org.jeecg.modules.productplan.enums.ProductPlanStatusEnum; import org.jeecg.modules.productplan.mapper.ZyPlanProcessMapper; +import org.jeecg.modules.productplan.service.IZyPlanProcessAccessoriesService; +import org.jeecg.modules.productplan.service.IZyPlanProcessFabricService; import org.jeecg.modules.productplan.service.IZyPlanProcessService; import org.jeecg.modules.productplan.service.IZyProductPlanService; import org.jeecg.modules.system.entity.SysDepart; @@ -43,10 +59,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; +import java.util.*; /** @@ -97,6 +110,24 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl getProcessDatalist(ZyPlanProcess zyPlanProcess) { //生产计划id String planId = zyPlanProcess.getPlanId(); @@ -137,10 +168,9 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl syncProductBaseProcess(ZyPlanProcess zyPlanProcess) { - List planProcessList = this.list(new LambdaQueryWrapper().eq(ZyPlanProcess::getPlanId, zyPlanProcess.getPlanId())); + int count = this.count(new LambdaQueryWrapper().eq(ZyPlanProcess::getPlanId, zyPlanProcess.getPlanId())); //生产计划工序表没有对应工序时,说明没有制定过该产品的生产工序计划,先把该产品对应的基本工序数据插入到生产计划工序表 - if (ObjectUtils.isEmpty(planProcessList)) { - + if (count == 0) { ZyProductPlan zyProductPlan = iZyProductPlanService.getById(zyPlanProcess.getPlanId()); if (ObjectUtils.isEmpty(zyProductPlan)) { throw new JeecgBootException(zyProductPlan.getId() + "生产计划不存在"); @@ -152,6 +182,7 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl productProcessesList = iZyProductProcessService.list(new LambdaQueryWrapper() .eq(ZyProductProcess::getProductId, zyProduct.getId())); @@ -160,17 +191,65 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl { ZyPlanProcess en = new ZyPlanProcess(); en.setProcessId(o.getProcessId()); - ZyProcess zyProcess = iZyProcessService.getById(o.getProcessId()); + ZyProcess zyProcess = iZyProcessService.getById(o.getId()); en.setProcessName(zyProcess.getProcessName()); en.setPlanId(zyPlanProcess.getPlanId()); + en.setTotalMachine(zyProcess.getTotalMachine()); + en.setTotalMaunal(zyProcess.getTotalMaunal()); saveList.add(en); }); this.saveBatch(saveList); } + + //重新查询计划工序 + List planProcessList = this.list(new LambdaQueryWrapper().eq(ZyPlanProcess::getPlanId, zyPlanProcess.getPlanId())); + + //工序面料同步到计划工序面料表 + this.saveBatchFabricByProcessIdList(planProcessList); + + //工序辅料同步到计划工序辅料表 + this.saveBatchAccessoriesByProcessIdList(planProcessList); } return null; } + void saveBatchAccessoriesByProcessIdList(List planProcessList) { + Optional.ofNullable(planProcessList).orElse(new ArrayList<>()).forEach(e -> { + List accessoriesList = this.iZyProcessAccessoriesService.list(new LambdaQueryWrapper() + .eq(ZyProcessAccessories::getProcessId, e.getProcessId())); + List list = new LinkedList<>(); + Optional.ofNullable(accessoriesList).orElse(new ArrayList<>()).forEach(obj -> { + ZyPlanProcessAccessories en = new ZyPlanProcessAccessories(); + en.setPlanProcessId(e.getProcessId()); + en.setPlanId(e.getPlanId()); + en.setAccessoriesId(obj.getAccessoriesId()); + ZyAccessories zyAccessories = iZyAccessoriesService.getById(obj.getAccessoriesId()); + en.setAccessoriesName(zyAccessories.getContents()); + list.add(en); + }); + iZyPlanProcessAccessoriesService.saveBatch(list); + }); + } + + void saveBatchFabricByProcessIdList(List planProcessList) { + Optional.ofNullable(planProcessList).orElse(new ArrayList<>()).forEach(e -> { + List fabricList = this.iZyProcessFabricService.list(new LambdaQueryWrapper() + .eq(ZyProcessFabric::getProcessId, e.getProcessId())); + List list = new LinkedList<>(); + Optional.ofNullable(fabricList).orElse(new ArrayList<>()).forEach(obj -> { + ZyPlanProcessFabric en = new ZyPlanProcessFabric(); + en.setPlanProcessId(e.getProcessId()); + en.setPlanId(e.getPlanId()); + en.setFabricId(obj.getFabricId()); + ZyFabric zyFabric = iZyFabricService.getById(obj.getFabricId()); + en.setFabricName(zyFabric.getName()); + list.add(en); + }); + iZyPlanProcessFabricService.saveBatch(list); + }); + } + + @Override public Map getPlanInfo(ZyPlanProcess planProcess) { //生产计划id