|
|
@ -23,6 +23,7 @@ using AMESCoreStudio.WebApi.Enum; |
|
|
|
using Microsoft.Extensions.Localization; |
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
using ClosedXML.Excel; |
|
|
|
using Microsoft.VisualBasic; |
|
|
|
|
|
|
|
namespace AMESCoreStudio.Web.Controllers |
|
|
|
{ |
|
|
@ -141,13 +142,13 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(Msg)) |
|
|
|
Msg = "必填欄位未填寫:" + Msg.Substring(0, (Msg.Length - 1)); |
|
|
|
Msg = "必填欄位未填寫:(" + Msg.Substring(0, (Msg.Length - 1)) + " )"; |
|
|
|
|
|
|
|
return Msg; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 工單工程 保存判斷
|
|
|
|
/// 工單工程 儲存判斷
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="model"></param>
|
|
|
|
/// <returns></returns>
|
|
|
@ -265,8 +266,6 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 下拉選單
|
|
|
|
/// <summary>
|
|
|
|
/// 產品別
|
|
|
@ -1455,6 +1454,38 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
var result = await _pcsApi.DeleteWipBarcodeOther(wipNo.Trim().ToUpper()); |
|
|
|
return Json(new Result() { success = result.Success, msg = result.Msg, data = null }); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 確認是否PLM有新的 ECN/ECR
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="ItemNo">工單料號</param>
|
|
|
|
/// <param name="OldEcnEcr">目前ECN ECR</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public async Task<IActionResult> CheckUpdateEcnOrEcr(string ItemNo, string OldEcnEcr) |
|
|
|
{ |
|
|
|
IResultModel<string> result; |
|
|
|
result = await _fqcApi.GetPLMEcn(ItemNo); |
|
|
|
if (result.Success) |
|
|
|
{ |
|
|
|
// 如果舊的ECN/ECR 跟新的
|
|
|
|
//if (OldEcnEcr.Trim().ToUpper() == result.Msg.Trim().ToUpper())
|
|
|
|
//result.Msg = "";
|
|
|
|
} |
|
|
|
return Json(new Result() { success = result.Success, msg = result.Msg, data = null }); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 刪除工單檔案
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="wipNo">工單號碼</param>
|
|
|
|
/// <param name="fileName">檔案名稱</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost] |
|
|
|
public async Task<JsonResult> DeleteWipInfoBlob(string wipNo, string fileName) |
|
|
|
{ |
|
|
|
var result = await _pcsApi.DeleteWipInfoBlobByFileName(wipNo, fileName); |
|
|
|
return Json(new Result() { success = result.Success, msg = result.Msg, data = null }); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
///// <summary>
|
|
|
@ -1632,7 +1663,7 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
TempData["request"] = JsonConvert.SerializeObject(model); |
|
|
|
return Redirect("PCS001N"); |
|
|
|
} |
|
|
|
// 保存
|
|
|
|
// 儲存
|
|
|
|
await WipDataSelectAll(model.wipInfo.WipNO, model.wipAtt.ItemNO, model.wipInfo.UnitNO); |
|
|
|
IResultModel result; |
|
|
|
int UserID = GetLogInUserID(); |
|
|
@ -1652,10 +1683,18 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
// 判斷是否有開重複工單+生產單位
|
|
|
|
var wipInfoQuery = await _pcsApi.GetWipInfoByWipNO(model.wipInfo.WipNO); |
|
|
|
if (wipInfoQuery.Any()) |
|
|
|
{ // 判斷工單號碼 在工單基本資料檔只能有一筆(不判斷是否不同製程)
|
|
|
|
ViewBag.MoidByOnlyOne = _configuration["MoidByOnlyOne"]; |
|
|
|
if (ViewBag.MoidByOnlyOne == "Y") |
|
|
|
{ |
|
|
|
if (wipInfoQuery.Where(w => w.UnitNO == model.wipInfo.UnitNO).Count() != 0) |
|
|
|
if (wipInfoQuery.Count() != 0) |
|
|
|
{ |
|
|
|
Msg += " 同樣生產單位已建立相同工單了 "; |
|
|
|
Msg += $",工單號碼【{model.wipInfo.WipNO}】已重複建立"; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (wipInfoQuery.Where(w => w.UnitNO == model.wipInfo.UnitNO).Count() != 0) |
|
|
|
{ |
|
|
|
Msg += ",同樣生產單位已建立相同工單了"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1693,8 +1732,11 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
model.wipInfo.CustomerMedical = model.wipInfo.CustomerMedical == "Y" ? "true" : "false"; |
|
|
|
model.wipInfo.CustomerVIP = model.wipInfo.CustomerVIP == "Y" ? "true" : "false"; |
|
|
|
model.wipInfo.SFISFlowCk = model.wipInfo.SFISFlowCk == "Y" ? "true" : "false"; |
|
|
|
ModelState.AddModelError("error", Msg); |
|
|
|
|
|
|
|
if (Msg.StartsWith(",")) |
|
|
|
Msg = Msg.Substring(1, Msg.Length - 1); |
|
|
|
|
|
|
|
ModelState.AddModelError("error", Msg); |
|
|
|
return View("PCS001N", model); |
|
|
|
} |
|
|
|
|
|
|
@ -2578,8 +2620,6 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
wipDataViewModel.wipBarcodeOther = model.wipBarcodeOther; |
|
|
|
var Msg = CheckWipInfoInsert(wipDataViewModel); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 判斷是否有開重複工單+生產單位
|
|
|
|
var wipInfoQuery = await _pcsApi.GetWipInfoByWipNO(model.wipInfo.WipNO); |
|
|
|
if (wipInfoQuery.Any()) |
|
|
@ -2614,13 +2654,6 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
Msg += ",SOP文件 請填寫SOP文件敘述 "; |
|
|
|
} |
|
|
|
|
|
|
|
//// 判斷MAC是否正確
|
|
|
|
//var CheckMACMsg = CheckMACData(model);
|
|
|
|
//if (!string.IsNullOrWhiteSpace(CheckMACMsg))
|
|
|
|
//{
|
|
|
|
// Msg += "," + CheckMACMsg;
|
|
|
|
//}
|
|
|
|
|
|
|
|
// 判斷標籤 工單性質選擇 WipAttr非標96工單時,則旁邊欄位必填
|
|
|
|
if (model.wipLabel.WipAttr == "B" && string.IsNullOrWhiteSpace(model.wipLabel.NonstandardWoMemo)) |
|
|
|
{ |
|
|
@ -3146,7 +3179,7 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
} |
|
|
|
// KP料號正確
|
|
|
|
var kpNameArray = model.WipKps.Select(s => s.KpName).Distinct().ToList(); |
|
|
|
foreach(var item in kpNameArray) |
|
|
|
foreach (var item in kpNameArray) |
|
|
|
{ |
|
|
|
if (_pcsApi.GetPlmMeterialInfo(item.Trim().ToUpper()).InvokeAsync().Result.Count == 0) |
|
|
|
{ |
|
|
@ -8302,6 +8335,23 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
} |
|
|
|
foreach (var item in model.WipSops.Where(w => w.WipSOPID != -1)) |
|
|
|
{ |
|
|
|
// 判斷是否有紀錄Sop版本,沒有需要建立第一版
|
|
|
|
if (item.SOPType == "A") |
|
|
|
{ |
|
|
|
var SopVer = await _pcsApi.GetWipSopForSopVer(model.wipInfo.WipNO, model.wipAtt.ItemNO, item.SOPName); |
|
|
|
if (SopVer.Success) |
|
|
|
{ |
|
|
|
if (SopVer.Msg == "N") |
|
|
|
{ |
|
|
|
var GetSopVer = await _pcsApi.GetDocEsopViewByNo(item.SOPName); |
|
|
|
if (GetSopVer.Count != 0) |
|
|
|
{ |
|
|
|
item.SOPVer = GetSopVer.FirstOrDefault().document_version; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
item.WipNo = model.wipInfo.WipNO; |
|
|
|
item.ItemNo = model.wipAtt.ItemNO; |
|
|
|
item.CreateUserID = UserID; |
|
|
|