| | |
| | | import cn.iocoder.yudao.module.mdm.service.item.MdmItemService; |
| | | import cn.iocoder.yudao.module.mdm.service.unit.MdmUnitMeasureService; |
| | | import cn.iocoder.yudao.module.mdm.service.warehouse.MdmWarehouseService; |
| | | import cn.iocoder.yudao.module.mes.api.item.MesMdItemApi; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @Resource |
| | | private MdmItemService itemService; |
| | | |
| | | @Resource |
| | | private MesMdItemApi mesMdItemApi; |
| | | |
| | | @Resource |
| | | private MdmItemCategoryService itemCategoryService; |
| | |
| | | enrichItemRespVO(resp); |
| | | // 填充批次属性配置 |
| | | enrichItemBatchConfig(resp); |
| | | // 填充同步状态 |
| | | resp.setSyncedMes(mesMdItemApi.getSyncedMdmItemIds(Set.of(id)).contains(id)); |
| | | } |
| | | return success(resp); |
| | | } |
| | |
| | | convertSet(pageResult.getList(), MdmItemDO::getUnitMeasureId)); |
| | | // 转换 |
| | | List<MdmItemRespVO> respList = BeanUtils.toBean(pageResult.getList(), MdmItemRespVO.class); |
| | | // 批量查询同步状态 |
| | | Set<Long> allIds = convertSet(respList, MdmItemRespVO::getId); |
| | | Set<Long> syncedIds = mesMdItemApi.getSyncedMdmItemIds(allIds); |
| | | // 批量关联查询辅单位名称 |
| | | Set<Long> unitIds = new HashSet<>(); |
| | | respList.forEach(resp -> { |
| | |
| | | if (warehouse != null) { |
| | | resp.setWarehouseName(warehouse.getName()); |
| | | } |
| | | // 同步状态 |
| | | resp.setSyncedMes(syncedIds.contains(resp.getId())); |
| | | }); |
| | | return success(new PageResult<>(respList, pageResult.getTotal())); |
| | | } |