This commit is contained in:
jing's 2024-04-07 09:50:57 +08:00
parent 8537b3f15d
commit 762422d2ba
1 changed files with 174 additions and 174 deletions

View File

@ -355,185 +355,185 @@ public class EBomEdit {
* 废弃 * 废弃
* @param dto * @param dto
*/ */
@Deprecated // @Deprecated
public void temporary(BomNewEBomParentEditDTO dto) { // public void temporary(BomNewEBomParentEditDTO dto) {
//
//
//
List<String> roleList = SpringUtil.getBean(UserRoleService.class).getUserPost(); // List<String> roleList = SpringUtil.getBean(UserRoleService.class).getUserPost();
//
//
if (dto.getParent() == null) { // if (dto.getParent() == null) {
//
for (BomNewEbomParentVO vo : dto.getDatas()) { // for (BomNewEbomParentVO vo : dto.getDatas()) {
parentEntities.add(createParentBomInfo(vo)); // parentEntities.add(createParentBomInfo(vo));
}
} else {
BomNewEbomParentEntity parent;
//缺bom
if (dto.getParent().getBomRowId() == null || dto.getParent().getBomRowId().longValue() == 0) {
dto.getParent().setBomRowId(dto.getParent().getRowId());
parent = createParentBomInfo(dto.getParent());
parent.setEditStatus(dto.getOpType());
parentEntities.add(parent);
} else {
parent = Convert.convert(BomNewEbomParentEntity.class, dto.getParent());
parent.setEditStatus(dto.getOpType());
parentEntities.add(parent);
}
childEntities = Convert.convert(new TypeReference<List<BomNewEbomChildEntity>>() {
}, dto.getDatas());
for (BomNewEbomChildEntity child :
childEntities) {
child.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum()));
//新增数据
if (child.getRowId() == null || child.getRowId().longValue() == 0) {
child.setRowId(IdWorker.getId());
child.setIdentityNo(StrUtil.join("_", parent.getRowId(), child.getRowId()));
child.setSource(source);
child.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
child.setCreatedTime(LocalDateTime.now());
child.setCreatedBy(SessionUtil.getUserCode());
child.setSourceRowId(0l);
child.setParentRowId(parent.getRowId());
child.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
// parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
//工艺人员
// 设计岗位设计岗位的用户只可以编辑未被设计复核过且是自己创建的物料如果设计岗位在编辑过程中新增的物料做为未被设计复核
// 工艺岗位工艺岗位的用户可以编辑被设计复核过的物料如果工艺岗位在编辑过程中新增的物料状态为被设计复核
// if(roleList.contains(EBomConstant.TECHNICIAN)){
// parent.setStatus(EBomStatusEnum.CHECKED.getValue());
// } // }
//
checkExcept(dto.getParent(), child); // } else {
// BomNewEbomParentEntity parent;
} //
child.setEditStatus(dto.getOpType()); // //缺bom
if (StrUtil.isNotBlank(child.getProjectType())) { // if (dto.getParent().getBomRowId() == null || dto.getParent().getBomRowId().longValue() == 0) {
child.setProjectType(child.getProjectType().toUpperCase()); // dto.getParent().setBomRowId(dto.getParent().getRowId());
} //
// parent.setCreatedJob(roleList.contains(EBomConstant.TECHNICIAN)?UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue()); // parent = createParentBomInfo(dto.getParent());
// parent.setEditStatus(dto.getOpType());
// parentEntities.add(parent);
// } else {
//
// parent = Convert.convert(BomNewEbomParentEntity.class, dto.getParent());
// parent.setEditStatus(dto.getOpType());
// parentEntities.add(parent);
// }
//
//
// childEntities = Convert.convert(new TypeReference<List<BomNewEbomChildEntity>>() {
// }, dto.getDatas());
//
// for (BomNewEbomChildEntity child :
// childEntities) {
//
// child.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum()));
//
// //新增数据
// if (child.getRowId() == null || child.getRowId().longValue() == 0) {
// child.setRowId(IdWorker.getId());
// child.setIdentityNo(StrUtil.join("_", parent.getRowId(), child.getRowId()));
//
// child.setSource(source);
// child.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
// child.setCreatedTime(LocalDateTime.now());
// child.setCreatedBy(SessionUtil.getUserCode());
// child.setSourceRowId(0l);
// child.setParentRowId(parent.getRowId());
// child.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
// // parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
//
// //工艺人员
// // 设计岗位设计岗位的用户只可以编辑未被设计复核过且是自己创建的物料如果设计岗位在编辑过程中新增的物料做为未被设计复核
// // 工艺岗位工艺岗位的用户可以编辑被设计复核过的物料如果工艺岗位在编辑过程中新增的物料状态为被设计复核
//// if(roleList.contains(EBomConstant.TECHNICIAN)){
//// parent.setStatus(EBomStatusEnum.CHECKED.getValue());
//// }
//
// checkExcept(dto.getParent(), child);
//
// }
// child.setEditStatus(dto.getOpType());
// 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())); // parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum()));
//
parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum())); // }
// }
} //
} //
// }
}
/** /**
* 废弃 * 废弃
* @param dto * @param dto
*/ */
@Deprecated // @Deprecated
public void submit(BomNewEBomParentEditDTO dto) { // public void submit(BomNewEBomParentEditDTO dto) {
//
//
List<String> materialNos = dto.getDatas().stream().map(u -> u.getMaterialNo()).collect(Collectors.toList()); // List<String> materialNos = dto.getDatas().stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
//检查物料编码是否在主数据中存在 // //检查物料编码是否在主数据中存在
List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos); // List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos);
List<String> effectiveMaterialNos = materialBaseInfo.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList()); // List<String> effectiveMaterialNos = materialBaseInfo.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
//
Set<String> difference = Sets.difference(new HashSet<>(materialNos), new HashSet<>(effectiveMaterialNos)); // Set<String> difference = Sets.difference(new HashSet<>(materialNos), new HashSet<>(effectiveMaterialNos));
VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料档案中不存在"); // VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料档案中不存在");
//
parentEntities = new ArrayList<>(); // parentEntities = new ArrayList<>();
childEntities = new ArrayList<>(); // childEntities = new ArrayList<>();
List<String> roleList = SpringUtil.getBean(UserRoleService.class).getUserPost(); // List<String> roleList = SpringUtil.getBean(UserRoleService.class).getUserPost();
//添加数据 // //添加数据
if (dto.getParent() == null) { // if (dto.getParent() == null) {
CheckEBomException eBomException = new CheckEBomException(dto.getDatas()); // CheckEBomException eBomException = new CheckEBomException(dto.getDatas());
eBomException.checkException(); // eBomException.checkException();
for (BomNewEbomParentVO vo : dto.getDatas()) { // for (BomNewEbomParentVO vo : dto.getDatas()) {
parentEntities.add(createParentBomInfo(vo)); // parentEntities.add(createParentBomInfo(vo));
} // }
//
} else { // } else {
BomNewEbomParentEntity parent; // BomNewEbomParentEntity parent;
//
//缺bom // //缺bom
if (dto.getParent().getBomRowId() == null || dto.getParent().getBomRowId().longValue() == 0) { // if (dto.getParent().getBomRowId() == null || dto.getParent().getBomRowId().longValue() == 0) {
dto.getParent().setBomRowId(dto.getParent().getRowId()); // dto.getParent().setBomRowId(dto.getParent().getRowId());
parent = createParentBomInfo(dto.getParent()); // parent = createParentBomInfo(dto.getParent());
dto.getDatas().forEach(k -> { // dto.getDatas().forEach(k -> {
k.setParentRowId(parent.getRowId()); // k.setParentRowId(parent.getRowId());
}); // });
parent.setEditStatus(dto.getOpType()); // parent.setEditStatus(dto.getOpType());
//
//工艺人员 // //工艺人员
if (roleList.contains(EBomConstant.TECHNICIAN)) { // if (roleList.contains(EBomConstant.TECHNICIAN)) {
parent.setStatus(EBomStatusEnum.CHECKED.getValue()); // parent.setStatus(EBomStatusEnum.CHECKED.getValue());
} // }
//
parentEntities.add(parent); // parentEntities.add(parent);
} else { // } else {
parent = Convert.convert(BomNewEbomParentEntity.class, dto.getParent()); // parent = Convert.convert(BomNewEbomParentEntity.class, dto.getParent());
parent.setEditStatus(dto.getOpType()); // parent.setEditStatus(dto.getOpType());
//工艺人员 // //工艺人员
if (roleList.contains(EBomConstant.TECHNICIAN)) { // if (roleList.contains(EBomConstant.TECHNICIAN)) {
parent.setStatus(EBomStatusEnum.CHECKED.getValue()); // parent.setStatus(EBomStatusEnum.CHECKED.getValue());
} // }
parent.setModifyTime(LocalDateTime.now()); // parent.setModifyTime(LocalDateTime.now());
//
parentEntities.add(parent); // parentEntities.add(parent);
} // }
//
//
childEntities = Convert.convert(new TypeReference<List<BomNewEbomChildEntity>>() { // childEntities = Convert.convert(new TypeReference<List<BomNewEbomChildEntity>>() {
}, dto.getDatas()); // }, dto.getDatas());
//
for (BomNewEbomChildEntity child : // for (BomNewEbomChildEntity child :
childEntities) { // childEntities) {
//
//
//child.setProjectTypeInputType(ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue()); // //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()); // 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.setRowId(IdWorker.getId());
child.setIdentityNo(StrUtil.join("-", parent.getRowId(), parent.getRowId())); // child.setIdentityNo(StrUtil.join("-", parent.getRowId(), parent.getRowId()));
//
child.setSource(source); // child.setSource(source);
//
child.setCreatedTime(LocalDateTime.now()); // child.setCreatedTime(LocalDateTime.now());
child.setCreatedBy(SessionUtil.getUserCode()); // child.setCreatedBy(SessionUtil.getUserCode());
child.setSourceRowId(0l); // child.setSourceRowId(0l);
child.setParentRowId(parent.getRowId()); // child.setParentRowId(parent.getRowId());
child.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()); // child.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
// parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()); // // parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
checkExcept(dto.getParent(), child); // checkExcept(dto.getParent(), child);
//
} else { // } else {
child.setModifyTime(LocalDateTime.now()); // child.setModifyTime(LocalDateTime.now());
} // }
//
//
child.setEditStatus(dto.getOpType()); // 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()));
//
//
// VUtils.isTure(parent.getProjectType().equals(child.getProjectType())).throwMessage("父、子级项目类型不能相同"); // // VUtils.isTure(parent.getProjectType().equals(child.getProjectType())).throwMessage("父、子级项目类型不能相同");
//
} // }
} // }
//
} // }
} }