From 932e04179b98441d9d549c987d2668858ae42b2d Mon Sep 17 00:00:00 2001 From: Marvin Date: Sun, 12 Mar 2023 23:07:41 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=E6=B8=85=E7=B7=9A=E4=BD=9C?= =?UTF-8?q?=E6=A5=ADPCS037?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 312 ++++++++++++++++++ AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs | 75 +++++ AMESCoreStudio.Web/Views/PCS/PCS037.cshtml | 152 +++++++++ AMESCoreStudio.Web/Views/PCS/PCS037C.cshtml | 53 +++ AMESCoreStudio.Web/Views/PCS/PCS037L.cshtml | 119 +++++++ AMESCoreStudio.Web/Views/PCS/PCS037LC.cshtml | 96 ++++++ AMESCoreStudio.Web/Views/PCS/PCS037LU.cshtml | 99 ++++++ AMESCoreStudio.Web/Views/PCS/PCS037U.cshtml | 59 ++++ AMESCoreStudio.WebApi/Models/AMESContext.cs | 10 + 9 files changed, 975 insertions(+) create mode 100644 AMESCoreStudio.Web/Views/PCS/PCS037.cshtml create mode 100644 AMESCoreStudio.Web/Views/PCS/PCS037C.cshtml create mode 100644 AMESCoreStudio.Web/Views/PCS/PCS037L.cshtml create mode 100644 AMESCoreStudio.Web/Views/PCS/PCS037LC.cshtml create mode 100644 AMESCoreStudio.Web/Views/PCS/PCS037LU.cshtml create mode 100644 AMESCoreStudio.Web/Views/PCS/PCS037U.cshtml diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 30c0b3de..1f224893 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -8321,6 +8321,318 @@ namespace AMESCoreStudio.Web.Controllers return (Msg, model); } #endregion + + #region PCS037 清線作業 + + /// + /// + /// + /// + public IActionResult PCS037() + { + return View(); + } + + public IActionResult PCS037C() + { + return View(); + } + + //修改页面 + [HttpGet] + public async Task PCS037UAsync(int id) + { + var result = await _pcsApi.GetWipClear(id); + + if (result.Count == 0) + { + return View(); + } + return View(result[0]); + } + + //维护明细页面 + [HttpGet] + public ActionResult PCS037L(string wipNO, int clearID) + { + ViewBag.ClearID = clearID; + return View(); + } + + //新增明细页面 + [HttpGet] + public async Task PCS037LCAsync(int id) + { + ViewBag.ClearID = id; + + var wip_clear = await _pcsApi.GetWipClear(id); + + int wip_id = wip_clear[0].WipID; + + var wip_info = await _pcsApi.GetWipInfo(wip_id); + + int flow_rule_id = wip_info[0].FlowRuleID; + + await GetRuleStationByFlowRuleID(flow_rule_id); + + return View(); + } + + //修改明細页面 + [HttpGet] + public async Task PCS037LUAsync(int id) + { + var result = await _pcsApi.GetWipClearDetail(id); + + var wip_clear = await _pcsApi.GetWipClear(result[0].ClearID); + + int wip_id = wip_clear[0].WipID; + + var wip_info = await _pcsApi.GetWipInfo(wip_id); + + int flow_rule_id = wip_info[0].FlowRuleID; + + await GetRuleStationByFlowRuleID(flow_rule_id); + + if (result.Count == 0) + { + return View(); + } + return View(result[0]); + } + + public async Task PCS037LDAsync(int id) + { + var result = await _pcsApi.DeleteWipClearDetail(id); + return Json(new Result() { success = true, msg = "" }); + } + + [ResponseCache(Duration = 0)] + [HttpGet] + public async Task GetWipClearDetailsAsync(int id, int page = 0, int limit = 10) + { + var result = await _pcsApi.GetWipClearDetailByClear(id, page, limit); + + if (result.DataTotal > 0) + { + return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); + } + + return Json(new Table() { count = 0, data = null }); + } + + [ResponseCache(Duration = 0)] + [HttpGet] + public async Task GetWipClearsAsync(int page = 0, int limit = 10) + { + var result = await _pcsApi.GetWipClears(page, limit); + + if (result.DataTotal > 0) + { + return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); + } + + return Json(new Table() { count = 0, data = null }); + } + + + [HttpPost] + public async Task PCS037CSaveAsync(WipClear model, string wipNO) + { + var userID = ""; + HttpContext.Request.Cookies.TryGetValue("UserID", out userID); + int user_id = 0; + if (userID != null) + { + if (int.Parse(userID.ToString()) >= 0) + { + user_id = int.Parse(userID.ToString()); + } + } + + if (wipNO != "") + { + int wipID = 0; + + var wip_info = await _pcsApi.GetWipInfoByWipNO(wipNO); + if (wip_info.Count == 0) + { + ModelState.AddModelError("error", "查無工單號碼"); + return View("PCS037C", model); + } + else + { + wipID = wip_info[0].WipID; + model.WipID = wipID; + model.ClearNo = ""; + model.DetailQty = 0; + model.CreateUserID = user_id; + model.CreateDate = DateTime.Now; + model.UpdateUserID = user_id; + model.UpdateDate = DateTime.Now; + + + IResultModel result; + + result = await _pcsApi.PostWipClear(JsonConvert.SerializeObject(model)); + + if (result.Success) + { + var _msg = "添加成功!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + else + { + ModelState.AddModelError("error", result.Msg); + return View("PCS037C", model); + } + } + } + else + { + ModelState.AddModelError("error", "工單號碼不可空白"); + return View("PCS037C", model); + } + } + + [HttpPost] + public async Task PCS037LUSaveAsync(WipClearDetail model) + { + var userID = ""; + HttpContext.Request.Cookies.TryGetValue("UserID", out userID); + int user_id = 0; + if (userID != null) + { + if (int.Parse(userID.ToString()) >= 0) + { + user_id = int.Parse(userID.ToString()); + } + } + + if (ModelState.IsValid) + { + IResultModel result; + + result = await _pcsApi.PutWipClearDetail(model.ClearDetailID, JsonConvert.SerializeObject(model)); + + if (result.Success) + { + var _msg = "修改成功!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + else + { + ModelState.AddModelError("error", result.Msg); + return View("PCS037LU", model); + } + + } + else + { + ModelState.AddModelError("error", "缺少必填資料"); + return View("PCS037LU", model); + } + } + + + [HttpPost] + public async Task PCS037USaveAsync(WipClear model) + { + var userID = ""; + HttpContext.Request.Cookies.TryGetValue("UserID", out userID); + int user_id = 0; + if (userID != null) + { + if (int.Parse(userID.ToString()) >= 0) + { + user_id = int.Parse(userID.ToString()); + } + } + + if (model.HeadmanCheckFlag == "on") + { + model.HeadmanCheckFlag = "Y"; + model.HeadmanUserID = user_id; + model.UpdateUserID = user_id; + } + + if (model.DirectorCheckFlag == "on") + { + model.DirectorCheckFlag = "Y"; + model.DirectorUserID = user_id; + model.UpdateUserID = user_id; + } + + if (ModelState.IsValid) + { + IResultModel result; + + result = await _pcsApi.PutWipClear(model.ClearID, JsonConvert.SerializeObject(model)); + + if (result.Success) + { + var _msg = "確認成功!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + else + { + ModelState.AddModelError("error", result.Msg); + return View("PCS037U", model); + } + + } + else + { + ModelState.AddModelError("error", "缺少必填資料"); + return View("PCS037U", model); + } + } + + [HttpPost] + public async Task PCS037LCSaveAsync(WipClearDetail model) + { + var userID = ""; + HttpContext.Request.Cookies.TryGetValue("UserID", out userID); + int user_id = 0; + if (userID != null) + { + if (int.Parse(userID.ToString()) >= 0) + { + user_id = int.Parse(userID.ToString()); + } + } + + model.CreateUserID = user_id; + model.CreateDate = DateTime.Now; + model.UpdateUserID = user_id; + model.UpdateDate = DateTime.Now; + + if (ModelState.IsValid) + { + IResultModel result; + + result = await _pcsApi.PostWipClearDetail(JsonConvert.SerializeObject(model)); + + if (result.Success) + { + var _msg = "新增明細成功!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + else + { + ModelState.AddModelError("error", result.Msg); + return View("PCS037LC", model); + } + + } + else + { + ModelState.AddModelError("error", "缺少必填資料"); + return View("PCS037LC", model); + } + } + + #endregion } public static class ObjectExtension diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 15eb4697..0cacbe7f 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -1447,5 +1447,80 @@ namespace AMESCoreStudio.Web /// [WebApiClient.Attributes.HttpPost("api/UnbindExtraBarcode")] ITask> PostUnbindExtraBarcode([FromBody, RawJsonContent] string model); + + #region 清線作業 + + /// + /// 查詢全部清線資料 + /// + /// + [WebApiClient.Attributes.HttpGet("api/WipClears")] + ITask> GetWipClears(int page, int limit); + + /// + /// 新增清線資料 + /// + /// + [WebApiClient.Attributes.HttpPost("api/WipClears")] + ITask> PostWipClear([FromBody, RawJsonContent] string model); + + /// + /// 根據ID獲取指定清線資料 + /// + /// + [WebApiClient.Attributes.HttpGet("api/WipClears/{id}")] + ITask> GetWipClear(int id); + + /// + /// 刪除清線資料 + /// + /// + [WebApiClient.Attributes.HttpDelete("api/WipClears/{id}")] + ITask> DeleteWipClear(int id); + + /// + /// 更新清線資料 + /// + /// + [WebApiClient.Attributes.HttpPut("api/WipClears/{id}")] + ITask> PutWipClear(int id, [FromBody, RawJsonContent] string model); + + + /// + /// 根据ID查詢清線明细資料 + /// + /// + [WebApiClient.Attributes.HttpGet("api/WipClearDetails/Clear/{id}")] + ITask> GetWipClearDetailByClear(int id, int page, int limit); + + /// + /// 新增清線明細資料 + /// + /// + [WebApiClient.Attributes.HttpPost("api/WipClearDetails")] + ITask> PostWipClearDetail([FromBody, RawJsonContent] string model); + + /// + /// 刪除清線明細資料 + /// + /// + [WebApiClient.Attributes.HttpDelete("api/WipClearDetails/{id}")] + ITask> DeleteWipClearDetail(int id); + + /// + /// 根据ID查詢清線明细資料 + /// + /// + [WebApiClient.Attributes.HttpGet("api/WipClearDetails/{id}")] + ITask> GetWipClearDetail(int id); + + /// + /// 更新清線資料 + /// + /// + [WebApiClient.Attributes.HttpPut("api/WipClearDetails/{id}")] + ITask> PutWipClearDetail(int id, [FromBody, RawJsonContent] string model); + + #endregion } } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS037.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS037.cshtml new file mode 100644 index 00000000..d0e07f4a --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS037.cshtml @@ -0,0 +1,152 @@ +@{ + ViewData["Title"] = "清線作業"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + + + +
+
+
+
+
@ViewBag.Title
+
+
+
+
+
+
+
+ +@section Scripts{ + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCS/PCS037C.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS037C.cshtml new file mode 100644 index 00000000..e7f3ba59 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS037C.cshtml @@ -0,0 +1,53 @@ +@model AMESCoreStudio.WebApi.Models.AMES.WipClear + + +@{ ViewData["Title"] = "PCS037C"; + Layout = "~/Views/Shared/_FormLayout.cshtml"; } + + + + +
+
+
+
+ +
+ + +
+ @Html.ValidationMessage("error") +
+ +
+ +
+
+
+ +@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + + + +} + diff --git a/AMESCoreStudio.Web/Views/PCS/PCS037L.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS037L.cshtml new file mode 100644 index 00000000..a97e2a29 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS037L.cshtml @@ -0,0 +1,119 @@ +@{ + ViewData["Title"] = "清線明細維護"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + +
+
+
+
+
@ViewBag.Title
+ +
+
+
+
+
+ +
+
+ +@section Scripts{ + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCS/PCS037LC.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS037LC.cshtml new file mode 100644 index 00000000..8353d27b --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS037LC.cshtml @@ -0,0 +1,96 @@ +@model AMESCoreStudio.WebApi.Models.AMES.WipClearDetail + + +@{ ViewData["Title"] = "PCS037LC"; + Layout = "~/Views/Shared/_FormLayout.cshtml"; } + + + + +
+
+
+
+ + + +
+ + + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+ @Html.ValidationMessage("error") +
+ +
+ +
+
+
+ +@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + + + +} + diff --git a/AMESCoreStudio.Web/Views/PCS/PCS037LU.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS037LU.cshtml new file mode 100644 index 00000000..46d44004 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS037LU.cshtml @@ -0,0 +1,99 @@ +@model AMESCoreStudio.WebApi.Models.AMES.WipClearDetail + + +@{ ViewData["Title"] = "PCS037LC"; + Layout = "~/Views/Shared/_FormLayout.cshtml"; } + + + + +
+
+
+
+ + + + + + +
+ + + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+ @Html.ValidationMessage("error") +
+ +
+ +
+
+
+ +@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + + + +} + diff --git a/AMESCoreStudio.Web/Views/PCS/PCS037U.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS037U.cshtml new file mode 100644 index 00000000..3dce5d89 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS037U.cshtml @@ -0,0 +1,59 @@ +@model AMESCoreStudio.WebApi.Models.AMES.WipClear +@{ + ViewData["Title"] = "BAS001U"; + Layout = "~/Views/Shared/_FormLayout.cshtml"; +} + + + +
+
+
+
+ + + + + + + + + +
+ + + +
+ +
+ + + +
+
+ +
+ +
+
+
+ +@section Scripts { + @{ + await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); + } + + +} diff --git a/AMESCoreStudio.WebApi/Models/AMESContext.cs b/AMESCoreStudio.WebApi/Models/AMESContext.cs index fc52a4f3..32cc0cb7 100644 --- a/AMESCoreStudio.WebApi/Models/AMESContext.cs +++ b/AMESCoreStudio.WebApi/Models/AMESContext.cs @@ -924,6 +924,16 @@ namespace AMESCoreStudio.WebApi /// 出貨序號規則-明細 /// public DbSet SerialRuleDetails { get; set; } + + /// + /// 清線資料 + /// + public DbSet WipClears { get; set; } + + /// + /// 清線明細資料 + /// + public DbSet WipClearDetails { get; set; } } }