From fb118d09f81bf6b35d477beb26559f0a48f5ece9 Mon Sep 17 00:00:00 2001 From: Sai Date: Thu, 21 Sep 2023 18:05:22 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=AA=BF=E6=95=B4TestLog=20=E8=B6=85?= =?UTF-8?q?=E9=80=A3=E7=B5=90=20web=20appsettings.json=20=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=20"TestLogUncPath":=20"\\\\10.168.135.236\\TestLog\\S?= =?UTF-8?q?WMLog\\",?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 20 ++++++++++++++++--- AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml | 18 +++++++++++++++-- AMESCoreStudio.Web/Views/PCS/PCS009V.cshtml | 12 +++++++++++ 3 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 AMESCoreStudio.Web/Views/PCS/PCS009V.cshtml diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 4be4ec4f..e74f2eb8 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -4655,14 +4655,13 @@ namespace AMESCoreStudio.Web.Controllers Result = FileName.Contains("PASS") ? "PASS" : "FAIL", Record_Time = RecordTime, FileName = FileName, - //FilePath = $@"/TestLog/{(string)item.workOrder}/{FileName}" + FilePath = $"{(string)item.workOrder}\{FileName}" }); - //SopPath = $@"/DocEsop/{Esop.FirstOrDefault().file_path}" } return View(result); } - public async Task PCS009T(string sn ,string id) + public async Task PCS009T(string sn, string id) { var query = await _pcsApi.GetTestLogByMSSql(sn); var result = new List(); @@ -4723,6 +4722,21 @@ namespace AMESCoreStudio.Web.Controllers return View(); } + public IActionResult PCS009V(string id) + { + string TestLogUncPath = _configuration.GetValue("TestLogUncPath"); + // UNC路径 + string uncPath = $@"{TestLogUncPath}\{id}"; + if (System.IO.File.Exists(uncPath)) + { + var fileStream = new FileStream(uncPath, FileMode.Open, FileAccess.Read); + // 读取文件内容 + string fileContent = System.IO.File.ReadAllText(uncPath); + ViewBag.Log = fileContent; + } + return View(); + } + public class PCS009TViewModel { public string Name { get; set; } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml index 6fb89800..0fda977e 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml @@ -263,8 +263,7 @@ @index.Record_Time - @index.FileName - @*@index.FileName*@ + @index.FileName 測試Log @@ -558,5 +557,20 @@ }); }); }; + + function show(id) { + layui.use('layer', function () { + var layer = layui.layer; + layer.open({ + type: 2, + title: '預覽文件', + shadeClose: true,//点击遮罩关闭层 + shade: 0.8, + area: ['90%', '90%'], + zIndex: 19891014, + content: `/PCS/PCS009V?id=${id}` + }); + }); + }; } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS009V.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS009V.cshtml new file mode 100644 index 00000000..2d459be5 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS009V.cshtml @@ -0,0 +1,12 @@ +@{ + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + +
+
+
@ViewBag.Log
+
+
+ +@section Scripts{ + }