物料主数据

1、【物料变更】申请部门是营销中心,11,21变更,由冻结改成其他状态,不允许改成激活
2、【物料申请】支持61大类物料申请
This commit is contained in:
大米 2024-08-15 22:10:42 +08:00 committed by 10001392
parent 14fa056416
commit c4349f44a9
2 changed files with 21 additions and 0 deletions

View File

@ -59,6 +59,8 @@ public class MaterialMainExcelApi extends BaseApi {
EecExcelUtil.setResponseExcelHeader(response, categoryCode);
if (categoryCode.startsWith("30")) {
throw new NflgBusinessException(STATE.ParamErr, "整机物料不可批量导入");
} else if (categoryCode.startsWith("60")) {
throw new NflgBusinessException(STATE.ParamErr, "服务物料不可批量导入");
}
if (categoryCode.startsWith("20") || categoryCode.startsWith("22")) {
new Workbook("物料导入", "").addSheet(new ListSheet<>(categoryCode, ImmutableList.of(new MaterialSelfExcelDTO()))).writeTo(response.getOutputStream());

View File

@ -474,6 +474,7 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
notFreezeSet.add(data.getMaterialNo());
}
}
this.validateFreezeStateChangeOther(ents, deptEnt.getDptCode());
this.saveBatch(ents);
//同步OA
materialUpdateToOAService.sysncToOaOnleState(ents);
@ -642,6 +643,7 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
return ResultVO.error(checkMaterialDesc.getMsg());
}
}
this.validateFreezeStateChangeOther(ents, deptEnt.getDptCode());
this.saveBatch(ents);
//同步OA
materialUpdateToOAService.sysnToOa(ents);
@ -649,6 +651,23 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
return ResultVO.success(Boolean.TRUE);
}
// 申请部门是 营销中心11,21变更由冻结改成其他状态不允许改成激活
private void validateFreezeStateChangeOther(List<MaterialUpdateBillEntity> updateList, String applyDeptCode) {
if (CollectionUtil.isEmpty(updateList)) {
return;
}
if (!applyDeptCode.contains("营销中心")) {
return;
}
List<MaterialUpdateBillEntity> filterList = updateList.stream().filter(update -> (update.getOldCategoryCode().startsWith("10") || update.getOldCategoryCode().startsWith("20"))
&& update.getOldMaterialState().equals(MaterialStateEnum.FROZEN.getValue())
&& (ObjectUtil.isNotEmpty(update.getNewMaterialState()) && update.getNewMaterialState().equals(MaterialStateEnum.ACTIVATE.getValue()))).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(filterList)) {
List<String> materialNos = filterList.stream().map(MaterialUpdateBillEntity::getMaterialNo).collect(Collectors.toList());
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", materialNos).concat("物料解冻时,禁止改成激活"));
}
}
/**
* 获取物料分类tree
*