Merge branch 'refs/heads/feature/DM/nflg-bom' into feature/DM/nflg-bom-transition

# Conflicts:
#	nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/VirtualPackageBase.java
This commit is contained in:
曹鹏飞 2024-05-11 15:37:25 +08:00
commit afec61231a
13 changed files with 70 additions and 24 deletions

View File

@ -484,7 +484,7 @@ public class EbomApi extends BaseApi {
*/ */
@GetMapping("getSource") @GetMapping("getSource")
@ApiOperation("获取对应的原始bom") @ApiOperation("获取对应的原始bom")
public ResultVO<BomOriginalListVO> getSource(@Valid @RequestParam("rowId") @NotNull Long rowId) { public ResultVO<List<BomOriginalListVO>> getSource(@Valid @RequestParam("rowId") @NotNull Long rowId) {
return ResultVO.success(bomNewEbomParentService.getSource(rowId)); return ResultVO.success(bomNewEbomParentService.getSource(rowId));
} }
} }

View File

@ -197,8 +197,8 @@ public class BomNewEbomChildEntity implements Serializable {
* 来源行ID(原始BOM中的行ID) * 来源行ID(原始BOM中的行ID)
*/ */
@TableField(value = "source_row_id") @TableField(value = "source_row_id")
@ApiModelProperty(value = "来源行ID(原始BOM中的行ID)") @ApiModelProperty(value = "来源行ID(原始BOM中的行ID),多个以逗号隔开")
private Long sourceRowId; private String sourceRowId;
/** /**
* 备注 * 备注

View File

@ -223,7 +223,7 @@ public class BomNewEbomParentEntity implements Serializable {
*/ */
@TableField(value = "source_row_id") @TableField(value = "source_row_id")
@ApiModelProperty(value = "来源行ID(原始BOM中的行ID)") @ApiModelProperty(value = "来源行ID(原始BOM中的行ID)")
private Long sourceRowId; private String sourceRowId;
/** /**
* 设计人员编码 * 设计人员编码

View File

@ -163,7 +163,7 @@ public class BomNewEbomParentVO extends BaseMaterialVO implements Serializable {
* 来源行ID(原始BOM中的行ID) * 来源行ID(原始BOM中的行ID)
*/ */
@ApiModelProperty(value = "来源行ID(原始BOM中的行ID)") @ApiModelProperty(value = "来源行ID(原始BOM中的行ID)")
private Long sourceRowId; private String sourceRowId;
/** /**
* 设计人员编码 * 设计人员编码

View File

@ -189,6 +189,9 @@ public class BomOriginalListVO extends BaseMaterialVO {
@ApiModelProperty(value = "原始单位-来自cad") @ApiModelProperty(value = "原始单位-来自cad")
private String materialOriginalUnit; private String materialOriginalUnit;
@ApiModelProperty("来源行ID,多个以逗号隔开")
private String sourceRowId;
public Integer getVirtualPartType() { public Integer getVirtualPartType() {
if( drawingNo.contains(VirtualPackageTypeEnum.DELIVERY_PACKAGE.getConMaterialName())){ if( drawingNo.contains(VirtualPackageTypeEnum.DELIVERY_PACKAGE.getConMaterialName())){
return VirtualPackageTypeEnum.DELIVERY_PACKAGE.getValue(); return VirtualPackageTypeEnum.DELIVERY_PACKAGE.getValue();

View File

@ -2299,25 +2299,31 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
return datas; return datas;
} }
public BomOriginalListVO getSource(Long rowId) { public List<BomOriginalListVO> getSource(Long rowId) {
VUtils.isTure(Objects.isNull(rowId) || rowId == 0).throwMessage("无效的数据"); VUtils.isTure(Objects.isNull(rowId) || rowId == 0).throwMessage("无效的数据");
BomNewEbomParentEntity parent = getById(rowId); BomNewEbomParentEntity parent = getById(rowId);
if (!Objects.isNull(parent)) { if (!Objects.isNull(parent)) {
if (parent.getSourceRowId() != 0) { if (StrUtil.isNotBlank(parent.getSourceRowId())) {
BomNewOriginalParentEntity op = originalParentService.getById(parent.getSourceRowId()); List<Long> rowIds = Arrays.stream(parent.getSourceRowId().split(",")).map(Long::valueOf).collect(Collectors.toList());
if (!Objects.isNull(op)) { List<BomNewOriginalParentEntity> originals = originalParentService.lambdaQuery()
return Convert.convert(BomOriginalListVO.class, op); .in(BomNewOriginalParentEntity::getRowId, rowIds)
.list();
if (CollUtil.isNotEmpty(originals)) {
return Convert.toList(BomOriginalListVO.class, originals);
} }
} }
} else { } else {
BomNewEbomChildEntity child = ebomChildService.getById(rowId); BomNewEbomChildEntity child = ebomChildService.getById(rowId);
if (!Objects.isNull(child)) { if (!Objects.isNull(child)) {
if (child.getSourceRowId() != 0) { if (StrUtil.isNotBlank(child.getSourceRowId())) {
BomNewOriginalChildEntity oc = originalChildService.getById(child.getSourceRowId()); List<Long> rowIds = Arrays.stream(child.getSourceRowId().split(",")).map(Long::valueOf).collect(Collectors.toList());
if (!Objects.isNull(oc)) { List<BomNewOriginalChildEntity> originals = originalChildService.lambdaQuery()
return Convert.convert(BomOriginalListVO.class, oc); .in(BomNewOriginalChildEntity::getRowId, rowIds)
.list();
if (CollUtil.isNotEmpty(originals)) {
return Convert.toList(BomOriginalListVO.class, originals);
} }
} }
} }

View File

@ -73,7 +73,7 @@ public class EBomEdit {
parent.setCurrentVersion("A00"); parent.setCurrentVersion("A00");
parent.setDeviseName(SessionUtil.getRealName()); parent.setDeviseName(SessionUtil.getRealName());
parent.setDeptName(SessionUtil.getDepartName()); parent.setDeptName(SessionUtil.getDepartName());
parent.setSourceRowId(0L); parent.setSourceRowId("");
parent.setSource(source); parent.setSource(source);
parent.setStatus(EBomStatusEnum.WAIT_CHECK.getValue()); parent.setStatus(EBomStatusEnum.WAIT_CHECK.getValue());
parent.setNum(new BigDecimal(1)); parent.setNum(new BigDecimal(1));
@ -201,7 +201,7 @@ public class EBomEdit {
child.setSource(source); child.setSource(source);
child.setCreatedTime(LocalDateTime.now()); child.setCreatedTime(LocalDateTime.now());
child.setCreatedBy(SessionUtil.getUserCode()); child.setCreatedBy(SessionUtil.getUserCode());
child.setSourceRowId(0L); child.setSourceRowId("");
child.setParentRowId(parentEntity.getRowId()); child.setParentRowId(parentEntity.getRowId());
if(StrUtil.isEmpty(child.getOrderNumber())){ if(StrUtil.isEmpty(child.getOrderNumber())){
child.setOrderNumber("00"); child.setOrderNumber("00");

View File

@ -200,7 +200,7 @@ public class EBomToPBom {
BomNewEbomParentVO lastVirtualPackage = getLastVirtualPackage(vo, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE); BomNewEbomParentVO lastVirtualPackage = getLastVirtualPackage(vo, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
if (Objects.nonNull(lastVirtualPackage)) { if (Objects.nonNull(lastVirtualPackage)) {
liftingLayerSummary(lastVirtualPackage, vo); liftingLayerSummary(lastVirtualPackage, vo);
vo.setSourceRowId(vo.getParentRowId()); vo.setSourceRowId(String.valueOf(vo.getParentRowId()));
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId())); vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
vo.setParentRowId(lastVirtualPackage.getBomRowId()); vo.setParentRowId(lastVirtualPackage.getBomRowId());
result.add(vo); result.add(vo);
@ -215,7 +215,7 @@ public class EBomToPBom {
BomNewEbomParentVO lastVirtualPackage = getLastVirtualPackage(vo, VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE); BomNewEbomParentVO lastVirtualPackage = getLastVirtualPackage(vo, VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
if (Objects.nonNull(lastVirtualPackage)) { if (Objects.nonNull(lastVirtualPackage)) {
liftingLayerSummary(lastVirtualPackage, vo); liftingLayerSummary(lastVirtualPackage, vo);
vo.setSourceRowId(vo.getParentRowId()); vo.setSourceRowId(String.valueOf(vo.getParentRowId()));
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId())); vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
vo.setParentRowId(lastVirtualPackage.getBomRowId()); vo.setParentRowId(lastVirtualPackage.getBomRowId());
result.add(vo); result.add(vo);

View File

@ -278,7 +278,8 @@ public abstract class VirtualPackageBase {
parent.setShouldBomExist(1); parent.setShouldBomExist(1);
parent.setBomExist(1); parent.setBomExist(1);
parent.setMaterialUnit("PC"); parent.setMaterialUnit("PC");
parent.setSourceRowId(0L); parent.setMaterialOriginalUnit("PC");
parent.setSourceRowId("");
parent.setLastVersionIs(1); parent.setLastVersionIs(1);
parent.setNum(new BigDecimal(1)); parent.setNum(new BigDecimal(1));
parent.setDeviseUserCode(SessionUtil.getUserCode()); parent.setDeviseUserCode(SessionUtil.getUserCode());

View File

@ -323,7 +323,7 @@ public class OriginalBomToEBomConvert extends BaseConvert {
eBomParent.setSource(EBomSourceEnum.FROM_BOM.getValue()); eBomParent.setSource(EBomSourceEnum.FROM_BOM.getValue());
eBomParent.setCurrentVersion(VersionUtil.getNextVersion(Objects.isNull(ebom) ? "" : VersionUtil.getNextVersion(ebom.getCurrentVersion()) )); eBomParent.setCurrentVersion(VersionUtil.getNextVersion(Objects.isNull(ebom) ? "" : VersionUtil.getNextVersion(ebom.getCurrentVersion()) ));
eBomParent.setConvertToEbomTime(LocalDateTime.now()); eBomParent.setConvertToEbomTime(LocalDateTime.now());
eBomParent.setSourceRowId(parentEnt.getBomRowId()); eBomParent.setSourceRowId(String.valueOf(parentEnt.getBomRowId()));
eBomParent.setLastVersionIs(1); eBomParent.setLastVersionIs(1);
eBomParent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue()); eBomParent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
//eBomParent.setModifyTime(LocalDateTime.now()); //eBomParent.setModifyTime(LocalDateTime.now());

View File

@ -97,6 +97,39 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
} }
/**
* 合并一般零部件
* @param list
* @return
*/
private List<BomOriginalListVO> mergeCommonPartBOM(List<BomOriginalListVO> list) {
List<BomOriginalListVO> result = new ArrayList();
//子级中一般零部件
List<BomOriginalListVO> commonPartList = list.stream().filter(u -> StrUtil.isBlank(u.getMaterialNo()) && OriginalConstant.COMMON_MATERIAL_CATEGORY_CODE.equals(u.getMaterialCategoryCode())).collect(Collectors.toList());
Map<String, List<BomOriginalListVO>> materialNoGroupMp =commonPartList.stream().collect(Collectors.groupingBy(BomOriginalListVO::getMaterialNo));
for (Map.Entry<String, List<BomOriginalListVO>> entry : materialNoGroupMp.entrySet()) {
List<BomOriginalListVO> list1 = entry.getValue();
BomOriginalListVO one = list1.get(0);
BigDecimal numResult = BigDecimal.ZERO;
BigDecimal totalWeightResult = BigDecimal.ZERO;
List<Long> rowIds=new ArrayList<>();
for (BomOriginalListVO item : list1) {
numResult = NumberUtil.add(numResult, Objects.nonNull(item.getNum()) ? item.getNum() : BigDecimal.ZERO);
totalWeightResult = NumberUtil.add(totalWeightResult, item.getTotalWeight());
rowIds.add(item.getRowId());
}
one.setNum(numResult);
one.setTotalWeight(totalWeightResult);
one.setSourceRowId(StrUtil.join(",",rowIds) );
result.add(one);
}
Set<Long> commonPartRowIds = commonPartList.stream().map(u -> u.getRowId()).collect(Collectors.toSet());
result.addAll(list.stream().filter(u->!commonPartRowIds.contains(u.getRowId())).collect(Collectors.toList()));
return result;
}
/** /**
* BOM-处理 * BOM-处理
@ -108,6 +141,9 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
//子节点 //子节点
List<BomOriginalListVO> parentChild = bomDetail.stream().filter(u -> Objects.nonNull(u.getParentRowId()) && u.getParentRowId().equals(parentEnt.getBomRowId())).distinct().collect(Collectors.toList()); List<BomOriginalListVO> parentChild = bomDetail.stream().filter(u -> Objects.nonNull(u.getParentRowId()) && u.getParentRowId().equals(parentEnt.getBomRowId())).distinct().collect(Collectors.toList());
//合并一般零部件
mergeCommonPartBOM(parentChild);
BomNewEbomParentEntity oldEBom = ebomParentService.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parentEnt.getMaterialNo()).last(" order by current_version desc limit 1").one(); BomNewEbomParentEntity oldEBom = ebomParentService.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parentEnt.getMaterialNo()).last(" order by current_version desc limit 1").one();
List<BomNewEbomChildEntity> oldParenChild = ebomChildService.getBaseMapper().getChildByMaterialNo(parentEnt.getMaterialNo()); List<BomNewEbomChildEntity> oldParenChild = ebomChildService.getBaseMapper().getChildByMaterialNo(parentEnt.getMaterialNo());
//无Ebom时 //无Ebom时
@ -324,7 +360,7 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
eBomParent.setSource(EBomSourceEnum.FROM_BOM.getValue()); eBomParent.setSource(EBomSourceEnum.FROM_BOM.getValue());
eBomParent.setCurrentVersion(VersionUtil.getNextVersion(Objects.isNull(ebom) ? "" : VersionUtil.getNextVersion(ebom.getCurrentVersion()))); eBomParent.setCurrentVersion(VersionUtil.getNextVersion(Objects.isNull(ebom) ? "" : VersionUtil.getNextVersion(ebom.getCurrentVersion())));
eBomParent.setConvertToEbomTime(LocalDateTime.now()); eBomParent.setConvertToEbomTime(LocalDateTime.now());
eBomParent.setSourceRowId(parentEnt.getRowId()); eBomParent.setSourceRowId(StrUtil.isNotBlank(parentEnt.getSourceRowId())?parentEnt.getSourceRowId(): parentEnt.getRowId().toString());
eBomParent.setLastVersionIs(1); eBomParent.setLastVersionIs(1);
eBomParent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue()); eBomParent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
//eBomParent.setModifyTime(LocalDateTime.now()); //eBomParent.setModifyTime(LocalDateTime.now());
@ -376,7 +412,7 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
childEntity.setParentRowId(parentRowId); childEntity.setParentRowId(parentRowId);
childEntity.setIdentityNo(StrUtil.join("_", parentRowId.toString(), childEntity.getRowId())); childEntity.setIdentityNo(StrUtil.join("_", parentRowId.toString(), childEntity.getRowId()));
childEntity.setModifyTime(LocalDateTime.now()); childEntity.setModifyTime(LocalDateTime.now());
childEntity.setSourceRowId(child.getRowId()); childEntity.setSourceRowId(StrUtil.isNotBlank(child.getSourceRowId())?child.getSourceRowId(): child.getRowId().toString());
//当为原材料时数量=总重 单位改为KG 图号=编码 //当为原材料时数量=总重 单位改为KG 图号=编码
// if((StrUtil.isNotBlank(childEntity.getMaterialCategoryCode())&& childEntity.getMaterialCategoryCode().startsWith("10") ) || (StrUtil.isNotBlank(childEntity.getMaterialNo()) && childEntity.getMaterialNo().startsWith("11"))){ // if((StrUtil.isNotBlank(childEntity.getMaterialCategoryCode())&& childEntity.getMaterialCategoryCode().startsWith("10") ) || (StrUtil.isNotBlank(childEntity.getMaterialNo()) && childEntity.getMaterialNo().startsWith("11"))){
// childEntity.setNum(childEntity.getTotalWeight()); // childEntity.setNum(childEntity.getTotalWeight());

View File

@ -29,7 +29,7 @@
<result column="exception_tag" property="exceptionTag" jdbcType="VARCHAR"/> <result column="exception_tag" property="exceptionTag" jdbcType="VARCHAR"/>
<result column="source" property="source" jdbcType="INTEGER"/> <result column="source" property="source" jdbcType="INTEGER"/>
<result column="source_row_id" property="sourceRowId" jdbcType="BIGINT"/> <result column="source_row_id" property="sourceRowId" jdbcType="VARCHAR"/>
<result column="remark" property="remark" jdbcType="VARCHAR"/> <result column="remark" property="remark" jdbcType="VARCHAR"/>
<result column="virtual_part_type" property="virtualPartType" jdbcType="INTEGER"/> <result column="virtual_part_type" property="virtualPartType" jdbcType="INTEGER"/>
<result column="virtual_part_root_material_no" property="virtualPartRootMaterialNo" /> <result column="virtual_part_root_material_no" property="virtualPartRootMaterialNo" />

View File

@ -30,7 +30,7 @@
<result column="user_root_is" property="userRootIs" jdbcType="INTEGER"/> <result column="user_root_is" property="userRootIs" jdbcType="INTEGER"/>
<result column="exception_status" property="exceptionStatus" jdbcType="INTEGER"/> <result column="exception_status" property="exceptionStatus" jdbcType="INTEGER"/>
<result column="virtual_package_is" property="virtualPackageIs" jdbcType="INTEGER"/> <result column="virtual_package_is" property="virtualPackageIs" jdbcType="INTEGER"/>
<result column="source_row_id" property="sourceRowId" jdbcType="BIGINT"/> <result column="source_row_id" property="sourceRowId" jdbcType="VARCHAR"/>
<result column="devise_user_code" property="deviseUserCode" jdbcType="VARCHAR"/> <result column="devise_user_code" property="deviseUserCode" jdbcType="VARCHAR"/>
<result column="devise_name" property="deviseName" jdbcType="VARCHAR"/> <result column="devise_name" property="deviseName" jdbcType="VARCHAR"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/> <result column="created_by" property="createdBy" jdbcType="VARCHAR"/>