diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java index e2bc16eb..43e0dba0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java @@ -69,7 +69,7 @@ public class ErpBom extends BaseEntity /** 用量 */ // @Excel(name = "用量",sort = 8) - private Double useNum; + private Integer useNum; /** 损耗率 */ private String lossRate; @@ -273,7 +273,7 @@ public class ErpBom extends BaseEntity { return describe; } - public void setUseNum(Double useNum) + public void setUseNum(Integer useNum) { this.useNum = useNum; } @@ -286,7 +286,7 @@ public class ErpBom extends BaseEntity this.engineer = engineer; } - public Double getUseNum() + public Integer getUseNum() { return useNum; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBomImportVo.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBomImportVo.java index fe4be6aa..24e26523 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBomImportVo.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBomImportVo.java @@ -18,7 +18,7 @@ public class ErpBomImportVo implements Serializable { /** 用量 */ @Excel(name = "用量",sort = 2) - private Double useNum; + private Integer useNum; /** 损耗率 */ @Excel(name = "损耗率",sort = 3) @@ -36,11 +36,11 @@ public class ErpBomImportVo implements Serializable { this.materialNo = materialNo; } - public Double getUseNum() { + public Integer getUseNum() { return useNum; } - public void setUseNum(Double useNum) { + public void setUseNum(Integer useNum) { this.useNum = useNum; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java index 3f963404..1a1871f5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java @@ -33,9 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.math.BigDecimal; import java.util.*; -import java.util.stream.Collectors; /** * bomService业务层处理 @@ -212,7 +210,6 @@ private ISysAttachService attachService; return resultList; } - //List filterOneLevelList = oneLevelList.stream().filter(bom -> "1".equals(bom.getUseStatus()) && "1".equals(bom.getAuditStatus())).collect(Collectors.toList()); // 一阶集合 @@ -229,6 +226,91 @@ private ISysAttachService attachService; return resultList; } + //查询bom子阶(遇到采购类型停止) + @Override + public List selectPurchaseLimitedErpBomAllLevelList(ErpBom erpBom) { + List resultList = new ArrayList<>(); + //先判断当前父亲节点的bom是否审核通过 + Long parentId = erpBom.getParentId(); + //父节点的id + Long id = parentId; + ErpBomVo erpBomVo = erpBomMapper.selectErpBomById(id); + if (!"1".equals(erpBomVo.getAuditStatus()) && !"1".equals(erpBomVo.getUseStatus())){ + return resultList; + } + // 一阶集合 + List oneLevelList = erpBomMapper.selectOtherOrderErpBomSubList(erpBom); + if(CollectionUtils.isNotEmpty(oneLevelList)){ + for (ErpBom bom: oneLevelList) { + resultList.add(bom); + String materialNo = bom.getMaterialNo(); + Long level = bom.getLevel(); + recursionLimitedSubBom(resultList, materialNo, level); + } + } + return resultList; + } + + //循环查询bom子阶(遇到采购类型停止) + public void recursionLimitedSubBom(List resultList, String materialNo, Long level) { + ErpBom subBom = erpBomMapper.selectErpBomByOneMaterialNo(materialNo); + if(subBom!=null){ + Long subId = subBom.getId(); + ErpBom erpBom1 = new ErpBom(); + erpBom1.setParentId(subId); + List subLevelList = erpBomMapper.selectErpBomSubList(erpBom1); + if(CollectionUtils.isNotEmpty(subLevelList)){ + for (ErpBom sub: subLevelList) { + Long level1 = level+1; + if(level1 >= 8){ + break; + } + sub.setLevel(level1); + resultList.add(sub); + //采购类型的物料生成生产订单时无下阶 + if(sub.getProcessMethod().equals("0")){ + break; + } + String materialNo1 = sub.getMaterialNo(); + recursionLimitedSubBom(resultList,materialNo1,level1); + } + } + } + } + /** + * 生产订单关联bom信息列表 + * */ + @Override + public List selectMakeOrderErpBomAllLevelList(String[] materialNos) { + List resultList = new ArrayList<>(); + //先判断当前节点的bom是否审核通过 + for (int i = 0;i oneLevelList = erpBomMapper.selectOtherOrderErpBomSubList(erpBom); + if(CollectionUtils.isNotEmpty(oneLevelList)){ + for (ErpBom bom: oneLevelList) { + Long level = bom.getLevel()+1; + bom.setLevel(level); + resultList.add(bom); + String materialNo = bom.getMaterialNo(); + recursionLimitedSubBom(resultList, materialNo, level); + } + } + } + } + return resultList; + } @Override @@ -576,7 +658,7 @@ private ISysAttachService attachService; { ErpBomImportVo bomImportVo = bomImportVos.get(i); String materialNo = bomImportVo.getMaterialNo(); - Double useNum = bomImportVo.getUseNum(); + Integer useNum = bomImportVo.getUseNum(); Double lossRate = bomImportVo.getLossRate(); String remark = bomImportVo.getRemark(); ErpMaterialVo erpMaterialVo = materialMapper.selectErpMaterialByMaterialNo(materialNo); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java index 34cdb703..74c3d3bb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java @@ -230,7 +230,7 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService //物料数量 long materialNum = sysSalesOrderChild.getMaterialNum(); //用量 - Double useNum = filterSysMakeorderBom.getUseNum(); + Integer useNum = filterSysMakeorderBom.getUseNum(); //采购计划数 double purchasePlanNum = materialNum * useNum; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java index aadbe548..de8e5941 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java @@ -1,6 +1,8 @@ package com.ruoyi.system.domain; import java.math.BigDecimal; +import java.util.Date; + import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -70,11 +72,14 @@ public class SysMakeorderBom extends BaseEntity @Excel(name = "描述") private String describe; + //物料型号 + private String materialModel; + private String warehouseDept; /** 用量 */ @Excel(name = "用量") - private Double useNum; + private Integer useNum; /** 损耗率 */ @Excel(name = "损耗率") @@ -100,6 +105,15 @@ public class SysMakeorderBom extends BaseEntity // 已领料数 private int hasPickNum; +// 订单数量 + private int orderNum; + +// 客户期望交付时间 + private Date deliveryTime; + + private int finishNum; + +// 已完成数 public void setId(Long id) { this.id = id; @@ -228,11 +242,11 @@ public class SysMakeorderBom extends BaseEntity } - public Double getUseNum() { + public Integer getUseNum() { return useNum; } - public void setUseNum(Double useNum) { + public void setUseNum(Integer useNum) { this.useNum = useNum; } @@ -303,6 +317,38 @@ public class SysMakeorderBom extends BaseEntity this.hasPickNum = hasPickNum; } + public String getMaterialModel() { + return materialModel; + } + + public void setMaterialModel(String materialModel) { + this.materialModel = materialModel; + } + + public int getOrderNum() { + return orderNum; + } + + public void setOrderNum(int orderNum) { + this.orderNum = orderNum; + } + + public Date getDeliveryTime() { + return deliveryTime; + } + + public void setDeliveryTime(Date deliveryTime) { + this.deliveryTime = deliveryTime; + } + + public int getFinishNum() { + return finishNum; + } + + public void setFinishNum(int finishNum) { + this.finishNum = finishNum; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)