|
@ -8694,6 +8694,175 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
return _msg; |
|
|
return _msg; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region PCS038 條碼輸入整批作業
|
|
|
|
|
|
public async Task<IActionResult> PCS038() |
|
|
|
|
|
{ |
|
|
|
|
|
await GetLineInfo(); |
|
|
|
|
|
await GetFactoryUnit(); |
|
|
|
|
|
return View(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// PCS038 Query
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="wipNo">工單號碼/param>
|
|
|
|
|
|
/// <param name="productNo">料號</param>
|
|
|
|
|
|
/// <param name="unit">生產單位/param>
|
|
|
|
|
|
/// <param name="lineID">LineID</param>
|
|
|
|
|
|
/// <param name="type">選擇查詢類型</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public async Task<IActionResult> PCS038QueryAsync(string wipNo, string productNo, string unit, string type, int lineID = 0, int page = 0, int limit = 10) |
|
|
|
|
|
{ |
|
|
|
|
|
if (type == "W") |
|
|
|
|
|
productNo = string.Empty; |
|
|
|
|
|
else |
|
|
|
|
|
wipNo = string.Empty; |
|
|
|
|
|
|
|
|
|
|
|
var wipInfo = await _pcsApi.GetWipInfoByWipNO(wipNo); |
|
|
|
|
|
wipInfo = wipInfo.Where(w => w.WipType == "N").ToList(); |
|
|
|
|
|
if (wipInfo.Count() > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IResultModel<BarcodeInfoDto> result = await _pcsApi.GetBarcodeInfoesByPCS022Query(wipNo: wipNo, |
|
|
|
|
|
itemNo: productNo, unit: unit, lineID, page: page, limit: limit); |
|
|
|
|
|
|
|
|
|
|
|
if (result.Data.Count() != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.Data.Count() }); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
IResultModel<BarcodeInfoDto> result1 = await _pcsApi.GetWipInfosByPCS038Query(wipNo: wipNo, |
|
|
|
|
|
unit: unit, lineID, page: page, limit: limit); |
|
|
|
|
|
|
|
|
|
|
|
if (result1.Data.Count() != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
return Json(new Table() { code = 0, msg = "", data = result1.Data, count = result1.DataTotal }); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
return Json(new Table() { count = 0, data = null }); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
return Json(new Table() { count = 0, data = null }); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[HttpGet] |
|
|
|
|
|
public IActionResult PCS038V(int wipID, int stationID) |
|
|
|
|
|
{ |
|
|
|
|
|
ViewBag.WIP_ID = wipID; |
|
|
|
|
|
ViewBag.STATION_ID = stationID; |
|
|
|
|
|
return View(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[HttpGet] |
|
|
|
|
|
public async Task<IActionResult> PCS038VQuery(int wipID, int stationID, int page = 0, int limit = 10) |
|
|
|
|
|
{ |
|
|
|
|
|
var result = await _pcsApi.GetWipStationBarcodeByPCS038(wipID, stationID, page, limit); |
|
|
|
|
|
|
|
|
|
|
|
if (result.DataTotal > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return Json(new Table() { count = 0, data = null }); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[HttpPost] |
|
|
|
|
|
public async Task<IActionResult> PCS038U(int wipID, int StationID, int PassQty) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
var result = await _pcsApi.GetBarcodeInfoesByWipID(wipID); |
|
|
|
|
|
result = result.Where(w => w.StationID == StationID && w.RuleStatus == "P").OrderBy(o =>o.BarcodeID).Take(PassQty).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
var FlowRule = result.FirstOrDefault().GetWipInfo.FlowRuleID; |
|
|
|
|
|
var result_RuleStation = await _basApi.GetRuleStationsByFlow(FlowRule, 0); |
|
|
|
|
|
// 只抓標準站 & 排除完工站
|
|
|
|
|
|
result_RuleStation = result_RuleStation.Where(w => w.StationType == "M" && w.StationID != 1000).OrderBy(o => o.Sequence).ToList(); |
|
|
|
|
|
// 當站
|
|
|
|
|
|
|
|
|
|
|
|
var NowSequence = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (StationID != 0) |
|
|
|
|
|
NowSequence = result_RuleStation.Where(w => w.StationID == StationID && w.FlowRuleID == FlowRule).FirstOrDefault().Sequence; |
|
|
|
|
|
|
|
|
|
|
|
var NextStationID = 0; |
|
|
|
|
|
// 排除當站為最後一站
|
|
|
|
|
|
if (result_RuleStation.Count != NowSequence + 1) |
|
|
|
|
|
NextStationID = result_RuleStation.Where(w => w.Sequence == NowSequence + 1).FirstOrDefault().StationID; |
|
|
|
|
|
|
|
|
|
|
|
if (NextStationID != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
var resultMsg = string.Empty; |
|
|
|
|
|
foreach (var item in result) |
|
|
|
|
|
{ |
|
|
|
|
|
//自動過站
|
|
|
|
|
|
var barCode = new BarCodeCheckDto |
|
|
|
|
|
{ |
|
|
|
|
|
wipNo = item.GetWipInfo.WipNO, |
|
|
|
|
|
barcode = item.BarcodeNo, |
|
|
|
|
|
barcodeType = "M", |
|
|
|
|
|
stationID = NextStationID, |
|
|
|
|
|
line = item.GetWipInfo.LineID ?? 0, |
|
|
|
|
|
unitNo = item.GetWipInfo.UnitNO, |
|
|
|
|
|
inputItems = null, |
|
|
|
|
|
userID = GetLogInUserID() |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
if (StationID == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
await _pcsApi.DeleteBarcodeInfo(item.BarcodeID); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var barcode_result = await _pcsApi.PassIngByCheck(JsonConvert.SerializeObject(barCode)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (barcode_result.Success) |
|
|
|
|
|
{ |
|
|
|
|
|
resultMsg += $"{item.BarcodeNo} 內部條碼:資料過站成功!!!" + "</br>"; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
resultMsg += $"{item.BarcodeNo} 內部條碼:資料過站失敗!!!原因:" + barcode_result.Msg + "</br>"; |
|
|
|
|
|
} |
|
|
|
|
|
//return Json(new Result() { success = true, msg = resultMsg });
|
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
return Json(new Result() { success = false, msg = ex.Message }); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return Json(new Result() { success = true, msg = resultMsg }); |
|
|
|
|
|
} |
|
|
|
|
|
return Json(new Result() { success = true, msg = "該站為最後一站,無法執行過站" }); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async Task<IActionResult> PCS038CreateBarcodeAsync(int wipID) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
var wipbarcode = await _pcsApi.CreateBarcodeInfobyPCS038(wipID); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Json(new Result() { success = wipbarcode.Success, msg = wipbarcode.Msg }); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|