ebom 工艺创建bom不能退回

This commit is contained in:
jing's 2024-03-20 11:45:10 +08:00
parent b455c47b3e
commit f179268e14
2 changed files with 25 additions and 12 deletions

View File

@ -1057,8 +1057,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
/**
* 退回设计
* 1.已发布不能退
* 2.被工艺岗位添加的物料不可以退回但是可以被删除只能是当前工艺岗位的用户创建的物料
*
*/
// @Transactional(rollbackFor = Exception.class)
@Transactional(rollbackFor = Exception.class)
public void revertDesign(BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException {
List<Long> rowIds = dto.getRowIdList();
@ -1077,7 +1080,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (rowIds.size() != bomNewEbomParentEntityList.size()) {
// throw new NflgBusinessException(STATE.BusinessError, "选择数据中包含有下级BOM无法进行退回");
VUtils.isTure(true).throwMessage("选择数据中包含有下级BOM无法进行退回");
}
@ -1110,9 +1113,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
//忽略叶子节点
//忽略叶子节点 工艺人员
revertList.addAll(bomTreeList.stream()
.filter(u -> u.getBomRowId() > 0)
.filter(u -> u.getBomRowId() > 0 && Objects.equals(UserJobEnum.ENGINEER.getValue(),u.getCreatedJob()))
.map(BomNewEbomParentVO::getBomRowId).collect(Collectors.toList()));
}
@ -1346,7 +1349,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (StringUtils.isNotEmpty(query.getMaterialNo())) {
materialMainList = materialMainService.lambdaQuery().eq(MaterialMainEntity::getMaterialNo, query.getMaterialNo()).list();
if (CollUtil.isEmpty(materialMainList)) {
throw new NflgBusinessException(STATE.Error, StrUtil.format("{} 物料编码的物料信息不存在", query.getMaterialNo()));
throw new NflgBusinessException(STATE.Error, StrUtil.format("{} 物料编码在主数据不存在", query.getMaterialNo()));
}
if (CollUtil.isNotEmpty(materialMainList) && materialMainList.size() > 1) {
throw new NflgBusinessException(STATE.Error, StrUtil.format("同时存在{}多条相同物料编码的物料信息", query.getMaterialNo()));
@ -1364,12 +1367,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
BomNewEbomParentEntity bomParent = null;
BomNewEbomChildEntity childEntity = null;
if (query.getBomRowId() != null && query.getBomRowId().longValue() != 0) {
bomParent = getById(query.getBomRowId());
}
if (query.getRowId() != null && query.getRowId().longValue() != 0) {
childEntity = SpringUtil.getBean(BomNewEbomChildService.class).getById(query.getRowId());
}
@ -1380,12 +1381,24 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
BomNewEbomParentVO baseMaterialVO = new BomNewEbomParentVO();
if (childEntity != null) {
//编辑查询物料id未变化
if (childEntity.getMaterialNo().equals(materialMainEntity.getMaterialNo()) || childEntity.getDrawingNo().equals(materialMainEntity.getDrawingNo())) {
BeanUtil.copyProperties(childEntity, baseMaterialVO);
if (childEntity.getMaterialNo().equals(materialMainEntity.getMaterialNo())) {
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(ImmutableList.of(baseMaterialVO),EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
return baseMaterialVO;
}
}
//编辑数据 新增或物料编码已变化
BomNewEbomParentEntity bomParent = null;
if (query.getBomRowId() != null && query.getBomRowId().longValue() != 0) {
bomParent = getById(query.getBomRowId());
}
BeanUtil.copyProperties(materialMainEntity, baseMaterialVO);
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(ImmutableList.of(baseMaterialVO));

View File

@ -243,7 +243,7 @@ public class EBomEdit {
dto.getDatas().forEach(k -> {
k.setParentRowId(parentEntity.getRowId());
});
parentEntity.setEditStatus(dto.getOpType());
// parentEntity.setEditStatus(dto.getOpType());
}else{
parentEntity = Convert.convert(BomNewEbomParentEntity.class, dto.getParent());