feat: 如果导入的单位跟物料主数据单位不一致,则提示数据不一致异常
This commit is contained in:
parent
b34beca4f2
commit
36e0e5c293
|
|
@ -626,14 +626,14 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void checkBomException(List<BomNewEbomParentVO> list, List<Integer> unCheckList) {
|
// public void checkBomException(List<BomNewEbomParentVO> list, List<Integer> unCheckList) {
|
||||||
CheckEBomException checkEBomException = new CheckEBomException(list);
|
// CheckEBomException checkEBomException = new CheckEBomException(list);
|
||||||
checkEBomException.setUnCheckExcept(unCheckList);
|
// checkEBomException.setUnCheckExcept(unCheckList);
|
||||||
checkEBomException.checkException();
|
// checkEBomException.checkException();
|
||||||
|
//
|
||||||
//保存异常
|
// //保存异常
|
||||||
saveException(checkEBomException);
|
// saveException(checkEBomException);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import com.nflg.product.bomnew.util.VUtils;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
|
|
@ -108,12 +109,14 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends BaseMaterialVO> void intiMaterialInfo(List<T> data , String ... ignorePropertyList) {
|
public <T extends BaseMaterialVO> List<BaseMaterialVO> intiMaterialInfo(List<T> data, String... ignorePropertyList) {
|
||||||
List<String> materialNos = data.stream().map(BaseMaterialVO::getMaterialNo).filter(StrUtil::isNotBlank).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);
|
intiMaterialInfo(data, materialBaseInfos, ignorePropertyList);
|
||||||
|
return materialBaseInfos;
|
||||||
}
|
}
|
||||||
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends BaseMaterialVO> void intiMaterialInfo(List<T> data ,List<BaseMaterialVO> materialBaseInfos, String ... ignorePropertyList) {
|
public <T extends BaseMaterialVO> void intiMaterialInfo(List<T> data ,List<BaseMaterialVO> materialBaseInfos, String ... ignorePropertyList) {
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,7 @@ import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||||
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
||||||
import com.nflg.product.bomnew.service.MaterialMainService;
|
import com.nflg.product.bomnew.service.MaterialMainService;
|
||||||
import com.nflg.product.bomnew.util.BomLevelUtil;
|
import com.nflg.product.bomnew.util.*;
|
||||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
|
||||||
import com.nflg.product.bomnew.util.TreeUtils;
|
|
||||||
import com.nflg.product.bomnew.util.VUtils;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import nflg.product.common.constant.STATE;
|
import nflg.product.common.constant.STATE;
|
||||||
|
|
@ -88,28 +85,27 @@ public class CheckEBomException {
|
||||||
*/
|
*/
|
||||||
public void initException() {
|
public void initException() {
|
||||||
//初始化物料信息
|
//初始化物料信息
|
||||||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(allBomDetail, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(allBomDetail, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||||
|
|
||||||
checkException();
|
checkException(materialBaseInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initException(List<Integer> unCheckException) {
|
public void initException(List<Integer> unCheckException) {
|
||||||
//初始化物料信息
|
//初始化物料信息
|
||||||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(allBomDetail, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(allBomDetail, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||||
this.unCheckExcept=unCheckException;
|
this.unCheckExcept=unCheckException;
|
||||||
checkException();
|
checkException(materialBaseInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initException(String... ignorePropertyList) {
|
public void initException(String... ignorePropertyList) {
|
||||||
|
List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(allBomDetail, ignorePropertyList);
|
||||||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(allBomDetail, ignorePropertyList);
|
checkException(materialBaseInfo);
|
||||||
checkException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void checkException() {
|
public void checkException(List<BaseMaterialVO> materialBaseInfo) {
|
||||||
for (BomNewEbomParentVO vo : allBomDetail) {
|
for (BomNewEbomParentVO vo : allBomDetail) {
|
||||||
// if(Objects.isNull(vo.getExceptionStatus())) {
|
// if(Objects.isNull(vo.getExceptionStatus())) {
|
||||||
//忽略不检查的如14
|
//忽略不检查的如14
|
||||||
|
|
@ -118,7 +114,10 @@ public class CheckEBomException {
|
||||||
&& unCheckExcept.contains(vo.getExceptionStatus())) {
|
&& unCheckExcept.contains(vo.getExceptionStatus())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
BaseMaterialVO mainVO = materialBaseInfo.stream()
|
||||||
|
.filter(u -> StrUtil.equals(u.getMaterialNo(), vo.getMaterialNo()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
|
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
|
||||||
// }
|
// }
|
||||||
if (StrUtil.isNotBlank(vo.getMaterialNo())
|
if (StrUtil.isNotBlank(vo.getMaterialNo())
|
||||||
|
|
@ -132,6 +131,9 @@ public class CheckEBomException {
|
||||||
} else if (StrUtil.isBlank(vo.getProjectType()) && !Objects.equals(vo.getRootIs(), 1)
|
} else if (StrUtil.isBlank(vo.getProjectType()) && !Objects.equals(vo.getRootIs(), 1)
|
||||||
&& !Objects.equals(vo.getUserRootIs(), 1) && !Objects.equals(vo.getRootIsForWaitReview(), 1)) {
|
&& !Objects.equals(vo.getUserRootIs(), 1) && !Objects.equals(vo.getRootIsForWaitReview(), 1)) {
|
||||||
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
|
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
|
||||||
|
} else if ((StrUtil.equals("KG", StringUtil.toUpperCase(vo.getMaterialUnit())) && !StrUtil.equals(StringUtil.toUpperCase(vo.getMaterialUnit()), "PC"))
|
||||||
|
|| (!Objects.isNull(mainVO) && !StrUtil.equals(vo.getMaterialUnit(), mainVO.getMaterialUnit()))) {
|
||||||
|
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_12.getValue());
|
||||||
} else if (StrUtil.isNotBlank(vo.getNoticeNums()) && EBomExceptionStatusEnum.EXCEPT_NO_11.equalsValue(vo.getExceptionStatus())) {
|
} else if (StrUtil.isNotBlank(vo.getNoticeNums()) && EBomExceptionStatusEnum.EXCEPT_NO_11.equalsValue(vo.getExceptionStatus())) {
|
||||||
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
|
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.nflg.product.bomnew.util;
|
package com.nflg.product.bomnew.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -134,4 +135,9 @@ public class StringUtil {
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String toUpperCase(String str) {
|
||||||
|
if (StrUtil.isBlank(str)) return str;
|
||||||
|
return str.toUpperCase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue