feat(ebom): 修复31码生成虚拟包的问题
This commit is contained in:
parent
17ac4f6591
commit
b4693fa64a
|
|
@ -1,6 +1,5 @@
|
||||||
package com.nflg.product.bomnew.pojo.entity;
|
package com.nflg.product.bomnew.pojo.entity;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
|
@ -225,7 +224,9 @@ public class BomNewEbomChildEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "原始单位-来自cad")
|
@ApiModelProperty(value = "原始单位-来自cad")
|
||||||
private String materialOriginalUnit;
|
private String materialOriginalUnit;
|
||||||
|
|
||||||
|
@TableField(value = "initial_parent_row_id")
|
||||||
|
@ApiModelProperty(value = "刚转过来或刚导入时的父行ID")
|
||||||
|
private Long initialParentRowId;
|
||||||
// private String materialNoAndProjectType;
|
// private String materialNoAndProjectType;
|
||||||
|
|
||||||
// public String getMaterialNoAndProjectType() {
|
// public String getMaterialNoAndProjectType() {
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,11 @@ import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
import com.nflg.product.bomnew.client.MaterialMainClient;
|
import com.nflg.product.bomnew.client.MaterialMainClient;
|
||||||
import com.nflg.product.bomnew.constant.EBomSourceEnum;
|
import com.nflg.product.bomnew.constant.*;
|
||||||
import com.nflg.product.bomnew.constant.OriginalConstant;
|
|
||||||
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.dto.AddVirtrualMaterialDTO;
|
||||||
import com.nflg.product.bomnew.pojo.dto.MaterialUpdateBillDTO;
|
import com.nflg.product.bomnew.pojo.dto.MaterialUpdateBillDTO;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||||
|
|
@ -20,6 +18,8 @@ import com.nflg.product.bomnew.pojo.vo.ChildListForGenerateVirtualPackageVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.MaterialMainVO;
|
import com.nflg.product.bomnew.pojo.vo.MaterialMainVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
|
import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
|
||||||
import com.nflg.product.bomnew.util.VUtils;
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
|
import com.nflg.product.bomnew.util.VersionUtil;
|
||||||
|
import nflg.product.common.dto.LoginUserInfoDTO;
|
||||||
import nflg.product.common.vo.ResultVO;
|
import nflg.product.common.vo.ResultVO;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
@ -27,11 +27,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 曹鹏飞
|
* @author 曹鹏飞
|
||||||
|
|
@ -43,15 +40,20 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
|
|
||||||
private final BomNewEbomParentService ebomParentService = SpringUtil.getBean(BomNewEbomParentService.class);
|
private final BomNewEbomParentService ebomParentService = SpringUtil.getBean(BomNewEbomParentService.class);
|
||||||
private final BomNewEbomChildService ebomChildService = SpringUtil.getBean(BomNewEbomChildService.class);
|
private final BomNewEbomChildService ebomChildService = SpringUtil.getBean(BomNewEbomChildService.class);
|
||||||
|
|
||||||
private final MaterialMainClient materialMainClient = SpringUtil.getBean(MaterialMainClient.class);
|
private final MaterialMainClient materialMainClient = SpringUtil.getBean(MaterialMainClient.class);
|
||||||
private final MaterialService materialService = SpringUtil.getBean(MaterialService.class);
|
private final MaterialService materialService = SpringUtil.getBean(MaterialService.class);
|
||||||
|
|
||||||
private final List<BomNewEbomChildEntity> children = new ArrayList<>();
|
private final List<BomNewEbomChildEntity> childrenForAdd = Collections.synchronizedList(new ArrayList<>());
|
||||||
private final List<BomNewEbomParentEntity> parents = new ArrayList<>();
|
private final List<BomNewEbomChildEntity> childrenForUpdate = Collections.synchronizedList(new ArrayList<>());
|
||||||
|
private final List<BomNewEbomParentEntity> parentsForAdd = Collections.synchronizedList(new ArrayList<>());
|
||||||
|
private final List<BomNewEbomParentEntity> parentsForUpdate = Collections.synchronizedList(new ArrayList<>());
|
||||||
private final List<Long> childRowIdsForDel = new ArrayList<>();
|
private final List<Long> childRowIdsForDel = new ArrayList<>();
|
||||||
|
private final List<OperationErrorMsgVO> errorMsgList = Collections.synchronizedList(new ArrayList<>());
|
||||||
|
private final Map<String, String> materialUpdateBill = new HashMap<>();
|
||||||
|
|
||||||
private final List<OperationErrorMsgVO> errorMsgList = new ArrayList<>();
|
private final static List<Long> DOING_ROWID = Collections.synchronizedList(new ArrayList<>());
|
||||||
|
|
||||||
|
private final LoginUserInfoDTO userInfo = SessionUtil.getUser();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OperationErrorMsgVO> generate(GenerateVirtualPackageQuery query) {
|
public List<OperationErrorMsgVO> generate(GenerateVirtualPackageQuery query) {
|
||||||
|
|
@ -61,42 +63,58 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
VUtils.isTure(root.getMaterialNo().startsWith("21")).throwMessage("21编码接口调用错误");
|
VUtils.isTure(root.getMaterialNo().startsWith("21")).throwMessage("21编码接口调用错误");
|
||||||
VUtils.isTure(!root.getMaterialNo().startsWith("31")).throwMessage("该编码的物料不能生成发货包:" + root.getMaterialNo());
|
VUtils.isTure(!root.getMaterialNo().startsWith("31")).throwMessage("该编码的物料不能生成发货包:" + root.getMaterialNo());
|
||||||
|
|
||||||
List<ChildListForGenerateVirtualPackageVO> olds = ebomParentService.getChildListForGenerateVirtualPackage(root);
|
VUtils.isTure(DOING_ROWID.contains(query.getParentRowId())).throwMessage(root.getMaterialNo() + "正在生成虚拟包,请勿重复操作");
|
||||||
query.getChildren().forEach(it -> {
|
try {
|
||||||
ChildListForGenerateVirtualPackageVO old = olds.stream().filter(f -> Objects.equals(f.getRowId(), it.getRowId())).findFirst().orElse(null);
|
DOING_ROWID.add(query.getParentRowId());
|
||||||
VUtils.isTure(Objects.isNull(old)).throwMessage(it.getRowId() + "无效");
|
List<ChildListForGenerateVirtualPackageVO> olds = ebomParentService.getChildListForGenerateVirtualPackage(root);
|
||||||
BomNewEbomChildEntity child = ebomChildService.getById(it.getRowId());
|
List<CompletableFuture<Void>> futures = new ArrayList<>();
|
||||||
if (it.isGenerate1010() && it.isGenerate1020()) {
|
query.getChildren().forEach(it -> {
|
||||||
selectedAll(root, child, old);
|
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
|
||||||
} else if (!it.isGenerate1010() && !it.isGenerate1020()) {
|
ChildListForGenerateVirtualPackageVO old = olds.stream().filter(f -> Objects.equals(f.getRowId(), it.getRowId())).findFirst().orElse(null);
|
||||||
cancelAll(root, child, old);
|
VUtils.isTure(Objects.isNull(old)).throwMessage(it.getRowId() + "无效");
|
||||||
} else if (it.isGenerate1010()) {
|
BomNewEbomChildEntity child = ebomChildService.getById(it.getRowId());
|
||||||
selected1010Cancel1020(root, child, old);
|
if (it.isGenerate1010() && it.isGenerate1020()) {
|
||||||
} else {
|
selectedAll(root, child, old);
|
||||||
selected1020Cancel1010(root, child, old);
|
} else if (!it.isGenerate1010() && !it.isGenerate1020()) {
|
||||||
|
cancelAll(root, child, old);
|
||||||
|
} else if (it.isGenerate1010()) {
|
||||||
|
selected1010Cancel1020(root, child, old);
|
||||||
|
} else {
|
||||||
|
selected1020Cancel1010(root, child, old);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
futures.add(future);
|
||||||
|
});
|
||||||
|
CompletableFuture<Void> combinedFuture = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
|
||||||
|
combinedFuture.join();
|
||||||
|
|
||||||
|
// List<AddVirtrualMaterialDTO> addM = children.stream().filter(c -> StrUtil.isBlank(c.getMaterialNo())).map(c -> {
|
||||||
|
// AddVirtrualMaterialDTO ent = new AddVirtrualMaterialDTO();
|
||||||
|
// ent.setKey(c.getRowId().toString());
|
||||||
|
// ent.setDrawingNo(c.getDrawingNo());
|
||||||
|
// ent.setMaterialName(c.getMaterialName());
|
||||||
|
// ent.setMaterialDesc(c.getMaterialDesc());
|
||||||
|
// ent.setMaterialCategoryCode(c.getMaterialCategoryCode());
|
||||||
|
// return ent;
|
||||||
|
// }).collect(Collectors.toList());
|
||||||
|
// Map<String, AddVirtrualMaterialDTO> vMNosResult = materialService.batchAddMaterial(addM);
|
||||||
|
// vMNosResult.forEach((k, v) -> {
|
||||||
|
// children.stream().filter(c -> Objects.equals(c.getRowId(), Convert.toLong(k))).forEach(c -> {
|
||||||
|
// c.setMaterialNo(v.getMaterialNo());
|
||||||
|
// });
|
||||||
|
// parents.stream().filter(c -> Objects.equals(c.getRowId(), Convert.toLong(k))).forEach(c -> {
|
||||||
|
// c.setMaterialNo(v.getMaterialNo());
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
|
save();
|
||||||
|
|
||||||
|
if (!materialUpdateBill.isEmpty()) {
|
||||||
|
materialUpdateBill.forEach(this::addMaterialUpdateBillEntity);
|
||||||
}
|
}
|
||||||
});
|
} finally {
|
||||||
|
DOING_ROWID.remove(query.getParentRowId());
|
||||||
List<AddVirtrualMaterialDTO> addM = children.stream().filter(c -> StrUtil.isBlank(c.getMaterialNo())).map(c -> {
|
}
|
||||||
AddVirtrualMaterialDTO ent = new AddVirtrualMaterialDTO();
|
|
||||||
ent.setKey(c.getRowId().toString());
|
|
||||||
ent.setDrawingNo(c.getDrawingNo());
|
|
||||||
ent.setMaterialName(c.getMaterialName());
|
|
||||||
ent.setMaterialDesc(c.getMaterialDesc());
|
|
||||||
ent.setMaterialCategoryCode(c.getMaterialCategoryCode());
|
|
||||||
return ent;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
Map<String, AddVirtrualMaterialDTO> vMNosResult = materialService.batchAddMaterial(addM);
|
|
||||||
vMNosResult.forEach((k, v) -> {
|
|
||||||
children.stream().filter(c -> Objects.equals(c.getRowId(), Convert.toLong(k))).forEach(c -> {
|
|
||||||
c.setMaterialNo(v.getMaterialNo());
|
|
||||||
});
|
|
||||||
parents.stream().filter(c -> Objects.equals(c.getRowId(), Convert.toLong(k))).forEach(c -> {
|
|
||||||
c.setMaterialNo(v.getMaterialNo());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
save();
|
|
||||||
|
|
||||||
return errorMsgList;
|
return errorMsgList;
|
||||||
}
|
}
|
||||||
|
|
@ -106,11 +124,25 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
if (CollUtil.isNotEmpty(childRowIdsForDel)) {
|
if (CollUtil.isNotEmpty(childRowIdsForDel)) {
|
||||||
ebomChildService.getBaseMapper().deleteBatchIds(childRowIdsForDel);
|
ebomChildService.getBaseMapper().deleteBatchIds(childRowIdsForDel);
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(children)) {
|
if (CollUtil.isNotEmpty(childrenForAdd)) {
|
||||||
ebomChildService.saveOrUpdateBatch(children);
|
LOGGER.debug("ebomChildService.saveBatch");
|
||||||
|
LOGGER.debug(JSON.toJSONString(childrenForAdd));
|
||||||
|
ebomChildService.saveBatch(childrenForAdd);
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(parents)) {
|
if (CollUtil.isNotEmpty(childrenForUpdate)) {
|
||||||
ebomParentService.saveOrUpdateBatch(parents);
|
LOGGER.debug("ebomChildService.updateBatchById");
|
||||||
|
LOGGER.debug(JSON.toJSONString(childrenForUpdate));
|
||||||
|
ebomChildService.updateBatchById(childrenForUpdate);
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(parentsForAdd)) {
|
||||||
|
LOGGER.debug("ebomParentService.saveBatch");
|
||||||
|
LOGGER.debug(JSON.toJSONString(parentsForAdd));
|
||||||
|
ebomParentService.saveBatch(parentsForAdd);
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(parentsForUpdate)) {
|
||||||
|
LOGGER.debug("ebomParentService.updateBatchById");
|
||||||
|
LOGGER.debug(JSON.toJSONString(parentsForUpdate));
|
||||||
|
ebomParentService.updateBatchById(parentsForUpdate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,6 +152,7 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
String dnMaking = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.MAKING_PACKAGE, true);
|
String dnMaking = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.MAKING_PACKAGE, true);
|
||||||
BomNewEbomParentEntity p = ebomParentService.lambdaQuery()
|
BomNewEbomParentEntity p = ebomParentService.lambdaQuery()
|
||||||
.eq(BomNewEbomParentEntity::getDrawingNo, dnMaking)
|
.eq(BomNewEbomParentEntity::getDrawingNo, dnMaking)
|
||||||
|
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||||
.one();
|
.one();
|
||||||
if (Objects.isNull(p)) {
|
if (Objects.isNull(p)) {
|
||||||
BomNewEbomChildEntity c = ebomChildService.lambdaQuery()
|
BomNewEbomChildEntity c = ebomChildService.lambdaQuery()
|
||||||
|
|
@ -131,7 +164,7 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
}
|
}
|
||||||
child.setParentRowId(p.getRowId());
|
child.setParentRowId(p.getRowId());
|
||||||
child.setModifyTime(LocalDateTime.now());
|
child.setModifyTime(LocalDateTime.now());
|
||||||
children.add(child);
|
childrenForUpdate.add(child);
|
||||||
} else if (!old.isHasGenerated1010() && !old.isHasGenerated1020()) {
|
} else if (!old.isHasGenerated1010() && !old.isHasGenerated1020()) {
|
||||||
build1020VirtualPackage(root, true, child);
|
build1020VirtualPackage(root, true, child);
|
||||||
} else if (old.isHasGenerated1010()) {
|
} else if (old.isHasGenerated1010()) {
|
||||||
|
|
@ -140,12 +173,14 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
String newDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.DELIVERY_PACKAGE, true);
|
String newDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.DELIVERY_PACKAGE, true);
|
||||||
BomNewEbomParentEntity fp = ebomParentService.lambdaQuery()
|
BomNewEbomParentEntity fp = ebomParentService.lambdaQuery()
|
||||||
.eq(BomNewEbomParentEntity::getDrawingNo, newDrawingNo)
|
.eq(BomNewEbomParentEntity::getDrawingNo, newDrawingNo)
|
||||||
|
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||||
.one();
|
.one();
|
||||||
if (Objects.nonNull(fp)) {
|
if (Objects.nonNull(fp)) {
|
||||||
buildVirtualPackage(true, root.getRowId(), root, child, VirtualPackageTypeEnum.DELIVERY_PACKAGE, child.getOrderNumber());
|
buildVirtualPackage(true, root.getRowId(), root, child, VirtualPackageTypeEnum.DELIVERY_PACKAGE, child.getOrderNumber());
|
||||||
String dnMaking = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.MAKING_PACKAGE, true);
|
String dnMaking = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.MAKING_PACKAGE, true);
|
||||||
BomNewEbomParentEntity zp = ebomParentService.lambdaQuery()
|
BomNewEbomParentEntity zp = ebomParentService.lambdaQuery()
|
||||||
.eq(BomNewEbomParentEntity::getDrawingNo, dnMaking)
|
.eq(BomNewEbomParentEntity::getDrawingNo, dnMaking)
|
||||||
|
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||||
.one();
|
.one();
|
||||||
if (Objects.isNull(zp)) {
|
if (Objects.isNull(zp)) {
|
||||||
BomNewEbomChildEntity c = ebomChildService.lambdaQuery()
|
BomNewEbomChildEntity c = ebomChildService.lambdaQuery()
|
||||||
|
|
@ -158,7 +193,7 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
//挂载物料
|
//挂载物料
|
||||||
child.setParentRowId(zp.getRowId());
|
child.setParentRowId(zp.getRowId());
|
||||||
child.setModifyTime(LocalDateTime.now());
|
child.setModifyTime(LocalDateTime.now());
|
||||||
children.add(child);
|
childrenForUpdate.add(child);
|
||||||
} else {
|
} else {
|
||||||
fp = updateParentVirtualPackage(oldDrawingNo, newDrawingNo);
|
fp = updateParentVirtualPackage(oldDrawingNo, newDrawingNo);
|
||||||
updateChildVirtualPackage(root.getRowId(), oldDrawingNo, newDrawingNo);
|
updateChildVirtualPackage(root.getRowId(), oldDrawingNo, newDrawingNo);
|
||||||
|
|
@ -174,7 +209,7 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
//挂载物料
|
//挂载物料
|
||||||
child.setParentRowId(zp.getRowId());
|
child.setParentRowId(zp.getRowId());
|
||||||
child.setModifyTime(LocalDateTime.now());
|
child.setModifyTime(LocalDateTime.now());
|
||||||
children.add(child);
|
childrenForUpdate.add(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -182,15 +217,17 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
private BomNewEbomParentEntity updateParentVirtualPackage(String oldDrawingNo, String newDrawingNo) {
|
private BomNewEbomParentEntity updateParentVirtualPackage(String oldDrawingNo, String newDrawingNo) {
|
||||||
BomNewEbomParentEntity p = ebomParentService.lambdaQuery()
|
BomNewEbomParentEntity p = ebomParentService.lambdaQuery()
|
||||||
.eq(BomNewEbomParentEntity::getDrawingNo, newDrawingNo)
|
.eq(BomNewEbomParentEntity::getDrawingNo, newDrawingNo)
|
||||||
|
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||||
.one();
|
.one();
|
||||||
if (Objects.isNull(p)) {
|
if (Objects.isNull(p)) {
|
||||||
p = ebomParentService.lambdaQuery()
|
p = ebomParentService.lambdaQuery()
|
||||||
.eq(BomNewEbomParentEntity::getDrawingNo, oldDrawingNo)
|
.eq(BomNewEbomParentEntity::getDrawingNo, oldDrawingNo)
|
||||||
|
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||||
.one();
|
.one();
|
||||||
p.setDrawingNo(newDrawingNo);
|
p.setDrawingNo(newDrawingNo);
|
||||||
p.setMaterialDesc(newDrawingNo);
|
p.setMaterialDesc(newDrawingNo);
|
||||||
p.setMaterialName(newDrawingNo);
|
p.setMaterialName(newDrawingNo);
|
||||||
parents.add(p);
|
parentsForUpdate.add(p);
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
@ -200,32 +237,38 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
.eq(BomNewEbomChildEntity::getParentRowId, parentRowId)
|
.eq(BomNewEbomChildEntity::getParentRowId, parentRowId)
|
||||||
.eq(BomNewEbomChildEntity::getDrawingNo, oldDrawingNo)
|
.eq(BomNewEbomChildEntity::getDrawingNo, oldDrawingNo)
|
||||||
.one();
|
.one();
|
||||||
addMaterialUpdateBillEntity(c.getMaterialNo(), newDrawingNo);
|
//addMaterialUpdateBillEntity(c.getMaterialNo(), newDrawingNo);
|
||||||
c.setDrawingNo(newDrawingNo);
|
c.setDrawingNo(newDrawingNo);
|
||||||
c.setMaterialDesc(newDrawingNo);
|
c.setMaterialDesc(newDrawingNo);
|
||||||
c.setMaterialName(newDrawingNo);
|
c.setMaterialName(newDrawingNo);
|
||||||
children.add(c);
|
childrenForUpdate.add(c);
|
||||||
|
materialUpdateBill.putIfAbsent(c.getMaterialNo(), newDrawingNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMaterialUpdateBillEntity(String materialNo, String newDrawingNo) {
|
private void addMaterialUpdateBillEntity(String materialNo, String newDrawingNo) {
|
||||||
ResultVO<MaterialMainVO> result = materialMainClient.selectByMaterialNo(materialNo);
|
try {
|
||||||
if (result.getState() != 200) {
|
ResultVO<MaterialMainVO> result = materialMainClient.selectByMaterialNo(materialNo);
|
||||||
errorMsgList.add(OperationErrorMsgVO.create(materialNo, result.getMsg()));
|
if (result.getState() != 200) {
|
||||||
return;
|
errorMsgList.add(OperationErrorMsgVO.create(materialNo, result.getMsg()));
|
||||||
}
|
return;
|
||||||
MaterialMainVO vo = result.getData();
|
}
|
||||||
MaterialUpdateBillDTO dto = Convert.convert(MaterialUpdateBillDTO.class, vo);
|
MaterialMainVO vo = result.getData();
|
||||||
dto.setOpEnum(1);
|
MaterialUpdateBillDTO dto = Convert.convert(MaterialUpdateBillDTO.class, vo);
|
||||||
dto.setDrawingNo(newDrawingNo);
|
dto.setOpEnum(1);
|
||||||
dto.setMaterialDesc(newDrawingNo);
|
dto.setDrawingNo(newDrawingNo);
|
||||||
dto.setMaterialName(newDrawingNo);
|
dto.setMaterialDesc(newDrawingNo);
|
||||||
dto.setOldMaterialDesc(vo.getMaterialDesc());
|
dto.setMaterialName(newDrawingNo);
|
||||||
dto.setOldMaterialState(vo.getMaterialState());
|
dto.setOldMaterialDesc(vo.getMaterialDesc());
|
||||||
dto.setOldCategoryCode(vo.getMaterialCategoryCode());
|
dto.setOldMaterialState(vo.getMaterialState());
|
||||||
dto.setUpdateResion("发货包工厂切换");
|
dto.setOldCategoryCode(vo.getMaterialCategoryCode());
|
||||||
ResultVO<Boolean> result1 = materialMainClient.addMaterialUpdateBillEntity(dto);
|
dto.setUpdateResion("发货包工厂切换");
|
||||||
if (result1.getState() != 200) {
|
ResultVO<Boolean> result1 = materialMainClient.addMaterialUpdateBillEntity(dto);
|
||||||
errorMsgList.add(OperationErrorMsgVO.create(materialNo, result1.getMsg()));
|
if (result1.getState() != 200) {
|
||||||
|
errorMsgList.add(OperationErrorMsgVO.create(materialNo, result1.getMsg()));
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
LOGGER.error(StrUtil.format("物料变更失败,materialNo:{},drawingNo:", materialNo, newDrawingNo), ex);
|
||||||
|
errorMsgList.add(OperationErrorMsgVO.create(materialNo, "物料变更失败:" + ex.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -241,12 +284,14 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
String newDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.DELIVERY_PACKAGE, false);
|
String newDrawingNo = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.DELIVERY_PACKAGE, false);
|
||||||
BomNewEbomParentEntity fp = ebomParentService.lambdaQuery()
|
BomNewEbomParentEntity fp = ebomParentService.lambdaQuery()
|
||||||
.eq(BomNewEbomParentEntity::getDrawingNo, newDrawingNo)
|
.eq(BomNewEbomParentEntity::getDrawingNo, newDrawingNo)
|
||||||
|
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||||
.one();
|
.one();
|
||||||
if (Objects.nonNull(fp)) {
|
if (Objects.nonNull(fp)) {
|
||||||
buildVirtualPackage(true, root.getRowId(), root, child, VirtualPackageTypeEnum.DELIVERY_PACKAGE, child.getOrderNumber());
|
buildVirtualPackage(true, root.getRowId(), root, child, VirtualPackageTypeEnum.DELIVERY_PACKAGE, child.getOrderNumber());
|
||||||
String dnMaking = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.MAKING_PACKAGE, true);
|
String dnMaking = buildDrawingNo(root.getDrawingNo(), child.getMaterialName(), VirtualPackageTypeEnum.MAKING_PACKAGE, false);
|
||||||
BomNewEbomParentEntity zp = ebomParentService.lambdaQuery()
|
BomNewEbomParentEntity zp = ebomParentService.lambdaQuery()
|
||||||
.eq(BomNewEbomParentEntity::getDrawingNo, dnMaking)
|
.eq(BomNewEbomParentEntity::getDrawingNo, dnMaking)
|
||||||
|
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||||
.one();
|
.one();
|
||||||
if (Objects.isNull(zp)) {
|
if (Objects.isNull(zp)) {
|
||||||
BomNewEbomChildEntity c = ebomChildService.lambdaQuery()
|
BomNewEbomChildEntity c = ebomChildService.lambdaQuery()
|
||||||
|
|
@ -259,7 +304,7 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
//挂载物料
|
//挂载物料
|
||||||
child.setParentRowId(zp.getRowId());
|
child.setParentRowId(zp.getRowId());
|
||||||
child.setModifyTime(LocalDateTime.now());
|
child.setModifyTime(LocalDateTime.now());
|
||||||
children.add(child);
|
childrenForUpdate.add(child);
|
||||||
} else {
|
} else {
|
||||||
fp = updateParentVirtualPackage(oldDrawingNo, newDrawingNo);
|
fp = updateParentVirtualPackage(oldDrawingNo, newDrawingNo);
|
||||||
updateChildVirtualPackage(root.getRowId(), oldDrawingNo, newDrawingNo);
|
updateChildVirtualPackage(root.getRowId(), oldDrawingNo, newDrawingNo);
|
||||||
|
|
@ -275,7 +320,7 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
//挂载物料
|
//挂载物料
|
||||||
child.setParentRowId(zp.getRowId());
|
child.setParentRowId(zp.getRowId());
|
||||||
child.setModifyTime(LocalDateTime.now());
|
child.setModifyTime(LocalDateTime.now());
|
||||||
children.add(child);
|
childrenForUpdate.add(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -289,7 +334,7 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
BomNewEbomParentEntity qp2 = buildVirtualPackage(qp1, qc2);
|
BomNewEbomParentEntity qp2 = buildVirtualPackage(qp1, qc2);
|
||||||
child.setParentRowId(qp2.getRowId());
|
child.setParentRowId(qp2.getRowId());
|
||||||
child.setModifyTime(LocalDateTime.now());
|
child.setModifyTime(LocalDateTime.now());
|
||||||
children.add(child);
|
childrenForUpdate.add(child);
|
||||||
//直发包
|
//直发包
|
||||||
buildVirtualPackage(false, qp1.getRowId(), root, child, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE, "002");
|
buildVirtualPackage(false, qp1.getRowId(), root, child, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE, "002");
|
||||||
}
|
}
|
||||||
|
|
@ -304,7 +349,7 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
BomNewEbomParentEntity xp2 = buildVirtualPackage(xp1, xc2);
|
BomNewEbomParentEntity xp2 = buildVirtualPackage(xp1, xc2);
|
||||||
child.setParentRowId(xp2.getRowId());
|
child.setParentRowId(xp2.getRowId());
|
||||||
child.setModifyTime(LocalDateTime.now());
|
child.setModifyTime(LocalDateTime.now());
|
||||||
children.add(child);
|
childrenForUpdate.add(child);
|
||||||
}
|
}
|
||||||
//直发包
|
//直发包
|
||||||
buildVirtualPackage(true, xp1.getRowId(), root, child, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE, "002");
|
buildVirtualPackage(true, xp1.getRowId(), root, child, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE, "002");
|
||||||
|
|
@ -325,7 +370,7 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
private void cancelAll(BomNewEbomParentEntity root, BomNewEbomChildEntity child, ChildListForGenerateVirtualPackageVO old) {
|
private void cancelAll(BomNewEbomParentEntity root, BomNewEbomChildEntity child, ChildListForGenerateVirtualPackageVO old) {
|
||||||
child.setParentRowId(root.getRowId());
|
child.setParentRowId(root.getRowId());
|
||||||
child.setModifyTime(LocalDateTime.now());
|
child.setModifyTime(LocalDateTime.now());
|
||||||
children.add(child);
|
childrenForUpdate.add(child);
|
||||||
if (old.isHasGenerated1010()) {
|
if (old.isHasGenerated1010()) {
|
||||||
buildDelVirtualPackage(root, child, false);
|
buildDelVirtualPackage(root, child, false);
|
||||||
}
|
}
|
||||||
|
|
@ -362,30 +407,46 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
private BomNewEbomParentEntity buildVirtualPackage(BomNewEbomParentEntity parent, BomNewEbomChildEntity child) {
|
private BomNewEbomParentEntity buildVirtualPackage(BomNewEbomParentEntity parent, BomNewEbomChildEntity child) {
|
||||||
BomNewEbomParentEntity p = ebomParentService.lambdaQuery()
|
BomNewEbomParentEntity p = ebomParentService.lambdaQuery()
|
||||||
.eq(BomNewEbomParentEntity::getDrawingNo, child.getDrawingNo())
|
.eq(BomNewEbomParentEntity::getDrawingNo, child.getDrawingNo())
|
||||||
|
.orderByDesc(BomNewEbomParentEntity::getRowId)
|
||||||
|
.last(" limit 1")
|
||||||
.one();
|
.one();
|
||||||
if (Objects.isNull(p)) {
|
if (Objects.nonNull(p)) {
|
||||||
p = Convert.convert(BomNewEbomParentEntity.class, child);
|
if (Objects.equals(p.getStatus(), EBomStatusEnum.PUBLISHED.getValue())) {
|
||||||
p.setCreatedBy(SessionUtil.getUserCode());
|
p.setLastVersionIs(0);
|
||||||
p.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
|
parentsForUpdate.add(p);
|
||||||
p.setVirtualPackageIs(1);
|
BomNewEbomParentEntity p1 = buildParent(parent, child);
|
||||||
p.setRootIs(0);
|
p1.setCurrentVersion(VersionUtil.getNextVersion(p.getCurrentVersion()));
|
||||||
p.setUserRootIs(0);
|
parentsForAdd.add(p1);
|
||||||
p.setDeviseName(SessionUtil.getRealName());
|
return p1;
|
||||||
p.setDeviseUserCode(SessionUtil.getUserCode());
|
}
|
||||||
p.setDeptName(SessionUtil.getDepartName());
|
} else {
|
||||||
p.setRootIsForWaitReview(0);
|
p = buildParent(parent, child);
|
||||||
p.setAuditTime(parent.getAuditTime());
|
parentsForAdd.add(p);
|
||||||
p.setAuditUserName(parent.getAuditUserName());
|
|
||||||
p.setStatus(parent.getStatus());
|
|
||||||
p.setLastVersionIs(1);
|
|
||||||
p.setBatchNo("");
|
|
||||||
p.setLevelNum(parent.getLevelNum() + 1);
|
|
||||||
p.setBomExist(1);
|
|
||||||
parents.add(p);
|
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BomNewEbomParentEntity buildParent(BomNewEbomParentEntity parent, BomNewEbomChildEntity child) {
|
||||||
|
BomNewEbomParentEntity p = Convert.convert(BomNewEbomParentEntity.class, child);
|
||||||
|
p.setCreatedBy(userInfo.getUserCode());
|
||||||
|
p.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
|
||||||
|
p.setVirtualPackageIs(1);
|
||||||
|
p.setRootIs(0);
|
||||||
|
p.setUserRootIs(0);
|
||||||
|
p.setDeviseName(userInfo.getRealName());
|
||||||
|
p.setDeviseUserCode(userInfo.getUserCode());
|
||||||
|
p.setDeptName(userInfo.getDepartName());
|
||||||
|
p.setRootIsForWaitReview(0);
|
||||||
|
p.setAuditTime(parent.getAuditTime());
|
||||||
|
p.setAuditUserName(parent.getAuditUserName());
|
||||||
|
p.setStatus(parent.getStatus());
|
||||||
|
p.setLastVersionIs(1);
|
||||||
|
p.setBatchNo("");
|
||||||
|
p.setLevelNum(parent.getLevelNum() + 1);
|
||||||
|
p.setBomExist(1);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
private BomNewEbomChildEntity buildVirtualPackage(boolean is1020Factory, Long parentRowId, BomNewEbomParentEntity root
|
private BomNewEbomChildEntity buildVirtualPackage(boolean is1020Factory, Long parentRowId, BomNewEbomParentEntity root
|
||||||
, BomNewEbomChildEntity material, VirtualPackageTypeEnum type, String orderNo) {
|
, BomNewEbomChildEntity material, VirtualPackageTypeEnum type, String orderNo) {
|
||||||
String drawingNo = buildDrawingNo(root.getDrawingNo(), material.getMaterialName(), type, is1020Factory);
|
String drawingNo = buildDrawingNo(root.getDrawingNo(), material.getMaterialName(), type, is1020Factory);
|
||||||
|
|
@ -396,12 +457,6 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
if (Objects.isNull(child)) {
|
if (Objects.isNull(child)) {
|
||||||
child = new BomNewEbomChildEntity();
|
child = new BomNewEbomChildEntity();
|
||||||
child.setRowId(IdWorker.getId());
|
child.setRowId(IdWorker.getId());
|
||||||
BomNewEbomParentEntity p = ebomParentService.lambdaQuery()
|
|
||||||
.eq(BomNewEbomParentEntity::getDrawingNo, drawingNo)
|
|
||||||
.one();
|
|
||||||
if (Objects.nonNull(p)) {
|
|
||||||
child.setMaterialNo(p.getMaterialNo());
|
|
||||||
}
|
|
||||||
child.setParentRowId(parentRowId);
|
child.setParentRowId(parentRowId);
|
||||||
child.setIdentityNo(parentRowId + "_" + child.getRowId());
|
child.setIdentityNo(parentRowId + "_" + child.getRowId());
|
||||||
child.setOrderNumber(orderNo);
|
child.setOrderNumber(orderNo);
|
||||||
|
|
@ -413,13 +468,22 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
child.setProjectTypeInputType(ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue());
|
child.setProjectTypeInputType(ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue());
|
||||||
child.setMaterialUnit("PC");
|
child.setMaterialUnit("PC");
|
||||||
child.setMaterialOriginalUnit("PC");
|
child.setMaterialOriginalUnit("PC");
|
||||||
child.setCreatedBy(SessionUtil.getUserCode());
|
child.setCreatedBy(userInfo.getUserCode());
|
||||||
child.setDrawingNo(drawingNo);
|
child.setDrawingNo(drawingNo);
|
||||||
child.setMaterialDesc(child.getDrawingNo());
|
child.setMaterialDesc(child.getDrawingNo());
|
||||||
child.setMaterialName(child.getDrawingNo());
|
child.setMaterialName(child.getDrawingNo());
|
||||||
child.setMaterialCategoryCode(type.getMaterialCategoryCode());
|
child.setMaterialCategoryCode(type.getMaterialCategoryCode());
|
||||||
child.setVirtualPartRootMaterialNo(root.getMaterialNo());
|
child.setVirtualPartRootMaterialNo(root.getMaterialNo());
|
||||||
children.add(child);
|
BomNewEbomParentEntity p = ebomParentService.lambdaQuery()
|
||||||
|
.eq(BomNewEbomParentEntity::getDrawingNo, drawingNo)
|
||||||
|
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||||
|
.one();
|
||||||
|
if (Objects.nonNull(p)) {
|
||||||
|
child.setMaterialNo(p.getMaterialNo());
|
||||||
|
} else {
|
||||||
|
child.setMaterialNo(getMaterialNoForAdd(child));
|
||||||
|
}
|
||||||
|
childrenForAdd.add(child);
|
||||||
}
|
}
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
@ -427,4 +491,15 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
public static String buildDrawingNo(String drawingNo, String materialName, VirtualPackageTypeEnum type, boolean is1020Factory) {
|
public static String buildDrawingNo(String drawingNo, String materialName, VirtualPackageTypeEnum type, boolean is1020Factory) {
|
||||||
return StrUtil.format("({})({}{})({})", drawingNo, materialName, is1020Factory ? "仙桃" : "", type.getConMaterialName());
|
return StrUtil.format("({})({}{})({})", drawingNo, materialName, is1020Factory ? "仙桃" : "", type.getConMaterialName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getMaterialNoForAdd(BomNewEbomChildEntity c) {
|
||||||
|
AddVirtrualMaterialDTO ent = new AddVirtrualMaterialDTO();
|
||||||
|
ent.setKey(c.getRowId().toString());
|
||||||
|
ent.setDrawingNo(c.getDrawingNo());
|
||||||
|
ent.setMaterialName(c.getMaterialName());
|
||||||
|
ent.setMaterialDesc(c.getMaterialDesc());
|
||||||
|
ent.setMaterialCategoryCode(c.getMaterialCategoryCode());
|
||||||
|
Map<String, AddVirtrualMaterialDTO> vMNosResult = materialService.batchAddMaterial(Collections.singletonList(ent), userInfo);
|
||||||
|
return vMNosResult.get(c.getRowId().toString()).getMaterialNo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2383,12 +2383,24 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
|
|
||||||
public List<ChildListForGenerateVirtualPackageVO> getChildListForGenerateVirtualPackage(BomNewEbomParentEntity parent) {
|
public List<ChildListForGenerateVirtualPackageVO> getChildListForGenerateVirtualPackage(BomNewEbomParentEntity parent) {
|
||||||
List<BomNewEbomChildEntity> children = ebomChildService.lambdaQuery()
|
List<BomNewEbomChildEntity> children = ebomChildService.lambdaQuery()
|
||||||
.eq(BomNewEbomChildEntity::getVirtualPartRootMaterialNo, parent.getMaterialNo())
|
.eq(BomNewEbomChildEntity::getInitialParentRowId, parent.getRowId())
|
||||||
.eq(BomNewEbomChildEntity::getVirtualPartType, VirtualPackageTypeEnum.UN_VIRTUAL_PACKAGE.getValue())
|
.eq(BomNewEbomChildEntity::getVirtualPartType, VirtualPackageTypeEnum.UN_VIRTUAL_PACKAGE.getValue())
|
||||||
.ne(BomNewEbomChildEntity::getProjectType, BomConstant.PROJECT_TYPE_TEMPORARY)
|
.ne(BomNewEbomChildEntity::getProjectType, BomConstant.PROJECT_TYPE_TEMPORARY)
|
||||||
.orderByAsc(BomNewEbomChildEntity::getOrderNumber)
|
.orderByAsc(BomNewEbomChildEntity::getOrderNumber)
|
||||||
.list();
|
.list();
|
||||||
if (CollUtil.isNotEmpty(children)) {
|
if (CollUtil.isNotEmpty(children)) {
|
||||||
|
//是否有物料名称相同的物料
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
Map<String, List<BomNewEbomChildEntity>> gc = children.stream().collect(Collectors.groupingBy(BomNewEbomChildEntity::getMaterialName));
|
||||||
|
gc.forEach((k, v) -> {
|
||||||
|
if (v.size() > 1) {
|
||||||
|
sb.append(StrUtil.format("{}的物料名称相同。",
|
||||||
|
StrUtil.join(",", v.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()))));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
String err = sb.toString();
|
||||||
|
VUtils.isTure(StrUtil.isNotBlank(err)).throwMessage("请先处理下面的错误:" + err);
|
||||||
|
|
||||||
List<ChildListForGenerateVirtualPackageVO> cvos = new ArrayList<>();
|
List<ChildListForGenerateVirtualPackageVO> cvos = new ArrayList<>();
|
||||||
children.forEach(it -> {
|
children.forEach(it -> {
|
||||||
ChildListForGenerateVirtualPackageVO cvo = Convert.convert(ChildListForGenerateVirtualPackageVO.class, it);
|
ChildListForGenerateVirtualPackageVO cvo = Convert.convert(ChildListForGenerateVirtualPackageVO.class, it);
|
||||||
|
|
|
||||||
|
|
@ -359,9 +359,7 @@ public class EBomImportService {
|
||||||
child.setProjectType(data.getProjectType());
|
child.setProjectType(data.getProjectType());
|
||||||
child.setProjectTypeInputType(ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue());
|
child.setProjectTypeInputType(ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue());
|
||||||
child.setIdentityNo(child.getParentRowId() + "_" + child.getRowId());
|
child.setIdentityNo(child.getParentRowId() + "_" + child.getRowId());
|
||||||
if (p.getMaterialNo().startsWith("31")) {
|
child.setInitialParentRowId(p.getRowId());
|
||||||
child.setVirtualPartRootMaterialNo(p.getMaterialNo());
|
|
||||||
}
|
|
||||||
child.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
child.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||||
child.setExceptionStatus(EBomExceptionStatusEnum.INIT.getValue());
|
child.setExceptionStatus(EBomExceptionStatusEnum.INIT.getValue());
|
||||||
child.setCreatedBy(SessionUtil.getUserCode());
|
child.setCreatedBy(SessionUtil.getUserCode());
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||||
import com.nflg.product.bomnew.util.VUtils;
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import nflg.product.common.constant.STATE;
|
import nflg.product.common.constant.STATE;
|
||||||
|
import nflg.product.common.dto.LoginUserInfoDTO;
|
||||||
import nflg.product.common.vo.ResultVO;
|
import nflg.product.common.vo.ResultVO;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
|
@ -168,7 +169,7 @@ public class MaterialService {
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
//****************************************本地生成,不调主数据**************************************************
|
//****************************************本地生成,不调主数据**************************************************
|
||||||
public Map<String,AddVirtrualMaterialDTO> batchAddMaterial(List<AddVirtrualMaterialDTO> mds){
|
public Map<String, AddVirtrualMaterialDTO> batchAddMaterial(List<AddVirtrualMaterialDTO> mds, LoginUserInfoDTO userInfo) {
|
||||||
List<MaterialMainEntity> resultList=new ArrayList<>();
|
List<MaterialMainEntity> resultList=new ArrayList<>();
|
||||||
|
|
||||||
List<AddMaterialMainDTO> syncOaEnts=new ArrayList<>();
|
List<AddMaterialMainDTO> syncOaEnts=new ArrayList<>();
|
||||||
|
|
@ -182,14 +183,14 @@ public class MaterialService {
|
||||||
ma.setMaterialName(md.getMaterialName());
|
ma.setMaterialName(md.getMaterialName());
|
||||||
ma.setMaterialDesc(md.getMaterialDesc());
|
ma.setMaterialDesc(md.getMaterialDesc());
|
||||||
ma.setMaterialCategoryCode(md.getMaterialCategoryCode());
|
ma.setMaterialCategoryCode(md.getMaterialCategoryCode());
|
||||||
ma.setCreatedBy(SessionUtil.getUserCode());
|
ma.setCreatedBy(userInfo.getUserCode());
|
||||||
ma.setCreatedTime(LocalDateTime.now());
|
ma.setCreatedTime(LocalDateTime.now());
|
||||||
ma.setUpdatedBy(SessionUtil.getUserCode());
|
ma.setUpdatedBy(userInfo.getUserCode());
|
||||||
ma.setUpdatedTime(LocalDateTime.now());
|
ma.setUpdatedTime(LocalDateTime.now());
|
||||||
ma.setMaterialClass(0);
|
ma.setMaterialClass(0);
|
||||||
ma.setProcessState(0);
|
ma.setProcessState(0);
|
||||||
ma.setApplyUserCode(SessionUtil.getRealName());
|
ma.setApplyUserCode(userInfo.getRealName());
|
||||||
ma.setApplyDeptName(SessionUtil.getDepartName());
|
ma.setApplyDeptName(userInfo.getDepartName());
|
||||||
ma.setMaterialUnit("PC");
|
ma.setMaterialUnit("PC");
|
||||||
ma.setProcessState(10);
|
ma.setProcessState(10);
|
||||||
if(StrUtil.isNotBlank(md.getProjectType())){
|
if(StrUtil.isNotBlank(md.getProjectType())){
|
||||||
|
|
@ -213,6 +214,10 @@ public class MaterialService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, AddVirtrualMaterialDTO> batchAddMaterial(List<AddVirtrualMaterialDTO> mds) {
|
||||||
|
return batchAddMaterial(mds, SessionUtil.getUser());
|
||||||
|
}
|
||||||
|
|
||||||
private void checkMaterial(List<AddVirtrualMaterialDTO> mds){
|
private void checkMaterial(List<AddVirtrualMaterialDTO> mds){
|
||||||
List<AddVirtrualMaterialDTO> noCateGoryCodes = mds.stream().filter(u -> StrUtil.isBlank(u.getMaterialCategoryCode())).collect(Collectors.toList());
|
List<AddVirtrualMaterialDTO> noCateGoryCodes = mds.stream().filter(u -> StrUtil.isBlank(u.getMaterialCategoryCode())).collect(Collectors.toList());
|
||||||
VUtils.isTure(CollUtil.isNotEmpty(noCateGoryCodes)).throwMessage("最小物料类别不能为空");
|
VUtils.isTure(CollUtil.isNotEmpty(noCateGoryCodes)).throwMessage("最小物料类别不能为空");
|
||||||
|
|
@ -281,7 +286,7 @@ public class MaterialService {
|
||||||
* @param materialCategoryCode
|
* @param materialCategoryCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String generateMaterialNo(String materialCategoryCode ,String preCategory) {
|
public synchronized String generateMaterialNo(String materialCategoryCode, String preCategory) {
|
||||||
// String preCategory =materialMainService.getBaseMapper().getMaterialCategory(materialCategoryCode);
|
// String preCategory =materialMainService.getBaseMapper().getMaterialCategory(materialCategoryCode);
|
||||||
if (StrUtil.isBlank(preCategory)) {
|
if (StrUtil.isBlank(preCategory)) {
|
||||||
throw new NflgBusinessException(STATE.ParamErr, materialCategoryCode.concat("未设置对应分类"));
|
throw new NflgBusinessException(STATE.ParamErr, materialCategoryCode.concat("未设置对应分类"));
|
||||||
|
|
|
||||||
|
|
@ -228,9 +228,7 @@ public class EBomEdit {
|
||||||
child.setNum(BigDecimal.ONE);
|
child.setNum(BigDecimal.ONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (parentEntity.getMaterialNo().startsWith("31")) {
|
child.setInitialParentRowId(parentEntity.getRowId());
|
||||||
child.setVirtualPartRootMaterialNo(parentEntity.getMaterialNo());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -313,7 +313,7 @@ public abstract class VirtualPackageBase {
|
||||||
childEntity.setProjectType("L");
|
childEntity.setProjectType("L");
|
||||||
childEntity.setMaterialUnit("PC");
|
childEntity.setMaterialUnit("PC");
|
||||||
childEntity.setProjectTypeInputType(ProjectTypeInputTypeEnum.AUTO_MATCH.getValue());
|
childEntity.setProjectTypeInputType(ProjectTypeInputTypeEnum.AUTO_MATCH.getValue());
|
||||||
childEntity.setVirtualPartRootMaterialNo(rootMaterialNo);
|
childEntity.setInitialParentRowId(parentRowId);
|
||||||
this.childResult.add(childEntity);
|
this.childResult.add(childEntity);
|
||||||
return childEntity;
|
return childEntity;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -428,9 +428,7 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
||||||
// childEntity.setDrawingNo(childEntity.getMaterialNo());
|
// childEntity.setDrawingNo(childEntity.getMaterialNo());
|
||||||
// }
|
// }
|
||||||
childEntity.setMaterialOriginalUnit(childEntity.getMaterialUnit());
|
childEntity.setMaterialOriginalUnit(childEntity.getMaterialUnit());
|
||||||
if (parent.getMaterialNo().startsWith("31")) {
|
childEntity.setInitialParentRowId(parent.getEBomRowId());
|
||||||
childEntity.setVirtualPartRootMaterialNo(parent.getMaterialNo());
|
|
||||||
}
|
|
||||||
this.eBomChildResult.add(childEntity);
|
this.eBomChildResult.add(childEntity);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue