1、BUG修复

This commit is contained in:
大米 2024-04-13 15:34:52 +08:00
parent dc097a96cb
commit a5e5dd1827
7 changed files with 204 additions and 166 deletions

View File

@ -7,7 +7,9 @@ import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO; import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* t_bom_new_original_parent 表数据库访问层 * t_bom_new_original_parent 表数据库访问层
@ -59,7 +61,14 @@ public interface BomNewOriginalParentMapper extends BaseMapper<BomNewOriginalPar
*/ */
List<BomOriginalListVO> getParentForDrawingNoSeach(@Param("drawingNos") List<String> drawingNos ,@Param("state") Integer state); List<BomOriginalListVO> getParentForDrawingNoSeach(@Param("drawingNos") List<String> drawingNos ,@Param("state") Integer state);
List<BomOriginalListVO> getChildForDrawingNoSeach(@Param("drawingNos") List<String> drawingNos,@Param("state") Integer state); List<BomOriginalListVO> getChildForDrawingNoSeach(@Param("drawingNos") List<String> drawingNos,@Param("bomRowIds") Collection<Long> bomRowIds);
/**
* 获取父级图号
* @param drawingNos
* @return
*/
Set<String> getMaterialParent(@Param("drawingNos") Collection<String> drawingNos);

View File

