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:
commit
afec61231a
|
|
@ -484,7 +484,7 @@ public class EbomApi extends BaseApi {
|
|||
*/
|
||||
@GetMapping("getSource")
|
||||
@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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,8 +197,8 @@ public class BomNewEbomChildEntity implements Serializable {
|
|||
* 来源行ID(原始BOM中的行ID)
|
||||
*/
|
||||
@TableField(value = "source_row_id")
|
||||
@ApiModelProperty(value = "来源行ID(原始BOM中的行ID)")
|
||||
private Long sourceRowId;
|
||||
@ApiModelProperty(value = "来源行ID(原始BOM中的行ID),多个以逗号隔开")
|
||||
private String sourceRowId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ public class BomNewEbomParentEntity implements Serializable {
|
|||
*/
|
||||
@TableField(value = "source_row_id")
|
||||
@ApiModelProperty(value = "来源行ID(原始BOM中的行ID)")
|
||||
private Long sourceRowId;
|
||||
private String sourceRowId;
|
||||
|
||||
/**
|
||||
* 设计人员编码
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ public class BomNewEbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
* 来源行ID(原始BOM中的行ID)
|
||||
*/
|
||||
@ApiModelProperty(value = "来源行ID(原始BOM中的行ID)")
|
||||
private Long sourceRowId;
|
||||
private String sourceRowId;
|
||||
|
||||
/**
|
||||
* 设计人员编码
|
||||
|
|
|
|||
|
|
@ -189,6 +189,9 @@ public class BomOriginalListVO extends BaseMaterialVO {
|
|||
@ApiModelProperty(value = "原始单位-来自cad")
|
||||
private String materialOriginalUnit;
|
||||
|
||||
@ApiModelProperty("来源行ID,多个以逗号隔开")
|
||||
private String sourceRowId;
|
||||
|
||||
public Integer getVirtualPartType() {
|
||||
if( drawingNo.contains(VirtualPackageTypeEnum.DELIVERY_PACKAGE.getConMaterialName())){
|
||||
return VirtualPackageTypeEnum.DELIVERY_PACKAGE.getValue();
|
||||
|
|
|
|||
|
|
@ -2299,25 +2299,31 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
return datas;
|
||||
}
|
||||
|
||||
public BomOriginalListVO getSource(Long rowId) {
|
||||
public List<BomOriginalListVO> getSource(Long rowId) {
|
||||
VUtils.isTure(Objects.isNull(rowId) || rowId == 0).throwMessage("无效的数据");
|
||||
|
||||
BomNewEbomParentEntity parent = getById(rowId);
|
||||
|
||||
if (!Objects.isNull(parent)) {
|
||||
if (parent.getSourceRowId() != 0) {
|
||||
BomNewOriginalParentEntity op = originalParentService.getById(parent.getSourceRowId());
|
||||
if (!Objects.isNull(op)) {
|
||||
return Convert.convert(BomOriginalListVO.class, op);
|
||||
if (StrUtil.isNotBlank(parent.getSourceRowId())) {
|
||||
List<Long> rowIds = Arrays.stream(parent.getSourceRowId().split(",")).map(Long::valueOf).collect(Collectors.toList());
|
||||
List<BomNewOriginalParentEntity> originals = originalParentService.lambdaQuery()
|
||||
.in(BomNewOriginalParentEntity::getRowId, rowIds)
|
||||
.list();
|
||||
if (CollUtil.isNotEmpty(originals)) {
|
||||
return Convert.toList(BomOriginalListVO.class, originals);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
BomNewEbomChildEntity child = ebomChildService.getById(rowId);
|
||||
if (!Objects.isNull(child)) {
|
||||
if (child.getSourceRowId() != 0) {
|
||||
BomNewOriginalChildEntity oc = originalChildService.getById(child.getSourceRowId());
|
||||
if (!Objects.isNull(oc)) {
|
||||
return Convert.convert(BomOriginalListVO.class, oc);
|
||||
if (StrUtil.isNotBlank(child.getSourceRowId())) {
|
||||
List<Long> rowIds = Arrays.stream(child.getSourceRowId().split(",")).map(Long::valueOf).collect(Collectors.toList());
|
||||
List<BomNewOriginalChildEntity> originals = originalChildService.lambdaQuery()
|
||||
.in(BomNewOriginalChildEntity::getRowId, rowIds)
|
||||
.list();
|
||||
if (CollUtil.isNotEmpty(originals)) {
|
||||
return Convert.toList(BomOriginalListVO.class, originals);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class EBomEdit {
|
|||
parent.setCurrentVersion("A00");
|
||||
parent.setDeviseName(SessionUtil.getRealName());
|
||||
parent.setDeptName(SessionUtil.getDepartName());
|
||||
parent.setSourceRowId(0L);
|
||||
parent.setSourceRowId("");
|
||||
parent.setSource(source);
|
||||
parent.setStatus(EBomStatusEnum.WAIT_CHECK.getValue());
|
||||
parent.setNum(new BigDecimal(1));
|
||||
|
|
@ -201,7 +201,7 @@ public class EBomEdit {
|
|||
child.setSource(source);
|
||||
child.setCreatedTime(LocalDateTime.now());
|
||||
child.setCreatedBy(SessionUtil.getUserCode());
|
||||
child.setSourceRowId(0L);
|
||||
child.setSourceRowId("");
|
||||
child.setParentRowId(parentEntity.getRowId());
|
||||
if(StrUtil.isEmpty(child.getOrderNumber())){
|
||||
child.setOrderNumber("00");
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ public class EBomToPBom {
|
|||
BomNewEbomParentVO lastVirtualPackage = getLastVirtualPackage(vo, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
if (Objects.nonNull(lastVirtualPackage)) {
|
||||
liftingLayerSummary(lastVirtualPackage, vo);
|
||||
vo.setSourceRowId(vo.getParentRowId());
|
||||
vo.setSourceRowId(String.valueOf(vo.getParentRowId()));
|
||||
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
|
||||
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
||||
result.add(vo);
|
||||
|
|
@ -215,7 +215,7 @@ public class EBomToPBom {
|
|||
BomNewEbomParentVO lastVirtualPackage = getLastVirtualPackage(vo, VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
if (Objects.nonNull(lastVirtualPackage)) {
|
||||
liftingLayerSummary(lastVirtualPackage, vo);
|
||||
vo.setSourceRowId(vo.getParentRowId());
|
||||
vo.setSourceRowId(String.valueOf(vo.getParentRowId()));
|
||||
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
|
||||
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
||||
result.add(vo);
|
||||
|
|
|
|||
|
|
@ -278,7 +278,8 @@ public abstract class VirtualPackageBase {
|
|||
parent.setShouldBomExist(1);
|
||||
parent.setBomExist(1);
|
||||
parent.setMaterialUnit("PC");
|
||||
parent.setSourceRowId(0L);
|
||||
parent.setMaterialOriginalUnit("PC");
|
||||
parent.setSourceRowId("");
|
||||
parent.setLastVersionIs(1);
|
||||
parent.setNum(new BigDecimal(1));
|
||||
parent.setDeviseUserCode(SessionUtil.getUserCode());
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ public class OriginalBomToEBomConvert extends BaseConvert {
|
|||
eBomParent.setSource(EBomSourceEnum.FROM_BOM.getValue());
|
||||
eBomParent.setCurrentVersion(VersionUtil.getNextVersion(Objects.isNull(ebom) ? "" : VersionUtil.getNextVersion(ebom.getCurrentVersion()) ));
|
||||
eBomParent.setConvertToEbomTime(LocalDateTime.now());
|
||||
eBomParent.setSourceRowId(parentEnt.getBomRowId());
|
||||
eBomParent.setSourceRowId(String.valueOf(parentEnt.getBomRowId()));
|
||||
eBomParent.setLastVersionIs(1);
|
||||
eBomParent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||
//eBomParent.setModifyTime(LocalDateTime.now());
|
||||
|
|
|
|||
|
|
@ -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-处理
|
||||
|
|
@ -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());
|
||||
|
||||
//合并一般零部件
|
||||
mergeCommonPartBOM(parentChild);
|
||||
|
||||
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());
|
||||
//无Ebom时
|
||||
|
|
@ -324,7 +360,7 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
|||
eBomParent.setSource(EBomSourceEnum.FROM_BOM.getValue());
|
||||
eBomParent.setCurrentVersion(VersionUtil.getNextVersion(Objects.isNull(ebom) ? "" : VersionUtil.getNextVersion(ebom.getCurrentVersion())));
|
||||
eBomParent.setConvertToEbomTime(LocalDateTime.now());
|
||||
eBomParent.setSourceRowId(parentEnt.getRowId());
|
||||
eBomParent.setSourceRowId(StrUtil.isNotBlank(parentEnt.getSourceRowId())?parentEnt.getSourceRowId(): parentEnt.getRowId().toString());
|
||||
eBomParent.setLastVersionIs(1);
|
||||
eBomParent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||
//eBomParent.setModifyTime(LocalDateTime.now());
|
||||
|
|
@ -376,7 +412,7 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
|||
childEntity.setParentRowId(parentRowId);
|
||||
childEntity.setIdentityNo(StrUtil.join("_", parentRowId.toString(), childEntity.getRowId()));
|
||||
childEntity.setModifyTime(LocalDateTime.now());
|
||||
childEntity.setSourceRowId(child.getRowId());
|
||||
childEntity.setSourceRowId(StrUtil.isNotBlank(child.getSourceRowId())?child.getSourceRowId(): child.getRowId().toString());
|
||||
//当为原材料时,数量=总重 单位改为KG 图号=编码
|
||||
// if((StrUtil.isNotBlank(childEntity.getMaterialCategoryCode())&& childEntity.getMaterialCategoryCode().startsWith("10") ) || (StrUtil.isNotBlank(childEntity.getMaterialNo()) && childEntity.getMaterialNo().startsWith("11"))){
|
||||
// childEntity.setNum(childEntity.getTotalWeight());
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<result column="exception_tag" property="exceptionTag" jdbcType="VARCHAR"/>
|
||||
|
||||
<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="virtual_part_type" property="virtualPartType" jdbcType="INTEGER"/>
|
||||
<result column="virtual_part_root_material_no" property="virtualPartRootMaterialNo" />
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<result column="user_root_is" property="userRootIs" jdbcType="INTEGER"/>
|
||||
<result column="exception_status" property="exceptionStatus" 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_name" property="deviseName" jdbcType="VARCHAR"/>
|
||||
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue