From 2b46b576d512bf86a8d01681a2e835b046d2fda0 Mon Sep 17 00:00:00 2001 From: Yiru Date: Wed, 9 Aug 2023 00:44:45 +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=95=8F=E9=A1=8C=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 37 ++++++++++--------- .../AMES/WipBarcodeOthersController.cs | 13 +++++-- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index d16ddfe5..7a6d4c2b 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -9171,23 +9171,24 @@ namespace AMESCoreStudio.Web.Controllers } if (Rule.Contains("SN4]")) { - NewRule = NewRule.Replace("[SN4]", "0000"); + NewRule = NewRule.Replace("[SN4]", "&&&&"); } - if (Rule.Contains("SN5]")) + if (Rule.Contains("SS]")) { - NewRule = NewRule.Replace("[SN5]", "00000"); + NewRule = NewRule.Replace("[SS]", "**"); } - if (Rule.Contains("SN6]")) + if (Rule.Contains("SN5]")) { - NewRule = NewRule.Replace("[SN6]", "000000"); + NewRule = NewRule.Replace("[SN5]", "&&&&&"); } - if (Rule.Contains("SS]")) + if (Rule.Contains("SN6]")) { - NewRule = NewRule.Replace("[SS]", "**"); + NewRule = NewRule.Replace("[SN6]", "&&&&&&"); } + - int SNStart = NewRule.IndexOf('0'); //流水號開始 - int SNLen = NewRule.Count(c => c == '0'); //流水號長度 + int SNStart = NewRule.IndexOf('&'); //流水號開始 + int SNLen = NewRule.Count(c => c == '&'); //流水號長度 #endregion // 流水碼預設長度 @@ -9264,15 +9265,15 @@ namespace AMESCoreStudio.Web.Controllers } string EndNO = model.WipBarcodeOther.EndNO.Substring(0, SNStart) + InputEndNoQty.ToString().PadLeft(SNLen, '0') + model.WipBarcodeOther.EndNO.Substring(SNStart + SNLen); //判斷結束序號是否有重覆在其他區間 - var CheckRepeat = await CheckWipBarcodeOtherRepeat(model.WipInfo.WipNO,model.SerialRuleItem,model.WipBarcodeOther.StartNO,EndNO, SNStart , SNLen); - if (!CheckRepeat.Success) - { - _msg = CheckRepeat.Msg; - // ModelState.AddModelError("error", CheckRepeat.Msg); + //var CheckRepeat = await CheckWipBarcodeOtherRepeat(model.WipInfo.WipNO,model.SerialRuleItem,model.WipBarcodeOther.StartNO,EndNO, SNStart , SNLen); + // if (!CheckRepeat.Success) + // { + // _msg = CheckRepeat.Msg; + // // ModelState.AddModelError("error", CheckRepeat.Msg); - } - else - { + // } + // else + // { //取相同Rule 年、月、周 的所有料號 var result1 = await _pcsApi.GetSerialRuleDetail(model.WipBarcodeOther.SerialRuleDetailID); var q_Detail = await _pcsApi.GetSerialRuleDetailbyPCS040(model.WipBarcodeOther.SerialRuleDetailID); @@ -9387,7 +9388,7 @@ namespace AMESCoreStudio.Web.Controllers // ModelState.AddModelError("error", result.Msg); //} } - } + // } return RedirectToAction("Refresh", "Home", new { wipNo = model.WipInfo.WipNO, msg = _msg }); // return RedirectToAction("PCS040R", "PCS", new { id = model.WipInfo.WipID, msg = _msg }); diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs index 355f3677..a49accfe 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs @@ -95,10 +95,10 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// /// [HttpGet("WipBarcodeOtherByItemNo")] - public async Task> GetWipBarcodeOtherByItemNo(string WipNo,string ItemNo) + public async Task> GetWipBarcodeOtherByItemNo(string WipNo, string ItemNo) { - var SerialRule = _context.SerialRuleDetails.Where(W => W.ItemNo == ItemNo) ;//.Select(s =>s.SerialRuleDetailID.ToString()).ToList(); - + var SerialRule = _context.SerialRuleDetails.Where(W => W.ItemNo == ItemNo);//.Select(s =>s.SerialRuleDetailID.ToString()).ToList(); + var wipBarcodeOther = _context.WipBarcodeOthers.Where(W => W.WipNO == WipNo); //查工單預計開工日 @@ -108,7 +108,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES join W in _context.WipInfos.Where(w => w.WipScheduleDate >= wipinfo) on O.WipNO equals W.WipNO join A in _context.WipAtts on O.WipNO equals A.WipNO join D in _context.SerialRuleDetails on O.SerialRuleDetailID equals D.SerialRuleDetailID - where D.Rule == SerialRule.Select(s=>s.Rule).FirstOrDefault() + where D.Rule == SerialRule.Select(s => s.Rule).FirstOrDefault() select new WipBarcodeOtherDto { @@ -131,7 +131,11 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES ResultModel result = new ResultModel(); + if (ItemNo.Contains("OTHER")) + { + q = q.Where(w => w.ItemRule == ItemNo); + } result.Data = await q.ToListAsync(); // result.Data = result.Data.Select(s => { s.Status = s.Status == "Y" ? "已投產" : s.Status == "N" ? "未投產" : "末知"; return s; }) @@ -145,6 +149,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return result; } + /// /// 新增工單出貨條碼區間設定檔 ///