| | |
| | | import cn.iocoder.yudao.module.mes.service.pro.task.MesProTaskService; |
| | | import cn.iocoder.yudao.module.mes.service.qc.pendinginspect.MesQcPendingInspectService; |
| | | import cn.iocoder.yudao.module.mes.service.qc.support.MesQcItemResolver; |
| | | import cn.iocoder.yudao.module.mes.service.qc.template.MesQcTemplateItemService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | private MesMdWorkstationService workstationService; |
| | | @Resource |
| | | private MesProTaskService taskService; |
| | | @Resource |
| | | private MesQcTemplateItemService templateItemService; |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得待检任务分页") |
| | |
| | | // 批量查询任务(IPQC 场景) |
| | | Map<Long, MesProTaskDO> taskMap = taskService.getTaskMap( |
| | | convertSet(list, MesQcPendingInspectRespVO::getTaskId)); |
| | | // 同一 物料+检验类型 的模板匹配结果缓存,避免重复查询 |
| | | Map<String, Boolean> canInspectCache = new HashMap<>(); |
| | | // 拼装 |
| | | list.forEach(vo -> { |
| | | findAndThen(itemMap, vo.getItemId(), item -> { |
| | |
| | | findAndThen(workstationMap, vo.getWorkstationId(), |
| | | workstation -> vo.setWorkstationName(workstation.getName())); |
| | | findAndThen(taskMap, vo.getTaskId(), task -> vo.setTaskCode(task.getCode())); |
| | | vo.setCanInspect(canInspectCache.computeIfAbsent( |
| | | vo.getQcType() + ":" + vo.getItemId(), |
| | | key -> templateItemService.hasEnabledTemplate(vo.getItemId(), vo.getQcType()))); |
| | | }); |
| | | } |
| | | |