change - 自动同步生产BOM

master
yinq 11 months ago
parent fe2795192e
commit 6bea396415

@ -70,6 +70,7 @@
<if test="updatedBy != null and updatedBy != ''"> and ml.updated_by = #{updatedBy}</if>
<if test="updatedTime != null "> and ml.updated_time = #{updatedTime}</if>
</where>
order by ml.material_subclass, ml.increment_date desc
</select>
<select id="selectBaseMaterialInfoByObjId" parameterType="Long" resultMap="BaseMaterialInfoResult">

@ -127,6 +127,22 @@ public class BaseBomInfo extends TreeStringEntity {
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime;
/**
* ()
*/
private String ancestors;
@Override
public String getAncestors() {
return ancestors;
}
@Override
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
@Override
public String getParentName() {
return parentName;

@ -230,6 +230,7 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
info.setStandardAmount(new BigDecimal(1));
info.setPlantCode(baseMaterialInfo.getPlantCode());
info.setCreatedTime(DateUtils.getNowDate());
info.setAncestors(baseMaterialInfo.getMaterialCode());
try {
this.insertBaseBomInfo(info);
} catch (Exception e) {
@ -247,6 +248,7 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
}
//根据成品产品BOM存箱体、门体
for (OrderBomInfo orderBomInfo : orderBomInfos) {
orderBomInfo.setAncestors(baseMaterialInfo.getMaterialCode());
//箱体
if (orderBomInfo.getMaterialType().equals(MaterialConstants.BOX_MATERIAL_TYPE)) {
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.BOX_MATERIAL_TYPE);
@ -266,8 +268,18 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
OrderBomInfo selectBomInfo = new OrderBomInfo();
selectBomInfo.setParentId(boxBomInfo.getMaterialCode());
List<OrderBomInfo> bomInfoList = orderBomInfoService.selectOrderBomInfoList(selectBomInfo);
//Boolean flag = false; // 判断BOM是否含有预装箱体
/* Boolean isYZXTFlag = false; // 判断BOM是否含有预装箱体
for (OrderBomInfo orderBomInfo : bomInfoList) {
if (orderBomInfo.getMaterialName().contains("预装箱体")){
isYZXTFlag = true;//此BOM有预装箱体
//围板
if (orderBomInfo.getMaterialType().equals(MaterialConstants.COAMING_MATERIAL_TYPE)) {
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.COAMING_MATERIAL_TYPE);
}
}
}*/
for (OrderBomInfo orderBomInfo : bomInfoList) {
orderBomInfo.setAncestors(boxBomInfo.getAncestors());
//内胆
if (orderBomInfo.getMaterialType().equals(MaterialConstants.LINER_MATERIAL_TYPE)) {
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.LINER_MATERIAL_TYPE);
@ -288,6 +300,7 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
selectBomInfo.setParentId(boxBomInfo.getMaterialCode());
List<OrderBomInfo> bomInfoList = orderBomInfoService.selectOrderBomInfoList(selectBomInfo);
for (OrderBomInfo orderBomInfo : bomInfoList) {
orderBomInfo.setAncestors(boxBomInfo.getAncestors());
//前板
if (orderBomInfo.getMaterialType().equals(MaterialConstants.FORMER_MATERIAL_TYPE)) {
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.FORMER_MATERIAL_TYPE);
@ -323,6 +336,7 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
info.setParentId(orderBomInfo.getParentId());
info.setStandardAmount(orderBomInfo.getStandardAmount());
info.setPlantCode(orderBomInfo.getFactoryCode());
info.setAncestors(orderBomInfo.getAncestors());
try {
info.setCreatedTime(DateUtils.getNowDate());
baseBomInfoMapper.insertBaseBomInfo(info);

Loading…
Cancel
Save