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")
|
@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,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);
|
saveException(checkEBomException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成虚拟包
|
* 生成虚拟包
|
||||||
*
|
*
|
||||||
|
|
@ -1000,7 +1011,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不需要更新
|
||||||
|
|
@ -1090,12 +1101,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));
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1213,6 +1225,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);
|
||||||
}
|
}
|
||||||
|
|
@ -1221,18 +1236,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1258,6 +1275,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)){
|
||||||
|
|
||||||
|
|
@ -1265,12 +1287,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)) {
|
||||||
|
|
@ -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();
|
// ebomChildService.getBaseMapper().updateEBomMaterialUse();
|
||||||
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1308,8 +1339,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());
|
||||||
|
|
@ -1342,10 +1373,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());
|
||||||
|
|
@ -1366,6 +1395,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);
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ public class CheckEBomException {
|
||||||
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_4.getValue());
|
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_4.getValue());
|
||||||
} else if (StrUtil.isNotBlank(vo.getMaterialNo()) && Objects.isNull(vo.getMaterialState())) {
|
} else if (StrUtil.isNotBlank(vo.getMaterialNo()) && Objects.isNull(vo.getMaterialState())) {
|
||||||
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_7.getValue());
|
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());
|
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
|
||||||
}
|
}
|
||||||
else if (StrUtil.isNotBlank(vo.getNoticeNums()) && EBomExceptionStatusEnum.EXCEPT_NO_11.equalsValue(vo.getExceptionStatus())){
|
else if (StrUtil.isNotBlank(vo.getNoticeNums()) && EBomExceptionStatusEnum.EXCEPT_NO_11.equalsValue(vo.getExceptionStatus())){
|
||||||
|
|
@ -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