| | |
| | | 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; |
| | |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete-list") |
| | | @Operation(summary = "批量删除物料") |
| | | @Parameter(name = "ids", description = "编号列表", required = true, example = "1,2,3") |
| | | @PreAuthorize("@ss.hasPermission('mdm:item:delete')") |
| | | public CommonResult<Boolean> deleteItemList(@RequestParam("ids") List<Long> ids) { |
| | | itemService.deleteItemList(ids); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获得物料") |
| | | @Parameter(name = "id", description = "编号", required = true, example = "1") |
| | |
| | | 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())); |
| | | } |