From e2a5657e3a0b8615bcd78a3149e5ba9ce5579bb8 Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期一, 02 十二月 2024 16:25:35 +0800
Subject: [PATCH] 1

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoDetailService.cs |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoDetailService.cs"
index 666b495..7a7b802 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoDetailService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoDetailService.cs"
@@ -1,9 +1,14 @@
-锘縰sing System;
+锘縰sing Magicodes.ExporterAndImporter.Core;
+using Magicodes.ExporterAndImporter.Excel;
+using SqlSugar;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEA_Core;
 using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Helper;
 using WIDESEA_IStockRepository;
 using WIDESEA_IStockService;
 using WIDESEA_Model.Models;
@@ -21,5 +26,34 @@
         {
             return BaseDal.QueryFirst(x => SerialNumbers.Contains(x.SerialNumber)) != null;
         }
+
+        //瀵煎嚭
+        public override WebResponseContent Export(PageDataOptions options)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                string savePath = AppDomain.CurrentDomain.BaseDirectory + $"ExcelExport";
+                IExporter exporter = new ExcelExporter();
+                //娣诲姞鏉′欢
+                string wheres = options.ValidatePageOptions(TProperties);
+                //鑾峰彇鎺掑簭瀛楁
+                Dictionary<string, OrderByType> orderbyDic = options.GetPageDataSort(TProperties);
+                List<Dt_StockInfoDetail> entities = BaseDal.QueryData(wheres, orderbyDic);
+
+                byte[] data = exporter.ExportAsByteArray(entities).Result;
+
+                string fileName = "1.xlsx";
+
+                FileHelper.WriteFile(savePath, fileName, data);
+
+                content = WebResponseContent.Instance.OK(data: savePath + "\\" + fileName);
+            }
+            catch (Exception ex)
+            {
+                content = WebResponseContent.Instance.Error(ex.Message);
+            }
+            return content;
+        }
     }
 }

--
Gitblit v1.9.3