diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BaseMaterialVO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BaseMaterialVO.java index 9b2a53d2..1db64c1a 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BaseMaterialVO.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BaseMaterialVO.java @@ -3,6 +3,7 @@ package com.nflg.product.bomnew.pojo.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.math.BigDecimal; import java.util.List; /** @@ -60,7 +61,7 @@ public class BaseMaterialVO { @ApiModelProperty("单位") private String materialUnit; - - + @ApiModelProperty("单重") + private BigDecimal materialWeight; } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java index 0f9c48fe..5021cc88 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java @@ -199,8 +199,8 @@ public class BomNewEbomParentService extends ServiceImpl getBatchParentMaterialByMaterialNo(List materialNos) { - List materialBom = bomNewEbomMaterialUseService.lambdaQuery().in(BomNewEbomMaterialUseEntity::getMaterialNo, materialNos).list(); + public List getBatchParentMaterialByMaterialNo(List materialNos) { + List materialBom = bomNewEbomMaterialUseService.lambdaQuery().in(BomNewEbomMaterialUseEntity::getMaterialNo, materialNos).list(); List result = new ArrayList<>(); if (CollUtil.isNotEmpty(materialBom)) { Set relSkuNo = getParentMaterialByUse(materialBom); @@ -215,9 +215,9 @@ public class BomNewEbomParentService extends ServiceImpl getParentMaterialByUse(List list){ - Set result=new HashSet<>(); - for ( BomNewEbomMaterialUseEntity materialUse: list) { + private Set getParentMaterialByUse(List list) { + Set result = new HashSet<>(); + for (BomNewEbomMaterialUseEntity materialUse : list) { Set relSkuNo = Sets.newHashSet(StrUtil.split(materialUse.getParentMaterialNo(), ",")); result.addAll(relSkuNo); } @@ -287,12 +287,11 @@ public class BomNewEbomParentService extends ServiceImpl list, String ... ignorePropertyList) { + public void initBomException(List list, String... ignorePropertyList) { CheckEBomException checkEBomException = new CheckEBomException(list); checkEBomException.initException(ignorePropertyList); @@ -429,9 +428,9 @@ public class BomNewEbomParentService extends ServiceImpl list) { + public void checkBomException(List list, List unCheckList) { CheckEBomException checkEBomException = new CheckEBomException(list); + checkEBomException.setUnCheckExcept(unCheckList); checkEBomException.checkException(); //保存异常 @@ -452,10 +451,10 @@ public class BomNewEbomParentService extends ServiceImpl allBomDetail = checkEBomException.getAllBomDetail(); //父级 - List parents = allBomDetail.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList()); + List parents = allBomDetail.stream().filter(u -> u.getBomRowId() != null && u.getBomRowId() > 0).collect(Collectors.toList()); if (CollUtil.isNotEmpty(parents)) { List pentList = new ArrayList<>(); parents.forEach(k -> { @@ -469,7 +468,7 @@ public class BomNewEbomParentService extends ServiceImpl child = allBomDetail.stream().filter(u -> u.getRowId() > 0).collect(Collectors.toList()); + List child = allBomDetail.stream().filter(u -> u.getRowId() != null && u.getRowId() > 0).collect(Collectors.toList()); if (CollUtil.isNotEmpty(parents)) { List childList = new ArrayList<>(); child.forEach(k -> { @@ -509,10 +508,11 @@ public class BomNewEbomParentService extends ServiceImpl bomRowIds) throws ExecutionException, InterruptedException { + public void batchCheckAndSaveEBomException(List bomRowIds) throws ExecutionException, InterruptedException { for (Long bomRowId : bomRowIds) { CheckEBomException checkEBomException = new CheckEBomException(bomRowId); checkEBomException.initException(); @@ -524,9 +524,6 @@ public class BomNewEbomParentService extends ServiceImpl list, HttpServletResponse response) throws IOException { final ListSheet listSheet = new ListSheet() { Long n = 0L; Long pages = 1L; + @Override protected List more() { @@ -662,18 +656,15 @@ public class BomNewEbomParentService extends ServiceImpl bomRowIds, HttpServletResponse response) throws IOException { final ListSheet listSheet = new ListSheet() { Long n = 0L; Long pages = 1L; + @Override protected List more() { - List child = getChildBatch(bomRowIds); + List child = getChildBatch(bomRowIds); return n++ < pages ? Convert.toList(EbomExcelVO.class, child) : null; } }; @@ -681,9 +672,6 @@ public class BomNewEbomParentService extends ServiceImpl result = EecExcelUtil.getExcelContext(inputStream, BomNewEBomImportExcelDTO.class); - if(CollectionUtil.isEmpty(result)){ - throw new NflgBusinessException(STATE.Error,"上传数据为空"); + if (CollectionUtil.isEmpty(result)) { + throw new NflgBusinessException(STATE.Error, "上传数据为空"); } List materialNos = result.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList()); CheckEBomException.checkMaterialNoInMain1(materialNos); - EBomImportExcelCheck eBomImportExcelCheck=new EBomImportExcelCheck(); + EBomImportExcelCheck eBomImportExcelCheck = new EBomImportExcelCheck(); eBomImportExcelCheck.validData(result); List datas = Convert.convert(new TypeReference>() { }, result); BomNewEbomParentEntity parentEntity = this.getBaseMapper().selectById(dto.getRowId()); - BomNewEbomParentVO parentVO=Convert.convert(BomNewEbomParentVO.class,parentEntity); + BomNewEbomParentVO parentVO = Convert.convert(BomNewEbomParentVO.class, parentEntity); parentVO.setBomRowId(parentVO.getRowId()); parentVO.setParentRowId(0l); - materialMainService.intiMaterialInfo(datas, "projectType","materialWeight", + materialMainService.intiMaterialInfo(datas, "projectType", "materialWeight", "material_texture"); EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_EXCE.getValue()); BomNewEBomParentEditDTO bomNewEBomParentEditDTO = new BomNewEBomParentEditDTO(); @@ -759,28 +747,26 @@ public class BomNewEbomParentService extends ServiceImpl queryWrapper=new QueryWrapper<>(); - queryWrapper.lambda().eq(BomNewEbomChildEntity::getParentRowId,dto.getRowId()).last("limit 1"); + } else { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(BomNewEbomChildEntity::getParentRowId, dto.getRowId()).last("limit 1"); queryWrapper.lambda().orderByDesc(BomNewEbomChildEntity::getOrderNumber); - BomNewEbomChildEntity entity= ebomChildService.getOne(queryWrapper); - if(entity!=null && StrUtil.isNotEmpty(entity.getOrderNumber())){ - orderNo= Integer.parseInt(entity.getOrderNumber()) ; + BomNewEbomChildEntity entity = ebomChildService.getOne(queryWrapper); + if (entity != null && StrUtil.isNotEmpty(entity.getOrderNumber())) { + orderNo = Integer.parseInt(entity.getOrderNumber()); orderNo++; } } - for(BomNewEbomChildEntity childEntities:eBomEdit.childEntities){ + for (BomNewEbomChildEntity childEntities : eBomEdit.childEntities) { childEntities.setOrderNumber(OrderNoUtil.orderNo2Str(orderNo)); orderNo++; } @@ -912,7 +898,7 @@ public class BomNewEbomParentService extends ServiceImpl materialNoList = pbomList.stream().map(BomNewEbomParentVO::getMaterialNo).collect(Collectors.toList()); throw new NflgBusinessException(STATE.BusinessError, StrUtil.format("物料编号 {} 状态为已发布PBOM,无法退回设计", StrUtil.join(",", materialNoList))); @@ -926,8 +912,7 @@ public class BomNewEbomParentService extends ServiceImpl updateWrapper = new UpdateWrapper<>(); updateWrapper.lambda() .set(BomNewEbomParentEntity::getRevertTime, LocalDateTime.now()) @@ -936,12 +921,12 @@ public class BomNewEbomParentService extends ServiceImpl childWrapper = new UpdateWrapper<>(); + UpdateWrapper childWrapper = new UpdateWrapper<>(); childWrapper.lambda() .set(BomNewEbomChildEntity::getModifyTime, LocalDateTime.now()) .set(BomNewEbomChildEntity::getEditStatus, EbomEditStatusEnum.HANDLER_CREATED.getValue()) - .in(BomNewEbomChildEntity ::getParentRowId, revertList); + .in(BomNewEbomChildEntity::getParentRowId, revertList); if (!this.update(updateWrapper)) { throw new NflgBusinessException(STATE.Error, "退回设计失败"); @@ -1008,9 +993,9 @@ public class BomNewEbomParentService extends ServiceImpl updateReviewIdList = new ArrayList<>(); for (Long bomRowId : rowIds) { - List childList=getBomTree(bomRowId); + List childList = getBomTree(bomRowId); CheckEBomException checkEBomException = new CheckEBomException(childList); - // System.out.println(JSON.toJSONString(checkEBomException.getAllBomDetail())); + // System.out.println(JSON.toJSONString(checkEBomException.getAllBomDetail())); checkEBomException.initException(); //错误状态包含在checkStatus内有异常抛出 checkEBomException.checkContainExcept(checkStatus); @@ -1025,23 +1010,23 @@ public class BomNewEbomParentService extends ServiceImpl updateWrapper=new UpdateWrapper<>(); + if (CollectionUtil.isNotEmpty(updateReviewIdList)) { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); updateWrapper.lambda() - .set(BomNewEbomParentEntity::getAuditTime,LocalDateTime.now()) - .set(BomNewEbomParentEntity::getAuditUserName,SessionUtil.getUserName()) - .set(BomNewEbomParentEntity::getStatus,EBomStatusEnum.CHECKED.getValue()) - .set(BomNewEbomParentEntity::getEditStatus,EbomEditStatusEnum.HANDLER_FINISHED.getValue()) - .in(BomNewEbomParentEntity::getRowId,updateReviewIdList); + .set(BomNewEbomParentEntity::getAuditTime, LocalDateTime.now()) + .set(BomNewEbomParentEntity::getAuditUserName, SessionUtil.getUserName()) + .set(BomNewEbomParentEntity::getStatus, EBomStatusEnum.CHECKED.getValue()) + .set(BomNewEbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_FINISHED.getValue()) + .in(BomNewEbomParentEntity::getRowId, updateReviewIdList); - UpdateWrapper childWrapper = new UpdateWrapper<>(); + UpdateWrapper childWrapper = new UpdateWrapper<>(); childWrapper.lambda() .set(BomNewEbomChildEntity::getModifyTime, LocalDateTime.now()) .set(BomNewEbomChildEntity::getEditStatus, EbomEditStatusEnum.HANDLER_FINISHED.getValue()) - .in(BomNewEbomChildEntity ::getParentRowId, updateReviewIdList); + .in(BomNewEbomChildEntity::getParentRowId, updateReviewIdList); - if (! this.update(updateWrapper)) { + if (!this.update(updateWrapper)) { throw new NflgBusinessException(STATE.Error, "复核失败"); } ebomChildService.update(childWrapper); @@ -1101,7 +1086,7 @@ public class BomNewEbomParentService extends ServiceImpl computeLevelNumAndRootState()); - // computeLevelNumAndRootState(); + ThreadUtil.execAsync(() -> computeLevelNumAndRootState()); + // computeLevelNumAndRootState(); } return true; @@ -1226,8 +1211,6 @@ public class BomNewEbomParentService extends ServiceImpl childList=dto.getDatas(); + List childList = dto.getDatas(); - if( dto.getParent().getRootIs()==null || dto.getParent().getRootIs()==0) { + if (dto.getParent().getRootIs() == null || dto.getParent().getRootIs() == 0) { childList.add(dto.getParent()); } checkAndSaveEBomException(childList); @@ -1281,21 +1264,21 @@ public class BomNewEbomParentService extends ServiceImpl allBom = Convert.convert(new TypeReference>() { - }, eBomEdit.childEntities); + List allBom = Convert.convert(new TypeReference>() { + }, eBomEdit.childEntities); - BomNewEbomParentVO parent = Convert.convert( BomNewEbomParentVO .class - , eBomEdit.parentEntities.get(0)); + BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class + , eBomEdit.parentEntities.get(0)); - if(dto.getParent().getRootIs()==null || dto.getParent().getRootIs()==0) { + if (dto.getParent().getRootIs() == null || dto.getParent().getRootIs() == 0) { allBom.add(parent); } - CheckEBomException checkEBomException = new CheckEBomException(allBom); - checkEBomException.checkContainExcept(checkStatus); + CheckEBomException checkEBomException = new CheckEBomException(allBom); + checkEBomException.checkContainExcept(checkStatus); } if (CollectionUtil.isNotEmpty(eBomEdit.parentEntities)) { @@ -1309,18 +1292,17 @@ public class BomNewEbomParentService extends ServiceImpl childList = dto.getDatas(); - List childList= dto.getDatas(); - - if(dto.getParent().getRootIs()==null || dto.getParent().getRootIs()==0) { + if (dto.getParent().getRootIs() == null || dto.getParent().getRootIs() == 0) { childList.add(dto.getParent()); } checkAndSaveEBomException(childList); - // ebomChildService.getBaseMapper().updateEBomMaterialUse(); + // ebomChildService.getBaseMapper().updateEBomMaterialUse(); ThreadUtil.execAsync(() -> computeLevelNumAndRootState()); return true; @@ -1377,12 +1359,13 @@ public class BomNewEbomParentService extends ServiceImpl checkBom = new ArrayList<>(); - List tmp1=dto.getDatas().stream().filter(item->Objects.nonNull(item.getRowId()) && item.getRowId()>0).collect(Collectors.toList()); - List tmp2=dto.getDatas().stream().filter(item->Objects.isNull(item.getRowId()) || item.getRowId()==0).collect(Collectors.toList()); + List tmp1 = dto.getDatas().stream().filter(item -> Objects.nonNull(item.getRowId()) && item.getRowId() > 0).collect(Collectors.toList()); + List tmp2 = dto.getDatas().stream().filter(item -> Objects.isNull(item.getRowId()) || item.getRowId() == 0).collect(Collectors.toList()); - SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(tmp2); - String[] ignore= new String[]{ + SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(tmp2, ""); + + String[] ignore = new String[]{ "projectType", "procureType", "materialUnit", @@ -1390,32 +1373,39 @@ public class BomNewEbomParentService extends ServiceImpl= 0) { + vo.setUnitWeight(vo.getMaterialWeight()); + } + vo.setTotalWeight(NumberUtil.mul(vo.getUnitWeight(), vo.getNum())); + } } + } return dto.getDatas(); - } +} } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/MaterialMainService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/MaterialMainService.java index b9d4b7a5..f98faba5 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/MaterialMainService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/MaterialMainService.java @@ -128,7 +128,7 @@ public class MaterialMainService extends ServiceImpl */ public void initMaterialForDrawdingNo diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java index 3784daa9..b463a090 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java @@ -22,6 +22,7 @@ import com.nflg.product.bomnew.util.ListCommonUtil; import com.nflg.product.bomnew.util.TreeUtils; import com.nflg.product.bomnew.util.VUtils; import lombok.Getter; +import lombok.Setter; import nflg.product.common.constant.STATE; import java.math.BigDecimal; @@ -36,8 +37,8 @@ public class CheckEBomException { @Getter List allBomDetail ; - - +@Setter + List unCheckExcept; public static void checkMaterialNoInMain1(List materialNos){ @@ -98,6 +99,13 @@ public class CheckEBomException { public void checkException(){ for (BomNewEbomParentVO vo : allBomDetail) { // if(Objects.isNull(vo.getExceptionStatus())) { + //忽略不检查的如14 + if(CollectionUtil.isNotEmpty(unCheckExcept) + && vo.getExceptionStatus()!=null + &&unCheckExcept.contains(vo.getExceptionStatus())){ + continue; + } + vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()); // } if (StrUtil.isNotBlank(vo.getMaterialNo()) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomEdit.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomEdit.java index 79395b70..849e4e79 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomEdit.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomEdit.java @@ -39,8 +39,8 @@ public class EBomEdit { Integer source; - public EBomEdit(Integer source){ - this.source=source; + public EBomEdit(Integer source) { + this.source = source; } BomNewEbomParentEntity createParentBomInfo(BomNewEbomParentVO vo) { @@ -57,7 +57,7 @@ public class EBomEdit { // parent.setMaterialName(material.getMaterialName()); // parent.setMaterialDesc(material.getMaterialDesc()); // parent.setMaterialTexture(material.getMaterial()); - // parent.setNum(vo.getNum() == null ? new BigDecimal(1) : vo.getNum()); + // parent.setNum(vo.getNum() == null ? new BigDecimal(1) : vo.getNum()); parent.setTotalWeight(NumberUtil.mul(vo.getUnitWeight(), vo.getNum())); parent.setDeviseUserCode(SessionUtil.getUserCode()); @@ -76,14 +76,32 @@ public class EBomEdit { // parent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue()); // } - parent.setStatus(SpringUtil.getBean(UserRoleService.class).technician()? EBomStatusEnum.CHECKED.getValue():EBomStatusEnum.WAIT_CHECK.getValue()); - parent.setCreatedJob(SpringUtil.getBean(UserRoleService.class).technician()?UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue()); + parent.setStatus(SpringUtil.getBean(UserRoleService.class).technician() ? EBomStatusEnum.CHECKED.getValue() : EBomStatusEnum.WAIT_CHECK.getValue()); + parent.setCreatedJob(SpringUtil.getBean(UserRoleService.class).technician() ? UserJobEnum.ENGINEER.getValue() : UserJobEnum.DESIGNER.getValue()); return parent; } + private void checkExcept(BomNewEbomParentVO parent, BomNewEbomChildEntity child) { + if (StrUtil.isBlank(child.getMaterialNo()) || Objects.isNull(child.getNum()) + || BigDecimal.ZERO.compareTo(child.getNum()) >= 0) { + child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_4.getValue()); + } else if (StrUtil.isEmpty(child.getProjectType())) { + child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue()); + } else if (StrUtil.isNotBlank(parent.getProjectType()) + && StrUtil.containsAny(parent.getProjectType(), ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue(), ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue())) { + if (StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue(), child.getProjectType())) { + child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_9.getValue()); + } + if (StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue(), child.getProjectType())) { + child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue()); + } + } + + + } public void temporary(BomNewEBomParentEditDTO dto) { @@ -91,12 +109,12 @@ public class EBomEdit { parentEntities = new ArrayList<>(); childEntities = new ArrayList<>(); - List roleList= SpringUtil.getBean(UserRoleService.class).getUserPost(); + List roleList = SpringUtil.getBean(UserRoleService.class).getUserPost(); //添加数据 if (dto.getParent() == null) { for (BomNewEbomParentVO vo : dto.getDatas()) { - parentEntities.add(createParentBomInfo (vo)); + parentEntities.add(createParentBomInfo(vo)); } } else { @@ -109,7 +127,7 @@ public class EBomEdit { parent = createParentBomInfo(dto.getParent()); parent.setEditStatus(dto.getOpType()); parentEntities.add(parent); - }else { + } else { parent = Convert.convert(BomNewEbomParentEntity.class, dto.getParent()); parent.setEditStatus(dto.getOpType()); @@ -117,7 +135,7 @@ public class EBomEdit { } - childEntities=Convert.convert(new TypeReference>() { + childEntities = Convert.convert(new TypeReference>() { }, dto.getDatas()); for (BomNewEbomChildEntity child : @@ -126,7 +144,7 @@ public class EBomEdit { child.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum())); //新增数据 - if(child.getRowId()==null || child.getRowId().longValue()==0){ + if (child.getRowId() == null || child.getRowId().longValue() == 0) { child.setRowId(IdWorker.getId()); child.setIdentityNo(StrUtil.join("_", parent.getRowId(), child.getRowId())); @@ -137,29 +155,34 @@ public class EBomEdit { child.setSourceRowId(0l); child.setParentRowId(parent.getRowId()); child.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()); - parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()); + // parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()); //工艺人员 - if(roleList.contains(EBomConstant.TECHNICIAN)){ - parent.setStatus(EBomStatusEnum.CHECKED.getValue()); - } + // 设计岗位:设计岗位的用户只可以编辑未被“设计复核”过且是自己创建的物料,如果设计岗位在编辑过程中新增的物料做为未被“设计复核”。 + // 工艺岗位:工艺岗位的用户可以编辑被“设计复核”过的物料,如果工艺岗位在编辑过程中新增的物料状态为被“设计复核” +// if(roleList.contains(EBomConstant.TECHNICIAN)){ +// parent.setStatus(EBomStatusEnum.CHECKED.getValue()); +// } + + checkExcept(dto.getParent(), child); } child.setEditStatus(dto.getOpType()); - // parent.setCreatedJob(roleList.contains(EBomConstant.TECHNICIAN)?UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue()); - // parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum())); + if (StrUtil.isNotBlank(child.getProjectType())) { + child.setProjectType(child.getProjectType().toUpperCase()); + } + // parent.setCreatedJob(roleList.contains(EBomConstant.TECHNICIAN)?UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue()); + // parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum())); + parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum())); } } - } - - public void submit(BomNewEBomParentEditDTO dto) { @@ -170,16 +193,16 @@ public class EBomEdit { Set difference = Sets.difference(new HashSet<>(materialNos), new HashSet<>(effectiveMaterialNos)); VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料档案中不存在"); - // Map materialVOMap = ListCommonUtil.listToMap(materialBaseInfo, BaseMaterialVO::getMaterialNo); + parentEntities = new ArrayList<>(); childEntities = new ArrayList<>(); - List roleList= SpringUtil.getBean(UserRoleService.class).getUserPost(); + List roleList = SpringUtil.getBean(UserRoleService.class).getUserPost(); //添加数据 if (dto.getParent() == null) { - CheckEBomException eBomException=new CheckEBomException( dto.getDatas() ); + CheckEBomException eBomException = new CheckEBomException(dto.getDatas()); eBomException.checkException(); for (BomNewEbomParentVO vo : dto.getDatas()) { - parentEntities.add(createParentBomInfo (vo)); + parentEntities.add(createParentBomInfo(vo)); } } else { @@ -188,20 +211,20 @@ public class EBomEdit { //缺bom if (dto.getParent().getBomRowId() == null || dto.getParent().getBomRowId().longValue() == 0) { dto.getParent().setBomRowId(dto.getParent().getRowId()); - parent = createParentBomInfo(dto.getParent()); + parent = createParentBomInfo(dto.getParent()); parent.setEditStatus(dto.getOpType()); //工艺人员 - if(roleList.contains(EBomConstant.TECHNICIAN)){ + if (roleList.contains(EBomConstant.TECHNICIAN)) { parent.setStatus(EBomStatusEnum.CHECKED.getValue()); } parentEntities.add(parent); - }else { + } else { parent = Convert.convert(BomNewEbomParentEntity.class, dto.getParent()); parent.setEditStatus(dto.getOpType()); //工艺人员 - if(roleList.contains(EBomConstant.TECHNICIAN)){ + if (roleList.contains(EBomConstant.TECHNICIAN)) { parent.setStatus(EBomStatusEnum.CHECKED.getValue()); } @@ -209,7 +232,7 @@ public class EBomEdit { } - childEntities=Convert.convert(new TypeReference>() { + childEntities = Convert.convert(new TypeReference>() { }, dto.getDatas()); for (BomNewEbomChildEntity child : @@ -217,10 +240,10 @@ public class EBomEdit { //child.setProjectTypeInputType(ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue()); - child.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum())); + // child.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum())); child.setEditStatus(dto.getOpType()); //新增数据 - if(child.getRowId()==null || child.getRowId().longValue()==0){ + if (child.getRowId() == null || child.getRowId().longValue() == 0) { child.setRowId(IdWorker.getId()); child.setIdentityNo(StrUtil.join("-", parent.getRowId(), parent.getRowId())); @@ -231,36 +254,24 @@ public class EBomEdit { child.setSourceRowId(0l); child.setParentRowId(parent.getRowId()); child.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()); - // parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()); + // parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()); + checkExcept(dto.getParent(), child); } child.setEditStatus(dto.getOpType()); - // parent.setCreatedJob(roleList.contains(EBomConstant.TECHNICIAN)?UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue()); + // parent.setCreatedJob(roleList.contains(EBomConstant.TECHNICIAN)?UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue()); - // parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum())); + parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum())); -// if(StrUtil.isEmpty(child.getProjectType())){ -// child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue()); -// } -// -// if(StrUtil.isNotEmpty(dto.getParent().getProjectType()) && StrUtil.containsAny(dto.getParent().getProjectType(),ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue(),ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue())){ -// if(StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue(),child.getProjectType())){ -// child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_9.getValue()); -// } -// -// if(StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue(),child.getProjectType())){ -// child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue()); -// } -// } - // VUtils.isTure(parent.getProjectType().equals(child.getProjectType())).throwMessage("父、子级项目类型不能相同"); + // VUtils.isTure(parent.getProjectType().equals(child.getProjectType())).throwMessage("父、子级项目类型不能相同"); - } } - } + } + } diff --git a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/MaterialMainMapper.xml b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/MaterialMainMapper.xml index 233c7cf3..ed6c3482 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/MaterialMainMapper.xml +++ b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/MaterialMainMapper.xml @@ -71,7 +71,7 @@