Merge branch 'refs/heads/feature/DM/nflg-bom-dq' into dev

This commit is contained in:
曹鹏飞 2024-04-25 16:56:31 +08:00
commit 43b5c198c8
11 changed files with 166 additions and 53 deletions

View File

@ -15,6 +15,7 @@ import com.nflg.product.bomnew.pojo.vo.*;
import com.nflg.product.bomnew.service.DQBomImportService; import com.nflg.product.bomnew.service.DQBomImportService;
import com.nflg.product.bomnew.service.DQBomService; import com.nflg.product.bomnew.service.DQBomService;
import com.nflg.product.bomnew.util.EecExcelUtil; import com.nflg.product.bomnew.util.EecExcelUtil;
import com.nflg.product.bomnew.util.VUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import nflg.product.common.vo.ResultVO; import nflg.product.common.vo.ResultVO;
@ -139,7 +140,7 @@ public class DQBomApi extends BaseApi {
@PostMapping("checkException") @PostMapping("checkException")
@ApiOperation("异常检查") @ApiOperation("异常检查")
public ResultVO<String> checkException(@Valid @RequestBody @NotEmpty List<Long> bomRowIds) { public ResultVO<String> checkException(@Valid @RequestBody @NotEmpty List<Long> bomRowIds) {
dQBomService.checkException(bomRowIds.get(0)); bomRowIds.forEach(dQBomService::checkException);
return ResultVO.success(); return ResultVO.success();
} }
@ -151,7 +152,7 @@ public class DQBomApi extends BaseApi {
@PostMapping("deleteBom") @PostMapping("deleteBom")
@ApiOperation("删除bom") @ApiOperation("删除bom")
public ResultVO<String> deleteBom(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) { public ResultVO<String> deleteBom(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) {
dQBomService.deleteBom(rootBomRowIds.get(0)); rootBomRowIds.forEach(dQBomService::deleteBom);
return ResultVO.success(); return ResultVO.success();
} }
@ -163,6 +164,7 @@ public class DQBomApi extends BaseApi {
@PostMapping("exportBom") @PostMapping("exportBom")
@ApiOperation("导出bom") @ApiOperation("导出bom")
public void exportBom(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds, HttpServletResponse response) throws IOException { public void exportBom(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds, HttpServletResponse response) throws IOException {
VUtils.isTure(rootBomRowIds.size() > 1).throwMessage("每次只能导出1条");
List<DQbomExcelVO> data = dQBomService.exportBom(rootBomRowIds.get(0)); List<DQbomExcelVO> data = dQBomService.exportBom(rootBomRowIds.get(0));
EecExcelUtil.export(response, data, DQbomExcelVO.class, "电气专用bom"); EecExcelUtil.export(response, data, DQbomExcelVO.class, "电气专用bom");
} }
@ -175,7 +177,7 @@ public class DQBomApi extends BaseApi {
@PostMapping("convertToPbom") @PostMapping("convertToPbom")
@ApiOperation("生成pbom") @ApiOperation("生成pbom")
public ResultVO convertToPbom(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) { public ResultVO convertToPbom(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) {
dQBomService.convertToPbom(rootBomRowIds.get(0)); rootBomRowIds.forEach(dQBomService::convertToPbom);
return ResultVO.success(); return ResultVO.success();
} }
@ -211,6 +213,7 @@ public class DQBomApi extends BaseApi {
@PostMapping("importToSAP") @PostMapping("importToSAP")
@ApiOperation("导入到SAP") @ApiOperation("导入到SAP")
public ResultVO<Boolean> importToSAP(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) { public ResultVO<Boolean> importToSAP(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) {
VUtils.isTure(rootBomRowIds.size() > 1).throwMessage("每次只能导入1条");
return dQBomService.importToSAP(rootBomRowIds.get(0)); return dQBomService.importToSAP(rootBomRowIds.get(0));
} }

View File

@ -31,6 +31,8 @@ import org.ttzero.excel.entity.Workbook;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -450,5 +452,15 @@ public class EbomApi extends BaseApi {
return ResultVO.success(); return ResultVO.success();
} }
/**
* 导入到SAP
* @param rootBomRowIds 顶级bom的rowId
* @return
*/
@PostMapping("importToSAP")
@ApiOperation("导入到SAP")
public ResultVO<Boolean> importToSAP(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) {
VUtils.isTure(rootBomRowIds.size() > 1).throwMessage("每次只能导入1条");
return bomNewEbomParentService.importToSAP(rootBomRowIds.get(0));
}
} }

View File

@ -1,19 +1,17 @@
package com.nflg.product.bomnew.pojo.entity; package com.nflg.product.bomnew.pojo.entity;
import java.math.BigDecimal; import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalDate;
/** /**
* t_bom_new_ebom_parent * t_bom_new_ebom_parent
@ -365,5 +363,19 @@ public class BomNewEbomParentEntity implements Serializable {
@ApiModelProperty(value = "待复核根节点") @ApiModelProperty(value = "待复核根节点")
private Integer rootIsForWaitReview; private Integer rootIsForWaitReview;
/**
* 导入SAP状态1-未导入3-已导入
*/
@TableField(value = "sap_state")
@ApiModelProperty(value = "导入SAP状态1-未导入3-已导入")
private Integer sapState;
/**
* 导入SAP时间
*/
@TableField(value = "sap_time")
@ApiModelProperty(value = "导入SAP时间")
private LocalDateTime sapTime;
private static final long serialVersionUID = 265246823929418418L; private static final long serialVersionUID = 265246823929418418L;
} }

View File

@ -130,7 +130,8 @@ public class BomNewDQbomExceptionCheckService {
// } else if (parent.getMaterialNo().startsWith(BomConstant.NO_TEMPORARY_PREFIX)) { // } else if (parent.getMaterialNo().startsWith(BomConstant.NO_TEMPORARY_PREFIX)) {
// status = EBomExceptionStatusEnum.EXCEPT_NO_4; // status = EBomExceptionStatusEnum.EXCEPT_NO_4;
} else { } else {
BaseMaterialVO materialVO = materialVOS.stream().filter(v -> v.getMaterialNo().equals(parent.getMaterialNo())) BaseMaterialVO materialVO = materialVOS.stream()
.filter(v -> v.getMaterialNo().equals(parent.getMaterialNo()))
.findFirst() .findFirst()
.orElse(null); .orElse(null);
if (materialVO == null) { if (materialVO == null) {

View File

@ -4,11 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.lang.TypeReference; import cn.hutool.core.lang.TypeReference;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.*;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil; import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@ -23,6 +22,8 @@ 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.dto.sap.impart2.ImportSapParamDTO;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO;
import com.nflg.product.bomnew.pojo.entity.*; import com.nflg.product.bomnew.pojo.entity.*;
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;
@ -46,6 +47,7 @@ import java.io.OutputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture;
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;
@ -626,14 +628,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);
} // }
/** /**
@ -921,6 +923,69 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
SpringUtil.getBean(BomNewEbomParentFormalService.class).copyEbomFormal(bomRowId); SpringUtil.getBean(BomNewEbomParentFormalService.class).copyEbomFormal(bomRowId);
CompletableFuture.runAsync(() -> {
importToSAP(bomRowId);
});
}
}
public ResultVO<Boolean> importToSAP(Long bomRowId) {
BomNewEbomParentEntity root = this.getById(bomRowId);
VUtils.isTure(Objects.isNull(root)).throwMessage("数据不存在");
VUtils.isTure(root.getRootIs() != 1).throwMessage("请选择根节点");
ImportSapParamDTO sapDto = new ImportSapParamDTO();
sapDto.setZID(RandomUtil.randomNumbers(5));
sapDto.setI_WERKS(FactoryCodeEnum.FACTORY_1010.getValue());
sapDto.setI_STLAN("2");
String dateYMD = DateUtil.format(new Date(), "yyyyMMdd");
List<T1DTO> t1s = new ArrayList<>();
T1DTO troot = new T1DTO();
troot.setID(RandomUtil.randomNumbers(5));
troot.setMATNR("");
troot.setIDNRK(root.getMaterialNo());
troot.setMEINS(root.getMaterialUnit());
troot.setMENGE("1");
troot.setPOSTP("");
troot.setDATUM(dateYMD);
t1s.add(troot);
buildChildrenForSap(root, t1s);
sapDto.setT1(t1s);
ResultVO<Boolean> resultVO = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null);
if (resultVO.getState().equals(STATE.Success.getState())) {
BomNewEbomParentEntity parentEntity = new BomNewEbomParentEntity();
parentEntity.setRowId(bomRowId);
parentEntity.setSapState(MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue());
parentEntity.setSapTime(LocalDateTimeUtil.now());
updateById(parentEntity);
}
return resultVO;
}
private void buildChildrenForSap(BomNewEbomParentEntity parent, List<T1DTO> t1s) {
List<BomNewEbomChildEntity> children = ebomChildService.lambdaQuery()
.eq(BomNewEbomChildEntity::getParentRowId, parent.getRowId())
.list();
if (CollUtil.isNotEmpty(children)) {
String dateYMD = DateUtil.format(new Date(), "yyyyMMdd");
children.forEach(c -> {
T1DTO t1 = new T1DTO();
t1.setID(RandomUtil.randomNumbers(5));
t1.setMATNR(parent.getMaterialNo());
t1.setIDNRK(c.getMaterialNo());
t1.setMEINS(c.getMaterialUnit());
t1.setMENGE(c.getNum().toString());
t1.setPOSTP(c.getProjectType());
t1.setDATUM(dateYMD);
t1s.add(t1);
BomNewEbomParentEntity cp = lambdaQuery()
.eq(BomNewEbomParentEntity::getMaterialNo, c.getMaterialNo())
.eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
.one();
if (!Objects.isNull(cp)) {
buildChildrenForSap(cp, t1s);
}
});
} }
} }
@ -1683,10 +1748,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
//恢复原始bom状态 //恢复原始bom状态
if (CollectionUtil.isNotEmpty(eBomDel.getRevertOBom())) { // if (CollectionUtil.isNotEmpty(eBomDel.getRevertOBom())) {
List<Long> rowIds = eBomDel.getRevertOBom().stream().map(BomNewEbomParentVO::getSourceRowId).collect(Collectors.toList()); // List<Long> rowIds = eBomDel.getRevertOBom().stream().map(BomNewEbomParentVO::getSourceRowId).collect(Collectors.toList());
SpringUtil.getBean(BomNewOriginalParentService.class).revertBom(rowIds); // SpringUtil.getBean(BomNewOriginalParentService.class).revertBom(rowIds);
} // }
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) { if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {

View File

@ -381,6 +381,10 @@ public class DQBomImportService {
dQbomExcelVO.setNum(BigDecimal.ONE); dQbomExcelVO.setNum(BigDecimal.ONE);
} }
} }
if (StrUtil.equals(dQbomExcelVO.getMaterialNo(), "9000000000")) {
dQbomExcelVO.setProjectType("T");
}
dQbomExcelVO.setCurrentVersion("");
excelContextTL.get().add(dQbomExcelVO); excelContextTL.get().add(dQbomExcelVO);
} }

View File

@ -224,8 +224,9 @@ public class DQBomService {
if (Objects.isNull(query.getParent()) || query.getParent().getBomRowId() == 0) { if (Objects.isNull(query.getParent()) || query.getParent().getBomRowId() == 0) {
//新增父级节点 //新增父级节点
BomNewDQbomParentEntity oldParent = dQBomParentService.lambdaQuery().eq(BomNewDQbomParentEntity::getMaterialNo, query.getParent().getMaterialNo()) BomNewDQbomParentEntity oldParent = dQBomParentService.lambdaQuery()
.eq(BomNewDQbomParentEntity::getLastVersionIs, 1) .eq(BomNewDQbomParentEntity::getMaterialNo, query.getParent().getMaterialNo())
.eq(BomNewDQbomParentEntity::getStatus, DQBomStatusEnum.WAIT_CONVERT.getValue())
.one(); .one();
VUtils.isTure(oldParent != null && !oldParent.getCreatedBy().equals(SessionUtil.getUserCode())) VUtils.isTure(oldParent != null && !oldParent.getCreatedBy().equals(SessionUtil.getUserCode()))
.throwMessage("父级已被其他人创建"); .throwMessage("父级已被其他人创建");
@ -380,7 +381,7 @@ public class DQBomService {
t1.setMATNR(d.getParentMaterialNo()); t1.setMATNR(d.getParentMaterialNo());
t1.setIDNRK(d.getMaterialNo()); t1.setIDNRK(d.getMaterialNo());
t1.setMEINS(d.getMaterialUnit()); t1.setMEINS(d.getMaterialUnit());
t1.setMENGE("1"); t1.setMENGE(d.getNum().toString());
t1.setPOSTP(d.getProjectType()); t1.setPOSTP(d.getProjectType());
t1.setDATUM(dateYMD); t1.setDATUM(dateYMD);
t1s.add(t1); t1s.add(t1);

View File

@ -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) {

View File

@ -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());
} }
@ -158,11 +160,15 @@ public class CheckEBomException {
for (String key : childMaterialMap.keySet()) { for (String key : childMaterialMap.keySet()) {
List<BomNewEbomParentVO> materialGroupList = childMaterialMap.get(key); List<BomNewEbomParentVO> materialGroupList = childMaterialMap.get(key);
if (materialGroupList.size() > 1) { if (materialGroupList.size() > 1) {
materialGroupList.forEach(u -> { Map<String, List<BomNewEbomParentVO>> m2 = ListCommonUtil.listGroupMap(materialGroupList, BomNewEbomParentVO::getProjectType);
m2.forEach((mk, mv) -> {
if (mv.size() > 1) {
mv.forEach(u -> {
u.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_6.getValue()); u.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_6.getValue());
}); });
} }
});
}
} }
if (ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue().equals(parent.getProjectType())) { if (ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue().equals(parent.getProjectType())) {
List<BomNewEbomParentVO> qList = child.stream().filter(u -> ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue().equals(u.getProjectType())).collect(Collectors.toList()); List<BomNewEbomParentVO> qList = child.stream().filter(u -> ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue().equals(u.getProjectType())).collect(Collectors.toList());

View File

@ -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();
}
} }

View File

@ -384,15 +384,15 @@
<select id="workDetailsListByPageNew" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO"> <select id="workDetailsListByPageNew" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
SELECT *,row_id as bomRowId SELECT *,row_id as bomRowId
FROM t_bom_new_ebom_parent FROM t_bom_new_ebom_parent
WHERE (root_is=1 OR ((user_root_is=1 OR root_is_for_wait_review=1) AND created_by=#{userCode})) <!-- WHERE (root_is=1 OR ((user_root_is=1 OR root_is_for_wait_review=1) AND created_by=#{userCode}))-->
<if test="userJob==0"> <if test="userJob==0">
AND status IN (1,3) WHERE status IN (1,3) AND (user_root_is=1 OR root_is_for_wait_review=1) AND created_by=#{userCode}
</if> </if>
<if test="userJob==1 and query.dataType==0"> <if test="userJob==1 and query.dataType==0">
AND status=2 WHERE root_is=1 AND status=2
</if> </if>
<if test="userJob==1 and query.dataType==1"> <if test="userJob==1 and query.dataType==1">
AND status=4 WHERE root_is=1 AND status=4
</if> </if>
<if test="query.deviseName!=null and query.deviseName!=''"> <if test="query.deviseName!=null and query.deviseName!=''">
AND devise_name=#{query.deviseName} AND devise_name=#{query.deviseName}