This commit is contained in:
parent
7b3f7318ba
commit
8a287a79af
|
|
@ -12,6 +12,7 @@ import cn.hutool.core.util.IdUtil;
|
|||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
|
@ -320,6 +321,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
if (parentVO != null) {
|
||||
parentVO.setBomRowId(rowId);
|
||||
parentVO.setParentRowId(0L);
|
||||
|
||||
list.add(parentVO);
|
||||
}
|
||||
return list;
|
||||
|
|
@ -844,6 +846,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
for (Long bomRowId :
|
||||
rowIds) {
|
||||
CheckEBomException checkEBomException = new CheckEBomException(bomRowId);
|
||||
System.out.println(JSON.toJSONString(checkEBomException.getAllBomDetail()) );
|
||||
checkEBomException.initException();
|
||||
//错误状态包含在checkStatus内有异常抛出
|
||||
checkEBomException.checkContainExcept(checkStatus);
|
||||
|
|
@ -1054,7 +1057,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
deleteBomChild(dto.getDelDatas());
|
||||
}
|
||||
}
|
||||
ebomChildService.getBaseMapper().updateEBomMaterialUse();
|
||||
computeLevelNumAndRootState();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1067,7 +1070,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_MDM.getValue());
|
||||
dto.setOpType(EbomEditStatusEnum.HANDLER_FINISHED.getValue());
|
||||
eBomEdit.temporary(dto);
|
||||
eBomEdit.submit(dto);
|
||||
|
||||
List<Integer> checkStatus = CollectionUtil.toList(new Integer[]{
|
||||
EBomExceptionStatusEnum.EXCEPT_NO_2.getValue(),
|
||||
|
|
|
|||
|
|
@ -39,14 +39,14 @@ public class CheckEBomException {
|
|||
|
||||
public CheckEBomException(Long bomRowId) throws ExecutionException, InterruptedException {
|
||||
|
||||
// allBomDetail = SpringUtil.getBean(BomNewEbomParentService.class).getBomTree(bomRowId);
|
||||
// BomNewEbomParentEntity parent = SpringUtil.getBean(BomNewEbomParentService.class).getById(bomRowId);
|
||||
// BomNewEbomParentVO convert = Convert.convert(BomNewEbomParentVO.class, parent);
|
||||
// convert.setBomRowId(convert.getRowId());
|
||||
// convert.setParentRowId(0L);
|
||||
// allBomDetail.add(convert);
|
||||
allBomDetail = SpringUtil.getBean(BomNewEbomParentService.class).getBomTree(bomRowId);
|
||||
BomNewEbomParentEntity parent = SpringUtil.getBean(BomNewEbomParentService.class).getById(bomRowId);
|
||||
BomNewEbomParentVO convert = Convert.convert(BomNewEbomParentVO.class, parent);
|
||||
convert.setBomRowId(convert.getRowId());
|
||||
convert.setParentRowId(0L);
|
||||
allBomDetail.add(convert);
|
||||
|
||||
allBomDetail = SpringUtil.getBean(BomNewEbomParentService.class).buildBomTreeContainSelf(bomRowId);
|
||||
// allBomDetail = SpringUtil.getBean(BomNewEbomParentService.class).buildBomTreeContainSelf(bomRowId);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,14 +86,82 @@ public class EBomEdit {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void temporary(BomNewEBomParentEditDTO dto) {
|
||||
|
||||
|
||||
parentEntities = new ArrayList<>();
|
||||
childEntities = new ArrayList<>();
|
||||
//添加数据
|
||||
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()));
|
||||
List<String> roleList= SpringUtil.getBean(UserRoleService.class).getUserPost();
|
||||
//新增数据
|
||||
if(child.getRowId()==null || child.getRowId().longValue()==0){
|
||||
child.setRowId(IdWorker.getId());
|
||||
child.setIdentityNo(StrUtil.join("-", parent.getRowId(), parent.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());
|
||||
}
|
||||
|
||||
}
|
||||
child.setEditStatus(dto.getOpType());
|
||||
parent.setCreatedJob(roleList.contains(EBomConstant.TECHNICIAN)?UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue());
|
||||
parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum()));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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);
|
||||
|
|
@ -118,9 +186,6 @@ public class EBomEdit {
|
|||
List<BomNewEbomParentVO> exceptList=new ArrayList<>();
|
||||
exceptList.addAll(dto.getDatas());
|
||||
|
||||
|
||||
|
||||
|
||||
//缺bom
|
||||
if (dto.getParent().getBomRowId() == null || dto.getParent().getBomRowId().longValue() == 0) {
|
||||
dto.getParent().setBomRowId(dto.getParent().getRowId());
|
||||
|
|
@ -128,6 +193,7 @@ public class EBomEdit {
|
|||
CheckEBomException eBomException=new CheckEBomException( exceptList );
|
||||
eBomException.checkException();
|
||||
parent = createParentBomInfo(dto.getParent());
|
||||
parent.setEditStatus(dto.getOpType());
|
||||
parentEntities.add(parent);
|
||||
}else {
|
||||
exceptList.add(dto.getParent());
|
||||
|
|
|
|||
Loading…
Reference in New Issue