Merge remote-tracking branch 'origin/feature/DM/nflg-bom' into feature/DM/nflg-bom

This commit is contained in:
大米 2024-05-27 10:26:16 +08:00
commit e7f8d4665e
6 changed files with 70 additions and 4 deletions

View File

@ -1,6 +1,5 @@
package com.nflg.product.bomnew.pojo.entity;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
@ -225,6 +224,13 @@ public class BomNewEbomChildEntity implements Serializable {
@ApiModelProperty(value = "原始单位-来自cad")
private String materialOriginalUnit;
/**
* SAP排序字符串
*/
@TableField(value = "sap_order_num")
@ApiModelProperty(value = "SAP排序字符串")
private String sapOrderNum;
// private String materialNoAndProjectType;

View File

@ -385,5 +385,12 @@ public class BomNewEbomParentEntity implements Serializable {
@ApiModelProperty(value = "导入SAP时间")
private LocalDateTime sapTime;
/**
* SAP排序字符串
*/
@TableField(value = "sap_order_num")
@ApiModelProperty(value = "SAP排序字符串")
private String sapOrderNum;
private static final long serialVersionUID = 265246823929418418L;
}

View File

@ -124,5 +124,11 @@ public class BomNewEbomChildVO extends BaseMaterialVO implements Serializable {
@ApiModelProperty(value = "备注")
private String remark;
/**
* SAP排序字符串
*/
@ApiModelProperty(value = "SAP排序字符串")
private String sapOrderNum;
private static final long serialVersionUID = 1L;
}

View File

@ -341,6 +341,12 @@ public class BomNewEbomParentVO extends BaseMaterialVO implements Serializable {
@ApiModelProperty(value = "导入SAP状态")
private Integer sapState;
/**
* SAP排序字符串
*/
@ApiModelProperty(value = "SAP排序字符串")
private String sapOrderNum;
private List<BomNewEbomParentVO> childNodes = Collections.emptyList();
private static final long serialVersionUID = 1L;

View File

@ -24,6 +24,7 @@ import com.nflg.product.bomnew.service.BomNewEbomParentService;
import com.nflg.product.bomnew.service.MaterialMainService;
import com.nflg.product.bomnew.service.UserRoleService;
import com.nflg.product.bomnew.service.cache.MaterialMateCache;
import com.nflg.product.bomnew.util.BomUtil;
import com.nflg.product.bomnew.util.ListCommonUtil;
import com.nflg.product.bomnew.util.VUtils;
import com.nflg.product.bomnew.util.VersionUtil;
@ -387,6 +388,8 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
this.eBomParentResult.add(ebom);
}
eBomParent.setMaterialOriginalUnit(eBomParent.getMaterialUnit());
eBomParent.setSapOrderNum(BomUtil.generateSapOrderNum(parentEnt.getProjectType(), parentEnt.getMaterialCategoryCode()
, "1010", parentEnt.getMaterialNo(), parentEnt.getBomExist()));
this.eBomParentResult.add(eBomParent);
return eBomParent.getRowId();
@ -428,9 +431,8 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
// childEntity.setDrawingNo(childEntity.getMaterialNo());
// }
childEntity.setMaterialOriginalUnit(childEntity.getMaterialUnit());
if (parent.getMaterialNo().startsWith("31")) {
childEntity.setVirtualPartRootMaterialNo(parent.getMaterialNo());
}
childEntity.setSapOrderNum(BomUtil.generateSapOrderNum(childEntity.getProjectType()
, childEntity.getMaterialCategoryCode(), "1010", childEntity.getMaterialNo(), 0));
this.eBomChildResult.add(childEntity);

View File

@ -1,6 +1,7 @@
package com.nflg.product.bomnew.util;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import java.math.BigDecimal;
import java.util.Objects;
@ -35,4 +36,42 @@ public class BomUtil {
}
return new BigDecimal(NumberUtil.toStr(old));
}
public static String generateSapOrderNum(String projectType, String categoryCode, String factoryCode, String materialNo, Integer bomExist) {
String orderNum = "";
if (StrUtil.equals(projectType, "F")) {
if (StrUtil.equals(factoryCode, "1010")) {
orderNum = "0080";
} else if (StrUtil.equals(factoryCode, "1020")) {
orderNum = "0090";
}
if (StrUtil.equals(materialNo, "1100013148") && StrUtil.equals(factoryCode, "1010")) {
orderNum = "0020";
}
if (StrUtil.equals(materialNo, "1100000090") && StrUtil.equals(factoryCode, "1020")) {
orderNum = "0020";
}
if (StrUtil.equals(materialNo, "1100000091") && StrUtil.equals(factoryCode, "1020")) {
orderNum = "0020";
}
} else if (StrUtil.equals(projectType, "T")) {
orderNum = "0040";
} else {
orderNum = "0099";
if (StrUtil.equals(categoryCode, "100101")) {
orderNum = "0010";
}
if (StrUtil.equals(categoryCode, "102101")
|| (Integer.parseInt(categoryCode) >= 100102 && Integer.parseInt(categoryCode) <= 100104)) {
orderNum = "0020";
}
if (StrUtil.equals(categoryCode, "100301") && StrUtil.equals(factoryCode, "1010")) {
orderNum = "0050";
}
if (bomExist == 1) {
orderNum = "0040";
}
}
return orderNum;
}
}