Merge remote-tracking branch 'origin/feature/DM/nflg-bom' into feature/DM/nflg-bom
This commit is contained in:
commit
bc7181fb86
|
|
@ -3,9 +3,9 @@ package com.nflg.product.bomnew.api.user;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
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.bomnew.mapper.master.BomNewEbomChildMapper;
|
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomOriginalCadParentEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomOriginalCadParentEntity;
|
||||||
import com.nflg.product.bomnew.pojo.vo.ImportOriginalBomVO;
|
import com.nflg.product.bomnew.pojo.vo.ImportOriginalBomVO;
|
||||||
|
import com.nflg.product.bomnew.service.BomNewEbomChildService;
|
||||||
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
||||||
import com.nflg.product.bomnew.service.BomNewOriginalParentV2Service;
|
import com.nflg.product.bomnew.service.BomNewOriginalParentV2Service;
|
||||||
import com.nflg.product.bomnew.service.BomOriginalCadParentService;
|
import com.nflg.product.bomnew.service.BomOriginalCadParentService;
|
||||||
|
|
@ -38,7 +38,7 @@ public class EbomV2Api extends BaseApi {
|
||||||
@Resource
|
@Resource
|
||||||
BomNewOriginalParentV2Service originalParentV2Service;
|
BomNewOriginalParentV2Service originalParentV2Service;
|
||||||
@Resource
|
@Resource
|
||||||
BomNewEbomChildMapper bomNewEbomChildMapper;
|
BomNewEbomChildService ebomChildService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
BomNewEbomParentService ebomParentService;
|
BomNewEbomParentService ebomParentService;
|
||||||
|
|
@ -56,7 +56,7 @@ public class EbomV2Api extends BaseApi {
|
||||||
|
|
||||||
result = originalParentV2Service.pullFromCadAndToEBom(parents);
|
result = originalParentV2Service.pullFromCadAndToEBom(parents);
|
||||||
//更新物料使用
|
//更新物料使用
|
||||||
bomNewEbomChildMapper.updateEBomMaterialUse();
|
ebomChildService.updateEBomMaterialUse(parents.stream().map(BomOriginalCadParentEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||||
|
|
||||||
//跟新EBom 根节点
|
//跟新EBom 根节点
|
||||||
ebomParentService.getBaseMapper().updateRootState();
|
ebomParentService.getBaseMapper().updateRootState();
|
||||||
|
|
|
||||||
|
|
@ -162,8 +162,6 @@ public class OriginalBomApi extends BaseApi {
|
||||||
VUtils.isTure(CollUtil.isEmpty(bomRowIds)).throwMessage("请选择要转换的BOM");
|
VUtils.isTure(CollUtil.isEmpty(bomRowIds)).throwMessage("请选择要转换的BOM");
|
||||||
VUtils.isTure(bomRowIds.size() > 20).throwMessage("你选择的BOM数据大于20");
|
VUtils.isTure(bomRowIds.size() > 20).throwMessage("你选择的BOM数据大于20");
|
||||||
List<ImportOriginalBomVO> result = originalParentService.convertToEBom(bomRowIds);
|
List<ImportOriginalBomVO> result = originalParentService.convertToEBom(bomRowIds);
|
||||||
//更新物料使用
|
|
||||||
bomNewEbomChildMapper.updateEBomMaterialUse();
|
|
||||||
|
|
||||||
//更新-原始BOM跟节点
|
//更新-原始BOM跟节点
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||||
import com.nflg.product.bomnew.pojo.vo.ChildMaxExceptionStateVO;
|
import com.nflg.product.bomnew.pojo.vo.ChildMaxExceptionStateVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -21,7 +22,7 @@ public interface BomNewEbomChildMapper extends BaseMapper<BomNewEbomChildEntity>
|
||||||
/**
|
/**
|
||||||
* 全量更新-EBOM物料use
|
* 全量更新-EBOM物料use
|
||||||
*/
|
*/
|
||||||
void updateEBomMaterialUse();
|
void updateEBomMaterialUse(Collection<String> materialNos);
|
||||||
|
|
||||||
List<ChildMaxExceptionStateVO> getChildMaxExceptionState(@Param("bomRowIds") List<Long> bomRowIds);
|
List<ChildMaxExceptionStateVO> getChildMaxExceptionState(@Param("bomRowIds") List<Long> bomRowIds);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ import com.nflg.product.bomnew.mapper.master.BomNewEbomChildMapper;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* t_bom_new_ebom_child 表服务实现类
|
* t_bom_new_ebom_child 表服务实现类
|
||||||
|
|
@ -16,4 +19,9 @@ import org.springframework.stereotype.Service;
|
||||||
@Service
|
@Service
|
||||||
public class BomNewEbomChildService extends ServiceImpl<BomNewEbomChildMapper, BomNewEbomChildEntity> {
|
public class BomNewEbomChildService extends ServiceImpl<BomNewEbomChildMapper, BomNewEbomChildEntity> {
|
||||||
|
|
||||||
|
public CompletableFuture<Void> updateEBomMaterialUse(Collection<String> materialNos) {
|
||||||
|
return CompletableFuture.runAsync(() -> {
|
||||||
|
baseMapper.updateEBomMaterialUse(materialNos);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
child.setNoticeNums(parentEntity.getNoticeNums());
|
child.setNoticeNums(parentEntity.getNoticeNums());
|
||||||
child.setSuperMaterialStatus(parentEntity.getSuperMaterialStatus());
|
child.setSuperMaterialStatus(parentEntity.getSuperMaterialStatus());
|
||||||
|
|
||||||
if (parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) {
|
if (!parent.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())
|
||||||
|
&& parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) {
|
||||||
child.setStatus(EBomStatusEnum.BORROWED_PARTS.getValue());
|
child.setStatus(EBomStatusEnum.BORROWED_PARTS.getValue());
|
||||||
child.setBomRowId(0L);
|
child.setBomRowId(0L);
|
||||||
}
|
}
|
||||||
|
|
@ -1146,12 +1147,12 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
/**
|
/**
|
||||||
* 计算层级数和根节点状态
|
* 计算层级数和根节点状态
|
||||||
*/
|
*/
|
||||||
public void computeLevelNumAndRootState() {
|
public void computeLevelNumAndRootState(Collection<String> materialNos) {
|
||||||
//计算树的层级数
|
//计算树的层级数
|
||||||
// CompletableFuture.runAsync(() -> {
|
// CompletableFuture.runAsync(() -> {
|
||||||
try {
|
try {
|
||||||
this.getBaseMapper().updateRootState();
|
this.getBaseMapper().updateRootState();
|
||||||
ebomChildService.getBaseMapper().updateEBomMaterialUse();
|
ebomChildService.updateEBomMaterialUse(materialNos);
|
||||||
//this.compucteLevelNum();
|
//this.compucteLevelNum();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -1274,7 +1275,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
|
|
||||||
}
|
}
|
||||||
//不要异步
|
//不要异步
|
||||||
computeLevelNumAndRootState();
|
computeLevelNumAndRootState(eBomEdit.childEntities.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||||
|
|
||||||
if (CollUtil.isEmpty(sameList)) {
|
if (CollUtil.isEmpty(sameList)) {
|
||||||
return ResultVO.success();
|
return ResultVO.success();
|
||||||
|
|
@ -1807,7 +1808,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
|
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
|
||||||
|
|
||||||
//ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
//ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
||||||
computeLevelNumAndRootState();
|
computeLevelNumAndRootState(eBomDel.getDelEBom().stream().map(BomNewEbomParentVO::getMaterialNo).collect(Collectors.toSet()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1895,7 +1896,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
|
|
||||||
// checkAndSaveEBomException(childList);
|
// checkAndSaveEBomException(childList);
|
||||||
//不要异步
|
//不要异步
|
||||||
ebomChildService.getBaseMapper().updateEBomMaterialUse();
|
ebomChildService.updateEBomMaterialUse(eBomEdit.childEntities.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||||
// ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
// ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
||||||
|
|
||||||
if (eBomEdit.isRootForWaitReview()) {
|
if (eBomEdit.isRootForWaitReview()) {
|
||||||
|
|
|
||||||
|
|
@ -648,6 +648,8 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(convert.getEBomChildResult())) {
|
if (CollUtil.isNotEmpty(convert.getEBomChildResult())) {
|
||||||
ebomChildService.saveOrUpdateBatch(convert.getEBomChildResult());
|
ebomChildService.saveOrUpdateBatch(convert.getEBomChildResult());
|
||||||
|
//更新物料使用
|
||||||
|
ebomChildService.updateEBomMaterialUse(convert.getEBomChildResult().stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||||
}
|
}
|
||||||
//将原始BOM及子级转为已处理
|
//将原始BOM及子级转为已处理
|
||||||
if (CollUtil.isNotEmpty(convert.getHasHandlerParentIds())) {
|
if (CollUtil.isNotEmpty(convert.getHasHandlerParentIds())) {
|
||||||
|
|
|
||||||
|
|
@ -57,12 +57,20 @@
|
||||||
|
|
||||||
<update id="updateEBomMaterialUse">
|
<update id="updateEBomMaterialUse">
|
||||||
SET @@global.group_concat_max_len=804800;
|
SET @@global.group_concat_max_len=804800;
|
||||||
TRUNCATE TABLE t_bom_new_ebom_material_use;
|
DELETE FROM t_bom_new_ebom_material_use
|
||||||
INSERT INTO `t_bom_new_ebom_material_use` (`row_id`, `material_no`, `parent_material_no`)
|
WHERE material_no IN
|
||||||
|
<foreach collection="materialNos" item="materialNo" open="(" close=")" separator=",">
|
||||||
|
#{materialNo}
|
||||||
|
</foreach>;
|
||||||
|
|
||||||
|
INSERT INTO `t_bom_new_ebom_material_use` (`row_id`, `material_no`, `parent_material_no`)
|
||||||
select min(b.row_id) rowId, b.material_no, GROUP_CONCAt( distinct a.material_no) as value_list
|
select min(b.row_id) rowId, b.material_no, GROUP_CONCAt( distinct a.material_no) as value_list
|
||||||
from t_bom_new_ebom_parent a
|
from t_bom_new_ebom_parent a
|
||||||
join t_bom_new_ebom_child b on a.row_id=b.parent_row_id and a.last_version_is=1
|
join t_bom_new_ebom_child b on a.row_id=b.parent_row_id and a.last_version_is=1
|
||||||
|
WHERE b.material_no IN
|
||||||
|
<foreach collection="materialNos" item="materialNo" open="(" close=")" separator=",">
|
||||||
|
#{materialNo}
|
||||||
|
</foreach>
|
||||||
group by b.material_no;
|
group by b.material_no;
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue