Browse Source

1. PCS019 條碼遺漏查詢

PTD
ray 3 years ago
parent
commit
0d5189ea18
  1. 56
      AMESCoreStudio.Web/Controllers/PCSController.cs

56
AMESCoreStudio.Web/Controllers/PCSController.cs

@ -24,7 +24,7 @@ using Microsoft.Extensions.Configuration;
namespace AMESCoreStudio.Web.Controllers namespace AMESCoreStudio.Web.Controllers
{ {
public class PCSController : Controller public class PCSController : Controller
{ {
@ -1609,7 +1609,6 @@ namespace AMESCoreStudio.Web.Controllers
model.wipInfo.CustomerVIP = model.wipInfo.CustomerVIP == "true" ? "Y" : "N"; model.wipInfo.CustomerVIP = model.wipInfo.CustomerVIP == "true" ? "Y" : "N";
model.wipInfo.SFISFlowCk = model.wipInfo.SFISFlowCk == "true" ? "Y" : "N"; model.wipInfo.SFISFlowCk = model.wipInfo.SFISFlowCk == "true" ? "Y" : "N";
// 判斷資料填寫 // 判斷資料填寫
var Msg = CheckWipInfoInsert(model, "New"); var Msg = CheckWipInfoInsert(model, "New");
@ -4563,8 +4562,11 @@ namespace AMESCoreStudio.Web.Controllers
public async Task<IActionResult> PCS019QueryAsync(string wipNo, string unitNo, int stations, int page = 0, int limit = 10) public async Task<IActionResult> PCS019QueryAsync(string wipNo, string unitNo, int stations, int page = 0, int limit = 10)
{ {
string barcodeNo = string.Empty; string barcodeNo = string.Empty;
string stationName = string.Empty;
int ruleStation = 0; int ruleStation = 0;
var result_RuleStation = new List<RuleStationDto>();
// 條碼區間 // 條碼區間
var result_WipBarcode = await _pcsApi.GetWipBarcode(wipNo); var result_WipBarcode = await _pcsApi.GetWipBarcode(wipNo);
@ -4574,10 +4576,16 @@ namespace AMESCoreStudio.Web.Controllers
if (result_WipInfo.Count() != 0) 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) 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<dynamic> aa = new List<dynamic>(); List<dynamic> aa = new List<dynamic>();
// 跑條碼區間資料 // 跑條碼區間資料
foreach (var item in result_WipBarcode) 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)); 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 var result = new
{ {
barcodeNo = No + i.ToString().PadLeft(NoLength, '0'), barcodeNo = barcodeNo,
stations = "a" stations = stationName
}; };
aa.Add(result); aa.Add(result);
} }

Loading…
Cancel
Save