Merge branch 'refs/heads/feature/DM/nflg-bom-dq' into sit
This commit is contained in:
commit
71c8605df6
|
|
@ -22,7 +22,7 @@ public interface BomNewDQbomParentMapper extends BaseMapper<BomNewDQbomParentEnt
|
|||
|
||||
BomNewDQbomVO getRootBomByRowId(Long rootBomRowId);
|
||||
|
||||
List<BomNewDQbomVO> getChildren(Long bomRowId);
|
||||
// List<BomNewDQbomVO> getChildren(Long bomRowId);
|
||||
|
||||
List<BomNewDQbomVO> getBom(int status, String materialNo, String drawingNo, String materialName);
|
||||
|
||||
|
|
|
|||
|
|
@ -328,6 +328,9 @@ public class BomNewEbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
@ApiModelProperty(value = "待复核根节点")
|
||||
private Integer rootIsForWaitReview;
|
||||
|
||||
@ApiModelProperty(value = "导入SAP状态")
|
||||
private Integer sapState;
|
||||
|
||||
private List<BomNewEbomParentVO> childNodes = Collections.emptyList();
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -263,6 +263,9 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
@ApiModelProperty("层级数字")
|
||||
private BigDecimal levelNumber;
|
||||
|
||||
@ApiModelProperty(value = "导入SAP状态")
|
||||
private Integer sapState;
|
||||
|
||||
private String levelNo;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
|
@ -14,6 +15,7 @@ import com.nflg.product.bomnew.constant.BomConstant;
|
|||
import com.nflg.product.bomnew.constant.DQBomStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.EBomExceptionStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.UserJobEnum;
|
||||
import com.nflg.product.bomnew.mapper.master.MaterialMainMapper;
|
||||
import com.nflg.product.bomnew.pojo.dto.BaseImportExcelDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewDQbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewDQbomParentEntity;
|
||||
|
|
@ -240,18 +242,48 @@ public class DQBomImportService {
|
|||
);
|
||||
}
|
||||
|
||||
List<String> materialNos = datas.stream().map(DQbomExcelVO::getMaterialNo).distinct().collect(Collectors.toList());
|
||||
errorMsg.addAll(datas.stream()
|
||||
.filter(d -> StrUtil.isBlank(d.getMaterialNo()) && StrUtil.isBlank(d.getDrawingNo()))
|
||||
.map(d -> OperationErrorMsgVO.create("第" + d.getRowNum() + "行", "编号和图号都为空"))
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
//如果编号不为空,则图号使用主物料图号
|
||||
List<String> materialNos = datas.stream()
|
||||
.map(DQbomExcelVO::getMaterialNo)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<BaseMaterialVO> materialBaseInfos = materialMainService.getMaterialBaseInfo(materialNos);
|
||||
datas.forEach(d -> {
|
||||
for (DQbomExcelVO d : datas) {
|
||||
BaseMaterialVO vo = materialBaseInfos.stream()
|
||||
.filter(m -> m.getMaterialNo().equals(d.getMaterialNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (!Objects.isNull(vo)) {
|
||||
if (Objects.nonNull(vo)) {
|
||||
d.setDrawingNo(vo.getDrawingNo());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//如果编号为空,图号不为空,则编号使用主物料编号
|
||||
List<String> drawingNos = datas.stream()
|
||||
.filter(d -> StrUtil.isNotBlank(d.getDrawingNo()) && StrUtil.isBlank(d.getMaterialNo()))
|
||||
.map(DQbomExcelVO::getDrawingNo)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
materialBaseInfos = SpringUtil.getBean(MaterialMainMapper.class).getMaterialByDrawingNo(drawingNos);
|
||||
for (DQbomExcelVO d : datas) {
|
||||
if (StrUtil.isNotBlank(d.getDrawingNo()) && StrUtil.isBlank(d.getMaterialNo())) {
|
||||
BaseMaterialVO vo = materialBaseInfos.stream()
|
||||
.filter(m -> m.getDrawingNo().equals(d.getDrawingNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(vo)) {
|
||||
d.setMaterialNo(vo.getMaterialNo());
|
||||
} else {
|
||||
errorMsg.add(OperationErrorMsgVO.create("第" + d.getRowNum() + "行", "图号不存在"));
|
||||
}
|
||||
}
|
||||
}
|
||||
return errorMsg;
|
||||
}
|
||||
|
||||
|
|
@ -266,27 +298,7 @@ public class DQBomImportService {
|
|||
BomNewDQbomParentEntity parent = parents.stream().filter(p -> p.getMaterialNo().equals(data.getMaterialNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
//if (parent == null && (count - 1 != index || datas.get(index + 1).getLevel() > data.getLevel())) {
|
||||
if (parent == null && count - 1 > index && datas.get(index + 1).getLevel() > data.getLevel()) {
|
||||
// if (index == 0) {
|
||||
// BomNewDQbomParentEntity old = dQBomParentService.lambdaQuery()
|
||||
// .eq(data.getProjectType().equals("L"), BomNewDQbomParentEntity::getMaterialNo, data.getMaterialNo())
|
||||
// .eq(data.getProjectType().equals("T"), BomNewDQbomParentEntity::getMaterialName, data.getMaterialName())
|
||||
// .orderByDesc(BomNewDQbomParentEntity::getRowId)
|
||||
// .last(" limit 1")
|
||||
// .one();
|
||||
// if (!Objects.isNull(old)) {
|
||||
// VUtils.isTure(Objects.equals(data.getMaterialUnit(), old.getMaterialUnit())
|
||||
// || Objects.equals(data.getNum(), old.getNum())
|
||||
// || Objects.equals(data.getMaterialTexture(), old.getMaterialTexture()))
|
||||
// .throwMessage("导入的数据已存在,请勿重复导入");
|
||||
// if (Objects.equals(old.getStatus(), DQBomStatusEnum.WAIT_CONVERT.getValue())) {
|
||||
// VUtils.isTure(!Objects.equals(old.getCreatedBy(), SessionUtil.getUserCode()))
|
||||
// .throwMessage(StrUtil.format("此物料已由{}导入过,不能再次导入", old.getCreatedName()));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
parent = new BomNewDQbomParentEntity();
|
||||
parent.setRowId(IdWorker.getId());
|
||||
parent.setLevel(data.getLevel());
|
||||
|
|
|
|||
|
|
@ -375,7 +375,8 @@ public class DQBomService {
|
|||
|
||||
private void getChildren(List<BomNewDQbomVO> datas, BomNewDQbomVO parent) {
|
||||
if (Objects.isNull(parent) || parent.getBomRowId() == 0) return;
|
||||
List<BomNewDQbomVO> cc = dQBomParentService.getBaseMapper().getChildren(parent.getBomRowId());
|
||||
//List<BomNewDQbomVO> cc = dQBomParentService.getBaseMapper().getChildren(parent.getBomRowId());
|
||||
List<BomNewDQbomVO> cc = getChild(parent.getBomRowId());
|
||||
if (CollUtil.isNotEmpty(cc)) {
|
||||
cc.forEach(c -> {
|
||||
c.setParentMaterialNo(parent.getMaterialNo());
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@ import cn.hutool.core.util.StrUtil;
|
|||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.bomnew.constant.*;
|
||||
import com.nflg.product.bomnew.constant.EBomSourceEnum;
|
||||
import com.nflg.product.bomnew.constant.EBomStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.ProjectTypeInputTypeEnum;
|
||||
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||
import com.nflg.product.bomnew.pojo.dto.AddVirtrualMaterialDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
|
|
@ -177,7 +180,7 @@ public abstract class VirtualPackageBase {
|
|||
childEntity.setIdentityNo(parent.getRowId().toString());
|
||||
childEntity.setOrderNumber(orderNo);
|
||||
childEntity.setNum(new BigDecimal(1));
|
||||
childEntity.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||
childEntity.setEditStatus(parent.getEditStatus());
|
||||
childEntity.setSource(EBomSourceEnum.FROM_MDM.getValue());
|
||||
childEntity.setVirtualPartType(virtualPackageTypeEnum.getValue());
|
||||
childEntity.setProjectType("L");
|
||||
|
|
|
|||
Loading…
Reference in New Issue