Merge remote-tracking branch 'origin/feature/DM/nflg-bom' into feature/DM/nflg-bom
This commit is contained in:
commit
9df337434d
|
|
@ -264,10 +264,14 @@ public class EbomApi extends BaseApi {
|
|||
|
||||
@GetMapping("editDetail")
|
||||
@ApiOperation("编辑物料列表")
|
||||
public ResultVO<BomNewEbomEditDetailVO> editDetail(@RequestParam("bomRowId") Long bomRowId) {
|
||||
public ResultVO<BomNewEbomEditDetailVO> editDetail(@RequestParam("bomRowId") Long bomRowId,@RequestParam("projectType") String projectType) {
|
||||
|
||||
if(Objects.isNull(bomRowId)){
|
||||
VUtils.isTure(true ).throwMessage("bomRowId不能为空");
|
||||
}
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
resultVO.setData(bomNewEbomParentService.editDetail(bomRowId));
|
||||
resultVO.setData(bomNewEbomParentService.editDetail(bomRowId,projectType));
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -499,6 +499,16 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
}
|
||||
|
||||
|
||||
public void checkAndSaveEBomException(List<BomNewEbomParentVO> list) throws ExecutionException, InterruptedException {
|
||||
CheckEBomException checkEBomException = new CheckEBomException(list);
|
||||
checkEBomException.initException();
|
||||
|
||||
//保存异常
|
||||
saveException(checkEBomException);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* 检查 并保存异常信息
|
||||
*/
|
||||
|
|
@ -511,11 +521,12 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
saveException(checkEBomException);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 生成虚拟包
|
||||
*
|
||||
|
|
@ -1000,7 +1011,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
List<BomNewEbomParentVO > childList=getBomTree(bomRowId);
|
||||
CheckEBomException checkEBomException = new CheckEBomException(childList);
|
||||
// System.out.println(JSON.toJSONString(checkEBomException.getAllBomDetail()));
|
||||
checkEBomException.initException("projectType");
|
||||
checkEBomException.initException();
|
||||
//错误状态包含在checkStatus内有异常抛出
|
||||
checkEBomException.checkContainExcept(checkStatus);
|
||||
//筛选bomRowId()>0 说明有bom,更新只到parent这层,无bom不需要更新
|
||||
|
|
@ -1090,12 +1101,13 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
return true;
|
||||
}
|
||||
|
||||
public BomNewEbomEditDetailVO editDetail(Long bomRowId) {
|
||||
public BomNewEbomEditDetailVO editDetail(Long bomRowId,String projectType) {
|
||||
BomNewEbomEditDetailVO vo = new BomNewEbomEditDetailVO();
|
||||
BomNewEbomParentEntity parent = this.getById(bomRowId);
|
||||
BomNewEbomParentEntity parent = this.getBaseMapper().selectById(bomRowId);
|
||||
BomNewEbomParentVO parentVO = Convert.convert(BomNewEbomParentVO.class, parent);
|
||||
parentVO.setBomRowId(parentVO.getRowId());
|
||||
parentVO.setParentRowId(0l);
|
||||
parentVO.setProjectType(projectType);
|
||||
// materialMainService.intiMaterialInfo(ImmutableList.of(parentVO));
|
||||
|
||||
|
||||
|
|
@ -1213,6 +1225,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
dto.setOpType(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||
eBomEdit.temporary(dto);
|
||||
|
||||
|
||||
|
||||
|
||||
if (CollectionUtil.isNotEmpty(eBomEdit.parentEntities)) {
|
||||
this.saveOrUpdateBatch(eBomEdit.parentEntities);
|
||||
}
|
||||
|
|
@ -1221,18 +1236,20 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
ebomChildService.saveOrUpdateBatch(eBomEdit.childEntities);
|
||||
//ebomChildService.getBaseMapper().updateEBomMaterialUse();
|
||||
}
|
||||
|
||||
if (dto.getParent() != null) {
|
||||
if (CollectionUtil.isNotEmpty(dto.getDelDatas())) {
|
||||
deleteBomChild(dto.getDelDatas());
|
||||
}
|
||||
}
|
||||
List<BomNewEbomParentVO> childList=dto.getDatas();
|
||||
|
||||
checkAndSaveEBomException(dto.getParent().getBomRowId());
|
||||
|
||||
|
||||
if( dto.getParent().getRootIs()==null || dto.getParent().getRootIs()==0) {
|
||||
childList.add(dto.getParent());
|
||||
}
|
||||
checkAndSaveEBomException(childList);
|
||||
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1258,6 +1275,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
EBomExceptionStatusEnum.EXCEPT_NO_10.getValue()
|
||||
});
|
||||
|
||||
if (dto.getParent() != null) {
|
||||
if (CollectionUtil.isNotEmpty(dto.getDelDatas())) {
|
||||
deleteBomChild(dto.getDelDatas());
|
||||
}
|
||||
}
|
||||
|
||||
if(CollectionUtil.isNotEmpty(eBomEdit.childEntities)){
|
||||
|
||||
|
|
@ -1265,12 +1287,15 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
List<BomNewEbomParentVO> allBom = Convert.convert(new TypeReference<List<BomNewEbomParentVO>>() {
|
||||
}, eBomEdit.childEntities);
|
||||
|
||||
BomNewEbomParentVO parent = Convert.convert( BomNewEbomParentVO .class
|
||||
, eBomEdit.parentEntities.get(0));
|
||||
|
||||
if(dto.getParent().getRootIs()==null || dto.getParent().getRootIs()==0) {
|
||||
allBom.add(parent);
|
||||
}
|
||||
|
||||
CheckEBomException checkEBomException = new CheckEBomException(allBom);
|
||||
checkEBomException.initException("material", "materialTexture", "projectType");
|
||||
|
||||
checkEBomException.checkContainExcept(checkStatus);
|
||||
|
||||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(eBomEdit.parentEntities)) {
|
||||
|
|
@ -1283,12 +1308,18 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
}
|
||||
|
||||
if (dto.getParent() != null) {
|
||||
if (CollectionUtil.isNotEmpty(dto.getDelDatas())) {
|
||||
deleteBomChild(dto.getDelDatas());
|
||||
|
||||
|
||||
// checkAndSaveEBomException(dto.getParent().getBomRowId());
|
||||
|
||||
List<BomNewEbomParentVO> childList= dto.getDatas();
|
||||
|
||||
if(dto.getParent().getRootIs()==null || dto.getParent().getRootIs()==0) {
|
||||
childList.add(dto.getParent());
|
||||
|
||||
}
|
||||
}
|
||||
checkAndSaveEBomException(dto.getParent().getBomRowId());
|
||||
|
||||
checkAndSaveEBomException(childList);
|
||||
// ebomChildService.getBaseMapper().updateEBomMaterialUse();
|
||||
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
||||
return true;
|
||||
|
|
@ -1308,8 +1339,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
return;
|
||||
}
|
||||
List<BomNewEbomParentVO> delTagList = new ArrayList<>();
|
||||
CheckEBomException checkEBomException = new CheckEBomException(delList);
|
||||
checkEBomException.initException("material", "materialTexture", "projectType");
|
||||
// CheckEBomException checkEBomException = new CheckEBomException(delList);
|
||||
// checkEBomException.initException();
|
||||
//原始bom不正常
|
||||
List<BomNewEbomParentVO> s1List = delList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource())
|
||||
&& !Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList());
|
||||
|
|
@ -1342,10 +1373,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
*/
|
||||
public List<BomNewEbomParentVO> changeMaterial(BomNewEBomChangeDTO dto) {
|
||||
|
||||
|
||||
CheckEBomException.checkMaterialNoInMain(dto.getDatas());
|
||||
|
||||
|
||||
List<BomNewEbomParentVO> checkBom = new ArrayList<>();
|
||||
|
||||
List<BomNewEbomParentVO> tmp1=dto.getDatas().stream().filter(item->Objects.nonNull(item.getRowId()) && item.getRowId()>0).collect(Collectors.toList());
|
||||
|
|
@ -1366,6 +1395,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
checkBom.addAll(tmp1);
|
||||
checkBom.addAll(tmp2);
|
||||
|
||||
if(dto.getParent().getRootIs()==null ||dto.getParent().getRootIs()==0 ) {
|
||||
checkBom.add(dto.getParent());
|
||||
}
|
||||
// CheckEBomException checkEBomException = new CheckEBomException(checkBom);
|
||||
// checkEBomException.checkException();
|
||||
// this.initBomException(checkBom);
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ public class CheckEBomException {
|
|||
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_4.getValue());
|
||||
} else if (StrUtil.isNotBlank(vo.getMaterialNo()) && Objects.isNull(vo.getMaterialState())) {
|
||||
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_7.getValue());
|
||||
} else if (StrUtil.isBlank(vo.getProjectType()) && Objects.nonNull(vo.getRootIs()) && !vo.getRootIs().equals(1)) {
|
||||
} else if (StrUtil.isBlank(vo.getProjectType()) && (vo.getRootIs()==null || vo.getRootIs()==0)) {
|
||||
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
|
||||
}
|
||||
else if (StrUtil.isNotBlank(vo.getNoticeNums()) && EBomExceptionStatusEnum.EXCEPT_NO_11.equalsValue(vo.getExceptionStatus())){
|
||||
|
|
@ -220,7 +220,7 @@ public class CheckEBomException {
|
|||
|
||||
if(CollUtil.isNotEmpty(list)){
|
||||
|
||||
throw new NflgBusinessException(STATE.BusinessError, EBomExceptionStatusEnum.code2description(list.get(0)));
|
||||
throw new NflgBusinessException(STATE.BusinessError, StrUtil.format("物料编码{} 异常情况 {}",item.getMaterialNo(),EBomExceptionStatusEnum.code2description(list.get(0)) ));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -241,19 +241,19 @@ public class EBomEdit {
|
|||
|
||||
// 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());
|
||||
}
|
||||
}
|
||||
// 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("父、子级项目类型不能相同");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue