1、过渡版需求-另一个分支
This commit is contained in:
parent
5d1e9418f4
commit
d24c954cb4
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.nflg.product.bomnew.api.user;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.mzt.logapi.starter.annotation.LogRecord;
|
||||||
|
import com.nflg.product.base.core.api.BaseApi;
|
||||||
|
import com.nflg.product.bomnew.pojo.dto.VirtualPackageParamDto;
|
||||||
|
import com.nflg.product.bomnew.service.*;
|
||||||
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import nflg.product.common.vo.ResultVO;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ebom-临时过渡接口
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Api(tags = "EBom临时接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("bom/new/ebom/temp")
|
||||||
|
public class EbomTempApi extends BaseApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务对象
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private BomNewEbomParentService bomNewEbomParentService;
|
||||||
|
|
||||||
|
@PostMapping("generateVirtualPackage")
|
||||||
|
@ApiOperation("生成虚拟包")
|
||||||
|
@LogRecord(success = "生成虚拟包:物料编码:{{#gvbom.materialNo}} 版本:{{#gvbom.currentVersion}},操作结果:{{#_ret}}",
|
||||||
|
bizNo = "{{#paramDto.bomRowId}}", type = "生成虚拟包")
|
||||||
|
public ResultVO<Boolean> generateVirtualPackage(@RequestBody VirtualPackageParamDto paramDto) throws IOException {
|
||||||
|
VUtils.isTure(CollUtil.isEmpty(paramDto.getVirtualPackageValue())).throwMessage("请选择要生成的虚拟包");
|
||||||
|
|
||||||
|
//检查-是否已
|
||||||
|
bomNewEbomParentService.generateVirtualPackage(paramDto);
|
||||||
|
return ResultVO.success(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,111 @@
|
||||||
|
package com.nflg.product.bomnew.service.domain.EBom;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||||
|
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||||
|
import com.nflg.product.bomnew.service.BomNewEbomChildService;
|
||||||
|
import nflg.product.common.constant.STATE;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 31物料生成虚拟包-临时过渡版
|
||||||
|
* 同时生成1010 ,1020 虚拟包
|
||||||
|
*/
|
||||||
|
public class VirtualPackageFor31Temp extends VirtualPackageBase {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param bomRowId 物料BOM-行ID
|
||||||
|
* @param virtualPackageValue 要生成的虚拟包
|
||||||
|
*/
|
||||||
|
public VirtualPackageFor31Temp(Long bomRowId, List<Integer> virtualPackageValue) {
|
||||||
|
this.bomRowId=bomRowId;
|
||||||
|
this.virtualPackageValue=virtualPackageValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 31物料生成虚拟包
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void generateVirtualPackage() {
|
||||||
|
|
||||||
|
// List<BomNewEbomChildEntity> child = getChild();
|
||||||
|
//SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(child);
|
||||||
|
BomNewEbomParentEntity parent = getParentByRowId(bomRowId);
|
||||||
|
|
||||||
|
try {
|
||||||
|
//生成虚拟包
|
||||||
|
if (CollUtil.isNotEmpty(children)) {
|
||||||
|
if (virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue() & parent.getVirtrualPackageEnum()) != VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()){
|
||||||
|
generateVMNoFor31(parent.getDrawingNo(), children, VirtualPackageTypeEnum.DELIVERY_PACKAGE, VirtualPackageTypeEnum.MAKING_PACKAGE
|
||||||
|
,VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE, VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
generateVMNoFor31(parent.getDrawingNo(), children, VirtualPackageTypeEnum.DELIVERY_PACKAGE, VirtualPackageTypeEnum.MAKING_PACKAGE
|
||||||
|
, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (BomNewEbomChildEntity item : children) {
|
||||||
|
BomNewEbomParentEntity makingPackage=null;
|
||||||
|
if((VirtualPackageTypeEnum.DELIVERY_PACKAGE.getValue()&parent.getVirtrualPackageEnum())!=VirtualPackageTypeEnum.DELIVERY_PACKAGE.getValue()) {
|
||||||
|
//构建发货包
|
||||||
|
BomNewEbomParentEntity deliveryPackage = buildParentVirtualPackage(item.getRowId(), VirtualPackageTypeEnum.DELIVERY_PACKAGE, item.getOrderNumber(), parent);
|
||||||
|
//构建构建发货包下制作包
|
||||||
|
makingPackage = buildParentVirtualPackage(item.getRowId(), VirtualPackageTypeEnum.MAKING_PACKAGE, "002", parent);
|
||||||
|
//构建构建发货包下直发
|
||||||
|
BomNewEbomParentEntity directDeliveryPackage = buildParentVirtualPackage(item.getRowId(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE, "001", parent);
|
||||||
|
|
||||||
|
//构建-产品下发货包-子级
|
||||||
|
buildChild(deliveryPackage, bomRowId, item.getOrderNumber(), VirtualPackageTypeEnum.DELIVERY_PACKAGE,parent.getMaterialNo());
|
||||||
|
|
||||||
|
//构建发货包-子级
|
||||||
|
buildChild(makingPackage, deliveryPackage.getRowId(), "002", VirtualPackageTypeEnum.MAKING_PACKAGE,parent.getMaterialNo());
|
||||||
|
buildChild(directDeliveryPackage, deliveryPackage.getRowId(), "001", VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE,parent.getMaterialNo());
|
||||||
|
|
||||||
|
BomNewEbomChildEntity itemUp = new BomNewEbomChildEntity();
|
||||||
|
itemUp.setRowId(item.getRowId());
|
||||||
|
itemUp.setParentRowId(makingPackage.getRowId());
|
||||||
|
this.childResult.add(itemUp);
|
||||||
|
}
|
||||||
|
// 包含发货前装配包
|
||||||
|
if (virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue() & parent.getVirtrualPackageEnum()) != VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) {
|
||||||
|
BomNewEbomParentEntity preAssemblyPackage = buildParentVirtualPackage(item.getRowId(), VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE, item.getOrderNumber(), parent);
|
||||||
|
//构建构建发货前装配包
|
||||||
|
if(Objects.isNull(makingPackage)){
|
||||||
|
makingPackage=getParentZhiZuo(item.getDrawingNo());
|
||||||
|
}
|
||||||
|
buildChild(preAssemblyPackage, makingPackage.getRowId(), "001", VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE,parent.getMaterialNo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parent.setVirtrualPackageEnum(getVPackageNum(parent));
|
||||||
|
this.parentResult.add(parent);
|
||||||
|
|
||||||
|
}catch (Exception ex) {
|
||||||
|
throw new NflgBusinessException(STATE.BusinessError, ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canGenerateVirtualPackage() {
|
||||||
|
children = SpringUtil.getBean(BomNewEbomChildService.class)
|
||||||
|
.lambdaQuery()
|
||||||
|
.eq(BomNewEbomChildEntity::getParentRowId, bomRowId)
|
||||||
|
.eq(BomNewEbomChildEntity::getVirtualPartType, VirtualPackageTypeEnum.UN_VIRTUAL_PACKAGE.getValue())
|
||||||
|
.list();
|
||||||
|
return CollUtil.isNotEmpty(children);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer getVPackageNum(BomNewEbomParentEntity parent){
|
||||||
|
Integer vNum= parent.getVirtrualPackageEnum();
|
||||||
|
for ( Integer i: virtualPackageValue) {
|
||||||
|
vNum=vNum|i;
|
||||||
|
}
|
||||||
|
return vNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue