diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index b1e54581..c68dfc94 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -1894,16 +1894,33 @@ namespace AMESCoreStudio.Web.Controllers public async Task PCS009R(PCS009ViewModel model) { - var result = new PCS009RViewModel(); + var result_barcodeinfo = new BarcodeInfo(); - var result_barcodeinfo = _pcsApi.GetBarcodeInfoesByNo(model.BarCodeNo).InvokeAsync().Result.FirstOrDefault(); + // 組件條碼查詢 + if (!string.IsNullOrWhiteSpace(model.PartNo)) + { + var result_barcodeitem = _pcsApi.GetBarcodeItemByPartNo(model.PartNo).InvokeAsync().Result.FirstOrDefault(); + if (result_barcodeitem != null) + { + model.BarCodeNo = _pcsApi.GetBarcodeInfoes(result_barcodeitem.BarcodeID).InvokeAsync().Result.FirstOrDefault().BarcodeNo; + } + } + + // 外部序號查詢 + if (!string.IsNullOrWhiteSpace(model.ExtraBarCodeNo)) + { + result_barcodeinfo = _fqcApi.GetBarcodeInfoesByExtraNo(model.ExtraBarCodeNo).InvokeAsync().Result.FirstOrDefault(); + model.BarCodeNo = result_barcodeinfo.BarcodeNo; + } + + result_barcodeinfo = _pcsApi.GetBarcodeInfoesByNo(model.BarCodeNo).InvokeAsync().Result.FirstOrDefault(); if (result_barcodeinfo == null) { var _msg = "查無相關資料!"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); } - + var result = new PCS009RViewModel(); // 條碼資料 result.BarCodeNo = result_barcodeinfo.BarcodeNo; result.ExtraBarCodeNo = result_barcodeinfo.ExtraBarcodeNo; @@ -1947,8 +1964,8 @@ namespace AMESCoreStudio.Web.Controllers } // 條碼組件 - var result_barcodeitem = await _pcsApi.GetBarcodeItemByBarCodeID(result_barcodeinfo.BarcodeID); - foreach (var barcodeitem in result_barcodeitem.OrderBy(o => o.CreateDate)) + var barcodeitems = await _pcsApi.GetBarcodeItemByBarCodeID(result_barcodeinfo.BarcodeID); + foreach (var barcodeitem in barcodeitems.OrderBy(o => o.CreateDate)) { result.BarCodeKPs.Add(new BarCodeKP { @@ -1960,8 +1977,8 @@ namespace AMESCoreStudio.Web.Controllers } // 組件變更 - var result_barcodeitemchange = await _pcsApi.GetBarcodeItemChangesByBarCodeID(result_barcodeinfo.BarcodeID); - foreach (var barcodeitemchange in result_barcodeitemchange.OrderBy(o => o.CreateDate)) + var barcodeitemchanges = await _pcsApi.GetBarcodeItemChangesByBarCodeID(result_barcodeinfo.BarcodeID); + foreach (var barcodeitemchange in barcodeitemchanges.OrderBy(o => o.CreateDate)) { result.KPChanges.Add(new KPChange { diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 7f51ef04..2e7f08bc 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -297,6 +297,13 @@ namespace AMESCoreStudio.Web /// [WebApiClient.Attributes.HttpGet("api/BarcodeItems/ByBarCode")] ITask> GetBarcodeItemByBarCode(string barcode); + + /// + /// 查詢組件序號 by PartNo + /// + /// + [WebApiClient.Attributes.HttpGet("api/BarcodeItems/ByPartNo/{id}")] + ITask> GetBarcodeItemByPartNo(string id); #endregion #region NgInfo 測試不良基本資料檔 PCS021 diff --git a/AMESCoreStudio.Web/Views/PCS/PCS009.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS009.cshtml index b17642aa..9c834416 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS009.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS009.cshtml @@ -25,6 +25,10 @@ border-color: #e6e6e6; margin: 10px 0; } + + .layui-table th{ + text-align:center; + } @@ -77,7 +81,13 @@ -
+
+ +
+
+
+ +
@@ -93,7 +103,7 @@ function detail(obj) { if (obj.data.barcodeNo) { - hg.open('檢視工單資料', '/PCS/PCS009R?BarCodeNo=' + obj.data.barcodeNo, '', '', true); + hg.open('條碼生產歷程', '/PCS/PCS009R?BarCodeNo=' + obj.data.barcodeNo, '', '', true); } } @@ -107,14 +117,12 @@ var tableCols = [[ { field: 'barcodeNo', - width: 150, title: '內部條碼', sort: true }, { field: 'extraBarcodeNo', title: '客戶條碼', - width: 200, sort: true }, { @@ -138,7 +146,7 @@ hg.open('條碼生產歷程', '/PCS/PCS009R' + query, '', '', true); } - + }; } \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml index 1f181fab..501c62b5 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml @@ -86,7 +86,7 @@
工單資料
- +
@foreach (var index in Model.WinInfos) { @@ -166,7 +166,7 @@
條碼紀錄
-
+
@@ -214,7 +214,7 @@
條碼組件
- +
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs index c8c13801..07d6afdd 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs @@ -245,7 +245,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// /// 用barcode獲取資料 /// - /// barcodeID + /// barcodeID /// [HttpGet("ByBarCode")] public async Task>> GetBarcodeItemByBarCode(string barcode) @@ -269,6 +269,19 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return barcodeItem; } + /// + /// 查詢 By PartNo + /// + /// 組件條碼 + /// + [HttpGet("ByPartNo/{id}")] + public async Task>> GetBarcodeItemByPartNo(string id) + { + IQueryable q = _context.BarcodeItems.Where(w => w.PartNo == id); + var barcodeItem = await q.ToListAsync(); + return barcodeItem; + } + /// /// 確認組件代碼是否重複 ///