Merge remote-tracking branch 'origin/feature/DM/nflg-bom' into feature/DM/nflg-bom
This commit is contained in:
commit
e59652fb45
|
|
@ -89,4 +89,17 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
|||
List<BomNewEbomParentVO> getBom(String materialNo, String drawingNo);
|
||||
|
||||
List<BomNewEbomParentVO> getVOById(Long parentRowId);
|
||||
|
||||
/**
|
||||
* 移Ebom 父表到给正式表
|
||||
*/
|
||||
void insertEBomFormalParent(@Param("parentRowIds") List<Long> parentRowIds);
|
||||
|
||||
/**
|
||||
* 转移Ebom 子表到给正式表
|
||||
* @param parentRowIds
|
||||
*/
|
||||
void insertEBomFormalChild(@Param("parentRowIds") List<Long> parentRowIds);
|
||||
|
||||
void delEBomHistory(@Param("parentRowIds") List<Long> parentRowIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,5 +59,11 @@ public interface BomNewPbomParentMapper extends BaseMapper<BomNewPbomParentEntit
|
|||
|
||||
void updateWaitPublicRootState(@Param("materialNoList") Collection<String> materialNoList);
|
||||
|
||||
void insertPBomParentToFormal(@Param("bomRowIds") List<Long> bomRowIds) ;
|
||||
|
||||
void insertPBomChildToFormal(@Param("bomRowIds") List<Long> bomRowIds);
|
||||
|
||||
void delPBom(@Param("bomRowIds") List<Long> bomRowIds);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -926,6 +926,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
List<Long> bomRowIds = bomTree.stream().filter(u -> u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(bomRowIds)) {
|
||||
this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), bomRowIds);
|
||||
//将历史已发布版-转移到正式历史表
|
||||
eBomToFormal(bomRowIds, bomTree.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList()) );
|
||||
}
|
||||
//子级记录-bom版本
|
||||
List<BomNewEbomChildEntity> bomChildren = new ArrayList<>();
|
||||
|
|
@ -2393,4 +2395,25 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
if (Objects.isNull(sapErrorMsgEntity)) return Collections.emptyList();
|
||||
return JSON.parseArray(sapErrorMsgEntity.getData(), OperationErrorMsgVO.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ebom发布时将历史正式版-移到正式表
|
||||
* @param exceptRowIds
|
||||
*/
|
||||
private void eBomToFormal(List<Long> exceptRowIds, List<BomNewEbomParentVO> parents){
|
||||
List<String> materialNos = parents.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
List<BomNewEbomParentEntity> toParents = this.lambdaQuery().eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).notIn(BomNewEbomParentEntity::getRowId, exceptRowIds)
|
||||
.in(BomNewEbomParentEntity::getMaterialNo, materialNos).select(BomNewEbomParentEntity::getRowId).list();
|
||||
if(CollUtil.isNotEmpty(toParents)) {
|
||||
|
||||
List<Long> childParentRowIds = toParents.stream().map(u -> u.getRowId()).collect(Collectors.toList());
|
||||
this.getBaseMapper().insertEBomFormalParent(childParentRowIds);
|
||||
this.getBaseMapper().insertEBomFormalChild(childParentRowIds);
|
||||
|
||||
//转移后删除
|
||||
this.getBaseMapper().delEBomHistory(childParentRowIds);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,6 +265,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
// .eq(PBomStatusEnum.PUBLISH.equalsValue(parent.getStatus()),BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
|
||||
.eq(PBomStatusEnum.PUBLISH.getValue() > parent.getStatus(), BomNewPbomParentEntity::getLastVersionIs, 1)
|
||||
.ge(PBomStatusEnum.PUBLISH.getValue() <= parent.getStatus(), BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
|
||||
.eq(BomNewPbomParentEntity::getFacCode,parent.getFacCode())
|
||||
.list();
|
||||
|
||||
Map<String, BomNewPbomParentEntity> bomListMap= list.parallelStream()
|
||||
|
|
@ -624,7 +625,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
public List<BomNewPbomParentVO> getAllBom(Long rowId, Integer countLevelNum) {
|
||||
List<BomNewPbomParentVO> bomDetail = this.getBaseMapper().getParentChild(rowId);
|
||||
AtomicInteger levelNum = new AtomicInteger(1);
|
||||
PBomDetailTask detailTask = new PBomDetailTask(bomDetail, countLevelNum, levelNum);
|
||||
BomNewPbomParentEntity parent = this.getBaseMapper().selectById(rowId);
|
||||
PBomDetailTask detailTask = new PBomDetailTask(bomDetail, countLevelNum, levelNum,parent.getFacCode());
|
||||
ForkJoinTask<List<BomNewPbomParentVO>> submit = bomDetailPool.submit(detailTask);
|
||||
|
||||
List<BomNewPbomParentVO> result = submit.join();
|
||||
|
|
@ -635,7 +637,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
public List<BomNewPbomParentVO> getAllBom(Long rowId, Integer countLevelNum, Boolean generateDrawingNumberFalg) throws ExecutionException, InterruptedException {
|
||||
List<BomNewPbomParentVO> bomDetail = this.getBaseMapper().getParentChild(rowId);
|
||||
AtomicInteger levelNum = new AtomicInteger(1);
|
||||
PBomDetailTask detailTask = new PBomDetailTask(bomDetail, countLevelNum, levelNum);
|
||||
BomNewPbomParentEntity parent = this.getBaseMapper().selectById(rowId);
|
||||
PBomDetailTask detailTask = new PBomDetailTask(bomDetail, countLevelNum, levelNum,parent.getFacCode());
|
||||
ForkJoinTask<List<BomNewPbomParentVO>> submit = bomDetailPool.submit(detailTask);
|
||||
|
||||
List<BomNewPbomParentVO> result = submit.join();
|
||||
|
|
@ -1009,6 +1012,9 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
upRootMark(parent);
|
||||
|
||||
List<Long> bomRowIds = allBom.stream().filter(u -> PBomStatusEnum.WAIT_PUBLISH.equalsValue(u.getStatus()) && u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
|
||||
|
||||
List<String> parentMaterialNos = allBom.stream().filter(u -> PBomStatusEnum.WAIT_PUBLISH.equalsValue(u.getStatus()) && u.getBomRowId() > 0).map(u->u.getMaterialNo()).collect(Collectors.toList());
|
||||
parentMaterialNos.add(parent.getMaterialNo());
|
||||
Integer state = (parent.getMaterialNo().startsWith("31") && parent.getFacCode().equals(EBomConstant.MAIN_FACTORY_CODE_1010)) ? PBomStatusEnum.WAIT_FACTORY.getValue() : PBomStatusEnum.PUBLISH.getValue();
|
||||
bomRowIds.add(bomRowId);
|
||||
this.getBaseMapper().bomRelease(state, SessionUtil.getUserName(), bomRowIds);
|
||||
|
|
@ -1027,7 +1033,10 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
pbomChildService.updateBatchById(pBomChildren);
|
||||
}
|
||||
|
||||
SpringUtil.getBean(BomNewPbomParentFormalService.class).copyPbomFormal(bomRowId);
|
||||
//历史版本转移到formal正式工作表
|
||||
pBomToFormal(bomRowIds, parentMaterialNos,parent.getFacCode());
|
||||
|
||||
// SpringUtil.getBean(BomNewPbomParentFormalService.class).copyPbomFormal(bomRowId);
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
importToSAP(bomRowId);
|
||||
|
|
@ -1167,4 +1176,28 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* pbom发布时将历史正式版-移到正式表
|
||||
* @param exceptRowIds
|
||||
*/
|
||||
private void pBomToFormal(List<Long> exceptRowIds, List<String> parentMaterialNos ,String facCode){
|
||||
|
||||
List<BomNewPbomParentEntity> toParents = this.lambdaQuery()
|
||||
.ge(BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
|
||||
.notIn(BomNewPbomParentEntity::getRowId, exceptRowIds)
|
||||
.in(BomNewPbomParentEntity::getMaterialNo, parentMaterialNos).select(BomNewPbomParentEntity::getRowId)
|
||||
.eq(BomNewPbomParentEntity::getFacCode,facCode)
|
||||
.list();
|
||||
if(CollUtil.isNotEmpty(toParents)) {
|
||||
|
||||
List<Long> oldPBomRowIds = toParents.stream().map(u -> u.getRowId()).collect(Collectors.toList());
|
||||
this.getBaseMapper().insertPBomParentToFormal(oldPBomRowIds);
|
||||
this.getBaseMapper().insertPBomChildToFormal(oldPBomRowIds);
|
||||
|
||||
//转移后删除
|
||||
this.getBaseMapper().delPBom(oldPBomRowIds);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,11 +36,15 @@ public class PBomDetailTask extends RecursiveTask<List<BomNewPbomParentVO>> {
|
|||
//是否统计层级数
|
||||
private Integer countLevelState;
|
||||
|
||||
//工厂编码
|
||||
private String facCode;
|
||||
|
||||
public PBomDetailTask(List<BomNewPbomParentVO> inBomDetail, Integer inCountLevelState, AtomicInteger inLevelNum) {
|
||||
|
||||
public PBomDetailTask(List<BomNewPbomParentVO> inBomDetail, Integer inCountLevelState, AtomicInteger inLevelNum,String facCode) {
|
||||
bomDetail = inBomDetail;
|
||||
levelNum=inLevelNum;
|
||||
countLevelState = inCountLevelState;
|
||||
this.facCode=facCode;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -53,7 +57,10 @@ public class PBomDetailTask extends RecursiveTask<List<BomNewPbomParentVO>> {
|
|||
|
||||
if (CollUtil.isNotEmpty(materialNos)) {
|
||||
|
||||
List<BomNewPbomParentEntity> childBomlist = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery().in(BomNewPbomParentEntity::getMaterialNo, materialNos).eq(BomNewPbomParentEntity::getLastVersionIs, 1).list();
|
||||
List<BomNewPbomParentEntity> childBomlist = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery()
|
||||
.in(BomNewPbomParentEntity::getMaterialNo, materialNos)
|
||||
.eq(BomNewPbomParentEntity::getLastVersionIs, 1)
|
||||
.eq(BomNewPbomParentEntity::getFacCode,facCode).list();
|
||||
Map<String, BomNewPbomParentEntity> parentMap = ListCommonUtil.listToMap(childBomlist, BomNewPbomParentEntity::getMaterialNo);
|
||||
for (BomNewPbomParentVO detailVO : bomDetail) {
|
||||
if (parentMap.containsKey(detailVO.getMaterialNo())) {
|
||||
|
|
@ -125,7 +132,7 @@ public class PBomDetailTask extends RecursiveTask<List<BomNewPbomParentVO>> {
|
|||
.list();
|
||||
List<BomNewPbomParentVO> bom = Convert.toList(BomNewPbomParentVO.class, children);
|
||||
|
||||
PBomDetailTask task = new PBomDetailTask(bom, countLevelState,levelNum);
|
||||
PBomDetailTask task = new PBomDetailTask(bom, countLevelState,levelNum,facCode);
|
||||
task.fork();
|
||||
bomDetail.addAll(task.join());
|
||||
return bomDetail;
|
||||
|
|
|
|||
|
|
@ -483,4 +483,35 @@
|
|||
LEFT JOIN t_bom_new_ebom_child b ON a.material_no = b.material_no
|
||||
WHERE a.row_id = #{parentRowId}
|
||||
</select>
|
||||
|
||||
<insert id="insertEBomFormalParent">
|
||||
INSERT INTO `t_bom_new_ebom_parent_formal` (`row_id`, `batch_no`, `drawing_no`, `material_no`, `order_number`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `material_original_unit`, `unit_weight`, `total_weight`, `current_version`, `num`, `source`, `root_is`, `should_bom_exist`, `super_material_status`, `bom_exist`, `last_version_is`, `edit_status`, `status`, `user_root_is`, `virtrual_package_enum`, `exception_status`, `virtual_package_is`, `source_row_id`, `devise_user_code`, `devise_name`, `created_by`, `created_time`, `created_job`, `audit_time`, `audit_user_name`, `release_time`, `release_user_name`, `revert_time`, `revert_user_name`, `expire_end_time`, `convert_to_ebom_time`, `remark`, `dept_name`, `level_num`, `change_desc`, `notice_nums`, `modify_time`, `sap_state`, `sap_time`)
|
||||
select `row_id`, `batch_no`, `drawing_no`, `material_no`, `order_number`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `material_original_unit`, `unit_weight`, `total_weight`, `current_version`, `num`, `source`, `root_is`, `should_bom_exist`, `super_material_status`, `bom_exist`, `last_version_is`, `edit_status`, `status`, `user_root_is`, `virtrual_package_enum`, `exception_status`, `virtual_package_is`, `source_row_id`, `devise_user_code`, `devise_name`, `created_by`, `created_time`, `created_job`, `audit_time`, `audit_user_name`, `release_time`, `release_user_name`, `revert_time`, `revert_user_name`, `expire_end_time`, `convert_to_ebom_time`, `remark`, `dept_name`, `level_num`, `change_desc`, `notice_nums`, `modify_time`, `sap_state`, `sap_time` t_bom_new_ebom_parent
|
||||
where row_id in
|
||||
<foreach collection="parentRowIds" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertEBomFormalChild">
|
||||
INSERT INTO `t_bom_new_ebom_child_formal` (`row_id`, `parent_row_id`, `identity_no`, `order_number`, `drawing_no`, `material_no`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `material_category_code`, `unit_weight`, `num`, `total_weight`, `project_type`, `project_type_input_type`, `created_by`, `virtual_part_is`, `created_time`, `modify_time`, `edit_status`, `exception_status`, `source`, `source_row_id`, `remark`, `virtual_part_type`, `virtual_part_root_material_no`, `bom_version_row_id`)
|
||||
select `row_id`, `parent_row_id`, `identity_no`, `order_number`, `drawing_no`, `material_no`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `material_category_code`, `unit_weight`, `num`, `total_weight`, `project_type`, `project_type_input_type`, `created_by`, `virtual_part_is`, `created_time`, `modify_time`, `edit_status`, `exception_status`, `source`, `source_row_id`, `remark`, `virtual_part_type`, `virtual_part_root_material_no`, `bom_version_row_id`
|
||||
from t_bom_new_ebom_child
|
||||
where parent_row_id in
|
||||
<foreach collection="parentRowIds" item="parentRowId" open="(" separator="," close=")">
|
||||
#{parentRowId}
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="delEBomHistory">
|
||||
delete from t_bom_new_ebom_parent where row_id in
|
||||
<foreach collection="parentRowIds" item="parentRowId" open="(" separator="," close=");">
|
||||
#{parentRowId}
|
||||
</foreach>
|
||||
|
||||
delete from t_bom_new_ebom_child where parent_row_id in
|
||||
<foreach collection="parentRowIds" item="parentRowId" open="(" separator="," close=");">
|
||||
#{parentRowId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -260,5 +260,40 @@
|
|||
|
||||
</update>
|
||||
|
||||
<insert id="insertPBomParentToFormal">
|
||||
INSERT INTO `t_bom_new_pbom_parent_formal` (`row_id`, `batch_no`, `drawing_no`, `fac_code`, `material_no`, `order_number`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `unit_weight`, `total_weight`, `current_version`, `num`, `project_type`, `root_is`, `should_bom_exist`, `super_material_status`, `bom_exist`, `last_version_is`, `edit_status`, `status`, `user_root_is`, `virtual_package_is`, `source_row_id`, `devise_user_code`, `devise_name`, `technology_user_code`, `technology_user_name`, `created_by`, `created_time`, `created_job`, `release_time`, `release_user_name`, `last_convert_mbom_user_name`, `last_convert_mbom_time`, `expire_end_time`, `remark`, `dept_name`, `level_num`, `change_desc`, `notice_nums`, `order_no`, `modify_time`, `sap_state`, `sap_time`)
|
||||
|
||||
select `row_id`, `batch_no`, `drawing_no`, `fac_code`, `material_no`, `order_number`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `unit_weight`, `total_weight`, `current_version`, `num`, `project_type`, `root_is`, `should_bom_exist`, `super_material_status`, `bom_exist`, `last_version_is`, `edit_status`, `status`, `user_root_is`, `virtual_package_is`, `source_row_id`, `devise_user_code`, `devise_name`, `technology_user_code`, `technology_user_name`, `created_by`, `created_time`, `created_job`, `release_time`, `release_user_name`, `last_convert_mbom_user_name`, `last_convert_mbom_time`, `expire_end_time`, `remark`, `dept_name`, `level_num`, `change_desc`, `notice_nums`, `order_no`, `modify_time`, `sap_state`, `sap_time`
|
||||
from t_bom_new_pbom_parent
|
||||
where row_id in
|
||||
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertPBomChildToFormal">
|
||||
INSERT INTO `t_bom_new_pbom_child_formal` (`row_id`, `parent_row_id`, `identity_no`, `fac_code`, `order_number`, `drawing_no`, `material_no`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `material_category_code`, `unit_weight`, `num`, `total_weight`, `project_type`, `production_factory_code`, `production_factory_code_input_type`, `set_production_factory_time`, `super_material_status`, `virtual_part_is`, `created_by`, `created_time`, `modify_time`, `source_row_id`, `remark`, `source_parent_material_no`, `virtual_part_type`, `virtual_part_root_material_no`, `bom_version_row_id`, `sap_state`, `sap_time`)
|
||||
|
||||
select `row_id`, `parent_row_id`, `identity_no`, `fac_code`, `order_number`, `drawing_no`, `material_no`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `material_category_code`, `unit_weight`, `num`, `total_weight`, `project_type`, `production_factory_code`, `production_factory_code_input_type`, `set_production_factory_time`, `super_material_status`, `virtual_part_is`, `created_by`, `created_time`, `modify_time`, `source_row_id`, `remark`, `source_parent_material_no`, `virtual_part_type`, `virtual_part_root_material_no`, `bom_version_row_id`, `sap_state`, `sap_time`
|
||||
from t_bom_new_pbom_child
|
||||
where parent_row_id in
|
||||
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="delPBom">
|
||||
delete from t_bom_new_pbom_parent where row_id in
|
||||
<foreach collection="bomRowIds" item="item" open="(" separator="," close=");">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
delete from t_bom_new_pbom_child where parent_row_id in
|
||||
<foreach collection="bomRowIds" item="item" open="(" separator="," close=");">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue