| | |
| | | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.Parameters; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | public CommonResult<Boolean> updateTask(@Valid @RequestBody MesProTaskSaveReqVO updateReqVO) { |
| | | taskService.updateTask(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/calculate-duration") |
| | | @Operation(summary = "计算生产时长", description = "根据工作站绑定设备的生产效率和传送履带,自动计算生产时长(小时)") |
| | | @Parameters({ |
| | | @Parameter(name = "workstationId", description = "工作站编号", required = true), |
| | | @Parameter(name = "quantity", description = "排产数量", required = true) |
| | | }) |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-task:query')") |
| | | public CommonResult<java.util.Map<String, Object>> calculateDuration( |
| | | @RequestParam("workstationId") Long workstationId, |
| | | @RequestParam("quantity") BigDecimal quantity) { |
| | | Integer duration = taskService.calculateDuration(workstationId, quantity); |
| | | return success(java.util.Map.of("duration", duration)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | |
| | | convertSet(itemMap.values(), MesMdItemDO::getUnitMeasureId)); |
| | | Map<Long, CrmCustomerRespDTO> customerMap = customerApi.getCustomerMap( |
| | | convertSet(list, MesProTaskDO::getClientId)); |
| | | // 工序的 checkFlag:批量查询后构建 routeId -> processId -> checkFlag 的双层 Map |
| | | // 工序的 checkFlag + backflushFlag:批量查询后构建 routeId -> processId -> flag 的双层 Map |
| | | Set<Long> routeIds = convertSet(list, MesProTaskDO::getRouteId); |
| | | Map<Long, Map<Long, Boolean>> routeProcessCheckFlagMap = new HashMap<>(); |
| | | Map<Long, Map<Long, Boolean>> routeProcessBackflushFlagMap = new HashMap<>(); |
| | | if (CollUtil.isNotEmpty(routeIds)) { |
| | | List<MesProRouteProcessDO> allRouteProcesses = routeProcessService.getRouteProcessListByRouteIds(routeIds); |
| | | for (MesProRouteProcessDO rp : allRouteProcesses) { |
| | | routeProcessCheckFlagMap |
| | | .computeIfAbsent(rp.getRouteId(), k -> new HashMap<>()) |
| | | .put(rp.getProcessId(), Boolean.TRUE.equals(rp.getCheckFlag())); |
| | | routeProcessBackflushFlagMap |
| | | .computeIfAbsent(rp.getRouteId(), k -> new HashMap<>()) |
| | | .put(rp.getProcessId(), Boolean.TRUE.equals(rp.getBackflushFlag())); |
| | | } |
| | | } |
| | | // 报工在途量:按任务聚合 feedbackQuantity(草稿/审批中/待检验 = 在途;已完成 = 已审批) |
| | |
| | | vo.setClientName(customer.getName())); |
| | | findAndThen(routeProcessCheckFlagMap, task.getRouteId(), processCheckMap -> |
| | | findAndThen(processCheckMap, task.getProcessId(), vo::setCheckFlag)); |
| | | findAndThen(routeProcessBackflushFlagMap, task.getRouteId(), processBackflushMap -> |
| | | findAndThen(processBackflushMap, task.getProcessId(), vo::setBackflushFlag)); |
| | | return vo; |
| | | }); |
| | | } |