暂存/提交验证调整
This commit is contained in:
parent
d055077b3f
commit
83aaed97f6
|
|
@ -377,6 +377,7 @@ public class EbomApi extends BaseApi {
|
||||||
@ApiOperation("提交")
|
@ApiOperation("提交")
|
||||||
@LogRecord(success = "Ebom-提交,物料编码:{{#dto.parent.materialNo}}-版本:{{#dto.parent.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#dto.parent.rowId}}",type = "Ebom-提交")
|
@LogRecord(success = "Ebom-提交,物料编码:{{#dto.parent.materialNo}}-版本:{{#dto.parent.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#dto.parent.rowId}}",type = "Ebom-提交")
|
||||||
public ResultVO<Boolean> submit(@RequestBody BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
|
public ResultVO<Boolean> submit(@RequestBody BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
|
||||||
|
|
||||||
return ResultVO.success(bomNewEbomParentService.submit(dto));
|
return ResultVO.success(bomNewEbomParentService.submit(dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,18 +114,18 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(materialNo)) {
|
if (StrUtil.isNotBlank(materialNo)) {
|
||||||
List<BomNewEbomParentEntity> materialBoms = this.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo,materialNo).eq(BomNewEbomParentEntity::getLastVersionIs, 1)
|
List<BomNewEbomParentEntity> materialBoms = this.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, materialNo).eq(BomNewEbomParentEntity::getLastVersionIs, 1)
|
||||||
.ne(BomNewEbomParentEntity::getStatus,EBomStatusEnum.PUBLISHED.getValue()).list();
|
.ne(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
|
||||||
if(query.getDataType().equals(0) && CollUtil.isEmpty(materialBoms) ){
|
if (query.getDataType().equals(0) && CollUtil.isEmpty(materialBoms)) {
|
||||||
return returnResult;
|
return returnResult;
|
||||||
}
|
}
|
||||||
List<String> materialNos=new ArrayList<>();
|
List<String> materialNos = new ArrayList<>();
|
||||||
List<String> parentMaterialByMaterialNo = getParentMaterialByMaterialNo(materialNo, !userRoleService.technician()).stream().collect(Collectors.toList());
|
List<String> parentMaterialByMaterialNo = getParentMaterialByMaterialNo(materialNo, !userRoleService.technician()).stream().collect(Collectors.toList());
|
||||||
materialNos.add(materialNo);
|
materialNos.add(materialNo);
|
||||||
materialNos.addAll(parentMaterialByMaterialNo);
|
materialNos.addAll(parentMaterialByMaterialNo);
|
||||||
if (CollUtil.isNotEmpty(materialNos)) {
|
if (CollUtil.isNotEmpty(materialNos)) {
|
||||||
List<BomNewEbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(materialNos, query.getDataType());
|
List<BomNewEbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(materialNos, query.getDataType());
|
||||||
List<BomNewEbomParentVO> childs = this.getBaseMapper().getChildForMaterialNoSeach(materialNos, materialNo,query.getDataType());
|
List<BomNewEbomParentVO> childs = this.getBaseMapper().getChildForMaterialNoSeach(materialNos, materialNo, query.getDataType());
|
||||||
List<BomNewEbomParentVO> data = new ArrayList<>();
|
List<BomNewEbomParentVO> data = new ArrayList<>();
|
||||||
data.addAll(parents);
|
data.addAll(parents);
|
||||||
data.addAll(childs);
|
data.addAll(childs);
|
||||||
|
|
@ -687,10 +687,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
for (Long bomRowId : paramDto.getBomRowIds()) {
|
for (Long bomRowId : paramDto.getBomRowIds()) {
|
||||||
|
|
||||||
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, this.getById(bomRowId));
|
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, this.getById(bomRowId));
|
||||||
VUtils.isTure(Objects.isNull(parent)).throwMessage("Bom版本不存在:"+bomRowId.toString());
|
VUtils.isTure(Objects.isNull(parent)).throwMessage("Bom版本不存在:" + bomRowId.toString());
|
||||||
LogRecordContext.putVariable("bom", parent);
|
LogRecordContext.putVariable("bom", parent);
|
||||||
List<BomNewEbomParentVO> bomTree = getBomTree(bomRowId);
|
List<BomNewEbomParentVO> bomTree = getBomTree(bomRowId);
|
||||||
VUtils.isTure(CollUtil.isEmpty(bomTree)).throwMessage("该BOM不存在下级,无需转换:"+ bomRowId.toString());
|
VUtils.isTure(CollUtil.isEmpty(bomTree)).throwMessage("该BOM不存在下级,无需转换:" + bomRowId.toString());
|
||||||
parent.setBomRowId(parent.getRowId());
|
parent.setBomRowId(parent.getRowId());
|
||||||
parent.setChildBomRowId(parent.getRowId());
|
parent.setChildBomRowId(parent.getRowId());
|
||||||
parent.setParentRowId(0L);
|
parent.setParentRowId(0L);
|
||||||
|
|
@ -757,13 +757,13 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void upRootMark(BomNewEbomParentVO parent){
|
private void upRootMark(BomNewEbomParentVO parent) {
|
||||||
Integer rootIs = this.getBaseMapper().checkIsRoot(parent.getMaterialNo());
|
Integer rootIs = this.getBaseMapper().checkIsRoot(parent.getMaterialNo());
|
||||||
Integer userRootIs=this.getBaseMapper().checkIsUserRoot(parent.getMaterialNo(),parent.getCreatedBy());
|
Integer userRootIs = this.getBaseMapper().checkIsUserRoot(parent.getMaterialNo(), parent.getCreatedBy());
|
||||||
BomNewEbomParentEntity ebomParent=new BomNewEbomParentEntity();
|
BomNewEbomParentEntity ebomParent = new BomNewEbomParentEntity();
|
||||||
ebomParent.setRowId(parent.getRowId());
|
ebomParent.setRowId(parent.getRowId());
|
||||||
ebomParent.setRootIs(rootIs>0?0:1);
|
ebomParent.setRootIs(rootIs > 0 ? 0 : 1);
|
||||||
ebomParent.setUserRootIs(userRootIs>0?0:1);
|
ebomParent.setUserRootIs(userRootIs > 0 ? 0 : 1);
|
||||||
this.updateById(ebomParent);
|
this.updateById(ebomParent);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -921,8 +921,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}, result);
|
}, result);
|
||||||
|
|
||||||
BomNewEbomParentEntity parentEntity = this.getBaseMapper().selectById(dto.getRowId());
|
BomNewEbomParentEntity parentEntity = this.getBaseMapper().selectById(dto.getRowId());
|
||||||
if(parentEntity==null){
|
if (parentEntity == null) {
|
||||||
throw new NflgBusinessException(STATE.Error, StrUtil.format("bom {} 数据未查询到",dto.getRowId()));
|
throw new NflgBusinessException(STATE.Error, StrUtil.format("bom {} 数据未查询到", dto.getRowId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
BomNewEbomParentVO parentVO = Convert.convert(BomNewEbomParentVO.class, parentEntity);
|
BomNewEbomParentVO parentVO = Convert.convert(BomNewEbomParentVO.class, parentEntity);
|
||||||
|
|
@ -978,8 +978,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( eBomEdit.getParentEntity()!=null) {
|
if (eBomEdit.getParentEntity() != null) {
|
||||||
this.saveOrUpdate( eBomEdit.getParentEntity());
|
this.saveOrUpdate(eBomEdit.getParentEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(eBomEdit.childEntities)) {
|
if (CollectionUtil.isNotEmpty(eBomEdit.childEntities)) {
|
||||||
|
|
@ -1294,11 +1294,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BomNewEbomEditDetailVO editDetail( Long rowId,Long bomRowId, String projectType) {
|
public BomNewEbomEditDetailVO editDetail(Long rowId, Long bomRowId, String projectType) {
|
||||||
|
|
||||||
BomNewEbomEditDetailVO vo = new BomNewEbomEditDetailVO();
|
BomNewEbomEditDetailVO vo = new BomNewEbomEditDetailVO();
|
||||||
BomNewEbomParentVO parentVO;
|
BomNewEbomParentVO parentVO;
|
||||||
if(bomRowId==null || bomRowId.longValue()==0) {
|
if (bomRowId == null || bomRowId.longValue() == 0) {
|
||||||
|
|
||||||
BomNewEbomChildEntity child = SpringUtil.getBean(BomNewEbomChildService.class).getBaseMapper().selectById(rowId);
|
BomNewEbomChildEntity child = SpringUtil.getBean(BomNewEbomChildService.class).getBaseMapper().selectById(rowId);
|
||||||
|
|
||||||
|
|
@ -1309,12 +1309,12 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
|| (parentVO.getMaterialCategoryCode().startsWith("20") && (MaterialGetEnum.outsource.equalsValue(parentVO.getMaterialGetType()) || MaterialGetEnum.purchase.equalsValue(parentVO.getMaterialGetType())))
|
|| (parentVO.getMaterialCategoryCode().startsWith("20") && (MaterialGetEnum.outsource.equalsValue(parentVO.getMaterialGetType()) || MaterialGetEnum.purchase.equalsValue(parentVO.getMaterialGetType())))
|
||||||
|| parentVO.getMaterialCategoryCode().equals("7013")) {
|
|| parentVO.getMaterialCategoryCode().equals("7013")) {
|
||||||
;
|
;
|
||||||
}else{
|
} else {
|
||||||
VUtils.isTure(true).throwMessage("编辑条件需满足,1.存在下级物料或是缺BOM 2.物料的分类20且流程类型为外协和采购部分\n" +
|
VUtils.isTure(true).throwMessage("编辑条件需满足,1.存在下级物料或是缺BOM 2.物料的分类20且流程类型为外协和采购部分\n" +
|
||||||
" 3.分类70中的7013时的物料 ");
|
" 3.分类70中的7013时的物料 ");
|
||||||
}
|
}
|
||||||
vo.setDatas(new ArrayList<>());
|
vo.setDatas(new ArrayList<>());
|
||||||
}else{
|
} else {
|
||||||
BomNewEbomParentEntity parent = this.getBaseMapper().selectById(bomRowId);
|
BomNewEbomParentEntity parent = this.getBaseMapper().selectById(bomRowId);
|
||||||
parentVO = Convert.convert(BomNewEbomParentVO.class, parent);
|
parentVO = Convert.convert(BomNewEbomParentVO.class, parent);
|
||||||
|
|
||||||
|
|
@ -1520,6 +1520,17 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public BomNewEbomParentVO temporary(BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
|
public BomNewEbomParentVO temporary(BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
|
||||||
|
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(dto.getDelDatas())) {
|
||||||
|
deleteBomChild(dto.getDelDatas());
|
||||||
|
}
|
||||||
|
|
||||||
|
//暂存数据为空后面不处理
|
||||||
|
if (CollUtil.isEmpty(dto.getDatas())) {
|
||||||
|
return dto.getParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_MDM.getValue());
|
EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_MDM.getValue());
|
||||||
dto.setOpType(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
dto.setOpType(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||||
eBomEdit.handleBom(dto);
|
eBomEdit.handleBom(dto);
|
||||||
|
|
@ -1531,7 +1542,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eBomEdit.getParentEntity()!=null) {
|
if (eBomEdit.getParentEntity() != null) {
|
||||||
this.saveOrUpdate(eBomEdit.getParentEntity());
|
this.saveOrUpdate(eBomEdit.getParentEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1547,7 +1558,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
ebomChildService.getBaseMapper().updateEBomMaterialUse();
|
ebomChildService.getBaseMapper().updateEBomMaterialUse();
|
||||||
// ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
// ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
||||||
|
|
||||||
BomNewEbomParentVO retParentVO= Convert.convert(BomNewEbomParentVO.class,eBomEdit.getParentEntity());
|
BomNewEbomParentVO retParentVO = Convert.convert(BomNewEbomParentVO.class, eBomEdit.getParentEntity());
|
||||||
retParentVO.setBomRowId(retParentVO.getRowId());
|
retParentVO.setBomRowId(retParentVO.getRowId());
|
||||||
|
|
||||||
return retParentVO;
|
return retParentVO;
|
||||||
|
|
@ -1561,6 +1572,15 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean submit(BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
|
public Boolean submit(BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
|
||||||
|
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(dto.getDelDatas())) {
|
||||||
|
deleteBomChild(dto.getDelDatas());
|
||||||
|
}
|
||||||
|
|
||||||
|
//无提交数据后面不处理
|
||||||
|
if (CollUtil.isEmpty(dto.getDatas())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_MDM.getValue());
|
EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_MDM.getValue());
|
||||||
dto.setOpType(EbomEditStatusEnum.HANDLER_FINISHED.getValue());
|
dto.setOpType(EbomEditStatusEnum.HANDLER_FINISHED.getValue());
|
||||||
eBomEdit.handleBom(dto);
|
eBomEdit.handleBom(dto);
|
||||||
|
|
@ -1576,14 +1596,8 @@ 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 (eBomEdit.getParentEntity() != null) {
|
||||||
if ( eBomEdit.getParentEntity()!=null) {
|
|
||||||
this.saveOrUpdate(eBomEdit.getParentEntity());
|
this.saveOrUpdate(eBomEdit.getParentEntity());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1598,7 +1612,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(eBomEdit.childEntities)) {
|
if (CollectionUtil.isNotEmpty(eBomEdit.childEntities)) {
|
||||||
ebomChildService.saveOrUpdateBatch(eBomEdit.childEntities);
|
ebomChildService.saveOrUpdateBatch(eBomEdit.childEntities);
|
||||||
|
|
||||||
|
|
@ -1635,10 +1648,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
List<BomNewEbomParentVO> delTagList = new ArrayList<>();
|
List<BomNewEbomParentVO> delTagList = new ArrayList<>();
|
||||||
|
|
||||||
List<BomNewEbomParentVO> okList = delList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource())
|
List<BomNewEbomParentVO> okList = 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());
|
||||||
|
|
||||||
if(CollUtil.isNotEmpty(okList)){
|
if (CollUtil.isNotEmpty(okList)) {
|
||||||
throw new NflgBusinessException(STATE.Error,"从原始Bom导入的数据,数据没有异常的情况下,不可以删除");
|
throw new NflgBusinessException(STATE.Error, "从原始Bom导入的数据,数据没有异常的情况下,不可以删除");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue