From c53a21e2366a719fa3a24e6914e4faae74c559b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=99=93=E8=BF=AA?= <2596750866@qq.com> Date: Fri, 15 Nov 2024 09:30:13 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E5=B7=A5=E7=A8=8B=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?bom=E4=BF=A1=E6=81=AF=20=E4=BF=AE=E6=94=B9erpBom=E5=AE=9E?= =?UTF-8?q?=E4=BD=93=E7=B1=BB=E3=80=81erpBomImportVo=E7=B1=BB=E7=94=A8?= =?UTF-8?q?=E9=87=8F=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B=E4=B8=BAInteger?= =?UTF-8?q?=EF=BC=9B=20=E4=BF=AE=E6=94=B9erpBomService=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E4=BF=AE=E6=94=B9=E7=94=A8=E9=87=8F?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E8=B5=8B=E5=80=BC=E8=AF=AD=E5=8F=A5=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=9F=A5=E8=AF=A2=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E8=AE=A2=E5=8D=95bom=E6=96=B9=E6=B3=95=E5=92=8C?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E6=9F=A5=E8=AF=A2bom=E6=89=80=E6=9C=89?= =?UTF-8?q?=E9=98=B6=E6=96=B9=E6=B3=95=EF=BC=9B=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92service=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E4=B8=AD=E8=8E=B7=E5=8F=96bom=E7=94=A8=E9=87=8F=E8=AF=AD?= =?UTF-8?q?=E5=8F=A5=E7=B1=BB=E5=9E=8B=EF=BC=9B=20=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=20=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=9F=E4=BA=A7bom=E7=B1=BB=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99=E5=9E=8B=E5=8F=B7=E3=80=81?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=95=B0=E9=87=8F=E3=80=81=E4=BA=A4=E4=BB=98?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E3=80=81=E5=B7=B2=E5=AE=8C=E6=88=90=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=EF=BC=8C=E4=BF=AE=E6=94=B9=E7=94=A8=E9=87=8F?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=B8=BAInteger=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/erp/domain/ErpBom.java | 6 +- .../com/ruoyi/erp/domain/ErpBomImportVo.java | 6 +- .../erp/service/impl/ErpBomServiceImpl.java | 90 ++++++++++++++++++- .../service/impl/PurchasePlanServiceImpl.java | 2 +- .../ruoyi/system/domain/SysMakeorderBom.java | 52 ++++++++++- 5 files changed, 142 insertions(+), 14 deletions(-) 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)