This commit is contained in:
parent
8537b3f15d
commit
762422d2ba
|
|
@ -355,185 +355,185 @@ public class EBomEdit {
|
|||
* 废弃
|
||||
* @param dto
|
||||
*/
|
||||
@Deprecated
|
||||
public void temporary(BomNewEBomParentEditDTO dto) {
|
||||
|
||||
|
||||
|
||||
List<String> roleList = SpringUtil.getBean(UserRoleService.class).getUserPost();
|
||||
|
||||
|
||||
if (dto.getParent() == null) {
|
||||
|
||||
for (BomNewEbomParentVO vo : dto.getDatas()) {
|
||||
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);
|
||||
|
||||
}
|
||||
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()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// @Deprecated
|
||||
// public void temporary(BomNewEBomParentEditDTO dto) {
|
||||
//
|
||||
//
|
||||
//
|
||||
// List<String> roleList = SpringUtil.getBean(UserRoleService.class).getUserPost();
|
||||
//
|
||||
//
|
||||
// if (dto.getParent() == null) {
|
||||
//
|
||||
// for (BomNewEbomParentVO vo : dto.getDatas()) {
|
||||
// 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);
|
||||
//
|
||||
// }
|
||||
// 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()));
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* 废弃
|
||||
* @param dto
|
||||
*/
|
||||
@Deprecated
|
||||
public void submit(BomNewEBomParentEditDTO dto) {
|
||||
|
||||
|
||||
List<String> materialNos = dto.getDatas().stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
//检查物料编码是否在主数据中存在
|
||||
List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos);
|
||||
List<String> effectiveMaterialNos = materialBaseInfo.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
|
||||
Set<String> difference = Sets.difference(new HashSet<>(materialNos), new HashSet<>(effectiveMaterialNos));
|
||||
VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料档案中不存在");
|
||||
|
||||
parentEntities = new ArrayList<>();
|
||||
childEntities = new ArrayList<>();
|
||||
List<String> roleList = SpringUtil.getBean(UserRoleService.class).getUserPost();
|
||||
//添加数据
|
||||
if (dto.getParent() == null) {
|
||||
CheckEBomException eBomException = new CheckEBomException(dto.getDatas());
|
||||
eBomException.checkException();
|
||||
for (BomNewEbomParentVO vo : dto.getDatas()) {
|
||||
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());
|
||||
dto.getDatas().forEach(k -> {
|
||||
k.setParentRowId(parent.getRowId());
|
||||
});
|
||||
parent.setEditStatus(dto.getOpType());
|
||||
|
||||
//工艺人员
|
||||
if (roleList.contains(EBomConstant.TECHNICIAN)) {
|
||||
parent.setStatus(EBomStatusEnum.CHECKED.getValue());
|
||||
}
|
||||
|
||||
parentEntities.add(parent);
|
||||
} else {
|
||||
parent = Convert.convert(BomNewEbomParentEntity.class, dto.getParent());
|
||||
parent.setEditStatus(dto.getOpType());
|
||||
//工艺人员
|
||||
if (roleList.contains(EBomConstant.TECHNICIAN)) {
|
||||
parent.setStatus(EBomStatusEnum.CHECKED.getValue());
|
||||
}
|
||||
parent.setModifyTime(LocalDateTime.now());
|
||||
|
||||
parentEntities.add(parent);
|
||||
}
|
||||
|
||||
|
||||
childEntities = Convert.convert(new TypeReference<List<BomNewEbomChildEntity>>() {
|
||||
}, dto.getDatas());
|
||||
|
||||
for (BomNewEbomChildEntity child :
|
||||
childEntities) {
|
||||
|
||||
|
||||
//child.setProjectTypeInputType(ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue());
|
||||
// child.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum()));
|
||||
child.setEditStatus(dto.getOpType());
|
||||
//新增数据
|
||||
if (child.getRowId() == null || child.getRowId().longValue() == 0) {
|
||||
child.setRowId(IdWorker.getId());
|
||||
child.setIdentityNo(StrUtil.join("-", parent.getRowId(), parent.getRowId()));
|
||||
|
||||
child.setSource(source);
|
||||
|
||||
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());
|
||||
checkExcept(dto.getParent(), child);
|
||||
|
||||
} else {
|
||||
child.setModifyTime(LocalDateTime.now());
|
||||
}
|
||||
|
||||
|
||||
child.setEditStatus(dto.getOpType());
|
||||
// parent.setCreatedJob(roleList.contains(EBomConstant.TECHNICIAN)?UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue());
|
||||
|
||||
parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum()));
|
||||
|
||||
|
||||
// VUtils.isTure(parent.getProjectType().equals(child.getProjectType())).throwMessage("父、子级项目类型不能相同");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// @Deprecated
|
||||
// public void submit(BomNewEBomParentEditDTO dto) {
|
||||
//
|
||||
//
|
||||
// List<String> materialNos = dto.getDatas().stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
// //检查物料编码是否在主数据中存在
|
||||
// List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos);
|
||||
// List<String> effectiveMaterialNos = materialBaseInfo.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
//
|
||||
// Set<String> difference = Sets.difference(new HashSet<>(materialNos), new HashSet<>(effectiveMaterialNos));
|
||||
// VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料档案中不存在");
|
||||
//
|
||||
// parentEntities = new ArrayList<>();
|
||||
// childEntities = new ArrayList<>();
|
||||
// List<String> roleList = SpringUtil.getBean(UserRoleService.class).getUserPost();
|
||||
// //添加数据
|
||||
// if (dto.getParent() == null) {
|
||||
// CheckEBomException eBomException = new CheckEBomException(dto.getDatas());
|
||||
// eBomException.checkException();
|
||||
// for (BomNewEbomParentVO vo : dto.getDatas()) {
|
||||
// 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());
|
||||
// dto.getDatas().forEach(k -> {
|
||||
// k.setParentRowId(parent.getRowId());
|
||||
// });
|
||||
// parent.setEditStatus(dto.getOpType());
|
||||
//
|
||||
// //工艺人员
|
||||
// if (roleList.contains(EBomConstant.TECHNICIAN)) {
|
||||
// parent.setStatus(EBomStatusEnum.CHECKED.getValue());
|
||||
// }
|
||||
//
|
||||
// parentEntities.add(parent);
|
||||
// } else {
|
||||
// parent = Convert.convert(BomNewEbomParentEntity.class, dto.getParent());
|
||||
// parent.setEditStatus(dto.getOpType());
|
||||
// //工艺人员
|
||||
// if (roleList.contains(EBomConstant.TECHNICIAN)) {
|
||||
// parent.setStatus(EBomStatusEnum.CHECKED.getValue());
|
||||
// }
|
||||
// parent.setModifyTime(LocalDateTime.now());
|
||||
//
|
||||
// parentEntities.add(parent);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// childEntities = Convert.convert(new TypeReference<List<BomNewEbomChildEntity>>() {
|
||||
// }, dto.getDatas());
|
||||
//
|
||||
// for (BomNewEbomChildEntity child :
|
||||
// childEntities) {
|
||||
//
|
||||
//
|
||||
// //child.setProjectTypeInputType(ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue());
|
||||
// // child.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum()));
|
||||
// child.setEditStatus(dto.getOpType());
|
||||
// //新增数据
|
||||
// if (child.getRowId() == null || child.getRowId().longValue() == 0) {
|
||||
// child.setRowId(IdWorker.getId());
|
||||
// child.setIdentityNo(StrUtil.join("-", parent.getRowId(), parent.getRowId()));
|
||||
//
|
||||
// child.setSource(source);
|
||||
//
|
||||
// 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());
|
||||
// checkExcept(dto.getParent(), child);
|
||||
//
|
||||
// } else {
|
||||
// child.setModifyTime(LocalDateTime.now());
|
||||
// }
|
||||
//
|
||||
//
|
||||
// child.setEditStatus(dto.getOpType());
|
||||
// // parent.setCreatedJob(roleList.contains(EBomConstant.TECHNICIAN)?UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue());
|
||||
//
|
||||
// parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum()));
|
||||
//
|
||||
//
|
||||
// // VUtils.isTure(parent.getProjectType().equals(child.getProjectType())).throwMessage("父、子级项目类型不能相同");
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue