diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java index 95d71802..2c911632 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java @@ -243,13 +243,13 @@ public class BomNewPbomParentService extends ServiceImpl(result)).writeTo(response.getOutputStream()); } - public List getChild(Long rowId) { - - List parentChild = this.getBaseMapper().getParentChild(rowId); - BomNewPbomParentEntity parent = this.getById(rowId); + public List getChild(BomNewPbomParentEntity parent) { + //List parentChild = this.getBaseMapper().getParentChild(rowId); + //BomNewPbomParentEntity parent = this.getById(rowId); + List parentChild = this.getBaseMapper().getParentChild(parent.getRowId()); if (CollUtil.isNotEmpty(parentChild)) { materialMainService.intiMaterialInfo(parentChild, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT); - List materialNos = parentChild.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList()); + List materialNos = parentChild.stream().map(BaseMaterialVO::getMaterialNo).collect(Collectors.toList()); if (CollUtil.isNotEmpty(materialNos)) { List list = this.lambdaQuery().in(BomNewPbomParentEntity::getMaterialNo, materialNos) .eq(!PBomStatusEnum.PUBLISH.equalsValue(parent.getStatus()), BomNewPbomParentEntity::getLastVersionIs, 1) @@ -325,15 +325,18 @@ public class BomNewPbomParentService extends ServiceImpl childList = Convert.toList(BomNewPbomChildEntity.class, paramDTO.getChildList()); - childList.forEach(u -> { - u.setParentRowId(paramDTO.getBomRowId()); - }); - pbomChildService.saveOrUpdateBatch(childList); parent.setEditStatus(editStatus.getValue()); + parent.setModifyTime(LocalDateTime.now()); this.updateById(parent); + + if (CollUtil.isNotEmpty(paramDTO.getChildList())) { + List childList = Convert.toList(BomNewPbomChildEntity.class, paramDTO.getChildList()); + childList.forEach(u -> u.setParentRowId(paramDTO.getBomRowId())); + pbomChildService.saveOrUpdateBatch(childList); + } + if (editStatus == PBomEditStatusEnum.HANDLER_TEMP) { - return getChild(paramDTO.getBomRowId()); + return getChild(parent); } else { return null; } @@ -431,7 +434,8 @@ public class BomNewPbomParentService extends ServiceImpl child = this.getChild(bomRowId); + BomNewPbomParentEntity parent = this.getById(bomRowId); + List child = this.getChild(parent); List result = Convert.toList(BomNewPbomEditExcelVO.class, child); new Workbook().addSheet(new ListSheet<>(result)).writeTo(response.getOutputStream()); @@ -440,7 +444,8 @@ public class BomNewPbomParentService extends ServiceImpl child = this.getChild(param.getBomRowId()); + BomNewPbomParentEntity parent = this.getById(param.getBomRowId()); + List child = this.getChild(parent); if (CollUtil.isNotEmpty(param.getRowIds())) { child = child.stream().filter(u -> param.getRowIds().contains(u.getRowId())).collect(Collectors.toList()); }