Merge branch 'feature/DM/nflg-bom' of http://112.74.186.154:3000/nflj/nflg_project into feature/DM/nflg-bom

# Conflicts:
#	nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java
This commit is contained in:
jing's 2024-01-04 23:28:46 +08:00
commit 52ab6d5c81
7 changed files with 82 additions and 13 deletions

View File

@ -345,9 +345,9 @@ public class EbomApi extends BaseApi {
@PostMapping("intiException")
@ApiOperation("初始化错误类型")
public ResultVO<Boolean> intiException(@RequestParam("bomRowId") Long bomRowId) throws ExecutionException, InterruptedException {
public ResultVO<Boolean> intiException(@RequestBody List<Long> bomRowIds) throws ExecutionException, InterruptedException {
bomNewEbomParentService.checkAndSaveEBomException(bomRowId );
bomNewEbomParentService.batchCheckAndSaveEBomException(bomRowIds );
return ResultVO.success(true);
}

View File

@ -3,8 +3,11 @@ package com.nflg.product.bomnew.api.user;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.nflg.product.base.core.api.BaseApi;
import com.nflg.product.bomnew.constant.EBomConstant;
import com.nflg.product.bomnew.constant.PBomEditStatusEnum;
import com.nflg.product.bomnew.constant.PBomStatusEnum;
import com.nflg.product.bomnew.pojo.dto.*;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewTechnologyPackageTypeEntity;
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
@ -167,6 +170,25 @@ public class PBomApi extends BaseApi {
return ResultVO.success(bomNewPbomParentService.allocationFactoryForRel(params));
}
@GetMapping("convertToMBom")
@ApiOperation("发布MBom")
public ResultVO<Boolean> convertToMBom(@RequestParam("bomRowId") Long bomRowId) {
BomNewPbomParentEntity parent = bomNewPbomParentService.getById(bomRowId);
VUtils.isTure(!parent.getMaterialNo().startsWith("31")).throwMessage("只有31开头的物料才可以发布");
VUtils.isTure(!PBomStatusEnum.PUBLISH.equalsValue(parent.getStatus())).throwMessage("只有已发布的BOM才能生成MBom");
//
VUtils.isTure(!parent.getFacCode().equals(EBomConstant.MAIN_FACTORY_CODE_1010)).throwMessage("只有1010工厂BOM才能进行分工厂");
return ResultVO.success(bomNewPbomParentService.convertToMBom(bomRowId));
}

View File

@ -13,4 +13,10 @@ public class EBomConstant {
//EBOM 获取时初始化物料主数据信息是忽略的字段
public static final String[] EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT = {"material", "materialTexture", "projectType", "materialUnit"};
//集团总部代码
public static final String MAIN_FACTORY_CODE_1010="1010";
//仙桃分厂代码
public static final String XIAN_TAO_FACTORY_CODE_1020="1020";
}

View File

@ -499,6 +499,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
public void checkAndSaveEBomException(List<BomNewEbomParentVO> list) throws ExecutionException, InterruptedException {
CheckEBomException checkEBomException = new CheckEBomException(list);
checkEBomException.initException();
@ -508,6 +509,21 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
/**
* 检查 并保存异常信息
*/
public void batchCheckAndSaveEBomException(List<Long> bomRowIds) throws ExecutionException, InterruptedException {
for (Long bomRowId : bomRowIds) {
CheckEBomException checkEBomException = new CheckEBomException(bomRowId);
checkEBomException.initException();
//保存异常
saveException(checkEBomException);
}
}

View File

@ -370,7 +370,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
convertToEBomDo(parent,ebomRowId);
//更新并保存异常信息
ebomParentService.checkAndSaveEBomException(ebomRowId);
ebomParentService.checkAndSaveEBomException( ebomRowId);
}
return true;

View File

@ -28,10 +28,7 @@ import org.ttzero.excel.entity.Workbook;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinTask;
@ -372,11 +369,9 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
List<BomNewPbomParentVO> childrenVO = getAllBom(params.getBomRowId() ,0);
materialMainService.intiMaterialInfo(childrenVO, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
List<BomFactorySplitRuleEntity> relList = bomFactorySplitRuleService.lambdaQuery().eq(BomFactorySplitRuleEntity::getRuleGroupCode, params.getRuleGroupCode()).list();
StringBuilder relPattern=new StringBuilder();
Map<Long ,String> result=new HashMap<>();
List<BomNewPbomChildEntity> result=new ArrayList<>();
Boolean match=true;
for (BomNewPbomParentVO child : childrenVO) {
if(StrUtil.isNotBlank(child.getProductionFactoryCode()) && ProductionFactoryCodeInputTypeEnum.MANUAL.equalsValue(child.getProductionFactoryCodeInputType()) ){
@ -409,17 +404,30 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
match=match & (relChild.size()>0);
}
if(match){
result.put(child.getRowId(), role.getFactoryCode());
BomNewPbomChildEntity ent = new BomNewPbomChildEntity();
ent.setRowId(child.getRowId());
ent.setFacCode(role.getFactoryCode());
result.add(ent);
break;
}
}
}
if(CollUtil.isNotEmpty(result)){
pbomChildService.saveOrUpdateBatch(result);
}
return true;
}
/**
* 发布MBOM
*/
public Boolean convertToMBom(Long bomRowId){
return true;
}
}

View File

@ -0,0 +1,17 @@
package com.nflg.product.bomnew.service.domain.PBom;
import io.swagger.annotations.ApiModelProperty;
/**
* PBOM转MBOM
*/
public class ConvertToMBom {
@ApiModelProperty("BOM版本行id")
private Long bomRowId;
public ConvertToMBom(Long inBomRowId){
this.bomRowId=inBomRowId;
}
}