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');