| | |
| | | @PostMapping(value = "/republish") |
| | | public Result<String> republish(@RequestBody MesProductionWorkOrderRepublishRequest request) { |
| | | MesProductionWorkOrder workOrder = mesProductionWorkOrderService.getById(request.getId()); |
| | | //todo 判断班次是否结束的逻辑 |
| | | if (!ProductionWorkOrderStatus.PUBLISHED.name().equals(workOrder.getWorkOrderStatus())) { |
| | | if (ProductionWorkOrderStatus.NEW.name().equals(workOrder.getWorkOrderStatus()) |
| | | || ProductionWorkOrderStatus.CLOSED.name().equals(workOrder.getWorkOrderStatus())) { |
| | | return Result.error("当前工单状态不支持重发布!"); |
| | | } |
| | | MesProductionWorkOrder republish = new MesProductionWorkOrder() |
| | |
| | | .setPlanQuantity(request.getPlanQuantity()) |
| | | .setRepublisher(Objects.requireNonNull(getCurrentUser()).getUsername()) |
| | | .setRepublishTime(new Date()) |
| | | .setRepublishReason(request.getRepublishReason()) |
| | | .setWorkOrderStatus(ProductionWorkOrderStatus.REPUBLISHED.name()); |
| | | .setRepublishReason(request.getRepublishReason()); |
| | | mesProductionWorkOrderService.updateById(republish); |
| | | return Result.ok("重发布成功!"); |
| | | } |
| | | |
| | | @AutoLog(value = "排产工单-执行排产工单计划") |
| | | @ApiOperation(value = "排产工单-执行排产工单计划", notes = "排产工单-执行排产工单计划") |
| | | @GetMapping(value = "/execute") |
| | | public Result<?> execute(@RequestParam("id") String id) { |
| | | MesProductionWorkOrder workOrder = mesProductionWorkOrderService.getById(id); |
| | | if (!ProductionWorkOrderStatus.PUBLISHED.name().equals(workOrder.getWorkOrderStatus())) { |
| | | return Result.error("当前工单状态不能执行!"); |
| | | } |
| | | //todo 齐套性检查、工艺点检、设备点检 的校验逻辑 |
| | | MesProductionWorkOrder executeOrder = new MesProductionWorkOrder() |
| | | .setId(id) |
| | | .setWorkOrderStatus(ProductionWorkOrderStatus.EXECUTING.name()); |
| | | mesProductionWorkOrderService.updateById(executeOrder); |
| | | return Result.ok("执行成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |