From ccdebc5369c108e6616550bfbe1cd47ec1e05813 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 09 十一月 2026 11:44:31 +0800
Subject: [PATCH] feat(bpm): 接入询价单与项目用印审批流程

---
 yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/machinery/MesDvMachineryController.java |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/machinery/MesDvMachineryController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/machinery/MesDvMachineryController.java
index 932db26..8c18b06 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/machinery/MesDvMachineryController.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/machinery/MesDvMachineryController.java
@@ -52,6 +52,10 @@
     private MesDvMachineryTypeService machineryTypeService;
     @Resource
     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 = "鍒涘缓璁惧")
@@ -80,7 +84,6 @@
     @GetMapping("/get")
     @Operation(summary = "鑾峰緱璁惧")
     @Parameter(name = "id", description = "缂栧彿", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('mes:dv-machinery:query')")
     public CommonResult<MesDvMachineryRespVO> getMachinery(@RequestParam("id") Long id) {
         MesDvMachineryDO machinery = machineryService.getMachinery(id);
         if (machinery == null) {
@@ -91,7 +94,6 @@
 
     @GetMapping("/page")
     @Operation(summary = "鑾峰緱璁惧鍒嗛〉")
-    @PreAuthorize("@ss.hasPermission('mes:dv-machinery:query')")
     public CommonResult<PageResult<MesDvMachineryRespVO>> getMachineryPage(@Valid MesDvMachineryPageReqVO pageReqVO) {
         PageResult<MesDvMachineryDO> pageResult = machineryService.getMachineryPage(pageReqVO);
         return success(new PageResult<>(buildMachineryRespVOList(pageResult.getList()), pageResult.getTotal()));
@@ -111,10 +113,17 @@
     }
 
     @GetMapping("/simple-list")
-    @Operation(summary = "鑾峰緱璁惧绮剧畝鍒楄〃", description = "涓昏鐢ㄤ簬鍓嶇鐨勪笅鎷夐�夐」")
-    @PreAuthorize("@ss.hasPermission('mes:dv-machinery:query')")
-    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));
     }
 
@@ -151,17 +160,21 @@
         if (CollUtil.isEmpty(list)) {
             return Collections.emptyList();
         }
-        // 1. 鎵归噺鑾峰彇璁惧绫诲瀷鍜岃溅闂翠俊鎭�
+        // 1. 鎵归噺鑾峰彇璁惧绫诲瀷銆佽溅闂村拰宸ヤ綔绔欎俊鎭�
         Map<Long, MesDvMachineryTypeDO> machineryTypeMap = machineryTypeService.getMachineryTypeMap(
                 convertSet(list, MesDvMachineryDO::getMachineryTypeId));
         Map<Long, MesMdWorkshopDO> workshopMap = workshopService.getWorkshopMap(
                 convertSet(list, MesDvMachineryDO::getWorkshopId));
+        Map<Long, cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO> workstationMap =
+                workstationService.getWorkstationMap(convertSet(list, MesDvMachineryDO::getWorkstationId));
         // 2. 鎷兼帴 VO
         return BeanUtils.toBean(list, MesDvMachineryRespVO.class, vo -> {
             MapUtils.findAndThen(machineryTypeMap, vo.getMachineryTypeId(),
                     machineryType -> vo.setMachineryTypeName(machineryType.getName()));
             MapUtils.findAndThen(workshopMap, vo.getWorkshopId(),
                     workshop -> vo.setWorkshopName(workshop.getName()));
+            MapUtils.findAndThen(workstationMap, vo.getWorkstationId(),
+                    workstation -> vo.setWorkstationName(workstation.getName()));
         });
     }
 

--
Gitblit v1.9.3