1-pbom-优化

This commit is contained in:
luoliming 2024-08-11 15:17:38 +08:00
parent a0fdabd88f
commit 7db0f7555e
5 changed files with 30 additions and 7 deletions

View File

@ -173,7 +173,7 @@ public class OriginalBomApi extends BaseApi {
//跟新EBom 根节点 //跟新EBom 根节点
// ebomParentService.getBaseMapper().updateRootState(); // ebomParentService.getBaseMapper().updateRootState();
ebomParentService.updateRootState(); ebomParentService.updateRootState();
ebomParentService.getBaseMapper().updateRootForWaitReview(); ebomParentService.updateRootForWaitReview();
return ResultVO.success(result); return ResultVO.success(result);
} }

View File

@ -79,8 +79,12 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
List<ReverseReportVO> eBomReverseReportNewst(@Param("materialNo")String materialNo); List<ReverseReportVO> eBomReverseReportNewst(@Param("materialNo")String materialNo);
Integer getCountForWaitReviewByMaterialNo(@Param("materialNo") String materialNo); Integer getCountForWaitReviewByMaterialNo(@Param("materialNo") String materialNo);
@Deprecated
void updateRootForWaitReview(); void updateRootForWaitReview();
void updateRootForWaitReview1();
void updateRootForWaitReview2();
void resetBomExist(Long rowId); void resetBomExist(Long rowId);
Set<String> getMaterialParent(@Param("materialNos") Collection<String> materialNos ,@Param("createdBy") String createdBy); Set<String> getMaterialParent(@Param("materialNos") Collection<String> materialNos ,@Param("createdBy") String createdBy);
@ -121,7 +125,7 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
Integer getSapErrorNum(String userCode); Integer getSapErrorNum(String userCode);
List<BomNewEbomParentEntity> getLatestByMaterialNo(Collection<String> materialNos); List<BomNewEbomParentEntity> getLatestByMaterialNo(Collection<String> materialNos);
@Deprecated
void updateLastVersionIs(); void updateLastVersionIs();
List<BomNewPbomParentVO> getReverseBoms(Long parentRowId); List<BomNewPbomParentVO> getReverseBoms(Long parentRowId);

View File

@ -233,6 +233,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
* @param materialNo * @param materialNo
* @return * @return
*/ */
@Deprecated
public Set<String> getParentMaterialByMaterialNo(String materialNo, Boolean selfIs) { public Set<String> getParentMaterialByMaterialNo(String materialNo, Boolean selfIs) {
BomNewEbomMaterialUseEntity materialBom = bomNewEbomMaterialUseService.lambdaQuery().eq(BomNewEbomMaterialUseEntity::getMaterialNo, materialNo).one(); BomNewEbomMaterialUseEntity materialBom = bomNewEbomMaterialUseService.lambdaQuery().eq(BomNewEbomMaterialUseEntity::getMaterialNo, materialNo).one();
Set<String> result = new HashSet<>(); Set<String> result = new HashSet<>();
@ -295,6 +296,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
* @param materialNos * @param materialNos
* @return * @return
*/ */
@Deprecated
public List<String> getBatchParentMaterialByMaterialNo(List<String> materialNos) { public List<String> getBatchParentMaterialByMaterialNo(List<String> materialNos) {
List<BomNewEbomMaterialUseEntity> materialBom = bomNewEbomMaterialUseService.lambdaQuery().in(BomNewEbomMaterialUseEntity::getMaterialNo, materialNos).list(); List<BomNewEbomMaterialUseEntity> materialBom = bomNewEbomMaterialUseService.lambdaQuery().in(BomNewEbomMaterialUseEntity::getMaterialNo, materialNos).list();
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
@ -2143,7 +2145,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
// ThreadUtil.execAsync(() -> computeLevelNumAndRootState()); // ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
if (eBomEdit.isRootForWaitReview()) { if (eBomEdit.isRootForWaitReview()) {
this.getBaseMapper().updateRootForWaitReview(); updateRootForWaitReview();
} }
@ -2153,6 +2155,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
return retParentVO; return retParentVO;
} }
public void updateRootForWaitReview(){
this.getBaseMapper().updateRootForWaitReview1();
this.getBaseMapper().updateRootForWaitReview2();
}
/** /**
* 提交物料 * 提交物料
* <p> * <p>
@ -2210,7 +2217,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
// checkAndSaveEBomException(dto.getParent().getBomRowId()); // checkAndSaveEBomException(dto.getParent().getBomRowId());
if (eBomEdit.isRootForWaitReview()) { if (eBomEdit.isRootForWaitReview()) {
this.getBaseMapper().updateRootForWaitReview(); this.updateRootForWaitReview();
} }
resetBomExist(dto.getParent().getRowId()); resetBomExist(dto.getParent().getRowId());
return true; return true;

View File

@ -517,9 +517,9 @@ public class DQBomService {
savePbomParents(parents, root.getMaterialNo().startsWith("31") ? PBomStatusEnum.FACTORY_CONFIRM : PBomStatusEnum.PUBLISH); savePbomParents(parents, root.getMaterialNo().startsWith("31") ? PBomStatusEnum.FACTORY_CONFIRM : PBomStatusEnum.PUBLISH);
savePbomChildren(children, parents); savePbomChildren(children, parents);
CompletableFuture.runAsync(() -> { // CompletableFuture.runAsync(() -> {
bomNewPbomParentService.getBaseMapper().updatePBomMaterialUse(); // bomNewPbomParentService.getBaseMapper().updatePBomMaterialUse();
}); // });
} }
private void savePbomChildren(List<BomNewDQbomChildEntity> children, List<BomNewDQbomParentEntity> parents) { private void savePbomChildren(List<BomNewDQbomChildEntity> children, List<BomNewDQbomParentEntity> parents) {

View File

@ -317,6 +317,18 @@
and a.last_version_is = 1 and a.last_version_is = 1
AND a.virtual_package_is = 0; AND a.virtual_package_is = 0;
</update> </update>
<update id="updateRootForWaitReview1">
update t_bom_new_ebom_parent
set root_is_for_wait_review=0
</update>
<update id="updateRootForWaitReview2">
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` in (1,3) and last_version_is=1
) b
on a.material_no=b.material_no
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
</update>
<!--更新-待复核根节点--> <!--更新-待复核根节点-->
<update id="updateRootForWaitReview"> <update id="updateRootForWaitReview">
update t_bom_new_ebom_parent update t_bom_new_ebom_parent