Browse Source

1. 修正PCS019 條碼漏刷查詢判斷

PTD
Ray 3 years ago
parent
commit
e42b1f44f4
  1. 102
      AMESCoreStudio.Web/Controllers/PCSController.cs
  2. 4
      AMESCoreStudio.Web/Views/PCS/PCS019.cshtml

102
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<dynamic> DataList = new List<dynamic>();
// 流程
var result_RuleStation = new List<RuleStationDto>();
// 條碼區間
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<dynamic> aa = new List<dynamic>();
// 跑條碼區間資料
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

4
AMESCoreStudio.Web/Views/PCS/PCS019.cshtml

@ -110,7 +110,7 @@
$.each(result.data, function (index, item) {
$("#unit").append($("<option>").text(item.text).val(item.value))
});
$("#unit option:eq(1)").attr("selected", 'selected'); //默认选择第一个选项
$("#unit option:eq(0)").attr("selected", 'selected'); //默认选择第一个选项
$("#unitNo").val($("#unit").val());
layui.form.render("select");//重新渲染 固定写法
},
@ -138,7 +138,7 @@
$("#stations").append($("<option>").text(item.text).val(item.value))
}
});
$("#stations option:eq(1)").attr("selected", 'selected'); //默认选择第一个选项
$("#stations option:eq(0)").attr("selected", 'selected'); //默认选择第一个选项
$("#stationsNo").val($("#stations").val());
layui.form.render("select");//重新渲染 固定写法
},

Loading…
Cancel
Save