Merge branch 'feature/DM/nflg-bom' of http://112.74.186.154:3000/nflj/nflg_project into feature/DM/nflg-bom
This commit is contained in:
commit
05cc8db7db
|
|
@ -7,6 +7,7 @@ import com.nflg.product.bomnew.constant.EBomConstant;
|
|||
import com.nflg.product.bomnew.constant.PBomEditStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.PBomStatusEnum;
|
||||
import com.nflg.product.bomnew.pojo.dto.*;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.ImportToSapDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewTechnologyPackageTypeEntity;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
|
||||
|
|
@ -14,13 +15,11 @@ import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
|||
import com.nflg.product.bomnew.pojo.vo.BomCopyCheckResultVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewTechnologyPackageTypeVO;
|
||||
import com.nflg.product.bomnew.service.BomNewPbomParentService;
|
||||
import com.nflg.product.bomnew.service.BomNewTechnologyPackageTypeService;
|
||||
import com.nflg.product.bomnew.service.MaterialService;
|
||||
import com.nflg.product.bomnew.service.UserRoleService;
|
||||
import com.nflg.product.bomnew.service.*;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -198,7 +197,7 @@ public class PBomApi extends BaseApi {
|
|||
public ResultVO<Boolean> convertToMBom(@RequestParam("bomRowId") Long bomRowId) throws ExecutionException, InterruptedException {
|
||||
BomNewPbomParentEntity parent = bomNewPbomParentService.getById(bomRowId);
|
||||
VUtils.isTure(!parent.getMaterialNo().startsWith("31")).throwMessage("只有31开头的物料才可以发布");
|
||||
VUtils.isTure(parent.getStatus()> PBomStatusEnum.PUBLISH.getValue()).throwMessage("只有已发布的BOM才能生成MBom");
|
||||
VUtils.isTure(parent.getStatus()< PBomStatusEnum.PUBLISH.getValue()).throwMessage("只有已发布的BOM才能生成MBom");
|
||||
//
|
||||
VUtils.isTure(!parent.getFacCode().equals(EBomConstant.MAIN_FACTORY_CODE_1010)).throwMessage("只有1010工厂BOM才能进行分工厂");
|
||||
return ResultVO.success(bomNewPbomParentService.convertToMBom(bomRowId));
|
||||
|
|
@ -241,6 +240,16 @@ public class PBomApi extends BaseApi {
|
|||
|
||||
return ResultVO.success(materialService.batchAddMaterial(parems));
|
||||
}
|
||||
@Resource
|
||||
SapOpUtilService sapOpUtilService;
|
||||
|
||||
@PostMapping("sysnSapTest")
|
||||
@ApiOperation("同步sap测试")
|
||||
public ResultVO<Boolean> sysnSapTest(@RequestBody List<ImportToSapDTO> parems) {
|
||||
ResultVO<Boolean> result = sapOpUtilService.importPBomToSap(parems);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -681,12 +681,15 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getRowId, paramDTO.getBomRowIds()).list();
|
||||
List<String> notConvertToPbom = list.stream().filter(u -> u.getStatus() < EBomStatusEnum.PUBLISHED.getValue()).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(notConvertToPbom)).throwMessage(StrUtil.join(",", notConvertToPbom) + "未转PBom,不能发起变更");
|
||||
|
||||
List<BomNewEbomParentEntity> parentResult = new ArrayList<>();
|
||||
List<BomNewEbomChildEntity> childResult = new ArrayList<>();
|
||||
for (Long bomRowId : paramDTO.getBomRowIds()) {
|
||||
BomNewEbomParentEntity parent = this.getById(bomRowId);
|
||||
List<BomNewEbomParentEntity> existEnt = this.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parent.getMaterialNo()).lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
|
||||
//含发布前版本则无需升级
|
||||
if(CollUtil.isEmpty(existEnt)) {
|
||||
List<BomNewEbomChildEntity> child = ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, bomRowId).list();
|
||||
|
||||
BomNewEbomParentEntity newParent = new BomNewEbomParentEntity();
|
||||
BeanUtil.copyProperties(parent, newParent);
|
||||
newParent.setRowId(IdWorker.getId());
|
||||
|
|
@ -695,11 +698,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
newParent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_11.getValue());
|
||||
newParent.setChangeDesc(paramDTO.getChangeDesc());
|
||||
newParent.setNoticeNums(paramDTO.getNoticeNums());
|
||||
newParent.setStatus(EBomStatusEnum.WAIT_CHECK.getValue());
|
||||
parent.setLastVersionIs(0);
|
||||
parentResult.add(newParent);
|
||||
parentResult.add(parent);
|
||||
|
||||
|
||||
for (BomNewEbomChildEntity childEnt : child) {
|
||||
BomNewEbomChildEntity newChild = new BomNewEbomChildEntity();
|
||||
BeanUtil.copyProperties(childEnt, newChild);
|
||||
|
|
@ -708,6 +710,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
childResult.add(newChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(parentResult)) {
|
||||
this.saveOrUpdateBatch(parentResult);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.enums.BooleanEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
|
@ -38,6 +39,7 @@ import java.io.IOException;
|
|||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
|
|
@ -158,6 +160,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
/**
|
||||
* 获取物料所有子级
|
||||
*
|
||||
* @param materialNo
|
||||
* @param
|
||||
* @return
|
||||
|
|
@ -185,7 +188,6 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 已
|
||||
*
|
||||
|
|
@ -200,6 +202,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
/**
|
||||
* 导出工作列表
|
||||
*
|
||||
* @param query
|
||||
* @param response
|
||||
* @throws IOException
|
||||
|
|
@ -213,6 +216,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
/**
|
||||
* 导出正式工作表
|
||||
*
|
||||
* @param query
|
||||
* @param response
|
||||
* @throws IOException
|
||||
|
|
@ -510,6 +514,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
return result;
|
||||
|
||||
}
|
||||
|
||||
public void generateDrawingNo(List<BomNewPbomParentVO> saveBomDetailParamDTO, Long bomRowID, String parentDrawingNo) {
|
||||
List<BomNewPbomParentVO> firstLevelBoms = saveBomDetailParamDTO.stream().filter(u -> u.getParentRowId().equals(bomRowID)).collect(Collectors.toList());
|
||||
parentDrawingNo = StrUtil.isNotBlank(parentDrawingNo) ? parentDrawingNo : "";
|
||||
|
|
@ -555,16 +560,16 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
VUtils.isTure(StrUtil.isBlank(params.getRuleGroupCode())).throwMessage("规则编码不能为空");
|
||||
|
||||
List<BomNewPbomParentVO> childrenVO = getAllBom(params.getBomRowId(), 0);
|
||||
List<BomNewPbomParentVO> childrenVO = getAllBom(params.getBomRowId(), 0, true);
|
||||
materialMainService.intiMaterialInfo(childrenVO, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
List<BomFactorySplitRuleEntity> relList = bomFactorySplitRuleService.lambdaQuery().eq(BomFactorySplitRuleEntity::getRuleGroupCode, params.getRuleGroupCode()).list();
|
||||
StringBuilder relPattern = new StringBuilder();
|
||||
List<BomNewPbomChildEntity> result = new ArrayList<>();
|
||||
|
||||
for (BomNewPbomParentVO child : childrenVO) {
|
||||
if (StrUtil.isNotBlank(child.getProductionFactoryCode()) && ProductionFactoryCodeInputTypeEnum.MANUAL.equalsValue(child.getProductionFactoryCodeInputType())) {
|
||||
continue;
|
||||
}
|
||||
// if (StrUtil.isNotBlank(child.getProductionFactoryCode()) && ProductionFactoryCodeInputTypeEnum.MANUAL.equalsValue(child.getProductionFactoryCodeInputType())) {
|
||||
// continue;
|
||||
// }
|
||||
for (BomFactorySplitRuleEntity role : relList) {
|
||||
Boolean match = true;
|
||||
if (StrUtil.isNotBlank(role.getMaterialCategoryCode())) {
|
||||
|
|
@ -602,19 +607,28 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(child.getProjectType().equals("Q")){
|
||||
intiQFac(child,childrenVO);
|
||||
}else {
|
||||
intiNotQFac(child,childrenVO);
|
||||
}
|
||||
//Q项
|
||||
List<BomNewPbomParentVO> qList = childrenVO.stream().filter(u -> u.getProjectType().equals("Q")).collect(Collectors.toList());
|
||||
{
|
||||
for (BomNewPbomParentVO qVo : qList) {
|
||||
intiQFac(qVo, childrenVO);
|
||||
}
|
||||
}
|
||||
//非Q
|
||||
// List<BomNewPbomParentVO> noQList = childrenVO.stream().filter(u -> !u.getProjectType().equals("Q")).collect(Collectors.toList());
|
||||
// {
|
||||
// for (BomNewPbomParentVO noQVo : noQList) {
|
||||
// intiNotQFac(noQVo, childrenVO);
|
||||
// }
|
||||
// }
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
pbomChildService.saveOrUpdateBatch(result);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
//处理Q下子级分工厂
|
||||
private void intiQFac(BomNewPbomParentVO parentVO, List<BomNewPbomParentVO> child) {
|
||||
|
||||
|
|
@ -622,6 +636,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
setSubNodeFac(parentVO, child, parentVO.getProductionFactoryCode());
|
||||
|
||||
}
|
||||
|
||||
//非Q
|
||||
private void intiNotQFac(BomNewPbomParentVO parentVO, List<BomNewPbomParentVO> child) {
|
||||
|
||||
|
|
@ -638,7 +653,6 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void setParentFac(BomNewPbomParentVO parentVO, List<BomNewPbomParentVO> child, String facCode) {
|
||||
|
|
@ -654,8 +668,9 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
}
|
||||
|
||||
private void setSubNodeFac(BomNewPbomParentVO parentVO, List<BomNewPbomParentVO> child, String facCode) {
|
||||
String zero ="1"+ StrUtil.padAfter("0", parentVO.getLevelNum().toString().split(".")[1].length(), "0");
|
||||
BigDecimal bNodeLevel = NumberUtil.add(parentVO.getLevelNumber(), new BigDecimal(1).divide(NumberUtil.div ( new BigDecimal(1) , new BigDecimal(zero))) );
|
||||
String[] numSplit = parentVO.getLevelNumber().toString().split(".");
|
||||
String zero = "1" + StrUtil.padAfter("0", (numSplit.length > 1 ? numSplit[1].length() : 0), "0");
|
||||
BigDecimal bNodeLevel = NumberUtil.add(parentVO.getLevelNumber(), (NumberUtil.div(new BigDecimal(1), new BigDecimal(zero))));
|
||||
List<BomNewPbomParentVO> subNodes = child.stream().filter(u -> u.getLevelNumber().compareTo(parentVO.getLevelNumber()) > 0 && u.getLevelNumber().compareTo(bNodeLevel) < 0).collect(Collectors.toList());
|
||||
for (BomNewPbomParentVO node : subNodes) {
|
||||
node.setProductionFactoryCode(facCode);
|
||||
|
|
@ -664,8 +679,6 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void reConvertToMBom(Long bomRowId, List<Long> backRowId) {
|
||||
|
||||
|
||||
|
|
@ -696,7 +709,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
List<String> noProductionFactoryCodeList = allChild.stream().filter(u -> StrUtil.isBlank(u.getProductionFactoryCode())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noProductionFactoryCodeList)).throwMessage(StrUtil.join(",", noProductionFactoryCodeList) + "物料暂未分工厂,请分完工厂再进行发布");
|
||||
ConvertToMBom convertToMBom = new ConvertToMBom(rootParent, allChild);
|
||||
convertToMBom.convertToMBom();
|
||||
convertToMBom.convertToMBom(true, true);
|
||||
if (CollUtil.isNotEmpty(convertToMBom.getMBomParentResult())) {
|
||||
mBomParentService.saveOrUpdateBatch(convertToMBom.getMBomParentResult());
|
||||
}
|
||||
|
|
@ -717,6 +730,40 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* MBOM退回后,重新发布调用
|
||||
*
|
||||
* @param bomRowId
|
||||
* @return
|
||||
* @throws ExecutionException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean convertToMBomFor1020(Long bomRowId) throws ExecutionException, InterruptedException {
|
||||
|
||||
BomNewPbomParentEntity rootParent = this.getById(bomRowId);
|
||||
List<BomNewPbomParentVO> allChild = getAllBom(bomRowId, 0);
|
||||
|
||||
if (StrUtil.isBlank(rootParent.getOrderNo())) {
|
||||
String orderNo = crmService.getOrderNo(rootParent.getMaterialNo());
|
||||
rootParent.setOrderNo(orderNo);
|
||||
}
|
||||
VUtils.isTure(StrUtil.isBlank(rootParent.getOrderNo())).throwMessage("没有获取到订单号");
|
||||
|
||||
List<String> noProductionFactoryCodeList = allChild.stream().filter(u -> StrUtil.isBlank(u.getProductionFactoryCode())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noProductionFactoryCodeList)).throwMessage(StrUtil.join(",", noProductionFactoryCodeList) + "物料暂未分工厂,请分完工厂再进行发布");
|
||||
ConvertToMBom convertToMBom = new ConvertToMBom(rootParent, allChild);
|
||||
convertToMBom.convertToMBom(false, true);
|
||||
if (CollUtil.isNotEmpty(convertToMBom.getMBomParentResult())) {
|
||||
mBomParentService.saveOrUpdateBatch(convertToMBom.getMBomParentResult());
|
||||
}
|
||||
if (CollUtil.isNotEmpty(convertToMBom.getMBomDetailResult())) {
|
||||
mBomDetailService.saveOrUpdateBatch(convertToMBom.getMBomDetailResult());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发布Pbom
|
||||
*
|
||||
|
|
@ -732,7 +779,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
bomRowIds.add(bomRowId);
|
||||
this.getBaseMapper().bomRelease(state, SessionUtil.getUserName(), bomRowIds);
|
||||
//同步sap
|
||||
saySyncDEMO();
|
||||
// saySyncDEMO();
|
||||
// importSap(parent,allBom);
|
||||
|
||||
} catch (Exception ex) {
|
||||
throw new NflgBusinessException(STATE.BusinessError, "发布Pbom失败:" + ex.getMessage());
|
||||
|
|
@ -747,11 +795,11 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
ImportToSapParentDTO sapParent = new ImportToSapParentDTO();
|
||||
sapParent.setWERKS("1010");
|
||||
sapParent.setMATNR("2100564157");
|
||||
sapParent.setSTLAN("");
|
||||
sapParent.setSTLAN("2");
|
||||
sapParent.setBMENG("1");
|
||||
sapParent.setBMEIN("PC");
|
||||
sapParent.setSTLST("3");
|
||||
sapParent.setDATUV("2024-01-16");
|
||||
sapParent.setDATUV("20240116");
|
||||
|
||||
result.setParent(sapParent);
|
||||
List<ImportToSapChildDTO> childResult = new ArrayList<>();
|
||||
|
|
@ -785,7 +833,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
sapParams.add(buildSapBom(Convert.convert(BomNewPbomParentVO.class, parent), pChild));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(sapParams)) {
|
||||
sapOpUtilService.importPBomToSap(sapParams);
|
||||
ResultVO<Boolean> booleanResultVO = sapOpUtilService.importPBomToSap(sapParams);
|
||||
VUtils.isTure(!booleanResultVO.getState().equals(STATE.Success)).throwMessage("同步SAP失败:" + booleanResultVO.getMsg());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -794,14 +843,14 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
ImportToSapDTO result = new ImportToSapDTO();
|
||||
ImportToSapParentDTO sapParent = new ImportToSapParentDTO();
|
||||
SimpleDateFormat spt=new SimpleDateFormat("yyyy-MM-dd");
|
||||
DateTimeFormatter ymd = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
sapParent.setWERKS(parentVO.getFacCode());
|
||||
sapParent.setMATNR(parentVO.getMaterialNo());
|
||||
sapParent.setSTLAN("");
|
||||
sapParent.setSTLAN("2");
|
||||
sapParent.setBMENG(parentVO.getNum().toString());
|
||||
sapParent.setBMEIN(parentVO.getMaterialUnit());
|
||||
sapParent.setSTLST("3");
|
||||
sapParent.setDATUV(spt.format( parentVO.getCreatedTime()));
|
||||
sapParent.setDATUV(parentVO.getCreatedTime().format(ymd));
|
||||
|
||||
List<ImportToSapChildDTO> childResult = new ArrayList<>();
|
||||
for (BomNewPbomParentVO child : children) {
|
||||
|
|
@ -820,7 +869,6 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取CRM 订单号
|
||||
*
|
||||
|
|
@ -834,6 +882,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
/**
|
||||
* 发起变更
|
||||
*
|
||||
* @param bomRowId
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public class SapOpUtilService {
|
|||
return ResultVO.error(STATE.Error, eErrmsg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
return ResultVO.error(STATE.Error, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -185,6 +185,9 @@ public class CheckEBomException {
|
|||
return;
|
||||
}
|
||||
for (BomNewEbomParentVO exItem : exceptionList) {
|
||||
if(Objects.isNull(exItem.getLevelNo())){
|
||||
continue;
|
||||
}
|
||||
List<String> parentByLevel = BomLevelUtil.getParentByLevel(exItem.getLevelNo());
|
||||
List<BomNewEbomParentVO> warnList = allBomDetail.stream().filter(u -> !u.getVirtualPartType().equals(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && !u.getVirtualPartType().equals(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue()) && u.getBomRowId() > 0 && parentByLevel.contains(u.getLevelNo()) && EBomExceptionStatusEnum.OK.equalsValue(u.getExceptionStatus())).collect(Collectors.toList());
|
||||
for (BomNewEbomParentVO k :warnList) {
|
||||
|
|
|
|||
|
|
@ -9,14 +9,17 @@ import cn.hutool.extra.spring.SpringUtil;
|
|||
import com.alibaba.excel.enums.BooleanEnum;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.bomnew.constant.EBomConstant;
|
||||
import com.nflg.product.bomnew.constant.MBomConstantEnum;
|
||||
import com.nflg.product.bomnew.constant.ProductionFactoryCodeInputTypeEnum;
|
||||
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewMbomDetailEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewMbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||
import com.nflg.product.bomnew.service.BomNewMbomDetailService;
|
||||
import com.nflg.product.bomnew.service.BomNewMbomParentService;
|
||||
import com.nflg.product.bomnew.service.BomNewPbomParentService;
|
||||
import com.nflg.product.bomnew.util.CTreePBomUtils;
|
||||
|
|
@ -68,13 +71,17 @@ public class ConvertToMBom {
|
|||
/**
|
||||
* 转换MBom
|
||||
*/
|
||||
public void convertToMBom() {
|
||||
public void convertToMBom(Boolean convert1010 ,Boolean convert1020) {
|
||||
//handler1010();
|
||||
if(convert1020) {
|
||||
handler1020();
|
||||
|
||||
buildMBom(EBomConstant.MAIN_FACTORY_CODE_1010);
|
||||
buildMBom(EBomConstant.XIAN_TAO_FACTORY_CODE_1020);
|
||||
}
|
||||
if(convert1010) {
|
||||
buildMBom(EBomConstant.MAIN_FACTORY_CODE_1010);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建MBom明细
|
||||
|
|
@ -87,9 +94,17 @@ public class ConvertToMBom {
|
|||
BomNewMbomParentEntity oldParent = SpringUtil.getBean(BomNewMbomParentService.class).lambdaQuery().eq(BomNewMbomParentEntity::getMaterialNo, parent.getMaterialNo())
|
||||
.eq(BomNewMbomParentEntity::getLastVersionIs, 1).eq(BomNewMbomParentEntity::getFacCode, facCode).one();
|
||||
if (Objects.nonNull(oldParent)) {
|
||||
if(MBomConstantEnum.MBomStatusEnum.PUB_SAP.equalsValue(oldParent.getStatus()) ) {
|
||||
|
||||
mBomParent.setCurrentVersion(VersionUtil.getNextVersion(oldParent.getCurrentVersion()));
|
||||
oldParent.setLastVersionIs(0);
|
||||
this.mBomParentResult.add(oldParent);
|
||||
}
|
||||
else {
|
||||
SpringUtil.getBean(BomNewMbomDetailService.class).getBaseMapper().deleteByMap(ImmutableMap.of("bom_row_id", oldParent.getRowId()));
|
||||
SpringUtil.getBean(BomNewMbomParentService.class).getBaseMapper().deleteById(oldParent.getRowId());
|
||||
mBomParent.setCurrentVersion(oldParent.getCurrentVersion());
|
||||
}
|
||||
} else {
|
||||
mBomParent.setCurrentVersion(VersionUtil.getNextVersion(""));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,5 +132,11 @@ public class BaseGlobalExceptionHandle {
|
|||
return ResultVO.error(e.getBindingResult().getFieldError().getDefaultMessage()) ;
|
||||
}
|
||||
|
||||
@ExceptionHandler(NullPointerException.class)
|
||||
public ResultVO<String> handleNullPointerException(NullPointerException ex) {
|
||||
|
||||
return ResultVO.error(STATE.Error, "系统错误,请联系管理员:"+ex.getMessage()) ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue