Merge remote-tracking branch 'origin/feature/DM/nflg-bom-transition-hlq' into feature/DM/nflg-bom-transition

This commit is contained in:
10001392 2024-08-28 08:44:45 +08:00
commit 78d87ae304
2 changed files with 21 additions and 0 deletions

View File

@ -59,6 +59,8 @@ public class MaterialMainExcelApi extends BaseApi {
EecExcelUtil.setResponseExcelHeader(response, categoryCode); EecExcelUtil.setResponseExcelHeader(response, categoryCode);
if (categoryCode.startsWith("30")) { if (categoryCode.startsWith("30")) {
throw new NflgBusinessException(STATE.ParamErr, "整机物料不可批量导入"); throw new NflgBusinessException(STATE.ParamErr, "整机物料不可批量导入");
} else if (categoryCode.startsWith("60")) {
throw new NflgBusinessException(STATE.ParamErr, "服务物料不可批量导入");
} }
if (categoryCode.startsWith("20") || categoryCode.startsWith("22")) { if (categoryCode.startsWith("20") || categoryCode.startsWith("22")) {
new Workbook("物料导入", "").addSheet(new ListSheet<>(categoryCode, ImmutableList.of(new MaterialSelfExcelDTO()))).writeTo(response.getOutputStream()); 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()); notFreezeSet.add(data.getMaterialNo());
} }
} }
this.validateFreezeStateChangeOther(ents, deptEnt.getDptCode());
this.saveBatch(ents); this.saveBatch(ents);
//同步OA //同步OA
materialUpdateToOAService.sysncToOaOnleState(ents); materialUpdateToOAService.sysncToOaOnleState(ents);
@ -642,6 +643,7 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
return ResultVO.error(checkMaterialDesc.getMsg()); return ResultVO.error(checkMaterialDesc.getMsg());
} }
} }
this.validateFreezeStateChangeOther(ents, deptEnt.getDptCode());
this.saveBatch(ents); this.saveBatch(ents);
//同步OA //同步OA
materialUpdateToOAService.sysnToOa(ents); materialUpdateToOAService.sysnToOa(ents);
@ -649,6 +651,23 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
return ResultVO.success(Boolean.TRUE); 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 * 获取物料分类tree
* *