@ -126,7 +126,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
List<String> materialNos = new ArrayList<>(); List<String> materialNos = new ArrayList<>();
// List<String> parentMaterialByMaterialNo = getParentMaterialByMaterialNo(materialNo, !userRoleService.technician()).stream().collect(Collectors.toList()); // List<String> parentMaterialByMaterialNo = getParentMaterialByMaterialNo(materialNo, !userRoleService.technician()).stream().collect(Collectors.toList());
//获取父级物料 //获取父级物料
List<String> parentMaterialByMaterialNo=getParentMaterial(ImmutableList.of(materialNo) ,!userRoleService.technician()).stream().collect(Collectors.toList()); List<String> parentMaterialByMaterialNo = getParentMaterial(ImmutableList.of(materialNo), !userRoleService.technician()).stream().collect(Collectors.toList());
// materialNos.add(materialNo); // materialNos.add(materialNo);
materialNos.addAll(parentMaterialByMaterialNo); materialNos.addAll(parentMaterialByMaterialNo);
if (CollUtil.isNotEmpty(materialNos)) { if (CollUtil.isNotEmpty(materialNos)) {
@ -225,6 +225,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
/** /**
* 获取父级物料 (包含查询物料本身) * 获取父级物料 (包含查询物料本身)
*
* @param materialNoList * @param materialNoList
* @param bomType * @param bomType
* @return * @return
@ -233,13 +234,13 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
Set<String> result = new HashSet<>(); Set<String> result = new HashSet<>();
result.addAll(materialNoList); result.addAll(materialNoList);
Set<String> useMaterialSku = this.getBaseMapper().getMaterialParent(materialNoList,bomType?SessionUtil.getUserCode():null); Set<String> useMaterialSku = this.getBaseMapper().getMaterialParent(materialNoList, bomType ? SessionUtil.getUserCode() : null);
while (CollUtil.isNotEmpty(useMaterialSku)) { while (CollUtil.isNotEmpty(useMaterialSku)) {
//防止数据错误循环依赖-死循环 //防止数据错误循环依赖-死循环
Set<String> difference = Sets.difference(useMaterialSku, result); Set<String> difference = Sets.difference(useMaterialSku, result);
if (CollUtil.isNotEmpty(difference)) { if (CollUtil.isNotEmpty(difference)) {
useMaterialSku = this.getBaseMapper().getMaterialParent(difference,bomType?SessionUtil.getUserCode():null); useMaterialSku = this.getBaseMapper().getMaterialParent(difference, bomType ? SessionUtil.getUserCode() : null);
result.addAll(difference); result.addAll(difference);
} else { } else {
break; break;
@ -330,12 +331,12 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
List<String> materialNos = parentChild.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(u -> u.getMaterialNo()).collect(Collectors.toList()); List<String> materialNos = parentChild.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(u -> u.getMaterialNo()).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
Function.identity(), Function.identity(),
@ -402,6 +403,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
/** /**
* 生成虚拟包时-获取子级 * 生成虚拟包时-获取子级
*
* @param rowId * @param rowId
* @return * @return
*/ */
@ -417,7 +419,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos) List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos)
.eq(BomNewEbomParentEntity::getLastVersionIs, 1).list(); .eq(BomNewEbomParentEntity::getLastVersionIs, 1).list();
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
Function.identity(), Function.identity(),
@ -769,41 +771,43 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
public void generateVirtualPackage(VirtualPackageParamDto paramDto) throws IOException { public void generateVirtualPackage(VirtualPackageParamDto paramDto) throws IOException {
BomNewEbomParentEntity root = this.getById(paramDto.getBomRowId());
BomNewEbomParentEntity root = this.getById(paramDto.getBomRowId()); VUtils.isTure(Objects.isNull(root)).throwMessage("Bom不存在");
VUtils.isTure(Objects.isNull(root)).throwMessage("Bom不存在");
// //初始化虚拟包-判断枚举不是手工生成虚拟包的情况
// VUtils.isTure(root.getVirtrualPackageEnum()>0).throwMessage("已生成过虚拟包不能2次生成"); checkAndInitVirtualPackageEnum(paramDto, root);
VUtils.isTure(!Objects.equals(root.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue()))
.throwMessage("异常状态下不允许生成虚拟包"); VUtils.isTure(root.getVirtrualPackageEnum() > 0).throwMessage("已生成过虚拟包不能2次生成");
LogRecordContext.putVariable("gvbom", root); VUtils.isTure(!Objects.equals(root.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue()))
//初始化虚拟包-判断枚举不是手工生成虚拟包的情况 .throwMessage("异常状态下不允许生成虚拟包");
checkAndInitVirtualPackageEnum(paramDto, root); LogRecordContext.putVariable("gvbom", root);
Boolean flag = true;
for (Integer f : paramDto.getVirtualPackageValue()) { // Boolean flag = true;
flag = flag & ((root.getVirtrualPackageEnum() & f) == f); // for (Integer f : paramDto.getVirtualPackageValue()) {
// flag = flag & ((root.getVirtrualPackageEnum() & f) == f);
// }
// VUtils.isTure(flag).throwMessage("已生成虚拟包,无需重复生成");
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, root);
materialMainService.intiMaterialInfo(ImmutableList.of(parent), BomNewEbomParentVO::getMaterialNo);
if (parent.getMaterialCategoryCode().startsWith("30") || ImmutableList.of("200601", "200401").contains(parent.getMaterialCategoryCode())) {
VirtualPackageBase generate;
if (parent.getMaterialCategoryCode().startsWith("30")) {
generate = new VirtualPackageFor31(paramDto.getBomRowId(), paramDto.getVirtualPackageValue());
} else {
generate = new VirtualPackageFor21(paramDto.getBomRowId(), paramDto.getVirtualPackageValue());
} }
VUtils.isTure(flag).throwMessage("已生成虚拟包,无需重复生成"); generate.generateVirtualPackage();
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, root);
materialMainService.intiMaterialInfo(ImmutableList.of(parent), BomNewEbomParentVO::getMaterialNo);
if (parent.getMaterialCategoryCode().startsWith("30") || ImmutableList.of("200601","200401").contains(parent.getMaterialCategoryCode())) {
VirtualPackageBase generate;
if (parent.getMaterialCategoryCode().startsWith("30")) {
generate = new VirtualPackageFor31(paramDto.getBomRowId(), paramDto.getVirtualPackageValue());
} else {
generate = new VirtualPackageFor21(paramDto.getBomRowId(), paramDto.getVirtualPackageValue());
}
generate.generateVirtualPackage();
if (CollUtil.isNotEmpty(generate.getParentResult())) {
this.saveOrUpdateBatch(generate.getParentResult());
}
if (CollUtil.isNotEmpty(generate.getChildResult())) {
ebomChildService.saveOrUpdateBatch(generate.getChildResult());
}
if (CollUtil.isNotEmpty(generate.getParentResult())) {
this.saveOrUpdateBatch(generate.getParentResult());
} }
if (CollUtil.isNotEmpty(generate.getChildResult())) {
ebomChildService.saveOrUpdateBatch(generate.getChildResult());
}
}
} }
@ -962,11 +966,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
public void editExportBom(EbomEditExportDTO param, OutputStream response) throws IOException { public void editExportBom(EbomEditExportDTO param, OutputStream response) throws IOException {
List<BomNewEbomParentVO> result=param.getList(); List<BomNewEbomParentVO> result = param.getList();
if(CollUtil.isEmpty(param.getList())){ if (CollUtil.isEmpty(param.getList())) {
result=getChild(param.getBomRowId()); result = getChild(param.getBomRowId());
} }
final ListSheet<EbomExcelEditVO> listSheet = new ListSheet<EbomExcelEditVO>(Convert.toList(EbomExcelEditVO.class,result) ); final ListSheet<EbomExcelEditVO> listSheet = new ListSheet<EbomExcelEditVO>(Convert.toList(EbomExcelEditVO.class, result));
EecExcelUtil.eecExcel("bom列表", listSheet, response); EecExcelUtil.eecExcel("bom列表", listSheet, response);
} }
@ -975,7 +979,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
public void exportBom(List<Long> bomRowIds, HttpServletResponse response) throws IOException { public void exportBom(List<Long> bomRowIds, HttpServletResponse response) throws IOException {
List<BomNewEbomParentVO> child = getChildBatch(bomRowIds); List<BomNewEbomParentVO> child = getChildBatch(bomRowIds);
final ListSheet<EbomExcelVO> listSheet = new ListSheet<>(Convert.toList(EbomExcelVO.class, child)); final ListSheet<EbomExcelVO> listSheet = new ListSheet<>(Convert.toList(EbomExcelVO.class, child));
EecExcelUtil.eecExcel("bom列表", listSheet, response); EecExcelUtil.eecExcel("bom列表", listSheet, response);
} }
@ -1051,7 +1055,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
parentVO.setParentRowId(0l); parentVO.setParentRowId(0l);
//原始bom强制追加 //原始bom强制追加
if(ObjectUtil.equal(EBomSourceEnum.FROM_BOM.getValue(),parentVO.getSource())){ if (ObjectUtil.equal(EBomSourceEnum.FROM_BOM.getValue(), parentVO.getSource())) {
dto.setOpType(EBomConstant.EBomExcelImportEnum.IMPORT_TYPE_APPEND.getValue()); dto.setOpType(EBomConstant.EBomExcelImportEnum.IMPORT_TYPE_APPEND.getValue());
} }
@ -1069,10 +1073,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (dto.isDel()) { if (dto.isDel()) {
if ((parentVO.getSource().equals(EBomSourceEnum.FROM_MDM.getValue()) if ((parentVO.getSource().equals(EBomSourceEnum.FROM_MDM.getValue())
|| parentVO.getSource().equals(EBomSourceEnum.FROM_EXCE.getValue()))) { || parentVO.getSource().equals(EBomSourceEnum.FROM_EXCE.getValue()))) {
// deleteBom(dto.getRowId()); // deleteBom(dto.getRowId());
//当前bom下列表数据 //当前bom下列表数据
QueryWrapper<BomNewEbomChildEntity > delWrapper=new QueryWrapper<>(); QueryWrapper<BomNewEbomChildEntity> delWrapper = new QueryWrapper<>();
delWrapper.lambda().eq(BomNewEbomChildEntity::getParentRowId,dto.getRowId()); delWrapper.lambda().eq(BomNewEbomChildEntity::getParentRowId, dto.getRowId());
SpringUtil.getBean(BomNewEbomChildService.class).getBaseMapper().delete(delWrapper); SpringUtil.getBean(BomNewEbomChildService.class).getBaseMapper().delete(delWrapper);
} }
@ -1115,20 +1119,20 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
List<String> sameList=null; List<String> sameList = null;
if (CollectionUtil.isNotEmpty(eBomEdit.childEntities)) { if (CollectionUtil.isNotEmpty(eBomEdit.childEntities)) {
QueryWrapper<BomNewEbomChildEntity > queryWrapper=new QueryWrapper<>(); QueryWrapper<BomNewEbomChildEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(BomNewEbomChildEntity::getParentRowId,dto.getRowId()); queryWrapper.lambda().eq(BomNewEbomChildEntity::getParentRowId, dto.getRowId());
List<BomNewEbomChildEntity> oldChildList= SpringUtil.getBean(BomNewEbomChildService.class).list(queryWrapper); List<BomNewEbomChildEntity> oldChildList = SpringUtil.getBean(BomNewEbomChildService.class).list(queryWrapper);
ebomChildService.saveOrUpdateBatch(eBomEdit.childEntities); ebomChildService.saveOrUpdateBatch(eBomEdit.childEntities);
if(CollUtil.isNotEmpty(oldChildList)) { if (CollUtil.isNotEmpty(oldChildList)) {
//追加里包含相同 //追加里包含相同
List<String> appendList = eBomEdit.childEntities.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()); List<String> appendList = eBomEdit.childEntities.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList());
List<String> oldList = oldChildList.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()); List<String> oldList = oldChildList.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList());
sameList = appendList.stream() sameList = appendList.stream()
.filter(oldList::contains) .filter(oldList::contains)
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -1138,10 +1142,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
//不要异步 //不要异步
computeLevelNumAndRootState(); computeLevelNumAndRootState();
if(CollUtil.isEmpty(sameList)){ if (CollUtil.isEmpty(sameList)) {
return ResultVO.success(); return ResultVO.success();
}else{ } else {
return ResultVO.error(StrUtil.format("导入数据存在重复物料 {}",StrUtil.join(",",sameList))); return ResultVO.error(StrUtil.format("导入数据存在重复物料 {}", StrUtil.join(",", sameList)));
} }
} }
@ -1213,9 +1217,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
* 退回设计,不用判断角色 工艺岗才能看见已复核数据 * 退回设计,不用判断角色 工艺岗才能看见已复核数据
* 1.已发布不能退 * 1.已发布不能退
* 2.被工艺岗位添加的物料不可以退回但是可以被删除只能是当前工艺岗位的用户创建的物料 * 2.被工艺岗位添加的物料不可以退回但是可以被删除只能是当前工艺岗位的用户创建的物料
*
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void revertDesign(BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException { public void revertDesign(BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException {
List<Long> rowIds = dto.getRowIdList(); List<Long> rowIds = dto.getRowIdList();
@ -1254,21 +1257,20 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
revertList.clear(); revertList.clear();
//忽略叶子节点 工艺人员不退回设计 ,只退回设计复核部分 //忽略叶子节点 工艺人员不退回设计 ,只退回设计复核部分
revertList.addAll(bomTreeList.stream() revertList.addAll(bomTreeList.stream()
.filter(u -> (ObjectUtil.isNotNull(u.getBomRowId()) && u.getBomRowId().longValue() > 0 ) .filter(u -> (ObjectUtil.isNotNull(u.getBomRowId()) && u.getBomRowId().longValue() > 0)
&& !ObjectUtil.equal(UserJobEnum.ENGINEER.getValue(),u.getCreatedJob()) && !ObjectUtil.equal(UserJobEnum.ENGINEER.getValue(), u.getCreatedJob())
&& ObjectUtil.equal(EBomStatusEnum.CHECKED.getValue(),u.getStatus()) && ObjectUtil.equal(EBomStatusEnum.CHECKED.getValue(), u.getStatus())
) )
.map(BomNewEbomParentVO::getBomRowId).collect(Collectors.toList())); .map(BomNewEbomParentVO::getBomRowId).collect(Collectors.toList()));
if (CollectionUtil.isNotEmpty(revertList)) { if (CollectionUtil.isNotEmpty(revertList)) {
//parent表状态 //parent表状态
UpdateWrapper<BomNewEbomParentEntity> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<BomNewEbomParentEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.lambda() updateWrapper.lambda()
.set(BomNewEbomParentEntity::getRevertTime, LocalDateTime.now()) .set(BomNewEbomParentEntity::getRevertTime, LocalDateTime.now())
.set(BomNewEbomParentEntity::getRevertUserName, SessionUtil.getUserName()) .set(BomNewEbomParentEntity::getRevertUserName, SessionUtil.getUserName())
.set(BomNewEbomParentEntity::getRevertDesc,dto.getRevertDesc()) .set(BomNewEbomParentEntity::getRevertDesc, dto.getRevertDesc())
.set(BomNewEbomParentEntity::getStatus, EBomStatusEnum.RETURNED.getValue()) .set(BomNewEbomParentEntity::getStatus, EBomStatusEnum.RETURNED.getValue())
.set(BomNewEbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_CREATED.getValue()) .set(BomNewEbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_CREATED.getValue())
.in(BomNewEbomParentEntity::getRowId, revertList); .in(BomNewEbomParentEntity::getRowId, revertList);
@ -1280,24 +1282,22 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
.set(BomNewEbomChildEntity::getEditStatus, EbomEditStatusEnum.HANDLER_CREATED.getValue()) .set(BomNewEbomChildEntity::getEditStatus, EbomEditStatusEnum.HANDLER_CREATED.getValue())
.in(BomNewEbomChildEntity::getParentRowId, revertList); .in(BomNewEbomChildEntity::getParentRowId, revertList);
this.update(updateWrapper ); this.update(updateWrapper);
ebomChildService.update(childWrapper) ; ebomChildService.update(childWrapper);
} }
//更新-待复核根节点 //更新-待复核根节点
// getBaseMapper().updateRootForWaitReview(); // getBaseMapper().updateRootForWaitReview();
} }
} }
/** /**
* 设计复核 * 设计复核
*设计人员只可以复核自己的物料如果存在引用其他用户创建的物料时不可以改变被引用物料的审核状态 * 设计人员只可以复核自己的物料如果存在引用其他用户创建的物料时不可以改变被引用物料的审核状态
* 异常检查 * 异常检查
* 1. 是否存在空物料编号空数量的数据信息; * 1. 是否存在空物料编号空数量的数据信息;
* 2. 是否存在在主数据平台的物料信息没有的数据 * 2. 是否存在在主数据平台的物料信息没有的数据
@ -1306,7 +1306,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
* 5. 项目类别是否填写正确项目类别请参照项目类别自动赋值规则 * 5. 项目类别是否填写正确项目类别请参照项目类别自动赋值规则
* 6. 是否存在已冻结/永久禁用的物料 * 6. 是否存在已冻结/永久禁用的物料
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean designReview(BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException { public Boolean designReview(BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException {
List<Long> rowIds = dto.getRowIdList(); List<Long> rowIds = dto.getRowIdList();
@ -1319,11 +1319,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
//检查顶级bom是否是设计自己 //检查顶级bom是否是设计自己
List<BomNewEbomParentEntity> checkList=bomNewEbomParentEntityList.stream().filter(u->!u.getCreatedBy().equals(SessionUtil.getUserCode())).collect(Collectors.toList()); List<BomNewEbomParentEntity> checkList = bomNewEbomParentEntityList.stream().filter(u -> !u.getCreatedBy().equals(SessionUtil.getUserCode())).collect(Collectors.toList());
if(CollUtil.isNotEmpty(checkList)) { if (CollUtil.isNotEmpty(checkList)) {
String checkListMaterialNo=StrUtil.join(",",checkList.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toList())); String checkListMaterialNo = StrUtil.join(",", checkList.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toList()));
VUtils.isTure(true).throwMessage(StrUtil.format("{} 该节点不属于你,你无权复核",checkListMaterialNo)); VUtils.isTure(true).throwMessage(StrUtil.format("{} 该节点不属于你,你无权复核", checkListMaterialNo));
} }
Set<String> materialNoAndVersion = bomNewEbomParentEntityList.stream().map(u -> StrUtil.join("-", u.getMaterialNo(), u.getCurrentVersion())).collect(Collectors.toSet()); Set<String> materialNoAndVersion = bomNewEbomParentEntityList.stream().map(u -> StrUtil.join("-", u.getMaterialNo(), u.getCurrentVersion())).collect(Collectors.toSet());
@ -1373,8 +1373,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
.set(BomNewEbomParentEntity::getAuditUserName, SessionUtil.getUserName()) .set(BomNewEbomParentEntity::getAuditUserName, SessionUtil.getUserName())
.set(BomNewEbomParentEntity::getStatus, EBomStatusEnum.CHECKED.getValue()) .set(BomNewEbomParentEntity::getStatus, EBomStatusEnum.CHECKED.getValue())
.set(BomNewEbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_FINISHED.getValue()) .set(BomNewEbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_FINISHED.getValue())
.set(BomNewEbomParentEntity::getRootIsForWaitReview,0) .set(BomNewEbomParentEntity::getRootIsForWaitReview, 0)
.set(BomNewEbomParentEntity::getRevertDesc,"") .set(BomNewEbomParentEntity::getRevertDesc, "")
.in(BomNewEbomParentEntity::getRowId, updateReviewIdList); .in(BomNewEbomParentEntity::getRowId, updateReviewIdList);
@ -1403,13 +1403,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
public Boolean updateProjectType(BomNewEbomProjectTypeDTO dto) { public Boolean updateProjectType(BomNewEbomProjectTypeDTO dto) {
List<Long> rowIdList = dto.getRowIdList().stream().map(BomNewEbomProjectTypeDTO.BomNewEbomChangeProjectType::getRowId).collect(Collectors.toList()); List<Long> rowIdList = dto.getRowIdList().stream().map(BomNewEbomProjectTypeDTO.BomNewEbomChangeProjectType::getRowId).collect(Collectors.toList());
List<Long> bomRowIdList = dto.getRowIdList().stream().filter(u -> u.getBomRowId() > 0).map(BomNewEbomProjectTypeDTO.BomNewEbomChangeProjectType::getBomRowId).collect(Collectors.toList()); List<Long> bomRowIdList = dto.getRowIdList().stream().filter(u -> u.getBomRowId() > 0).map(BomNewEbomProjectTypeDTO.BomNewEbomChangeProjectType::getBomRowId).collect(Collectors.toList());
// if (CollectionUtil.isNotEmpty(bomRowIdList)) { // if (CollectionUtil.isNotEmpty(bomRowIdList)) {
// UpdateWrapper<BomNewEbomParentEntity> parentUpdate = new UpdateWrapper<>(); // UpdateWrapper<BomNewEbomParentEntity> parentUpdate = new UpdateWrapper<>();
// parentUpdate.lambda() // parentUpdate.lambda()
@ -1505,7 +1502,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
BomNewEbomChildEntity childEntity = null; BomNewEbomChildEntity childEntity = null;
@ -1520,18 +1516,15 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (childEntity != null) { if (childEntity != null) {
//编辑查询物料id未变化 //编辑查询物料id未变化
if (childEntity.getMaterialNo().equals(materialMainEntity.getMaterialNo()) || childEntity.getDrawingNo().equals(materialMainEntity.getDrawingNo())) { if (childEntity.getMaterialNo().equals(materialMainEntity.getMaterialNo()) || childEntity.getDrawingNo().equals(materialMainEntity.getDrawingNo())) {
BeanUtil.copyProperties(childEntity, baseMaterialVO); BeanUtil.copyProperties(childEntity, baseMaterialVO);
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(ImmutableList.of(baseMaterialVO),EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2); SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(ImmutableList.of(baseMaterialVO), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
return baseMaterialVO; return baseMaterialVO;
} }
} }
//编辑数据 新增或物料编码已变化 //编辑数据 新增或物料编码已变化
BomNewEbomParentEntity bomParent = null; BomNewEbomParentEntity bomParent = null;
if (query.getBomRowId() != null && query.getBomRowId().longValue() != 0) { if (query.getBomRowId() != null && query.getBomRowId().longValue() != 0) {
@ -1540,7 +1533,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
BeanUtil.copyProperties(materialMainEntity, baseMaterialVO); BeanUtil.copyProperties(materialMainEntity, baseMaterialVO);
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(ImmutableList.of(baseMaterialVO)); SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(ImmutableList.of(baseMaterialVO));
//继承bom的状态 //继承bom的状态
if (bomParent != null) { if (bomParent != null) {
baseMaterialVO.setEditStatus(bomParent.getEditStatus()); baseMaterialVO.setEditStatus(bomParent.getEditStatus());
baseMaterialVO.setStatus(bomParent.getStatus()); baseMaterialVO.setStatus(bomParent.getStatus());
@ -1563,12 +1556,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (StrUtil.isNotBlank(materialMainEntity.getMaterialWeight())) { if (StrUtil.isNotBlank(materialMainEntity.getMaterialWeight())) {
baseMaterialVO.setUnitWeight(new BigDecimal(materialMainEntity.getMaterialWeight())); baseMaterialVO.setUnitWeight(new BigDecimal(materialMainEntity.getMaterialWeight()));
} }
if(ObjectUtil.isNull(baseMaterialVO.getNum())){ if (ObjectUtil.isNull(baseMaterialVO.getNum())) {
baseMaterialVO.setNum(new BigDecimal(1)); baseMaterialVO.setNum(new BigDecimal(1));
} }
if (StrUtil.isNotBlank(baseMaterialVO.getMaterialNo()) if (StrUtil.isNotBlank(baseMaterialVO.getMaterialNo())
&& (MaterialGetEnum.MaterialStateEnum.STATE_NO_4.equalsValue(baseMaterialVO.getMaterialState()) && (MaterialGetEnum.MaterialStateEnum.STATE_NO_4.equalsValue(baseMaterialVO.getMaterialState())
|| MaterialGetEnum.MaterialStateEnum.STATE_NO_5.equalsValue(baseMaterialVO.getMaterialState()))) { || MaterialGetEnum.MaterialStateEnum.STATE_NO_5.equalsValue(baseMaterialVO.getMaterialState()))) {
@ -1604,9 +1596,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean deleteBom(Long bomRowId) throws ExecutionException, InterruptedException { public Boolean deleteBom(Long bomRowId) throws ExecutionException, InterruptedException {
QueryWrapper<BomNewEbomParentEntity> queryWrapper=new QueryWrapper<>(); QueryWrapper<BomNewEbomParentEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda() .eq(BomNewEbomParentEntity::getRowId, bomRowId) queryWrapper.lambda().eq(BomNewEbomParentEntity::getRowId, bomRowId)
.eq(BomNewEbomParentEntity::getUserRootIs, 1); .eq(BomNewEbomParentEntity::getUserRootIs, 1);
BomNewEbomParentEntity parentEntity = this.getBaseMapper().selectOne(queryWrapper); BomNewEbomParentEntity parentEntity = this.getBaseMapper().selectOne(queryWrapper);
@ -1632,19 +1624,19 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) { if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
//取bom信息删除 //取bom信息删除
List<Long> parentList= eBomDel.getDelEBom().stream().filter(u -> (ObjectUtil.isNotNull(u.getBomRowId()) && u.getBomRowId() > 0)) List<Long> parentList = eBomDel.getDelEBom().stream().filter(u -> (ObjectUtil.isNotNull(u.getBomRowId()) && u.getBomRowId() > 0))
.map(BomNewEbomParentVO::getBomRowId).collect(Collectors.toList()); .map(BomNewEbomParentVO::getBomRowId).collect(Collectors.toList());
List<Long> childList= eBomDel.getDelEBom().stream().filter(u -> (ObjectUtil.isNull(u.getBomRowId()) || u.getBomRowId().longValue()==0l)) List<Long> childList = eBomDel.getDelEBom().stream().filter(u -> (ObjectUtil.isNull(u.getBomRowId()) || u.getBomRowId().longValue() == 0l))
.map(BomNewEbomParentVO::getRowId).collect(Collectors.toList()); .map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
if(CollUtil.isNotEmpty(parentList)) { if (CollUtil.isNotEmpty(parentList)) {
this.getBaseMapper().delBatch(parentList); this.getBaseMapper().delBatch(parentList);
} }
// QueryWrapper<BomNewEbomParentEntity> parentWrapper=new QueryWrapper<>(); // QueryWrapper<BomNewEbomParentEntity> parentWrapper=new QueryWrapper<>();
// parentWrapper.lambda().in(BomNewEbomParentEntity::getRowId,parentList); // parentWrapper.lambda().in(BomNewEbomParentEntity::getRowId,parentList);
// //
if(CollUtil.isNotEmpty(childList)) { if (CollUtil.isNotEmpty(childList)) {
QueryWrapper<BomNewEbomChildEntity> childWrapper = new QueryWrapper<>(); QueryWrapper<BomNewEbomChildEntity> childWrapper = new QueryWrapper<>();
childWrapper.lambda().in(BomNewEbomChildEntity::getRowId, childList); childWrapper.lambda().in(BomNewEbomChildEntity::getRowId, childList);
// //
@ -1653,7 +1645,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
}else{ } else {
VUtils.isTure(true).throwMessage("该bom下没有你删除的数据"); VUtils.isTure(true).throwMessage("该bom下没有你删除的数据");
} }
@ -1665,11 +1657,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) { if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
//ThreadUtil.execAsync(() -> computeLevelNumAndRootState()); //ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
computeLevelNumAndRootState(); computeLevelNumAndRootState();
} }
return true; return true;
@ -1705,11 +1696,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
void checkUserRoleAuth(String bomCreatedBy){ void checkUserRoleAuth(String bomCreatedBy) {
//1.设计岗操作自己数据 //1.设计岗操作自己数据
//2.工艺人员可以修改自己创建的或是已通过设计复核的数据工艺岗能看见设计岗数据必定是已复核或双角色岗设计+工艺 //2.工艺人员可以修改自己创建的或是已通过设计复核的数据工艺岗能看见设计岗数据必定是已复核或双角色岗设计+工艺
if(!SpringUtil.getBean(UserRoleService.class).technician()){ if (!SpringUtil.getBean(UserRoleService.class).technician()) {
if(!bomCreatedBy.equals(SessionUtil.getUserCode())){ if (!bomCreatedBy.equals(SessionUtil.getUserCode())) {
VUtils.isTure(true).throwMessage("该节点不属于你,你无权操作"); VUtils.isTure(true).throwMessage("该节点不属于你,你无权操作");
} }
} }
@ -1717,9 +1708,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
/** /**
* 暂存 * 暂存
* <p> * <p>
@ -1733,7 +1721,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
checkUserRoleAuth(dto.getParent().getCreatedBy()); checkUserRoleAuth(dto.getParent().getCreatedBy());
//暂存数据为空后面不处理 //暂存数据为空后面不处理
if (CollUtil.isEmpty(dto.getDatas())) { if (CollUtil.isEmpty(dto.getDatas())) {
return dto.getParent(); return dto.getParent();
@ -1745,11 +1732,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
eBomEdit.handleBom(dto); eBomEdit.handleBom(dto);
if (eBomEdit.getParentEntity() != null) { if (eBomEdit.getParentEntity() != null) {
eBomEdit.nextVersion(); eBomEdit.nextVersion();
this.saveOrUpdate(eBomEdit.getParentEntity()); this.saveOrUpdate(eBomEdit.getParentEntity());
} }
@ -1771,8 +1756,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
BomNewEbomParentVO retParentVO = Convert.convert(BomNewEbomParentVO.class, eBomEdit.getParentEntity()); BomNewEbomParentVO retParentVO = Convert.convert(BomNewEbomParentVO.class, eBomEdit.getParentEntity());
retParentVO.setBomRowId(retParentVO.getRowId()); retParentVO.setBomRowId(retParentVO.getRowId());
@ -1789,7 +1772,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
checkUserRoleAuth(dto.getParent().getCreatedBy()); checkUserRoleAuth(dto.getParent().getCreatedBy());
//无提交数据后面不处理 //无提交数据后面不处理
if (CollUtil.isEmpty(dto.getDatas())) { if (CollUtil.isEmpty(dto.getDatas())) {
return true; return true;
@ -1847,18 +1829,18 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
/** /**
* 1. 编辑页面的删除只是删除BOM的关联关系 * 1. 编辑页面的删除只是删除BOM的关联关系
* 2. 删除规则 * 2. 删除规则
* 从原始Bom导入的数据数据没有异常的情况下用户不可以删除 * 从原始Bom导入的数据数据没有异常的情况下用户不可以删除
* 用户可以直接删除用户单击暂存或是提交时才会保存至数据库 * 用户可以直接删除用户单击暂存或是提交时才会保存至数据库
*/ */
public void deleteBomChild(List<BomNewEbomParentVO> delList) { public void deleteBomChild(List<BomNewEbomParentVO> delList) {
if(CollUtil.isEmpty(delList)){ if (CollUtil.isEmpty(delList)) {
return; return;
} }
List<Long> rowIds=delList.stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList()); List<Long> rowIds = delList.stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
QueryWrapper<BomNewEbomChildEntity> queryChildWrapper=new QueryWrapper<>(); QueryWrapper<BomNewEbomChildEntity> queryChildWrapper = new QueryWrapper<>();
queryChildWrapper.lambda().in(BomNewEbomChildEntity::getRowId,rowIds); queryChildWrapper.lambda().in(BomNewEbomChildEntity::getRowId, rowIds);
List<BomNewEbomChildEntity> delChildList=SpringUtil.getBean(BomNewEbomChildService.class).list(queryChildWrapper); List<BomNewEbomChildEntity> delChildList = SpringUtil.getBean(BomNewEbomChildService.class).list(queryChildWrapper);
List<BomNewEbomChildEntity> delTagList = new ArrayList<>(); List<BomNewEbomChildEntity> delTagList = new ArrayList<>();
@ -1867,7 +1849,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
&& Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList()); && Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(check1List)) { if (CollUtil.isNotEmpty(check1List)) {
throw new NflgBusinessException(STATE.Error,StrUtil.format("从原始Bom导入的数据数据没有异常的情况下{} 不可以删除 ",StrUtil.join(",", check1List.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()) ))); throw new NflgBusinessException(STATE.Error, StrUtil.format("从原始Bom导入的数据数据没有异常的情况下{} 不可以删除 ", StrUtil.join(",", check1List.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()))));
} }
//检查有bom数据关系是否可以删 //检查有bom数据关系是否可以删
@ -1879,7 +1861,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
// } // }
//原始bom不正常 //原始bom不正常
List<BomNewEbomChildEntity> s1List = delChildList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource()) List<BomNewEbomChildEntity> s1List = delChildList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource())
&& !Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList()); && !Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList());
@ -1895,16 +1876,16 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
// 设计自己删除自己 // 设计自己删除自己
//工艺岗用户1 可以删工艺岗用户2 的数据 //工艺岗用户1 可以删工艺岗用户2 的数据
if (CollectionUtil.isNotEmpty(s2List)) { if (CollectionUtil.isNotEmpty(s2List)) {
for (BomNewEbomChildEntity vo: for (BomNewEbomChildEntity vo :
s2List) { s2List) {
if( userRoleService.technician() ){ //工艺岗可删 if (userRoleService.technician()) { //工艺岗可删
delTagList.add(vo); delTagList.add(vo);
}else if ( userRoleService.designer() && vo.getCreatedBy().equals(SessionUtil.getUserCode())){ //自己的数据可删 } else if (userRoleService.designer() && vo.getCreatedBy().equals(SessionUtil.getUserCode())) { //自己的数据可删
delTagList.add(vo); delTagList.add(vo);
}else{ } else {
throw new NflgBusinessException(STATE.Error,StrUtil.format("{}数据不是你的,无权删除",vo.getMaterialNo())); throw new NflgBusinessException(STATE.Error, StrUtil.format("{}数据不是你的,无权删除", vo.getMaterialNo()));
} }
} }
} }
@ -1919,7 +1900,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
/** /**
* 变更物料 * 变更物料
* 全量更新目前编辑页面的物料信息可以理解为同步主数据的物料信息到此处更新物料的状态并根据物料的状态更新异常情况 * 全量更新目前编辑页面的物料信息可以理解为同步主数据的物料信息到此处更新物料的状态并根据物料的状态更新异常情况
*/ */

