【工艺路线】获取PBOM所有子级,保存校验

This commit is contained in:
10001392 2024-11-26 16:36:28 +08:00
parent 07b313d9e2
commit 587a3d6eda
4 changed files with 44 additions and 14 deletions

View File

@ -107,7 +107,10 @@ public class BomNewPBomVO extends BaseMaterialVO {
}else { }else {
return expireEndTime; return expireEndTime;
} }
} }
private String parentMaterialNo;
private String parentMaterialDesc;
} }

View File

@ -85,4 +85,7 @@ public class ProcessRouteTaskVO extends BaseMaterialVO implements Serializable {
// 组件分配列表 // 组件分配列表
private List<ProcessRouteTaskAssemblyVO> assemblyVOList; private List<ProcessRouteTaskAssemblyVO> assemblyVOList;
// 保存类型 tempSave 不校验 validSave 校验
private String saveType;
} }

View File

@ -92,11 +92,25 @@ public class ProcessRouteTaskService extends ServiceImpl<ProcessRouteTaskMapper,
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(ProcessRouteTaskVO processRouteTaskVO) { public void save(ProcessRouteTaskVO processRouteTaskVO) {
if (ObjectUtil.isEmpty(processRouteTaskVO.getFactory())) { if (!"tempSave".equals(processRouteTaskVO.getSaveType())) {
throw new NflgBusinessException(STATE.ParamErr, "工厂不能为空"); if (ObjectUtil.isEmpty(processRouteTaskVO.getFactory())) {
} throw new NflgBusinessException(STATE.ParamErr, "工厂不能为空");
if (ObjectUtil.isEmpty(processRouteTaskVO.getMaterialNo())) { }
throw new NflgBusinessException(STATE.ParamErr, "物料号不能为空"); if (ObjectUtil.isEmpty(processRouteTaskVO.getMaterialNo())) {
throw new NflgBusinessException(STATE.ParamErr, "物料号不能为空");
}
if (ObjectUtil.isEmpty(processRouteTaskVO.getUsefulness())) {
throw new NflgBusinessException(STATE.ParamErr, "用途不能为空");
}
if (ObjectUtil.isEmpty(processRouteTaskVO.getStatus())) {
throw new NflgBusinessException(STATE.ParamErr, "状态不能为空");
}
if (CollUtil.isEmpty(processRouteTaskVO.getProcessesVOList())) {
throw new NflgBusinessException(STATE.ParamErr, "工序列表不能为空");
}
if (CollUtil.isEmpty(processRouteTaskVO.getAssemblyVOList())) {
throw new NflgBusinessException(STATE.ParamErr, "组件分配列表不能为空");
}
} }
List<ProcessRouteTaskEntity> existsTaskList = this.lambdaQuery().eq(ProcessRouteTaskEntity::getFactory, processRouteTaskVO.getFactory()) List<ProcessRouteTaskEntity> existsTaskList = this.lambdaQuery().eq(ProcessRouteTaskEntity::getFactory, processRouteTaskVO.getFactory())
.eq(ProcessRouteTaskEntity::getMaterialNo, processRouteTaskVO.getMaterialNo()) .eq(ProcessRouteTaskEntity::getMaterialNo, processRouteTaskVO.getMaterialNo())
@ -178,15 +192,19 @@ public class ProcessRouteTaskService extends ServiceImpl<ProcessRouteTaskMapper,
List<BomNewPBomVO> nodeList = showDataStyle(convertBomList, rootParent.getRowId()); List<BomNewPBomVO> nodeList = showDataStyle(convertBomList, rootParent.getRowId());
for (BomNewPBomVO vo: nodeList) { for (BomNewPBomVO vo: nodeList) {
vo.setBomVersion(rootParent.getCurrentVersion()); vo.setBomVersion(rootParent.getCurrentVersion());
// vo.setDeviseName(parentFormal.getDeviseName());
// vo.setCreatedTime(parentFormal.getCreatedTime());
// vo.setExpireEndTime(parentFormal.getReleaseTime());
// 1040506070大类以及200201小类这些不需要BOM的物料版本号显示B00 by 10002327 241101
// if(MaterialshouldBomExistUtil.checkNoNeedBom(vo) || Objects.equals("T",vo.getProjectType())){
// vo.setCurrentVersion(OriginalConstant.NO_NEED_BOM);
// }
} }
nodesList.addAll(nodeList); nodesList.addAll(nodeList);
if (CollUtil.isNotEmpty(nodesList)) {
nodesList.forEach(item -> {
List<BomNewPBomVO> parents = nodesList.stream().filter(parent -> item.getParentRowId().equals(parent.getRowId())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(parents)) {
item.setParentMaterialNo(parents.get(0).getMaterialNo());
item.setParentMaterialDesc(parents.get(0).getMaterialDesc());
}
});
// 最顶级不返回
nodesList.remove(0);
}
return nodesList; return nodesList;
} }

View File

@ -48,7 +48,13 @@
AND updated_by LIKE concat('%', #{query.updatedBy}, '%') AND updated_by LIKE concat('%', #{query.updatedBy}, '%')
</if> </if>
<if test="query.delFlag != null"> <if test="query.delFlag != null">
AND del_flag = #{delFlag} AND del_flag = #{query.delFlag}
</if>
<if test="query.status != null">
AND `status` = #{query.status}
</if>
<if test="query.usefulness != null">
AND usefulness = #{query.usefulness}
</if> </if>
</where> </where>
</sql> </sql>