1.转EBOM
This commit is contained in:
parent
9eb0dcd64f
commit
eb19755b41
|
|
@ -78,6 +78,7 @@ public class OriginalBomApi extends BaseApi {
|
||||||
public ResultVO<List<TreeNode<BomOriginalListVO>>> getChildTree(@RequestParam("rowId") Long rowId) throws ExecutionException, InterruptedException {
|
public ResultVO<List<TreeNode<BomOriginalListVO>>> getChildTree(@RequestParam("rowId") Long rowId) throws ExecutionException, InterruptedException {
|
||||||
return ResultVO.success(originalParentService.getChildTree(rowId));
|
return ResultVO.success(originalParentService.getChildTree(rowId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("saveBom")
|
@PostMapping("saveBom")
|
||||||
@ApiOperation("编辑时-暂存")
|
@ApiOperation("编辑时-暂存")
|
||||||
public ResultVO<Boolean> saveBom(@Valid @RequestBody OriginalSaveBomDTO bom) {
|
public ResultVO<Boolean> saveBom(@Valid @RequestBody OriginalSaveBomDTO bom) {
|
||||||
|
|
@ -120,6 +121,7 @@ public class OriginalBomApi extends BaseApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 原始BOM转EBom
|
* 原始BOM转EBom
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("convertToEBom")
|
@PostMapping("convertToEBom")
|
||||||
|
|
@ -160,12 +162,7 @@ public class OriginalBomApi extends BaseApi {
|
||||||
|
|
||||||
//计算层级
|
//计算层级
|
||||||
originalParentService.computeLevelNumAndRootState();
|
originalParentService.computeLevelNumAndRootState();
|
||||||
// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
|
|
||||||
// @Override
|
|
||||||
// public void afterCommit() {
|
|
||||||
// originalParentService.computeLevelNumAndRootState();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
return ResultVO.success(true);
|
return ResultVO.success(true);
|
||||||
}
|
}
|
||||||
|
|
@ -198,17 +195,14 @@ public class OriginalBomApi extends BaseApi {
|
||||||
public ResultVO<Boolean> testImportBom() throws IOException {
|
public ResultVO<Boolean> testImportBom() throws IOException {
|
||||||
InputStream inputStream = new FileInputStream("C:\\Users\\01956\\Desktop\\西卡印尼烘干线总站BOM.xlsx");
|
InputStream inputStream = new FileInputStream("C:\\Users\\01956\\Desktop\\西卡印尼烘干线总站BOM.xlsx");
|
||||||
originalParentService.importBomTest(inputStream);
|
originalParentService.importBomTest(inputStream);
|
||||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
|
|
||||||
@Override
|
// originalParentService.computeLevelNumAndRootState();
|
||||||
public void afterCommit() {
|
|
||||||
originalParentService.computeLevelNumAndRootState();
|
originalParentService.computeLevelNumAndRootState();
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return ResultVO.success(true);
|
return ResultVO.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,5 +33,8 @@ public interface BomNewOriginalParentMapper extends BaseMapper<BomNewOriginalPar
|
||||||
/**
|
/**
|
||||||
* 更新是否根节点状态
|
* 更新是否根节点状态
|
||||||
*/
|
*/
|
||||||
void updateRootState();
|
void updateRootState_1();
|
||||||
|
|
||||||
|
void updateRootState_2();
|
||||||
|
void updateRootState_3();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.nflg.product.base.core.config.SpringContextUtils;
|
import com.nflg.product.base.core.config.SpringContextUtils;
|
||||||
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.bomnew.constant.OriginalConstant;
|
import com.nflg.product.bomnew.constant.OriginalConstant;
|
||||||
import com.nflg.product.bomnew.constant.OriginalEditStatusEnum;
|
import com.nflg.product.bomnew.constant.OriginalEditStatusEnum;
|
||||||
import com.nflg.product.bomnew.constant.OriginalSourceEnum;
|
import com.nflg.product.bomnew.constant.OriginalSourceEnum;
|
||||||
|
|
@ -233,7 +234,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
for (BomNewOriginalParentEntity bom : list) {
|
for (BomNewOriginalParentEntity bom : list) {
|
||||||
bom.setRootIs(1);
|
// bom.setRootIs(1);
|
||||||
List<BomOriginalListVO> bomDetail = this.getBaseMapper().getParentChild(bom.getRowId());
|
List<BomOriginalListVO> bomDetail = this.getBaseMapper().getParentChild(bom.getRowId());
|
||||||
OriginalBomDetailTask detailTask = new OriginalBomDetailTask(bomDetail);
|
OriginalBomDetailTask detailTask = new OriginalBomDetailTask(bomDetail);
|
||||||
detailTask.setLevelNum(1);
|
detailTask.setLevelNum(1);
|
||||||
|
|
@ -284,16 +285,18 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
||||||
* 计算层级数和根节点状态
|
* 计算层级数和根节点状态
|
||||||
*/
|
*/
|
||||||
public void computeLevelNumAndRootState() {
|
public void computeLevelNumAndRootState() {
|
||||||
//计算树的层级数
|
|
||||||
// CompletableFuture.runAsync(() -> {
|
|
||||||
try {
|
try {
|
||||||
this.getBaseMapper().updateRootState();
|
this.getBaseMapper().updateRootState_1();
|
||||||
|
this.getBaseMapper().updateRootState_2();
|
||||||
|
this.getBaseMapper().updateRootState_3();
|
||||||
this.compucteLevelNum();
|
this.compucteLevelNum();
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
log.info("计算层级出错:" + e.getMessage());
|
log.info("计算层级出错:" + e.getMessage());
|
||||||
}
|
}
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -385,7 +388,6 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
||||||
/**
|
/**
|
||||||
* 原始BOM导入
|
* 原始BOM导入
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void importBom(MultipartFile file) throws IOException {
|
public void importBom(MultipartFile file) throws IOException {
|
||||||
rowNum.set(1);
|
rowNum.set(1);
|
||||||
excelContextTL.set(new ArrayList<>());
|
excelContextTL.set(new ArrayList<>());
|
||||||
|
|
|
||||||
|
|
@ -124,23 +124,27 @@
|
||||||
</foreach>;
|
</foreach>;
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateRootState">
|
<update id="updateRootState_1">
|
||||||
|
|
||||||
update t_bom_new_original_parent set root_is=0,user_root_is=0 where last_version_is=1;
|
update t_bom_new_original_parent set root_is=0,user_root_is=0 where last_version_is=1
|
||||||
|
|
||||||
|
</update>
|
||||||
|
<update id="updateRootState_2">
|
||||||
update t_bom_new_original_parent a join (
|
update t_bom_new_original_parent a join (
|
||||||
select a.row_id from t_bom_new_original_parent a
|
select a.row_id from t_bom_new_original_parent a
|
||||||
left join t_bom_new_original_child b
|
left join t_bom_new_original_child b
|
||||||
on a.drawing_no=b.drawing_no
|
on a.drawing_no=b.drawing_no
|
||||||
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;
|
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 id="updateRootState_3">
|
||||||
update t_bom_new_original_parent a join (
|
update t_bom_new_original_parent a join (
|
||||||
select a.row_id from t_bom_new_original_parent a
|
select a.row_id from t_bom_new_original_parent a
|
||||||
left join t_bom_new_original_child b
|
left join t_bom_new_original_child b
|
||||||
on a.drawing_no=b.drawing_no and a.created_by=b.created_by
|
on a.drawing_no=b.drawing_no and a.created_by=b.created_by
|
||||||
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;
|
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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue