feat: [excel-129]支持分类代码为10开头的物料添加工艺包到上级
This commit is contained in:
parent
3789b30bf7
commit
998ac9bc50
|
|
@ -480,23 +480,10 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
||||||
String drawingNo = packageParam.getDrawingNo();
|
String drawingNo = packageParam.getDrawingNo();
|
||||||
String materialName = packageParam.getMaterialName();
|
String materialName = packageParam.getMaterialName();
|
||||||
String materialDesc = packageParam.getMaterialDesc();
|
String materialDesc = packageParam.getMaterialDesc();
|
||||||
BomNewPbomParentVO result = null;
|
BomNewPbomParentVO result = getVO(packageParam);
|
||||||
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));
|
materialMainService.intiMaterialInfo(ImmutableList.of(result));
|
||||||
//VUtils.isTure(StrUtil.isBlank(result.getMaterialCategoryCode()) || !result.getMaterialCategoryCode().startsWith("20")).throwMessage("插入工艺包的物料需为制作物料");
|
//VUtils.isTure(StrUtil.isBlank(result.getMaterialCategoryCode()) || !result.getMaterialCategoryCode().startsWith("20")).throwMessage("插入工艺包的物料需为制作物料");
|
||||||
VUtils.isTure(StrUtil.isBlank(result.getMaterialCategoryCode())).throwMessage("物料分类代码不能为空");
|
|
||||||
if (result.getMaterialCategoryCode().startsWith("10")) {
|
|
||||||
//工艺包只能添加到上级
|
|
||||||
VUtils.isTure(!Objects.equals(packageParam.getLevelBelong(), 0)).throwMessage("10分类开头的物料,工艺包只能添加到上级");
|
|
||||||
} else if (!result.getMaterialCategoryCode().startsWith("20")) {
|
|
||||||
VUtils.isTure(true).throwMessage("插入工艺包的物料需为制作物料或10分类开头");
|
|
||||||
}
|
|
||||||
|
|
||||||
// drawingNo = StrUtil.join("", result.getDrawingNo(), technologyPackageTypeEntity.getDrawingNoSuffix());
|
// drawingNo = StrUtil.join("", result.getDrawingNo(), technologyPackageTypeEntity.getDrawingNoSuffix());
|
||||||
// 检查改图号是否已存在主数据中
|
// 检查改图号是否已存在主数据中
|
||||||
|
|
@ -523,18 +510,39 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
||||||
BaseMaterialVO resultD = materialMainService.getMaterialBaseInfo(ImmutableList.of(materialNo)).get(0);
|
BaseMaterialVO resultD = materialMainService.getMaterialBaseInfo(ImmutableList.of(materialNo)).get(0);
|
||||||
//插入工艺包
|
//插入工艺包
|
||||||
packageParam.setTechnologyPackageMaterialNo(materialNo);
|
packageParam.setTechnologyPackageMaterialNo(materialNo);
|
||||||
insertTechnologyPackage(packageParam);
|
insertTechnologyPackage(packageParam, result);
|
||||||
|
|
||||||
return resultD;
|
return resultD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
private BomNewPbomParentVO getVO(TechnologyPackageParam packageParam) {
|
||||||
|
if (packageParam.getRowIds().size() == 1) {
|
||||||
|
BomNewPbomChildEntity child = pbomChildService.getById(packageParam.getRowIds().get(0));
|
||||||
|
return Convert.convert(BomNewPbomParentVO.class, child);
|
||||||
|
} else {
|
||||||
|
BomNewPbomParentEntity parent = this.getById(packageParam.getBomRowId());
|
||||||
|
return Convert.convert(BomNewPbomParentVO.class, parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void insertTechnologyPackage(TechnologyPackageParam technologyPackageParam) {
|
public void insertTechnologyPackage(TechnologyPackageParam technologyPackageParam) {
|
||||||
|
insertTechnologyPackage(technologyPackageParam, getVO(technologyPackageParam));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void insertTechnologyPackage(TechnologyPackageParam technologyPackageParam, BomNewPbomParentVO vo) {
|
||||||
VUtils.isTure(StrUtil.isBlank(technologyPackageParam.getTechnologyPackageMaterialNo())).throwMessage("工艺包物料编码不能为空");
|
VUtils.isTure(StrUtil.isBlank(technologyPackageParam.getTechnologyPackageMaterialNo())).throwMessage("工艺包物料编码不能为空");
|
||||||
VUtils.isTure(CollUtil.isEmpty(technologyPackageParam.getRowIds())).throwMessage("请选择要插入工艺包的物料");
|
VUtils.isTure(CollUtil.isEmpty(technologyPackageParam.getRowIds())).throwMessage("请选择要插入工艺包的物料");
|
||||||
if (technologyPackageParam.getRowIds().size() == 1 && Objects.isNull(technologyPackageParam.getLevelBelong())) {
|
if (technologyPackageParam.getRowIds().size() == 1 && Objects.isNull(technologyPackageParam.getLevelBelong())) {
|
||||||
throw new NflgBusinessException(STATE.BusinessError, "单条物料时,请选择上下级");
|
throw new NflgBusinessException(STATE.BusinessError, "单条物料时,请选择上下级");
|
||||||
}
|
}
|
||||||
|
VUtils.isTure(StrUtil.isBlank(vo.getMaterialCategoryCode())).throwMessage("物料分类代码不能为空");
|
||||||
|
if (vo.getMaterialCategoryCode().startsWith("10")) {
|
||||||
|
//工艺包只能添加到上级
|
||||||
|
VUtils.isTure(!Objects.equals(technologyPackageParam.getLevelBelong(), 0)).throwMessage("10分类开头的物料,工艺包只能添加到上级");
|
||||||
|
} else if (!vo.getMaterialCategoryCode().startsWith("20")) {
|
||||||
|
VUtils.isTure(true).throwMessage("插入工艺包的物料需为制作物料或10分类开头");
|
||||||
|
}
|
||||||
TechnologyPackageParamBuilder builder = new TechnologyPackageParamBuilder(technologyPackageParam);
|
TechnologyPackageParamBuilder builder = new TechnologyPackageParamBuilder(technologyPackageParam);
|
||||||
builder.builder();
|
builder.builder();
|
||||||
if (CollUtil.isNotEmpty(builder.getPackageParent())) {
|
if (CollUtil.isNotEmpty(builder.getPackageParent())) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue