| | |
| | | private MesMdWorkshopService workshopService; |
| | | @Resource |
| | | private cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService workstationService; |
| | | @Resource |
| | | private cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationMachineService workstationMachineService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "创建设备") |
| | |
| | | } |
| | | |
| | | @GetMapping("/simple-list") |
| | | @Operation(summary = "获得设备精简列表", description = "主要用于前端的下拉选项") |
| | | public CommonResult<List<MesDvMachineryRespVO>> getMachinerySimpleList() { |
| | | @Operation(summary = "获得设备精简列表", description = "主要用于前端的下拉选项;传 workstationId 时只返回该工作站绑定的设备") |
| | | @Parameter(name = "workstationId", description = "工作站编号,可选;传则只返回该工作站绑定的设备") |
| | | public CommonResult<List<MesDvMachineryRespVO>> getMachinerySimpleList( |
| | | @RequestParam(value = "workstationId", required = false) Long workstationId) { |
| | | List<MesDvMachineryDO> list = machineryService.getMachineryList(); |
| | | if (workstationId != null) { |
| | | var boundIds = cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet( |
| | | workstationMachineService.getWorkstationMachineListByWorkstationId(workstationId), |
| | | cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationMachineDO::getMachineryId); |
| | | list = list.stream().filter(machinery -> boundIds.contains(machinery.getId())).toList(); |
| | | } |
| | | return success(BeanUtils.toBean(list, MesDvMachineryRespVO.class)); |
| | | } |
| | | |