|
|
@ -26,6 +26,7 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
public class PCSController : Controller |
|
|
|
{ |
|
|
|
private readonly ILogger<PCSController> _logger; |
|
|
|
private readonly ILogger<LoginController> _log; |
|
|
|
public readonly ISYS _sysApi; |
|
|
|
public readonly IPCS _pcsApi; |
|
|
|
public readonly IBAS _basApi; |
|
|
@ -35,10 +36,11 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
public readonly IFileServerProvider _fileServerProvider; |
|
|
|
private readonly IWebHostEnvironment _env; |
|
|
|
|
|
|
|
public PCSController(ILogger<PCSController> logger, ISYS sysApi, IPCS pcsApi, IBAS basApi, IPPS ppsApi, IFQC fqcApi |
|
|
|
public PCSController(ILogger<PCSController> logger, ILogger<LoginController> log, ISYS sysApi, IPCS pcsApi, IBAS basApi, IPPS ppsApi, IFQC fqcApi |
|
|
|
, IFileServerProvider fileServerProvider, IWebHostEnvironment env, IKCS kcsApi) |
|
|
|
{ |
|
|
|
_logger = logger; |
|
|
|
_log = log; |
|
|
|
_sysApi = sysApi; |
|
|
|
_pcsApi = pcsApi; |
|
|
|
_basApi = basApi; |
|
|
@ -1233,8 +1235,8 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
GetCheckboxDIP(); |
|
|
|
GetCheckboxSMD(); |
|
|
|
#endregion
|
|
|
|
|
|
|
|
IResultModel result; |
|
|
|
int UserID = GetLogInUserID(); |
|
|
|
// Checkbox轉換
|
|
|
|
model.wipInfo.ECNCheck = model.wipInfo.ECNCheck == "true" ? "Y" : "N"; |
|
|
|
model.wipInfo.ModelCheck = model.wipInfo.ModelCheck == "true" ? "Y" : "N"; |
|
|
@ -1301,17 +1303,21 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
await _pcsApi.PostMaterialItem(JsonConvert.SerializeObject( |
|
|
|
new MaterialItem |
|
|
|
{ |
|
|
|
ItemNo = model.wipAtt.ItemNO |
|
|
|
ItemNo = model.wipAtt.ItemNO, |
|
|
|
CreateUserID = UserID |
|
|
|
})); |
|
|
|
} |
|
|
|
|
|
|
|
// 工單屬性
|
|
|
|
model.wipAtt.WipNO = model.wipInfo.WipNO; |
|
|
|
model.wipAtt.CreateUserID = UserID; |
|
|
|
await _pcsApi.PostWipAtt(JsonConvert.SerializeObject(model.wipAtt)); |
|
|
|
|
|
|
|
// 標籤
|
|
|
|
model.wipLabel.ApproveLogo = model.wipLabel.ApproveLogos == null ? null : string.Join(',', model.wipLabel.ApproveLogos); |
|
|
|
model.wipLabel.WipNO = model.wipInfo.WipNO; |
|
|
|
model.wipLabel.CreateUserID = UserID; |
|
|
|
model.wipLabel.UpdateUserID = UserID; |
|
|
|
await _pcsApi.PostWipLabel(JsonConvert.SerializeObject(model.wipLabel)); |
|
|
|
|
|
|
|
// 新增工單Log
|
|
|
@ -1319,6 +1325,7 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
wiplog.WipID = wipID; |
|
|
|
wiplog.StatusNO = "N"; |
|
|
|
wiplog.WipDesc = "."; |
|
|
|
wiplog.CreateUserID = UserID; |
|
|
|
await _pcsApi.PostWipLog(JsonConvert.SerializeObject(wiplog)); |
|
|
|
|
|
|
|
// 系統
|
|
|
@ -1330,6 +1337,8 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
{ |
|
|
|
model.wipSystem.ItemNo = model.wipAtt.ItemNO; |
|
|
|
model.wipSystem.WipNo = model.wipInfo.WipNO; |
|
|
|
model.wipSystem.CreateUserID = UserID; |
|
|
|
model.wipSystem.UpdateUserID = UserID; |
|
|
|
await _pcsApi.PostWipSystem(JsonConvert.SerializeObject(model.wipSystem)); |
|
|
|
} |
|
|
|
} |
|
|
@ -1346,6 +1355,8 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
model.wipBoard.SmdSolderMask = model.wipBoard.SmdSolderMasks == null ? null : string.Join(',', model.wipBoard.SmdSolderMasks); |
|
|
|
model.wipBoard.ItemNo = model.wipAtt.ItemNO; |
|
|
|
model.wipBoard.WipNo = model.wipInfo.WipNO; |
|
|
|
model.wipBoard.CreateUserID = UserID; |
|
|
|
model.wipBoard.UpdateUserID = UserID; |
|
|
|
await _pcsApi.PostWipBoard(JsonConvert.SerializeObject(model.wipBoard)); |
|
|
|
} |
|
|
|
} |
|
|
@ -1357,6 +1368,7 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
model.wipBarcode.WipID = wipID; |
|
|
|
model.wipBarcode.WipNO = model.wipInfo.WipNO; |
|
|
|
model.wipBarcode.UnitNO = model.wipInfo.UnitNO; |
|
|
|
model.wipBarcode.CreateUserID = UserID; |
|
|
|
result = await _pcsApi.PostWipBarcode(JsonConvert.SerializeObject(model.wipBarcode)); |
|
|
|
|
|
|
|
// 工單條碼規則設定文件檔
|
|
|
@ -1376,6 +1388,8 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
{ |
|
|
|
model.wipBarcodeOther.WipNO = model.wipInfo.WipNO; |
|
|
|
model.wipBarcodeOther.TypeNO = type_no.TypeNo; |
|
|
|
model.wipBarcodeOther.CreateUserID = UserID; |
|
|
|
model.wipBarcodeOther.UpdateUserID = UserID; |
|
|
|
result = await _pcsApi.PostWipBarcodeOther(JsonConvert.SerializeObject(model.wipBarcodeOther)); |
|
|
|
} |
|
|
|
} |
|
|
@ -1389,6 +1403,7 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
model.wipMAC.WipNO = model.wipInfo.WipNO; |
|
|
|
model.wipMAC.Title = mACInfo.Title; |
|
|
|
model.wipMAC.ClassGroup = mACInfo.ClassGroup; |
|
|
|
model.wipMAC.CreateUserID = UserID; |
|
|
|
result = await _pcsApi.PostWipMAC(JsonConvert.SerializeObject(model.wipMAC)); |
|
|
|
result = await _pcsApi.PutMACInfoByClassGroup(mACInfo.ClassGroup, model.wipMAC.EndNO); |
|
|
|
} |
|
|
@ -1411,7 +1426,9 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
KpNo = item.KpNo, |
|
|
|
KpSeq = item.KpSeq, |
|
|
|
Length = item.Length, |
|
|
|
Title = item.Title |
|
|
|
Title = item.Title, |
|
|
|
CreateUserID = UserID, |
|
|
|
UpdateUserID = UserID |
|
|
|
}; |
|
|
|
await _pcsApi.PostWipKp(JsonConvert.SerializeObject(wipKp)); |
|
|
|
} |
|
|
@ -1426,7 +1443,9 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
ItemNo = model.wipAtt.ItemNO, |
|
|
|
UnitNo = model.wipInfo.UnitNO, |
|
|
|
OutfitNo = item.OutfitNo, |
|
|
|
PartNo = item.StationType |
|
|
|
PartNo = item.StationType, |
|
|
|
CreateUserID = UserID, |
|
|
|
UpdateUserID = UserID |
|
|
|
}; |
|
|
|
await _pcsApi.PostWipOutfit(JsonConvert.SerializeObject(wipOutfit)); |
|
|
|
} |
|
|
@ -1442,7 +1461,9 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
UnitNo = model.wipInfo.UnitNO, |
|
|
|
SOPName = item.SopName, |
|
|
|
SOPPath = item.SopPath, |
|
|
|
SOPType = item.SopType |
|
|
|
SOPType = item.SopType, |
|
|
|
CreateUserID = UserID, |
|
|
|
UpdateUserID = UserID |
|
|
|
}; |
|
|
|
await _pcsApi.PostWipSop(JsonConvert.SerializeObject(wipSop)); |
|
|
|
} |
|
|
@ -4353,6 +4374,21 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
var aa = "string"; |
|
|
|
return View(model); |
|
|
|
} |
|
|
|
|
|
|
|
public int GetLogInUserID() |
|
|
|
{ |
|
|
|
int user_id = 0; |
|
|
|
HttpContext.Request.Cookies.TryGetValue("UserID", out string userID); |
|
|
|
|
|
|
|
if (userID != null) |
|
|
|
{ |
|
|
|
if (int.Parse(userID.ToString()) >= 0) |
|
|
|
{ |
|
|
|
user_id = int.Parse(userID.ToString()); |
|
|
|
} |
|
|
|
} |
|
|
|
return user_id; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|