From c47c8647f514eaa8c6a7624185b55738e8625c2c Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 05 十一月 2026 13:37:31 +0800
Subject: [PATCH] feat(product-issue): 支持按任务工序校验和选择领料物料

---
 yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/reel/ProductCtcReelController.java |   38 +++++++++++++++++++++++++++++++++++---
 1 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/reel/ProductCtcReelController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/reel/ProductCtcReelController.java
index 8dca240..690e905 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/reel/ProductCtcReelController.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pd/reel/ProductCtcReelController.java
@@ -5,6 +5,9 @@
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+import cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo.ProductCtcReelImportExcelVO;
+import cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo.ProductCtcReelImportRespVO;
 import cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo.ProductCtcReelPageReqVO;
 import cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo.ProductCtcReelRespVO;
 import cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo.ProductCtcReelSaveReqVO;
@@ -14,13 +17,17 @@
 import cn.iocoder.yudao.module.mes.service.pd.reel.ProductCtcReelService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Parameters;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.Valid;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -68,7 +75,6 @@
     @GetMapping("/get")
     @Operation(summary = "鑾峰緱鐩樺叿璁$畻璁板綍")
     @Parameter(name = "id", description = "缂栧彿", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('mes:pd-ctc-reel:query')")
     public CommonResult<ProductCtcReelRespVO> getReel(@RequestParam("id") Long id) {
         ProductCtcReelDO reel = reelService.getReel(id);
         if (reel == null) {
@@ -79,7 +85,6 @@
 
     @GetMapping("/page")
     @Operation(summary = "鑾峰緱鐩樺叿璁$畻璁板綍鍒嗛〉")
-    @PreAuthorize("@ss.hasPermission('mes:pd-ctc-reel:query')")
     public CommonResult<PageResult<ProductCtcReelRespVO>> getReelPage(@Valid ProductCtcReelPageReqVO pageReqVO) {
         PageResult<ProductCtcReelDO> pageResult = reelService.getReelPage(pageReqVO);
         return success(new PageResult<>(buildReelRespVOList(pageResult.getList()), pageResult.getTotal()));
@@ -88,12 +93,39 @@
     @GetMapping("/list-by-ctc")
     @Operation(summary = "鑾峰緱鎸囧畾鎹綅瀵肩嚎浜у搧鐨勭洏鍏疯绠楄褰曞垪琛�")
     @Parameter(name = "ctcId", description = "鎹綅瀵肩嚎浜у搧ID", required = true)
-    @PreAuthorize("@ss.hasPermission('mes:pd-ctc-reel:query')")
     public CommonResult<List<ProductCtcReelRespVO>> getReelListByCtcId(@RequestParam("ctcId") Long ctcId) {
         List<ProductCtcReelDO> list = reelService.getReelListByCtcId(ctcId);
         return success(buildReelRespVOList(list));
     }
 
+    @GetMapping("/get-import-template")
+    @Operation(summary = "鑾峰緱鐩樺叿璁$畻璁板綍瀵煎叆妯℃澘")
+    public void importTemplate(HttpServletResponse response) throws IOException {
+        List<ProductCtcReelImportExcelVO> list = Collections.singletonList(
+                ProductCtcReelImportExcelVO.builder()
+                        .ctcOrderSpec("QQNB-2/120").reelType("鏈ㄧ洏")
+                        .reelOuterDiameter(new java.math.BigDecimal("1200")).reelInnerDiameter(new java.math.BigDecimal("630"))
+                        .reelWidth(new java.math.BigDecimal("850")).maxCapacity(new java.math.BigDecimal("3"))
+                        .recommendedLength(new java.math.BigDecimal("2.5")).netWeight(new java.math.BigDecimal("180"))
+                        .grossWeight(new java.math.BigDecimal("200")).calcFormula("").remark("").build()
+        );
+        ExcelUtils.write(response, "鐩樺叿璁$畻璁板綍瀵煎叆妯℃澘.xls", "鐩樺叿璁$畻璁板綍鍒楄〃", ProductCtcReelImportExcelVO.class, list);
+    }
+
+    @PostMapping("/import")
+    @Operation(summary = "瀵煎叆鐩樺叿璁$畻璁板綍")
+    @Parameters({
+            @Parameter(name = "file", description = "Excel 鏂囦欢", required = true),
+            @Parameter(name = "updateSupport", description = "鏄惁鏀寔鏇存柊锛岄粯璁や负 false", example = "true")
+    })
+    @PreAuthorize("@ss.hasPermission('mes:pd-ctc-reel:import')")
+    public CommonResult<ProductCtcReelImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
+                                                                @RequestParam(value = "updateSupport", required = false,
+                                                                        defaultValue = "false") Boolean updateSupport) throws Exception {
+        List<ProductCtcReelImportExcelVO> list = ExcelUtils.read(file, ProductCtcReelImportExcelVO.class);
+        return success(reelService.importReelList(list, updateSupport));
+    }
+
     // ==================== 鎷兼帴 VO ====================
 
     private List<ProductCtcReelRespVO> buildReelRespVOList(List<ProductCtcReelDO> list) {

--
Gitblit v1.9.3