From 0d5189ea180773934cde95c23711699fd38dd42a Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 9 Jun 2022 01:14:25 +0800 Subject: [PATCH] =?UTF-8?q?1.=20PCS019=20=E6=A2=9D=E7=A2=BC=E9=81=BA?= =?UTF-8?q?=E6=BC=8F=E6=9F=A5=E8=A9=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 56 ++++++++++++++++--- 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 714488df..c03fd942 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -24,7 +24,7 @@ using Microsoft.Extensions.Configuration; namespace AMESCoreStudio.Web.Controllers { - + public class PCSController : Controller { @@ -1609,7 +1609,6 @@ namespace AMESCoreStudio.Web.Controllers model.wipInfo.CustomerVIP = model.wipInfo.CustomerVIP == "true" ? "Y" : "N"; model.wipInfo.SFISFlowCk = model.wipInfo.SFISFlowCk == "true" ? "Y" : "N"; - // 判斷資料填寫 var Msg = CheckWipInfoInsert(model, "New"); @@ -4563,8 +4562,11 @@ namespace AMESCoreStudio.Web.Controllers public async Task PCS019QueryAsync(string wipNo, string unitNo, int stations, int page = 0, int limit = 10) { string barcodeNo = string.Empty; + string stationName = string.Empty; int ruleStation = 0; + var result_RuleStation = new List(); + // 條碼區間 var result_WipBarcode = await _pcsApi.GetWipBarcode(wipNo); @@ -4574,10 +4576,16 @@ namespace AMESCoreStudio.Web.Controllers if (result_WipInfo.Count() != 0) { - var result_RuleStation = await _pcsApi.GetRuleStationByFlow(result_WipInfo.FirstOrDefault().FlowRuleID); + result_RuleStation = await _pcsApi.GetRuleStationByFlow(result_WipInfo.FirstOrDefault().FlowRuleID); if (result_RuleStation.Count() != 0) - ruleStation = result_RuleStation.FirstOrDefault().StationID; + { + if (result_RuleStation.Any(w => w.StationID == stations)) + { + ruleStation = result_RuleStation.Where(w => w.StationID == stations).FirstOrDefault().RuleStationID; + } + } } + List aa = new List(); // 跑條碼區間資料 foreach (var item in result_WipBarcode) @@ -4589,14 +4597,46 @@ namespace AMESCoreStudio.Web.Controllers // 迄止 int endNo = int.Parse(item.EndNO.Substring(item.EndNO.Length - NoLength, NoLength)); - for(int i = startNo; i <= endNo; i++) + for (int i = startNo; i <= endNo; i++) { + barcodeNo = No + i.ToString().PadLeft(NoLength, '0'); + // 取BarcodeID + var BarcodeID = _pcsApi.GetBarcodeInfoesByNo(barcodeNo).InvokeAsync().Result.FirstOrDefault(); + // 沒有Barcode = 尚未投入 + if (BarcodeID == null) + stationName = "尚未投入過站"; + else + { + var result_BarcodeStation = await _pcsApi.GetBarcodeStationByBarCodeID(BarcodeID.BarcodeID); + // 判斷BarcodeStation 有RulseStation資料 代表有刷過 不顯示 + if (result_BarcodeStation.Where(w => w.RuleStationID == ruleStation).Any()) + continue; + else + { + if (result_BarcodeStation.Count() == 0) + { + stationName = "尚未投入過站"; + } + else + { + var nowRuleStationID = result_BarcodeStation.OrderByDescending(o => o.InputDate) + .FirstOrDefault().RuleStationID; + + if (result_RuleStation.Where(w => w.RuleStationID == nowRuleStationID).Any()) + { + stationName = result_RuleStation.Where(w => w.RuleStationID == nowRuleStationID) + .FirstOrDefault().StationDesc; + } + } + } + } + var result = new { - barcodeNo = No + i.ToString().PadLeft(NoLength, '0'), - stations = "a" + barcodeNo = barcodeNo, + stations = stationName }; - + aa.Add(result); }