From e42b1f44f479334fb073844aa609892493e2bffe Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 9 Jun 2022 09:11:22 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=AD=A3PCS019=20=E6=A2=9D?= =?UTF-8?q?=E7=A2=BC=E6=BC=8F=E5=88=B7=E6=9F=A5=E8=A9=A2=E5=88=A4=E6=96=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 102 +++++++++--------- AMESCoreStudio.Web/Views/PCS/PCS019.cshtml | 4 +- 2 files changed, 54 insertions(+), 52 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index c03fd942..86eb106a 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -4564,18 +4564,26 @@ namespace AMESCoreStudio.Web.Controllers string barcodeNo = string.Empty; string stationName = string.Empty; int ruleStation = 0; - + // retrue View + List DataList = new List(); + // 流程 var result_RuleStation = new List(); - // 條碼區間 var result_WipBarcode = await _pcsApi.GetWipBarcode(wipNo); - // 查詢作業站(ruleStationID) + #region 查詢作業站(ruleStationID) var result_WipInfo = await _pcsApi.GetWipInfoByWipNO(wipNo); result_WipInfo = result_WipInfo.Where(w => w.UnitNO == unitNo).ToList(); if (result_WipInfo.Count() != 0) { + // 投入數量 = 0 就離開 + if (result_WipInfo.FirstOrDefault().CompleteQTY == 0) + { + return Json(new Table() { count = 0, data = DataList, msg = "" }); + } + + // 找該流程的作業站 result_RuleStation = await _pcsApi.GetRuleStationByFlow(result_WipInfo.FirstOrDefault().FlowRuleID); if (result_RuleStation.Count() != 0) { @@ -4583,71 +4591,65 @@ namespace AMESCoreStudio.Web.Controllers { ruleStation = result_RuleStation.Where(w => w.StationID == stations).FirstOrDefault().RuleStationID; } - } + } } + #endregion - List aa = new List(); - // 跑條碼區間資料 - foreach (var item in result_WipBarcode) + // 有比對到ruleStationID 才往下跑 + if (ruleStation != 0) { - // 條碼 - string No = item.StartNO.Substring(0, item.StartNO.Length - NoLength); - // 起始 - int startNo = int.Parse(item.StartNO.Substring(item.StartNO.Length - NoLength, NoLength)); - // 迄止 - int endNo = int.Parse(item.EndNO.Substring(item.EndNO.Length - NoLength, NoLength)); - - for (int i = startNo; i <= endNo; i++) + #region 跑條碼區間資料 + foreach (var item in result_WipBarcode) { - barcodeNo = No + i.ToString().PadLeft(NoLength, '0'); - // 取BarcodeID - var BarcodeID = _pcsApi.GetBarcodeInfoesByNo(barcodeNo).InvokeAsync().Result.FirstOrDefault(); - // 沒有Barcode = 尚未投入 - if (BarcodeID == null) - stationName = "尚未投入過站"; - else + // 條碼(沒有流水碼) + string No = item.StartNO.Substring(0, item.StartNO.Length - NoLength); + // 起始流水碼 + int startNo = int.Parse(item.StartNO.Substring(item.StartNO.Length - NoLength, NoLength)); + // 迄止流水碼 + int endNo = int.Parse(item.EndNO.Substring(item.EndNO.Length - NoLength, NoLength)); + + for (int i = startNo; i <= endNo; i++) { - var result_BarcodeStation = await _pcsApi.GetBarcodeStationByBarCodeID(BarcodeID.BarcodeID); - // 判斷BarcodeStation 有RulseStation資料 代表有刷過 不顯示 - if (result_BarcodeStation.Where(w => w.RuleStationID == ruleStation).Any()) - continue; + barcodeNo = No + i.ToString().PadLeft(NoLength, '0'); + // 取BarcodeID + var BarcodeInfo = _pcsApi.GetBarcodeInfoesByNo(barcodeNo).InvokeAsync().Result.FirstOrDefault(); + // 沒有BarcodeID = 尚未投入 + if (BarcodeInfo == null) + stationName = "尚未投入過站"; else { - if (result_BarcodeStation.Count() == 0) - { - stationName = "尚未投入過站"; - } + var result_BarcodeStation = await _pcsApi.GetBarcodeStationByBarCodeID(BarcodeInfo.BarcodeID); + // 判斷BarcodeStation 有RulseStation資料 代表有刷過 不顯示 + if (result_BarcodeStation.Where(w => w.RuleStationID == ruleStation).Any()) + continue; else { - var nowRuleStationID = result_BarcodeStation.OrderByDescending(o => o.InputDate) - .FirstOrDefault().RuleStationID; - - if (result_RuleStation.Where(w => w.RuleStationID == nowRuleStationID).Any()) + // 沒有過站紀錄 + if (result_BarcodeStation.Count() == 0) { - stationName = result_RuleStation.Where(w => w.RuleStationID == nowRuleStationID) + stationName = "尚未投入過站"; + } + // 取得BarInfo 當前站別 + else + { + stationName = result_RuleStation.Where(w => w.RuleStationID == BarcodeInfo.RuleStationID) .FirstOrDefault().StationDesc; } } } - } - var result = new - { - barcodeNo = barcodeNo, - stations = stationName - }; - - aa.Add(result); + var result = new + { + barcodeNo = barcodeNo, + stations = stationName + }; + DataList.Add(result); + } } - } + #endregion - return Json(new Table() { count = 0, data = aa, msg = "111111" }); - //if (result.Data != null) - //{ - // return Json(new Table() { code = 0, msg = "111111", data = result.Data, count = result.DataTotal }); - //} - //return Json(new Table() { count = 0, data = null }); + return Json(new Table() { count = 0, data = DataList, msg = "" }); } #endregion diff --git a/AMESCoreStudio.Web/Views/PCS/PCS019.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS019.cshtml index da6c6afd..092dde8b 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS019.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS019.cshtml @@ -110,7 +110,7 @@ $.each(result.data, function (index, item) { $("#unit").append($("