From c0f356e10b2e36d7771fb583ac6df8a6474b8075 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 24 May 2022 10:18:42 +0800 Subject: [PATCH] =?UTF-8?q?1.=20PCS009=20=E5=8A=A0=E5=85=A5=E6=A2=9D?= =?UTF-8?q?=E7=A2=BC=E8=AE=8A=E6=9B=B4=202.=20PCS001N=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E9=8C=AF=E8=AA=A4=E8=A8=8A=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 21 +++++++++-- AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs | 7 ++++ .../ViewModels/PCS/PCS009RViewModel.cs | 6 +++ AMESCoreStudio.Web/Views/PCS/PCS001N.cshtml | 2 +- AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml | 37 +++++++++++++++++++ .../AMES/BarcodeChangeController.cs | 22 +++++++++++ .../Models/AMES/BarcodeChange.cs | 6 +++ 7 files changed, 96 insertions(+), 5 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 4d05c7bf..bb116c6f 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -1849,12 +1849,12 @@ namespace AMESCoreStudio.Web.Controllers } - - if (result.Success) { - ModelState.AddModelError("error", "新增成功!"); - return View("PCS001N",new WipDataViewModel()); + ModelState.Clear(); + ModelState.AddModelError("error", "新增成功!"); + var viewModel = new WipDataViewModel(); + return View(viewModel); } else { @@ -3859,6 +3859,19 @@ namespace AMESCoreStudio.Web.Controllers // 維修 result.nGInfoDtos = await _pcsApi.GetNgInfoByBarcodeNoFromPCS009(result_barcodeinfo.BarcodeNo); + // 條碼變更 + var barcodeChanges = await _pcsApi.GetBarcodeChangeByBarcodeID(result_barcodeinfo.BarcodeID); + foreach (var item in barcodeChanges) + { + result.BarCodeChanges.Add(new BarCodeChange + { + BarCodeOld = item.BarcodeNOOld, + Memo = item.Memo, + User = item.CreateUserName, + Date = item.CreateDate.ToString("yyyy/MM/dd HH:mm:ss") + }); + } + return View(result); } #endregion diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 14f62123..51d0e472 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -587,6 +587,13 @@ namespace AMESCoreStudio.Web /// [WebApiClient.Attributes.HttpPost("api/BarcodeChange")] ITask> PostBarcodeChange([FromBody, RawJsonContent] string model); + + /// + /// 條碼變更資料表 by BarCodeID + /// + /// + [WebApiClient.Attributes.HttpGet("api/BarcodeChange/ByBarcodeID/{id}")] + ITask> GetBarcodeChangeByBarcodeID(int id); #endregion #region MaterialItem 料號基本資料檔 diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs index 418c633b..d6f8c1ce 100644 --- a/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs @@ -91,6 +91,7 @@ namespace AMESCoreStudio.Web.ViewModels.PCS /// 維修紀錄 /// public List nGInfoDtos { get; set; } + } /// @@ -222,6 +223,11 @@ namespace AMESCoreStudio.Web.ViewModels.PCS /// public string BarCodeOld { get; set; } + /// + /// 備註 + /// + public string Memo { get; set; } + /// /// 置換人員 /// diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001N.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001N.cshtml index 0f99b90b..12d421d8 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001N.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001N.cshtml @@ -25,7 +25,7 @@
- +
@ViewData["message"]
diff --git a/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml index fb5f85ba..e520f1d0 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml @@ -377,6 +377,43 @@
條碼變更
+ + + + + + + + + + + @foreach (var index in Model.BarCodeChanges) + { + + + + + + + } + +
+ (舊)內部序號 + + 備註 + + 變更人員 + + 變更時間 +
+ @index.BarCodeOld + + @index.Memo + + @index.User + + @index.Date +
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeChangeController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeChangeController.cs index 8f0060f0..09c22de0 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeChangeController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeChangeController.cs @@ -57,7 +57,29 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return await q.ToListAsync(); } + /// + /// 條碼變更資料表 by id + /// + /// BarcodeID + /// + [HttpGet("ByBarcodeID/{id}")] + public async Task>> GetBarcodeChangeByBarcodeID(int id) + { + var q = from q1 in _context.BarcodeChanges where q1.BarcodeID == id + join q2 in _context.UserInfoes on q1.CreateUserID equals q2.CreateUserId + select new BarcodeChange + { + BarcodeChangeID = q1.BarcodeChangeID, + BarcodeID = q1.BarcodeID, + BarcodeNOOld = q1.BarcodeNOOld, + CreateUserID = q1.CreateUserID, + CreateDate = q1.CreateDate, + Memo = q1.Memo, + CreateUserName = q2.UserName + }; + return await q.ToListAsync(); + } /// /// 新增條碼變更資料表 diff --git a/AMESCoreStudio.WebApi/Models/AMES/BarcodeChange.cs b/AMESCoreStudio.WebApi/Models/AMES/BarcodeChange.cs index 05af2e09..a2fa5f98 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/BarcodeChange.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/BarcodeChange.cs @@ -67,5 +67,11 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Display(Name = "備註")] public string Memo { get; set; } + /// + /// 建立者Name + /// + [NotMapped] + [DataMember] + public string CreateUserName { get; set; } } }