fix(ebom): 转正式表时设置转换人姓名
This commit is contained in:
parent
9b64e55981
commit
b577689855
|
|
@ -62,7 +62,7 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
||||||
|
|
||||||
void delBatch(@Param("rowIds") List<Long> rowIds);
|
void delBatch(@Param("rowIds") List<Long> rowIds);
|
||||||
|
|
||||||
void updateStateBatchByRowIds(@Param("status") Integer status, @Param("list") List<Long> list );
|
void updateStateBatchByRowIds(@Param("status") Integer status, String userName, @Param("list") List<Long> list);
|
||||||
|
|
||||||
Integer checkIsRoot(@Param("materialNo") String materialNo);
|
Integer checkIsRoot(@Param("materialNo") String materialNo);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -342,16 +342,16 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
|
|
||||||
List<BomNewEbomParentVO> parentChild = this.getBaseMapper().getParentChild(rowId);
|
List<BomNewEbomParentVO> parentChild = this.getBaseMapper().getParentChild(rowId);
|
||||||
//排除项目类别的赋值
|
//排除项目类别的赋值
|
||||||
List<BaseMaterialVO> materialVOS = materialMainService.intiMaterialInfoInPattern(parentChild, "^21 | ^31", EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
materialMainService.intiMaterialInfoInPattern(parentChild, "^21 | ^31", EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
||||||
if (CollUtil.isNotEmpty(parentChild)) {
|
if (CollUtil.isNotEmpty(parentChild)) {
|
||||||
List<String> materialNos = parentChild.stream().map(BaseMaterialVO::getMaterialNo).filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
List<String> materialNos = parentChild.stream().map(BaseMaterialVO::getMaterialNo).filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||||
if (CollUtil.isNotEmpty(materialNos)) {
|
if (CollUtil.isNotEmpty(materialNos)) {
|
||||||
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos)
|
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos)
|
||||||
.eq(!EBomStatusEnum.PUBLISHED.equalsValue(parent.getStatus()), BomNewEbomParentEntity::getLastVersionIs, 1)
|
.eq(!EBomStatusEnum.PUBLISHED.equalsValue(parent.getStatus()), BomNewEbomParentEntity::getLastVersionIs, 1)
|
||||||
.eq(EBomStatusEnum.PUBLISHED.equalsValue(parent.getStatus()), BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
|
.eq(EBomStatusEnum.PUBLISHED.equalsValue(parent.getStatus()), BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
|
||||||
if (EBomStatusEnum.CHECKED.equalsValue(parent.getStatus())) {
|
// if (EBomStatusEnum.CHECKED.equalsValue(parent.getStatus())) {
|
||||||
list = list.stream().filter(u -> EBomStatusEnum.CHECKED.equalsValue(u.getStatus())).collect(Collectors.toList());
|
// list = list.stream().filter(u -> EBomStatusEnum.CHECKED.equalsValue(u.getStatus())).collect(Collectors.toList());
|
||||||
}
|
// }
|
||||||
Map<String, BomNewEbomParentEntity> bomListMap = list.parallelStream()
|
Map<String, BomNewEbomParentEntity> bomListMap = list.parallelStream()
|
||||||
.collect(Collectors.toMap(
|
.collect(Collectors.toMap(
|
||||||
BomNewEbomParentEntity::getMaterialNo, // key: DrawingNo
|
BomNewEbomParentEntity::getMaterialNo, // key: DrawingNo
|
||||||
|
|
@ -391,6 +391,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
&& parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) {
|
&& parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) {
|
||||||
child.setStatus(EBomStatusEnum.BORROWED_PARTS.getValue());
|
child.setStatus(EBomStatusEnum.BORROWED_PARTS.getValue());
|
||||||
child.setBomRowId(0L);
|
child.setBomRowId(0L);
|
||||||
|
child.setCurrentVersion(parentEntity.getCurrentVersion());
|
||||||
}
|
}
|
||||||
// //非本人则为借用件
|
// //非本人则为借用件
|
||||||
// else if (!parentEntity.getCreatedBy().equals(child.getCreatedBy())) {
|
// else if (!parentEntity.getCreatedBy().equals(child.getCreatedBy())) {
|
||||||
|
|
@ -926,7 +927,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
// }
|
// }
|
||||||
List<Long> bomRowIds = bomTree.stream().filter(u -> u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
|
List<Long> bomRowIds = bomTree.stream().filter(u -> u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
|
||||||
if (CollUtil.isNotEmpty(bomRowIds)) {
|
if (CollUtil.isNotEmpty(bomRowIds)) {
|
||||||
this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), bomRowIds);
|
this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), SessionUtil.getRealName(), bomRowIds);
|
||||||
//将历史已发布版-转移到正式历史表
|
//将历史已发布版-转移到正式历史表
|
||||||
eBomToFormal(bomRowIds, bomTree.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList()) );
|
eBomToFormal(bomRowIds, bomTree.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList()) );
|
||||||
}
|
}
|
||||||
|
|
@ -2574,21 +2575,22 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean deleteBomV2(Long bomRowId) {
|
public Boolean deleteBomV2(Long bomRowId) {
|
||||||
BomNewEbomParentEntity root = getById(bomRowId);
|
BomNewEbomParentEntity parent = getById(bomRowId);
|
||||||
VUtils.isTure(Objects.isNull(root)).throwMessage("bom不存在");
|
VUtils.isTure(Objects.isNull(parent)).throwMessage("bom不存在");
|
||||||
VUtils.isTure(root.getRootIs() != 1 && root.getUserRootIs() != 1).throwMessage("请选择根节点");
|
// VUtils.isTure(root.getRootIs() != 1 && root.getUserRootIs() != 1).throwMessage("请选择根节点");
|
||||||
VUtils.isTure(!StrUtil.equals(root.getCreatedBy(), SessionUtil.getUserCode())).throwMessage("不能删除他人的数据");
|
|
||||||
|
|
||||||
delete(root);
|
LogRecordContext.putVariable("bom", parent);
|
||||||
|
|
||||||
|
delete(parent);
|
||||||
|
|
||||||
CompletableFuture.runAsync(this::updateLastVersionIs);
|
CompletableFuture.runAsync(this::updateLastVersionIs);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void delete(BomNewEbomParentEntity parent) {
|
private void delete(BomNewEbomParentEntity parent) {
|
||||||
if (!StrUtil.equals(parent.getCreatedBy(), SessionUtil.getUserCode())) {
|
VUtils.isTure(!(StrUtil.equals(parent.getCreatedBy(), SessionUtil.getUserCode())
|
||||||
return;
|
|| Objects.equals(parent.getVirtualPackageIs(), 1)))
|
||||||
}
|
.throwMessage("只能删除虚拟包和自己创建的数据");
|
||||||
|
|
||||||
this.getBaseMapper().delete(Wrappers.lambdaQuery(BomNewEbomParentEntity.class)
|
this.getBaseMapper().delete(Wrappers.lambdaQuery(BomNewEbomParentEntity.class)
|
||||||
.eq(BomNewEbomParentEntity::getRowId, parent.getRowId()));
|
.eq(BomNewEbomParentEntity::getRowId, parent.getRowId()));
|
||||||
|
|
@ -2615,22 +2617,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
if (CollUtil.isEmpty(parents)) return;
|
if (CollUtil.isEmpty(parents)) return;
|
||||||
|
|
||||||
List<BomNewEbomParentEntity> deleteParents = parents.stream()
|
List<BomNewEbomParentEntity> deleteParents = parents.stream()
|
||||||
.filter(p -> (StrUtil.equals(p.getCreatedBy(), SessionUtil.getUserCode())
|
.filter(p -> StrUtil.equals(p.getCreatedBy(), SessionUtil.getUserCode()) || Objects.equals(p.getVirtualPackageIs(), 1))
|
||||||
&& (Objects.equals(p.getSource(), EBomSourceEnum.FROM_BOM.getValue()) || Objects.equals(p.getSource(), EBomSourceEnum.FROM_EXCE.getValue())))
|
|
||||||
|| Objects.equals(p.getVirtualPackageIs(), 1))
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
//将自己手动创建的bom提为用户顶层
|
|
||||||
List<BomNewEbomParentEntity> updateParents = parents.stream()
|
|
||||||
.filter(p -> StrUtil.equals(p.getCreatedBy(), SessionUtil.getUserCode()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
updateParents.removeAll(deleteParents);
|
|
||||||
if (CollUtil.isNotEmpty(updateParents)) {
|
|
||||||
this.lambdaUpdate()
|
|
||||||
.set(BomNewEbomParentEntity::getUserRootIs, 1)
|
|
||||||
.set(BomNewEbomParentEntity::getModifyTime, LocalDateTime.now())
|
|
||||||
.in(BomNewEbomParentEntity::getRowId, updateParents.stream().map(BomNewEbomParentEntity::getRowId).collect(Collectors.toList()));
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteParents.forEach(this::delete);
|
deleteParents.forEach(this::delete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue