From 4b94eda8bfadeb96ead118086d9bfdc00bc03f23 Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 9 Mar 2023 00:28:36 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=AD=A3=E5=B7=A5=E5=96=AE?= =?UTF-8?q?=E9=8E=96=E5=AE=9A=E6=9F=A5=E8=A9=A2Bug=202.=20FQC=E6=8A=BD?= =?UTF-8?q?=E9=A9=97=E9=99=84=E4=BB=B6=E5=8F=AF=E4=BB=A5=E4=B8=8B=E8=BC=89?= =?UTF-8?q?=E6=AA=94=E6=A1=88=203.=20=E8=AA=BF=E6=95=B4=E5=B7=A5=E5=96=AE?= =?UTF-8?q?=E7=B6=AD=E8=AD=B7=E7=9B=B8=E9=97=9C=E5=8F=96MAC=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E5=8F=8A=E7=95=AB=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/FQCController.cs | 41 +++ .../Controllers/PCSController.cs | 261 +++++++----------- AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs | 2 +- .../ViewModels/PCS/WipViewModel.cs | 4 +- AMESCoreStudio.Web/Views/FQC/FQC007D.cshtml | 13 + AMESCoreStudio.Web/Views/PCS/PCS001.cshtml | 4 +- AMESCoreStudio.Web/Views/PCS/PCS001N.cshtml | 99 ++++--- AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml | 117 ++++---- AMESCoreStudio.Web/Views/PCS/PCS003.cshtml | 166 +++++------ AMESCoreStudio.Web/Views/PCS/PCS034.cshtml | 138 +++++---- .../Controllers/AMES/MACInfoesController.cs | 2 +- .../Controllers/AMES/WipLockController.cs | 19 +- .../Controllers/AMES/WipMACController.cs | 17 +- AMESCoreStudio.WebApi/DTO/AMES/FQC010VIiew.cs | 14 + 14 files changed, 461 insertions(+), 436 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/FQCController.cs b/AMESCoreStudio.Web/Controllers/FQCController.cs index 32d8777e..ff62e0a9 100644 --- a/AMESCoreStudio.Web/Controllers/FQCController.cs +++ b/AMESCoreStudio.Web/Controllers/FQCController.cs @@ -22,6 +22,7 @@ using System.ComponentModel.DataAnnotations; using AspNetCore.Reporting; using System.Text.Encodings; using AMESCoreStudio.WebApi.Enum; +using Microsoft.AspNetCore.StaticFiles; namespace AMESCoreStudio.Web.Controllers { @@ -1537,6 +1538,46 @@ namespace AMESCoreStudio.Web.Controllers model.fqcResultMasterBlobs = await _fqcApi.GetFqcResultMasterBlobByFqcID(model.FqcID); return View("FQC007D", model); } + + /// + /// 檔案下載 + /// + /// 路徑 + /// 檔名 + /// + public async Task FileDownload(string Path, string FileName) + { + var path = $@"{_env.WebRootPath}\{Path}{FileName}"; + var memoryStream = new MemoryStream(); + using (var stream = new FileStream(path, FileMode.Open)) + { + await stream.CopyToAsync(memoryStream); + } + memoryStream.Seek(0, SeekOrigin.Begin); + string contentType = await GetFileContentTypeAsync(FileName); + // 回傳檔案到 Client 需要附上 Content Type,否則瀏覽器會解析失敗。 + return File(memoryStream, contentType, FileName); + } + + /// + /// 获取文件ContentType + /// + /// 文件名称 + /// + public async static Task GetFileContentTypeAsync(string fileName) + { + return await Task.Run(() => + { + string suffix = Path.GetExtension(fileName); + var provider = new FileExtensionContentTypeProvider(); + if (suffix.ToUpper().Trim() == ".MSG") + { + return "application/octet-stream"; + } + var contentType = provider.Mappings[suffix]; + return contentType; + }); + } #endregion #region 檢驗工項維護 diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index c658a58c..30c0b3de 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -139,11 +139,6 @@ namespace AMESCoreStudio.Web.Controllers Msg += ",客戶序號未填完整"; } - // MAC - if (string.IsNullOrWhiteSpace(model.wipMAC.StartNO) != string.IsNullOrWhiteSpace(model.wipMAC.EndNO)) - { - Msg += ",MAC未填完整"; - } if (!string.IsNullOrWhiteSpace(Msg)) Msg = "必填欄位未填寫:" + Msg.Substring(0, (Msg.Length - 1)); @@ -1616,13 +1611,6 @@ namespace AMESCoreStudio.Web.Controllers model.ruleStations = await _pcsApi.GetRuleStationByWipNo(model.wipInfo.WipNO); - model.wipMAC = await _pcsApi.GetWipMAC(model.wipInfo.WipNO); - if (model.wipMAC != null) - { - model.wipMAC.StartNO = model.wipMAC.Title + model.wipMAC.StartNO; - model.wipMAC.EndNO = model.wipMAC.Title + model.wipMAC.EndNO; - } - model.wipBarcodeOther = await _pcsApi.GetWipBarcodeOther(model.wipInfo.WipNO); model.WipKps = await _pcsApi.GetWipKpByWipNo(model.wipInfo.WipNO); @@ -1666,11 +1654,11 @@ namespace AMESCoreStudio.Web.Controllers } // 判斷MAC是否正確 - var CheckMACMsg = CheckMACData(model); - if (!string.IsNullOrWhiteSpace(CheckMACMsg)) - { - Msg += CheckMACMsg; - } + //var CheckMACMsg = CheckMACData(model); + //if (!string.IsNullOrWhiteSpace(CheckMACMsg)) + //{ + // Msg += CheckMACMsg; + //} if (!string.IsNullOrWhiteSpace(Msg)) { @@ -1760,34 +1748,7 @@ namespace AMESCoreStudio.Web.Controllers // } //} - // MAC - if (!string.IsNullOrWhiteSpace(model.wipMAC.StartNO) && !string.IsNullOrWhiteSpace(model.wipMAC.EndNO)) - { - if (model.wipMAC.StartNO.Length == 12) - { - model.wipMAC.Title = model.wipMAC.StartNO.Substring(0, 6).ToUpper(); - model.wipMAC.StartNO = model.wipMAC.StartNO.Substring(model.wipMAC.StartNO.Length - 6, 6).ToUpper(); - model.wipMAC.EndNO = model.wipMAC.EndNO.Substring(model.wipMAC.EndNO.Length - 6, 6).ToUpper(); - - // 確認MAC Table是否有料號資料 - var mACInfo = await _pcsApi.GetMACInfo(model.wipAtt.ItemNO); - if (mACInfo != null) - { - model.wipMAC.ClassGroup = mACInfo.ClassGroup; - //result = await _pcsApi.PutMACInfoByClassGroup(mACInfo.ClassGroup, model.wipMAC.EndNO); - } - - if (!string.IsNullOrWhiteSpace(model.wipMAC.WipNO)) - result = await _pcsApi.PutWipMAC(JsonConvert.SerializeObject(model.wipMAC)); - else - { - model.wipMAC.WipNO = model.wipInfo.WipNO; - model.wipMAC.CreateUserID = UserID; - result = await _pcsApi.PostWipMAC(JsonConvert.SerializeObject(model.wipMAC)); - } - } - } - + // 料號相關 var materialItem = await _pcsApi.GetMaterialItemByItemNO(model.wipAtt.ItemNO); if (materialItem != null) @@ -2143,21 +2104,6 @@ namespace AMESCoreStudio.Web.Controllers } } - // MAC - if (!string.IsNullOrWhiteSpace(model.wipMAC.StartNO) && !string.IsNullOrWhiteSpace(model.wipMAC.EndNO)) - { - var mACInfo = await _pcsApi.GetMACInfo(model.wipAtt.ItemNO); - if (mACInfo != null) - { - model.wipMAC.WipNO = model.wipInfo.WipNO; - model.wipMAC.Title = mACInfo.Title; - model.wipMAC.ClassGroup = mACInfo.ClassGroup; - model.wipMAC.CreateUserID = UserID; - result = await _pcsApi.PostWipMAC(JsonConvert.SerializeObject(model.wipMAC)); - result = await _pcsApi.PutMACInfoByClassGroup(mACInfo.ClassGroup, model.wipMAC.EndNO); - } - } - // 料號相關 var materialItem = await _pcsApi.GetMaterialItemByItemNO(model.wipAtt.ItemNO); if (materialItem != null) @@ -2279,7 +2225,7 @@ namespace AMESCoreStudio.Web.Controllers model.wipSystem = await _pcsApi.GetWipSystem(model.wipInfo.WipNO); - model.wipMAC = await _pcsApi.GetWipMAC(model.wipInfo.WipNO); + model.wipMACs = await _pcsApi.GetWipMAC(model.wipInfo.WipNO); model.wipLabel = await _pcsApi.GetWipLabel(model.wipInfo.WipNO); @@ -2372,12 +2318,7 @@ namespace AMESCoreStudio.Web.Controllers } } - model.wipMAC = await _pcsApi.GetWipMAC(model.wipInfo.WipNO); - if (model.wipMAC != null) - { - model.wipMAC.StartNO = model.wipMAC.Title + model.wipMAC.StartNO; - model.wipMAC.EndNO = model.wipMAC.Title + model.wipMAC.EndNO; - } + model.wipMACs = await _pcsApi.GetWipMAC(model.wipInfo.WipNO); model.wipLabel = await _pcsApi.GetWipLabel(model.wipInfo.WipNO); @@ -2523,12 +2464,7 @@ namespace AMESCoreStudio.Web.Controllers } } - model.wipMAC = await _pcsApi.GetWipMAC(model.wipInfo.WipNO); - if (model.wipMAC != null) - { - model.wipMAC.StartNO = model.wipMAC.Title + model.wipMAC.StartNO; - model.wipMAC.EndNO = model.wipMAC.Title + model.wipMAC.EndNO; - } + model.wipMACs = await _pcsApi.GetWipMAC(model.wipInfo.WipNO); model.wipLabel = await _pcsApi.GetWipLabel(model.wipInfo.WipNO); @@ -2615,7 +2551,6 @@ namespace AMESCoreStudio.Web.Controllers wipDataViewModel.wipInfo = model.wipInfo; wipDataViewModel.wipSystem = model.wipSystem; wipDataViewModel.wipBoard = model.wipBoard; - wipDataViewModel.wipMAC = model.wipMAC; wipDataViewModel.wipBarcodeOther = model.wipBarcodeOther; var Msg = CheckWipInfoInsert(wipDataViewModel); @@ -2644,12 +2579,12 @@ namespace AMESCoreStudio.Web.Controllers Msg += ",SOP文件 請填寫SOP文件敘述 "; } - // 判斷MAC是否正確 - var CheckMACMsg = CheckMACData(model); - if (!string.IsNullOrWhiteSpace(CheckMACMsg)) - { - Msg += "," + CheckMACMsg; - } + //// 判斷MAC是否正確 + //var CheckMACMsg = CheckMACData(model); + //if (!string.IsNullOrWhiteSpace(CheckMACMsg)) + //{ + // Msg += "," + CheckMACMsg; + //} // 判斷標籤 工單性質選擇 WipAttr非標96工單時,則旁邊欄位必填 if (model.wipLabel.WipAttr == "B" && string.IsNullOrWhiteSpace(model.wipLabel.NonstandardWoMemo)) @@ -3078,12 +3013,7 @@ namespace AMESCoreStudio.Web.Controllers } } - model.wipMAC = await _pcsApi.GetWipMAC(model.wipInfo.WipNO); - if (model.wipMAC != null) - { - model.wipMAC.StartNO = model.wipMAC.Title + model.wipMAC.StartNO; - model.wipMAC.EndNO = model.wipMAC.Title + model.wipMAC.EndNO; - } + model.wipMACs = await _pcsApi.GetWipMAC(model.wipInfo.WipNO); model.wipLabel = await _pcsApi.GetWipLabel(model.wipInfo.WipNO); @@ -3169,7 +3099,6 @@ namespace AMESCoreStudio.Web.Controllers wipDataViewModel.wipInfo = model.wipInfo; wipDataViewModel.wipSystem = model.wipSystem; wipDataViewModel.wipBoard = model.wipBoard; - wipDataViewModel.wipMAC = model.wipMAC; wipDataViewModel.wipBarcodeOther = model.wipBarcodeOther; var Msg = CheckWipInfoInsert(wipDataViewModel); @@ -3185,12 +3114,12 @@ namespace AMESCoreStudio.Web.Controllers Msg += ",SOP文件 請填寫SOP文件敘述 "; } - // 判斷MAC是否正確 - var CheckMACMsg = CheckMACData(model); - if (!string.IsNullOrWhiteSpace(CheckMACMsg)) - { - Msg += "," + CheckMACMsg; - } + //// 判斷MAC是否正確 + //var CheckMACMsg = CheckMACData(model); + //if (!string.IsNullOrWhiteSpace(CheckMACMsg)) + //{ + // Msg += "," + CheckMACMsg; + //} // 判斷標籤 工單性質選擇 WipAttr非標96工單時,則旁邊欄位必填 if (model.wipLabel.WipAttr == "B" && string.IsNullOrWhiteSpace(model.wipLabel.NonstandardWoMemo)) @@ -3382,54 +3311,68 @@ namespace AMESCoreStudio.Web.Controllers /// public string CheckMACData(WipDataViewModel model) { - if (model.wipMAC == null) - return ""; + return ""; - string StartNO = model.wipMAC.StartNO ?? ""; - string EndNO = model.wipMAC.EndNO ?? ""; - // 資料為空 - if (string.IsNullOrWhiteSpace(StartNO) && string.IsNullOrWhiteSpace(EndNO)) - return ""; + //if (model.wipMAC == null) + // return ""; - if (StartNO.Length != 12 || EndNO.Length != 12) - return "MAC長度有誤"; + //string StartNO = model.wipMAC.StartNO ?? ""; + //string EndNO = model.wipMAC.EndNO ?? ""; + //// 資料為空 + //if (string.IsNullOrWhiteSpace(StartNO) && string.IsNullOrWhiteSpace(EndNO)) + // return ""; - if (StartNO.ToUpper().Substring(0, 6) != EndNO.ToUpper().Substring(0, 6)) - return "MAC前綴不一樣"; + //if (StartNO.Length != 12 || EndNO.Length != 12) + // return "MAC長度有誤"; - // 轉十進位 - var Entire = new Code.Entire(); - try - { - // 最小值 - var StartNONum = int.Parse(Entire.DecHex(StartNO.Substring(StartNO.Length - 6, 6), "HexToDec")); - // 最大值 - var EndNONum = int.Parse(Entire.DecHex(EndNO.Substring(EndNO.Length - 6, 6), "HexToDec")); - - // 取MAC區間小於工單數 - if (EndNONum - StartNONum + 1 < model.wipInfo.PlanQTY) - return "MAC區間小於工單數量"; + //if (StartNO.ToUpper().Substring(0, 6) != EndNO.ToUpper().Substring(0, 6)) + // return "MAC前綴不一樣"; - // 判斷MAC區間是否有重複使用 - var result = _pcsApi.GetCheckMAC(model.wipInfo.WipNO, StartNO, EndNO).InvokeAsync().Result; - - if (!result.Success) - return result.Msg; - else - return ""; - } - catch - { - return "MAC後6碼格式有誤"; - } + //// 轉十進位 + //var Entire = new Code.Entire(); + //try + //{ + // // 最小值 + // var StartNONum = int.Parse(Entire.DecHex(StartNO.Substring(StartNO.Length - 6, 6), "HexToDec")); + // // 最大值 + // var EndNONum = int.Parse(Entire.DecHex(EndNO.Substring(EndNO.Length - 6, 6), "HexToDec")); + + // // 取MAC區間小於工單數 + // if (EndNONum - StartNONum + 1 < model.wipInfo.PlanQTY) + // return "MAC區間小於工單數量"; + + // // 判斷MAC區間是否有重複使用 + // var result = _pcsApi.GetCheckMAC(model.wipInfo.WipNO, StartNO, EndNO).InvokeAsync().Result; + + // if (!result.Success) + // return result.Msg; + // else + // return ""; + //} + //catch + //{ + // return "MAC後6碼格式有誤"; + //} } - public async Task GetMAC(string itemno, int planQTY) + public async Task GetMAC(string itemno, string wipNo , int planQTY) { var q = await _pcsApi.GetMACInfo(itemno); if (q != null) { + // 工單數量*單板MAC數 + var MacQty = planQTY * q.Qty; + var wipMAC = await _pcsApi.GetWipMAC(wipNo); + var getWipMacQty = wipMAC.Select(s => s.Qty).Sum(); + // 判斷目前工單數量*單板MAC數 == DB已記使用MAC數量 + if (planQTY * q.Qty <= getWipMacQty) + { + return Json(new { _msg = "已取滿MAC數量,請在確認" }); + } + + MacQty = MacQty - getWipMacQty; + // 當前值 16 進位 var Value = q.Value; @@ -3438,7 +3381,7 @@ namespace AMESCoreStudio.Web.Controllers // 最小值 var Mix = (int.Parse(Entire.DecHex(Value, "HexToDec")) + 1); // 最大值 - var Max = (int.Parse(Entire.DecHex(Value, "HexToDec")) + planQTY * q.Qty); + var Max = (int.Parse(Entire.DecHex(Value, "HexToDec")) + MacQty); // 當最大值 > DB設定最大值 if (Max > int.Parse(Entire.DecHex(q.Max.ToString(), "HexToDec"))) @@ -3454,10 +3397,25 @@ namespace AMESCoreStudio.Web.Controllers } + var MACstr = q.Title + Entire.DecHex(Mix.ToString(), "DecToHex").ToUpper(); + var MACend = q.Title + Entire.DecHex(Max.ToString(), "DecToHex").ToUpper(); + + // 新增WipMAC + var model = new WipMAC(); + + model.StartNO = Entire.DecHex(Mix.ToString(), "DecToHex").ToUpper(); + model.EndNO = Entire.DecHex(Max.ToString(), "DecToHex").ToUpper(); + model.Qty = MacQty; + model.WipNO = wipNo; + model.Title = q.Title; + model.ClassGroup = q.ClassGroup; + model.CreateUserID = GetLogInUserID(); + var result = await _pcsApi.PostWipMAC(JsonConvert.SerializeObject(model)); + await _pcsApi.PutMACInfoByClassGroup(q.ClassGroup, Entire.DecHex(Max.ToString(), "DecToHex").ToUpper()); var x = new { - mix = q.Title + Entire.DecHex(Mix.ToString(), "DecToHex").ToUpper(), - max = q.Title + Entire.DecHex(Max.ToString(), "DecToHex").ToUpper(), + mix = MACstr, + max = MACend, }; return Json(x); } @@ -4547,12 +4505,12 @@ namespace AMESCoreStudio.Web.Controllers result.BoxNo = result_barcodeinfo.BoxNo; result.StatusNo = result_barcodeinfo.StatusNo; // 取入庫單號 - if(!string.IsNullOrWhiteSpace(result.BoxNo)) + if (!string.IsNullOrWhiteSpace(result.BoxNo)) { var FqcInhouse = await _pcsApi.GetFqcInhouseDetailBySerialNo(result.BoxNo); if (FqcInhouse.Count() != 0) { - result.InhouseNo = FqcInhouse.OrderByDescending(o => o.UpdateDate).FirstOrDefault().InhouseNo; + result.InhouseNo = FqcInhouse.OrderByDescending(o => o.UpdateDate).FirstOrDefault().InhouseNo; } } @@ -8205,37 +8163,6 @@ namespace AMESCoreStudio.Web.Controllers } } - // 工單MAC WipMAC - if (!string.IsNullOrWhiteSpace(model.wipMAC.StartNO) && !string.IsNullOrWhiteSpace(model.wipMAC.EndNO)) - { - if (model.wipMAC.StartNO.Length == 12) - { - model.wipMAC.Title = model.wipMAC.StartNO.Substring(0, 6).ToUpper(); - model.wipMAC.StartNO = model.wipMAC.StartNO.Substring(model.wipMAC.StartNO.Length - 6, 6).ToUpper(); - model.wipMAC.EndNO = model.wipMAC.EndNO.Substring(model.wipMAC.EndNO.Length - 6, 6).ToUpper(); - - // 確認MAC Table是否有料號資料 - var mACInfo = await _pcsApi.GetMACInfo(model.wipAtt.ItemNO); - if (mACInfo != null) - { - model.wipMAC.ClassGroup = mACInfo.ClassGroup; - } - - if (!string.IsNullOrWhiteSpace(model.wipMAC.WipNO)) - result = await _pcsApi.PutWipMAC(JsonConvert.SerializeObject(model.wipMAC)); - else - { - model.wipMAC.WipNO = model.wipInfo.WipNO; - model.wipMAC.CreateUserID = UserID; - result = await _pcsApi.PostWipMAC(JsonConvert.SerializeObject(model.wipMAC)); - } - - if (!result.Success) - { - Msg += result.Msg; - } - } - } // 工單 KeyParts WipKp // 判斷料號KP有資料 沒有資料時 一起新增到料號KP @@ -8395,7 +8322,7 @@ namespace AMESCoreStudio.Web.Controllers } #endregion } - + public static class ObjectExtension { public static T GetAttributeFrom(this object instance, string propertyName) where T : Attribute @@ -8406,7 +8333,7 @@ namespace AMESCoreStudio.Web.Controllers return (T)property.GetCustomAttributes(attributeType, false).FirstOrDefault(); } } - + } diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 60316e76..15eb4697 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -238,7 +238,7 @@ namespace AMESCoreStudio.Web #region WipMAC 工單MAC資料檔 PCS001 [WebApiClient.Attributes.HttpGet("api/WipMAC/{id}")] - ITask GetWipMAC(string id); + ITask> GetWipMAC(string id); [WebApiClient.Attributes.HttpGet("api/WipMAC/CheckMAC/{id}/{startNo}/{endNo}")] ITask> GetCheckMAC(string id, string startNo, string endNo); diff --git a/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs index c6562c90..fa38b958 100644 --- a/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/PCS/WipViewModel.cs @@ -20,7 +20,7 @@ namespace AMESCoreStudio.Web.ViewModels.PCS WipSops = new List(); WipOutfits = new List(); wipInfoBlobs = new List(); - wipMAC = new WipMAC(); + wipMACs = new List(); wipBarcodeOther = new WipBarcodeOther(); } @@ -74,7 +74,7 @@ namespace AMESCoreStudio.Web.ViewModels.PCS /// /// MAC /// - public WipMAC wipMAC { get; set; } + public IEnumerable wipMACs { get; set; } /// /// 條碼區間設定 diff --git a/AMESCoreStudio.Web/Views/FQC/FQC007D.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC007D.cshtml index e2cd358c..ff9150e5 100644 --- a/AMESCoreStudio.Web/Views/FQC/FQC007D.cshtml +++ b/AMESCoreStudio.Web/Views/FQC/FQC007D.cshtml @@ -13,6 +13,7 @@
+ **預覽只能顯示圖檔、PDF、文字檔** @@ -20,6 +21,7 @@ + @@ -35,6 +37,9 @@ + } @@ -86,6 +91,14 @@ }); }; + // 檔案下載 + function filedownload(obj) { + var Path = $(obj).closest("TR").find('span[id*=Filepath]').text(); + var FileName = $(obj).closest("TR").find('span[id*=FileName]').text(); + filePath = `/PCS/FileDownload?Path=${Path}&FileName=${FileName}`; + $(obj).attr("href", filePath); + }; + $(document).ready(function () { var error = '@Html.ValidationMessage("error")'; if ($(error).text() != '') { diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml index fec65023..df28736c 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml @@ -263,7 +263,7 @@
-
+ @*
@@ -275,7 +275,7 @@
-
+
*@
diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001N.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001N.cshtml index fd446cd9..790ee9b7 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001N.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001N.cshtml @@ -217,23 +217,38 @@
- -
- -
-
-
-
- -
-
- -
+ +
檔案名稱 檔案路徑 預覽下載
預覽 + 下載 +
+ + + + + + + + + @foreach (var index in Model.wipBarcodes) + { + + + + + } + +
+ 起始生產序號 + + 結束生產序號 +
+ @index.StartNO + + @index.EndNO +
-
- +
@@ -252,20 +267,38 @@
-
- -
- -
-
-
-
- -
+
+ + + + + + + + + + @foreach (var index in Model.wipMACs) + { + + + + + } + +
+ MAC區間起 + + MAC區間迄 +
+ @index.Title@index.StartNO + + @index.Title@index.EndNO +
@@ -403,11 +436,6 @@ $("#barcodeOtherDiv").hide(); } - // DIV MAC - if ($('#wipMAC_StartNO').val() != "" && $('#wipMAC_EndNO').val() != "") { - $("#GetMAC").hide(); - } - getLineInfoList($("#unit").val()); // 產生條碼 @@ -478,11 +506,11 @@ }); // 產生MAC - $("#GetMAC").click(function (event) { + $("#GetMAC").click(function (event) { var wipNO = $('#wipAtt_ItemNO').val(); var planQTY = $('#wipInfo_PlanQTY').val(); if (wipNO == '' || !wipNO) { - parent.hg.msg("請輸入工單號碼"); + parent.hg.msg("請輸入料號"); return; } if (planQTY == '' || !planQTY || planQTY == 0) { @@ -492,19 +520,18 @@ $.ajax({ url: '@Url.Action("GetMAC", "PCS")', dataType: 'json', - data: { "itemno": $("#wipAtt_ItemNO").val(), "planQTY": $('#wipInfo_PlanQTY').val() }, + data: { "itemno": $("#wipAtt_ItemNO").val(), "wipNo": $('#wipInfo_WipNO').val() ,"planQTY": $('#wipInfo_PlanQTY').val() }, cache: false, type: "POST", success: function (data, textStatus, jqXHR) { if (data._msg != undefined) { parent.hg.msg(data._msg); } - else - { - $("#wipMAC_StartNO").val(data.mix); - $("#wipMAC_EndNO").val(data.max); - $("#wipMAC_StartNO").attr("readonly", "readonly"); - $("#wipMAC_EndNO").attr("readonly", "readonly"); + else { + var contactdiv = '' + + `${data.mix} + ${data.max}`; + $('#MACTable').append(contactdiv); } }, error: function (jqXHR, textStatus, errorThrown) { diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml index 0494eb22..b8944f48 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml @@ -228,33 +228,37 @@ @* 序號編碼sheet *@
- - - - - +
+
+ +
- 起始生產序號 -
+ + + - - - - - @foreach (var index in Model.wipBarcodes) - { - - - - - } - -
+ 起始生產序號 + - 結束生產序號 -
- @index.StartNO - - @index.EndNO -
+ + 結束生產序號 + + + + + @foreach (var index in Model.wipBarcodes) + { + + + @index.StartNO + + + @index.EndNO + + + } + + +
+
@@ -271,14 +275,33 @@
- -
- -
-
-
-
- -
+ + + + + + + + + + + @foreach (var index in Model.wipMACs) + { + + + + + } + +
+ MAC區間起 + + MAC區間迄 +
+ @index.Title@index.StartNO + + @index.Title@index.EndNO +
@@ -471,9 +494,9 @@
- - - + + +
@@ -489,9 +512,7 @@
- +
@@ -508,13 +529,11 @@
-
+
- +
@@ -527,9 +546,7 @@
- +
@@ -545,9 +562,7 @@
- +
@@ -851,7 +866,7 @@
- +
diff --git a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml index e0bc5a79..07a89d5e 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml @@ -30,9 +30,7 @@ - +
@@ -231,52 +229,40 @@ @* 序號編碼sheet *@
- - - - - +
+
+ +
- 起始生產序號 -
+ + + - - - - - @foreach (var index in Model.wipBarcodes) - { - - - - - } - -
+ 起始生產序號 + - 結束生產序號 -
- @index.StartNO - - @index.EndNO -
- @*
-
- -
- -
-
-
-
- -
-
- -
+ + 結束生產序號 + + + + + @foreach (var index in Model.wipBarcodes) + { + + + @index.StartNO + + + @index.EndNO + + + } + + +
-
*@ -
- +
@@ -295,20 +281,38 @@
-
- -
- -
-
-
-
- -
+
+ + + + + + + + + + @foreach (var index in Model.wipMACs) + { + + + + + } + +
+ MAC區間起 + + MAC區間迄 +
+ @index.Title@index.StartNO + + @index.Title@index.EndNO +
@@ -491,15 +495,9 @@
- - - + + +
@@ -515,9 +513,7 @@
- +
@@ -538,9 +534,7 @@
- +
@@ -553,9 +547,7 @@
- +
@@ -571,9 +563,7 @@
- +
@@ -879,9 +869,7 @@
- +
@@ -992,8 +980,8 @@ SOP文件敘述 @* - 檔案路徑 - *@ + 檔案路徑 + *@ SOP類型 @@ -1014,8 +1002,8 @@ @* - - *@ + + *@ @@ -1177,10 +1165,6 @@ // $("#barcodeOtherDiv").hide(); //} - // DIV MAC - if ($('#wipMAC_StartNO').val() != "" && $('#wipMAC_EndNO').val() != "") { - $("#GetMAC").hide(); - } // DIV keyPartsExcel @if (Model.wipInfo.WipNO.StartsWith("981")) @@ -1307,7 +1291,7 @@ $.ajax({ url: '@Url.Action("GetMAC", "PCS")', dataType: 'json', - data: { "itemno": $("#wipAtt_ItemNO").val(), "planQTY": $('#wipInfo_PlanQTY').val() }, + data: { "itemno": $("#wipAtt_ItemNO").val(), "wipNo": $('#wipInfo_WipNO').val() ,"planQTY": $('#wipInfo_PlanQTY').val() }, cache: false, type: "POST", success: function (data, textStatus, jqXHR) { @@ -1315,10 +1299,10 @@ parent.hg.msg(data._msg); } else { - $("#wipMAC_StartNO").val(data.mix); - $("#wipMAC_EndNO").val(data.max); - $("#wipMAC_StartNO").attr("readonly", "readonly"); - $("#wipMAC_EndNO").attr("readonly", "readonly"); + var contactdiv = '' + + `${data.mix} + ${data.max}`; + $('#MACTable').append(contactdiv); } }, error: function (jqXHR, textStatus, errorThrown) { diff --git a/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml index a4cfbf01..173388ca 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml @@ -32,9 +32,6 @@ -
@@ -234,52 +231,40 @@ @* 序號編碼sheet *@
- - - - - - - - - - - @foreach (var index in Model.wipBarcodes) - { - - - - - } - -
- 起始生產序號 - - 結束生產序號 -
- @index.StartNO - - @index.EndNO -
- @*
-
- -
- -
-
-
-
- -
-
- -
-
-
*@ +
+
+ + + + + + + + + + @foreach (var index in Model.wipBarcodes) + { + + + + + } + +
+ 起始生產序號 + + 結束生產序號 +
+ @index.StartNO + + @index.EndNO +
+
+
- +
@@ -298,20 +283,38 @@
-
- -
- -
-
-
-
- -
+
+ + + + + + + + + + @foreach (var index in Model.wipMACs) + { + + + + + } + +
+ MAC區間起 + + MAC區間迄 +
+ @index.Title@index.StartNO + + @index.Title@index.EndNO +
@@ -962,8 +965,8 @@ SOP文件敘述 @* - 檔案路徑 - *@ + 檔案路徑 + *@ SOP類型 @@ -984,8 +987,8 @@ @* - - *@ + + *@ @@ -1146,11 +1149,6 @@ $("#barcodeOtherDiv").hide(); } - // DIV MAC - if ($('#wipMAC_StartNO').val() != "" && $('#wipMAC_EndNO').val() != "") { - $("#GetMAC").hide(); - } - getLineInfoList($("#unitNo").val()); // 產生條碼 @@ -1216,7 +1214,7 @@ }); // 產生MAC - $("#GetMAC").click(function (event) { + $("#GetMAC").click(function (event) { var wipNO = $('#wipAtt_ItemNO').val(); var planQTY = $('#wipInfo_PlanQTY').val(); if (wipNO == '' || !wipNO) { @@ -1230,7 +1228,7 @@ $.ajax({ url: '@Url.Action("GetMAC", "PCS")', dataType: 'json', - data: { "itemno": $("#wipAtt_ItemNO").val(), "planQTY": $('#wipInfo_PlanQTY').val() }, + data: { "itemno": $("#wipAtt_ItemNO").val(), "wipNo": $('#wipInfo_WipNO').val() ,"planQTY": $('#wipInfo_PlanQTY').val() }, cache: false, type: "POST", success: function (data, textStatus, jqXHR) { @@ -1238,10 +1236,10 @@ parent.hg.msg(data._msg); } else { - $("#wipMAC_StartNO").val(data.mix); - $("#wipMAC_EndNO").val(data.max); - $("#wipMAC_StartNO").attr("readonly", "readonly"); - $("#wipMAC_EndNO").attr("readonly", "readonly"); + var contactdiv = '' + + `${data.mix} + ${data.max}`; + $('#MACTable').append(contactdiv); } }, error: function (jqXHR, textStatus, errorThrown) { diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/MACInfoesController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/MACInfoesController.cs index ea2cc8ae..ae37f36d 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/MACInfoesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/MACInfoesController.cs @@ -218,7 +218,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES try { - await _context.Database.ExecuteSqlInterpolatedAsync($"UPDATE JHAMES.C_PARAMETER_INI SET VALUE={value} WHERE CLASS_GROUP={id}"); + await _context.Database.ExecuteSqlInterpolatedAsync($"UPDATE JHAMES.C_PARAMETER_INI SET VALUE={value},UPDATE_DATE={DateTime.Now} WHERE CLASS_GROUP={id}"); //_context.SaveChangesAsync(); result.Success = true; result.Msg = "OK"; diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipLockController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipLockController.cs index 076612f2..b556f104 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipLockController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipLockController.cs @@ -97,7 +97,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES [Route("[action]")] [HttpGet] public async Task> GetWipLockQuery(string wipNO, string lockstatus, string locktype - , string itemno, string lockreasontype, int stations = 0, string date_str = null, string date_end = null + , string itemno, string lockreasontype, int? stations, string date_str = null, string date_end = null , int page = 0, int limit = 10) { IQueryable q = from s in _context.WipLocks @@ -114,12 +114,11 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES UnLockDate = s.UnLockDate, LockUserID = s.LockUserID, LockReason = s.LockReason, - LockStatus = s.LockStatus == "0" ? "鎖定" : "解鎖", + LockStatus = s.LockStatus, UnLockUserID = s.UnLockUserID, UnLockReason = s.UnLockReason, LockReasonType = s.LockReasonType, - LockReasonTypeName = s.LockReasonType == "0" ? "3C認證工單" : - s.LockReasonType == "1" ? "驗證工單" : "維修換料待分析", + LockReasonTypeName = s.LockReasonType, LockType = s.LockType, LockUserName = q2.UserName, UnLockUserName = q3.UserName, @@ -142,7 +141,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES if (!string.IsNullOrWhiteSpace(itemno)) q = q.Where(w => w.ItemNO == itemno); - if (stations != 0) + if (stations != null) q = q.Where(w => w.StationID == stations); if (DateTime.TryParse(date_str, out _)) @@ -166,7 +165,15 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES q = q.Skip((page - 1) * limit).Take(limit); } - result.Data = await q.ToListAsync(); + var qq = await q.ToListAsync(); + qq = qq.Select(s => + { + s.LockStatus = s.LockStatus == "0" ? "鎖定" : "解鎖"; + s.LockReasonTypeName = s.LockReasonType == "0" ? "3C認證工單" : + s.LockReasonType == "1" ? "驗證工單" : "維修換料待分析"; return s; + }).ToList(); + + result.Data = qq; return result; } diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipMACController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipMACController.cs index 23f2eb54..4ceb15d3 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipMACController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipMACController.cs @@ -40,17 +40,16 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return WipMAC; } + /// + /// 工單MAC資料檔 By 工單號碼 + /// + /// + /// [HttpGet("{id}")] - public async Task> GetWipMAC(string id) + public async Task>> GetWipMAC(string id) { IQueryable q = _context.WipMACs; - - var WipMAC = await q.Where(p => p.WipNO == id).FirstOrDefaultAsync(); - - //if (WipMAC == null) - //{ - // return NotFound(); - //} + var WipMAC = await q.Where(p => p.WipNO == id).ToListAsync(); return WipMAC; } @@ -115,7 +114,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { ResultModel result = new ResultModel(); - var getWipMAC = GetWipMAC(wipMAC.WipNO).Result.Value; + var getWipMAC = GetWipMAC(wipMAC.WipNO).Result.Value.FirstOrDefault(); if (getWipMAC != null) { _context.WipMACs.Remove(getWipMAC); diff --git a/AMESCoreStudio.WebApi/DTO/AMES/FQC010VIiew.cs b/AMESCoreStudio.WebApi/DTO/AMES/FQC010VIiew.cs index 1474c2cf..828a9a06 100644 --- a/AMESCoreStudio.WebApi/DTO/AMES/FQC010VIiew.cs +++ b/AMESCoreStudio.WebApi/DTO/AMES/FQC010VIiew.cs @@ -30,6 +30,11 @@ namespace AMESCoreStudio.WebApi.DTO.AMES ///
public string InspectionDate { get; set; } + /// + /// 檢驗時間 + /// + public string EndTime { get; set; } + /// /// 工單料號 /// @@ -70,6 +75,9 @@ namespace AMESCoreStudio.WebApi.DTO.AMES /// public string BIOSVer { get; set; } + /// + /// ECN + /// public string ECN { get; set; } /// @@ -108,6 +116,9 @@ namespace AMESCoreStudio.WebApi.DTO.AMES /// public string QuotDescription { get; set; } + /// + /// + /// public string AQL { get; set; } /// @@ -162,6 +173,9 @@ namespace AMESCoreStudio.WebApi.DTO.AMES /// public string FactoryRemark { get; set; } = "N/A"; + /// + /// + /// public string ECNMemo { get; set; } = "N/A"; ///