|
@ -4564,18 +4564,26 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
string barcodeNo = string.Empty; |
|
|
string barcodeNo = string.Empty; |
|
|
string stationName = string.Empty; |
|
|
string stationName = string.Empty; |
|
|
int ruleStation = 0; |
|
|
int ruleStation = 0; |
|
|
|
|
|
// retrue View
|
|
|
|
|
|
List<dynamic> DataList = new List<dynamic>(); |
|
|
|
|
|
// 流程
|
|
|
var result_RuleStation = new List<RuleStationDto>(); |
|
|
var result_RuleStation = new List<RuleStationDto>(); |
|
|
|
|
|
|
|
|
// 條碼區間
|
|
|
// 條碼區間
|
|
|
var result_WipBarcode = await _pcsApi.GetWipBarcode(wipNo); |
|
|
var result_WipBarcode = await _pcsApi.GetWipBarcode(wipNo); |
|
|
|
|
|
|
|
|
// 查詢作業站(ruleStationID)
|
|
|
#region 查詢作業站(ruleStationID)
|
|
|
var result_WipInfo = await _pcsApi.GetWipInfoByWipNO(wipNo); |
|
|
var result_WipInfo = await _pcsApi.GetWipInfoByWipNO(wipNo); |
|
|
result_WipInfo = result_WipInfo.Where(w => w.UnitNO == unitNo).ToList(); |
|
|
result_WipInfo = result_WipInfo.Where(w => w.UnitNO == unitNo).ToList(); |
|
|
|
|
|
|
|
|
if (result_WipInfo.Count() != 0) |
|
|
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); |
|
|
result_RuleStation = await _pcsApi.GetRuleStationByFlow(result_WipInfo.FirstOrDefault().FlowRuleID); |
|
|
if (result_RuleStation.Count() != 0) |
|
|
if (result_RuleStation.Count() != 0) |
|
|
{ |
|
|
{ |
|
@ -4583,71 +4591,65 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
{ |
|
|
{ |
|
|
ruleStation = result_RuleStation.Where(w => w.StationID == stations).FirstOrDefault().RuleStationID; |
|
|
ruleStation = result_RuleStation.Where(w => w.StationID == stations).FirstOrDefault().RuleStationID; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
List<dynamic> aa = new List<dynamic>(); |
|
|
// 有比對到ruleStationID 才往下跑
|
|
|
// 跑條碼區間資料
|
|
|
if (ruleStation != 0) |
|
|
foreach (var item in result_WipBarcode) |
|
|
|
|
|
{ |
|
|
{ |
|
|
// 條碼
|
|
|
#region 跑條碼區間資料
|
|
|
string No = item.StartNO.Substring(0, item.StartNO.Length - NoLength); |
|
|
foreach (var item in result_WipBarcode) |
|
|
// 起始
|
|
|
|
|
|
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++) |
|
|
|
|
|
{ |
|
|
{ |
|
|
barcodeNo = No + i.ToString().PadLeft(NoLength, '0'); |
|
|
// 條碼(沒有流水碼)
|
|
|
// 取BarcodeID
|
|
|
string No = item.StartNO.Substring(0, item.StartNO.Length - NoLength); |
|
|
var BarcodeID = _pcsApi.GetBarcodeInfoesByNo(barcodeNo).InvokeAsync().Result.FirstOrDefault(); |
|
|
// 起始流水碼
|
|
|
// 沒有Barcode = 尚未投入
|
|
|
int startNo = int.Parse(item.StartNO.Substring(item.StartNO.Length - NoLength, NoLength)); |
|
|
if (BarcodeID == null) |
|
|
// 迄止流水碼
|
|
|
stationName = "尚未投入過站"; |
|
|
int endNo = int.Parse(item.EndNO.Substring(item.EndNO.Length - NoLength, NoLength)); |
|
|
else |
|
|
|
|
|
|
|
|
for (int i = startNo; i <= endNo; i++) |
|
|
{ |
|
|
{ |
|
|
var result_BarcodeStation = await _pcsApi.GetBarcodeStationByBarCodeID(BarcodeID.BarcodeID); |
|
|
barcodeNo = No + i.ToString().PadLeft(NoLength, '0'); |
|
|
// 判斷BarcodeStation 有RulseStation資料 代表有刷過 不顯示
|
|
|
// 取BarcodeID
|
|
|
if (result_BarcodeStation.Where(w => w.RuleStationID == ruleStation).Any()) |
|
|
var BarcodeInfo = _pcsApi.GetBarcodeInfoesByNo(barcodeNo).InvokeAsync().Result.FirstOrDefault(); |
|
|
continue; |
|
|
// 沒有BarcodeID = 尚未投入
|
|
|
|
|
|
if (BarcodeInfo == null) |
|
|
|
|
|
stationName = "尚未投入過站"; |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
if (result_BarcodeStation.Count() == 0) |
|
|
var result_BarcodeStation = await _pcsApi.GetBarcodeStationByBarCodeID(BarcodeInfo.BarcodeID); |
|
|
{ |
|
|
// 判斷BarcodeStation 有RulseStation資料 代表有刷過 不顯示
|
|
|
stationName = "尚未投入過站"; |
|
|
if (result_BarcodeStation.Where(w => w.RuleStationID == ruleStation).Any()) |
|
|
} |
|
|
continue; |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
var nowRuleStationID = result_BarcodeStation.OrderByDescending(o => o.InputDate) |
|
|
// 沒有過站紀錄
|
|
|
.FirstOrDefault().RuleStationID; |
|
|
if (result_BarcodeStation.Count() == 0) |
|
|
|
|
|
|
|
|
if (result_RuleStation.Where(w => w.RuleStationID == nowRuleStationID).Any()) |
|
|
|
|
|
{ |
|
|
{ |
|
|
stationName = result_RuleStation.Where(w => w.RuleStationID == nowRuleStationID) |
|
|
stationName = "尚未投入過站"; |
|
|
|
|
|
} |
|
|
|
|
|
// 取得BarInfo 當前站別
|
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
stationName = result_RuleStation.Where(w => w.RuleStationID == BarcodeInfo.RuleStationID) |
|
|
.FirstOrDefault().StationDesc; |
|
|
.FirstOrDefault().StationDesc; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var result = new |
|
|
var result = new |
|
|
{ |
|
|
{ |
|
|
barcodeNo = barcodeNo, |
|
|
barcodeNo = barcodeNo, |
|
|
stations = stationName |
|
|
stations = stationName |
|
|
}; |
|
|
}; |
|
|
|
|
|
DataList.Add(result); |
|
|
aa.Add(result); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
return Json(new Table() { count = 0, data = aa, msg = "111111" }); |
|
|
return Json(new Table() { count = 0, data = DataList, msg = "" }); |
|
|
//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 });
|
|
|
|
|
|
} |
|
|
} |
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|