|
|
@ -87,6 +87,9 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
if (string.IsNullOrWhiteSpace(model.wipInfo.UnitNO)) |
|
|
|
Msg += model.wipInfo.GetAttributeFrom<DisplayAttribute>(nameof(model.wipInfo.UnitNO)).Name + ","; |
|
|
|
|
|
|
|
if (model.wipInfo.FlowRuleID == 0) |
|
|
|
Msg += model.wipInfo.GetAttributeFrom<DisplayAttribute>(nameof(model.wipInfo.FlowRuleID)).Name + ","; |
|
|
|
|
|
|
|
if (model.wipInfo.WipDueDate == DateTime.MinValue) |
|
|
|
Msg += model.wipInfo.GetAttributeFrom<DisplayAttribute>(nameof(model.wipInfo.WipDueDate)).Name + ","; |
|
|
|
|
|
|
@ -2613,39 +2616,40 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
wipDataViewModel.wipBarcodeOther = model.wipBarcodeOther; |
|
|
|
var Msg = CheckWipInfoInsert(wipDataViewModel); |
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(Msg)) |
|
|
|
// 判斷是否有開重複工單+生產單位
|
|
|
|
var wipInfoQuery = await _pcsApi.GetWipInfoByWipNO(model.wipInfo.WipNO); |
|
|
|
if (wipInfoQuery.Any()) |
|
|
|
{ |
|
|
|
ModelState.AddModelError("error", Msg); |
|
|
|
return View("PCS003", model); |
|
|
|
if (wipInfoQuery.Where(w => w.UnitNO == model.wipInfo.UnitNO).Count() == 2) |
|
|
|
{ |
|
|
|
Msg += ",同樣生產單位已建立相同工單了"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 判斷WipKp 順序是否重複
|
|
|
|
if (model.WipKps.Where(w => w.WipKpID != -1).GroupBy(g => g.KpSeq).Where(w => w.Count() > 1).Any()) |
|
|
|
{ |
|
|
|
ModelState.AddModelError("error", "KeyParts 順序有重複"); |
|
|
|
return View("PCS003", model); |
|
|
|
Msg += ",KeyParts 順序有重複 "; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 判斷SOP是否沒填文件名稱
|
|
|
|
if (model.WipSops.Where(w => string.IsNullOrWhiteSpace(w.SOPName)).Any()) |
|
|
|
{ |
|
|
|
ModelState.AddModelError("error", "SOP文件 請填寫SOP文件敘述"); |
|
|
|
return View("PCS003", model); |
|
|
|
Msg += ",SOP文件 請填寫SOP文件敘述 "; |
|
|
|
} |
|
|
|
|
|
|
|
// 判斷MAC是否正確
|
|
|
|
var CheckMACMsg = CheckMACData(model); |
|
|
|
if (!string.IsNullOrWhiteSpace(CheckMACMsg)) |
|
|
|
{ |
|
|
|
ModelState.AddModelError("error", CheckMACMsg); |
|
|
|
return View("PCS003", model); |
|
|
|
Msg += "," + CheckMACMsg; |
|
|
|
} |
|
|
|
|
|
|
|
// 判斷標籤 工單性質選擇 WipAttr非標96工單時,則旁邊欄位必填
|
|
|
|
if (model.wipLabel.WipAttr == "B" && string.IsNullOrWhiteSpace(model.wipLabel.NonstandardWoMemo)) |
|
|
|
{ |
|
|
|
ModelState.AddModelError("error", "標籤:工單性質選擇非標96工單時,需填入資料"); |
|
|
|
return View("PCS003", model); |
|
|
|
Msg += ",標籤:工單性質選擇非標96工單時,需填入資料"; |
|
|
|
} |
|
|
|
|
|
|
|
// 判斷治具中生產單位與作業站吻合
|
|
|
@ -2658,10 +2662,18 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
|
|
|
|
if (!RuleStation.Where(w => Outfits.StationID == w.StationID).Any()) |
|
|
|
{ |
|
|
|
ModelState.AddModelError("error", "治具組合中生產單位與作業站不匹配"); |
|
|
|
return View("PCS003", model); |
|
|
|
Msg += ",治具組合中生產單位與作業站不匹配"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(Msg)) |
|
|
|
{ |
|
|
|
if (Msg.StartsWith(",")) |
|
|
|
Msg = Msg.Substring(1, Msg.Length-1); |
|
|
|
|
|
|
|
ModelState.AddModelError("error", Msg); |
|
|
|
return View("PCS003", model); |
|
|
|
} |
|
|
|
|
|
|
|
// 修改工單數量大於原本數量
|
|
|
|