1.pbom-创建工艺包

This commit is contained in:
大米 2024-01-01 18:14:58 +08:00
parent a12e542595
commit f78360da8b
3 changed files with 57 additions and 3 deletions

View File

@ -122,9 +122,9 @@ public class PBomApi extends BaseApi {
@PostMapping("createTechnologyPackage") @PostMapping("createTechnologyPackage")
@ApiOperation("编辑-创建虚拟包") @ApiOperation("编辑-创建虚拟包")
public ResultVO<BaseMaterialVO> createTechnologyPackage(TechnologyPackageParam packageParam){ public ResultVO<BaseMaterialVO> createTechnologyPackage(TechnologyPackageParam packageParam) throws IOException {
return ResultVO.success(new BaseMaterialVO()); return ResultVO.success( bomNewPbomParentService.createTechnologyPackage(packageParam));
} }

View File

@ -1,6 +1,7 @@
package com.nflg.product.bomnew.pojo.dto; package com.nflg.product.bomnew.pojo.dto;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
@ -8,6 +9,8 @@ import java.util.List;
/** /**
* 插入工艺包参数 * 插入工艺包参数
*/ */
@Data
public class TechnologyPackageParam { public class TechnologyPackageParam {
@ApiModelProperty("bom行ID") @ApiModelProperty("bom行ID")
@ -24,7 +27,7 @@ public class TechnologyPackageParam {
@ApiModelProperty("工艺包类型rowId(创建工艺包时用)") @ApiModelProperty("工艺包类型rowId(创建工艺包时用)")
private Long technologyPackageRowId; private Long technologyPackageTypeRowId;

View File

@ -14,9 +14,13 @@ import com.nflg.product.bomnew.constant.PBomStatusEnum;
import com.nflg.product.bomnew.mapper.master.BomNewPbomParentMapper; import com.nflg.product.bomnew.mapper.master.BomNewPbomParentMapper;
import com.nflg.product.bomnew.pojo.dto.EditPBomDelDTO; import com.nflg.product.bomnew.pojo.dto.EditPBomDelDTO;
import com.nflg.product.bomnew.pojo.dto.EditPBomParamDTO; import com.nflg.product.bomnew.pojo.dto.EditPBomParamDTO;
import com.nflg.product.bomnew.pojo.dto.TechnologyPackageParam;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity; import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity; import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewTechnologyPackageTypeEntity;
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery; import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
import com.nflg.product.bomnew.pojo.vo.BomNewPbomEditExcelVO; import com.nflg.product.bomnew.pojo.vo.BomNewPbomEditExcelVO;
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO; import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
import com.nflg.product.bomnew.util.EecExcelUtil; import com.nflg.product.bomnew.util.EecExcelUtil;
@ -57,6 +61,12 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
@Resource @Resource
BomNewPbomChildService pbomChildService; BomNewPbomChildService pbomChildService;
@Resource
BomNewTechnologyPackageTypeService technologyPackageTypeService;
@Resource
MaterialService materialService;
/** /**
* pbom-工作列表 * pbom-工作列表
* *
@ -207,6 +217,47 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
} }
/**
* 创建工艺包
* @param packageParam
* @return
*/
public BaseMaterialVO createTechnologyPackage(TechnologyPackageParam packageParam) throws IOException {
VUtils.isTure(Objects.isNull(packageParam.getTechnologyPackageTypeRowId())).throwMessage("请选择工艺包类型");
BomNewTechnologyPackageTypeEntity technologyPackageTypeEntity = technologyPackageTypeService.getById(packageParam.getTechnologyPackageTypeRowId());
//单条物料
String drawingNo="";
String materialName="";
String materialDesc="";
BomNewPbomParentVO result=null;
if(packageParam.getRowIds().size()==1){
BomNewPbomChildEntity child = pbomChildService.getById(packageParam.getRowIds().get(0));
result=Convert.convert(BomNewPbomParentVO.class,child);
}
else {
BomNewPbomParentEntity parent=this.getById(packageParam.getBomRowId());
result=Convert.convert(BomNewPbomParentVO.class,parent);
}
materialMainService.intiMaterialInfo(ImmutableList.of(result) );
VUtils.isTure(StrUtil.isBlank(result.getMaterialCategoryCode()) || !result.getMaterialCategoryCode().startsWith("20") ).throwMessage("插入工艺包的物料需时制作物料");
drawingNo=StrUtil.join("", result.getDrawingNo(),technologyPackageTypeEntity.getDrawingNoSuffix());
// 检查改图号是否已存在主数据中
List<MaterialMainEntity> materials = materialMainService.lambdaQuery().eq(MaterialMainEntity::getDrawingNo, drawingNo).list();
if(CollUtil.isNotEmpty(materials)){
return Convert.convert(BaseMaterialVO.class,materials.get(0));
}
materialName=StrUtil.join("",result.getMaterialName(),technologyPackageTypeEntity.getRemark());
materialDesc=StrUtil.join(" ",materialName,drawingNo);
String materialNo = materialService.addMaterial(drawingNo, materialName, materialDesc, "");
return materialMainService.getMaterialBaseInfo(ImmutableList.of(materialNo)).get(0);
}
} }