From 6d1883b4ad1d51ffca8a790987e0f2405447b69a Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 19 May 2022 18:28:17 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E5=B7=A5=E5=96=AE=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=8F=96LotNo=E6=96=B9=E5=BC=8F=202.=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=A2=9D=E7=A2=BC=E5=8D=80=E9=96=93=E5=88=A4=E6=96=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 56 +++++++++++++++++-- AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs | 7 +++ .../ViewModels/PCS/PCS004CViewModel.cs | 5 ++ AMESCoreStudio.Web/Views/PCS/PCS001.cshtml | 2 - AMESCoreStudio.Web/Views/PCS/PCS003.cshtml | 24 +++++++- AMESCoreStudio.Web/Views/PCS/PCS004C.cshtml | 50 +++++++++-------- AMESCoreStudio.Web/Views/PCS/PCS005.cshtml | 2 +- .../AMES/BarcodeInfoesController.cs | 6 -- 8 files changed, 114 insertions(+), 38 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 0b82f9b4..470d4135 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -1384,7 +1384,7 @@ namespace AMESCoreStudio.Web.Controllers /// 工單號碼 /// RuleStation [HttpPost] - public async Task GetBarcodeOther(string itemNo, string lotNo, int num ,string wipNo) + public async Task GetBarcodeOther(string itemNo, string lotNo, int num, string wipNo) { var result = await _pcsApi.GetSerialRuleByQurey(itemNo, lotNo.Trim().ToUpper(), num); string StartNO = ""; @@ -2169,7 +2169,7 @@ namespace AMESCoreStudio.Web.Controllers } // 判斷WipKp 順序是否重複 - if (model.WipKps.GroupBy(g => g.KpSeq).Where(w => w.Count() > 1).Any()) + if (model.WipKps.Where(w => w.WipKpID != -1).GroupBy(g => g.KpSeq).Where(w => w.Count() > 1).Any()) { ModelState.AddModelError("error", "KeyParts 順序有重複"); @@ -2629,6 +2629,52 @@ namespace AMESCoreStudio.Web.Controllers { await GetLineInfo(); await GetFlowRuleList(); + + // 起訖序號沒填寫 或者 綁定序號沒填寫 + if ((string.IsNullOrWhiteSpace(model.WipBarcode.StartNO) || string.IsNullOrWhiteSpace(model.WipBarcode.EndNO)) + && string.IsNullOrWhiteSpace(model.BarcodeNo)) + { + ModelState.AddModelError("error", "請確認新增的條碼是否有填寫?"); + return View(model); + } + + if ((!string.IsNullOrWhiteSpace(model.WipBarcode.StartNO) || !string.IsNullOrWhiteSpace(model.WipBarcode.EndNO)) + && !string.IsNullOrWhiteSpace(model.BarcodeNo)) + { + ModelState.AddModelError("error", "請則一選擇要新增條碼的方式?"); + return View(model); + } + + // 既有序號綁定 + if (!string.IsNullOrWhiteSpace(model.BarcodeNo)) + { + // 內部序號 + if (model.Type == "SN") + { + if (_pcsApi.GetBarcodeInfoesByNo(model.BarcodeNo).InvokeAsync().Result.Count() == 0) + { + ModelState.AddModelError("error", "綁定序號【" + model.BarcodeNo + "】,找不到已綁定的內部序號"); + return View(model); + } + } + // 出貨序號 + else if (model.Type == "SSN") + { + var resultExtraNo = await _pcsApi.GetBarcodeInfoesByExtraNo(model.BarcodeNo); + if (resultExtraNo.Count() == 0) + { + ModelState.AddModelError("error", "綁定序號【" + model.BarcodeNo + "】,找不到已綁定的出貨序號"); + return View(model); + } + else + model.BarcodeNo = resultExtraNo.FirstOrDefault().BarcodeNo; + } + + model.WipBarcode.StartNO = model.BarcodeNo; + model.WipBarcode.EndNO = model.BarcodeNo; + } + + // 流水碼預設長度 int NoLength = 4; string _msg = string.Empty; @@ -4969,7 +5015,7 @@ namespace AMESCoreStudio.Web.Controllers { var id = GetLogInUserID(); ViewBag.UserID = id; - var result = await _sysApi.GetUserInfo(id); + var result = await _sysApi.GetUserInfo(id); var name = result[0].UserName; ViewBag.UserName = name; return View(); @@ -4997,7 +5043,7 @@ namespace AMESCoreStudio.Web.Controllers result = await _pcsApi.PostSampleSipmentSN(JsonConvert.SerializeObject(model)); if (result.Success) { - var _msg = "取得序號成功!,序號為["+ result2.Msg + "]"; + var _msg = "取得序號成功!,序號為[" + result2.Msg + "]"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); } else @@ -5048,7 +5094,7 @@ namespace AMESCoreStudio.Web.Controllers if (string.IsNullOrEmpty(Edate)) Edate = "*"; - var result = await _pcsApi.GetSampleSipmentSNsByQurey( itemNo, wipNo, userName, Sdate, Edate); + var result = await _pcsApi.GetSampleSipmentSNsByQurey(itemNo, wipNo, userName, Sdate, Edate); if (result.Count > 0) { diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 5b1bdce3..45dc082f 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -299,6 +299,13 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpPut("api/BarcodeInfoes")] ITask> PutBarcodeInfoes([FromBody, RawJsonContent] string model); + + /// + /// 查詢條碼資料-客戶序號 + /// + /// + [WebApiClient.Attributes.HttpGet("api/BarcodeInfoes/ByExtraNo/{extraNo}")] + ITask> GetBarcodeInfoesByExtraNo(string extraNo); #endregion #region BarCodeStation 條碼過站資料檔 PCS021 diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS004CViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS004CViewModel.cs index 5532edef..aaa76809 100644 --- a/AMESCoreStudio.Web/ViewModels/PCS/PCS004CViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS004CViewModel.cs @@ -19,5 +19,10 @@ namespace AMESCoreStudio.Web.ViewModels.PCS public IEnumerable RuleStation { get; set; } + // 序號綁定 Type SN:內部序號 SSN:出貨序號 + public string Type { get; set; } + + // 綁定條碼 + public string BarcodeNo { get; set; } } } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml index 3eb484c0..f25f7c7a 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml @@ -30,9 +30,7 @@
-
- diff --git a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml index 2a22da97..b7d4bbc3 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml @@ -1170,9 +1170,9 @@ parent.hg.msg("請確認計畫數量"); return; } + if (lotNo == '' || !lotNo) { - parent.hg.msg("請確認lotNo"); - return; + lotNo = getLotNo(); } $.ajax({ @@ -1685,6 +1685,26 @@ }); return a; } + + function getLotNo() { + var b = ""; + $.ajax( + { + url: "@Url.Action("GetFactoryInfoes", "BAS")", + dataType: 'json', + data: {}, + async:false, + type: 'get', + success: function (result) { + $.each(result.data, function (index, item) { + if ($("#wipInfo_Werks").val() == item.factoryID) { + b = item.factoryNo.substr(2, 2); + } + }); + }, + }); + return b; + } } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS004C.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS004C.cshtml index b72e6575..18736caa 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS004C.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS004C.cshtml @@ -1,7 +1,7 @@ @model AMESCoreStudio.Web.ViewModels.PCS.PCS004CViewModel -@{ +@{ Layout = "~/Views/Shared/_AMESLayout.cshtml"; }