| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.qc.rqc; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.batch.MesWmBatchDO; |
| | | import cn.iocoder.yudao.module.mes.service.wm.batch.MesWmBatchService; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | |
| | | public class MesQcRqcController { |
| | | |
| | | @Resource |
| | | private MesWmBatchService batchService; |
| | | |
| | | @Resource |
| | | private MesQcRqcService rqcService; |
| | | @Resource |
| | | private MesMdItemService itemService; |
| | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获得退货检验单") |
| | | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:qc-rqc:query')") |
| | | public CommonResult<MesQcRqcRespVO> getRqc(@RequestParam("id") Long id) { |
| | | MesQcRqcDO rqc = rqcService.getRqc(id); |
| | | return success(buildRqcRespVOList(Collections.singletonList(rqc)).get(0)); |
| | |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得退货检验单分页") |
| | | @PreAuthorize("@ss.hasPermission('mes:qc-rqc:query')") |
| | | public CommonResult<PageResult<MesQcRqcRespVO>> getRqcPage(@Valid MesQcRqcPageReqVO pageReqVO) { |
| | | PageResult<MesQcRqcDO> pageResult = rqcService.getRqcPage(pageReqVO); |
| | | return success(new PageResult<>(buildRqcRespVOList(pageResult.getList()), pageResult.getTotal())); |
| | |
| | | convertSet(list, MesQcRqcDO::getInspectorUserId)); |
| | | // 批量查询检验项指标 |
| | | Map<Long, String> indicatorSummaryMap = buildIndicatorSummaryMap(list); |
| | | Map<String, MesWmBatchDO> batchMap = new HashMap<>(); |
| | | for (String code : convertSet(list, MesQcRqcDO::getBatchCode)) { |
| | | if (code != null && !code.isBlank()) batchMap.put(code, batchService.getBatchByCode(code)); |
| | | } |
| | | // 拼装 VO |
| | | return BeanUtils.toBean(list, MesQcRqcRespVO.class, vo -> { |
| | | findAndThen(batchMap, vo.getBatchCode(), batch -> vo.setReelNo(batch.getReelNo())); |
| | | findAndThen(itemMap, vo.getItemId(), item -> { |
| | | vo.setItemCode(item.getCode()).setItemName(item.getName()).setItemSpecification(item.getSpecification()); |
| | | findAndThen(unitMeasureMap, item.getUnitMeasureId(), |