change - add生产BOM

main
yinq 6 months ago
parent 208f07eeb9
commit d1d5a76f14

@ -45,6 +45,15 @@ public class ProdBomInfoController extends BaseController {
return getDataTable(list);
}
/**
* BOM
*/
@GetMapping("/productionBomTreeList")
public AjaxResult productionBomTreeList(ProdBomInfo prodBomInfo) {
List<ProdBomInfo> list = prodBomInfoService.selectProductionBomTreeList(prodBomInfo);
return success(list);
}
/**
* BOM
*/

@ -57,6 +57,12 @@ public class ProdBomInfo extends BaseEntity {
@Excel(name = "父物料ID")
private Long parentId;
/**
*
*/
@Excel(name = "父物料编码")
private String parentCode;
/**
*
*/
@ -69,6 +75,12 @@ public class ProdBomInfo extends BaseEntity {
@Excel(name = "工厂编号")
private String factoryCode;
/**
*
*/
@Excel(name = "工厂名称")
private String factoryName;
/**
*
*/
@ -99,6 +111,22 @@ public class ProdBomInfo extends BaseEntity {
@Excel(name = "是否标识")
private String isFlag;
public String getParentCode() {
return parentCode;
}
public void setParentCode(String parentCode) {
this.parentCode = parentCode;
}
public String getFactoryName() {
return factoryName;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
public void setObjId(Long objId) {
this.objId = objId;
}

@ -58,4 +58,11 @@ public interface IProdBomInfoService {
* @return
*/
public int deleteProdBomInfoByObjId(Long objId);
/**
* BOM
* @param prodBomInfo
* @return
*/
List<ProdBomInfo> selectProductionBomTreeList(ProdBomInfo prodBomInfo);
}

@ -44,6 +44,25 @@ public class ProdBomInfoServiceImpl implements IProdBomInfoService {
return prodBomInfoMapper.selectProdBomInfoList(prodBomInfo);
}
/**
* BOM
* @param prodBomInfo
* @return
*/
@Override
public List<ProdBomInfo> selectProductionBomTreeList(ProdBomInfo prodBomInfo) {
List<ProdBomInfo> prodBomInfos = prodBomInfoMapper.selectProdBomInfoList(prodBomInfo);
try {
ProdBomInfo bomInfo = new ProdBomInfo();
bomInfo.setAncestors(prodBomInfos.get(0).getObjId().toString());
List<ProdBomInfo> infos = prodBomInfoMapper.selectProdBomInfoList(bomInfo);
prodBomInfos.addAll(infos);
} catch (Exception e) {
e.printStackTrace();
}
return prodBomInfos;
}
/**
* BOM
*

@ -12,8 +12,10 @@
<result property="materialType" column="material_type"/>
<result property="standardAmount" column="standard_amount"/>
<result property="parentId" column="parent_id"/>
<result property="parentCode" column="parent_code"/>
<result property="parentName" column="parent_name"/>
<result property="factoryCode" column="factory_code"/>
<result property="factoryName" column="factory_name"/>
<result property="sort" column="sort"/>
<result property="vbeln" column="vbeln"/>
<result property="vbpos" column="vbpos"/>
@ -26,56 +28,62 @@
</resultMap>
<sql id="selectProdBomInfoVo">
select obj_id,
bom_code,
material_code,
material_name,
material_type,
standard_amount,
parent_id,
parent_name,
factory_code,
sort,
vbeln,
vbpos,
ancestors,
is_flag,
create_by,
create_time,
update_by,
update_time
from prod_bom_info
select pbi.obj_id,
pbi.bom_code,
pbi.material_code,
bmi.material_name,
pbi.material_type,
pbi.standard_amount,
pbi.parent_id,
pbi2.material_code parent_code,
pbi2.material_name parent_name,
bf.factory_code,
bf.factory_name,
pbi.sort,
pbi.vbeln,
pbi.vbpos,
pbi.ancestors,
pbi.is_flag,
pbi.create_by,
pbi.create_time,
pbi.update_by,
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
</sql>
<select id="selectProdBomInfoList" parameterType="ProdBomInfo" resultMap="ProdBomInfoResult">
<include refid="selectProdBomInfoVo"/>
<where>
<if test="bomCode != null and bomCode != ''">and bom_code = #{bomCode}</if>
<if test="materialCode != null and materialCode != ''">and material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''">and material_name like concat('%', #{materialName},
<if test="bomCode != null and bomCode != ''">and pbi.bom_code = #{bomCode}</if>
<if test="materialCode != null and materialCode != ''">and pbi.material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''">and pbi.material_name like concat('%', #{materialName},
'%')
</if>
<if test="materialType != null and materialType != ''">and material_type = #{materialType}</if>
<if test="standardAmount != null ">and standard_amount = #{standardAmount}</if>
<if test="parentId != null and parentId != ''">and parent_id = #{parentId}</if>
<if test="parentName != null and parentName != ''">and parent_name like concat('%', #{parentName}, '%')
<if test="materialType != null and materialType != ''">and pbi.material_type = #{materialType}</if>
<if test="standardAmount != null ">and pbi.standard_amount = #{standardAmount}</if>
<if test="parentId != null and parentId != ''">and pbi.parent_id = #{parentId}</if>
<if test="parentName != null and parentName != ''">and pbi.parent_name like concat('%', #{parentName}, '%')
</if>
<if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if>
<if test="sort != null and sort != ''">and sort = #{sort}</if>
<if test="vbeln != null and vbeln != ''">and vbeln = #{vbeln}</if>
<if test="vbpos != null and vbpos != ''">and vbpos = #{vbpos}</if>
<if test="ancestors != null and ancestors != ''">and ancestors = #{ancestors}</if>
<if test="isFlag != null and isFlag != ''">and is_flag = #{isFlag}</if>
<if test="createBy != null and createBy != ''">and create_by = #{createBy}</if>
<if test="createTime != null ">and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''">and update_by = #{updateBy}</if>
<if test="updateTime != null ">and update_time = #{updateTime}</if>
<if test="factoryCode != null and factoryCode != ''">and pbi.factory_code = #{factoryCode}</if>
<if test="sort != null and sort != ''">and pbi.sort = #{sort}</if>
<if test="vbeln != null and vbeln != ''">and pbi.vbeln = #{vbeln}</if>
<if test="vbpos != null and vbpos != ''">and pbi.vbpos = #{vbpos}</if>
<if test="ancestors != null and ancestors != ''">and pbi.ancestors like concat('%', #{ancestors}, '%')</if>
<if test="isFlag != null and isFlag != ''">and pbi.is_flag = #{isFlag}</if>
<if test="createBy != null and createBy != ''">and pbi.create_by = #{createBy}</if>
<if test="createTime != null ">and pbi.create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''">and pbi.update_by = #{updateBy}</if>
<if test="updateTime != null ">and pbi.update_time = #{updateTime}</if>
</where>
</select>
<select id="selectProdBomInfoByObjId" parameterType="Long" resultMap="ProdBomInfoResult">
<include refid="selectProdBomInfoVo"/>
where obj_id = #{objId}
where pbi.obj_id = #{objId}
</select>
<insert id="insertProdBomInfo" parameterType="ProdBomInfo" useGeneratedKeys="true" keyProperty="objId">

Loading…
Cancel
Save