EBOM修复
This commit is contained in:
parent
72151cb3eb
commit
41c0b4346e
|
|
@ -58,12 +58,20 @@ public class PBomApi extends BaseApi {
|
|||
return ResultVO.success(bomNewPbomParentService.workDetailsListByPage(query));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("releaseListByPage")
|
||||
@ApiOperation("PBom已发布工作列表")
|
||||
public ResultVO<IPage<BomNewPbomParentVO>> releaseListByPage(@RequestBody BomNewPbomParentQuery query) {
|
||||
return ResultVO.success(bomNewPbomParentService.releaseListByPage(query));
|
||||
}
|
||||
|
||||
@PostMapping("exportWorkDetailsListByPage")
|
||||
@ApiOperation("导出工作列表")
|
||||
public void exportWorkDetailsListByPage(@RequestBody BomNewPbomParentQuery query ,HttpServletResponse response) {
|
||||
bomNewPbomParentService.exportWorkDetailsListByPage(query,response);
|
||||
}
|
||||
|
||||
@GetMapping("getChild")
|
||||
@ApiOperation("获取子级")
|
||||
public ResultVO<List<BomNewPbomParentVO>> getChild(@RequestParam("bomRowId") Long bomRowId){
|
||||
|
|
@ -175,7 +183,7 @@ public class PBomApi extends BaseApi {
|
|||
public ResultVO<Boolean> convertToMBom(@RequestParam("bomRowId") Long bomRowId) throws ExecutionException, InterruptedException {
|
||||
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.getStatus()> PBomStatusEnum.PUBLISH.getValue()).throwMessage("只有已发布的BOM才能生成MBom");
|
||||
//
|
||||
VUtils.isTure(!parent.getFacCode().equals(EBomConstant.MAIN_FACTORY_CODE_1010)).throwMessage("只有1010工厂BOM才能进行分工厂");
|
||||
return ResultVO.success(bomNewPbomParentService.convertToMBom(bomRowId));
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class BomOriginalListVO extends BaseMaterialVO {
|
|||
* 数量
|
||||
*/
|
||||
@ApiModelProperty(value = "数量")
|
||||
private Integer num;
|
||||
private BigDecimal num;
|
||||
|
||||
/**
|
||||
* 是否根节点 0-否 1-是
|
||||
|
|
|
|||
|
|
@ -269,13 +269,16 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
*/
|
||||
public List<BomNewEbomParentVO> getChild(Long rowId) {
|
||||
BomNewEbomParentEntity parent = this.getBaseMapper().selectById(rowId);
|
||||
|
||||
List<BomNewEbomParentVO> parentChild = this.getBaseMapper().getParentChild(rowId);
|
||||
//排除项目类别的赋值
|
||||
materialMainService.intiMaterialInfoInPattern(parentChild,"^21 | ^31", EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
if (CollUtil.isNotEmpty(parentChild)) {
|
||||
List<String> materialNos = parentChild.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(materialNos)) {
|
||||
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos).eq(BomNewEbomParentEntity::getLastVersionIs, 1).list();
|
||||
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos)
|
||||
.eq(BomNewEbomParentEntity::getLastVersionIs, 1)
|
||||
.eq(EBomStatusEnum.PUBLISHED.equalsValue(parent.getStatus()),BomNewEbomParentEntity::getStatus,EBomStatusEnum.PUBLISHED.getValue() ).list();
|
||||
Map<String, BomNewEbomParentEntity> bomListMap = ListCommonUtil.listToMap(list, BomNewEbomParentEntity::getMaterialNo);
|
||||
for (BomNewEbomParentVO child : parentChild) {
|
||||
if (bomListMap.containsKey(child.getMaterialNo())) {
|
||||
|
|
|
|||
|
|
@ -160,6 +160,10 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
return result;
|
||||
}
|
||||
|
||||
public void exportWorkDetailsListByPage(BomNewPbomParentQuery query,HttpServletResponse response){
|
||||
|
||||
}
|
||||
|
||||
public List<BomNewPbomParentVO> getChild(Long rowId) {
|
||||
|
||||
List<BomNewPbomParentVO> parentChild = this.getBaseMapper().getParentChild(rowId);
|
||||
|
|
@ -505,11 +509,19 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean convertToMBom(Long bomRowId) throws ExecutionException, InterruptedException {
|
||||
//获取CRM订单号
|
||||
|
||||
|
||||
BomNewPbomParentEntity rootParent = this.getById(bomRowId);
|
||||
List<BomNewPbomParentVO> allChild = getAllBom(bomRowId, 0);
|
||||
|
||||
if(StrUtil.isBlank(rootParent.getOrderNo())){
|
||||
String orderNo = crmService.getOrderNo(rootParent.getMaterialNo());
|
||||
rootParent.setOrderNo(orderNo);
|
||||
}
|
||||
VUtils.isTure(StrUtil.isBlank(rootParent.getOrderNo())).throwMessage("没有获取到订单号");
|
||||
|
||||
List<String> noProductionFactoryCodeList = allChild.stream().filter(u -> StrUtil.isBlank(u.getProductionFactoryCode())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noProductionFactoryCodeList)).throwMessage(StrUtil.join(",", noProductionFactoryCodeList)+"物料暂未分工厂,请分完工厂再进行发布");
|
||||
ConvertToMBom convertToMBom=new ConvertToMBom(rootParent ,allChild);
|
||||
convertToMBom.convertToMBom();
|
||||
if(CollUtil.isNotEmpty(convertToMBom.getMBomParentResult())){
|
||||
|
|
@ -539,12 +551,19 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
public boolean realesePbom(Long bomRowId){
|
||||
BomNewPbomParentEntity parent = this.getById(bomRowId);
|
||||
VUtils.isTure(Objects.isNull(parent)).throwMessage("所选BOM-不存在");
|
||||
if(parent.getMaterialNo().startsWith("31")){
|
||||
String orderNo = crmService.getOrderNo(parent.getMaterialNo());
|
||||
parent.setOrderNo(orderNo);
|
||||
|
||||
}
|
||||
try {
|
||||
List<BomNewPbomParentVO> allBom = getAllBom(bomRowId, 0);
|
||||
List<Long> bomRowIds = allBom.stream().filter(u -> PBomStatusEnum.WAIT_PUBLISH.equalsValue(u.getStatus()) && u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
|
||||
Integer state= parent.getMaterialNo().startsWith("31")?PBomStatusEnum.WAIT_FACTORY.getValue():PBomStatusEnum.PUBLISH.getValue();
|
||||
bomRowIds.add(bomRowId);
|
||||
this.getBaseMapper().bomRelease(state,SessionUtil.getUserName(),bomRowIds);
|
||||
//保存订单号
|
||||
this.updateById(parent);
|
||||
}
|
||||
catch (Exception ex){
|
||||
throw new NflgBusinessException(STATE.BusinessError, "发布Pbom失败:"+ex.getMessage());
|
||||
|
|
|
|||
|
|
@ -69,8 +69,6 @@ public class CrmService {
|
|||
*/
|
||||
public String getOrderNo(String materialNo) {
|
||||
try {
|
||||
|
||||
|
||||
HttpUtils httpUtils = new HttpUtils();
|
||||
Map<String, String> paramMp = new HashMap<>();
|
||||
List<Map<String, String>> reBody = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ public class EBomToPBom {
|
|||
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
||||
result.add(vo);
|
||||
} else { //当没找到直发包时,记录到变更影响
|
||||
buildUpgradeChange(vo);
|
||||
// buildUpgradeChange(vo);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
@ -179,7 +179,7 @@ public class EBomToPBom {
|
|||
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
||||
result.add(vo);
|
||||
} else { //当没找到直发包时,记录到变更影响
|
||||
buildUpgradeChange(vo);
|
||||
// buildUpgradeChange(vo);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
@ -306,7 +306,10 @@ public class EBomToPBom {
|
|||
|
||||
private BomNewEbomParentVO getLastVirtualPackage(BomNewEbomParentVO vo, VirtualPackageTypeEnum virtualPackageTypeEnum) {
|
||||
List<BomNewEbomParentVO> zhiFaList = allBomDetail.stream().filter(u -> vo.getLevelNumber().compareTo(u.getLevelNumber()) > 0 && u.getMaterialName().contains(virtualPackageTypeEnum.getConMaterialName())).collect(Collectors.toList());
|
||||
return Collections.max(zhiFaList, Comparator.comparing(BomNewEbomParentVO::getLevelNumber));
|
||||
if(CollUtil.isNotEmpty(zhiFaList)) {
|
||||
return Collections.max(zhiFaList, Comparator.comparing(BomNewEbomParentVO::getLevelNumber));
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -249,6 +249,8 @@ public class OriginalBomToEBomConvert extends BaseConvert {
|
|||
parentEntity.setMaterialName(baseMaterialVO.getMaterialName());
|
||||
parentEntity.setMaterialDesc(baseMaterialVO.getMaterialDesc());
|
||||
parentEntity.setMaterialTexture(baseMaterialVO.getMaterialTexture());
|
||||
parentEntity.setMaterialUnit("KG");
|
||||
parentEntity.setNum(parentEntity.getTotalWeight());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -362,11 +364,11 @@ public class OriginalBomToEBomConvert extends BaseConvert {
|
|||
childEntity.setIdentityNo(StrUtil.join("_", parentRowId.toString(), childEntity.getRowId()));
|
||||
childEntity.setModifyTime(LocalDateTime.now());
|
||||
//当为原材料时,数量=总重 单位改为KG 图号=编码
|
||||
if(StrUtil.isNotBlank(childEntity.getMaterialCategoryCode())&& childEntity.getMaterialCategoryCode().startsWith("10")){
|
||||
childEntity.setNum(childEntity.getTotalWeight());
|
||||
childEntity.setMaterialUnit("KG");
|
||||
childEntity.setDrawingNo(childEntity.getMaterialNo());
|
||||
}
|
||||
// if((StrUtil.isNotBlank(childEntity.getMaterialCategoryCode())&& childEntity.getMaterialCategoryCode().startsWith("10") ) || (StrUtil.isNotBlank(childEntity.getMaterialNo()) && childEntity.getMaterialNo().startsWith("11"))){
|
||||
// childEntity.setNum(childEntity.getTotalWeight());
|
||||
// childEntity.setMaterialUnit("KG");
|
||||
// childEntity.setDrawingNo(childEntity.getMaterialNo());
|
||||
// }
|
||||
this.eBomChildResult.add(childEntity);
|
||||
|
||||
|
||||
|
|
@ -395,10 +397,10 @@ public class OriginalBomToEBomConvert extends BaseConvert {
|
|||
for (Map.Entry<String, List<BomOriginalListVO>> entry : mateiralNoMp.entrySet()) {
|
||||
List<BomOriginalListVO> list1 = entry.getValue();
|
||||
BomOriginalListVO one = list1.get(0);
|
||||
Integer numResult = 0;
|
||||
BigDecimal numResult = BigDecimal.ZERO;
|
||||
BigDecimal totalWeightResult = BigDecimal.ZERO;
|
||||
for (BomOriginalListVO item : list1) {
|
||||
numResult = Objects.nonNull(item.getNum()) ? item.getNum() : 0;
|
||||
numResult = Objects.nonNull(item.getNum()) ? item.getNum() : BigDecimal.ZERO;
|
||||
totalWeightResult = NumberUtil.add(totalWeightResult, item.getTotalWeight());
|
||||
}
|
||||
one.setNum(numResult);
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@
|
|||
order by created_time desc
|
||||
</if>
|
||||
<if test="job==1">
|
||||
select * ,row_id as bomRowId from t_bom_new_ebom_parent where user_root_is=1 and ( status=2 or status=4 )
|
||||
select * ,row_id as bomRowId from t_bom_new_ebom_parent where ( user_root_is= 1 or root_is=1) and status=2
|
||||
<include refid="whr"/>
|
||||
order by created_time desc
|
||||
</if>
|
||||
|
|
@ -117,7 +117,7 @@
|
|||
|
||||
<!--BOM-正式工作表-->
|
||||
<select id="formalWorksheet" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
|
||||
select * , row_id as bomRowId from t_bom_new_ebom_parent where status=4
|
||||
select * , row_id as bomRowId from t_bom_new_ebom_parent where status=4 and ( root_is= 1 or user_root_is=1)
|
||||
<include refid="whr"/>
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue