fix: 修复电气bom导入sap成功后,bom状态会变成待转换的问题;导入到sap的物料单位改为使用主物料单位
This commit is contained in:
parent
a6ee24c8c5
commit
7545e35fbf
|
|
@ -3,7 +3,6 @@ package com.nflg.product.bomnew.service;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
@ -387,6 +386,8 @@ public class DQBomService {
|
||||||
|
|
||||||
List<BomNewDQbomVO> datas = getAll(rootBomRowId);
|
List<BomNewDQbomVO> datas = getAll(rootBomRowId);
|
||||||
datas.remove(0);
|
datas.remove(0);
|
||||||
|
List<String> materialNos = datas.stream().map(BomNewDQbomVO::getMaterialNo).collect(Collectors.toList());
|
||||||
|
List<BaseMaterialVO> materialBaseInfos = materialMainService.getMaterialBaseInfo(materialNos);
|
||||||
ImportSapParamDTO sapDto = new ImportSapParamDTO();
|
ImportSapParamDTO sapDto = new ImportSapParamDTO();
|
||||||
sapDto.setZID(RandomUtil.randomNumbers(5));
|
sapDto.setZID(RandomUtil.randomNumbers(5));
|
||||||
sapDto.setI_WERKS("1");
|
sapDto.setI_WERKS("1");
|
||||||
|
|
@ -397,28 +398,35 @@ public class DQBomService {
|
||||||
T1DTO t1 = new T1DTO();
|
T1DTO t1 = new T1DTO();
|
||||||
t1.setID(RandomUtil.randomNumbers(5));
|
t1.setID(RandomUtil.randomNumbers(5));
|
||||||
t1.setMATNR(d.getParentMaterialNo());
|
t1.setMATNR(d.getParentMaterialNo());
|
||||||
t1.setMEINS(d.getMaterialUnit());
|
|
||||||
t1.setMENGE(d.getNum().toString());
|
t1.setMENGE(d.getNum().toString());
|
||||||
t1.setPOSTP(d.getProjectType());
|
t1.setPOSTP(d.getProjectType());
|
||||||
|
t1.setDATUM(dateYMD);
|
||||||
|
|
||||||
|
t1.setMEINS(d.getMaterialUnit());
|
||||||
if (BomConstant.PROJECT_TYPE_TEMPORARY.equals(d.getProjectType())) {
|
if (BomConstant.PROJECT_TYPE_TEMPORARY.equals(d.getProjectType())) {
|
||||||
t1.setIDNRK("");
|
t1.setIDNRK("");
|
||||||
t1.setPOTX1(d.getMaterialName());
|
t1.setPOTX1(d.getMaterialName());
|
||||||
} else {
|
} else {
|
||||||
t1.setIDNRK(d.getMaterialNo());
|
t1.setIDNRK(d.getMaterialNo());
|
||||||
|
BaseMaterialVO bm = materialBaseInfos.stream().filter(m -> m.getMaterialNo().equals(d.getMaterialNo())).findFirst().orElse(null);
|
||||||
|
if (!Objects.isNull(bm)) {
|
||||||
|
t1.setMEINS(bm.getMaterialUnit());
|
||||||
}
|
}
|
||||||
t1.setDATUM(dateYMD);
|
}
|
||||||
|
|
||||||
t1s.add(t1);
|
t1s.add(t1);
|
||||||
});
|
});
|
||||||
sapDto.setT1(t1s);
|
sapDto.setT1(t1s);
|
||||||
ResultVO<Boolean> resultVO = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null);
|
ResultVO<Boolean> resultVO = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null);
|
||||||
if (resultVO.getState().equals(STATE.Success.getState())) {
|
boolean update = dQBomParentService.lambdaUpdate()
|
||||||
BomNewDQbomParentEntity parentEntity = new BomNewDQbomParentEntity();
|
.eq(BomNewDQbomParentEntity::getRowId, rootBomRowId)
|
||||||
parentEntity.setRowId(rootBomRowId);
|
.set(BomNewDQbomParentEntity::getSapTime, LocalDateTime.now())
|
||||||
parentEntity.setSapState(MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue());
|
.set(resultVO.getState().equals(STATE.Success.getState())
|
||||||
parentEntity.setSapTime(LocalDateTimeUtil.now());
|
, BomNewDQbomParentEntity::getSapState, MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue())
|
||||||
dQBomParentService.updateById(parentEntity);
|
.set(!resultVO.getState().equals(STATE.Success.getState())
|
||||||
}
|
, BomNewDQbomParentEntity::getSapState, MBomConstantEnum.MBomStatusEnum.PUB_ERROR.getValue())
|
||||||
return resultVO;
|
.update();
|
||||||
|
return update ? resultVO : ResultVO.error("更新数据失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
public BomDQbomEditDetailVO editDetail(Long rowId, Long bomRowId) {
|
public BomDQbomEditDetailVO editDetail(Long rowId, Long bomRowId) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue