optimize: 电气bom功能

This commit is contained in:
曹鹏飞 2024-04-26 16:02:27 +08:00
parent b6273ac9ae
commit 2f138ae0c0
4 changed files with 13 additions and 8 deletions

View File

@ -48,6 +48,13 @@ public class DQbomExcelVO extends BaseImportExcelDTO {
@ExcelColumn("项目类别") @ExcelColumn("项目类别")
private String projectType; private String projectType;
public String getProjectType() {
if (StrUtil.isBlank(projectType)) {
return "";
}
return projectType;
}
@ExcelColumn("版本") @ExcelColumn("版本")
private String currentVersion; private String currentVersion;

View File

@ -124,9 +124,7 @@ public class BomNewDQbomExceptionCheckService {
private void checkParent(BomNewDQbomParentEntity parent) { private void checkParent(BomNewDQbomParentEntity parent) {
EBomExceptionStatusEnum status = EBomExceptionStatusEnum.OK; EBomExceptionStatusEnum status = EBomExceptionStatusEnum.OK;
if (parent.getRootIs() == 1 || parent.getUserRootIs() == 1) { if (parent.getRootIs() == 1 || parent.getUserRootIs() == 1) {
if (StrUtil.isBlank(parent.getProjectType())) { if (StrUtil.equals(BomConstant.PROJECT_TYPE_TEMPORARY, parent.getProjectType())) {
status = EBomExceptionStatusEnum.EXCEPT_NO_8;
} else if (BomConstant.PROJECT_TYPE_TEMPORARY.equals(parent.getProjectType()) || "Q".equals(parent.getProjectType())) {
if (StrUtil.isBlank(parent.getMaterialName())) { if (StrUtil.isBlank(parent.getMaterialName())) {
status = EBomExceptionStatusEnum.EXCEPT_NO_4; status = EBomExceptionStatusEnum.EXCEPT_NO_4;
} }
@ -167,7 +165,7 @@ public class BomNewDQbomExceptionCheckService {
EBomExceptionStatusEnum status = EBomExceptionStatusEnum.OK; EBomExceptionStatusEnum status = EBomExceptionStatusEnum.OK;
if (StrUtil.isBlank(child.getProjectType())) { if (StrUtil.isBlank(child.getProjectType())) {
status = EBomExceptionStatusEnum.EXCEPT_NO_8; status = EBomExceptionStatusEnum.EXCEPT_NO_8;
} else if (BomConstant.PROJECT_TYPE_TEMPORARY.equals(child.getProjectType()) || "Q".equals(child.getProjectType())) { } else if (StrUtil.equals(BomConstant.PROJECT_TYPE_TEMPORARY, child.getProjectType())) {
if (StrUtil.isBlank(child.getMaterialName())) { if (StrUtil.isBlank(child.getMaterialName())) {
status = EBomExceptionStatusEnum.EXCEPT_NO_4; status = EBomExceptionStatusEnum.EXCEPT_NO_4;
} }

View File

@ -390,7 +390,7 @@ public class DQBomImportService {
dQbomExcelVO.setNum(BigDecimal.ONE); dQbomExcelVO.setNum(BigDecimal.ONE);
} }
} }
if (StrUtil.equals(dQbomExcelVO.getMaterialNo(), "9000000000")) { if (StrUtil.equals(dQbomExcelVO.getMaterialNo(), BomConstant.PROJECT_TYPE_TEMPORARY_MATERIAL_NO)) {
dQbomExcelVO.setProjectType(BomConstant.PROJECT_TYPE_TEMPORARY); dQbomExcelVO.setProjectType(BomConstant.PROJECT_TYPE_TEMPORARY);
} }
dQbomExcelVO.setCurrentVersion(""); dQbomExcelVO.setCurrentVersion("");

View File

@ -308,8 +308,8 @@ public class DQBomService {
VUtils.isTure(!SessionUtil.getUserCode().equals(root.getCreatedBy())).throwMessage("不能删除他人创建的bom"); VUtils.isTure(!SessionUtil.getUserCode().equals(root.getCreatedBy())).throwMessage("不能删除他人创建的bom");
VUtils.isTure(root.getStatus().equals(DQBomStatusEnum.PUBLISHED.getValue())).throwMessage("不能删除已发布的bom"); VUtils.isTure(root.getStatus().equals(DQBomStatusEnum.PUBLISHED.getValue())).throwMessage("不能删除已发布的bom");
List<Long> liChildren = new ArrayList<>(); Set<Long> liChildren = new HashSet<>();
List<Long> liParents = new ArrayList<>(); Set<Long> liParents = new HashSet<>();
liParents.add(root.getRowId()); liParents.add(root.getRowId());
List<BomNewDQbomVO> children = dQBomChildService.getBomsByParentRowId(rowId); List<BomNewDQbomVO> children = dQBomChildService.getBomsByParentRowId(rowId);
children.forEach(c -> { children.forEach(c -> {
@ -319,7 +319,7 @@ public class DQBomService {
dQBomChildService.getBaseMapper().deleteBatchIds(liChildren); dQBomChildService.getBaseMapper().deleteBatchIds(liChildren);
} }
private void delete(List<Long> parents, List<Long> children, BomNewDQbomVO bom) { private void delete(Set<Long> parents, Set<Long> children, BomNewDQbomVO bom) {
children.add(bom.getRowId()); children.add(bom.getRowId());
if (!Objects.isNull(bom.getBomRowId()) && bom.getBomCreateBy().equals(SessionUtil.getUserCode())) { if (!Objects.isNull(bom.getBomRowId()) && bom.getBomCreateBy().equals(SessionUtil.getUserCode())) {
parents.add(bom.getBomRowId()); parents.add(bom.getBomRowId());