1.Pbom
This commit is contained in:
parent
be9db5d36f
commit
d8406ee9c4
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue