fix(ebom): 修改source_row_id由long变为string的相关问题

This commit is contained in:
曹鹏飞 2024-05-11 15:34:08 +08:00
parent a411e7f8b5
commit 92b57a06f0
6 changed files with 22 additions and 16 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

@ -2305,25 +2305,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("0"); 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("0"); 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

@ -193,7 +193,7 @@ public abstract class VirtualPackageBase {
parent.setBomExist(1); parent.setBomExist(1);
parent.setMaterialUnit("PC"); parent.setMaterialUnit("PC");
parent.setMaterialOriginalUnit("PC"); parent.setMaterialOriginalUnit("PC");
parent.setSourceRowId(0L); 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());