From 8d0b466ef4fe497932e15c186688679e55a26f62 Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期五, 22 八月 2025 10:45:59 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/org/jeecg/modules/cms/service/impl/CuttingInboundServiceImpl.java |   80 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 80 insertions(+), 0 deletions(-)

diff --git a/src/main/java/org/jeecg/modules/cms/service/impl/CuttingInboundServiceImpl.java b/src/main/java/org/jeecg/modules/cms/service/impl/CuttingInboundServiceImpl.java
index 4ca9708..991f67f 100644
--- a/src/main/java/org/jeecg/modules/cms/service/impl/CuttingInboundServiceImpl.java
+++ b/src/main/java/org/jeecg/modules/cms/service/impl/CuttingInboundServiceImpl.java
@@ -1,11 +1,20 @@
 package org.jeecg.modules.cms.service.impl;
 
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.cms.entity.CuttingInbound;
+import org.jeecg.modules.cms.entity.CuttingInboundDetail;
 import org.jeecg.modules.cms.mapper.CuttingInboundMapper;
 import org.jeecg.modules.cms.service.ICuttingInboundService;
+import org.jeecg.modules.cms.service.ICuttingInboundDetailService;
+import org.jeecg.modules.cms.vo.CuttingInboundExportVo;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @Description: 鍒�鍏峰叆搴撳崟
@@ -15,5 +24,76 @@
  */
 @Service
 public class CuttingInboundServiceImpl extends ServiceImpl<CuttingInboundMapper, CuttingInbound> implements ICuttingInboundService {
+    @Autowired
+    private ICuttingInboundDetailService cuttingInboundDetailService; // 娉ㄥ叆浠庤〃鏈嶅姟
+    /**
+     * 閫氳繃Excel瀵煎叆鍒�鍏峰叆搴撳崟鏁版嵁
+     *
+     * @param list 寰呭鍏ョ殑鏁版嵁鍒楄〃
+     * @return 瀵煎叆缁撴灉
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Result<?> importExcelData(List<CuttingInboundExportVo> list) {
+//        try {
+//            for (CuttingInboundExportVo exportVo : list) {
+//                // 淇濆瓨涓昏〃鏁版嵁
+//                CuttingInbound cuttingInbound = new CuttingInbound();
+//                cuttingInbound.setReceiver(exportVo.getReceiver());
+//                cuttingInbound.setReceiveTime(exportVo.getReceiveTime());
+//                cuttingInbound.setReceiveComment(exportVo.getReceiveComment());
+//                cuttingInbound.setConfirmer(exportVo.getConfirmer());
+//                cuttingInbound.setConfirmTime(exportVo.getConfirmTime());
+//                cuttingInbound.setConfirmComment(exportVo.getConfirmComment());
+//                cuttingInbound.setOrderStatus(exportVo.getOrderStatus());
+//
+//                // 淇濆瓨涓昏〃鏁版嵁浠ヨ幏鍙朓D
+//                this.save(cuttingInbound);
+//
+//                // 鑾峰彇涓昏〃ID
+//                String orderId = cuttingInbound.getId();
+//
+//                // 澶勭悊浠庤〃鏁版嵁
+//                List<CuttingInboundDetail> detailList = exportVo.getDetailList();
+//                if (detailList != null && !detailList.isEmpty()) {
+//                    for (CuttingInboundDetail detail : detailList) {
+//                        detail.setOrderId(orderId); // 璁剧疆澶栭敭鍏宠仈
+//                        cuttingInboundDetailService.save(detail);
+//                    }
+//                }
+//            }
+//            return Result.ok("瀵煎叆鎴愬姛");
+//        } catch (Exception e) {
+//            log.error("瀵煎叆澶辫触", e);
+//            return Result.error("瀵煎叆澶辫触: " + e.getMessage());
+//        }
+//    }
+        for (CuttingInboundExportVo exportVo : list) {
+            // 淇濆瓨涓昏〃鏁版嵁
+            CuttingInbound cuttingInbound = new CuttingInbound();
+            cuttingInbound.setReceiver(exportVo.getReceiver());
+            cuttingInbound.setReceiveTime(exportVo.getReceiveTime());
+            cuttingInbound.setReceiveComment(exportVo.getReceiveComment());
+            cuttingInbound.setConfirmer(exportVo.getConfirmer());
+            cuttingInbound.setConfirmTime(exportVo.getConfirmTime());
+            cuttingInbound.setConfirmComment(exportVo.getConfirmComment());
+            cuttingInbound.setOrderStatus(exportVo.getOrderStatus());
 
+            // 淇濆瓨涓昏〃鏁版嵁浠ヨ幏鍙朓D
+            this.save(cuttingInbound);
+
+            // 鑾峰彇涓昏〃ID
+            String orderId = cuttingInbound.getId();
+
+            // 澶勭悊浠庤〃鏁版嵁
+            List<CuttingInboundDetail> detailList = exportVo.getDetailList();
+            if (detailList != null && !detailList.isEmpty()) {
+                for (CuttingInboundDetail detail : detailList) {
+                    detail.setOrderId(orderId); // 璁剧疆澶栭敭鍏宠仈
+                    cuttingInboundDetailService.save(detail);
+                }
+            }
+        }
+        return Result.ok("瀵煎叆鎴愬姛");
+    }
 }

--
Gitblit v1.9.3