optimize(pbom): 导入到SAP时,如果直发包缺少parent,则自动添加
This commit is contained in:
parent
472a899bee
commit
b01cbd3cff
|
|
@ -7,6 +7,7 @@ import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||||
|
|
@ -21,6 +22,7 @@ import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
|
||||||
import com.nflg.product.bomnew.util.BomUtil;
|
import com.nflg.product.bomnew.util.BomUtil;
|
||||||
import com.nflg.product.bomnew.util.SapErrorMsgUtil;
|
import com.nflg.product.bomnew.util.SapErrorMsgUtil;
|
||||||
import com.nflg.product.bomnew.util.VUtils;
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
|
import com.nflg.product.bomnew.util.VersionUtil;
|
||||||
import nflg.product.common.constant.STATE;
|
import nflg.product.common.constant.STATE;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
@ -145,7 +147,11 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
if (Objects.nonNull(czfb)) {
|
if (Objects.nonNull(czfb)) {
|
||||||
BomNewPbomParentEntity cpttp = getParent(czfb);
|
BomNewPbomParentEntity cpttp = getParent(czfb);
|
||||||
VUtils.isTure(Objects.isNull(cpttp)).throwMessage(StrUtil.format("顶层直发包({})对应的parent丢失", czfb.getMaterialNo()));
|
// VUtils.isTure(Objects.isNull(cpttp)).throwMessage(StrUtil.format("顶层直发包({})对应的parent丢失", czfb.getMaterialNo()));
|
||||||
|
if (Objects.isNull(cpttp)) {
|
||||||
|
//添加直发包的parent
|
||||||
|
cpttp = addZFBParent(czfb);
|
||||||
|
}
|
||||||
ddpRowId = cpttp.getRowId();
|
ddpRowId = cpttp.getRowId();
|
||||||
cmap.put(ddpRowId, new ArrayList<>());
|
cmap.put(ddpRowId, new ArrayList<>());
|
||||||
LOGGER.debug("{} 直发包 rowId:{},编号:{},描述:{}", TAG, ddpRowId, cpttp.getMaterialNo(), cpttp.getMaterialDesc());
|
LOGGER.debug("{} 直发包 rowId:{},编号:{},描述:{}", TAG, ddpRowId, cpttp.getMaterialNo(), cpttp.getMaterialDesc());
|
||||||
|
|
@ -153,6 +159,46 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
|
||||||
return ddpRowId;
|
return ddpRowId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BomNewPbomParentEntity addZFBParent(BomNewPbomChildEntity child) {
|
||||||
|
BomNewPbomParentEntity parent = new BomNewPbomParentEntity();
|
||||||
|
parent.setRowId(IdWorker.getId());
|
||||||
|
parent.setCreatedTime(LocalDateTime.now());
|
||||||
|
parent.setNum(BigDecimal.ONE);
|
||||||
|
parent.setStatus(PBomStatusEnum.PUBLISH.getValue());
|
||||||
|
parent.setBomExist(1);
|
||||||
|
parent.setDrawingNo(child.getDrawingNo());
|
||||||
|
parent.setBatchNo("");
|
||||||
|
parent.setCreatedBy(SessionUtil.getUserCode());
|
||||||
|
parent.setCreatedJob(UserJobEnum.ENGINEER.getValue());
|
||||||
|
parent.setCurrentVersion(VersionUtil.getNextVersion(""));
|
||||||
|
parent.setDeptRowId(SessionUtil.getDepartRowId());
|
||||||
|
parent.setDeptName(SessionUtil.getDepartName());
|
||||||
|
parent.setDeviseName(SessionUtil.getRealName());
|
||||||
|
parent.setDeviseUserCode(SessionUtil.getUserCode());
|
||||||
|
parent.setEditStatus(PBomEditStatusEnum.HANDLER_FINISHED.getValue());
|
||||||
|
parent.setFacCode(child.getFacCode());
|
||||||
|
parent.setMaterialNo(child.getMaterialNo());
|
||||||
|
parent.setLastVersionIs(1);
|
||||||
|
parent.setLevelNum(3);
|
||||||
|
parent.setMaterialDesc(child.getMaterialDesc());
|
||||||
|
parent.setMaterialName(child.getMaterialName());
|
||||||
|
parent.setMaterialUnit(child.getMaterialUnit());
|
||||||
|
parent.setMaterialTexture(child.getMaterialTexture());
|
||||||
|
parent.setSuperMaterialStatus(0);
|
||||||
|
parent.setProjectType("L");
|
||||||
|
parent.setRootIs(0);
|
||||||
|
parent.setUserRootIs(0);
|
||||||
|
parent.setReleaseTime(LocalDateTime.now());
|
||||||
|
parent.setReleaseUserName(SessionUtil.getRealName());
|
||||||
|
parent.setShouldBomExist(0);
|
||||||
|
parent.setSource(child.getSource());
|
||||||
|
parent.setTechnologyUserCode(SessionUtil.getUserCode());
|
||||||
|
parent.setTechnologyUserName(SessionUtil.getRealName());
|
||||||
|
parent.setVirtualPackageIs(1);
|
||||||
|
bomNewPbomParentService.save(parent);
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
private void saveSapErrorMsg(Long rootBomRowId, List<OperationErrorMsgVO> liErrMsg) {
|
private void saveSapErrorMsg(Long rootBomRowId, List<OperationErrorMsgVO> liErrMsg) {
|
||||||
bomNewSapErrorMsgService.getBaseMapper().delete(Wrappers.lambdaQuery(BomNewSapErrorMsgEntity.class)
|
bomNewSapErrorMsgService.getBaseMapper().delete(Wrappers.lambdaQuery(BomNewSapErrorMsgEntity.class)
|
||||||
.eq(BomNewSapErrorMsgEntity::getTargetRowId, rootBomRowId));
|
.eq(BomNewSapErrorMsgEntity::getTargetRowId, rootBomRowId));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue