diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 1d04be66..6c9b06df 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -6538,14 +6538,21 @@ namespace AMESCoreStudio.Web.Controllers public async Task PCS024C(string id) { var result = await _pcsApi.GetBarcodeInfoesByNo(id); + if (result.Count > 0) + { + var tt = result[0]; + ViewBag.BarcodeID = tt.BarcodeID; + ViewBag.WipID = tt.WipID; + ViewBag.BarcodeNo = id; - var tt = result[0]; - ViewBag.BarcodeID = tt.BarcodeID; - ViewBag.WipID = tt.WipID; - ViewBag.BarcodeNo = id; - await GetFactoryUnit(); - //await GetStations(); - await GetItems(); + await GetFactoryUnit(); + //await GetStations(); + await GetItems(); + } + else + { + ViewBag.BarcodeNo = "查無序號請重新輸入"; + } return View(); } @@ -6570,6 +6577,20 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Result() { success = true, msg = "" }); } + [HttpGet] + public async Task GetBarcodeInfoesByNoAsync(string id) + { + var result = await _pcsApi.GetBarcodeInfoesByNo(id); + + if (result.Count > 0) + { + return Json(new Table() { code = 0, msg = "", data = result, count = 1 }); + } + + return Json(new Table() { count = 0, data = null }); + } + + //頁面提交,id=0 添加,id>0 修改 [HttpPost] public async Task PCS024CSaveAsync(BarcodeItem model) @@ -8351,7 +8372,7 @@ namespace AMESCoreStudio.Web.Controllers } #endregion } - + public static class ObjectExtension { public static T GetAttributeFrom(this object instance, string propertyName) where T : Attribute @@ -8362,4 +8383,7 @@ namespace AMESCoreStudio.Web.Controllers return (T)property.GetCustomAttributes(attributeType, false).FirstOrDefault(); } } + + + } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS024.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS024.cshtml index 8c83d445..7d8623e2 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS024.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS024.cshtml @@ -94,9 +94,14 @@ //新增 $('#btnAdd').click(function () { + + var keywords = $('#barcodeNo').val(); + getBarcodeinfo(keywords); var keywords = $('#barcodeNo').val(); if (keywords) - hg.open('新增組件資料', '/PCS/PCS024C/' + keywords, 640, 480); + { + hg.open('新增組件資料', '/PCS/PCS024C/' + keywords, 640, 480); + } else alert("請先輸入內部條碼!!"); }); @@ -112,5 +117,33 @@ var table = hg.table.datatable('test', '組件資料', '/PCS/GetBarcodeItemByUnit?unitId=' + unit + '&barcodeNo=' + barcode, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); }; + + + function getBarcodeinfo(barcodeNO) { + if (barcodeNO) { + + $.ajax({ + url: "/PCS/GetBarcodeInfoesByNo", + data: { id: barcodeNO }, + dataType: 'json', + contentType: "application/json", + type: 'get', + success: function (result) { + if (result.data) { + + } + else { + + alert('查無此序號請確認序號是否正確!!!'); + + return false; + } + + } + }); + } + }; + + } \ No newline at end of file diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseDetailController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseDetailController.cs index b3cdf6fe..1010329b 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseDetailController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseDetailController.cs @@ -259,13 +259,14 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES [HttpDelete("{id}")] public async Task> DeleteFqcInhouseDetail(string id) { - + ResultModel result = new ResultModel(); var fqcInhouseDetail = await _context.FqcInhouseDetails.Where(p => p.InhouseNo == id).FirstOrDefaultAsync(); if (fqcInhouseDetail == null) - { - return NotFound(); - } + { + + return fqcInhouseDetail; + } _context.FqcInhouseDetails.Remove(fqcInhouseDetail); await _context.SaveChangesAsync();