Browse Source

[fix]

工程管理 bom信息
修改erpBom实体类、erpBomImportVo类用量字段类型为Integer;
修改erpBomService导入方法,修改用量相关赋值语句类型,新增查询生产订单bom方法和循环查询bom所有阶方法;
修改采购计划service方法中获取bom用量语句类型;
生产管理 生产订单
修改生产bom类,新增物料型号、订单数量、交付时间、已完成数字段,修改用量字段为Integer;
dev
王晓迪 2 weeks ago
parent
commit
c53a21e236
  1. 6
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java
  2. 6
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBomImportVo.java
  3. 90
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java
  4. 2
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java
  5. 52
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java

6
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java

@ -69,7 +69,7 @@ public class ErpBom extends BaseEntity
/** 用量 */ /** 用量 */
// @Excel(name = "用量",sort = 8) // @Excel(name = "用量",sort = 8)
private Double useNum; private Integer useNum;
/** 损耗率 */ /** 损耗率 */
private String lossRate; private String lossRate;
@ -273,7 +273,7 @@ public class ErpBom extends BaseEntity
{ {
return describe; return describe;
} }
public void setUseNum(Double useNum) public void setUseNum(Integer useNum)
{ {
this.useNum = useNum; this.useNum = useNum;
} }
@ -286,7 +286,7 @@ public class ErpBom extends BaseEntity
this.engineer = engineer; this.engineer = engineer;
} }
public Double getUseNum() public Integer getUseNum()
{ {
return useNum; return useNum;
} }

6
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBomImportVo.java

@ -18,7 +18,7 @@ public class ErpBomImportVo implements Serializable {
/** 用量 */ /** 用量 */
@Excel(name = "用量",sort = 2) @Excel(name = "用量",sort = 2)
private Double useNum; private Integer useNum;
/** 损耗率 */ /** 损耗率 */
@Excel(name = "损耗率",sort = 3) @Excel(name = "损耗率",sort = 3)
@ -36,11 +36,11 @@ public class ErpBomImportVo implements Serializable {
this.materialNo = materialNo; this.materialNo = materialNo;
} }
public Double getUseNum() { public Integer getUseNum() {
return useNum; return useNum;
} }
public void setUseNum(Double useNum) { public void setUseNum(Integer useNum) {
this.useNum = useNum; this.useNum = useNum;
} }

90
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* bomService业务层处理 * bomService业务层处理
@ -212,7 +210,6 @@ private ISysAttachService attachService;
return resultList; return resultList;
} }
//List<ErpBom> filterOneLevelList = oneLevelList.stream().filter(bom -> "1".equals(bom.getUseStatus()) && "1".equals(bom.getAuditStatus())).collect(Collectors.toList()); //List<ErpBom> 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; return resultList;
} }
//查询bom子阶(遇到采购类型停止)
@Override
public List<ErpBom> selectPurchaseLimitedErpBomAllLevelList(ErpBom erpBom) {
List<ErpBom> 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<ErpBom> 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<ErpBom> 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<ErpBom> 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<ErpBom> selectMakeOrderErpBomAllLevelList(String[] materialNos) {
List<ErpBom> resultList = new ArrayList<>();
//先判断当前节点的bom是否审核通过
for (int i = 0;i<materialNos.length;i++){
ErpBom erpBom = erpBomMapper.selectErpBomByOneMaterialNo(materialNos[i]);
if(erpBom==null){
/*bom数据库中查询不到该物料,说明未被添加为bom,生成只有料号和层级(1层)的空对象以便页面替换*/
ErpBom nullErpBom = new ErpBom();
nullErpBom.setMaterialNo(materialNos[i]);
nullErpBom.setLevel(1L);
resultList.add(nullErpBom);
}else{
if (!"1".equals(erpBom.getAuditStatus()) && !"1".equals(erpBom.getUseStatus())){
throw new BusinessException("料号"+materialNos[i]+"审核未通过或已作废");
}
// 一阶集合(页面上是二阶)
List<ErpBom> 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 @Override
@ -576,7 +658,7 @@ private ISysAttachService attachService;
{ {
ErpBomImportVo bomImportVo = bomImportVos.get(i); ErpBomImportVo bomImportVo = bomImportVos.get(i);
String materialNo = bomImportVo.getMaterialNo(); String materialNo = bomImportVo.getMaterialNo();
Double useNum = bomImportVo.getUseNum(); Integer useNum = bomImportVo.getUseNum();
Double lossRate = bomImportVo.getLossRate(); Double lossRate = bomImportVo.getLossRate();
String remark = bomImportVo.getRemark(); String remark = bomImportVo.getRemark();
ErpMaterialVo erpMaterialVo = materialMapper.selectErpMaterialByMaterialNo(materialNo); ErpMaterialVo erpMaterialVo = materialMapper.selectErpMaterialByMaterialNo(materialNo);

2
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(); long materialNum = sysSalesOrderChild.getMaterialNum();
//用量 //用量
Double useNum = filterSysMakeorderBom.getUseNum(); Integer useNum = filterSysMakeorderBom.getUseNum();
//采购计划数 //采购计划数
double purchasePlanNum = materialNum * useNum; double purchasePlanNum = materialNum * useNum;

52
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java

@ -1,6 +1,8 @@
package com.ruoyi.system.domain; package com.ruoyi.system.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
@ -70,11 +72,14 @@ public class SysMakeorderBom extends BaseEntity
@Excel(name = "描述") @Excel(name = "描述")
private String describe; private String describe;
//物料型号
private String materialModel;
private String warehouseDept; private String warehouseDept;
/** 用量 */ /** 用量 */
@Excel(name = "用量") @Excel(name = "用量")
private Double useNum; private Integer useNum;
/** 损耗率 */ /** 损耗率 */
@Excel(name = "损耗率") @Excel(name = "损耗率")
@ -100,6 +105,15 @@ public class SysMakeorderBom extends BaseEntity
// 已领料数 // 已领料数
private int hasPickNum; private int hasPickNum;
// 订单数量
private int orderNum;
// 客户期望交付时间
private Date deliveryTime;
private int finishNum;
// 已完成数
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;
@ -228,11 +242,11 @@ public class SysMakeorderBom extends BaseEntity
} }
public Double getUseNum() { public Integer getUseNum() {
return useNum; return useNum;
} }
public void setUseNum(Double useNum) { public void setUseNum(Integer useNum) {
this.useNum = useNum; this.useNum = useNum;
} }
@ -303,6 +317,38 @@ public class SysMakeorderBom extends BaseEntity
this.hasPickNum = hasPickNum; 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 @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

Loading…
Cancel
Save