Merge remote-tracking branch 'origin/master-hlq20241114batch'
This commit is contained in:
commit
812935d5ff
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.mzt.logapi.starter.annotation.LogRecord;
|
||||
import com.nflg.product.base.core.api.BaseApi;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.bomnew.constant.EBomConstant;
|
||||
|
|
@ -65,6 +66,7 @@ public class BatchBomApi extends BaseApi {
|
|||
|
||||
@PostMapping("updateEBom")
|
||||
@ApiOperation("更新EBOM并导入SAP")
|
||||
@LogRecord(success = "更新EBOM并导入SAP,操作结果:{{#_ret}}", bizNo = "",type = "更新EBOM并导入SAP")
|
||||
public ResultVO<List<OperationErrorMsgVO>> updateEBom(@RequestBody List<BaseBomVO> baseBomVOList) {
|
||||
List<Long> addRowIds = batchBomService.updateEBom(baseBomVOList);
|
||||
List<OperationErrorMsgVO> errorMsgVOS = new ArrayList<>();
|
||||
|
|
@ -80,6 +82,7 @@ public class BatchBomApi extends BaseApi {
|
|||
|
||||
@PostMapping("updatePBom")
|
||||
@ApiOperation("更新PBOM并导入SAP")
|
||||
@LogRecord(success = "更新PBOM并导入SAP,操作结果:{{#_ret}}", bizNo = "",type = "更新PBOM并导入SAP")
|
||||
public ResultVO<List<OperationErrorMsgVO>> updatePBom(@RequestBody List<BaseBomVO> baseBomVOList) {
|
||||
List<Long> addRowIds = batchBomService.updatePBom(baseBomVOList);
|
||||
List<OperationErrorMsgVO> errorMsgVOS = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -23,4 +23,5 @@ public class BomConstant {
|
|||
public static final String ADD="新增";
|
||||
public static final String UP="修改";
|
||||
public static final String DEL="删除";
|
||||
public static final String BATCH="批量替代";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ public enum EBomSourceEnum implements ValueEnum<Integer> {
|
|||
FROM_MDM(3, "MDM创建"),
|
||||
FROM_SAP(4, "从SAP导入"),
|
||||
FROM_CHANGE(5, "变更"),
|
||||
FROM_DELETE(6, "BOM删除");
|
||||
FROM_DELETE(6, "BOM删除"),
|
||||
FROM_BATCH(7, "批量变更");
|
||||
|
||||
private final Integer value;
|
||||
private final String description;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ public enum PbomSourceEnum implements ValueEnum<Integer> {
|
|||
FROM_SAP(3, "从SAP导入"),
|
||||
FROM_COPY(4, "复制"),
|
||||
FROM_CHANGE(5, "变更"),
|
||||
FROM_DELETE(6, "BOM删除");
|
||||
FROM_DELETE(6, "BOM删除"),
|
||||
FROM_BATCH(7, "批量变更");
|
||||
|
||||
private final Integer value;
|
||||
private final String description;
|
||||
|
|
|
|||
|
|
@ -49,5 +49,6 @@ public class UpdateLogVO {
|
|||
@ApiModelProperty("旧版或新版 0-旧版 1-新版")
|
||||
private Integer oldOrNewVersion=0;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "来源")
|
||||
private Integer source;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ public class BatchBomService {
|
|||
baseBomVO.setNewMaterialNo(batchBomQuery.getNewMaterialNo());
|
||||
baseBomVO.setNewNum(newReplaceTimes.divide(replaceTimes, decimalScale, RoundingMode.HALF_UP).multiply(baseBomVO.getNum()));
|
||||
baseBomVO.setNewUnit(batchBomQuery.getNewMaterialUnit());
|
||||
baseBomVO.setNewVersion(VersionUtil.getNextVersion(baseBomVO.getParentVersion()));
|
||||
baseBomVO.setNewVersion(VersionUtil.getPBomUpgradNextVersion(baseBomVO.getParentVersion()));
|
||||
resultList.add(baseBomVO);
|
||||
}
|
||||
}
|
||||
|
|
@ -319,6 +319,53 @@ public class BatchBomService {
|
|||
List<Long> delRowIds = new ArrayList<>(baseBomVOList.size()); // 需要从正式表删除的父级BOM ID
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
int createdJob = userRoleService.technician() ? UserJobEnum.ENGINEER.getValue() : UserJobEnum.DESIGNER.getValue();
|
||||
|
||||
// TODO 如果有草稿中数据,草稿大版本+1(先改草稿中的版本,否则会报错:Duplicate entry 'xxx-A00.0a-1010' for key 'uniq_material_no_version')
|
||||
for (BaseBomVO baseBomVO: baseBomVOList) {
|
||||
BomNewEbomParentEntity draftParent = bomNewEbomParentService.lambdaQuery()
|
||||
.eq(BomNewEbomParentEntity::getMaterialNo, baseBomVO.getParentMaterialNo())
|
||||
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||
.one();
|
||||
if (ObjectUtil.isNotEmpty(draftParent)) {
|
||||
// 草稿版本 A01 -> A02,A01.1 -> A02.1
|
||||
String[] currentVersionArr = draftParent.getCurrentVersion().split("\\.");
|
||||
String newVersion = VersionUtil.getNextVersion(currentVersionArr[0]);
|
||||
if (currentVersionArr.length > 1) {
|
||||
newVersion += "." + currentVersionArr[1];
|
||||
}
|
||||
draftParent.setCurrentVersion(newVersion);
|
||||
draftParent.setModifyTime(LocalDateTime.now());
|
||||
bomNewEbomParentService.updateById(draftParent);
|
||||
// 子级有原物料号,也要替代成新物料号
|
||||
List<BomNewEbomChildEntity> draftChildren = bomNewEbomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, draftParent.getRowId()).list();
|
||||
if (CollectionUtil.isNotEmpty(draftChildren)) {
|
||||
List<BomNewEbomChildEntity> replaceChildren = draftChildren.stream().filter(child -> baseBomVO.getMaterialNo().equals(child.getMaterialNo())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(replaceChildren)) {
|
||||
for (BomNewEbomChildEntity newReplaceChild: replaceChildren) {
|
||||
newReplaceChild.setRowId(IdWorker.getId());
|
||||
newReplaceChild.setIdentityNo(draftParent.getRowId() + "_" + newReplaceChild.getRowId());
|
||||
newReplaceChild.setMaterialNo(baseBomVO.getNewMaterialNo()); // 新物料编码
|
||||
newReplaceChild.setDrawingNo(newMaterialInfo.getDrawingNo());
|
||||
newReplaceChild.setMaterialName(newMaterialInfo.getMaterialName());
|
||||
newReplaceChild.setMaterialDesc(newMaterialInfo.getMaterialDesc()); // 新物料描述
|
||||
newReplaceChild.setMaterialTexture(newMaterialInfo.getMaterialTexture());
|
||||
newReplaceChild.setMaterialUnit(baseBomVO.getNewUnit()); // 新单位
|
||||
newReplaceChild.setNum(baseBomVO.getNewNum()); // 新数量
|
||||
newReplaceChild.setMaterialCategoryCode(newMaterialInfo.getMaterialCategoryCode());
|
||||
// TODO 新单重?新总重?要不要更新
|
||||
// 新版本创建时间要更新,创建人要不要更新待定(根据权限管理考虑)
|
||||
newReplaceChild.setCreatedTime(now);
|
||||
newReplaceChild.setModifyTime(now);
|
||||
newReplaceChild.setCreatedBy(SessionUtil.getUserCode());
|
||||
newReplaceChild.setRemark("【批量替代BOM】由" + baseBomVO.getMaterialNo() + "替代为" + baseBomVO.getNewMaterialNo());
|
||||
newReplaceChild.setSource(EBomSourceEnum.FROM_BATCH.getValue());
|
||||
}
|
||||
bomNewEbomChildService.updateBatchById(replaceChildren);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (BaseBomVO baseBomVO: baseBomVOList) {
|
||||
// 找到父级
|
||||
BomNewEbomParentEntity ebomParentEntity = bomNewEbomParentService.lambdaQuery().eq(BomNewEbomParentEntity::getRowId, baseBomVO.getParentRowId()).one();
|
||||
|
|
@ -338,6 +385,7 @@ public class BatchBomService {
|
|||
// 新版本创建时间要更新,创建人要不要更新待定(根据权限管理考虑)
|
||||
newParent.setCreatedTime(now);
|
||||
newParent.setModifyTime(now);
|
||||
newParent.setSource(EBomSourceEnum.FROM_BATCH.getValue());
|
||||
newParent.setSapState(SapStatusEnum.UNPUB_SAP.getValue());
|
||||
newParent.setSapTime(null);
|
||||
newParent.setDeptRowId(SessionUtil.getDepartRowId());
|
||||
|
|
@ -358,6 +406,7 @@ public class BatchBomService {
|
|||
newChild.setCreatedTime(now);
|
||||
newChild.setModifyTime(now);
|
||||
newChild.setCreatedBy(SessionUtil.getUserCode());
|
||||
newChild.setSource(EBomSourceEnum.FROM_BATCH.getValue());
|
||||
newChildList.add(newChild);
|
||||
});
|
||||
BomNewEbomChildEntity newReplaceChild = new BomNewEbomChildEntity();
|
||||
|
|
@ -379,6 +428,7 @@ public class BatchBomService {
|
|||
newReplaceChild.setModifyTime(now);
|
||||
newReplaceChild.setCreatedBy(SessionUtil.getUserCode());
|
||||
newReplaceChild.setRemark("【批量替代BOM】由" + baseBomVO.getMaterialNo() + "替代为" + baseBomVO.getNewMaterialNo());
|
||||
newReplaceChild.setSource(EBomSourceEnum.FROM_BATCH.getValue());
|
||||
newChildList.add(newReplaceChild);
|
||||
bomNewEbomParentService.save(newParent);
|
||||
bomNewEbomChildService.saveBatch(newChildList);
|
||||
|
|
@ -395,50 +445,6 @@ public class BatchBomService {
|
|||
// 转移后删除
|
||||
bomNewEbomParentService.delEBomHistory(delRowIds);
|
||||
}
|
||||
// TODO 如果有草稿中数据,草稿版本+1
|
||||
for (BaseBomVO baseBomVO: baseBomVOList) {
|
||||
BomNewEbomParentEntity draftParent = bomNewEbomParentService.lambdaQuery()
|
||||
.eq(BomNewEbomParentEntity::getMaterialNo, baseBomVO.getParentMaterialNo())
|
||||
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||
.one();
|
||||
if (ObjectUtil.isNotEmpty(draftParent)) {
|
||||
// 草稿版本 A01 -> A02,A01.1 -> A02.1
|
||||
String[] currentVersionArr = draftParent.getCurrentVersion().split("\\.");
|
||||
String newVersion = VersionUtil.getNextVersion(currentVersionArr[0]);
|
||||
if (currentVersionArr.length > 1) {
|
||||
newVersion += "." + currentVersionArr[1];
|
||||
}
|
||||
draftParent.setCurrentVersion(newVersion);
|
||||
draftParent.setModifyTime(LocalDateTime.now());
|
||||
bomNewEbomParentService.updateById(draftParent);
|
||||
// 子级有原物料号,也要替代成新物料号
|
||||
List<BomNewEbomChildEntity> draftChildren = bomNewEbomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, baseBomVO.getParentRowId()).list();
|
||||
if (CollectionUtil.isNotEmpty(draftChildren)) {
|
||||
List<BomNewEbomChildEntity> replaceChildren = draftChildren.stream().filter(child -> baseBomVO.getMaterialNo().equals(child.getMaterialNo())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(replaceChildren)) {
|
||||
for (BomNewEbomChildEntity newReplaceChild: replaceChildren) {
|
||||
newReplaceChild.setRowId(IdWorker.getId());
|
||||
newReplaceChild.setIdentityNo(draftParent.getRowId() + "_" + newReplaceChild.getRowId());
|
||||
newReplaceChild.setMaterialNo(baseBomVO.getNewMaterialNo()); // 新物料编码
|
||||
newReplaceChild.setDrawingNo(newMaterialInfo.getDrawingNo());
|
||||
newReplaceChild.setMaterialName(newMaterialInfo.getMaterialName());
|
||||
newReplaceChild.setMaterialDesc(newMaterialInfo.getMaterialDesc()); // 新物料描述
|
||||
newReplaceChild.setMaterialTexture(newMaterialInfo.getMaterialTexture());
|
||||
newReplaceChild.setMaterialUnit(baseBomVO.getNewUnit()); // 新单位
|
||||
newReplaceChild.setNum(baseBomVO.getNewNum()); // 新数量
|
||||
newReplaceChild.setMaterialCategoryCode(newMaterialInfo.getMaterialCategoryCode());
|
||||
// TODO 新单重?新总重?要不要更新
|
||||
// 新版本创建时间要更新,创建人要不要更新待定(根据权限管理考虑)
|
||||
newReplaceChild.setCreatedTime(now);
|
||||
newReplaceChild.setModifyTime(now);
|
||||
newReplaceChild.setCreatedBy(SessionUtil.getUserCode());
|
||||
newReplaceChild.setRemark("【批量替代BOM】由" + baseBomVO.getMaterialNo() + "替代为" + baseBomVO.getNewMaterialNo());
|
||||
}
|
||||
bomNewEbomChildService.updateBatchById(replaceChildren);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return addRowIds;
|
||||
}
|
||||
|
||||
|
|
@ -460,6 +466,49 @@ public class BatchBomService {
|
|||
List<Long> delRowIds = new ArrayList<>(baseBomVOList.size()); // 需要从正式表删除的父级BOM ID
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
int createdJob = userRoleService.technician() ? UserJobEnum.ENGINEER.getValue() : UserJobEnum.DESIGNER.getValue();
|
||||
|
||||
// TODO 如果有草稿中数据,草稿小小版本+1(先改草稿中的版本,否则会报错:Duplicate entry 'xxx-A00.0a-1010' for key 'uniq_material_no_version')
|
||||
for (BaseBomVO baseBomVO: baseBomVOList) {
|
||||
BomNewPbomParentEntity draftParent = bomNewPbomParentService.lambdaQuery()
|
||||
.eq(BomNewPbomParentEntity::getMaterialNo, baseBomVO.getParentMaterialNo())
|
||||
.eq(BomNewPbomParentEntity::getFacCode, baseBomVO.getFactory())
|
||||
.lt(BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
|
||||
.one();
|
||||
if (ObjectUtil.isNotEmpty(draftParent)) {
|
||||
// 草稿数据小小版本+1(因为草稿的小小版本号已经被批量替代这个版本占用)
|
||||
draftParent.setCurrentVersion(VersionUtil.getPBomUpgradNextVersion(draftParent.getCurrentVersion()));
|
||||
draftParent.setModifyTime(LocalDateTime.now());
|
||||
bomNewPbomParentService.updateById(draftParent);
|
||||
// 子级有原物料号,也要替代成新物料号
|
||||
List<BomNewPbomChildEntity> draftChildren = bomNewPbomChildService.lambdaQuery().eq(BomNewPbomChildEntity::getParentRowId, draftParent.getRowId()).list();
|
||||
if (CollectionUtil.isNotEmpty(draftChildren)) {
|
||||
List<BomNewPbomChildEntity> replaceChildren = draftChildren.stream().filter(child -> baseBomVO.getMaterialNo().equals(child.getMaterialNo())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(replaceChildren)) {
|
||||
for (BomNewPbomChildEntity newReplaceChild: replaceChildren) {
|
||||
newReplaceChild.setRowId(IdWorker.getId());
|
||||
newReplaceChild.setIdentityNo(draftParent.getRowId() + "_" + newReplaceChild.getRowId());
|
||||
newReplaceChild.setMaterialNo(baseBomVO.getNewMaterialNo()); // 新物料编码
|
||||
newReplaceChild.setDrawingNo(newMaterialInfo.getDrawingNo());
|
||||
newReplaceChild.setMaterialName(newMaterialInfo.getMaterialName());
|
||||
newReplaceChild.setMaterialDesc(newMaterialInfo.getMaterialDesc()); // 新物料描述
|
||||
newReplaceChild.setMaterialTexture(newMaterialInfo.getMaterialTexture());
|
||||
newReplaceChild.setMaterialUnit(baseBomVO.getNewUnit()); // 新单位
|
||||
newReplaceChild.setNum(baseBomVO.getNewNum()); // 新数量
|
||||
newReplaceChild.setMaterialCategoryCode(newMaterialInfo.getMaterialCategoryCode());
|
||||
// TODO 新单重?新总重?要不要更新
|
||||
// 新版本创建时间要更新,创建人要不要更新待定(根据权限管理考虑)
|
||||
newReplaceChild.setCreatedTime(now);
|
||||
newReplaceChild.setModifyTime(now);
|
||||
newReplaceChild.setCreatedBy(SessionUtil.getUserCode());
|
||||
newReplaceChild.setRemark("【批量替代BOM】由" + baseBomVO.getMaterialNo() + "替代为" + baseBomVO.getNewMaterialNo());
|
||||
newReplaceChild.setSource(PbomSourceEnum.FROM_BATCH.getValue());
|
||||
}
|
||||
bomNewPbomChildService.updateBatchById(replaceChildren);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (BaseBomVO baseBomVO: baseBomVOList) {
|
||||
// 找到父级
|
||||
BomNewPbomParentEntity pbomParentEntity = bomNewPbomParentService.lambdaQuery().eq(BomNewPbomParentEntity::getRowId, baseBomVO.getParentRowId()).one();
|
||||
|
|
@ -471,7 +520,7 @@ public class BatchBomService {
|
|||
BomNewPbomChildEntity replaceChild = collect.get(0);
|
||||
// 其他子级
|
||||
List<BomNewPbomChildEntity> otherChildren = pbomChildEntities.stream().filter(item -> !item.getRowId().equals(baseBomVO.getChildRowId())).collect(Collectors.toList());
|
||||
// 构建新版的父级规则:大版本号+1(如果该BOM还有编辑中的草稿版本,则草稿版本号也+1)
|
||||
// 构建新版的父级规则:小小版本号+1(如果该BOM还有编辑中的草稿版本,则草稿小小版本号也+1)
|
||||
BomNewPbomParentEntity newParent = new BomNewPbomParentEntity();
|
||||
BeanUtil.copyProperties(pbomParentEntity, newParent);
|
||||
newParent.setRowId(IdWorker.getId());
|
||||
|
|
@ -479,6 +528,7 @@ public class BatchBomService {
|
|||
// 新版本创建时间要更新,创建人要不要更新待定(根据权限管理考虑)
|
||||
newParent.setCreatedTime(now);
|
||||
newParent.setModifyTime(now);
|
||||
newParent.setSource(PbomSourceEnum.FROM_BATCH.getValue());
|
||||
newParent.setSapState(SapStatusEnum.UNPUB_SAP.getValue());
|
||||
newParent.setSapTime(null);
|
||||
newParent.setDeptRowId(SessionUtil.getDepartRowId());
|
||||
|
|
@ -499,6 +549,7 @@ public class BatchBomService {
|
|||
newChild.setCreatedTime(now);
|
||||
newChild.setModifyTime(now);
|
||||
newChild.setCreatedBy(SessionUtil.getUserCode());
|
||||
newChild.setSource(PbomSourceEnum.FROM_BATCH.getValue());
|
||||
newChildList.add(newChild);
|
||||
});
|
||||
BomNewPbomChildEntity newReplaceChild = new BomNewPbomChildEntity();
|
||||
|
|
@ -520,6 +571,7 @@ public class BatchBomService {
|
|||
newReplaceChild.setModifyTime(now);
|
||||
newReplaceChild.setCreatedBy(SessionUtil.getUserCode());
|
||||
newReplaceChild.setRemark("【批量替代BOM】由" + baseBomVO.getMaterialNo() + "替代为" + baseBomVO.getNewMaterialNo());
|
||||
newReplaceChild.setSource(PbomSourceEnum.FROM_BATCH.getValue());
|
||||
newChildList.add(newReplaceChild);
|
||||
bomNewPbomParentService.save(newParent);
|
||||
bomNewPbomChildService.saveBatch(newChildList);
|
||||
|
|
@ -536,51 +588,6 @@ public class BatchBomService {
|
|||
// 转移后删除
|
||||
bomNewPbomParentService.delPBom(delRowIds);
|
||||
}
|
||||
// TODO 如果有草稿中数据,草稿版本+1
|
||||
for (BaseBomVO baseBomVO: baseBomVOList) {
|
||||
BomNewPbomParentEntity draftParent = bomNewPbomParentService.lambdaQuery()
|
||||
.eq(BomNewPbomParentEntity::getMaterialNo, baseBomVO.getParentMaterialNo())
|
||||
.eq(BomNewPbomParentEntity::getFacCode, baseBomVO.getFactory())
|
||||
.lt(BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
|
||||
.one();
|
||||
if (ObjectUtil.isNotEmpty(draftParent)) {
|
||||
// 草稿版本 A01 -> A02,A01.1 -> A02.1
|
||||
String[] currentVersionArr = draftParent.getCurrentVersion().split("\\.");
|
||||
String newVersion = VersionUtil.getNextVersion(currentVersionArr[0]);
|
||||
if (currentVersionArr.length > 1) {
|
||||
newVersion += "." + currentVersionArr[1];
|
||||
}
|
||||
draftParent.setCurrentVersion(newVersion);
|
||||
draftParent.setModifyTime(LocalDateTime.now());
|
||||
bomNewPbomParentService.updateById(draftParent);
|
||||
// 子级有原物料号,也要替代成新物料号
|
||||
List<BomNewPbomChildEntity> draftChildren = bomNewPbomChildService.lambdaQuery().eq(BomNewPbomChildEntity::getParentRowId, baseBomVO.getParentRowId()).list();
|
||||
if (CollectionUtil.isNotEmpty(draftChildren)) {
|
||||
List<BomNewPbomChildEntity> replaceChildren = draftChildren.stream().filter(child -> baseBomVO.getMaterialNo().equals(child.getMaterialNo())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(replaceChildren)) {
|
||||
for (BomNewPbomChildEntity newReplaceChild: replaceChildren) {
|
||||
newReplaceChild.setRowId(IdWorker.getId());
|
||||
newReplaceChild.setIdentityNo(draftParent.getRowId() + "_" + newReplaceChild.getRowId());
|
||||
newReplaceChild.setMaterialNo(baseBomVO.getNewMaterialNo()); // 新物料编码
|
||||
newReplaceChild.setDrawingNo(newMaterialInfo.getDrawingNo());
|
||||
newReplaceChild.setMaterialName(newMaterialInfo.getMaterialName());
|
||||
newReplaceChild.setMaterialDesc(newMaterialInfo.getMaterialDesc()); // 新物料描述
|
||||
newReplaceChild.setMaterialTexture(newMaterialInfo.getMaterialTexture());
|
||||
newReplaceChild.setMaterialUnit(baseBomVO.getNewUnit()); // 新单位
|
||||
newReplaceChild.setNum(baseBomVO.getNewNum()); // 新数量
|
||||
newReplaceChild.setMaterialCategoryCode(newMaterialInfo.getMaterialCategoryCode());
|
||||
// TODO 新单重?新总重?要不要更新
|
||||
// 新版本创建时间要更新,创建人要不要更新待定(根据权限管理考虑)
|
||||
newReplaceChild.setCreatedTime(now);
|
||||
newReplaceChild.setModifyTime(now);
|
||||
newReplaceChild.setCreatedBy(SessionUtil.getUserCode());
|
||||
newReplaceChild.setRemark("【批量替代BOM】由" + baseBomVO.getMaterialNo() + "替代为" + baseBomVO.getNewMaterialNo());
|
||||
}
|
||||
bomNewPbomChildService.updateBatchById(replaceChildren);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return addRowIds;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.google.common.collect.Sets;
|
||||
|
|
@ -532,6 +533,10 @@ public class ForwardReportService {
|
|||
if(!oldEnt.getMaterialNo().equals(newEnt.getMaterialNo()) || !oldEnt.getNum().equals(newEnt.getNum()) || !oldEnt.getProjectType().equals(newEnt.getProjectType())){
|
||||
result.add(oldEnt);
|
||||
newEnt.setOpType(BomConstant.UP);
|
||||
// 操作类型:批量替代
|
||||
if (ObjectUtil.isNotEmpty(newEnt.getSource()) && newEnt.getSource().equals(EBomSourceEnum.FROM_BATCH.getValue())) {
|
||||
newEnt.setOpType(BomConstant.BATCH);
|
||||
}
|
||||
result.add(newEnt);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,12 @@ public class SapErrorMsgUtil {
|
|||
errMsg.msg = materialNo + "物料状态可能为冻结,实际为:" + materialNoStateMap.get(materialNo);
|
||||
}
|
||||
});
|
||||
// SAP报错信息,这个提示语,'Z0'转义为:状态为冻结
|
||||
liErrMsg.forEach(errMsg -> {
|
||||
if (ObjectUtil.isNotEmpty(errMsg.msg) && errMsg.msg.contains("'Z0'")) {
|
||||
errMsg.msg = errMsg.msg.replaceAll("'Z0'", "状态为冻结");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -353,9 +353,9 @@
|
|||
</insert>
|
||||
|
||||
<insert id="insertPBomChildToFormal">
|
||||
INSERT INTO `t_bom_new_pbom_child_formal` (`row_id`, `parent_row_id`, `identity_no`, `fac_code`, `order_number`, `drawing_no`, `material_no`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `material_category_code`, `unit_weight`, `num`, `total_weight`, `project_type`, `production_factory_code`, `production_factory_code_input_type`, `set_production_factory_time`, `super_material_status`, `virtual_part_is`, `created_by`, `created_time`, `modify_time`, `source_row_id`, `remark`, `source_parent_material_no`, `virtual_part_type`, `virtual_part_root_material_no`, `bom_version_row_id`, `sap_state`, `sap_time`)
|
||||
INSERT INTO `t_bom_new_pbom_child_formal` (`row_id`, `parent_row_id`, `identity_no`, `fac_code`, `order_number`, `drawing_no`, `material_no`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `material_category_code`, `unit_weight`, `num`, `total_weight`, `project_type`, `production_factory_code`, `production_factory_code_input_type`, `set_production_factory_time`, `super_material_status`, `virtual_part_is`, `created_by`, `created_time`, `modify_time`, `source_row_id`, `remark`, `source_parent_material_no`, `virtual_part_type`, `virtual_part_root_material_no`, `bom_version_row_id`, `sap_state`, `sap_time`,`source`)
|
||||
|
||||
select `row_id`, `parent_row_id`, `identity_no`, `fac_code`, `order_number`, `drawing_no`, `material_no`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `material_category_code`, `unit_weight`, `num`, `total_weight`, `project_type`, `production_factory_code`, `production_factory_code_input_type`, `set_production_factory_time`, `super_material_status`, `virtual_part_is`, `created_by`, `created_time`, `modify_time`, `source_row_id`, `remark`, `source_parent_material_no`, `virtual_part_type`, `virtual_part_root_material_no`, `bom_version_row_id`, `sap_state`, `sap_time`
|
||||
select `row_id`, `parent_row_id`, `identity_no`, `fac_code`, `order_number`, `drawing_no`, `material_no`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `material_category_code`, `unit_weight`, `num`, `total_weight`, `project_type`, `production_factory_code`, `production_factory_code_input_type`, `set_production_factory_time`, `super_material_status`, `virtual_part_is`, `created_by`, `created_time`, `modify_time`, `source_row_id`, `remark`, `source_parent_material_no`, `virtual_part_type`, `virtual_part_root_material_no`, `bom_version_row_id`, `sap_state`, `sap_time`,`source`
|
||||
from t_bom_new_pbom_child
|
||||
where parent_row_id in
|
||||
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
|
||||
|
|
|
|||
Loading…
Reference in New Issue