From e742b7740c9fb9cf35cd4563fef17ba42486daea Mon Sep 17 00:00:00 2001 From: "BB.Wang" Date: Thu, 13 Jul 2023 22:17:29 +0800 Subject: [PATCH] =?UTF-8?q?Yiru=E4=BF=AE=E6=94=B9=E5=AE=8C=E5=B7=A5?= =?UTF-8?q?=E5=85=A5=E5=BA=AB=EF=BC=8C=E6=98=B6=E4=BA=A8=E5=AE=8C=E5=B7=A5?= =?UTF-8?q?=E9=A1=AF=E7=A4=BA=E5=AE=89=E5=8B=A4=E5=B7=A5=E5=96=AE=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9ipqc=E6=8A=BD=E9=A9=97=E5=BA=8F=E8=99=9F?= =?UTF-8?q?=E8=A6=81=E6=96=BC=E5=B7=A5=E5=96=AE=E4=B9=8B=E5=85=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 11 +- AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs | 29 ++++ AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml | 129 ++++++++++------- .../Controllers/BLL/RPTController.cs | 132 +++++++++++++++++- 4 files changed, 246 insertions(+), 55 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 5647d913..ac7a003b 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -7371,9 +7371,18 @@ namespace AMESCoreStudio.Web.Controllers else { - result = await _pcsApi.GetFqcInhouseMasterMultiQuery_EVER(barcodeNo: barcodeNo, wipNo: wipNo + var result_EVER = await _pcsApi.GetFqcInhouseMasterMultiQuery_Avalue(barcodeNo: barcodeNo, wipNo: wipNo , boxNo: boxNo, inhouseNo: inhouseNo, date_str: date_str, date_end: date_end , status: status, page: page, limit: limit); + + + foreach (var item in result_EVER.Data) + { + var wipresult= await _pcsApi.GetWipInfoByWipNO_EVER(wipno: item.WipNo); + + item.WipNo = wipresult.Select(s => s.RelatedWONO).FirstOrDefault(); + } + result = result_EVER ; } if (result.Data.Count() != 0) diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 7a2769be..c6b85537 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -1683,11 +1683,40 @@ namespace AMESCoreStudio.Web , string boxNo = null, string inhouseNo = null, string date_str = null, string date_end = null , string status = null, int page = 0, int limit = 10); + /// + /// FQC查詢 + /// + /// 內部序號 + /// 工單號碼 + /// 外箱號碼 + /// 入庫單號碼 + /// 入庫時間起 + /// 入庫時間迄 + /// 抽驗結果 + /// 頁數 + /// 筆數 + /// + [WebApiClient.Attributes.HttpGet("http://192.168.4.109:5088/api/FqcInhouseMaster/FqcInhouseMasterMultiQuery_Avalue/")] + ITask> GetFqcInhouseMasterMultiQuery_Avalue(string barcodeNo = null, string wipNo = null + , string boxNo = null, string inhouseNo = null, string date_str = null, string date_end = null + , string status = null, int page = 0, int limit = 10); + + [WebApiClient.Attributes.HttpGet("http://192.168.4.109:5088/api/BarcodeInfoes/ByBoxNoPCS031Q/")] ITask> GetBarcodeInfoesByBoxNoPCS031Q_EVER(string boxNo, int page = 0, int limit = 10); + + /// + /// 查詢工單基本資料-WipNO + /// + /// + [WebApiClient.Attributes.HttpGet("http://192.168.4.109:5088/api/WipInfos/WipInfoByWipNo/{wipno}")] + ITask> GetWipInfoByWipNO_EVER(string wipno); + + + //YIRU End ---------------------------------------------------------------------------------------- #endregion diff --git a/AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml b/AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml index 2b5804de..955f17f7 100644 --- a/AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml +++ b/AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml @@ -196,61 +196,88 @@ insertMaster("T"); }); function insertMaster(status) { - - var model = $("#modelform").serializeArray(); - //console.info(model); - var InspectionID; - var InspectionFormID; - var CreateUserID; - var UpdateUserID; - var CreateDate; - var UpdateDate; - var WipNo; - var ItemNo; - var BarcodeNo; - var StatusNo; - if (model.length > 0) { - //console.log(model); - InspectionID = model[0].value; - InspectionFormID = model[1].value; - CreateUserID = model[2].value; - UpdateUserID = model[3].value; - CreateDate = model[4].value; - UpdateDate = model[5].value; - WipNo = model[6].value; - ItemNo = model[7].value; - BarcodeNo = model[8].value; - StatusNo = status; - console.log('789'); - $.post("/SPC/SPC005TSAVE", - { - InspectionID: InspectionID, - InspectionFormID: InspectionFormID, - CreateUserID: CreateUserID, - UpdateUserID: UpdateUserID, - CreateDate: CreateDate, - UpdateDate: UpdateDate, - WipNo: WipNo, - ItemNo: ItemNo, - BarcodeNo: BarcodeNo, - StatusNo: StatusNo - }, - function (data) { - console.log(data); - if (data.success) { - console.log("master:data.success"); - insertList(data.msg); + var data = $("#WipNo").val(); + if (data) { + + var Barcode = $("#BarcodeNo").val(); + $.ajax({ + url: '/SPC/CheckBarcodeNO?BarcodeNo=' + Barcode + '&WipNo=' + data, + dataType: 'json', + contentType: "application/json", + type: 'get', + success: function (result) { + if (!result.data) { + alert("檢驗序號不在工單區間內"); + event.preventDefault(); + return false; } - }).success(function () { //alert("second success"); - }) - .error(function () { //alert("error"); - }) - .complete(function () { //alert("complete"); - }); + else { + + var model = $("#modelform").serializeArray(); + //console.info(model); + var InspectionID; + var InspectionFormID; + var CreateUserID; + var UpdateUserID; + var CreateDate; + var UpdateDate; + var WipNo; + var ItemNo; + var BarcodeNo; + var StatusNo; + if (model.length > 0) { + //console.log(model); + InspectionID = model[0].value; + InspectionFormID = model[1].value; + CreateUserID = model[2].value; + UpdateUserID = model[3].value; + CreateDate = model[4].value; + UpdateDate = model[5].value; + WipNo = model[6].value; + ItemNo = model[7].value; + BarcodeNo = model[8].value; + StatusNo = status; + console.log('789'); + $.post("/SPC/SPC005TSAVE", + { + InspectionID: InspectionID, + InspectionFormID: InspectionFormID, + CreateUserID: CreateUserID, + UpdateUserID: UpdateUserID, + CreateDate: CreateDate, + UpdateDate: UpdateDate, + WipNo: WipNo, + ItemNo: ItemNo, + BarcodeNo: BarcodeNo, + StatusNo: StatusNo + }, + function (data) { + console.log(data); + if (data.success) { + console.log("master:data.success"); + insertList(data.msg); + } + }).success(function () { //alert("second success"); + }) + .error(function () { //alert("error"); + }) + .complete(function () { //alert("complete"); + }); + + + } + } + + } + }); + + } + + }; function insertList(id) { @@ -491,6 +518,7 @@ if (e.keyCode == 13 ) { var data = $("#WipNo").val(); if (data) { + var Barcode = $("#BarcodeNo").val(); CheckBarcodeNo(Barcode, data); event.preventDefault(); @@ -672,6 +700,7 @@ }); }; + // PLM_ECN $("#GetPLMECN").on("click", function () { var ItemNo = $("#ItemNo").val(); diff --git a/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs b/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs index 50ea7419..b45ba7cc 100644 --- a/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs @@ -438,13 +438,37 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL result.IPQCTotal = 12; // FQC批退率 Board - result.FQCRRBoard = 5.08; + //result.FQCRRBoard = 5.08; + var f_FQCRRBoard = await new FqcResultMasterController(_context).GetFQCHeaderData4QRS016ByDetail(null, null, null, sDate, eDate, "1001"); + if (f_FQCRRBoard.DataTotal > 0) + { + foreach (var item in f_FQCRRBoard.Data.Where(W => W.type == "單板")) + { + result.FQCRRBoard = item.rejectRate; + } + } // FQC批退率 System - result.FQCRRSystem = 12.12; + //result.FQCRRSystem = 12.12; + var f_FQCRRSystem = await new FqcResultMasterController(_context).GetFQCHeaderData4QRS016ByDetail(null, null, null, sDate, eDate, "1001"); + if (f_FQCRRSystem.DataTotal > 0) + { + foreach (var item in f_FQCRRSystem.Data.Where(W => W.type == "系統組裝")) + { + result.FQCRRSystem = item.rejectRate; + } + } // FQC批退率 Medical - result.FQCRRMedical = 11.11; + //result.FQCRRMedical = 11.11; + var f_FQCRRMedical = await new FqcResultMasterController(_context).GetFQCHeaderData4QRS016ByDetail(null, null, null, sDate, eDate, "1001"); + if (f_FQCRRSystem.DataTotal > 0) + { + foreach (var item in f_FQCRRMedical.Data.Where(W => W.type == "醫療")) + { + result.FQCRRMedical = item.rejectRate; + } + } // DOA Board result.DOABoard = 0.04; @@ -456,7 +480,107 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL result.DOAMedical = 0.00; // FPY 立德 Board - result.FPYBoard_LEI = 99.15; + //result.FPYBoard_LEI = 99.15; + var f_FPYBoard_LEI = await new WipStationController(_context).GetWipStation4QRS014GroupB(null, sDate, eDate, null, null, null); + if (f_FPYBoard_LEI.DataTotal > 0) + { + double sum_rate = 100.0; + int sum_idx = 1; + + DataTable dtRate = new DataTable(); + dtRate.Columns.Add("STATION_ID"); + dtRate.Columns.Add("OK_QTY"); + dtRate.Columns.Add("NG_QTY"); + dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; + dtRate.AcceptChanges(); + + foreach (var data in f_FPYBoard_LEI.Data) + { + string str = data.ToString(); + string[] str2 = str.Replace("{", "").Replace("}", "").Split(','); + string str3 = ""; + for (int i = 0; i < str2.Length; i++) + { + string[] str21 = str2[i].Split("="); + str3 = str3 + str21[0].Trim() + ":" + "'" + str21[1].Trim() + "',"; + } + JObject j0 = JObject.Parse("{" + str3.Substring(0, str3.Length - 1) + "}"); + int stationID = int.Parse(j0["StationID"].ToString()); + + bool existFlag = false; + int idx = 0; + + for (int i = 0; i < dtRate.Rows.Count; i++) + { + if (dtRate.Rows[i]["STATION_ID"].ToString() == stationID.ToString()) + { + idx = i; + existFlag = true; + break; + } + } + + int okQty = 0, ngQty = 0; + + if (j0["RuleStatus"].ToString() == "P") + { + okQty = int.Parse(j0["FirstCnt"].ToString()); + } + else + { + ngQty = int.Parse(j0["FirstCnt"].ToString()); + } + + if (existFlag) + { + if (okQty > 0) + { + dtRate.Rows[idx][1] = okQty; + } + if (ngQty > 0) + { + dtRate.Rows[idx][2] = ngQty; + } + + dtRate.AcceptChanges(); + } + else + { + DataRow dr = dtRate.NewRow(); + dr[0] = stationID; + dr[1] = okQty; + dr[2] = ngQty; + + dtRate.Rows.Add(dr); + dtRate.AcceptChanges(); + } + } + + if (dtRate.Rows.Count > 0) + { + for (int j = 0; j < dtRate.Rows.Count; j++) + { + int okQty = int.Parse(dtRate.Rows[j][1].ToString()); + int ngQty = int.Parse(dtRate.Rows[j][2].ToString()); + + int inputQty = okQty + ngQty; + + double rate = 0; + if (okQty > 0) + { + rate = (okQty * 1.0 / inputQty) * 100; + } + + if (rate > 0) + { + //sum_rate = sum_rate * (rate / 100.0); + sum_idx = sum_idx + 1; + sum_rate = sum_rate + rate; + } + } + } + result.FPYBoard_LEI = double.Parse((sum_rate / sum_idx).ToString("0.00")); + } // FPY 立德 System result.FPYSystem_LEI = 92.12;