| | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; |
| | |
| | | } |
| | | |
| | | @GetMapping("/list-by-item-and-type") |
| | | @Operation(summary = "根据物料或工单/任务和检测种类获取可用质检方案") |
| | | @Operation(summary = "根据物料或工单/任务和检测种类获取可用质检方案(未指定物料/工单/任务时返回该检测种类下全部启用方案)") |
| | | @PreAuthorize("@ss.hasPermission('mes:qc-template:query')") |
| | | public CommonResult<List<MesQcTemplateItemOptionRespVO>> getTemplateItemOptionList( |
| | | @RequestParam(value = "qcType", required = false) Integer qcType, |
| | | @RequestParam(value = "itemId", required = false) Long itemId, |
| | | @RequestParam(value = "workOrderId", required = false) Long workOrderId, |
| | | @RequestParam(value = "taskId", required = false) Long taskId) { |
| | | // 未指定物料/工单/任务时,按检测种类返回全部启用的质检方案(不限制产品物料关联) |
| | | if (itemId == null && workOrderId == null && taskId == null && qcType != null) { |
| | | List<MesQcTemplateItemOptionRespVO> options = templateService.getEnabledTemplateListByType(qcType) |
| | | .stream().map(template -> new MesQcTemplateItemOptionRespVO() |
| | | .setTemplateId(template.getId()).setTemplateCode(template.getCode()) |
| | | .setTemplateName(template.getName())) |
| | | .collect(Collectors.toList()); |
| | | return success(options); |
| | | } |
| | | List<MesQcTemplateItemDO> list = templateItemService.getTemplateItemList( |
| | | itemId, qcType, workOrderId, taskId); |
| | | if (CollUtil.isEmpty(list)) { |