已排单,生产排单权限修改,禅道 1437 修复

This commit is contained in:
liuzhaotian
2025-03-27 16:26:35 +08:00
parent da4e3e0b9c
commit 162aa74e99
9 changed files with 44 additions and 35 deletions
@@ -54,7 +54,7 @@ public class RemainPlateManageController {
@PostMapping("/createMultiple") @PostMapping("/createMultiple")
@Operation(summary = "创建生产单余料板表(多个)") @Operation(summary = "创建生产单余料板表(多个)")
@PreAuthorize("@ss.hasAnyPermissions('manage:remain-plate:create','placeorder:optimize')") @PreAuthorize("@ss.hasAnyPermissions('manage:remain-plate:create','producePlan:optimize:remain-plate-store','placeorder:optimize:remain-plate-store')")
public CommonResult<Boolean> createRemainPlateMultiple(@Valid @RequestBody Set<RemainPlateSaveReqVO> createReqVOS) { public CommonResult<Boolean> createRemainPlateMultiple(@Valid @RequestBody Set<RemainPlateSaveReqVO> createReqVOS) {
return success(remainPlateService.createRemainPlateMultiple(createReqVOS)); return success(remainPlateService.createRemainPlateMultiple(createReqVOS));
} }
@@ -446,7 +446,7 @@ public class OrderController {
@GetMapping("/get-room-and-body") @GetMapping("/get-room-and-body")
@Operation(summary = "获取柜体和房间信息") @Operation(summary = "获取柜体和房间信息")
@Parameter(name = "planId", description = "排单ID", required = true, example = "1024") @Parameter(name = "planId", description = "排单ID", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')") @PreAuthorize("@ss.hasAnyPermissions('production:manager-list:detail','placeorder:optimize:manual-optimization','producePlan:optimize:manual-optimization')")
public CommonResult<List<OrderRoomBodyRespVO>> getRoomAndBody(@RequestParam("planId") Long planId) { public CommonResult<List<OrderRoomBodyRespVO>> getRoomAndBody(@RequestParam("planId") Long planId) {
return success(orderService.getRoomAndBody(planId)); return success(orderService.getRoomAndBody(planId));
} }
@@ -39,7 +39,7 @@ public class OptimizePlanController {
@GetMapping("/getPlateListByPlanId") @GetMapping("/getPlateListByPlanId")
@Operation(summary = "根据排单id获取板材列表") @Operation(summary = "根据排单id获取板材列表")
@PreAuthorize("@ss.hasPermission('placeorder:optimize')") @PreAuthorize("@ss.hasAnyPermissions('placeorder:optimize','producePlan:optimize')")
public CommonResult<List<PlateOptimize>> getPlateListByPlanId(@Schema(description = "排单id") @RequestParam("planId") Long planId) { public CommonResult<List<PlateOptimize>> getPlateListByPlanId(@Schema(description = "排单id") @RequestParam("planId") Long planId) {
return CommonResult.success(optimizePlanService.getPlateListByPlanId(planId)); return CommonResult.success(optimizePlanService.getPlateListByPlanId(planId));
} }
@@ -47,7 +47,7 @@ public class OptimizePlanController {
@PostMapping("/addRemain") @PostMapping("/addRemain")
@Operation(summary = "添加余料板") @Operation(summary = "添加余料板")
@PreAuthorize("@ss.hasPermission('placeorder:optimize')") @PreAuthorize("@ss.hasAnyPermissions('placeorder:optimize','producePlan:optimize')")
public CommonResult<Boolean> addRemain(@RequestBody @Valid AddRemainReqVO vo){ public CommonResult<Boolean> addRemain(@RequestBody @Valid AddRemainReqVO vo){
return CommonResult.success(optimizePlanService.addRemain(vo)); return CommonResult.success(optimizePlanService.addRemain(vo));
} }
@@ -82,7 +82,7 @@ public class OptimizePlanController {
@PutMapping("/updateCuttingStatus") @PutMapping("/updateCuttingStatus")
@Operation(summary = "修改开料状态") @Operation(summary = "修改开料状态")
@PreAuthorize("@ss.hasAnyPermissions('placeorder:optimize:updateCuttingStatus','placeorder:optimize:cutting-materials')") @PreAuthorize("@ss.hasAnyPermissions('placeorder:optimize:updateCuttingStatus','placeorder:optimize:cutting-materials','producePlan:optimize:cutting-materials','producePlan:optimize:updateCuttingStatus')")
public CommonResult<Boolean> updateCuttingStatus(@RequestBody CuttingStatusRespVO respVO) { public CommonResult<Boolean> updateCuttingStatus(@RequestBody CuttingStatusRespVO respVO) {
optimizePlanService.updateCuttingStatus(respVO); optimizePlanService.updateCuttingStatus(respVO);
return success(Boolean.TRUE); return success(Boolean.TRUE);
@@ -92,7 +92,7 @@ public class OptimizePlanController {
@GetMapping("/getOrderSource") @GetMapping("/getOrderSource")
@Operation(summary = "获取生产单源数据") @Operation(summary = "获取生产单源数据")
@PreAuthorize("@ss.hasAnyPermissions('placeorder:optimize','production:manager-list:calculate','manage:order-plan:process-scheme')") @PreAuthorize("@ss.hasAnyPermissions('placeorder:optimize','production:manager-list:calculate','manage:order-plan:process-scheme','producePlan:order-plan:process-scheme','producePlan:optimize')")
public CommonResult<OrderSource> getOrderSource(@Schema(description = "生产单id") @RequestParam(required = false) Long orderId, public CommonResult<OrderSource> getOrderSource(@Schema(description = "生产单id") @RequestParam(required = false) Long orderId,
@Schema(description = "排单id") @RequestParam(required = false) Long planId, @Schema(description = "排单id") @RequestParam(required = false) Long planId,
@Schema(description = "机台Id") @RequestParam(required = false) Long machineId @Schema(description = "机台Id") @RequestParam(required = false) Long machineId
@@ -104,7 +104,7 @@ public class OptimizePlanController {
@GetMapping("/getLabelDataSourceValue") @GetMapping("/getLabelDataSourceValue")
@Operation(summary = "获取标签数据源value") @Operation(summary = "获取标签数据源value")
@PreAuthorize("@ss.hasPermission('placeorder:optimize')") @PreAuthorize("@ss.hasAnyPermissions('placeorder:optimize','producePlan:optimize')")
public CommonResult<Map<String,Object>> getLabelDataSourceValue(@Valid GetSourceDataReq req ) { public CommonResult<Map<String,Object>> getLabelDataSourceValue(@Valid GetSourceDataReq req ) {
return CommonResult.success( optimizePlanService.getLabelDataSourceValue(req)); return CommonResult.success( optimizePlanService.getLabelDataSourceValue(req));
@@ -113,7 +113,7 @@ public class OptimizePlanController {
@PostMapping("/saveOptimizationResults") @PostMapping("/saveOptimizationResults")
@Operation(summary = "保存优化生产后的数据") @Operation(summary = "保存优化生产后的数据")
@PreAuthorize("@ss.hasPermission('placeorder:optimize')") @PreAuthorize("@ss.hasAnyPermissions('placeorder:optimize:save-optimize','placeorder:optimize:re-optimize','producePlan:optimize:re-optimize','producePlan:optimize:save-optimize')")
public CommonResult<Boolean> saveOptimizationResults(@Valid @RequestBody SavePlanPlateResultReqVO req ) { public CommonResult<Boolean> saveOptimizationResults(@Valid @RequestBody SavePlanPlateResultReqVO req ) {
optimizePlanService.saveOptimizationResults(req); optimizePlanService.saveOptimizationResults(req);
@@ -125,7 +125,7 @@ public class OptimizePlanController {
@PostMapping("/saveProcessSchemeResults") @PostMapping("/saveProcessSchemeResults")
@Operation(summary = "保存方案组的优化信息") @Operation(summary = "保存方案组的优化信息")
@PreAuthorize("@ss.hasAnyPermissions('placeorder:optimize','manage:order-plan:process-scheme')") @PreAuthorize("@ss.hasAnyPermissions('placeorder:optimize','manage:order-plan:process-scheme','producePlan:order-plan:process-scheme','producePlan:optimize')")
public CommonResult<Boolean> saveProcessSchemeResults(@RequestBody SaveProcessSchemeReqVO saveProcessSchemeReqVO) { public CommonResult<Boolean> saveProcessSchemeResults(@RequestBody SaveProcessSchemeReqVO saveProcessSchemeReqVO) {
optimizePlanService.saveProcessSchemeResults(saveProcessSchemeReqVO); optimizePlanService.saveProcessSchemeResults(saveProcessSchemeReqVO);
@@ -139,7 +139,7 @@ public class OptimizePlanController {
@GetMapping("/getProcessSchemeConfig") @GetMapping("/getProcessSchemeConfig")
@Operation(summary = "查询加工方案组对应的配置信息") @Operation(summary = "查询加工方案组对应的配置信息")
@Parameter(name = "planId", description = "排单ID", required = true) @Parameter(name = "planId", description = "排单ID", required = true)
@PreAuthorize("@ss.hasPermission('manage:order-plan:process-scheme')") @PreAuthorize("@ss.hasAnyPermissions('manage:order-plan:process-scheme','producePlan:order-plan:process-scheme')")
public CommonResult<PlanProcessSchemeList> getProcessSchemeConfig(@Schema(description = "方案组ID") @NotNull(message = "方案组的ID不能为空") Long processId, public CommonResult<PlanProcessSchemeList> getProcessSchemeConfig(@Schema(description = "方案组ID") @NotNull(message = "方案组的ID不能为空") Long processId,
@Schema(description = "排单id") @RequestParam Long planId) { @Schema(description = "排单id") @RequestParam Long planId) {
@@ -153,7 +153,7 @@ public class OptimizePlanController {
@PutMapping("/updateProcessScheme") @PutMapping("/updateProcessScheme")
@Operation(summary = "修改排单对应的方案组的是否锁单") @Operation(summary = "修改排单对应的方案组的是否锁单")
@PreAuthorize("@ss.hasPermission('placeorder:optimize')") @PreAuthorize("@ss.hasAnyPermissions('placeorder:optimize','producePlan:optimize')")
public CommonResult<Boolean> updateProcessScheme(@RequestBody PlanProcessSchemeReqVO reqVO) { public CommonResult<Boolean> updateProcessScheme(@RequestBody PlanProcessSchemeReqVO reqVO) {
optimizePlanService.updateProcessScheme(reqVO); optimizePlanService.updateProcessScheme(reqVO);
return success(true); return success(true);
@@ -69,7 +69,7 @@ public class PlanController {
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得排单") @Operation(summary = "获得排单")
@Parameter(name = "id", description = "排单id", required = true) @Parameter(name = "id", description = "排单id", required = true)
@PreAuthorize("@ss.hasPermission('placeorder:query')") @PreAuthorize("@ss.hasAnyPermissions('placeorder:query','producePlan:query')")
public CommonResult<PlanRespVO> getPlan(@RequestParam("id") @NotNull(message = "排单数据异常,请重新操作") Long id) { public CommonResult<PlanRespVO> getPlan(@RequestParam("id") @NotNull(message = "排单数据异常,请重新操作") Long id) {
PlanRespVO plan = planService.getPlan(id); PlanRespVO plan = planService.getPlan(id);
return success(BeanUtils.toBean(plan, PlanRespVO.class)); return success(BeanUtils.toBean(plan, PlanRespVO.class));
@@ -77,21 +77,21 @@ public class PlanController {
@GetMapping("getPlateByPlanId") @GetMapping("getPlateByPlanId")
@Operation(summary = "根据排单id获取小板分页") @Operation(summary = "根据排单id获取小板分页")
@PreAuthorize("@ss.hasPermission('placeorder:query')") @PreAuthorize("@ss.hasAnyPermissions('placeorder:query','producePlan:query')")
public CommonResult<PageResult<PlateResList>> getPlateByPlanId(@Valid GetPlateByPlanIdVO vo) { public CommonResult<PageResult<PlateResList>> getPlateByPlanId(@Valid GetPlateByPlanIdVO vo) {
return success(planService.getPlateByPlanId(vo)); return success(planService.getPlateByPlanId(vo));
} }
@GetMapping("getOrderByPlan") @GetMapping("getOrderByPlan")
@Operation(summary = "根据排单获取生产单分页") @Operation(summary = "根据排单获取生产单分页")
@PreAuthorize("@ss.hasAnyPermissions('placeorder:query','placeorder:priority')") @PreAuthorize("@ss.hasAnyPermissions('placeorder:query','placeorder:priority','producePlan:query')")
public CommonResult<PageResult<OrderRespVO>> getOrderByPlanId(@Valid PlanOrderPageReqVO pageReqVO) { public CommonResult<PageResult<OrderRespVO>> getOrderByPlanId(@Valid PlanOrderPageReqVO pageReqVO) {
return success(planService.getOrderByPlanId(pageReqVO)); return success(planService.getOrderByPlanId(pageReqVO));
} }
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得排单分页") @Operation(summary = "获得排单分页")
@PreAuthorize("@ss.hasAnyPermissions('placeorder:query','placeorder:priority')") @PreAuthorize("@ss.hasAnyPermissions('placeorder:query','placeorder:priority','producePlan:query')")
public CommonResult<PageResult<PlanRespVO>> getPlanPage(@Valid PlanPageReqVO pageReqVO) { public CommonResult<PageResult<PlanRespVO>> getPlanPage(@Valid PlanPageReqVO pageReqVO) {
PageResult<PlanRespVO> pageResult = planService.getPlanPage(pageReqVO); PageResult<PlanRespVO> pageResult = planService.getPlanPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, PlanRespVO.class)); return success(BeanUtils.toBean(pageResult, PlanRespVO.class));
@@ -133,7 +133,7 @@ public class PlateController {
@PostMapping("/insertPlate") @PostMapping("/insertPlate")
@Operation(summary = "优化生产创建板材") @Operation(summary = "优化生产创建板材")
@PreAuthorize("@ss.hasAnyPermissions('executor:plate:create','placeorder:optimize')") @PreAuthorize("@ss.hasAnyPermissions('executor:plate:create','placeorder:optimize:manual-optimization','producePlan:optimize:manual-optimization')")
public CommonResult<List<InsertPlateRespVO>> createNewPlate(@Valid @RequestBody List<OptimizationSavePlateReqVO> reqVO) { public CommonResult<List<InsertPlateRespVO>> createNewPlate(@Valid @RequestBody List<OptimizationSavePlateReqVO> reqVO) {
return success(plateService.createNewPlate(reqVO)); return success(plateService.createNewPlate(reqVO));
} }
@@ -676,6 +676,8 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
Long planId = boardModelDO.getPlanId(); Long planId = boardModelDO.getPlanId();
Long processId = 1L;
// // 延长操作用户的缓存时间 // // 延长操作用户的缓存时间
// redisInsertPlanCreator(planId); // redisInsertPlanCreator(planId);
@@ -688,6 +690,18 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
AssertUtils.notEmpty(planDO,ORDER_PLAN_DATE_ERROR); AssertUtils.notEmpty(planDO,ORDER_PLAN_DATE_ERROR);
if(planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
throw exception(THIS_PLAN_OPTIMIZE_DATA_ERROR);
}
// 兼容数据,后期可删除
List<OptimizeBoardModelDO> document = esUtils.getEsDocument(FIELD_PLAN_ID, planId, ORDER_OPTIMIZE_PLATE_MODEL, OptimizeBoardModelDO.class);
if(CollUtil.isNotEmpty(document)){
OptimizeBoardModelDO optimizeBoardModelDO = document.get(0);
processId = optimizeBoardModelDO.getProcessId();
}
if(req.getProcessId() != null){ if(req.getProcessId() != null){
@@ -698,15 +712,13 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
planDO.setProcessId(req.getProcessId()); planDO.setProcessId(req.getProcessId());
planMapper.updateById(planDO); planMapper.updateById(planDO);
} esUtils.deleteEsDocument(FIELD_PLAN_ID, FIELD_PROCESS_ID, planId, req.getProcessId(), ORDER_OPTIMIZE_PLATE_MODEL);
if(boardModelDO.getProcessId() == null) {
esUtils.deleteEsDocument(FIELD_PLAN_ID, planId, ORDER_OPTIMIZE_PLATE_MODEL);
}else { }else {
esUtils.deleteEsDocument(FIELD_PLAN_ID, FIELD_PROCESS_ID, planId, req.getProcessId(), ORDER_OPTIMIZE_PLATE_MODEL); esUtils.deleteEsDocument(FIELD_PLAN_ID, FIELD_PLAN_CONFIG_ID, planId, boardModelDO.getPlanConfigId(), ORDER_OPTIMIZE_PLATE_MODEL);
} }
}else { }else {
boardModelDO.setProcessId(planDO.getProcessId()); boardModelDO.setProcessId(planDO.getProcessId());
@@ -740,6 +752,12 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
esUtils.refresh(ORDER_OPTIMIZE_PLATE_MODEL); esUtils.refresh(ORDER_OPTIMIZE_PLATE_MODEL);
if (processId == null) {
esUtils.deleteEsDocument(FIELD_PLAN_ID, planId, ORDER_OPTIMIZE_PLATE_MODEL);
}
// List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLAN_CONFIG_ID,FIELD_PLAN_ID,req.getPlanConfigId(), planId, ORDER_OPTIMIZE_PLATE_MODEL, OptimizeBoardModelDO.class); // List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLAN_CONFIG_ID,FIELD_PLAN_ID,req.getPlanConfigId(), planId, ORDER_OPTIMIZE_PLATE_MODEL, OptimizeBoardModelDO.class);
@@ -261,8 +261,6 @@ public class PlanServiceImpl implements PlanService {
}else { }else {
planDO.setIsScheduled(updateReqVO.getIsScheduled()); planDO.setIsScheduled(updateReqVO.getIsScheduled());
planMapper.updateById(planDO); planMapper.updateById(planDO);
} }
@@ -968,6 +966,9 @@ public class PlanServiceImpl implements PlanService {
grouped.forEach((key,value) ->{ grouped.forEach((key,value) ->{
List<GoodsRespVO> goodsRespVOS = goodsMapper.selectNoOrderPlanGoods(value, getUserOrganId()); List<GoodsRespVO> goodsRespVOS = goodsMapper.selectNoOrderPlanGoods(value, getUserOrganId());
if(goodsRespVOS.size() == 1){
return;
}
planActualGoodsResps.add( planActualGoodsResps.add(
PlanActualGoodsResp.builder() PlanActualGoodsResp.builder()
@@ -1513,8 +1514,10 @@ public class PlanServiceImpl implements PlanService {
if(CollUtil.isNotEmpty(planActualGoodsLists)) { if(CollUtil.isNotEmpty(planActualGoodsLists)) {
// 有选实际大板的小板加大板创建排单
getCreatePlanMultipleGoodsList(planActualGoodsLists,planItemDOS,plateItemList,planActualGoodsModelDOS,planDOS,processId,loginUser); getCreatePlanMultipleGoodsList(planActualGoodsLists,planItemDOS,plateItemList,planActualGoodsModelDOS,planDOS,processId,loginUser);
// 没有选择实际大板的创建排单
if(MixConfigTypeEnum.SAMEMATERIALANDTHICKNESS.equals(mixedType)){ if(MixConfigTypeEnum.SAMEMATERIALANDTHICKNESS.equals(mixedType)){
// 筛选出材质和厚度相同的大板 // 筛选出材质和厚度相同的大板
grouped = groupByMaterialAndThicknessEqualToOne(goodsItemList); grouped = groupByMaterialAndThicknessEqualToOne(goodsItemList);
@@ -36,23 +36,12 @@ public class CuttingSaveReqVO {
@NotNull(message = "标签id不能空") @NotNull(message = "标签id不能空")
private Long labelId; private Long labelId;
// // 新的机台逻辑需要删除
// @Schema(description = "机台模板id")
// @NotNull(groups = CreateGroup.class, message = "机台模板id不能空")
// private Long templateId;
@Schema(description = "品牌ID", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "品牌ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "品牌ID不能为空") @NotNull(message = "品牌ID不能为空")
private Long brandId; private Long brandId;
// @Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
// private String brand;
// @Schema(description = "型号", requiredMode = Schema.RequiredMode.REQUIRED)
// private String model;
@Schema(description = "机台的型号-机台的ID") @Schema(description = "机台的型号-机台的ID")
@NotNull(message = "机台型号不能为空",groups = CreateGroup.class) @NotNull(message = "机台型号不能为空",groups = CreateGroup.class)
private Long machineId; private Long machineId;
@@ -18,7 +18,6 @@ public class MachineConvert {
.labelId(createReqVO.getLabelId()) .labelId(createReqVO.getLabelId())
.setting(createReqVO.getMachineSettingDO().toJSONString()) .setting(createReqVO.getMachineSettingDO().toJSONString())
.brandId(createReqVO.getBrandId()) .brandId(createReqVO.getBrandId())
// .model(createReqVO.getModel())
.build(); .build();
} }