diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index ca7b250c..195c9d67 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -1519,6 +1519,7 @@ namespace AMESCoreStudio.Web.Controllers var result = await _pcsApi.GetItApiEcnByWipNo(wipNo); var json = JsonConvert.DeserializeObject(result); return Json(new Result() { success = true, data = json }); + } #endregion @@ -3279,6 +3280,7 @@ namespace AMESCoreStudio.Web.Controllers public async Task GetMAC(string itemno, string wipNo, int planQTY) { + string msg = string.Empty; var q = await _pcsApi.GetMACInfo(itemno); if (q != null) @@ -3286,13 +3288,16 @@ namespace AMESCoreStudio.Web.Controllers // 工單數量*單板MAC數 var MacQty = planQTY * q.Qty; var wipMAC = await _pcsApi.GetWipMAC(wipNo); + // 目前該筆供單已取MAC數量 var getWipMacQty = wipMAC.Select(s => s.Qty).Sum(); // 判斷目前工單數量*單板MAC數 == DB已記使用MAC數量 if (planQTY * q.Qty <= getWipMacQty) { - return Json(new { _msg = "已取滿MAC數量,請在確認" }); + msg = "該筆工單已取滿MAC數量,請在確認"; + return Json(new Result() { success = false, data = null, msg = msg }); } + // 剩下工單未取MAC數量 MacQty = MacQty - getWipMacQty; // 當前值 16 進位 @@ -3300,20 +3305,31 @@ namespace AMESCoreStudio.Web.Controllers var Entire = new Code.Entire(); - // 最小值 + // Table 當前值 最小值 var Mix = (int.Parse(Entire.DecHex(Value, "HexToDec")) + 1); + if (Mix > int.Parse(Entire.DecHex(q.Max.ToString(), "HexToDec"))) + { + msg = "可使用MAC區間已用完,請在確認"; + return Json(new Result() { success = false, data = null, msg = msg }); + } + // 最大值 var Max = (int.Parse(Entire.DecHex(Value, "HexToDec")) + MacQty); - - // 當最大值 > DB設定最大值 + // 當最大值 > DB設定最大值 已超過目前區間 if (Max > int.Parse(Entire.DecHex(q.Max.ToString(), "HexToDec"))) { - return Json(new { _msg = "自動配MAC已超過設定最大值,請在確認!" }); + // 先把剩下區間用完 + Max = int.Parse(Entire.DecHex(q.Max.ToString(), "HexToDec")); + + // 取剩下的MAC數量 + msg = $"已將剩下MAC區間取完:【{Max - Mix + 1}】pcs,尚有:【{MacQty - (Max - Mix + 1)}】pcs還沒取,請再申請一組新的MAC區間"; + MacQty = Max - Mix + 1; + // return Json(new { _msg = "自動配MAC已超過設定最大值,請在確認!" }); } // 低於安全量 Mail通知 // 取完剩餘數量 - var NowQty = Max - int.Parse(Entire.DecHex(q.Max.ToString(), "HexToDec")); + var NowQty = int.Parse(Entire.DecHex(q.Max.ToString(), "HexToDec")) - Max; if (NowQty <= q.SafeQty) { @@ -3339,9 +3355,10 @@ namespace AMESCoreStudio.Web.Controllers mix = MACstr, max = MACend, }; - return Json(x); + return Json(new Result() { success = true, data = x, msg = msg }); } - return Json(new { _msg = "查無相關MAC對應" }); + msg = "查無相關MAC對應"; + return Json(new Result() { success = false, data = null, msg = msg }); } /// diff --git a/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml index ae333ff7..98f2b0d3 100644 --- a/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml +++ b/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml @@ -233,7 +233,7 @@ field: 'endTime', title: '抽驗結束時間', sort: true, - templet: '
{{ layui.util.toDateString(d.endTime, "yyyy/MM/dd") }}
' + templet: '
{{ layui.util.toDateString(d.endTime, "yyyy/MM/dd HH:mm:ss") }}
' }, { field: 'qaMemo', diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001N.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001N.cshtml index fab1f2ff..ccb253dd 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001N.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001N.cshtml @@ -506,11 +506,11 @@ }); // 產生MAC - $("#GetMAC").click(function (event) { + $("#GetMAC").click(function (event) { var wipNO = $('#wipAtt_ItemNO').val(); var planQTY = $('#wipInfo_PlanQTY').val(); if (wipNO == '' || !wipNO) { - parent.hg.msg("請輸入料號"); + parent.hg.msg("請輸入工程編號"); return; } if (planQTY == '' || !planQTY || planQTY == 0) { @@ -520,18 +520,19 @@ $.ajax({ url: '@Url.Action("GetMAC", "PCS")', dataType: 'json', - data: { "itemno": $("#wipAtt_ItemNO").val(), "wipNo": $('#wipInfo_WipNO').val() ,"planQTY": $('#wipInfo_PlanQTY').val() }, + data: { "itemno": $("#wipAtt_ItemNO").val(), "wipNo": $('#wipInfo_WipNO').val(), "planQTY": $('#wipInfo_PlanQTY').val() }, cache: false, type: "POST", - success: function (data, textStatus, jqXHR) { - if (data._msg != undefined) { - parent.hg.msg(data._msg); + 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 { - var contactdiv = '' + - `${data.mix} - ${data.max}`; - $('#MACTable').append(contactdiv); + parent.hg.msg(result.msg); } }, error: function (jqXHR, textStatus, errorThrown) { diff --git a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml index 3c6cd489..9f2ab409 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml @@ -250,14 +250,14 @@ @foreach (var index in Model.wipBarcodes) { - - - @index.StartNO - - - @index.EndNO - - + + + @index.StartNO + + + @index.EndNO + + } @@ -309,14 +309,14 @@ @foreach (var index in Model.wipMACs) { - - - @index.Title@index.StartNO - - - @index.Title@index.EndNO - - + + + @index.Title@index.StartNO + + + @index.Title@index.EndNO + + } @@ -381,30 +381,30 @@ @foreach (var index in Model.WipKps) { - - - - - - - - - - - - - - - - - - - - - - 刪除 - - + + + + + + + + + + + + + + + + + + + + + + 刪除 + + k++; } @@ -455,11 +455,11 @@ @if (!string.IsNullOrWhiteSpace(Model.itemNoCT1)) { - 有維護標準工時 + 有維護標準工時 } else { - **無維護標準工時** + **無維護標準工時** } @@ -502,9 +502,9 @@
- - - + + +
@@ -520,7 +520,7 @@
- +
@@ -541,7 +541,7 @@
- +
@@ -554,7 +554,7 @@
- +
@@ -570,7 +570,7 @@
- +
@@ -700,11 +700,11 @@ @if (!string.IsNullOrWhiteSpace(Model.itemNoCT1)) { - 有維護標準工時 + 有維護標準工時 } else { - **無維護標準工時** + **無維護標準工時** }
@@ -878,7 +878,7 @@
- +
@@ -952,23 +952,23 @@ @foreach (var index in Model.WipOutfits) { - - - - - - - - - + - - - - - 刪除 - - + + + + + + + + + + + + + 刪除 + + l++; } @@ -1013,27 +1013,27 @@ @foreach (var index in Model.WipSops) { - - - - - - @* - - *@ - - - - - - - - - - - 刪除 - - + + + + + + @* + + *@ + + + + + + + + + + + 刪除 + + i++; } @@ -1105,23 +1105,23 @@ @foreach (var index in Model.wipInfoBlobs) { - - - @index.ImageName - - - @index.Filepath - - - @index.Remark + + + @index.ImageName + + + @index.Filepath + + + @index.Remark - - - 預覽 - 下載 - 刪除 - - + + + 預覽 + 下載 + 刪除 + + } @@ -1340,11 +1340,11 @@ }); // 產生MAC - $("#GetMAC").click(function (event) { + $("#GetMAC").click(function (event) { var wipNO = $('#wipAtt_ItemNO').val(); var planQTY = $('#wipInfo_PlanQTY').val(); if (wipNO == '' || !wipNO) { - parent.hg.msg("請輸入料號"); + parent.hg.msg("請輸入工程編號"); return; } if (planQTY == '' || !planQTY || planQTY == 0) { @@ -1357,15 +1357,16 @@ data: { "itemno": $("#wipAtt_ItemNO").val(), "wipNo": $('#wipInfo_WipNO').val(), "planQTY": $('#wipInfo_PlanQTY').val() }, cache: false, type: "POST", - success: function (data, textStatus, jqXHR) { - if (data._msg != undefined) { - parent.hg.msg(data._msg); + 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 { - var contactdiv = '' + - `${data.mix} - ${data.max}`; - $('#MACTable').append(contactdiv); + parent.hg.msg(result.msg); } }, error: function (jqXHR, textStatus, errorThrown) { @@ -1965,6 +1966,10 @@ data: { "wipNo": '@Model.wipInfo.WipNO' }, success: function (result) { if (result.success) { + if (result.data.eaN_NO == null) { + hg.msghide("查無資料,不需要更新!"); + } + else { var result_data = result.data.eaN_NO; console.log(result_data.eaN_NO); if (result_data.length == 0) { @@ -1977,6 +1982,7 @@ layer.closeAll('dialog'); $("#wipAtt_ECN").val(result_data); }) + } } } }, diff --git a/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml index a740cc9d..43aa8cb1 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml @@ -1241,11 +1241,11 @@ }); // 產生MAC - $("#GetMAC").click(function (event) { + $("#GetMAC").click(function (event) { var wipNO = $('#wipAtt_ItemNO').val(); var planQTY = $('#wipInfo_PlanQTY').val(); if (wipNO == '' || !wipNO) { - parent.hg.msg("請輸入料號"); + parent.hg.msg("請輸入工程編號"); return; } if (planQTY == '' || !planQTY || planQTY == 0) { @@ -1258,15 +1258,16 @@ data: { "itemno": $("#wipAtt_ItemNO").val(), "wipNo": $('#wipInfo_WipNO').val(), "planQTY": $('#wipInfo_PlanQTY').val() }, cache: false, type: "POST", - success: function (data, textStatus, jqXHR) { - if (data._msg != undefined) { - parent.hg.msg(data._msg); + 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 { - var contactdiv = '' + - `${data.mix} - ${data.max}`; - $('#MACTable').append(contactdiv); + parent.hg.msg(result.msg); } }, error: function (jqXHR, textStatus, errorThrown) { @@ -1767,27 +1768,32 @@ return b; } - // 更新ECN or ECR + // 更新ECN or ECR function GetPLM_ECN() { $.ajax({ - url: "@Url.Action("FQC007GetPLMECN", "FQC")", + url: "@Url.Action("GetItApiEcnByWipNo", "PCS")", type: "Post", - data: { "ItemNo": '@Model.wipAtt.ItemNO' }, + async: true, + data: { "wipNo": '@Model.wipInfo.WipNO' }, success: function (result) { if (result.success) { - var result_msg = result.msg; - console.log(result_msg); - console.log('@Model.wipAtt.ECN'); - if ('@Model.wipAtt.ECN' != result_msg) { + if (result.data.eaN_NO == null) { + hg.msghide("查無資料,不需要更新!"); + } + else { + var result_data = result.data.eaN_NO; + console.log(result_data.eaN_NO); + if (result_data.length == 0) { + hg.msghide("不需要更新!"); + } + else if ('@Model.wipAtt.ECN' != result_data) { layer.confirm('比對與PLM ECN/ECR不一樣,確定更新ECN/ECR嗎?', { btn: ['確定', '取消'] }, function () { layer.closeAll('dialog'); - $("#wipAtt_ECN").val(result_msg); + $("#wipAtt_ECN").val(result_data); }) - } - else { - parent.hg.msg(result.msg); + } } } }, diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs index e665fc86..d5ff879f 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs @@ -1994,8 +1994,8 @@ FROM [SFIS].[dbo].[ZPDKeyPart] B WHERE B.[IsActive] = 1 AND B.[ProductSN] = (S // 塞檢驗完成日期 foreach (var item in qq) { - var fqcDate = _context.FqcResultMasters.Where(w => w.WipNo == item.wipNo) - .OrderBy(s => s.EndTime) + var fqcDate = _context.FqcResultMasters.Where(w => w.WipNo == item.wipNo && w.QaResult != "A") + .OrderBy(s => s.EndTime) .FirstOrDefault(); item.fqcDate = fqcDate == null ? "" : fqcDate.EndTime.ToString("yyyy/MM/dd"); } diff --git a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs index debe99d5..73ff59c3 100644 --- a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs @@ -1920,7 +1920,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { wipKpsItem = wipKps.Where(w => w.KpNo.ToUpper() == barcodeKPDtoItem.inputType.ToUpper()).FirstOrDefault(); - if (wipKpsItem != null) + if (wipKpsItem == null) { wipKpsItem = wipKps[x + i]; } @@ -2210,9 +2210,14 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES // 有過站紀錄 if (barcodeInfo != null) { - // 如果BarCodeInfo 結案就除外 + // 如果BarCodeInfo 結案,判斷當下作業站是否第一站 if (barcodeInfo.StatusID == -1) { + if (!rules.Value.Where(w => w.StationID == stationID && w.RuleSeq == 1 && w.RuleStatus == "P").Any()) + { + resultModel.Msg = "目前作業站不是第一站,請確認"; + return resultModel; + } resultModel.Success = true; return resultModel; }