1、315问题修复
This commit is contained in:
parent
c89e9f34cd
commit
2962454b46
|
|
@ -8,6 +8,7 @@ import com.mzt.logapi.starter.annotation.LogRecord;
|
||||||
import com.nflg.product.base.core.api.BaseApi;
|
import com.nflg.product.base.core.api.BaseApi;
|
||||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||||
|
import com.nflg.product.bomnew.constant.OriginalStatusEnum;
|
||||||
import com.nflg.product.bomnew.mapper.master.BomNewEbomChildMapper;
|
import com.nflg.product.bomnew.mapper.master.BomNewEbomChildMapper;
|
||||||
import com.nflg.product.bomnew.pojo.dto.BomNewOriginalExcelDTO;
|
import com.nflg.product.bomnew.pojo.dto.BomNewOriginalExcelDTO;
|
||||||
import com.nflg.product.bomnew.pojo.dto.OriginalSaveBomDTO;
|
import com.nflg.product.bomnew.pojo.dto.OriginalSaveBomDTO;
|
||||||
|
|
@ -44,6 +45,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -163,6 +165,12 @@ public class OriginalBomApi extends BaseApi {
|
||||||
//更新物料使用
|
//更新物料使用
|
||||||
bomNewEbomChildMapper.updateEBomMaterialUse();
|
bomNewEbomChildMapper.updateEBomMaterialUse();
|
||||||
|
|
||||||
|
//更新-原始BOM跟节点
|
||||||
|
CompletableFuture.runAsync(()->{
|
||||||
|
originalParentService.getBaseMapper().updateRootState_2(OriginalStatusEnum.OVER_CONVERT.getValue());
|
||||||
|
originalParentService.getBaseMapper().updateRootState_3(OriginalStatusEnum.OVER_CONVERT.getValue());
|
||||||
|
});
|
||||||
|
|
||||||
//跟新EBom 根节点
|
//跟新EBom 根节点
|
||||||
ebomParentService.getBaseMapper().updateRootState();
|
ebomParentService.getBaseMapper().updateRootState();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,8 @@ public interface BomNewOriginalParentMapper extends BaseMapper<BomNewOriginalPar
|
||||||
*/
|
*/
|
||||||
void updateRootState_1();
|
void updateRootState_1();
|
||||||
|
|
||||||
void updateRootState_2();
|
void updateRootState_2(@Param("status") Integer status);
|
||||||
void updateRootState_3();
|
void updateRootState_3(@Param("status") Integer status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新物料使用
|
* 更新物料使用
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,11 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
||||||
if (CollUtil.isNotEmpty(parentChild)) {
|
if (CollUtil.isNotEmpty(parentChild)) {
|
||||||
List<String> drawingNos = parentChild.stream().map(u -> u.getDrawingNo()).collect(Collectors.toList());
|
List<String> drawingNos = parentChild.stream().map(u -> u.getDrawingNo()).collect(Collectors.toList());
|
||||||
if (CollUtil.isNotEmpty(drawingNos)) {
|
if (CollUtil.isNotEmpty(drawingNos)) {
|
||||||
List<BomNewOriginalParentEntity> list = this.lambdaQuery().in(BomNewOriginalParentEntity::getDrawingNo, drawingNos).eq(BomNewOriginalParentEntity::getLastVersionIs, 1).list();
|
List<BomNewOriginalParentEntity> list = this.lambdaQuery().in(BomNewOriginalParentEntity::getDrawingNo, drawingNos)
|
||||||
|
.eq(OriginalStatusEnum.UN_CONVERT.equalsValue(parent.getStatus()),BomNewOriginalParentEntity::getLastVersionIs, 1)
|
||||||
|
.eq(OriginalStatusEnum.OVER_CONVERT.equalsValue(parent.getStatus()) , BomNewOriginalParentEntity::getStatus, parent.getStatus())
|
||||||
|
.last("order by current_version desc limit 1")
|
||||||
|
.list();
|
||||||
Map<String, BomNewOriginalParentEntity> bomListMap = ListCommonUtil.listToMap(list, BomNewOriginalParentEntity::getDrawingNo);
|
Map<String, BomNewOriginalParentEntity> bomListMap = ListCommonUtil.listToMap(list, BomNewOriginalParentEntity::getDrawingNo);
|
||||||
for (BomOriginalListVO child : parentChild) {
|
for (BomOriginalListVO child : parentChild) {
|
||||||
if (bomListMap.containsKey(child.getDrawingNo())) {
|
if (bomListMap.containsKey(child.getDrawingNo())) {
|
||||||
|
|
@ -417,8 +421,8 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.getBaseMapper().updateRootState_1();
|
this.getBaseMapper().updateRootState_1();
|
||||||
this.getBaseMapper().updateRootState_2();
|
this.getBaseMapper().updateRootState_2(OriginalStatusEnum.UN_CONVERT.getValue());
|
||||||
this.getBaseMapper().updateRootState_3();
|
this.getBaseMapper().updateRootState_3(OriginalStatusEnum.UN_CONVERT.getValue());
|
||||||
// this.compucteLevelNum();
|
// this.compucteLevelNum();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,22 +178,27 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="updateRootState">
|
<update id="updateRootState">
|
||||||
update t_bom_new_ebom_parent
|
update t_bom_new_ebom_parent
|
||||||
set root_is=0,
|
set root_is=0, user_root_is=0
|
||||||
user_root_is=0
|
where last_version_is = 1;
|
||||||
where last_version_is = 1;
|
|
||||||
update t_bom_new_ebom_parent a set a.root_is=1 ,a.user_root_is=1 where material_no not in (select material_no from (
|
|
||||||
select b.material_no from t_bom_new_ebom_parent a
|
|
||||||
join t_bom_new_ebom_child b on a.row_id=b.parent_row_id
|
|
||||||
where a.last_version_is=1 ) b ) and last_version_is=1;
|
|
||||||
|
|
||||||
|
|
||||||
update t_bom_new_ebom_parent a left join (select material_no ,created_by from (
|
update t_bom_new_ebom_parent a left join (
|
||||||
select b.material_no ,b.created_by from t_bom_new_ebom_parent a
|
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
|
||||||
join t_bom_new_ebom_child b on a.row_id=b.parent_row_id
|
and a.`status` < 4
|
||||||
where a.last_version_is=1 ) b ) t on a.material_no=t.material_no and a.created_by=t.created_by
|
) b
|
||||||
set user_root_is=1
|
on a.material_no=b.material_no
|
||||||
where a.last_version_is=1 and t.created_by is null
|
set a.root_is=1
|
||||||
|
where a.`status` < 4 and b.row_id is null and a.last_version_is=1 ;
|
||||||
|
|
||||||
|
|
||||||
|
update t_bom_new_ebom_parent a left join (
|
||||||
|
select b.row_id, b.material_no,a.`status` , a.created_by 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` < 4
|
||||||
|
) b
|
||||||
|
on a.material_no=b.material_no and a.created_by=b.created_by
|
||||||
|
set a.user_root_is=1
|
||||||
|
where a.`status` < 4 and b.row_id is null and a.last_version_is=1 ;
|
||||||
|
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,22 +145,20 @@
|
||||||
user_root_is=0
|
user_root_is=0
|
||||||
where last_version_is = 1
|
where last_version_is = 1
|
||||||
</update>
|
</update>
|
||||||
|
<!--处理根节点-->
|
||||||
<update id="updateRootState_2">
|
<update id="updateRootState_2">
|
||||||
update t_bom_new_original_parent a join (
|
update t_bom_new_original_parent a left join t_bom_new_original_child b
|
||||||
select a.row_id from t_bom_new_original_parent a
|
on a.drawing_no=b.drawing_no and b.`status`= #{status}
|
||||||
left join t_bom_new_original_child b
|
set root_is=1
|
||||||
on a.drawing_no=b.drawing_no
|
where a.`status`=#{status} and b.row_id is null
|
||||||
where a.last_version_is=1 and b.row_id is null ) t
|
|
||||||
on a.row_id=t.row_id set a.root_is=1
|
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<!--处理用户跟节点-->
|
||||||
<update id="updateRootState_3">
|
<update id="updateRootState_3">
|
||||||
update t_bom_new_original_parent a join (
|
update t_bom_new_original_parent a left join t_bom_new_original_child b
|
||||||
select a.row_id from t_bom_new_original_parent a
|
on a.drawing_no=b.drawing_no and b.`status`=#{status} and a.created_by=b.created_by
|
||||||
left join t_bom_new_original_child b
|
set user_root_is=1
|
||||||
on a.drawing_no=b.drawing_no and a.created_by=b.created_by
|
where a.`status`=#{status} and b.row_id is null
|
||||||
where a.last_version_is=1 and b.row_id is null ) t
|
|
||||||
on a.row_id=t.row_id set a.user_root_is=1
|
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<insert id="upOriginalMaterialUse">
|
<insert id="upOriginalMaterialUse">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue