异常调整
This commit is contained in:
parent
9757db017d
commit
4893ccaba7
|
|
@ -264,10 +264,14 @@ public class EbomApi extends BaseApi {
|
||||||
|
|
||||||
@GetMapping("editDetail")
|
@GetMapping("editDetail")
|
||||||
@ApiOperation("编辑物料列表")
|
@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 resultVO = new ResultVO();
|
||||||
resultVO.setData(bomNewEbomParentService.editDetail(bomRowId));
|
resultVO.setData(bomNewEbomParentService.editDetail(bomRowId,projectType));
|
||||||
return resultVO;
|
return resultVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -499,6 +499,17 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkAndSaveEBomException(List<BomNewEbomParentVO> list) throws ExecutionException, InterruptedException {
|
||||||
|
CheckEBomException checkEBomException = new CheckEBomException(list);
|
||||||
|
checkEBomException.initException();
|
||||||
|
|
||||||
|
//保存异常
|
||||||
|
saveException(checkEBomException);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成虚拟包
|
* 生成虚拟包
|
||||||
|
|
@ -984,7 +995,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
List<BomNewEbomParentVO > childList=getBomTree(bomRowId);
|
List<BomNewEbomParentVO > childList=getBomTree(bomRowId);
|
||||||
CheckEBomException checkEBomException = new CheckEBomException(childList);
|
CheckEBomException checkEBomException = new CheckEBomException(childList);
|
||||||
// System.out.println(JSON.toJSONString(checkEBomException.getAllBomDetail()));
|
// System.out.println(JSON.toJSONString(checkEBomException.getAllBomDetail()));
|
||||||
checkEBomException.initException("projectType");
|
checkEBomException.initException();
|
||||||
//错误状态包含在checkStatus内有异常抛出
|
//错误状态包含在checkStatus内有异常抛出
|
||||||
checkEBomException.checkContainExcept(checkStatus);
|
checkEBomException.checkContainExcept(checkStatus);
|
||||||
//筛选bomRowId()>0 说明有bom,更新只到parent这层,无bom不需要更新
|
//筛选bomRowId()>0 说明有bom,更新只到parent这层,无bom不需要更新
|
||||||
|
|
@ -1074,12 +1085,13 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BomNewEbomEditDetailVO editDetail(Long bomRowId) {
|
public BomNewEbomEditDetailVO editDetail(Long bomRowId,String projectType) {
|
||||||
BomNewEbomEditDetailVO vo = new BomNewEbomEditDetailVO();
|
BomNewEbomEditDetailVO vo = new BomNewEbomEditDetailVO();
|
||||||
BomNewEbomParentEntity parent = this.getById(bomRowId);
|
BomNewEbomParentEntity parent = this.getBaseMapper().selectById(bomRowId);
|
||||||
BomNewEbomParentVO parentVO = Convert.convert(BomNewEbomParentVO.class, parent);
|
BomNewEbomParentVO parentVO = Convert.convert(BomNewEbomParentVO.class, parent);
|
||||||
parentVO.setBomRowId(parentVO.getRowId());
|
parentVO.setBomRowId(parentVO.getRowId());
|
||||||
parentVO.setParentRowId(0l);
|
parentVO.setParentRowId(0l);
|
||||||
|
parentVO.setProjectType(projectType);
|
||||||
// materialMainService.intiMaterialInfo(ImmutableList.of(parentVO));
|
// materialMainService.intiMaterialInfo(ImmutableList.of(parentVO));
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1197,6 +1209,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
dto.setOpType(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
dto.setOpType(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||||
eBomEdit.temporary(dto);
|
eBomEdit.temporary(dto);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(eBomEdit.parentEntities)) {
|
if (CollectionUtil.isNotEmpty(eBomEdit.parentEntities)) {
|
||||||
this.saveOrUpdateBatch(eBomEdit.parentEntities);
|
this.saveOrUpdateBatch(eBomEdit.parentEntities);
|
||||||
}
|
}
|
||||||
|
|
@ -1205,18 +1220,20 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
ebomChildService.saveOrUpdateBatch(eBomEdit.childEntities);
|
ebomChildService.saveOrUpdateBatch(eBomEdit.childEntities);
|
||||||
//ebomChildService.getBaseMapper().updateEBomMaterialUse();
|
//ebomChildService.getBaseMapper().updateEBomMaterialUse();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dto.getParent() != null) {
|
if (dto.getParent() != null) {
|
||||||
if (CollectionUtil.isNotEmpty(dto.getDelDatas())) {
|
if (CollectionUtil.isNotEmpty(dto.getDelDatas())) {
|
||||||
deleteBomChild(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());
|
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1242,6 +1259,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
EBomExceptionStatusEnum.EXCEPT_NO_10.getValue()
|
EBomExceptionStatusEnum.EXCEPT_NO_10.getValue()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (dto.getParent() != null) {
|
||||||
|
if (CollectionUtil.isNotEmpty(dto.getDelDatas())) {
|
||||||
|
deleteBomChild(dto.getDelDatas());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(CollectionUtil.isNotEmpty(eBomEdit.childEntities)){
|
if(CollectionUtil.isNotEmpty(eBomEdit.childEntities)){
|
||||||
|
|
||||||
|
|
@ -1249,12 +1271,15 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
List<BomNewEbomParentVO> allBom = Convert.convert(new TypeReference<List<BomNewEbomParentVO>>() {
|
List<BomNewEbomParentVO> allBom = Convert.convert(new TypeReference<List<BomNewEbomParentVO>>() {
|
||||||
}, eBomEdit.childEntities);
|
}, 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 checkEBomException = new CheckEBomException(allBom);
|
||||||
checkEBomException.initException("material", "materialTexture", "projectType");
|
|
||||||
|
|
||||||
checkEBomException.checkContainExcept(checkStatus);
|
checkEBomException.checkContainExcept(checkStatus);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(eBomEdit.parentEntities)) {
|
if (CollectionUtil.isNotEmpty(eBomEdit.parentEntities)) {
|
||||||
|
|
@ -1267,12 +1292,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();
|
// ebomChildService.getBaseMapper().updateEBomMaterialUse();
|
||||||
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1292,8 +1323,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<BomNewEbomParentVO> delTagList = new ArrayList<>();
|
List<BomNewEbomParentVO> delTagList = new ArrayList<>();
|
||||||
CheckEBomException checkEBomException = new CheckEBomException(delList);
|
// CheckEBomException checkEBomException = new CheckEBomException(delList);
|
||||||
checkEBomException.initException("material", "materialTexture", "projectType");
|
// checkEBomException.initException();
|
||||||
//原始bom不正常
|
//原始bom不正常
|
||||||
List<BomNewEbomParentVO> s1List = delList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource())
|
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());
|
&& !Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList());
|
||||||
|
|
@ -1326,10 +1357,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
*/
|
*/
|
||||||
public List<BomNewEbomParentVO> changeMaterial(BomNewEBomChangeDTO dto) {
|
public List<BomNewEbomParentVO> changeMaterial(BomNewEBomChangeDTO dto) {
|
||||||
|
|
||||||
|
|
||||||
CheckEBomException.checkMaterialNoInMain(dto.getDatas());
|
CheckEBomException.checkMaterialNoInMain(dto.getDatas());
|
||||||
|
|
||||||
|
|
||||||
List<BomNewEbomParentVO> checkBom = new ArrayList<>();
|
List<BomNewEbomParentVO> checkBom = new ArrayList<>();
|
||||||
|
|
||||||
List<BomNewEbomParentVO> tmp1=dto.getDatas().stream().filter(item->Objects.nonNull(item.getRowId()) && item.getRowId()>0).collect(Collectors.toList());
|
List<BomNewEbomParentVO> tmp1=dto.getDatas().stream().filter(item->Objects.nonNull(item.getRowId()) && item.getRowId()>0).collect(Collectors.toList());
|
||||||
|
|
@ -1350,6 +1379,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
checkBom.addAll(tmp1);
|
checkBom.addAll(tmp1);
|
||||||
checkBom.addAll(tmp2);
|
checkBom.addAll(tmp2);
|
||||||
|
|
||||||
|
if(dto.getParent().getRootIs()==null ||dto.getParent().getRootIs()==0 ) {
|
||||||
|
checkBom.add(dto.getParent());
|
||||||
|
}
|
||||||
// CheckEBomException checkEBomException = new CheckEBomException(checkBom);
|
// CheckEBomException checkEBomException = new CheckEBomException(checkBom);
|
||||||
// checkEBomException.checkException();
|
// checkEBomException.checkException();
|
||||||
// this.initBomException(checkBom);
|
// this.initBomException(checkBom);
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ public class CheckEBomException {
|
||||||
|
|
||||||
if(CollUtil.isNotEmpty(list)){
|
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()));
|
// parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum()));
|
||||||
|
|
||||||
if(StrUtil.isEmpty(child.getProjectType())){
|
// if(StrUtil.isEmpty(child.getProjectType())){
|
||||||
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
|
// 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.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())){
|
// if(StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue(),child.getProjectType())){
|
||||||
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_9.getValue());
|
// child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_9.getValue());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue(),child.getProjectType())){
|
// if(StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue(),child.getProjectType())){
|
||||||
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue());
|
// child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// VUtils.isTure(parent.getProjectType().equals(child.getProjectType())).throwMessage("父、子级项目类型不能相同");
|
// VUtils.isTure(parent.getProjectType().equals(child.getProjectType())).throwMessage("父、子级项目类型不能相同");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue