|
|
@ -2192,15 +2192,15 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
// Input為內部序號
|
|
|
|
model.Barcode = true; |
|
|
|
|
|
|
|
// 確認內部序號是否報廢
|
|
|
|
var BarCodeScrapped = await _pcsApi.CheckBarCodeScrapped(Data); |
|
|
|
if (!BarCodeScrapped.Success) |
|
|
|
return Json(new Result() { success = BarCodeScrapped.Success, msg = BarCodeScrapped.Msg, data = Data }); |
|
|
|
//// 確認內部序號是否報廢
|
|
|
|
//var BarCodeScrapped = await _pcsApi.CheckBarCodeScrapped(Data);
|
|
|
|
//if (!BarCodeScrapped.Success)
|
|
|
|
// return Json(new Result() { success = BarCodeScrapped.Success, msg = BarCodeScrapped.Msg, data = Data });
|
|
|
|
|
|
|
|
// 確認內部序號是否鎖定
|
|
|
|
var BarCodeLock = await _pcsApi.CheckBarCodeLock(Data); |
|
|
|
if (!BarCodeLock.Success) |
|
|
|
return Json(new Result() { success = BarCodeLock.Success, msg = BarCodeLock.Msg, data = Data }); |
|
|
|
//// 確認內部序號是否鎖定
|
|
|
|
//var BarCodeLock = await _pcsApi.CheckBarCodeLock(Data);
|
|
|
|
//if (!BarCodeLock.Success)
|
|
|
|
// return Json(new Result() { success = BarCodeLock.Success, msg = BarCodeLock.Msg, data = Data });
|
|
|
|
|
|
|
|
// 取RuleStationID
|
|
|
|
var RuleStations = await _basApi.GetRuleStationsByFlow(model.FlowRuleID, 0); |
|
|
@ -2219,14 +2219,19 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
if (model.StationSEQ == 1) |
|
|
|
{ |
|
|
|
Msg += "投入站不能刷不良代碼</br>"; |
|
|
|
} |
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(Msg)) |
|
|
|
{ |
|
|
|
Success = false; |
|
|
|
return Json(new Result() { success = Success, msg = Msg, data = Data }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 判斷作業站與製程順序是否正確
|
|
|
|
var BarCodeFlow = await _pcsApi.CheckBarCodeFlow(model.WipNO, model.Input, model.UnitNO, model.Station); |
|
|
|
if (!BarCodeFlow.Success) |
|
|
|
return Json(new Result() { success = BarCodeFlow.Success, msg = BarCodeFlow.Msg, data = Data }); |
|
|
|
//// 判斷作業站與製程順序是否正確
|
|
|
|
//var BarCodeFlow = await _pcsApi.CheckBarCodeFlow(model.WipNO, model.Input, model.UnitNO, model.Station);
|
|
|
|
//if (!BarCodeFlow.Success)
|
|
|
|
// return Json(new Result() { success = BarCodeFlow.Success, msg = BarCodeFlow.Msg, data = Data });
|
|
|
|
|
|
|
|
|
|
|
|
// 下一個作業站是完工站時再判斷是否都有刷組件
|
|
|
@ -2240,253 +2245,298 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
if (CheckBarCodeKP.Data != null) |
|
|
|
ExtNo = CheckBarCodeKP.Data.FirstOrDefault(); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Msg += "內部序號工單號碼與過站工單不相同</br>"; |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
|
|
|
|
var keyParts = new List<BarCodeCheckDto.inputItem>(); |
|
|
|
// 先查詢已綁定組件數量
|
|
|
|
var BarCodeItems = await _pcsApi.GetBarcodeItemByBarCode(model.Input); |
|
|
|
int KpItemQty = BarCodeItems.Count(); |
|
|
|
int i = 0; |
|
|
|
foreach (var KeyPartItem in model.Inputs) |
|
|
|
{ |
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(Msg)) |
|
|
|
{ |
|
|
|
Success = false; |
|
|
|
return Json(new Result() { success = Success, msg = Msg, data = Data }); |
|
|
|
} |
|
|
|
keyParts.Add(new BarCodeCheckDto.inputItem |
|
|
|
{ |
|
|
|
inputType = KeyPartItem.Contains("$") ? "NG" : model.MaterialKps[i + KpItemQty].KpNo, |
|
|
|
inputData = KeyPartItem |
|
|
|
}); |
|
|
|
|
|
|
|
#region 判斷下一站為完工站
|
|
|
|
var NextStopCloseStation = await _pcsApi.CheckNextStopCloseStation(model.WipNO, model.UnitNO, model.Station); |
|
|
|
#endregion
|
|
|
|
if (!KeyPartItem.Contains("$")) |
|
|
|
i += 1; |
|
|
|
} |
|
|
|
|
|
|
|
#region 過站判斷正常 往下處理Table
|
|
|
|
var outfit = new List<BarCodeCheckDto.Outfit>(); |
|
|
|
foreach (var outfitItem in model.MaterialOutfits) |
|
|
|
{ |
|
|
|
outfit.Add(new BarCodeCheckDto.Outfit |
|
|
|
{ |
|
|
|
inputData = outfitItem.Inputs |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
if (model.Barcode) |
|
|
|
{ |
|
|
|
#region 內部序號輸入後新增 or 更新
|
|
|
|
string BarStatusNo = _basApi.GetFactoryUnit(model.UnitNO).InvokeAsync().Result.FirstOrDefault().UnitCode; |
|
|
|
|
|
|
|
// 新增or更新 BarCode_Info
|
|
|
|
var barcodeInfos = await _pcsApi.GetBarcodeInfoesByNo(model.Input); |
|
|
|
if (barcodeInfos.Count() != 0) |
|
|
|
{ |
|
|
|
model.BarCodeID = barcodeInfos[0].BarcodeID; |
|
|
|
var x = new BarCodeCheckDto |
|
|
|
{ |
|
|
|
wipNo = model.WipNO, |
|
|
|
barcode = model.Input, |
|
|
|
barcodeType = "M", |
|
|
|
station = model.Station, |
|
|
|
line = model.LineID, |
|
|
|
unitNo = model.UnitNO, |
|
|
|
inputItems = keyParts, |
|
|
|
outfits = outfit |
|
|
|
}; |
|
|
|
|
|
|
|
barcodeInfos[0].StatusNo = BarStatusNo; |
|
|
|
barcodeInfos[0].ExtraBarcodeNo = ExtNo; |
|
|
|
barcodeInfos[0].RuleStationID = model.RuleStation; |
|
|
|
barcodeInfos[0].RuleStatus = !model.BarcodeNG ? "P" : "F"; //F 不良
|
|
|
|
barcodeInfos[0].WipID = model.WipID; |
|
|
|
barcodeInfos[0].StatusID = NextStopCloseStation.Success ? -1 : 1; |
|
|
|
barcodeInfos[0].UpdateDate = DateTime.Now; |
|
|
|
await _pcsApi.PutBarcodeInfoes(JsonConvert.SerializeObject(barcodeInfos[0])); |
|
|
|
var barcode_result = await _pcsApi.PassIngByCheck(JsonConvert.SerializeObject(x)); |
|
|
|
if (!barcode_result.Success) |
|
|
|
return Json(new Result() { success = barcode_result.Success, msg = barcode_result.Msg, data = Data }); |
|
|
|
else |
|
|
|
{ |
|
|
|
Msg = "內部序號【" + Data + "】 過站完成!"; |
|
|
|
Data = string.Empty; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
BarcodeInfo barcodeInfo = new BarcodeInfo |
|
|
|
{ |
|
|
|
BarcodeNo = model.Input, |
|
|
|
StatusNo = BarStatusNo, |
|
|
|
RuleStationID = model.RuleStation, |
|
|
|
RuleStatus = !model.BarcodeNG ? "P" : "F",//F 不良
|
|
|
|
WipID = model.WipID, |
|
|
|
StatusID = NextStopCloseStation.Success ? -1 : 1, |
|
|
|
CreateUserID = 1 |
|
|
|
}; |
|
|
|
var resultBarCodeInfo = await _pcsApi.PostBarcodeInfoes(JsonConvert.SerializeObject(barcodeInfo)); |
|
|
|
if (resultBarCodeInfo.Success) |
|
|
|
model.BarCodeID = (int)resultBarCodeInfo.Data.Select(s => s.BarcodeID).FirstOrDefault(); |
|
|
|
Msg += "內部序號工單號碼與過站工單不相同</br>"; |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
|
|
|
|
// 新增 BarCodeStation
|
|
|
|
BarcodeStation barcodeStation = new BarcodeStation |
|
|
|
{ |
|
|
|
BarcodeID = model.BarCodeID, |
|
|
|
WipID = model.WipID, |
|
|
|
RuleStationID = model.RuleStation, |
|
|
|
RuleStatus = !model.BarcodeNG ? "P" : "F", //F 不良
|
|
|
|
InputDate = DateTime.Now, |
|
|
|
LineId = model.LineID |
|
|
|
}; |
|
|
|
await _pcsApi.PostBarcodeStation(JsonConvert.SerializeObject(barcodeStation)); |
|
|
|
|
|
|
|
// 新增 BarCodeItem
|
|
|
|
// 先查詢已綁定組件數量
|
|
|
|
var BarCodeItems = await _pcsApi.GetBarcodeItemByBarCodeID(model.BarCodeID); |
|
|
|
int KpItemQty = BarCodeItems.Count(); |
|
|
|
|
|
|
|
for (int i = 0; i < Kp.Count(); i++) |
|
|
|
{ |
|
|
|
//
|
|
|
|
if (ExtNo == Kp[i]) |
|
|
|
continue; |
|
|
|
|
|
|
|
var barcodeItem = new BarcodeItem |
|
|
|
{ |
|
|
|
BarcodeID = model.BarCodeID, |
|
|
|
WipID = model.WipID, |
|
|
|
RuleStationID = model.RuleStation, |
|
|
|
ItemNo = model.MaterialKps[i + KpItemQty].KpNo, |
|
|
|
PartNo = Kp[i], |
|
|
|
SysType = "S", |
|
|
|
CreateUserID = 0, |
|
|
|
CreateDate = DateTime.Now, |
|
|
|
UpdateDate = DateTime.Now |
|
|
|
}; |
|
|
|
await _pcsApi.PostBarcodeItem(JsonConvert.SerializeObject(barcodeItem)); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
// 新增 BarCodeWip 投入站新增 for 只有投入站才新增
|
|
|
|
if (model.StationSEQ == 1) |
|
|
|
{ |
|
|
|
BarcodeWip barcodeWip = new BarcodeWip |
|
|
|
{ |
|
|
|
BarcodeID = model.BarCodeID, |
|
|
|
WipID = model.WipID |
|
|
|
}; |
|
|
|
await _pcsApi.PostBarcodeWip(JsonConvert.SerializeObject(barcodeWip)); |
|
|
|
#region 判斷下一站為完工站
|
|
|
|
var NextStopCloseStation = await _pcsApi.CheckNextStopCloseStation(model.WipNO, model.UnitNO, model.Station); |
|
|
|
#endregion
|
|
|
|
|
|
|
|
var wipInfo = await _pcsApi.GetWipInfo(model.WipID); |
|
|
|
wipInfo[0].CompleteQTY += 1; |
|
|
|
await _pcsApi.PutWipInfo(JsonConvert.SerializeObject(wipInfo[0])); |
|
|
|
#region 過站判斷正常 往下處理Table 移到API執行
|
|
|
|
|
|
|
|
} |
|
|
|
//if (model.Barcode)
|
|
|
|
//{
|
|
|
|
// #region 內部序號輸入後新增 or 更新
|
|
|
|
// string BarStatusNo = _basApi.GetFactoryUnit(model.UnitNO).InvokeAsync().Result.FirstOrDefault().UnitCode;
|
|
|
|
|
|
|
|
// 判斷有不良代碼 新增 NgInfo NgComponent
|
|
|
|
if (model.BarcodeNG) |
|
|
|
{ |
|
|
|
foreach (var NGNo in model.Inputs.Where(w => w.Contains("$"))) |
|
|
|
{ |
|
|
|
var FixtureNo = string.Join(",", model.MaterialOutfits.Select(s => s.Inputs).ToArray()); |
|
|
|
NgInfo ngInfo = new NgInfo |
|
|
|
{ |
|
|
|
// // 新增or更新 BarCode_Info
|
|
|
|
// var barcodeInfos = await _pcsApi.GetBarcodeInfoesByNo(model.Input);
|
|
|
|
// if (barcodeInfos.Count() != 0)
|
|
|
|
// {
|
|
|
|
// model.BarCodeID = barcodeInfos[0].BarcodeID;
|
|
|
|
|
|
|
|
// barcodeInfos[0].StatusNo = BarStatusNo;
|
|
|
|
// barcodeInfos[0].ExtraBarcodeNo = ExtNo;
|
|
|
|
// barcodeInfos[0].RuleStationID = model.RuleStation;
|
|
|
|
// barcodeInfos[0].RuleStatus = !model.BarcodeNG ? "P" : "F"; //F 不良
|
|
|
|
// barcodeInfos[0].WipID = model.WipID;
|
|
|
|
// barcodeInfos[0].StatusID = NextStopCloseStation.Success ? -1 : 1;
|
|
|
|
// barcodeInfos[0].UpdateDate = DateTime.Now;
|
|
|
|
// await _pcsApi.PutBarcodeInfoes(JsonConvert.SerializeObject(barcodeInfos[0]));
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// BarcodeInfo barcodeInfo = new BarcodeInfo
|
|
|
|
// {
|
|
|
|
// BarcodeNo = model.Input,
|
|
|
|
// StatusNo = BarStatusNo,
|
|
|
|
// RuleStationID = model.RuleStation,
|
|
|
|
// RuleStatus = !model.BarcodeNG ? "P" : "F",//F 不良
|
|
|
|
// WipID = model.WipID,
|
|
|
|
// StatusID = NextStopCloseStation.Success ? -1 : 1,
|
|
|
|
// CreateUserID = 1
|
|
|
|
// };
|
|
|
|
// var resultBarCodeInfo = await _pcsApi.PostBarcodeInfoes(JsonConvert.SerializeObject(barcodeInfo));
|
|
|
|
// if (resultBarCodeInfo.Success)
|
|
|
|
// model.BarCodeID = (int)resultBarCodeInfo.Data.Select(s => s.BarcodeID).FirstOrDefault();
|
|
|
|
// }
|
|
|
|
|
|
|
|
TypeNo = model.StationTestType, |
|
|
|
OperatorID = 0, |
|
|
|
FixtureNo = string.IsNullOrWhiteSpace(FixtureNo) ? "-1" : FixtureNo, |
|
|
|
BarcodeID = model.BarCodeID, |
|
|
|
ReasonNo = NGNo, |
|
|
|
ProgramNo = "N/A", |
|
|
|
MachineNo = "N/A", |
|
|
|
StationId = model.Station, |
|
|
|
WipId = model.WipID |
|
|
|
}; |
|
|
|
var resultNgInfo = await _pcsApi.PostNgInfo(JsonConvert.SerializeObject(ngInfo)); |
|
|
|
if (resultNgInfo.Success) |
|
|
|
{ |
|
|
|
NgComponent ngComponent = new NgComponent |
|
|
|
{ |
|
|
|
NgID = resultNgInfo.Data.FirstOrDefault().NgID, |
|
|
|
LocationNo = "N/A", |
|
|
|
NgNo = NGNo |
|
|
|
}; |
|
|
|
await _pcsApi.PostNgComponent(JsonConvert.SerializeObject(ngComponent)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// // 新增 BarCodeStation
|
|
|
|
// BarcodeStation barcodeStation = new BarcodeStation
|
|
|
|
// {
|
|
|
|
// BarcodeID = model.BarCodeID,
|
|
|
|
// WipID = model.WipID,
|
|
|
|
// RuleStationID = model.RuleStation,
|
|
|
|
// RuleStatus = !model.BarcodeNG ? "P" : "F", //F 不良
|
|
|
|
// InputDate = DateTime.Now,
|
|
|
|
// LineId = model.LineID
|
|
|
|
// };
|
|
|
|
// await _pcsApi.PostBarcodeStation(JsonConvert.SerializeObject(barcodeStation));
|
|
|
|
|
|
|
|
// // 新增 BarCodeItem
|
|
|
|
// // 先查詢已綁定組件數量
|
|
|
|
// var BarCodeItems = await _pcsApi.GetBarcodeItemByBarCodeID(model.BarCodeID);
|
|
|
|
// int KpItemQty = BarCodeItems.Count();
|
|
|
|
|
|
|
|
// for (int i = 0; i < Kp.Count(); i++)
|
|
|
|
// {
|
|
|
|
// //
|
|
|
|
// if (ExtNo == Kp[i])
|
|
|
|
// continue;
|
|
|
|
|
|
|
|
// var barcodeItem = new BarcodeItem
|
|
|
|
// {
|
|
|
|
// BarcodeID = model.BarCodeID,
|
|
|
|
// WipID = model.WipID,
|
|
|
|
// RuleStationID = model.RuleStation,
|
|
|
|
// ItemNo = model.MaterialKps[i + KpItemQty].KpNo,
|
|
|
|
// PartNo = Kp[i],
|
|
|
|
// SysType = "S",
|
|
|
|
// CreateUserID = 0,
|
|
|
|
// CreateDate = DateTime.Now,
|
|
|
|
// UpdateDate = DateTime.Now
|
|
|
|
// };
|
|
|
|
// await _pcsApi.PostBarcodeItem(JsonConvert.SerializeObject(barcodeItem));
|
|
|
|
// }
|
|
|
|
// #endregion
|
|
|
|
|
|
|
|
#region 當生產單位為SMT或DIP時,確認是否有綁Group,有綁連片一起過站
|
|
|
|
List<int> GroupBarCodeID = new List<int>(); |
|
|
|
if (model.UnitNO == "S" || model.UnitNO == "D") |
|
|
|
{ |
|
|
|
var GroupID = await _pcsApi.GetBarcodeGroupByBarCodeID(model.BarCodeID); |
|
|
|
if (GroupID.Count != 0) |
|
|
|
{ |
|
|
|
var BarCodeGroup = await _pcsApi.GetBarcodeGroupByGroupID(GroupID.FirstOrDefault().GroupID); |
|
|
|
GroupBarCodeID = BarCodeGroup.Where(w => w.BarcodeID != model.BarCodeID).Select(s => s.BarcodeID).ToList(); |
|
|
|
} |
|
|
|
// // 新增 BarCodeWip 投入站新增 for 只有投入站才新增
|
|
|
|
// if (model.StationSEQ == 1)
|
|
|
|
// {
|
|
|
|
// BarcodeWip barcodeWip = new BarcodeWip
|
|
|
|
// {
|
|
|
|
// BarcodeID = model.BarCodeID,
|
|
|
|
// WipID = model.WipID
|
|
|
|
// };
|
|
|
|
// await _pcsApi.PostBarcodeWip(JsonConvert.SerializeObject(barcodeWip));
|
|
|
|
|
|
|
|
foreach (int id in GroupBarCodeID) |
|
|
|
{ |
|
|
|
// 更新 BarCode_Info
|
|
|
|
var barcodeGroupID = await _pcsApi.GetBarcodeInfoes(id); |
|
|
|
if (barcodeGroupID.Count() != 0) |
|
|
|
{ |
|
|
|
barcodeGroupID[0].StatusNo = BarStatusNo; |
|
|
|
barcodeGroupID[0].RuleStationID = model.RuleStation; |
|
|
|
barcodeGroupID[0].RuleStatus = !model.BarcodeNG ? "P" : "F"; //F 不良
|
|
|
|
barcodeGroupID[0].WipID = model.WipID; |
|
|
|
barcodeGroupID[0].StatusID = NextStopCloseStation.Success ? -1 : 1; |
|
|
|
barcodeGroupID[0].UpdateDate = DateTime.Now; |
|
|
|
await _pcsApi.PutBarcodeInfoes(JsonConvert.SerializeObject(barcodeGroupID[0])); |
|
|
|
} |
|
|
|
// 新增 BarCodeStation
|
|
|
|
barcodeStation.BarcodeID = id; |
|
|
|
await _pcsApi.PostBarcodeStation(JsonConvert.SerializeObject(barcodeStation)); |
|
|
|
// 新增 BarCodeItem
|
|
|
|
for (int i = 0; i < model.Inputs.Where(w => !w.StartsWith("$")).Count(); i++) |
|
|
|
{ |
|
|
|
var barcodeItem = new BarcodeItem |
|
|
|
{ |
|
|
|
BarcodeID = id, |
|
|
|
WipID = model.WipID, |
|
|
|
RuleStationID = model.RuleStation, |
|
|
|
ItemNo = model.MaterialKps[i].KpNo, |
|
|
|
PartNo = Kp[i], |
|
|
|
SysType = "S", |
|
|
|
CreateUserID = 0, |
|
|
|
CreateDate = DateTime.Now, |
|
|
|
UpdateDate = DateTime.Now |
|
|
|
}; |
|
|
|
await _pcsApi.PostBarcodeItem(JsonConvert.SerializeObject(barcodeItem)); |
|
|
|
} |
|
|
|
// 新增 BarCodeWip 投入站新增 for 只有投入站才新增
|
|
|
|
if (model.StationSEQ == 1) |
|
|
|
{ |
|
|
|
BarcodeWip barcodeWip = new BarcodeWip |
|
|
|
{ |
|
|
|
BarcodeID = id, |
|
|
|
WipID = model.WipID |
|
|
|
}; |
|
|
|
await _pcsApi.PostBarcodeWip(JsonConvert.SerializeObject(barcodeWip)); |
|
|
|
// var wipInfo = await _pcsApi.GetWipInfo(model.WipID);
|
|
|
|
// wipInfo[0].CompleteQTY += 1;
|
|
|
|
// await _pcsApi.PutWipInfo(JsonConvert.SerializeObject(wipInfo[0]));
|
|
|
|
|
|
|
|
var wipInfo = await _pcsApi.GetWipInfo(model.WipID); |
|
|
|
wipInfo[0].CompleteQTY += 1; |
|
|
|
await _pcsApi.PutWipInfo(JsonConvert.SerializeObject(wipInfo[0])); |
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|
// // 判斷有不良代碼 新增 NgInfo NgComponent
|
|
|
|
// if (model.BarcodeNG)
|
|
|
|
// {
|
|
|
|
// foreach (var NGNo in model.Inputs.Where(w => w.Contains("$")))
|
|
|
|
// {
|
|
|
|
// var FixtureNo = string.Join(",", model.MaterialOutfits.Select(s => s.Inputs).ToArray());
|
|
|
|
// NgInfo ngInfo = new NgInfo
|
|
|
|
// {
|
|
|
|
|
|
|
|
// TypeNo = model.StationTestType,
|
|
|
|
// OperatorID = 0,
|
|
|
|
// FixtureNo = string.IsNullOrWhiteSpace(FixtureNo) ? "-1" : FixtureNo,
|
|
|
|
// BarcodeID = model.BarCodeID,
|
|
|
|
// ReasonNo = NGNo,
|
|
|
|
// ProgramNo = "N/A",
|
|
|
|
// MachineNo = "N/A",
|
|
|
|
// StationId = model.Station,
|
|
|
|
// WipId = model.WipID
|
|
|
|
// };
|
|
|
|
// var resultNgInfo = await _pcsApi.PostNgInfo(JsonConvert.SerializeObject(ngInfo));
|
|
|
|
// if (resultNgInfo.Success)
|
|
|
|
// {
|
|
|
|
// NgComponent ngComponent = new NgComponent
|
|
|
|
// {
|
|
|
|
// NgID = resultNgInfo.Data.FirstOrDefault().NgID,
|
|
|
|
// LocationNo = "N/A",
|
|
|
|
// NgNo = NGNo
|
|
|
|
// };
|
|
|
|
// await _pcsApi.PostNgComponent(JsonConvert.SerializeObject(ngComponent));
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// 新增 NgInfo 不良時新增 判斷有不良代碼
|
|
|
|
if (model.BarcodeNG) |
|
|
|
{ |
|
|
|
foreach (var NGNo in model.Inputs.Where(w => w.Contains("$"))) |
|
|
|
{ |
|
|
|
var FixtureNo = string.Join(",", model.MaterialOutfits.Select(s => s.Inputs).ToArray()); |
|
|
|
NgInfo ngInfo = new NgInfo |
|
|
|
{ |
|
|
|
|
|
|
|
TypeNo = model.StationTestType, |
|
|
|
OperatorID = 0, |
|
|
|
FixtureNo = string.IsNullOrWhiteSpace(FixtureNo) ? "-1" : FixtureNo, |
|
|
|
BarcodeID = model.BarCodeID, |
|
|
|
ReasonNo = NGNo, |
|
|
|
ProgramNo = "N/A", |
|
|
|
MachineNo = "N/A", |
|
|
|
StationId = model.Station, |
|
|
|
WipId = model.WipID |
|
|
|
}; |
|
|
|
var resultNgInfo = await _pcsApi.PostNgInfo(JsonConvert.SerializeObject(ngInfo)); |
|
|
|
if (resultNgInfo.Success) |
|
|
|
{ |
|
|
|
NgComponent ngComponent = new NgComponent |
|
|
|
{ |
|
|
|
NgID = resultNgInfo.Data.FirstOrDefault().NgID, |
|
|
|
LocationNo = "N/A", |
|
|
|
NgNo = NGNo |
|
|
|
}; |
|
|
|
await _pcsApi.PostNgComponent(JsonConvert.SerializeObject(ngComponent)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
// #region 當生產單位為SMT或DIP時,確認是否有綁Group,有綁連片一起過站
|
|
|
|
// List<int> GroupBarCodeID = new List<int>();
|
|
|
|
// if (model.UnitNO == "S" || model.UnitNO == "D")
|
|
|
|
// {
|
|
|
|
// var GroupID = await _pcsApi.GetBarcodeGroupByBarCodeID(model.BarCodeID);
|
|
|
|
// if (GroupID.Count != 0)
|
|
|
|
// {
|
|
|
|
// var BarCodeGroup = await _pcsApi.GetBarcodeGroupByGroupID(GroupID.FirstOrDefault().GroupID);
|
|
|
|
// GroupBarCodeID = BarCodeGroup.Where(w => w.BarcodeID != model.BarCodeID).Select(s => s.BarcodeID).ToList();
|
|
|
|
// }
|
|
|
|
|
|
|
|
// foreach (int id in GroupBarCodeID)
|
|
|
|
// {
|
|
|
|
// // 更新 BarCode_Info
|
|
|
|
// var barcodeGroupID = await _pcsApi.GetBarcodeInfoes(id);
|
|
|
|
// if (barcodeGroupID.Count() != 0)
|
|
|
|
// {
|
|
|
|
// barcodeGroupID[0].StatusNo = BarStatusNo;
|
|
|
|
// barcodeGroupID[0].RuleStationID = model.RuleStation;
|
|
|
|
// barcodeGroupID[0].RuleStatus = !model.BarcodeNG ? "P" : "F"; //F 不良
|
|
|
|
// barcodeGroupID[0].WipID = model.WipID;
|
|
|
|
// barcodeGroupID[0].StatusID = NextStopCloseStation.Success ? -1 : 1;
|
|
|
|
// barcodeGroupID[0].UpdateDate = DateTime.Now;
|
|
|
|
// await _pcsApi.PutBarcodeInfoes(JsonConvert.SerializeObject(barcodeGroupID[0]));
|
|
|
|
// }
|
|
|
|
// // 新增 BarCodeStation
|
|
|
|
// barcodeStation.BarcodeID = id;
|
|
|
|
// await _pcsApi.PostBarcodeStation(JsonConvert.SerializeObject(barcodeStation));
|
|
|
|
// // 新增 BarCodeItem
|
|
|
|
// for (int i = 0; i < model.Inputs.Where(w => !w.StartsWith("$")).Count(); i++)
|
|
|
|
// {
|
|
|
|
// var barcodeItem = new BarcodeItem
|
|
|
|
// {
|
|
|
|
// BarcodeID = id,
|
|
|
|
// WipID = model.WipID,
|
|
|
|
// RuleStationID = model.RuleStation,
|
|
|
|
// ItemNo = model.MaterialKps[i].KpNo,
|
|
|
|
// PartNo = Kp[i],
|
|
|
|
// SysType = "S",
|
|
|
|
// CreateUserID = 0,
|
|
|
|
// CreateDate = DateTime.Now,
|
|
|
|
// UpdateDate = DateTime.Now
|
|
|
|
// };
|
|
|
|
// await _pcsApi.PostBarcodeItem(JsonConvert.SerializeObject(barcodeItem));
|
|
|
|
// }
|
|
|
|
// // 新增 BarCodeWip 投入站新增 for 只有投入站才新增
|
|
|
|
// if (model.StationSEQ == 1)
|
|
|
|
// {
|
|
|
|
// BarcodeWip barcodeWip = new BarcodeWip
|
|
|
|
// {
|
|
|
|
// BarcodeID = id,
|
|
|
|
// WipID = model.WipID
|
|
|
|
// };
|
|
|
|
// await _pcsApi.PostBarcodeWip(JsonConvert.SerializeObject(barcodeWip));
|
|
|
|
|
|
|
|
// var wipInfo = await _pcsApi.GetWipInfo(model.WipID);
|
|
|
|
// wipInfo[0].CompleteQTY += 1;
|
|
|
|
// await _pcsApi.PutWipInfo(JsonConvert.SerializeObject(wipInfo[0]));
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// // 新增 NgInfo 不良時新增 判斷有不良代碼
|
|
|
|
// if (model.BarcodeNG)
|
|
|
|
// {
|
|
|
|
// foreach (var NGNo in model.Inputs.Where(w => w.Contains("$")))
|
|
|
|
// {
|
|
|
|
// var FixtureNo = string.Join(",", model.MaterialOutfits.Select(s => s.Inputs).ToArray());
|
|
|
|
// NgInfo ngInfo = new NgInfo
|
|
|
|
// {
|
|
|
|
|
|
|
|
// TypeNo = model.StationTestType,
|
|
|
|
// OperatorID = 0,
|
|
|
|
// FixtureNo = string.IsNullOrWhiteSpace(FixtureNo) ? "-1" : FixtureNo,
|
|
|
|
// BarcodeID = model.BarCodeID,
|
|
|
|
// ReasonNo = NGNo,
|
|
|
|
// ProgramNo = "N/A",
|
|
|
|
// MachineNo = "N/A",
|
|
|
|
// StationId = model.Station,
|
|
|
|
// WipId = model.WipID
|
|
|
|
// };
|
|
|
|
// var resultNgInfo = await _pcsApi.PostNgInfo(JsonConvert.SerializeObject(ngInfo));
|
|
|
|
// if (resultNgInfo.Success)
|
|
|
|
// {
|
|
|
|
// NgComponent ngComponent = new NgComponent
|
|
|
|
// {
|
|
|
|
// NgID = resultNgInfo.Data.FirstOrDefault().NgID,
|
|
|
|
// LocationNo = "N/A",
|
|
|
|
// NgNo = NGNo
|
|
|
|
// };
|
|
|
|
// await _pcsApi.PostNgComponent(JsonConvert.SerializeObject(ngComponent));
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// #endregion
|
|
|
|
|
|
|
|
Msg = "內部序號【" + Data + "】 過站完成!"; |
|
|
|
Data = string.Empty; |
|
|
|
// Msg = "內部序號【" + Data + "】 過站完成!";
|
|
|
|
// Data = string.Empty;
|
|
|
|
|
|
|
|
} |
|
|
|
//}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
if (NextStopCloseStation.Success) |
|
|
@ -2504,7 +2554,7 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
// 確認完工數是否等於工單數
|
|
|
|
await _pcsApi.CheckWipNoBarCodeAllClost(model.WipNO, model.UnitNO, model.RuleStation); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return Json(new Result() { success = Success, msg = Msg, data = Data }); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|