| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | |
| | | HttpServletRequest req) { |
| | | Map<String, String[]> parameterMap = req.getParameterMap(); |
| | | QueryWrapper<MesProductionWorkOrder> queryWrapper = QueryGenerator.initQueryWrapper(mesProductionWorkOrder, parameterMap); |
| | | String[] startDates = parameterMap.get("startDate"); |
| | | String[] endDates = parameterMap.get("endDate"); |
| | | if (startDates != null && startDates.length > 0) { |
| | | queryWrapper.ge("work_order_date", startDates[0]); |
| | | } |
| | | if (endDates != null && endDates.length > 0) { |
| | | queryWrapper.le("work_order_date", endDates[0]); |
| | | } |
| | | Page<MesProductionWorkOrder> page = new Page<MesProductionWorkOrder>(pageNo, pageSize); |
| | | IPage<MesProductionWorkOrder> pageList = mesProductionWorkOrderService.page(page, queryWrapper); |
| | | IPage<MesProductionWorkOrder> pageList = mesProductionWorkOrderService.queryPageList(page, parameterMap); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | |
| | | if (!validatePlan(mesProductionWorkOrderList)) { |
| | | return Result.error("排产计划不合理,保存失败!"); |
| | | } |
| | | mesProductionWorkOrderList.forEach(item -> item.setWorkOrderStatus(ProductionWorkOrderStatus.NEW.name())); |
| | | mesProductionWorkOrderService.saveBatch(mesProductionWorkOrderList); |
| | | mesProductionWorkOrderList.forEach(item -> { |
| | | if (Objects.isNull(item.getId())) { |
| | | item.setWorkOrderStatus(ProductionWorkOrderStatus.NEW.name()); |
| | | } |
| | | }); |
| | | mesProductionWorkOrderService.saveOrUpdateBatch(mesProductionWorkOrderList); |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | |
| | | @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("执行成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |