计划工序管理-列表、读取工序 1.18

zhc4dev
zhc077 2 years ago
parent b65fe9e789
commit 7e2aa9da1b
  1. 2
      ant-design-vue-jeecg/src/views/productplan/ProductplanManage.vue
  2. 10
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcess.java
  3. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcessAccessories.java
  4. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/entity/ZyPlanProcessFabric.java
  5. 95
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java

@ -150,6 +150,8 @@ export default {
}, },
{key: 'inputProduct', title: '输入产品', width: '150', type: JVXETypes.input}, {key: 'inputProduct', title: '输入产品', width: '150', type: JVXETypes.input},
{key: 'semiProduct', 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: { url: {
list: "/org.jeecg.modules.productplan/zyPlanProcess/getProcessDatalist", list: "/org.jeecg.modules.productplan/zyPlanProcess/getProcessDatalist",

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -145,4 +146,13 @@ public class ZyPlanProcess implements Serializable {
@Excel(name = "成品/半成品", width = 15) @Excel(name = "成品/半成品", width = 15)
@ApiModelProperty(value = "成品/半成品") @ApiModelProperty(value = "成品/半成品")
private String semiProduct; private String semiProduct;
@Excel(name = "人工时长", width = 15)
@ApiModelProperty(value = "人工时长")
private Integer totalMaunal;
@Excel(name = "机器时长", width = 15)
@ApiModelProperty(value = "机器时长")
private Integer totalMachine;
} }

@ -76,6 +76,8 @@ public class ZyPlanProcessAccessories implements Serializable {
@ApiModelProperty(value = "辅料id") @ApiModelProperty(value = "辅料id")
@Dict(dictTable = "zy_accessories", dicText = "contents", dicCode = "id") @Dict(dictTable = "zy_accessories", dicText = "contents", dicCode = "id")
private String accessoriesId; private String accessoriesId;
private String accessoriesName;
/** /**
* 用量 * 用量
*/ */

@ -76,6 +76,8 @@ public class ZyPlanProcessFabric implements Serializable {
@ApiModelProperty(value = "面料id") @ApiModelProperty(value = "面料id")
@Dict(dictTable = "zy_fabric", dicText = "name", dicCode = "id") @Dict(dictTable = "zy_fabric", dicText = "name", dicCode = "id")
private String fabricId; private String fabricId;
private String fabricName;
/** /**
* 用量 * 用量
*/ */

@ -5,20 +5,36 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.exception.JeecgBootException; 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.entity.ZyProcess;
import org.jeecg.modules.demo.base.service.IZyProcessService; 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.entity.OrderGoods;
import org.jeecg.modules.demo.ordergoods.service.IOrderGoodsService; 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.entity.ZyOrders;
import org.jeecg.modules.demo.zyorders.service.IZyOrdersService; 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.entity.ZyProductProcess;
import org.jeecg.modules.product.zyproductprocess.service.IZyProductProcessService; import org.jeecg.modules.product.zyproductprocess.service.IZyProductProcessService;
import org.jeecg.modules.productplan.entity.ZyPlanProcess; 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.ZyProductPlan;
import org.jeecg.modules.productplan.entity.vo.PaiWeiTuVo; import org.jeecg.modules.productplan.entity.vo.PaiWeiTuVo;
import org.jeecg.modules.productplan.entity.vo.ProcessDataVo; import org.jeecg.modules.productplan.entity.vo.ProcessDataVo;
import org.jeecg.modules.productplan.enums.ProductPlanStatusEnum; import org.jeecg.modules.productplan.enums.ProductPlanStatusEnum;
import org.jeecg.modules.productplan.mapper.ZyPlanProcessMapper; 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.IZyPlanProcessService;
import org.jeecg.modules.productplan.service.IZyProductPlanService; import org.jeecg.modules.productplan.service.IZyProductPlanService;
import org.jeecg.modules.system.entity.SysDepart; 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.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.HashMap; import java.util.*;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/** /**
@ -97,6 +110,24 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
private IZyProductService iZyProductService; private IZyProductService iZyProductService;
@Autowired
private IZyPlanProcessFabricService iZyPlanProcessFabricService;
@Autowired
private IZyPlanProcessAccessoriesService iZyPlanProcessAccessoriesService;
@Autowired
private IZyProcessFabricService iZyProcessFabricService;
@Autowired
IZyFabricService iZyFabricService;
@Autowired
private IZyProcessAccessoriesService iZyProcessAccessoriesService;
@Autowired
private IZyAccessoriesService iZyAccessoriesService;
public List<ZyPlanProcess> getProcessDatalist(ZyPlanProcess zyPlanProcess) { public List<ZyPlanProcess> getProcessDatalist(ZyPlanProcess zyPlanProcess) {
//生产计划id //生产计划id
String planId = zyPlanProcess.getPlanId(); String planId = zyPlanProcess.getPlanId();
@ -137,10 +168,9 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
@Override @Override
public List<ZyPlanProcess> syncProductBaseProcess(ZyPlanProcess zyPlanProcess) { public List<ZyPlanProcess> syncProductBaseProcess(ZyPlanProcess zyPlanProcess) {
List<ZyPlanProcess> planProcessList = this.list(new LambdaQueryWrapper<ZyPlanProcess>().eq(ZyPlanProcess::getPlanId, zyPlanProcess.getPlanId())); int count = this.count(new LambdaQueryWrapper<ZyPlanProcess>().eq(ZyPlanProcess::getPlanId, zyPlanProcess.getPlanId()));
//生产计划工序表没有对应工序时,说明没有制定过该产品的生产工序计划,先把该产品对应的基本工序数据插入到生产计划工序表 //生产计划工序表没有对应工序时,说明没有制定过该产品的生产工序计划,先把该产品对应的基本工序数据插入到生产计划工序表
if (ObjectUtils.isEmpty(planProcessList)) { if (count == 0) {
ZyProductPlan zyProductPlan = iZyProductPlanService.getById(zyPlanProcess.getPlanId()); ZyProductPlan zyProductPlan = iZyProductPlanService.getById(zyPlanProcess.getPlanId());
if (ObjectUtils.isEmpty(zyProductPlan)) { if (ObjectUtils.isEmpty(zyProductPlan)) {
throw new JeecgBootException(zyProductPlan.getId() + "生产计划不存在"); throw new JeecgBootException(zyProductPlan.getId() + "生产计划不存在");
@ -152,6 +182,7 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
throw new JeecgBootException(zyProductPlan.getProductNo() + "产品不存在"); throw new JeecgBootException(zyProductPlan.getProductNo() + "产品不存在");
} }
//产品基本工序
List<ZyProductProcess> productProcessesList = iZyProductProcessService.list(new LambdaQueryWrapper<ZyProductProcess>() List<ZyProductProcess> productProcessesList = iZyProductProcessService.list(new LambdaQueryWrapper<ZyProductProcess>()
.eq(ZyProductProcess::getProductId, zyProduct.getId())); .eq(ZyProductProcess::getProductId, zyProduct.getId()));
@ -160,17 +191,65 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
productProcessesList.forEach(o -> { productProcessesList.forEach(o -> {
ZyPlanProcess en = new ZyPlanProcess(); ZyPlanProcess en = new ZyPlanProcess();
en.setProcessId(o.getProcessId()); en.setProcessId(o.getProcessId());
ZyProcess zyProcess = iZyProcessService.getById(o.getProcessId()); ZyProcess zyProcess = iZyProcessService.getById(o.getId());
en.setProcessName(zyProcess.getProcessName()); en.setProcessName(zyProcess.getProcessName());
en.setPlanId(zyPlanProcess.getPlanId()); en.setPlanId(zyPlanProcess.getPlanId());
en.setTotalMachine(zyProcess.getTotalMachine());
en.setTotalMaunal(zyProcess.getTotalMaunal());
saveList.add(en); saveList.add(en);
}); });
this.saveBatch(saveList); this.saveBatch(saveList);
} }
//重新查询计划工序
List<ZyPlanProcess> planProcessList = this.list(new LambdaQueryWrapper<ZyPlanProcess>().eq(ZyPlanProcess::getPlanId, zyPlanProcess.getPlanId()));
//工序面料同步到计划工序面料表
this.saveBatchFabricByProcessIdList(planProcessList);
//工序辅料同步到计划工序辅料表
this.saveBatchAccessoriesByProcessIdList(planProcessList);
} }
return null; return null;
} }
void saveBatchAccessoriesByProcessIdList(List<ZyPlanProcess> planProcessList) {
Optional.ofNullable(planProcessList).orElse(new ArrayList<>()).forEach(e -> {
List<ZyProcessAccessories> accessoriesList = this.iZyProcessAccessoriesService.list(new LambdaQueryWrapper<ZyProcessAccessories>()
.eq(ZyProcessAccessories::getProcessId, e.getProcessId()));
List<ZyPlanProcessAccessories> 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<ZyPlanProcess> planProcessList) {
Optional.ofNullable(planProcessList).orElse(new ArrayList<>()).forEach(e -> {
List<ZyProcessFabric> fabricList = this.iZyProcessFabricService.list(new LambdaQueryWrapper<ZyProcessFabric>()
.eq(ZyProcessFabric::getProcessId, e.getProcessId()));
List<ZyPlanProcessFabric> 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 @Override
public Map<String, Object> getPlanInfo(ZyPlanProcess planProcess) { public Map<String, Object> getPlanInfo(ZyPlanProcess planProcess) {
//生产计划id //生产计划id

Loading…
Cancel
Save