主物料类别

This commit is contained in:
jing's 2023-12-24 19:42:43 +08:00
parent 9535d8d1df
commit 0f795e71fd
4 changed files with 120 additions and 102 deletions

View File

@ -274,7 +274,7 @@ public class EbomApi extends BaseApi {
@ApiOperation("删除物料")
public ResultVO<Boolean> deleteBom(@RequestParam("bomRowId") Long bomRowId ) throws ExecutionException, InterruptedException{
bomNewEbomParentService.deleteBom(bomRowId);
bomNewEbomParentService.computeLevelNumAndRootState();
return ResultVO.success(true);
}

View File

@ -55,4 +55,9 @@ public class BaseMaterialVO {
@ApiModelProperty("物料大类别")
private String relCategoryCode;
@ApiModelProperty("物料分类编码名称")
private String categoryName;
}

View File

@ -203,6 +203,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
/**
* 获取变更影响
*
* @param query
* @return
*/
@ -213,8 +214,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
/**
* 获取子级
*
@ -233,16 +232,23 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
for (BomNewEbomParentVO child : parentChild) {
if (bomListMap.containsKey(child.getMaterialNo())) {
BomNewEbomParentEntity parentEntity = bomListMap.get(child.getMaterialNo());
child.setCurrentVersion(parentEntity.getCurrentVersion());
child.setStatus(parentEntity.getStatus());
child.setDeviseName(parentEntity.getDeviseName());
child.setDeviseUserCode(parentEntity.getDeviseUserCode());
//child.setCreatedBy(parentEntity.getCreatedBy());
child.setCreatedTime(parentEntity.getCreatedTime());
child.setBomRowId(parentEntity.getRowId());
child.setLevelNum(parentEntity.getLevelNum());
child.setDeptName(parentEntity.getDeptName());
child.setSource(parentEntity.getSource());
child.setBomExist(parentEntity.getBomExist());
child.setShouldBomExist(parentEntity.getShouldBomExist());
if (parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) {
child.setStatus(OriginalStatusEnum.BORROWED_PARTS.getValue());
}
@ -481,7 +487,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
if (CollUtil.isNotEmpty(eBomToPBom.getUpgradeChangeResult())) {
upgradeChangeService.saveOrUpdateBatch(eBomToPBom.getUpgradeChangeResult());
};
}
;
if (CollUtil.isNotEmpty(eBomToPBom.getHasConvertEBomRowIds())) {
this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), eBomToPBom.getHasConvertEBomRowIds());
}
@ -581,6 +588,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
// CompletableFuture.runAsync(() -> {
try {
this.getBaseMapper().updateRootState();
ebomChildService.getBaseMapper().updateEBomMaterialUse();
this.compucteLevelNum();
} catch (Exception e) {
@ -830,6 +838,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
/**
* 更新项目类型
*
* @return
*/
public Boolean updateProjectType(BomNewEbomProjectTypeDTO dto) {
@ -850,15 +859,14 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
public BomNewEbomEditDetailVO editDetail(Long bomRowId) {
BomNewEbomEditDetailVO vo = new BomNewEbomEditDetailVO();
BomNewEbomParentEntity parent = this.getById(bomRowId);
BomNewEbomParentVO parentVO = Convert.convert(BomNewEbomParentVO.class, parent);
parentVO.setBomRowId(parentVO.getRowId());
parentVO.setParentRowId(0l);
materialMainService.intiMaterialInfo(ImmutableList.of(parentVO));
// List<BomNewEbomParentVO> parentList = new ArrayList<>();
// parentList.add(parentVO);
// materialMainService.intiMaterialInfo(parentList);
@ -898,7 +906,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
BomNewEbomParentVO baseMaterialVO = new BomNewEbomParentVO();
BeanUtil.copyProperties(materialMainEntity, baseMaterialVO);
baseMaterialVO.setExceptionStatus(materialMainEntity.getMaterialState());
return baseMaterialVO;
}
@ -917,11 +924,12 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
* 3. 如果是借用件的节点不能删除
* 4. 如果存在其它用户创建的节点不可以删除
* 5. 如果是工艺岗位角色的时候只能删除自己在EBOM中创建的数据
*
* @return
* @throws ExecutionException
* @throws InterruptedException
*/
@Transactional(rollbackFor = Exception.class)
public Boolean deleteBom(Long bomRowId) throws ExecutionException, InterruptedException {
BomNewEbomParentEntity parentEntity = this.getBaseMapper().selectById(bomRowId);
@ -942,9 +950,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|| EBomStatusEnum.PUBLISHED.equalsValue(u.getStatus())))
.collect(Collectors.toList());
//借用件不能删除原始bom转换只能自己
List<BomNewEbomParentVO> obomList = null;
if (userRoleService.designer()) {
@ -969,6 +974,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (CollUtil.isNotEmpty(delParentRowId)) {
this.getBaseMapper().delBatch(delParentRowId);
}
computeLevelNumAndRootState();
}
@ -978,7 +988,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
SpringUtil.getBean(BomNewOriginalParentService.class).revertBom(rowIds);
}
return true;
}
@ -999,20 +1008,20 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (CollUtil.isNotEmpty(eBomEdit.childEntities)) {
ebomChildService.saveOrUpdateBatch(eBomEdit.childEntities);
ebomChildService.getBaseMapper().updateEBomMaterialUse();
}
if (dto.getParent() != null) {
if (dto.getParent() != null) {
deleteBomChild(dto.getDelDatas());
}
}
ebomChildService.getBaseMapper().updateEBomMaterialUse();
return true;
}
/**
* 提交物料
*
* <p>
* 1.
*/
public Boolean submit(BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
@ -1043,19 +1052,20 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
checkEBomException.checkContainExcept(checkStatus);
if (CollectionUtil.isNotEmpty(eBomEdit.parentEntities)) {
this.saveOrUpdateBatch(eBomEdit.parentEntities);
}
if (CollectionUtil.isNotEmpty(eBomEdit.childEntities)) {
ebomChildService.saveOrUpdateBatch(eBomEdit.childEntities);
}
if (dto.getParent() != null) {
deleteBomChild(dto.getDelDatas());
}
ebomChildService.getBaseMapper().updateEBomMaterialUse();
return true;
}
@ -1087,12 +1097,15 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (CollectionUtil.isNotEmpty(delTagList)) {
List<Long> rowIdList = delTagList.stream().filter(u -> u.getRowId() != null || u.getRowId().longValue() > 0).map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(rowIdList)) {
ebomChildService.removeByIds(rowIdList);
}
}
}
}

View File

@ -71,7 +71,7 @@
<select id="getMaterialBaseInfo" resultType="com.nflg.product.bomnew.pojo.vo.BaseMaterialVO">
select a.row_id as materialRowId, material_no, material_name, material_desc, procure_type, project_type, material_state,drawing_no,a.material_category_code ,material_get_type,drawing_no
,material_texture as material ,material_texture , b.rel_category_code
,material_texture as material ,material_texture , b.rel_category_code,b.category_name
from t_material_main a join t_material_category b on a.material_category_code=b.category_code
where material_no in
<foreach collection="materialNos" item="item" open="(" close=")" separator=",">