From c1418afe90a9fd0c9e9685ea81f06e83077760a8 Mon Sep 17 00:00:00 2001 From: "BB.Wang" Date: Wed, 12 Oct 2022 14:50:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=94=E5=8A=A9Yiru=E4=B8=8A=E5=82=B3?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=B8=AD=E5=A4=AE=E6=B2=BB=E5=85=B7?= =?UTF-8?q?=E5=BA=AB=E3=80=81=E5=B7=A5=E6=99=82=E7=AE=A1=E7=90=86=E3=80=81?= =?UTF-8?q?=E5=B7=A1=E6=AA=A2=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/JIGController.cs | 9 ++++- .../Controllers/SPCController.cs | 35 ++++++++++++------- .../Controllers/WHSController.cs | 24 +++++++++++-- AMESCoreStudio.Web/Views/JIG/JIG004D.cshtml | 23 ++++++------ AMESCoreStudio.Web/Views/JIG/JIG004U.cshtml | 14 ++++---- 5 files changed, 70 insertions(+), 35 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/JIGController.cs b/AMESCoreStudio.Web/Controllers/JIGController.cs index a7e14e1b..d93a38b4 100644 --- a/AMESCoreStudio.Web/Controllers/JIGController.cs +++ b/AMESCoreStudio.Web/Controllers/JIGController.cs @@ -587,8 +587,13 @@ namespace AMESCoreStudio.Web.Controllers } - public async Task JIG004D(int id ) + public async Task JIG004DAsync(int id ) { + GetUserID(); + await GetOutfitCommodityInfoesList(); + await GetOutfitVarityInfoesList(); + await GetOutfitVendorInfoesList(); + await GetOutfitFactoryInfosList(); var result = await _jigApi.GetOutfitInfo(id); if (result.Count == 0) @@ -809,6 +814,8 @@ namespace AMESCoreStudio.Web.Controllers public async Task JIG004DSaveAsync(OutfitInfo model) { + GetUserID(); + var msg = ""; if (ModelState.IsValid) { diff --git a/AMESCoreStudio.Web/Controllers/SPCController.cs b/AMESCoreStudio.Web/Controllers/SPCController.cs index 5058a616..88546f86 100644 --- a/AMESCoreStudio.Web/Controllers/SPCController.cs +++ b/AMESCoreStudio.Web/Controllers/SPCController.cs @@ -422,29 +422,38 @@ namespace AMESCoreStudio.Web.Controllers [HttpPost] public async Task SPC002CSaveAsync(InspectionForm model) { + await GetInspectionTypesList(); + await GetFactoryUnitsList3(); + if (ModelState.IsValid) { IResultModel result; - - result = await _spcApi.PostInspectionForm(JsonConvert.SerializeObject(model)); - - - if (result.Success) + var GetResult = await _spcApi.GetInspectionForms(); //yiru add 22-10-11 + if (GetResult.Where(w => w.InspectionName == model.InspectionName && w.InspectionTypeID == model.InspectionTypeID).ToList().Count > 0) { - var _msg = "添加成功!"; - return RedirectToAction("Refresh", "Home", new { msg = _msg }); + ModelState.AddModelError("error", "巡檢表單名稱重覆"); } else - { - if (result.Errors.Count > 0) + { + result = await _spcApi.PostInspectionForm(JsonConvert.SerializeObject(model)); + + + if (result.Success) { - ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); + var _msg = "添加成功!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); } else { - ModelState.AddModelError("error", result.Msg); - } - } + if (result.Errors.Count > 0) + { + ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); + } + else + { + ModelState.AddModelError("error", result.Msg); + } + } } } return View("SPC002C", model); } diff --git a/AMESCoreStudio.Web/Controllers/WHSController.cs b/AMESCoreStudio.Web/Controllers/WHSController.cs index 0d639c8c..157db5b0 100644 --- a/AMESCoreStudio.Web/Controllers/WHSController.cs +++ b/AMESCoreStudio.Web/Controllers/WHSController.cs @@ -97,6 +97,7 @@ namespace AMESCoreStudio.Web.Controllers var UnitItems = new List(); for (int i = 0; i < result.Count; i++) { + UnitItems.Add(new SelectListItem(result[i].UnitName, result[i].UnitNo.ToString())); } ViewBag.FactoryUnit = UnitItems; @@ -108,7 +109,8 @@ namespace AMESCoreStudio.Web.Controllers var FactoryItems = new List(); for (int i = 0; i < result.Count; i++) { - FactoryItems.Add(new SelectListItem(result[i].FactoryNameCh, result[i].FactoryID.ToString())); + if (result[i].StatusNo == "A") //yiru add 2022-10-11 + FactoryItems.Add(new SelectListItem(result[i].FactoryNameCh, result[i].FactoryID.ToString())); } ViewBag.FactoryList = FactoryItems; } @@ -874,6 +876,20 @@ namespace AMESCoreStudio.Web.Controllers [HttpPost] public async Task WHS008CSaveAsync(SupportUser model) { + //製程單位 + await GetFactoryUnitsList2(); + //廠別 + await GetFactoryList(); + //線別 + await GetLineList(); + //站別 + await GetStationList(); + //班別 + GetClassList(); + //其他部門 + await GetDeptList(); + + if (ModelState.IsValid) { var Msg = string.Empty; @@ -918,9 +934,13 @@ namespace AMESCoreStudio.Web.Controllers } } - if (Msg != null) + if (!string.IsNullOrEmpty(Msg)) { + + + ModelState.AddModelError("error", Msg); + return View("WHS008C",model); } else { diff --git a/AMESCoreStudio.Web/Views/JIG/JIG004D.cshtml b/AMESCoreStudio.Web/Views/JIG/JIG004D.cshtml index 4560266a..16ae1273 100644 --- a/AMESCoreStudio.Web/Views/JIG/JIG004D.cshtml +++ b/AMESCoreStudio.Web/Views/JIG/JIG004D.cshtml @@ -1,7 +1,7 @@ @model AMESCoreStudio.WebApi.Models.AMES.OutfitInfo -@{ ViewData["Title"] = "JIG004D"; +@{ ViewData["Title"] = "SPC004D"; Layout = "~/Views/Shared/_FormLayout.cshtml"; } @@ -57,8 +57,6 @@ - -
@@ -70,6 +68,7 @@
+ @Html.ValidationMessage("error")
@@ -83,17 +82,17 @@ @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); await Html.RenderPartialAsync("_FileinputScriptsPartial"); } - + + } diff --git a/AMESCoreStudio.Web/Views/JIG/JIG004U.cshtml b/AMESCoreStudio.Web/Views/JIG/JIG004U.cshtml index 546f47e0..0bca30dc 100644 --- a/AMESCoreStudio.Web/Views/JIG/JIG004U.cshtml +++ b/AMESCoreStudio.Web/Views/JIG/JIG004U.cshtml @@ -65,13 +65,13 @@ @* yiru 2022-09-19 *@
-
- - - -
+
+ + + @* yiru 2022-10-11 *@ +