From 89fdf4d105a57ab00f7ed9c7c2be2eb8ff4de781 Mon Sep 17 00:00:00 2001 From: Yiru Date: Tue, 12 Sep 2023 22:21:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E8=B2=A8=E5=BA=8F=E8=99=9F=E9=87=8D?= =?UTF-8?q?=E5=8F=96=E5=9C=A8=E6=93=8D=E4=BD=9C=E5=A2=9E=E5=8A=A0=E6=88=96?= =?UTF-8?q?=E6=B8=9B=E5=B0=91=E5=BA=8F=E8=99=9F=E5=BE=8C=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E5=9B=9E=E5=88=B0=E6=9F=A5=E8=A9=A2=E7=95=AB=E9=9D=A2=E4=B8=A6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B3=87=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 54 ++++++++----------- AMESCoreStudio.Web/Views/PCS/PCS040.cshtml | 18 ++++--- 2 files changed, 33 insertions(+), 39 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index b2e9da7a..8658db6c 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -9021,18 +9021,9 @@ namespace AMESCoreStudio.Web.Controllers #region PCS040 工單設定 - public async Task PCS040(string id) + public async Task PCS040() { - if (id != null) - { - await GetFactoryUnit(id); - ViewBag.UnitNo = id; - } - else - { - await GetFactoryUnit(); - } - + await GetFactoryUnit(); //await GetFactoryUnit(); return View(); } @@ -9044,16 +9035,18 @@ namespace AMESCoreStudio.Web.Controllers /// 工單號碼 /// 料號 /// - public async Task PCS040QueryAsync(string wipNo, int page = 0, int limit = 10) + [ResponseCache(Duration = 0)] + [HttpGet] + public async Task PCS040QueryAsync(string id, int page = 0, int limit = 10) { - if (string.IsNullOrEmpty(wipNo)) + if (string.IsNullOrEmpty(id)) { return Json(new Table() { code = 0, msg = "無資料", data = "", count = 0 }); } - - var wipbarcode = await _pcsApi.GetWipBarcodeOther(wipNo); - + + var wipbarcode = await _pcsApi.GetWipBarcodeOther(id); + string BegnBarcode = string.Empty; int snLength = 0; int SerialRuleDetailID = 0; @@ -9068,12 +9061,12 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Table() { code = 0, msg = "查不到工單出貨序號區間值", data = "", count = 0 }); } - // if (SerialRuleDetailID == null) - // return Json(new Table() { code = 0, msg = "查不到工單出貨序號區間值", data = "", count = 0 }); - // else + // if (SerialRuleDetailID == null) + // return Json(new Table() { code = 0, msg = "查不到工單出貨序號區間值", data = "", count = 0 }); + // else { var SerialRule = await _pcsApi.GetSerialRuleDetail(SerialRuleDetailID); - var result = await _pcsApi.GetWipBarcodeOtherByItemNo(WipNo: wipNo, ItemNo: SerialRule.Select(s=>s.ItemNo).FirstOrDefault()); + var result = await _pcsApi.GetWipBarcodeOtherByItemNo(WipNo: id, ItemNo: SerialRule.Select(s => s.ItemNo).FirstOrDefault()); result.Data = result.Data.Where(w => w.Wip_Status_NO != "E"); //判斷工單已開線 foreach (var item in result.Data) @@ -9107,7 +9100,7 @@ namespace AMESCoreStudio.Web.Controllers #endregion } - result.Data = result.Data.OrderBy(o => o.WipScheduleDate).ThenBy(o =>o.StartNo); + result.Data = result.Data.OrderBy(o => o.WipScheduleDate).ThenBy(o => o.StartNo); return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); } } @@ -9467,10 +9460,11 @@ namespace AMESCoreStudio.Web.Controllers await GetBarcodeOther(model.WipAtt.ItemNO, model.LotNo, QTY, model.WipInfo.WipNO, model.WipInfo.WipScheduleDate.ToString("yyyy-MM-dd")); _msg = "產生成功!"; - return RedirectToAction("Refresh", "Home", new { id = model.WipInfo.WipNO, msg = _msg }); + + return RedirectToAction("Refresh", "Home", new { msg = _msg }); } - + IResultModel result; model.WipBarcodeOther.WipNO = model.WipInfo.WipNO; @@ -9482,19 +9476,17 @@ namespace AMESCoreStudio.Web.Controllers if (result.Success) { _msg = "修改成功!"; - return RedirectToAction("Refresh", "Home", new { wipNo = model.WipInfo.WipNO, msg = _msg }); - // return RedirectToAction("PCS040R", "PCS", new { id = model.WipInfo.WipNO,Rule = model.WipAtt.ModelNO, serialRuleitem = model.SerialRuleItem }); - // return RedirectToAction("PCS040Query", "PCS", new { wipNo = model.WipInfo.WipNO }); - - } - else + + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + + } + else { _msg = result.Msg; ModelState.AddModelError("error", result.Msg); } - - return RedirectToAction("Refresh", "Home", new { wipNo = model.WipInfo.WipNO, msg = _msg }); + return RedirectToAction("Refresh", "Home", new { msg = _msg }); } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS040.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS040.cshtml index 4e16a35f..a81de2c7 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS040.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS040.cshtml @@ -69,7 +69,8 @@ //监听表单提交事件 hg.form.onsubmit('querysubmit', function (data) { - table && table.reload(data); + // table && table.reload(data); + tt(); }); var tableCols = [[ @@ -184,8 +185,6 @@ }); } - - function Create(obj) { if (obj.data.wipNo) { hg.open('產生工單資料', '/PCS/PCS040C?id=' + obj.data.wipNo + '&rule=' + obj.data.rule + '&serialRuleitem=' + obj.data.itemRule, 740, 350); @@ -193,11 +192,14 @@ } - - - //基本資料表格 - var table = hg.table.datatable('query', '工單資料修改', '/PCS/PCS040Query/' + $("#wipNo").val() , {}, tableCols, {}, true, 'full-100', ['filter', 'print', 'exports']); - + var table; + $(function () { + tt(); + }); + //基本数据表格 + function tt() { + table = hg.table.datatable('query', '工單資料修改', '/PCS/PCS040Query?id=' + $("#wipNo").val(), {}, tableCols, {}, true, 'full-100', ['filter', 'print', 'exports']); + } $(document).off('mousedown', '.layui-table-grid-down'). on('mousedown', '.layui-table-grid-down', function (event) { table._tableTrCurrr = $(this).closest('td');