View File

@ -114,6 +114,30 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
return result; return result;
} }
/**
* 获取父级图号包含查询的图号
* @param drawingNos
* @return
*/
public List<String> getParentMaterialByDrawingNo(List<String> drawingNos) {
Set<String> result = new HashSet<>();
result.addAll(drawingNos);
Set<String> useMaterialSku = this.getBaseMapper().getMaterialParent(drawingNos);
while (CollUtil.isNotEmpty(useMaterialSku)) {
//防止数据错误循环依赖-死循环
Set<String> difference = Sets.difference(useMaterialSku, result);
if (CollUtil.isNotEmpty(difference)) {
useMaterialSku = this.getBaseMapper().getMaterialParent(difference);
result.addAll(difference);
} else {
break;
}
}
return new ArrayList<>(result);
}
private Page<BomOriginalListVO> handSeachToTree(List<BomOriginalListVO> parents, List<BomOriginalListVO> childs) { private Page<BomOriginalListVO> handSeachToTree(List<BomOriginalListVO> parents, List<BomOriginalListVO> childs) {
Page<BomOriginalListVO> resutlData = new Page<>(); Page<BomOriginalListVO> resutlData = new Page<>();
Set<String> parentSet = parents.stream().map(u -> u.getDrawingNo()).collect(Collectors.toSet()); Set<String> parentSet = parents.stream().map(u -> u.getDrawingNo()).collect(Collectors.toSet());
@ -162,12 +186,12 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
// if(query.getStatus().equals(1) && CollUtil.isEmpty(materialBoms)){ // if(query.getStatus().equals(1) && CollUtil.isEmpty(materialBoms)){
// return result; // return result;
// } // }
List<String> parentDrawingNos = new ArrayList<>(getParentDrawingNoByMaterialNo(queryDrawingNos)); List<String> parentDrawingNos = new ArrayList<>(getParentMaterialByDrawingNo(queryDrawingNos));
parentDrawingNos.addAll(queryDrawingNos); // parentDrawingNos.addAll(queryDrawingNos);
if (CollUtil.isNotEmpty(parentDrawingNos)) { if (CollUtil.isNotEmpty(parentDrawingNos)) {
List<BomOriginalListVO> parents = this.getBaseMapper().getParentForDrawingNoSeach(parentDrawingNos, query.getStatus()); List<BomOriginalListVO> parents = this.getBaseMapper().getParentForDrawingNoSeach(parentDrawingNos, query.getStatus());
materialMainService.intiMaterialInfo(parents, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT); materialMainService.intiMaterialInfo(parents, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
List<BomOriginalListVO> childs = this.getBaseMapper().getChildForDrawingNoSeach(parentDrawingNos,query.getStatus()); List<BomOriginalListVO> childs = this.getBaseMapper().getChildForDrawingNoSeach(parentDrawingNos,parents.stream().map(u->u.getRowId()).collect(Collectors.toSet()));
materialMainService.intiMaterialInfo(childs, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT); materialMainService.intiMaterialInfo(childs, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
childs.stream().filter(f -> StrUtil.isBlank(f.getCurrentVersion())).forEach(f -> { childs.stream().filter(f -> StrUtil.isBlank(f.getCurrentVersion())).forEach(f -> {
if (MaterialshouldBomExistUtil.checkShouldBomExist(f.getMaterialCategoryCode(), f.getMaterialGetType())) { if (MaterialshouldBomExistUtil.checkShouldBomExist(f.getMaterialCategoryCode(), f.getMaterialGetType())) {
@ -499,6 +523,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
* *
* @return * @return
*/ */
@Transactional(rollbackFor = Exception.class)
public List<ImportOriginalBomVO> convertToEBom(List<Long> bomRowIds) throws ExecutionException, InterruptedException { public List<ImportOriginalBomVO> convertToEBom(List<Long> bomRowIds) throws ExecutionException, InterruptedException {
List<BomNewOriginalParentEntity> bomNewOriginalParentEntities = this.getBaseMapper().selectBatchIds(bomRowIds); List<BomNewOriginalParentEntity> bomNewOriginalParentEntities = this.getBaseMapper().selectBatchIds(bomRowIds);
@ -522,13 +547,13 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
try { try {
convertToEBomDo(parent, ebomRowId); convertToEBomDo(parent, ebomRowId);
//更新并保存异常信息
ebomParentService.checkAndSaveEBomException(ebomRowId);
} catch (Exception e) { } catch (Exception e) {
importOriginalBomVOList.add(new ImportOriginalBomVO(parent.getDrawingNo(), "操作失败:" + e.getMessage())); importOriginalBomVOList.add(new ImportOriginalBomVO(parent.getDrawingNo(), "操作失败:" + e.getMessage()));
throw e;
} }
//更新并保存异常信息
ebomParentService.checkAndSaveEBomException(ebomRowId);
} }
return importOriginalBomVOList; return importOriginalBomVOList;
} }

View File

@ -39,7 +39,7 @@ public class VirtualPackageFor21 extends VirtualPackageBase {
BomNewEbomParentEntity parent = getParentByRowId(bomRowId); BomNewEbomParentEntity parent = getParentByRowId(bomRowId);
BomNewEbomParentVO vo= Convert.convert(BomNewEbomParentVO.class,parent ); BomNewEbomParentVO vo= Convert.convert(BomNewEbomParentVO.class,parent );
if(virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (parent.getVirtrualPackageEnum()| VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue())!=VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()){ if(virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (parent.getVirtrualPackageEnum()&VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue())!= VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()){
generateVMNoF21(parent.getDrawingNo(), ImmutableList.of(vo),VirtualPackageTypeEnum.MAKING_PACKAGE, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE,VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE); generateVMNoF21(parent.getDrawingNo(), ImmutableList.of(vo),VirtualPackageTypeEnum.MAKING_PACKAGE, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE,VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
} }
else { else {
@ -58,7 +58,7 @@ public class VirtualPackageFor21 extends VirtualPackageBase {
buildChild(directDeliveryPackage, bomRowId, "002", VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE,parent.getMaterialNo()); buildChild(directDeliveryPackage, bomRowId, "002", VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE,parent.getMaterialNo());
} }
if(virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (parent.getVirtrualPackageEnum()| VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue())!=VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) { if(virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (parent.getVirtrualPackageEnum()& VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue())!=VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) {
//构建构建发货前装配包 //构建构建发货前装配包
if(Objects.isNull(makingPackage)){ if(Objects.isNull(makingPackage)){
makingPackage=getParentZhiZuo(parent.getDrawingNo()); makingPackage=getParentZhiZuo(parent.getDrawingNo());

View File

@ -226,8 +226,9 @@
</update> </update>
<!--更新-待复核根节点--> <!--更新-待复核根节点-->
<update id="updateRootForWaitReview"> <update id="updateRootForWaitReview">
update t_bom_new_ebom_parent set root_is_for_wait_review=0 ;
update t_bom_new_ebom_parent a left join ( update t_bom_new_ebom_parent a left join (
select b.row_id, b.material_no,a.`status` from t_bom_new_ebom_parent a join t_bom_new_ebom_child b on a.row_id=b.parent_row_id and a.`status` =2 select b.row_id, b.material_no,a.`status` from t_bom_new_ebom_parent a join t_bom_new_ebom_child b on a.row_id=b.parent_row_id and a.`status` in(1,3) and last_version_is=1
) b on a.material_no=b.material_no ) b on a.material_no=b.material_no
set a.root_is_for_wait_review=1 set a.root_is_for_wait_review=1
where a.`status` in (1,3) and last_version_is=1 and b.row_id is null ; where a.`status` in (1,3) and last_version_is=1 and b.row_id is null ;

View File

@ -192,40 +192,60 @@
<!--物料编码搜索-父级--> <!--物料编码搜索-父级-->
<select id="getParentForDrawingNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomOriginalListVO"> <select id="getParentForDrawingNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomOriginalListVO">
SELECT if(#{state}=1 and status=2,3,status) as status, created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.* SELECT status , created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*
FROM t_bom_new_original_parent a where 1=1 FROM t_bom_new_original_parent a
<!-- <if test="state==1">--> join (select drawing_no,max(current_version) current_version from t_bom_new_original_parent where status=#{state}
<!-- and a.last_version_is=1--> and drawing_no in
<!-- <if test="InHasConvertBomIs">-->
<!-- and a.status=1-->
<!-- </if>-->
<!-- </if>-->
<if test="state==2">
and current_version in ( select current_version from t_bom_new_original_parent where status &gt;1 and drawing_no in
<foreach collection="drawingNos" item="item" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
and drawing_no in
<foreach collection="drawingNos" item="item" open="(" separator="," close=")"> <foreach collection="drawingNos" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
group by drawing_no ) b on a.drawing_no=b.drawing_no and a.current_version=b.current_version
order by created_time desc order by created_time desc
</select> </select>
<!--物料编码搜索-子级--> <!--物料编码搜索-子级-->
<select id="getChildForDrawingNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomOriginalListVO"> <select id="getChildForDrawingNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomOriginalListVO">
select if(#{state}=1 and c.status=2,3,c.status) as status ,c.current_version , c.created_by as bomCreatedBy select a.status ,a.current_version , a.created_by as bomCreatedBy,
,IFNULL(c.devise_name,a.devise_name) as devise_name,IFNULL(c.devise_user_code,a.devise_user_code) AS devise_user_code a.devise_name ,a.devise_user_code
,IFNULL(c.dept_name,a.dept_name) AS dept_name,IFNULL(c.source,a.source) AS source,IFNULL(c.row_id,"0") as bomRowId ,a.dept_name,a.source,ifnull( a.row_id,0) as bomRowId
,IFNULL(c.row_id,"0") as childBomRowId, b.* ,ifnull( a.row_id,0) as childBomRowId, b.* from t_bom_new_original_child b
from t_bom_new_original_parent a left join t_bom_new_original_parent a on a.drawing_no=b.drawing_no and a.row_id in
join t_bom_new_original_child b on a.row_id =b.parent_row_id <foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
left join t_bom_new_original_parent c on b.drawing_no=c.drawing_no and c.last_version_is=1 #{item}
where a.last_version_is=1 and b.drawing_no in </foreach>
where b.parent_row_id in
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and b.drawing_no in
<foreach collection="drawingNos" item="item" open="(" separator="," close=")"> <foreach collection="drawingNos" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</select> </select>
<!-- &lt;!&ndash;物料编码搜索-子级&ndash;&gt;-->
<!-- <select id="getChildForDrawingNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomOriginalListVO">-->
<!-- select c.status ,c.current_version , c.created_by as bomCreatedBy-->
<!-- ,IFNULL(c.devise_name,a.devise_name) as devise_name,IFNULL(c.devise_user_code,a.devise_user_code) AS devise_user_code-->
<!-- ,IFNULL(c.dept_name,a.dept_name) AS dept_name,IFNULL(c.source,a.source) AS source,IFNULL(c.row_id,"0") as bomRowId-->
<!-- ,IFNULL(c.row_id,"0") as childBomRowId, b.*-->
<!-- from t_bom_new_original_parent a-->
<!-- join t_bom_new_original_child b on a.row_id =b.parent_row_id-->
<!-- left join t_bom_new_original_parent c on b.drawing_no=c.drawing_no and c.last_version_is=1-->
<!-- where a.last_version_is=1 and b.drawing_no in-->
<!-- <foreach collection="drawingNos" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </select>-->
<!--获取父级图号-->
<select id="getMaterialParent" resultType="java.lang.String">
select a.drawing_no from t_bom_new_original_parent a join t_bom_new_original_child b on a.row_id=b.parent_row_id
where a.last_version_is=1
and b.drawing_no in
<foreach collection="drawingNos" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper> </mapper>

View File

@ -1,6 +1,7 @@
package nflg.product.common.dto; package nflg.product.common.dto;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors;
//import org.omg.CORBA.PRIVATE_MEMBER; //import org.omg.CORBA.PRIVATE_MEMBER;
import java.util.List; import java.util.List;
@ -11,6 +12,7 @@ import java.util.List;
* @Date 2022/7/14 10:38 * @Date 2022/7/14 10:38
**/ **/
@Data @Data
@Accessors(chain = true)
public class LoginUserInfoDTO { public class LoginUserInfoDTO {
private Long rowId; private Long rowId;