From 39d8e9d29fdce7c08a8d14d35b1822022a7cbd3f Mon Sep 17 00:00:00 2001 From: Marvin Date: Thu, 20 Jul 2023 11:49:02 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E8=89=AF=E7=8E=87=E6=9F=A5?= =?UTF-8?q?=E8=A9=A2,=E5=A2=9E=E5=8A=A0=E5=85=A8=E9=83=A8=E6=95=B8?= =?UTF-8?q?=E6=93=9A=E5=B0=8E=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/QRSController.cs | 2 +- AMESCoreStudio.Web/Views/QRS/QRS010.cshtml | 43 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/AMESCoreStudio.Web/Controllers/QRSController.cs b/AMESCoreStudio.Web/Controllers/QRSController.cs index 8b776e81..a84b2c46 100644 --- a/AMESCoreStudio.Web/Controllers/QRSController.cs +++ b/AMESCoreStudio.Web/Controllers/QRSController.cs @@ -915,7 +915,7 @@ namespace AMESCoreStudio.Web.Controllers ModelNO = jo["modelNO"].ToString(), FirstCnt = int.Parse(joPass["firstCnt"].ToString()), PassCnt = int.Parse(jo["passCnt"].ToString()), - Yield = int.Parse(joPass["firstCnt"].ToString()) * 1.0 / int.Parse(jo["passCnt"].ToString()) * 100.0 + Yield = double.Parse((int.Parse(joPass["firstCnt"].ToString()) * 1.0 / int.Parse(jo["passCnt"].ToString()) * 100.0).ToString("0.00")) }); } } diff --git a/AMESCoreStudio.Web/Views/QRS/QRS010.cshtml b/AMESCoreStudio.Web/Views/QRS/QRS010.cshtml index 66843600..8948ff01 100644 --- a/AMESCoreStudio.Web/Views/QRS/QRS010.cshtml +++ b/AMESCoreStudio.Web/Views/QRS/QRS010.cshtml @@ -132,6 +132,7 @@
+
@@ -213,6 +214,48 @@ }); }; + layui.use(['jquery', 'excel', 'layer'], function () { + var $ = layui.jquery; + var layer = layui.layer; + var excel = layui.excel; + + $('#btnExport').on('click', function () { + + $.ajax({ + url: '@Url.Action("QRS010Query", "QRS")', + dataType: 'json', + success(res) { + var data = res.data; + data = excel.filterExportData(data, [ + 'wipNO', + 'itemNO', + 'planQty', + 'modelNO', + 'lineDesc', + 'stationDesc', + 'firstCnt', + 'passCnt', + 'yield' + ]); + + data.unshift({ + wipNO: "工單號碼", itemNO: "料號", planQty: "計畫數量", modelNO: "機種", lineDesc: "線別", stationDesc: "站別", firstCnt: "首次過站數量", passCnt: "總共過站數量", yield: "良率" + }); + + var timestart = Date.now(); + excel.downloadExcel(data, '良率數據' + formatJSONDate(Date.now().toString()), 'xlsx'); + var timeend = Date.now(); + + var spent = (timeend - timestart) / 1000; + layer.alert('導出全部數據耗時 ' + spent + ' s'); + } + , error() { + layer.alert('導出全部數據失敗'); + } + }); + }); + }); + layui.use(['form', 'layer', 'laydate'], function () { form = layui.form; laydate = layui.laydate;