From 18c8b84bdf2911f8faa11d816a082a29e57cc264 Mon Sep 17 00:00:00 2001 From: Yiru Date: Wed, 25 Oct 2023 19:33:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=9B=BB=E5=8B=95=E8=B5=B7?= =?UTF-8?q?=E5=AD=90=E6=89=AD=E5=8A=9B=E7=B4=80=E9=8C=84=E8=A1=A8=E6=9F=A5?= =?UTF-8?q?=E8=A9=A2=E8=88=87=E5=8C=AF=E5=87=BAExcel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/QRSController.cs | 60 +- AMESCoreStudio.Web/HttpApis/AMES/IQRS.cs | 30 + AMESCoreStudio.Web/Views/QRS/QRS023.cshtml | 157 ++++ .../wwwroot/Reports/QRS023View.rdlc | 711 ++++++++++++++++++ .../Controllers/AMES/ESTorqueController.cs | 102 +++ AMESCoreStudio.WebApi/Models/AMES/ESTorque.cs | 104 +++ AMESCoreStudio.WebApi/Models/AMESContext.cs | 7 + 7 files changed, 1170 insertions(+), 1 deletion(-) create mode 100644 AMESCoreStudio.Web/HttpApis/AMES/IQRS.cs create mode 100644 AMESCoreStudio.Web/Views/QRS/QRS023.cshtml create mode 100644 AMESCoreStudio.Web/wwwroot/Reports/QRS023View.rdlc create mode 100644 AMESCoreStudio.WebApi/Controllers/AMES/ESTorqueController.cs create mode 100644 AMESCoreStudio.WebApi/Models/AMES/ESTorque.cs diff --git a/AMESCoreStudio.Web/Controllers/QRSController.cs b/AMESCoreStudio.Web/Controllers/QRSController.cs index 7ce7e989..13542205 100644 --- a/AMESCoreStudio.Web/Controllers/QRSController.cs +++ b/AMESCoreStudio.Web/Controllers/QRSController.cs @@ -15,6 +15,7 @@ using AMESCoreStudio.WebApi.Models.BAS; using System; using System.Data; using AMESCoreStudio.Web.ViewModels; +using AspNetCore.Reporting; namespace AMESCoreStudio.Web.Controllers { @@ -27,9 +28,10 @@ namespace AMESCoreStudio.Web.Controllers public readonly IPCS _pcsApi; public readonly ISYS _sysApi; public readonly IKCS _kcsApi; + public readonly IQRS _qrsApi; private readonly IWebHostEnvironment _env; - public QRSController(ILogger logger, IREP repApi, IPPS ppsApi, IBAS basApi, IPCS pcsApi, ISYS sysApi, IKCS kcsApi, IWebHostEnvironment env) + public QRSController(ILogger logger, IREP repApi, IPPS ppsApi, IBAS basApi, IPCS pcsApi, ISYS sysApi, IKCS kcsApi, IWebHostEnvironment env, IQRS qrsApi) { _logger = logger; _repApi = repApi; @@ -38,6 +40,7 @@ namespace AMESCoreStudio.Web.Controllers _pcsApi = pcsApi; _sysApi = sysApi; _kcsApi = kcsApi; + _qrsApi = qrsApi; _env = env; } @@ -10683,8 +10686,63 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Table() { count = 0, data = null }); } + #region QRS023 電動起子扭力紀錄表 + /// + /// QRS023 + /// + /// + public async Task QRS023() + + { + return View(); + } + + public async Task QRS023QueryAsync(string wipNo, string sapNo, string dateStr, string dateEnd, int page = 0, int limit = 10) + { + + var result = await _qrsApi.GetEstorquebyQueryAll(wipNo: wipNo, sapNo: sapNo, sDate: dateStr, eDate: dateEnd, page: page, limit: limit); + + if (result.Count() != 0) + { + return Json(new Table() { code = 0, msg = "", data = result, count = result.Count }); + } + return Json(new Table() { count = 0, data = null }); + } + + public async Task QRS023_Excel(string wipNo, string sapNo, string dateStr, string dateEnd) + { + string mimeType = ""; + int extension = 1; + Dictionary param = new Dictionary(); + var localReport = GetReprot(wipNo, sapNo, dateStr, dateEnd); + var result = localReport.Result.Execute(RenderType.ExcelOpenXml, extension, param, mimeType); + //return File(result.MainStream, "application/msexcel", "Export.xls"); + return File(result.MainStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "ZTorque_" + System.DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".xlsx"); + //return File(result.MainStream, "application/msexcel", "Export.xls"); + } + + /// + /// 產生FQC報表 + /// + /// FQC單號 + /// FQC單號_編號 + /// + private async Task GetReprot(string wipNo, string sapNo, string dateStr, string dateEnd) + { + var path = $"{this._env.WebRootPath}\\Reports\\QRS023View.rdlc"; + LocalReport localReport = new LocalReport(path); + + System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); + System.Text.Encoding.GetEncoding(1252); + var resultQuery = _qrsApi.GetEstorquebyQueryAll(wipNo, sapNo, dateStr, dateEnd).InvokeAsync().Result; + + localReport.AddDataSource("DataSet3", resultQuery); + return localReport; + } + #endregion + #endregion /// /// 登入UserID diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IQRS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IQRS.cs new file mode 100644 index 00000000..231ed649 --- /dev/null +++ b/AMESCoreStudio.Web/HttpApis/AMES/IQRS.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using WebApiClient; +using WebApiClient.Attributes; +using AMESCoreStudio.WebApi; +using Microsoft.AspNetCore.Mvc; +using AMESCoreStudio.WebApi.Models.AMES; +using AMESCoreStudio.WebApi.Models.BAS; +using AMESCoreStudio.WebApi.DTO.AMES; +using AMESCoreStudio.CommonTools.Result; + +namespace AMESCoreStudio.Web +{ + [JsonReturn] + public interface IQRS:IHttpApi + { + #region QRS023 電動起子扭力紀錄表 + + /// + /// 獲取電動起子扭力紀錄表 + /// + /// + [WebApiClient.Attributes.HttpGet("api/ESTorque/ESTorqueByQuery")] + ITask> GetEstorquebyQueryAll(string wipNo,string sapNo,string sDate, string eDate, int page = 0, int limit = 10); + #endregion + + + + + } +} diff --git a/AMESCoreStudio.Web/Views/QRS/QRS023.cshtml b/AMESCoreStudio.Web/Views/QRS/QRS023.cshtml new file mode 100644 index 00000000..eafe4c2d --- /dev/null +++ b/AMESCoreStudio.Web/Views/QRS/QRS023.cshtml @@ -0,0 +1,157 @@ +@{ + ViewData["Title"] = "電動起子扭力紀錄表"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + + +
+
+
+
+
電動起子扭力紀錄表
+
+
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +@section Scripts{ + + + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/wwwroot/Reports/QRS023View.rdlc b/AMESCoreStudio.Web/wwwroot/Reports/QRS023View.rdlc new file mode 100644 index 00000000..3b3d6b1a --- /dev/null +++ b/AMESCoreStudio.Web/wwwroot/Reports/QRS023View.rdlc @@ -0,0 +1,711 @@ + + + 0 + + + + System.Data.DataSet + /* Local Connection */ + + e0dcb4ed-57fb-41b0-a865-d53383fc0026 + + + + + + Accessory + /* Local Query */ + + + + FormatDate + System.String + + + WipNo + System.String + + + SapNo + System.String + + + SetupValue + System.String + + + TorqueValue + System.String + + + UserName + System.String + + + + Accessory + FQC010VIiew + Accessory.FQC010VIiew, Accessory, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + + + + + + + + + + + + 4.15136cm + + + 4.39242cm + + + 3.25644cm + + + 2.5cm + + + 4.00498cm + + + 2.5cm + + + + + 0.6cm + + + + + true + true + + + + + 日期 + + + + + + + Textbox47 + + + LightGreen + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + 工單號碼 + + + + + + + Textbox49 + + + LightGreen + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + SAP編號 + + + + + + + Textbox51 + + + LightGreen + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + 設定值 + + + + + + + Textbox1 + + + LightGreen + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + 受校器讀值 + + + + + + + Textbox53 + + + LightGreen + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + 自校人員 + + + + + + + Textbox5 + + + LightGreen + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.6cm + + + + + true + true + + + + + =Fields!FormatDate.Value + + + + + + + FormatDate + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!WipNo.Value + + + + + + + WipNo + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!SapNo.Value + + + + + + + SapNo + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!SetupValue.Value + + + + + + + SetupValue1 + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!TorqueValue.Value + + + + + + + TorqueValue + + + Middle + 2pt + 2pt + 2pt + 2pt + + + true + + + + + + true + true + + + + + =Fields!UserName.Value + + + + + + + UserName + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + After + + + + + + + DataSet3 + 2.02244cm + 0.23571cm + 1.2cm + 20.8052cm + + + + + + true + true + + + + + + + + + 電動起子扭力紀錄表 + + + + + + + Textbox44 + 5.6424cm + 1.24355cm + 9.71299cm + 1 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + 允收標準:依照SOP定義kgf + + + + + + + Textbox45 + 1.02975cm + 14.2776cm + 0.8163cm + 6.76331cm + 2 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + QO4-109 Rev.A3 + + + + + + + Textbox76 + 3.88544cm + 15.08393cm + 1.00557cm + 5.63822cm + 3 + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + true + 0.34078cm + 5.98259cm + 21.18781cm + + + + + + 2.61732in +