diff --git a/os-mes/src/main/java/com/os/mes/prod/domain/ProdBomInfo.java b/os-mes/src/main/java/com/os/mes/prod/domain/ProdBomInfo.java index b3281b6..d548a6f 100644 --- a/os-mes/src/main/java/com/os/mes/prod/domain/ProdBomInfo.java +++ b/os-mes/src/main/java/com/os/mes/prod/domain/ProdBomInfo.java @@ -45,6 +45,12 @@ public class ProdBomInfo extends BaseEntity { @Excel(name = "物料类别") private String materialType; + /** + * 计量单位 + */ + @Excel(name = "计量单位") + private String materialUnit; + /** * 标准数量 */ @@ -111,6 +117,14 @@ public class ProdBomInfo extends BaseEntity { @Excel(name = "是否标识") private String isFlag; + public String getMaterialUnit() { + return materialUnit; + } + + public void setMaterialUnit(String materialUnit) { + this.materialUnit = materialUnit; + } + public String getParentCode() { return parentCode; } diff --git a/os-mes/src/main/java/com/os/mes/prod/service/impl/ProdBomInfoServiceImpl.java b/os-mes/src/main/java/com/os/mes/prod/service/impl/ProdBomInfoServiceImpl.java index 6a623f2..efa9968 100644 --- a/os-mes/src/main/java/com/os/mes/prod/service/impl/ProdBomInfoServiceImpl.java +++ b/os-mes/src/main/java/com/os/mes/prod/service/impl/ProdBomInfoServiceImpl.java @@ -1,5 +1,6 @@ package com.os.mes.prod.service.impl; +import java.util.ArrayList; import java.util.List; import com.os.common.exception.base.BaseException; @@ -51,16 +52,18 @@ public class ProdBomInfoServiceImpl implements IProdBomInfoService { */ @Override public List selectProductionBomTreeList(ProdBomInfo prodBomInfo) { - List prodBomInfos = prodBomInfoMapper.selectProdBomInfoList(prodBomInfo); + List prodBomInfoList = new ArrayList<>(); + ProdBomInfo info = prodBomInfoMapper.selectProdBomInfoByObjId(prodBomInfo.getObjId()); + prodBomInfoList.add(info); try { ProdBomInfo bomInfo = new ProdBomInfo(); - bomInfo.setAncestors(prodBomInfos.get(0).getObjId().toString()); + bomInfo.setAncestors(info.getObjId().toString()); List infos = prodBomInfoMapper.selectProdBomInfoList(bomInfo); - prodBomInfos.addAll(infos); + prodBomInfoList.addAll(infos); } catch (Exception e) { e.printStackTrace(); } - return prodBomInfos; + return prodBomInfoList; } /** diff --git a/os-mes/src/main/resources/mapper/mes/base/BaseMaterialInfoMapper.xml b/os-mes/src/main/resources/mapper/mes/base/BaseMaterialInfoMapper.xml index 5f8ffff..8bb4b5d 100644 --- a/os-mes/src/main/resources/mapper/mes/base/BaseMaterialInfoMapper.xml +++ b/os-mes/src/main/resources/mapper/mes/base/BaseMaterialInfoMapper.xml @@ -37,7 +37,7 @@ bmi.material_unit, bmi.unit_price, bmi.material_specifications, - bmi.factory_code, + pbl.plant_code factory_code, bmi.product_line_code, pbl.product_line_name, bmi.is_flag, diff --git a/os-mes/src/main/resources/mapper/mes/prod/ProdBomInfoMapper.xml b/os-mes/src/main/resources/mapper/mes/prod/ProdBomInfoMapper.xml index a945644..18c4e7c 100644 --- a/os-mes/src/main/resources/mapper/mes/prod/ProdBomInfoMapper.xml +++ b/os-mes/src/main/resources/mapper/mes/prod/ProdBomInfoMapper.xml @@ -10,6 +10,7 @@ + @@ -33,10 +34,9 @@ pbi.material_code, bmi.material_name, pbi.material_type, + bmi.material_unit, pbi.standard_amount, pbi.parent_id, - pbi2.material_code parent_code, - pbi2.material_name parent_name, bf.factory_code, bf.factory_name, pbi.sort, @@ -50,7 +50,6 @@ pbi.update_time from prod_bom_info pbi left join base_material_info bmi on bmi.material_code = pbi.material_code - left join prod_bom_info pbi2 on pbi.obj_id = pbi2.parent_id left join base_product_line bpl on bpl.product_line_code = bmi.product_line_code left join base_factory bf on bf.factory_code = bpl.plant_code