From 6ec927045eae84452df2c39175314349e5350944 Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 21 Apr 2022 02:53:17 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E9=81=8E=E7=AB=99=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E7=95=B0=E5=B8=B8=E4=BD=8D=E7=BD=AE=E6=AC=84=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 49 ++++++++--------- .../ViewModels/PCS/PCS021ViewModel.cs | 2 +- AMESCoreStudio.Web/Views/PCS/PCS021.cshtml | 53 ++++++++++++------- .../Controllers/BLL/BarCodeCheckController.cs | 8 +-- .../DTO/BLL/BarCodeCheckDto.cs | 2 +- 5 files changed, 61 insertions(+), 53 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 3954e986..ba234207 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -1937,7 +1937,6 @@ namespace AMESCoreStudio.Web.Controllers ModelState.AddModelError("error", "治具組合中生產單位與作業站不匹配"); return View("PCS003", model); } - } } @@ -2024,6 +2023,15 @@ namespace AMESCoreStudio.Web.Controllers model.wipMAC.Title = model.wipMAC.StartNO.Substring(0, 6).ToUpper(); model.wipMAC.StartNO = model.wipMAC.StartNO.Substring(model.wipMAC.StartNO.Length - 6, 6).ToUpper(); model.wipMAC.EndNO = model.wipMAC.EndNO.Substring(model.wipMAC.EndNO.Length - 6, 6).ToUpper(); + + // 確認MAC Table是否有料號資料 + var mACInfo = await _pcsApi.GetMACInfo(model.wipAtt.ItemNO); + if (mACInfo != null) + { + model.wipMAC.ClassGroup = mACInfo.ClassGroup; + //result = await _pcsApi.PutMACInfoByClassGroup(mACInfo.ClassGroup, model.wipMAC.EndNO); + } + if (!string.IsNullOrWhiteSpace(model.wipMAC.WipNO)) result = await _pcsApi.PutWipMAC(JsonConvert.SerializeObject(model.wipMAC)); else @@ -2032,23 +2040,6 @@ namespace AMESCoreStudio.Web.Controllers result = await _pcsApi.PostWipMAC(JsonConvert.SerializeObject(model.wipMAC)); } } - else - { - var mACInfo = await _pcsApi.GetMACInfo(model.wipAtt.ItemNO); - if (mACInfo != null) - { - model.wipMAC.Title = mACInfo.Title; - model.wipMAC.ClassGroup = mACInfo.ClassGroup; - if (!string.IsNullOrWhiteSpace(model.wipMAC.WipNO)) - result = await _pcsApi.PutWipMAC(JsonConvert.SerializeObject(model.wipMAC)); - else - { - model.wipMAC.WipNO = model.wipInfo.WipNO; - result = await _pcsApi.PostWipMAC(JsonConvert.SerializeObject(model.wipMAC)); - } - result = await _pcsApi.PutMACInfoByClassGroup(mACInfo.ClassGroup, model.wipMAC.EndNO); - } - } } // KeyParts // 先比對新舊ID 當舊ID有 新的沒有代表已刪除 @@ -3432,7 +3423,7 @@ namespace AMESCoreStudio.Web.Controllers model.UnitNO = q.FirstOrDefault().UnitNO; model.FlowRuleID = q.FirstOrDefault().FlowRuleID; model.ItemNO = (await _pcsApi.GetWipAtt(model.WipNO)).ItemNO; - + // 判斷工單狀態 var BarCodeWip = await _pcsApi.CheckBarCodeWip(model.WipNO, model.UnitNO, model.LineID, model.FlowRuleID); @@ -3538,7 +3529,7 @@ namespace AMESCoreStudio.Web.Controllers } #endregion - var Kp = model.Inputs.Where(w => !w.Contains("$")).ToList(); // 撈非不良代碼 = 組件序號 + var Kp = model.Inputs.Where(w => !w.Input.Contains("$")).ToList(); // 撈非不良代碼 = 組件序號 var q = await _pcsApi.GetBarCodeFromWip(model.Input); // 判斷是否用內部序號有對應到工單號碼,沒對應到視為組件或不良代碼 if (q.Success) @@ -3569,7 +3560,7 @@ namespace AMESCoreStudio.Web.Controllers model.StationSEQ = RuleStations.Where(w => w.StationID == model.Station).Select(s => s.Sequence).FirstOrDefault(); } // 判斷是否有$符號,代表有不良代碼 - if (model.Inputs.Where(w => w.Contains("$")).Any()) + if (model.Inputs.Where(w => w.Input.Contains("$")).Any()) { model.BarcodeNG = true; // 判斷是否為投入站,投入站不能刷不良 @@ -3610,6 +3601,11 @@ namespace AMESCoreStudio.Web.Controllers int i = 0; foreach (var KeyPartItem in model.Inputs) { + // 判斷是組件先+1 + if (!KeyPartItem.Input.Contains("$")) + i += 1; + + // 當刷入組組件+已紀錄組件數量 大於 設定組件數量 if (i + KpItemQty > model.WipKps.Count()) { Msg = "已刷超過組件數量"; @@ -3618,13 +3614,10 @@ namespace AMESCoreStudio.Web.Controllers } keyParts.Add(new BarCodeCheckDto.inputItem { - inputType = KeyPartItem.Contains("$") ? "NG" : model.WipKps[i + KpItemQty].KpNo, - inputData = KeyPartItem, - //oldInputData = KeyPartItem.InputNo + inputType = KeyPartItem.Input.Contains("$") ? "NG" : model.WipKps[i - 1 + KpItemQty].KpNo, + inputData = KeyPartItem.Input, + oldInputData = KeyPartItem.InputNo }); - - if (!KeyPartItem.Contains("$")) - i += 1; } // 治具 @@ -3916,7 +3909,7 @@ namespace AMESCoreStudio.Web.Controllers // await _pcsApi.CheckWipNoBarCodeAllClost(model.WipNO, model.UnitNO, model.RuleStation); } - return Json(new Result() { success = Success, msg = Msg, data = Data }); + return Json(new Result() { success = Success, msg = Msg, data = Data + "@" + model.InputNo }); // 刷入條碼+異常欄位 } #endregion diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs index 7f4cb8e3..5f719866 100644 --- a/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS021ViewModel.cs @@ -109,7 +109,7 @@ namespace AMESCoreStudio.Web.ViewModels.PCS /// inputs /// - public List Inputs { get; set; } = new List(); + public List Inputs { get; set; } = new List(); /// /// 料號相關資料 diff --git a/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml index 3b60dca5..f29a3b0c 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS021.cshtml @@ -125,7 +125,7 @@
+ event.preventDefault(); return false; }" asp-for="InputNo" id="inputNo" style="width:100px" class="layui-input" autocomplete="off" placeholder="可輸入異常位置" />
@@ -362,34 +362,38 @@ } }; - // 異常代碼換行 - function inputNo(e) { - if (e.keyCode == 13) { - $(':input:visible:enabled:eq(' + ($(':input:visible:enabled').index(this) + 1) + ')').focus(); - e.preventDefault(); - return false; - } - }; - function input(e) { if (e.keyCode == 13) { var Inputs = GetAllEmpData(); var data = $("#PCS021Form").serialize(); - $.each(Inputs, function (i, item) { - data += "&Inputs[" + i + "]=" + item; - }); + //$.each(Inputs, function (i, item) { + // data += "&Inputs[" + i + "]=" + item; + //}); + var InputsTotal = Inputs.length; + for (i = 0; i < InputsTotal; i++) { + data += "&Inputs[" + i + "].Input=" + Inputs[i].Input; + data += "&Inputs[" + i + "].InputNo=" + Inputs[i].InputNo; + } + + $.ajax({ url: "@Url.Action("PCS021_Input", "PCS")", type: "POST", data: data, success: function (result) { $("#inputtxt").val(''); + $("#inputNo").val(''); + // 錯誤訊息 if (!result.success) { parent.hg.msg(result.msg); } else { - if (result.msg.length != 0) { parent.hg.msg(result.msg);} + + if (result.msg.length != 0) + { parent.hg.msg(result.msg); } + if (result.data.length != 0) { + // 新增資料 TableAddRow(result.data); } else { @@ -432,9 +436,11 @@ // 新增trRow function TableAddRow(e) { + var strAry = e.split('@'); //var rowCount = $('.data-contact-person').length + 0; var contactdiv = '' + - '' + + '' + + '' + '刪除' + ''; $('#tblCustomers').append(contactdiv); @@ -459,12 +465,21 @@ // 紀錄表格欄位 function GetAllEmpData() { + // 單筆 + //var data = []; + //$('tr.data-contact-person').each(function () { + // var firstName = $(this).find('.td-Input').val(); + // data.push(firstName); + //}); + //return data; + var data = []; - $('tr.data-contact-person').each(function () { - var firstName = $(this).find('.td-Input').val(); - data.push(firstName); + $('tr.data-contact-person').each(function () { + var Input = $(this).find('.td-Input').val(); + var InputNo = $(this).find('.td-InputNo').val(); + data.push({ Input: Input, InputNo: InputNo}); }); - return data; + return data; } function AutoWindowSize() { diff --git a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs index 003d4a95..9adfc374 100644 --- a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs @@ -720,13 +720,13 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES StationId = barCodeCheckDto.station, WipId = barCodeCheckDto.wipID }; - var resultNgInfo = await ngInfoController.PostNgInfo(ngInfo); - if (resultNgInfo.Success) + resut = await ngInfoController.PostNgInfo(ngInfo); + if (resut.Success) { NgComponent ngComponent = new NgComponent { - NgID = resultNgInfo.Data.FirstOrDefault().NgID, - LocationNo = "N/A", + NgID = resut.Data.FirstOrDefault().NgID, + LocationNo = NGNo.oldInputData, NgNo = NGNo.inputData, }; await ngComponentsController.PostNgComponent(ngComponent); diff --git a/AMESCoreStudio.WebApi/DTO/BLL/BarCodeCheckDto.cs b/AMESCoreStudio.WebApi/DTO/BLL/BarCodeCheckDto.cs index e8ebb004..5d994238 100644 --- a/AMESCoreStudio.WebApi/DTO/BLL/BarCodeCheckDto.cs +++ b/AMESCoreStudio.WebApi/DTO/BLL/BarCodeCheckDto.cs @@ -122,7 +122,7 @@ namespace AMESCoreStudio.WebApi.DTO.AMES public string inputData { get; set; } /// - /// 組件:舊組件序號 + /// 組件:舊組件序號 NG:異常位置 /// [DataMember] public string oldInputData { get; set; }