Merge branch 'refs/heads/feature/DM/nflg-bom' into feature/DM/nflg-bom-transition
# Conflicts: # nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomV2Api.java # nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomChildService.java
This commit is contained in:
commit
0a6d022229
|
|
@ -15,6 +15,10 @@ import com.nflg.product.bomnew.pojo.vo.ListForGenerateVirtualPackageVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
|
import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
|
||||||
import com.nflg.product.bomnew.service.*;
|
import com.nflg.product.bomnew.service.*;
|
||||||
import com.nflg.product.bomnew.util.EecExcelUtil;
|
import com.nflg.product.bomnew.util.EecExcelUtil;
|
||||||
|
import com.nflg.product.bomnew.service.BomNewEbomChildService;
|
||||||
|
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
||||||
|
import com.nflg.product.bomnew.service.BomNewOriginalParentV2Service;
|
||||||
|
import com.nflg.product.bomnew.service.BomOriginalCadParentService;
|
||||||
import com.nflg.product.bomnew.util.VUtils;
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
@ -48,12 +52,11 @@ public class EbomV2Api extends BaseApi {
|
||||||
@Resource
|
@Resource
|
||||||
BomNewOriginalParentV2Service originalParentV2Service;
|
BomNewOriginalParentV2Service originalParentV2Service;
|
||||||
@Resource
|
@Resource
|
||||||
BomNewEbomChildMapper bomNewEbomChildMapper;
|
BomNewEbomChildService ebomChildService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
BomNewEbomParentService ebomParentService;
|
BomNewEbomParentService ebomParentService;
|
||||||
@Resource
|
|
||||||
BomNewEbomChildService ebomChildService;
|
|
||||||
@Resource
|
@Resource
|
||||||
EBomImportService eBomImportService;
|
EBomImportService eBomImportService;
|
||||||
|
|
||||||
|
|
@ -70,7 +73,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(() -> {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -22,7 +23,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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -26,4 +28,10 @@ public class BomNewEbomChildService extends ServiceImpl<BomNewEbomChildMapper, B
|
||||||
public void deleteAllChildren(Long parentRowId) {
|
public void deleteAllChildren(Long parentRowId) {
|
||||||
baseMapper.deleteAllChildren(parentRowId);
|
baseMapper.deleteAllChildren(parentRowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CompletableFuture<Void> updateEBomMaterialUse(Collection<String> materialNos) {
|
||||||
|
return CompletableFuture.runAsync(() -> {
|
||||||
|
baseMapper.updateEBomMaterialUse(materialNos);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1144,12 +1144,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) {
|
||||||
|
|
@ -1272,7 +1272,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();
|
||||||
|
|
@ -1805,7 +1805,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;
|
||||||
|
|
@ -1893,7 +1893,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,13 +57,21 @@
|
||||||
|
|
||||||
<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
|
||||||
group by b.material_no ;
|
WHERE b.material_no IN
|
||||||
|
<foreach collection="materialNos" item="materialNo" open="(" close=")" separator=",">
|
||||||
|
#{materialNo}
|
||||||
|
</foreach>
|
||||||
|
group by b.material_no;
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="getChildMaxExceptionState" resultType="com.nflg.product.bomnew.pojo.vo.ChildMaxExceptionStateVO">
|
<select id="getChildMaxExceptionState" resultType="com.nflg.product.bomnew.pojo.vo.ChildMaxExceptionStateVO">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue