diff --git a/AMESCoreStudio.Web/Controllers/BASController.cs b/AMESCoreStudio.Web/Controllers/BASController.cs index b3b6510..d1b7b42 100644 --- a/AMESCoreStudio.Web/Controllers/BASController.cs +++ b/AMESCoreStudio.Web/Controllers/BASController.cs @@ -162,7 +162,8 @@ namespace AMESCoreStudio.Web.Controllers ViewBag.FlowRuleList = FlowRuleItems; } - private async Task GetFlowRuleListByUnit(string unit_no) + [HttpPost] + public async Task GetFlowRuleListByUnit(string unit_no) { var result = await _basApi.GetFlowRulesByUnit(unit_no); @@ -172,6 +173,7 @@ namespace AMESCoreStudio.Web.Controllers FlowRuleItems.Add(new SelectListItem(result[i].UnitNo + result[i].FlowRuleName, result[i].FlowRuleID.ToString())); } ViewBag.FlowRuleList = FlowRuleItems; + return Json(new { data = FlowRuleItems }); } private async Task GetStationList() @@ -2014,17 +2016,20 @@ namespace AMESCoreStudio.Web.Controllers public async Task BAS012UAsync(string id) { await GetUnitList(); - await GetFlowRuleList(); + var aStr = id.Split("="); var iID = int.Parse(aStr[0]); ViewBag.item = aStr[1]; var result = await _basApi.GetMaterialFlow(iID); + if (result.Count == 0) { + await GetFlowRuleList(); return View(); } + await GetFlowRuleListByUnit(result[0].UnitNo); return View(result[0]); } @@ -2058,7 +2063,7 @@ namespace AMESCoreStudio.Web.Controllers } else { - if (result.Errors.Count > 0) + if (result.Errors != null && result.Errors.Count > 0) { ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); } diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index f68587b..074ea65 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -102,23 +102,15 @@ namespace AMESCoreStudio.Web.Controllers // 工單新增不用判斷 if (action != "New") { - // 安勤統一執行WIP_SYSTEM - if (ViewBag.WipSpecial == "Y") + // 系統 昶亨 組立:B 測試:T 包裝:O + if (model.wipInfo.UnitNO == "B" || model.wipInfo.UnitNO == "T" || model.wipInfo.UnitNO == "O") { Msg += CheckWipInfoInsert_WipSystem(model.wipSystem); } + // 板卡 else { - // 系統 昶亨 組立:B 測試:T 包裝:O - if (model.wipInfo.UnitNO == "B" || model.wipInfo.UnitNO == "T" || model.wipInfo.UnitNO == "O") - { - Msg += CheckWipInfoInsert_WipSystem(model.wipSystem); - } - // 板卡 - else - { - Msg += CheckWipInfoInsert_WipBoard(model.wipBoard); - } + Msg += CheckWipInfoInsert_WipBoard(model.wipBoard); } } @@ -2071,9 +2063,6 @@ namespace AMESCoreStudio.Web.Controllers public async Task PCS001R(int id) { - // 針對安勤 工單基本資料統一打開工程資訊 - ViewBag.WipSpecial = _configuration["WipSpecial"]; - WipDataViewModel model = new WipDataViewModel(); var q = await _pcsApi.GetWipInfo(id); if (q.Count != 0) @@ -2195,9 +2184,6 @@ namespace AMESCoreStudio.Web.Controllers public async Task PCS003(int id) { - // 針對安勤 工單基本資料統一打開工程資訊 - ViewBag.WipSpecial = _configuration["WipSpecial"]; - WipDataViewModel model = new WipDataViewModel(); var q = await _pcsApi.GetWipInfo(id); if (q.Count != 0) @@ -2353,12 +2339,203 @@ namespace AMESCoreStudio.Web.Controllers return View(model); } + [HttpGet] + public async Task PCS003GetData(int id, string copyWipNo, bool success = false) + { + WipDataViewModel model = new WipDataViewModel(); + var q = await _pcsApi.GetWipInfo(id); + + if (q.Count != 0) + { + // 判斷工單號碼是否已經投入 + if (await _pcsApi.GetWipInfoCheckStart(q.FirstOrDefault().WipNO, q.FirstOrDefault().UnitNO, q.FirstOrDefault().LineID) == "Y") + { + var _msg = _sharedLocalizer["Error_WorkOrder_InProgress", q.FirstOrDefault().WipNO]; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + + // 判斷工單號碼是否已經開線 + if (await _pcsApi.GetWipInfoCheckStartLine(q.FirstOrDefault().WipNO, q.FirstOrDefault().UnitNO, q.FirstOrDefault().LineID) == "Y") + { + var _msg = _sharedLocalizer["Error_WorkOrder_LineStarted", q.FirstOrDefault().WipNO]; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + + // 判斷是否完工 + if (q.Where(w => w.StatusNO == "E").Any()) + { + var _msg = _sharedLocalizer["Error_WorkOrder_Completed", q.FirstOrDefault().WipNO]; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + + // 判斷是否刪除 + if (q.Where(w => w.StatusNO == "C").Any()) + { + var _msg = _sharedLocalizer["Error_WorkOrder_Deleted", q.FirstOrDefault().WipNO]; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + + // 原先工單資料 + model.wipInfo = q.FirstOrDefault(); + model.wipAtt = await _pcsApi.GetWipAtt(model.wipInfo.WipNO); + model.wipBarcodes = await _pcsApi.GetWipBarcode(model.wipInfo.WipNO); + model.wipBarcode = model.wipBarcodes.FirstOrDefault() ?? new WipBarcode(); + model.wipMACs = await _pcsApi.GetWipMAC(model.wipInfo.WipNO); + model.wipLabel = await _pcsApi.GetWipLabel(model.wipInfo.WipNO); + model.wipBarcodeOthers = await _pcsApi.GetWipBarcodeOthers(model.wipInfo.WipNO); + model.WipKps = await _pcsApi.GetWipKpByWipNo(model.wipInfo.WipNO); + model.WipOutfits = await _pcsApi.GetWipOutfitByWipNo(model.wipInfo.WipNO); + model.WipSops = await _pcsApi.GetWipSopByWipNo(model.wipInfo.WipNO); + model.wipInfoBlobs = await _pcsApi.GetWipInfoBlob(model.wipInfo.WipNO); + + #region 複製工單資料 + // 板卡資訊-ALL + model.wipBoard = await _pcsApi.GetWipBoard(copyWipNo); + // 工程資訊-ALL + model.wipSystem = await _pcsApi.GetWipSystem(copyWipNo); + var copyWipAtt = await _pcsApi.GetWipAtt(copyWipNo); + var copyWipBarcode = await _pcsApi.GetWipBarcode(copyWipNo); + var copyWipInfo = await _pcsApi.GetWipInfoByWipNO(copyWipNo); + + // 工單基本資料-工單備註 + if (copyWipInfo.Any()) + { + model.wipInfo.Remarks = copyWipInfo.FirstOrDefault().Remarks; + } + + // 工單屬性-連板數、機種名稱、BOM日期、SMD投產優先 + if (copyWipAtt != null) + { + model.wipAtt.BomDate = copyWipAtt.BomDate; + model.wipAtt.ModelNO = copyWipAtt.ModelNO; + model.wipAtt.Boards = copyWipAtt.Boards; + model.wipAtt.Side = copyWipAtt.Side; + } + + // 生產條碼-條碼備註 + if (copyWipBarcode.Any()) + { + model.wipBarcode.Remarks = copyWipBarcode.FirstOrDefault().Remarks; + } + + #endregion + + if (model.wipBoard != null) + { + if (!string.IsNullOrWhiteSpace(model.wipBoard.Engineer)) + { + var UserInof = _sysApi.GetUserInfoByUserNo(model.wipBoard.Engineer).InvokeAsync().Result; + if (UserInof != null) + model.wipBoard.Engineer_Name = UserInof.UserName; + } + // 判斷是否是零件烘烤-其他溫度 + var PartsBake = model.wipBoard.PartsBake; + if (PartsBake != 125 && PartsBake != 100 && PartsBake != 80 && PartsBake != 60 && PartsBake != 45 && PartsBake != 0) + model.wipBoard.PartsBakeOther = PartsBake; + } + + if (model.wipSystem != null) + { + if (!string.IsNullOrWhiteSpace(model.wipSystem.Ec)) + { + var Ec_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Ec).InvokeAsync().Result; + model.wipSystem.Ec_Desc = Ec_Desc.Count == 0 ? "" : Ec_Desc.FirstOrDefault().MeterialDesc; + } + + if (!string.IsNullOrWhiteSpace(model.wipSystem.Fw)) + { + var Fw_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Fw).InvokeAsync().Result; + model.wipSystem.Fw_Desc = Fw_Desc.Count == 0 ? "" : Fw_Desc.FirstOrDefault().MeterialDesc; + } + + if (!string.IsNullOrWhiteSpace(model.wipSystem.Fw1)) + { + var Fw1_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Fw1).InvokeAsync().Result; + model.wipSystem.Fw1_Desc = Fw1_Desc.Count == 0 ? "" : Fw1_Desc.FirstOrDefault().MeterialDesc; + } + + if (!string.IsNullOrWhiteSpace(model.wipSystem.Fw2)) + { + var Fw2_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Fw2).InvokeAsync().Result; + model.wipSystem.Fw2_Desc = Fw2_Desc.Count == 0 ? "" : Fw2_Desc.FirstOrDefault().MeterialDesc; + } + + if (!string.IsNullOrWhiteSpace(model.wipSystem.Bios)) + { + var Bios_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.Bios).InvokeAsync().Result; + model.wipSystem.Bios_Desc = Bios_Desc.Count == 0 ? "" : Bios_Desc.FirstOrDefault().MeterialDesc; + } + + if (!string.IsNullOrWhiteSpace(model.wipSystem.OsVer)) + { + var Os_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.OsVer).InvokeAsync().Result; + model.wipSystem.OsVer_Desc = Os_Desc.Count == 0 ? "" : Os_Desc.FirstOrDefault().MeterialDesc; + } + + if (!string.IsNullOrWhiteSpace(model.wipSystem.PowerMode)) + { + var PowerMode_Desc = _pcsApi.GetPlmMeterialInfo(model.wipSystem.PowerMode).InvokeAsync().Result; + model.wipSystem.PowerMode_Desc = PowerMode_Desc.Count == 0 ? "" : PowerMode_Desc.FirstOrDefault().ProductionMemo; + } + + if (!string.IsNullOrWhiteSpace(model.wipSystem.Engineer)) + { + var UserInof = _sysApi.GetUserInfoByUserNo(model.wipSystem.Engineer).InvokeAsync().Result; + if (UserInof != null) + model.wipSystem.Engineer_Name = UserInof.UserName; + } + } + + // 取料號對應工時 + var standardWorkTimes = await _pcsApi.GetStandardWorkTimeByItemNo(model.wipAtt.ItemNO); + + if (standardWorkTimes.Count != 0) + model.itemNoCT1 = standardWorkTimes.Sum(m => m.TotalCT).ToString(); + + // 確認是否已通知 + var wipCheck = await _pcsApi.GetWipCheck(model.wipInfo.WipNO); + if (wipCheck == null) + { + model.wipCheck = "N"; + } + else if (wipCheck.PEUserID != null) + { + model.wipCheck = "Y"; + } + + } + + await WipDataSelectAll(model.wipAtt.WipNO, model.wipAtt.ItemNO, model.wipInfo.UnitNO); + + GetCheckboxApproveLogo(model.wipLabel != null ? model.wipLabel.ApproveLogo : null); + GetCheckboxCompanyLogo(model.wipLabel != null ? model.wipLabel.CompanyLogo : null); + GetCheckboxPrintMode(model.wipLabel != null ? model.wipLabel.PrintMode : null); + GetCheckboxWipAttr(model.wipLabel != null ? model.wipLabel.WipAttr : null); + GetCheckboxDIP(model.wipBoard != null ? model.wipBoard.DipSide : ""); + GetCheckboxSMD(model.wipBoard != null ? model.wipBoard.Smd : ""); + GetCheckboxSMDSolderMa(model.wipBoard != null ? model.wipBoard.SmdSolderMask : ""); + return View("PCS003", model); + } + [HttpPost] - public async Task PCS003Async(WipDataViewModel model, string action, IFormFile formFile) + public async Task CheckWipNoData(string wipNo) { - // 針對安勤 工單基本資料統一打開工程資訊 不判斷製程 - ViewBag.WipSpecial = _configuration["WipSpecial"]; + try + { + // 檢查是否有資料 + var hasData = await _pcsApi.GetWipInfoByWipNO(wipNo.Trim().ToUpper()); + return Json(hasData); + } + catch (Exception ex) + { + return Json(new List()); + } + } + + [HttpPost] + public async Task PCS003Async(WipDataViewModel model, string action, IFormFile formFile) + { try { // 登入UserID @@ -2575,9 +2752,6 @@ namespace AMESCoreStudio.Web.Controllers #region PCS034 工單投產可修改 public async Task PCS034(int id) { - // 針對安勤 工單基本資料統一打開工程資訊 - ViewBag.WipSpecial = _configuration["WipSpecial"]; - WipDataViewModel model = new WipDataViewModel(); var q = await _pcsApi.GetWipInfo(id); if (q.Count != 0) @@ -2705,9 +2879,6 @@ namespace AMESCoreStudio.Web.Controllers [HttpPost] public async Task PCS034Async(WipDataViewModel model, string action, IFormFile formFile) { - // 針對安勤 工單基本資料統一打開工程資訊 不判斷製程 - ViewBag.WipSpecial = _configuration["WipSpecial"]; - try { // 登入UserID @@ -7944,8 +8115,8 @@ namespace AMESCoreStudio.Web.Controllers Msg += result.Msg; } - // 安勤統一執行WipSystem - if (ViewBag.WipSpecial == "Y") + // 系統WipSystem + if (model.wipInfo.UnitNO == "B" || model.wipInfo.UnitNO == "O" || model.wipInfo.UnitNO == "T") { // 測試備註空白 帶工單描述 if (string.IsNullOrWhiteSpace(model.wipSystem.TestMemo)) @@ -7964,46 +8135,24 @@ namespace AMESCoreStudio.Web.Controllers } } else + // 板卡 WipBoard { - // 系統WipSystem - if (model.wipInfo.UnitNO == "B" || model.wipInfo.UnitNO == "O" || model.wipInfo.UnitNO == "T") - { - // 測試備註空白 帶工單描述 - if (string.IsNullOrWhiteSpace(model.wipSystem.TestMemo)) - { - model.wipSystem.TestMemo = model.wipInfo.Description; - } + model.wipBoard.Smd = model.wipBoard.SMDs == null ? null : string.Join(',', model.wipBoard.SMDs); + model.wipBoard.SmdSolderMask = model.wipBoard.SmdSolderMasks == null ? null : string.Join(',', model.wipBoard.SmdSolderMasks); + model.wipBoard.DipSide = model.wipBoard.DipSides == null ? null : string.Join(',', model.wipBoard.DipSides); + model.wipBoard.ItemNo = model.wipAtt.ItemNO; + model.wipBoard.WipNo = model.wipInfo.WipNO; + model.wipBoard.CreateUserID = UserID; + model.wipBoard.UpdateUserID = UserID; - model.wipSystem.ItemNo = model.wipAtt.ItemNO; - model.wipSystem.WipNo = model.wipInfo.WipNO; - model.wipSystem.CreateUserID = UserID; - model.wipSystem.UpdateUserID = UserID; - result = await _pcsApi.PutWipSystem(JsonConvert.SerializeObject(model.wipSystem)); - if (!result.Success) - { - Msg += result.Msg; - } - } - else - // 板卡 WipBoard + // 零件烘烤-其他時間 + if (model.wipBoard.PartsBake == 999) + model.wipBoard.PartsBake = (int)model.wipBoard.PartsBakeOther; + + result = await _pcsApi.PutWipBoard(JsonConvert.SerializeObject(model.wipBoard)); + if (!result.Success) { - model.wipBoard.Smd = model.wipBoard.SMDs == null ? null : string.Join(',', model.wipBoard.SMDs); - model.wipBoard.SmdSolderMask = model.wipBoard.SmdSolderMasks == null ? null : string.Join(',', model.wipBoard.SmdSolderMasks); - model.wipBoard.DipSide = model.wipBoard.DipSides == null ? null : string.Join(',', model.wipBoard.DipSides); - model.wipBoard.ItemNo = model.wipAtt.ItemNO; - model.wipBoard.WipNo = model.wipInfo.WipNO; - model.wipBoard.CreateUserID = UserID; - model.wipBoard.UpdateUserID = UserID; - - // 零件烘烤-其他時間 - if (model.wipBoard.PartsBake == 999) - model.wipBoard.PartsBake = (int)model.wipBoard.PartsBakeOther; - - result = await _pcsApi.PutWipBoard(JsonConvert.SerializeObject(model.wipBoard)); - if (!result.Success) - { - Msg += result.Msg; - } + Msg += result.Msg; } } diff --git a/AMESCoreStudio.Web/Views/BAS/BAS012.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS012.cshtml index 9677115..14469da 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS012.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS012.cshtml @@ -51,7 +51,7 @@ var tableCols = [[ { field: 'mfid', - //width: 80, + width: 80, title: '#', sort: true }, @@ -59,6 +59,7 @@ field: 'itemNo', title: '工程編號', sort: true, + width: 200, templet: function (d) { var tt; if (d.materialItem) diff --git a/AMESCoreStudio.Web/Views/BAS/BAS012C.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS012C.cshtml index 535115d..23fbbce 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS012C.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS012C.cshtml @@ -1,8 +1,10 @@ @model AMESCoreStudio.WebApi.Models.BAS.MaterialFlow -@{ ViewData["Title"] = "BAS012C"; - Layout = "~/Views/Shared/_FormLayout.cshtml"; } +@{ + ViewData["Title"] = "BAS012C"; + Layout = "~/Views/Shared/_FormLayout.cshtml"; +}
+ + +
@@ -41,8 +62,10 @@
- - + +
@@ -61,6 +84,16 @@
+ @* + *@ +
@@ -1243,7 +1276,11 @@
+ +
+ + @section Scripts { } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml index 28d90b5..76eda62 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml @@ -1,4 +1,5 @@ @model AMESCoreStudio.Web.ViewModels.PCS.PCS021ViewModel + @{ ViewData["Title"] = "過站作業"; Layout = "~/Views/Shared/_AMESLayout.cshtml"; diff --git a/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml index 8a0d8e1..236310c 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml @@ -211,8 +211,8 @@
@* - - *@ + + *@
@@ -280,14 +280,14 @@
@*
- -
- -
-
- -
-
*@ + +
+ +
+
+ +
+
*@
@@ -397,8 +397,8 @@ } - @*
- + @*
+
*@
@@ -489,9 +489,18 @@
- - - + + +
@@ -507,7 +516,10 @@
- +
@@ -528,7 +540,10 @@
- +
@@ -541,7 +556,10 @@
- +
@@ -557,7 +575,10 @@
- +
@@ -865,7 +886,10 @@
- +
@@ -976,8 +1000,8 @@ SOP文件敘述 @* - 檔案路徑 - *@ + 檔案路徑 + *@ SOP類型 @@ -1001,8 +1025,8 @@ @* - - *@ + + *@ @@ -1020,8 +1044,8 @@ } - @*
- + @*
+
*@
@@ -1155,25 +1179,15 @@ } RuleStation($("#flowId").val()); - // 安勤統一只Show工程資訊 - $("#system").show(); - $("#board").hide(); - - if ("@ViewBag.WipSpecial" == "N") { - if ($("#unitNo").val() == "B" || $("#unitNo").val() == "P" || $("#unitNo").val() == "T") { - $("#system").show(); - $("#board").hide(); - } - else { - $("#system").hide(); - $("#board").show(); - } + // 判斷工單製程切換工程資訊或板卡資訊 + if ($("#unitNo").val() == "B" || $("#unitNo").val() == "P" || $("#unitNo").val() == "T") { + $("#system").show(); + $("#board").hide(); + } + else { + $("#system").hide(); + $("#board").show(); } - - //// DIV 出貨序號 - //if ($('#wipBarcodeOther_StartNO').val() != "" && $('#wipBarcodeOther_EndNO').val() != "") { - // $("#barcodeOtherDiv").hide(); - //} getLineInfoList($("#unitNo").val()); @@ -1194,86 +1208,86 @@ }); - @*// 產生出貨序號 + @*// 產生出貨序號 $("#GetBarcodeOther").click(function (event) { - var itemNo = $('#wipAtt_ItemNO').val(); - var planQTY = $('#wipInfo_PlanQTY').val(); - var lotNo = $('#lotNo').val(); - var wipShcDate = $('#wipInfo_WipScheduleDate').val().replace(/\//g, '-'); - if (itemNo == '' || !itemNo) { - parent.hg.msg("請輸入工程編號"); - return; - } - if (planQTY == '' || !planQTY || planQTY == 0) { - parent.hg.msg("請確認計畫數量"); - return; - } - if (wipShcDate == '') { - parent.hg.msg("請確認預計開工日期有填寫"); - return; - } - if (lotNo == '' || !lotNo) { - lotNo = getLotNo(); - } + var itemNo = $('#wipAtt_ItemNO').val(); + var planQTY = $('#wipInfo_PlanQTY').val(); + var lotNo = $('#lotNo').val(); + var wipShcDate = $('#wipInfo_WipScheduleDate').val().replace(/\//g, '-'); + if (itemNo == '' || !itemNo) { + parent.hg.msg("請輸入工程編號"); + return; + } + if (planQTY == '' || !planQTY || planQTY == 0) { + parent.hg.msg("請確認計畫數量"); + return; + } + if (wipShcDate == '') { + parent.hg.msg("請確認預計開工日期有填寫"); + return; + } + if (lotNo == '' || !lotNo) { + lotNo = getLotNo(); + } - $.ajax({ - url: '@Url.Action("GetBarcodeOther", "PCS")', - dataType: 'json', - data: { "itemNo": itemNo, "lotNo": lotNo, "num": planQTY, "wipNo": '@Model.wipInfo.WipNO', "wipShcDate": wipShcDate }, - cache: false, - type: "POST", - success: function (result) { - // 錯誤訊息 - if (!result.success) { - parent.hg.msg(result.msg); - } - else { - $("#wipBarcodeOther_StartNO").val(result.data.startNO); - $("#wipBarcodeOther_EndNO").val(result.data.endNO); - $("#barcodeOtherDiv").hide(); - } - }, - error: function (jqXHR, textStatus, errorThrown) { - alert("Found error when using Ajax!!"); - } - }); + $.ajax({ + url: '@Url.Action("GetBarcodeOther", "PCS")', + dataType: 'json', + data: { "itemNo": itemNo, "lotNo": lotNo, "num": planQTY, "wipNo": '@Model.wipInfo.WipNO', "wipShcDate": wipShcDate }, + cache: false, + type: "POST", + success: function (result) { + // 錯誤訊息 + if (!result.success) { + parent.hg.msg(result.msg); + } + else { + $("#wipBarcodeOther_StartNO").val(result.data.startNO); + $("#wipBarcodeOther_EndNO").val(result.data.endNO); + $("#barcodeOtherDiv").hide(); + } + }, + error: function (jqXHR, textStatus, errorThrown) { + alert("Found error when using Ajax!!"); + } + }); });*@ - // 產生MAC - $("#GetMAC").click(function (event) { - var wipNO = $('#wipAtt_ItemNO').val(); - var planQTY = $('#wipInfo_PlanQTY').val(); - if (wipNO == '' || !wipNO) { - parent.hg.msg("請輸入工程編號"); - return; - } - if (planQTY == '' || !planQTY || planQTY == 0) { - parent.hg.msg("請確認計畫數量"); - return; - } - $.ajax({ - url: '@Url.Action("GetMAC", "PCS")', - dataType: 'json', - data: { "itemno": $("#wipAtt_ItemNO").val(), "wipNo": $('#wipInfo_WipNO').val(), "planQTY": $('#wipInfo_PlanQTY').val() }, - cache: false, - type: "POST", - success: function (result, textStatus, jqXHR) { - if (result.success) { - var contactdiv = `${result.data.mix}${result.data.max}`; - $('#MACTable').append(contactdiv); - if (result.msg.length != 0) { + // 產生MAC + $("#GetMAC").click(function (event) { + var wipNO = $('#wipAtt_ItemNO').val(); + var planQTY = $('#wipInfo_PlanQTY').val(); + if (wipNO == '' || !wipNO) { + parent.hg.msg("請輸入工程編號"); + return; + } + if (planQTY == '' || !planQTY || planQTY == 0) { + parent.hg.msg("請確認計畫數量"); + return; + } + $.ajax({ + url: '@Url.Action("GetMAC", "PCS")', + dataType: 'json', + data: { "itemno": $("#wipAtt_ItemNO").val(), "wipNo": $('#wipInfo_WipNO').val(), "planQTY": $('#wipInfo_PlanQTY').val() }, + cache: false, + type: "POST", + success: function (result, textStatus, jqXHR) { + if (result.success) { + var contactdiv = `${result.data.mix}${result.data.max}`; + $('#MACTable').append(contactdiv); + if (result.msg.length != 0) { + parent.hg.msg(result.msg); + } + } + else { parent.hg.msg(result.msg); } + }, + error: function (jqXHR, textStatus, errorThrown) { + alert("Found error when using Ajax!!"); } - else { - parent.hg.msg(result.msg); - } - }, - error: function (jqXHR, textStatus, errorThrown) { - alert("Found error when using Ajax!!"); - } + }); }); - }); function PrefixInteger(num, length) { return (Array(length).join('0') + num).slice(-length);