From 0b26067b6cc5d531938fa79cb540a45e125261d2 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期五, 12 一月 2024 14:55:54 +0800
Subject: [PATCH] 1.App版本升级接口 2.模具清单新增、导入添加仓库、库位字段 3.MES工单查询增加明细id关联

---
 VueWebCoreApi/Controllers/ImportExcelController.cs |   54 ++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 44 insertions(+), 10 deletions(-)

diff --git a/VueWebCoreApi/Controllers/ImportExcelController.cs b/VueWebCoreApi/Controllers/ImportExcelController.cs
index 3d67241..1617421 100644
--- a/VueWebCoreApi/Controllers/ImportExcelController.cs
+++ b/VueWebCoreApi/Controllers/ImportExcelController.cs
@@ -1,4 +1,5 @@
-锘縰sing Microsoft.AspNetCore.Mvc;
+锘縰sing Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Mvc;
 using System;
 using System.Collections.Generic;
 using System.Data;
@@ -18,6 +19,12 @@
     //[ChannelActionFilter]
     public class ImportExcelController : Controller
     {
+        private readonly IWebHostEnvironment _hostingEnvironment;
+
+        public ImportExcelController(IWebHostEnvironment hostingEnvironment)
+        {
+            _hostingEnvironment = hostingEnvironment;
+        }
 
         #region[Excel瀵煎叆妯℃澘鍒楄〃]
         /// <summary>
@@ -55,6 +62,33 @@
             mes.code = "200";
             mes.data = msg;
             return Json(mes);
+
+            //ToMessage mes = new ToMessage();
+            //List<ScoreReport> list = ExcelList.ExcelData();
+            //list = list.Where(s => s.FileCode == FileCode).ToList();
+            //var filename = list[0].FileName + ".xls";
+            //var wwwRootPath = _hostingEnvironment.WebRootPath;
+            //var fileDirectory = Path.Combine(wwwRootPath, "Excel"); // 鏇挎崲涓烘偍鐨凟xcel鏂囦欢鎵�鍦ㄧ洰褰�
+            //var filePath = Path.Combine(fileDirectory, $"{filename}.xlsx"); // 鍋囪鏂囦欢鍚嶇紪鐮佷负鏂囦欢鍚�
+
+            //if (System.IO.File.Exists(filePath))
+            //{
+            //    var fileInfo = new FileInfo(filePath);
+            //    var result = new
+            //    {
+            //        FileName = fileInfo.Name,
+            //        FilePath = filePath,
+            //        FileSize = fileInfo.Length
+            //    };
+            //    return Json(result);
+            //}
+            //else
+            //{
+            //    mes.code = "300";
+            //    mes.data = "";
+            //    mes.message = "鏂囦欢涓嶅瓨鍦�";
+            //}
+            //return Json(mes);
         }
         #endregion
 
@@ -84,12 +118,12 @@
                 list.json2 = list.json2;
                 return Json(list);
             }
-            //list.json3 = ExcelCheckData(myModel);  //鏁版嵁楠岃瘉
-            //if (list.json3.code == "300")
-            //{
-            //    list.json3 = list.json3;
-            //    return Json(list);
-            //}
+            list.json3 = ExcelImportSubmit(dataTable, FileCode);  //鏁版嵁瀵煎叆
+            if (list.json3.code == "300")
+            {
+                list.json3 = list.json3;
+                return Json(list);
+            }
             return Json(list);
         }
         #endregion
@@ -119,7 +153,7 @@
             catch (Exception e)
             {
                 mes.code = "300";
-                mes.Message = e.Message;
+                mes.message = e.Message;
             }
             return mes;
         }
@@ -145,7 +179,7 @@
             List<DataTable> dataTable = myModel.TableData;
             list = ExcelCheckBLL.ExcelCheckData(FileCode, dataTable, out StuCode, out message, out count);
             mes.code = StuCode;
-            mes.Message = message;
+            mes.message = message;
             mes.count = count;
             mes.data = list;
             return mes;
@@ -179,7 +213,7 @@
             catch (Exception e)
             {
                 mes.code = "300";
-                mes.Message = e.Message;
+                mes.message = e.Message;
             }
             return mes;
         }

--
Gitblit v1.9.3