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
46a0186ab3
|
|
@ -328,7 +328,6 @@ public class EbomApi extends BaseApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultVO.success(bomNewEbomParentService.changeMaterial(dto));
|
return ResultVO.success(bomNewEbomParentService.changeMaterial(dto));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,10 @@ import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||||
import com.nflg.product.bomnew.constant.*;
|
import com.nflg.product.bomnew.constant.*;
|
||||||
import com.nflg.product.bomnew.mapper.master.BomNewEbomParentMapper;
|
import com.nflg.product.bomnew.mapper.master.BomNewEbomParentMapper;
|
||||||
import com.nflg.product.bomnew.pojo.dto.*;
|
import com.nflg.product.bomnew.pojo.dto.*;
|
||||||
import com.nflg.product.bomnew.pojo.entity.*;
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomMaterialUseEntity;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
|
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
|
||||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
||||||
import com.nflg.product.bomnew.pojo.vo.*;
|
import com.nflg.product.bomnew.pojo.vo.*;
|
||||||
|
|
@ -49,7 +52,6 @@ import java.util.*;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.ForkJoinPool;
|
import java.util.concurrent.ForkJoinPool;
|
||||||
import java.util.concurrent.ForkJoinTask;
|
import java.util.concurrent.ForkJoinTask;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
import java.util.function.BinaryOperator;
|
import java.util.function.BinaryOperator;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
@ -1796,16 +1798,15 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
|
|
||||||
|
|
||||||
public List<BomNewEbomParentVO> changeMaterial(BomNewEBomChangeDTO dto) {
|
public List<BomNewEbomParentVO> changeMaterial(BomNewEBomChangeDTO dto) {
|
||||||
CheckEBomException.checkMaterialNoInMain(dto.getDatas());
|
List<BaseMaterialVO> materialVOS = CheckEBomException.checkMaterialNoInMain(dto.getDatas());
|
||||||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(dto.getDatas(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(dto.getDatas(), materialVOS, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
||||||
|
|
||||||
for (BomNewEbomParentVO vo :
|
for (BomNewEbomParentVO vo :
|
||||||
dto.getDatas()) {
|
dto.getDatas()) {
|
||||||
vo.setTotalWeight(NumberUtil.mul(vo.getUnitWeight(), vo.getNum()));
|
vo.setTotalWeight(NumberUtil.mul(vo.getUnitWeight(), vo.getNum()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return dto.getDatas();
|
return dto.getDatas();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
package com.nflg.product.bomnew.service;
|
package com.nflg.product.bomnew.service;
|
||||||
|
|
||||||
import cn.hutool.cache.Cache;
|
|
||||||
import cn.hutool.cache.CacheUtil;
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
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.lang.Pair;
|
|
||||||
import cn.hutool.core.lang.TypeReference;
|
import cn.hutool.core.lang.TypeReference;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
|
@ -112,9 +109,16 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends BaseMaterialVO> void intiMaterialInfo(List<T> data , String ... ignorePropertyList) {
|
public <T extends BaseMaterialVO> void intiMaterialInfo(List<T> data , String ... ignorePropertyList) {
|
||||||
List<String> materialNos = data.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
List<String> materialNos = data.stream().map(BaseMaterialVO::getMaterialNo).filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||||
if (CollUtil.isNotEmpty(materialNos)) {
|
if (CollUtil.isNotEmpty(materialNos)) {
|
||||||
List<BaseMaterialVO> materialBaseInfos = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos);
|
List<BaseMaterialVO> materialBaseInfos = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos);
|
||||||
|
intiMaterialInfo(data, materialBaseInfos, ignorePropertyList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends BaseMaterialVO> void intiMaterialInfo(List<T> data ,List<BaseMaterialVO> materialBaseInfos, String ... ignorePropertyList) {
|
||||||
|
List<String> materialNos = data.stream().map(BaseMaterialVO::getMaterialNo).filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(materialNos)) {
|
||||||
Map<String, BaseMaterialVO> materialMp = ListCommonUtil.listToMap(materialBaseInfos, BaseMaterialVO::getMaterialNo);
|
Map<String, BaseMaterialVO> materialMp = ListCommonUtil.listToMap(materialBaseInfos, BaseMaterialVO::getMaterialNo);
|
||||||
for (T t : data) {
|
for (T t : data) {
|
||||||
if (StrUtil.isNotBlank(t.getMaterialNo()) && materialMp.containsKey(t.getMaterialNo())) {
|
if (StrUtil.isNotBlank(t.getMaterialNo()) && materialMp.containsKey(t.getMaterialNo())) {
|
||||||
|
|
|
||||||
|
|
@ -40,18 +40,19 @@ public class CheckEBomException {
|
||||||
private Boolean checkWaring=false;
|
private Boolean checkWaring=false;
|
||||||
|
|
||||||
|
|
||||||
public static void checkMaterialNoInMain1(List<String> materialNos) {
|
public static List<BaseMaterialVO> checkMaterialNoInMain1(List<String> materialNos) {
|
||||||
// List<String> materialNos = dto.getDatas().stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
// List<String> materialNos = dto.getDatas().stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||||
//检查物料编码是否在主数据中存在
|
//检查物料编码是否在主数据中存在
|
||||||
List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos);
|
List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos);
|
||||||
List<String> effectiveMaterialNos = materialBaseInfo.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
List<String> effectiveMaterialNos = materialBaseInfo.stream().map(BaseMaterialVO::getMaterialNo).collect(Collectors.toList());
|
||||||
Set<String> difference = Sets.difference(new HashSet<>(materialNos), new HashSet<>(effectiveMaterialNos));
|
Set<String> difference = Sets.difference(new HashSet<>(materialNos), new HashSet<>(effectiveMaterialNos));
|
||||||
VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料档案中不存在");
|
VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料档案中不存在");
|
||||||
|
return materialBaseInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkMaterialNoInMain(List<BomNewEbomParentVO> list) {
|
public static List<BaseMaterialVO> checkMaterialNoInMain(List<BomNewEbomParentVO> list) {
|
||||||
List<String> materialNos = list.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
List<String> materialNos = list.stream().map(BaseMaterialVO::getMaterialNo).filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||||
checkMaterialNoInMain1(materialNos);
|
return checkMaterialNoInMain1(materialNos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue