diff --git a/AMESCoreStudio.Web/Controllers/JIGController.cs b/AMESCoreStudio.Web/Controllers/JIGController.cs index e07ea497..f08a9fc6 100644 --- a/AMESCoreStudio.Web/Controllers/JIGController.cs +++ b/AMESCoreStudio.Web/Controllers/JIGController.cs @@ -120,7 +120,6 @@ namespace AMESCoreStudio.Web.Controllers var result = await _sysApi.GetDeptInfoes(); var DeptItems = new List(); - DeptItems.Add(new SelectListItem("N/A", "0")); for (int i = 0; i < result.Count; i++) { DeptItems.Add(new SelectListItem(result[i].DeptName, result[i].DeptID.ToString())); @@ -132,7 +131,6 @@ namespace AMESCoreStudio.Web.Controllers var result = await _sysApi.GetUserInfoes(); var UserItems = new List(); - UserItems.Add(new SelectListItem("N/A", "-1")); for (int i = 0; i < result.Count; i++) { UserItems.Add(new SelectListItem(result[i].UserName, result[i].UserID.ToString())); @@ -626,7 +624,7 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Table() { count = 0, data = null }); } - public async Task GetOutfitInfoesByQueryAsync(int TypeFlag, int CommodityID, int VarityID, string Status, string QANo, string PartNo) + public async Task GetOutfitInfoesByQueryAsync(int TypeFlag, int CommodityID, int VarityID, string Status, string QANo, string PartNo, string UseStatus) { @@ -635,7 +633,7 @@ namespace AMESCoreStudio.Web.Controllers if (string.IsNullOrWhiteSpace(QANo)) QANo = "*"; - var result = await _jigApi.GetOutfitInfoesByQuery( TypeFlag, CommodityID, VarityID, Status, QANo, PartNo); + var result = await _jigApi.GetOutfitInfoesByQuery( TypeFlag, CommodityID, VarityID, Status, QANo, PartNo, UseStatus); if (result.Count > 0) { @@ -647,6 +645,264 @@ namespace AMESCoreStudio.Web.Controllers #endregion + #region JIG005設備領用/歸還相關 + public IActionResult JIG005() + { + return View(); + } + [HttpGet] + public async Task JIG005BAsync(int id) + { + var result = await _jigApi.GetOutfitInfo(id); + await GetDeptList(); + await GetUserInfo(); + ViewBag.OutfitID = id; + ViewBag.OutfitNo = result[0].OutfitNo; + ViewBag.QANo = result[0].QANo; + GetUserID(); + return View(); + } + public async Task JIG005RAsync(int id) + { + var result = await _jigApi.GetOutfitInfo(id); + await GetDeptList(); + await GetUserInfo(); + ViewBag.StatusDate = System.DateTime.Now.ToString("yyyy-MM-dd"); + ViewBag.OutfitID = id; + ViewBag.OutfitNo = result[0].OutfitNo; + ViewBag.QANo = result[0].QANo; + GetUserID(); + return View(); + + } + public async Task JIG005VAsync(int id) + { + var result = await _jigApi.GetOutfitInfo(id); + ViewBag.OutfitID = id; + + if (result.Count == 0) + { + return View(); + } + + return View(result[0]); + } + [HttpPost] + public async Task JIG005RSaveAsync(OutfitStatusLog model) + { + if (ModelState.IsValid) + { + IResultModel result; + IResultModel result1; + var OutfitInfo = await _jigApi.GetOutfitInfo(model.OutfitID); + var modi = OutfitInfo[0]; + modi.UseStatusNo = "R"; + modi.Custondian = model.StatusUserID; + result1 = await _jigApi.PutOutfitInfo(model.OutfitID, JsonConvert.SerializeObject(modi)); + if (result1.Success) + { + result = await _jigApi.PostOutfitStatusLog(JsonConvert.SerializeObject(model)); + + if (result.Success) + { + var _msg = "歸還成功!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + else + { + if (result.Errors.Count > 0) + { + ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); + } + else + { + ModelState.AddModelError("error", result.Msg); + } + } + } + } + return View("JIG005R", model); + } + public async Task JIG005BSaveAsync(OutfitStatusLog model) + { + if (ModelState.IsValid) + { + IResultModel result; + IResultModel result1; + var OutfitInfo = await _jigApi.GetOutfitInfo(model.OutfitID); + var modi = OutfitInfo[0]; + modi.UseStatusNo = "B"; + modi.Custondian = model.StatusUserID; + result1 = await _jigApi.PutOutfitInfo(model.OutfitID, JsonConvert.SerializeObject(modi)); + if (result1.Success) + { + result = await _jigApi.PostOutfitStatusLog(JsonConvert.SerializeObject(model)); + + if (result.Success) + { + var _msg = "領用成功!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + else + { + if (result.Errors.Count > 0) + { + ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); + } + else + { + ModelState.AddModelError("error", result.Msg); + } + } + } + } + return View("JIG005B", model); + } + + [ResponseCache(Duration = 0)] + [HttpGet] + public async Task GetOutfitStatusLogsAsync() + { + var result = await _jigApi.GetOutfitVendorInfoes(); + + if (result.Count > 0) + { + return Json(new Table() { code = 0, msg = "", data = result, count = result.Count }); + } + + return Json(new Table() { count = 0, data = null }); + } + public async Task GetOutfitStatusLogByOutfitIDAsync(int id) + { + var result = await _jigApi.GetOutfitStatusLogByOutfitID(id); + + if (result.Count > 0) + { + return Json(new Table() { code = 0, msg = "", data = result, count = result.Count }); + } + + return Json(new Table() { count = 0, data = null }); + } + + #endregion + + #region JIG006設備送修/報廢相關 + public IActionResult JIG006() + { + return View(); + } + [HttpGet] + public async Task JIG006SAsync(int id) + { + var result = await _jigApi.GetOutfitInfo(id); + await GetDeptList(); + await GetUserInfo(); + ViewBag.StatusDate = System.DateTime.Now.ToString("yyyy-MM-dd"); + ViewBag.OutfitID = id; + ViewBag.OutfitNo = result[0].OutfitNo; + ViewBag.QANo = result[0].QANo; + GetUserID(); + return View(); + } + public async Task JIG006FAsync(int id) + { + var result = await _jigApi.GetOutfitInfo(id); + await GetDeptList(); + await GetUserInfo(); + ViewBag.CreateDate = System.DateTime.Now.ToString("yyyy-MM-dd"); + ViewBag.OutfitID = id; + ViewBag.OutfitNo = result[0].OutfitNo; + ViewBag.QANo = result[0].QANo; + GetUserID(); + return View(); + + } + [HttpPost] + public async Task JIG006SSaveAsync(OutfitStatusLog model) + { + if (ModelState.IsValid) + { + IResultModel result; + IResultModel result1; + var OutfitInfo = await _jigApi.GetOutfitInfo(model.OutfitID); + var modi = OutfitInfo[0]; + modi.UseStatusNo = "S"; + modi.StatusNo = "S"; + modi.Custondian = model.StatusUserID; + result1 = await _jigApi.PutOutfitInfo(model.OutfitID, JsonConvert.SerializeObject(modi)); + if (result1.Success) + { + result = await _jigApi.PostOutfitStatusLog(JsonConvert.SerializeObject(model)); + + if (result.Success) + { + var _msg = "報廢完成!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + else + { + if (result.Errors.Count > 0) + { + ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); + } + else + { + ModelState.AddModelError("error", result.Msg); + } + } + } + } + return View("JIG006S", model); + } + public async Task JIG006FSaveAsync(OutfitStatusLog model) + { + if (ModelState.IsValid) + { + IResultModel result; + IResultModel result1; + var OutfitInfo = await _jigApi.GetOutfitInfo(model.OutfitID); + var modi = OutfitInfo[0]; + modi.UseStatusNo = "F"; + modi.Custondian = model.StatusUserID; + result1 = await _jigApi.PutOutfitInfo(model.OutfitID, JsonConvert.SerializeObject(modi)); + if (result1.Success) + { + result = await _jigApi.PostOutfitStatusLog(JsonConvert.SerializeObject(model)); + + if (result.Success) + { + var _msg = "送修成功!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + else + { + if (result.Errors.Count > 0) + { + ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); + } + else + { + ModelState.AddModelError("error", result.Msg); + } + } + } + } + return View("JIG006F", model); + } + public async Task GetOutfitStatusLogDtoByOutfitIDAsync(int id) + { + var result = await _jigApi.GetOutfitStatusLogDtoByOutfitID(id); + + if (result.Count > 0) + { + return Json(new Table() { code = 0, msg = "", data = result, count = result.Count }); + } + + return Json(new Table() { count = 0, data = null }); + } + + + #endregion diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IJIG.cs b/AMESCoreStudio.Web/HttpApis/AMES/IJIG.cs index 5c0d6c54..c2dccab8 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IJIG.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IJIG.cs @@ -160,13 +160,6 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpPut("api/OutfitInfoes/{id}")] ITask> PutOutfitInfo(int id, [FromBody, RawJsonContent] string model); - /// - /// 更新設備基本數據 - /// - /// - [WebApiClient.Attributes.HttpPut("api/InspectionResultDetails/{id}")] - ITask> PutInspectionResultDetail(int id, [FromBody, RawJsonContent] string model); - /// /// 刪除設備基本數據 @@ -193,45 +186,49 @@ namespace AMESCoreStudio.Web /// 根据設備基本數據 /// /// - [WebApiClient.Attributes.HttpGet("api/OutfitInfoes/Query/{TypeFlag}/{CommodityID}/{VarityID}/{Status}/{QANo}/{PartNo}")] - ITask> GetOutfitInfoesByQuery(int TypeFlag, int CommodityID, int VarityID, string Status, string QANo, string PartNo); + [WebApiClient.Attributes.HttpGet("api/OutfitInfoes/Query/{TypeFlag}/{CommodityID}/{VarityID}/{Status}/{QANo}/{PartNo}/{UseStatus}")] + ITask> GetOutfitInfoesByQuery(int TypeFlag, int CommodityID, int VarityID, string Status, string QANo, string PartNo, string UseStatus); #endregion - - - #region JIG006 巡檢結果維護 + #region JIG005 設備狀態紀錄維護 /// - /// 新增巡檢結果Detail + /// 新增設備狀態紀錄 /// /// - [WebApiClient.Attributes.HttpPost("api/InspectionResultDetails")] - ITask> PostInspectionResultDetail([FromBody, RawJsonContent] string model); + [WebApiClient.Attributes.HttpPost("api/OutfitStatusLogs")] + ITask> PostOutfitStatusLog([FromBody, RawJsonContent] string model); /// - /// 新增巡檢結果Blob + /// 更新設備狀態紀錄 /// /// - [WebApiClient.Attributes.HttpPost("api/InspectionResultBlobs")] - ITask> PostInspectionResultBlob([FromBody, RawJsonContent] string model); + [WebApiClient.Attributes.HttpPut("api/OutfitStatusLogs/{id}")] + ITask> PutOutfitStatusLog(int id, [FromBody, RawJsonContent] string model); + /// - /// 獲取指定巡檢表單Blob資料By Query + /// 根據ID獲取指定設備狀態紀錄 /// /// - [WebApiClient.Attributes.HttpGet("api/InspectionResultBlobs/Query/{id}/{itemID}")] - ITask> GetInspectionResultBlobsByQuery(int id, int itemID); + [WebApiClient.Attributes.HttpGet("api/OutfitStatusLogs/{id}")] + ITask> GetOutfitStatusLog(int id); /// - /// 根據ID獲取指定巡檢結果Details + /// 根據OutfitID獲取指定設備狀態紀錄 /// /// - [WebApiClient.Attributes.HttpGet("api/InspectionResultDetails/{id}")] - ITask> GetInspectionResultDetails(int id); + [WebApiClient.Attributes.HttpGet("api/OutfitStatusLogs/Outfit/{id}")] + ITask> GetOutfitStatusLogByOutfitID(int id); - + /// + /// 根據OutfitID獲取指定設備狀態紀錄 + /// + /// + [WebApiClient.Attributes.HttpGet("api/OutfitStatusLogs/OutfitDto/{id}")] + ITask> GetOutfitStatusLogDtoByOutfitID(int id); #endregion diff --git a/AMESCoreStudio.Web/Views/BAS/BAS007.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS007.cshtml index e4221e3b..f5f806fa 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS007.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS007.cshtml @@ -54,7 +54,7 @@ //通过行tool删除,lay-event="del" function del(obj) { if (obj.data.typeNo) { - hg.confirm("系統:" + obj.data.unitName + ",确定要删除吗?", function () { + hg.confirm("系統:" + obj.data.typeDesc + ",确定要删除吗?", function () { $.ajax({ url: '/BAS/BAS007D', data: { id: obj.data.typeNo }, diff --git a/AMESCoreStudio.Web/Views/JIG/JIG004.cshtml b/AMESCoreStudio.Web/Views/JIG/JIG004.cshtml index 17942a31..506ee342 100644 --- a/AMESCoreStudio.Web/Views/JIG/JIG004.cshtml +++ b/AMESCoreStudio.Web/Views/JIG/JIG004.cshtml @@ -285,7 +285,7 @@ //基本数据表格 function tt() { table = hg.table.datatable('test', '設備規格維護', - '/JIG/GetOutfitInfoesByQuery?TypeFlag=' + $("#TypeFlag").val() + '&CommodityID=' + $("#Commodity").val() + '&VarityID=' + $("#Varity").val() + '&Status=' + $("#Status").val() + '&QANo=' + $("#QANo").val() + '&PartNo=' + $("#PartNo").val() + '/JIG/GetOutfitInfoesByQuery?TypeFlag=' + $("#TypeFlag").val() + '&CommodityID=' + $("#Commodity").val() + '&VarityID=' + $("#Varity").val() + '&Status=' + $("#Status").val() + '&QANo=' + $("#QANo").val() + '&PartNo=' + $("#PartNo").val() + '&UseStatus=*' , {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); } diff --git a/AMESCoreStudio.Web/Views/JIG/JIG004C.cshtml b/AMESCoreStudio.Web/Views/JIG/JIG004C.cshtml index b9aceb3a..75b3f679 100644 --- a/AMESCoreStudio.Web/Views/JIG/JIG004C.cshtml +++ b/AMESCoreStudio.Web/Views/JIG/JIG004C.cshtml @@ -21,6 +21,7 @@ +
@@ -41,7 +42,7 @@ - +
@@ -110,7 +111,7 @@
-
+ @*
@@ -119,7 +120,7 @@ -
+
*@
diff --git a/AMESCoreStudio.Web/Views/JIG/JIG004U.cshtml b/AMESCoreStudio.Web/Views/JIG/JIG004U.cshtml index 18c0075d..1e07ef55 100644 --- a/AMESCoreStudio.Web/Views/JIG/JIG004U.cshtml +++ b/AMESCoreStudio.Web/Views/JIG/JIG004U.cshtml @@ -20,7 +20,8 @@ - + +
@@ -42,7 +43,7 @@ - +
@@ -111,95 +112,95 @@
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
- @Html.ValidationMessage("error") -
- -
- - -
- - -@section Scripts { - @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); - await Html.RenderPartialAsync("_FileinputScriptsPartial"); } - - + }); + + + $("#CommodityID").change(function () { + var data = $("#CommodityID").val(); + getVarityByCommodityID(data); + }); + function getVarityByCommodityID(data) { + $.ajax({ + url: "/JIG/GetOutfitVarityInfoesByQuery?TypeFlag=*&CommodityID=" + data + "&Status=A", + dataType: 'json', + //data: { id: data }, + contentType: "application/json", + type: 'get', + success: function (result) { + if (result.data) { + $("#Variety").empty(); + var count = 0; + $('#Variety').append(new Option("全部", "-99")); + $.each(result.data, function (index, item) { + $('#Variety').append(new Option(item.varityName, item.varityID)); + count = count + 1; + }); + if (count == 0) { + $("#Variety").empty(); + $('#Variety').append(new Option("無選項", "")); + + } + } + else { + $("#Variety").empty(); + $('#Variety').append(new Option("無選項", "")); + } + layui.form.render("select"); + } + }); + }; + -} + } diff --git a/AMESCoreStudio.Web/Views/JIG/JIG005.cshtml b/AMESCoreStudio.Web/Views/JIG/JIG005.cshtml new file mode 100644 index 00000000..8a478b03 --- /dev/null +++ b/AMESCoreStudio.Web/Views/JIG/JIG005.cshtml @@ -0,0 +1,218 @@ +@{ + ViewData["Title"] = "設備領用/歸還"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + +
+
+
+
+
@ViewBag.Title
+
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+
+
+ +@section Scripts{ + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/JIG/JIG005B.cshtml b/AMESCoreStudio.Web/Views/JIG/JIG005B.cshtml new file mode 100644 index 00000000..620de556 --- /dev/null +++ b/AMESCoreStudio.Web/Views/JIG/JIG005B.cshtml @@ -0,0 +1,119 @@ +@model AMESCoreStudio.WebApi.Models.AMES.OutfitStatusLog + + +@{ ViewData["Title"] = "SPC005B"; + Layout = "~/Views/Shared/_FormLayout.cshtml"; } + + + + +
+
+
+
+ + + + + + + + +
+ + +
+
+ + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+ @Html.ValidationMessage("error") +
+ +
+ +
+
+
+ +@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + + + +} + diff --git a/AMESCoreStudio.Web/Views/JIG/JIG005R.cshtml b/AMESCoreStudio.Web/Views/JIG/JIG005R.cshtml new file mode 100644 index 00000000..e5b4030c --- /dev/null +++ b/AMESCoreStudio.Web/Views/JIG/JIG005R.cshtml @@ -0,0 +1,114 @@ +@model AMESCoreStudio.WebApi.Models.AMES.OutfitStatusLog + + +@{ ViewData["Title"] = "SPC005R"; + Layout = "~/Views/Shared/_FormLayout.cshtml"; } + + + + +
+
+
+
+ + + + + + + + +
+ + +
+
+ + +
+
+ + + +
+
+ + + +
+
+ + + +
+ @Html.ValidationMessage("error") +
+ +
+ +
+
+
+ +@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + + + +} + diff --git a/AMESCoreStudio.Web/Views/JIG/JIG005V.cshtml b/AMESCoreStudio.Web/Views/JIG/JIG005V.cshtml new file mode 100644 index 00000000..ef03f565 --- /dev/null +++ b/AMESCoreStudio.Web/Views/JIG/JIG005V.cshtml @@ -0,0 +1,156 @@ +@model AMESCoreStudio.WebApi.Models.AMES.OutfitInfo + + +@{ ViewData["Title"] = "JIG005V"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; } + + + +
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+
+ +@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + + + +} + diff --git a/AMESCoreStudio.Web/Views/JIG/JIG006.cshtml b/AMESCoreStudio.Web/Views/JIG/JIG006.cshtml new file mode 100644 index 00000000..dfd87ac5 --- /dev/null +++ b/AMESCoreStudio.Web/Views/JIG/JIG006.cshtml @@ -0,0 +1,242 @@ +@{ + ViewData["Title"] = "設備基本數據維護"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + +
+
+
+
+
@ViewBag.Title
+
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+
+
+ +@section Scripts{ + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/JIG/JIG006F.cshtml b/AMESCoreStudio.Web/Views/JIG/JIG006F.cshtml new file mode 100644 index 00000000..9404f575 --- /dev/null +++ b/AMESCoreStudio.Web/Views/JIG/JIG006F.cshtml @@ -0,0 +1,118 @@ +@model AMESCoreStudio.WebApi.Models.AMES.OutfitStatusLog + + +@{ ViewData["Title"] = "SPC006F"; + Layout = "~/Views/Shared/_FormLayout.cshtml"; } + + + + +
+
+
+
+ + + + + + + +
+ + +
+
+ + + +
+
+ + +
+
+ + + +
+
+ + + +
+
+ + + +
+ @Html.ValidationMessage("error") +
+ +
+ +
+
+
+ +@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + + + +} + diff --git a/AMESCoreStudio.Web/Views/JIG/JIG006S.cshtml b/AMESCoreStudio.Web/Views/JIG/JIG006S.cshtml new file mode 100644 index 00000000..fd76cf7c --- /dev/null +++ b/AMESCoreStudio.Web/Views/JIG/JIG006S.cshtml @@ -0,0 +1,167 @@ +@model AMESCoreStudio.WebApi.Models.AMES.OutfitStatusLog + + +@{ ViewData["Title"] = "SPC006S"; + Layout = "~/Views/Shared/_FormLayout.cshtml"; } + + + + +
+
+
+
+ + + + + + + + +
+ + +
+
+ + +
+
+ + + +
ConfirmUserID +
+ + + +
+
+ + +
+
+ + + +
+
+ + + +
+
+ + + +
+ @Html.ValidationMessage("error") +
+ +
+ +
+
+
+ +@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + + + +} + diff --git a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml index 02b38d58..fe7c892c 100644 --- a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml +++ b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml @@ -2415,7 +2415,7 @@ - + @@ -2425,6 +2425,7 @@ + @@ -2449,6 +2450,66 @@ + + + 設備狀態紀錄維護 + + + + + 設備狀態紀錄維護 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 新增资料 + + + + + + + + + + + 工作群組維護 @@ -6133,6 +6194,66 @@ 更新日期 + + + MaterialKpDtp Select Dto + + + + + 料號KP_ID + + + + + 料號Name + + + + + KP料號名稱 + + + + + KP料號NO + + + + + KP料號NO + + + + + KP料號NO + + + + + 前置碼 + + + + + 站(前段) + + + + + 創建者ID + + + + + 創建日期 + + + + + 創建者ID + + 抽驗標準資料檔 DTO @@ -7420,6 +7541,11 @@ 治具資料檔 + + + 設備狀態紀錄資料檔 + + 條碼變更資料表 @@ -10639,6 +10765,11 @@ 狀態 + + + 使用狀態 + + 備註 @@ -10819,6 +10950,76 @@ 更新日期 + + + 設備記錄檔 + + + + + 設備狀態ID + + + + + 設備ID + + + + + 設備狀態 + + + + + 狀態人工號 + + + + + 狀態預計日期(送修/領用) + + + + + 備註 + + + + + 判定者 + + + + + 責任人/製程 + + + + + 原因 + + + + + 狀態數量 + + + + + 工單 + + + + + 創建者ID + + + + + 創建日期 + + 設備規格資料檔 diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/OutfitInfoesController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/OutfitInfoesController.cs index baa24682..bbb80029 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/OutfitInfoesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/OutfitInfoesController.cs @@ -77,10 +77,11 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// /// /// + /// /// // GET: api/OutfitInfoes/5 - [HttpGet("Query/{TypeFlag}/{CommodityID}/{VarityID}/{Status}/{QANo}/{PartNo}")] - public async Task>> GetOutfitInfoByQuery(int TypeFlag, int CommodityID, int VarityID, string Status, string QANo, string PartNo) + [HttpGet("Query/{TypeFlag}/{CommodityID}/{VarityID}/{Status}/{QANo}/{PartNo}/{UseStatus}")] + public async Task>> GetOutfitInfoByQuery(int TypeFlag, int CommodityID, int VarityID, string Status, string QANo, string PartNo, string UseStatus) { IQueryable q = _context.OutfitInfoes; @@ -106,6 +107,10 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES if (PartNo != "*") q = q.Where(p => p.PartNo.Equals(PartNo)); + if(UseStatus=="C") + q = q.Where(p => p.UseStatusNo != "F" || p.UseStatusNo != "S"); + + var OutfitInfo = await q.ToListAsync(); diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/OutfitStatusLogsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/OutfitStatusLogsController.cs new file mode 100644 index 00000000..a718f2f4 --- /dev/null +++ b/AMESCoreStudio.WebApi/Controllers/AMES/OutfitStatusLogsController.cs @@ -0,0 +1,261 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using AMESCoreStudio.WebApi; +using AMESCoreStudio.WebApi.Models.AMES; +using AMESCoreStudio.CommonTools.Result; +using AMESCoreStudio.WebApi.DTO.AMES; + +namespace AMESCoreStudio.WebApi.Controllers.AMES +{ + /// + /// 設備狀態紀錄維護 + /// + [Route("api/[controller]")] + [ApiController] + public class OutfitStatusLogsController : ControllerBase + { + private readonly AMESContext _context; + + /// + /// 設備狀態紀錄維護 + /// + /// + public OutfitStatusLogsController(AMESContext context) + { + _context = context; + } + + /// + /// + /// + /// + // GET: api/OutfitStatusLogs + [HttpGet] + public async Task>> GetOutfitStatusLog() + { + IQueryable q = _context.OutfitStatusLogs; + + q = q.OrderBy(p => p.OutfitLogID); + + var OutfitStatusLog = await q.ToListAsync(); + + return OutfitStatusLog; + } + + /// + /// + /// + /// + /// + // GET: api/OutfitStatusLogs/5 + [HttpGet("{id}")] + public async Task>> GetOutfitStatusLog(int id) + { + IQueryable q = _context.OutfitStatusLogs; + q = q.Where(p => p.OutfitLogID.Equals(id)); + + var OutfitStatusLog = await q.ToListAsync(); + + if (OutfitStatusLog == null) + { + return NotFound(); + } + + return OutfitStatusLog; + } + + /// + /// + /// + /// + /// + // GET: api/OutfitStatusLogs/5 + [HttpGet("Outfit/{id}")] + public async Task>> GetOutfitStatusLogByOutfitID(int id) + { + IQueryable q = _context.OutfitStatusLogs; + q = q.Where(p => p.OutfitID.Equals(id)); + + var OutfitStatusLog = await q.ToListAsync(); + + if (OutfitStatusLog == null) + { + return NotFound(); + } + + return OutfitStatusLog; + } + + /// + /// + /// + /// + /// + // GET: api/OutfitStatusLogs/5 + [HttpGet("OutfitDto/{id}")] + public async Task>> GetOutfitStatusLogDtoByOutfitID(int id) + { + IQueryable q = _context.OutfitStatusLogs; + q = q.Where(p => p.OutfitID.Equals(id)); + + var OutfitStatusLog = await q.ToListAsync(); + + if (OutfitStatusLog == null) + { + return NotFound(); + } + + var outfitStatusLogDtos = await q.Select(s => new OutfitStatusLogDto + { + OutfitID = _context.OutfitInfoes.Where(p1 => p1.OutfitID.Equals(s.OutfitID)).FirstOrDefault().QANo, + OutfitLogID = s.OutfitLogID, + CreateUserID = _context.UserInfoes.Where(p1 => p1.UserID.Equals(s.CreateUserID)).FirstOrDefault().UserName, + ConfirmUserID = _context.UserInfoes.Where(p1 => p1.UserID.Equals(s.ConfirmUserID)).FirstOrDefault().UserName, + StatusUserID = _context.UserInfoes.Where(p1 => p1.UserID.Equals(s.StatusUserID)).FirstOrDefault().UserName, + StatusDate = s.StatusDate.ToString("yyyy-MM-dd"), + Duty = s.Duty, + WipNo = s.WipNo, + StatusNo = s.StatusNo, + Remark = s.Remark, + CreateDate = s.CreateDate.ToString("yyyy-MM-dd") + }).ToListAsync(); + + return outfitStatusLogDtos; + + } + + /// + /// + /// + /// + /// + /// + // PUT: api/OutfitStatusLogs/5 + // To protect from overposting attacks, enable the specific properties you want to bind to, for + // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. + [HttpPut("{id}")] + public async Task> PutOutfitStatusLog(int id, [FromBody] OutfitStatusLog OutfitStatusLog) + { + ResultModel result = new ResultModel(); + if (id != OutfitStatusLog.OutfitLogID) + { + result.Success = false; + result.Msg = "序號錯誤"; + return result; + } + + _context.Entry(OutfitStatusLog).State = EntityState.Modified; + + try + { + await _context.SaveChangesAsync(); + } + catch (Exception ex) + { + + result.Success = false; + result.Msg = ex.Message; + return result; + + } + + result.Success = true; + result.Msg = "OK"; + return result; + } + + /// + /// 新增资料 + /// + /// + /// + // POST: api/OutfitStatusLogs + // To protect from overposting attacks, enable the specific properties you want to bind to, for + // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. + [HttpPost] + public async Task> PostOutfitStatusLog(OutfitStatusLog OutfitStatusLog) + { + ResultModel result = new ResultModel(); + Helper helper = new Helper(_context); + OutfitStatusLog.OutfitLogID = helper.GetIDKey("OUTFITLOG_ID").Result; + + _context.OutfitStatusLogs.Add(OutfitStatusLog); + + try + { + await _context.SaveChangesAsync(); + } + catch (Exception ex) + { + + result.Success = false; + result.Msg = ex.Message; + return result; + + } + + result.Success = true; + result.Msg = "OK"; + return result; + } + + /// + /// + /// + /// + /// + // DELETE: api/OutfitStatusLogs/5 + [HttpDelete("{id}")] + public async Task> DeleteOutfitStatusLog(int id) + { + ResultModel result = new ResultModel(); + var OutfitStatusLog = await _context.OutfitStatusLogs.Where(p => p.OutfitLogID == id).FirstOrDefaultAsync(); + if (OutfitStatusLog == null) + { + result.Success = false; + result.Msg = "序號錯誤"; + return result; + } + + //_context.OutfitStatusLogs.Remove(OutfitStatusLog); + + OutfitStatusLog newOutfitStatusLog = new OutfitStatusLog(); + newOutfitStatusLog = OutfitStatusLog; + + if (OutfitStatusLog.StatusNo == "A") + newOutfitStatusLog.StatusNo = "S"; + else + newOutfitStatusLog.StatusNo = "A"; + + _context.Entry(newOutfitStatusLog).State = EntityState.Modified; + + try + { + await _context.SaveChangesAsync(); + } + catch (Exception ex) + { + + result.Success = false; + result.Msg = ex.Message; + return result; + + } + + result.Success = true; + result.Msg = "OK"; + return result; + + } + + private bool OutfitStatusLogExists(int id) + { + return _context.OutfitStatusLogs.Any(e => e.OutfitLogID == id); + } + } +} diff --git a/AMESCoreStudio.WebApi/DTO/AMES/OutfitStatusLogDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/OutfitStatusLogDto.cs new file mode 100644 index 00000000..2a5d8a53 --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/OutfitStatusLogDto.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace AMESCoreStudio.WebApi.DTO.AMES +{ + public class OutfitStatusLogDtos + { + public List outfitStatusLogDtos { get; set; } + } + + /// + /// MaterialKpDtp Select Dto + /// + public class OutfitStatusLogDto + { + /// + /// 料號KP_ID + /// + + public int OutfitLogID { get; set; } + + /// + /// 料號Name + /// + + public string OutfitID { get; set; } + + /// + /// KP料號名稱 + /// + + public string StatusNo { get; set; } + + /// + /// KP料號NO + /// + + public string StatusUserID { get; set; } + + /// + /// KP料號NO + /// + + public string StatusDate { get; set; } + + /// + /// KP料號NO + /// + + public string Remark { get; set; } + + /// + /// 前置碼 + /// + + public string ConfirmUserID { get; set; } + + /// + /// 站(前段) + /// + + public string Duty { get; set; } + + /// + /// 創建者ID + /// + + public string CreateUserID { get; set; } + + /// + /// 創建日期 + /// + + public string WipNo { get; set; } + + /// + /// 創建者ID + /// + + public string CreateDate { get; set; } + + + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMES/OutfitInfo.cs b/AMESCoreStudio.WebApi/Models/AMES/OutfitInfo.cs index e7904c41..b0bce29d 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/OutfitInfo.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/OutfitInfo.cs @@ -62,6 +62,16 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Display(Name = "設備狀態")] public string StatusNo { get; set; } + /// + /// 使用狀態 + /// + [Column("USE_STATUS_NO")] + [StringLength(2)] + [DataMember] + [Required] + [Display(Name = "設備狀態")] + public string UseStatusNo { get; set; } + /// /// 備註 /// diff --git a/AMESCoreStudio.WebApi/Models/AMES/OutfitStatusLog.cs b/AMESCoreStudio.WebApi/Models/AMES/OutfitStatusLog.cs new file mode 100644 index 00000000..2d24cb15 --- /dev/null +++ b/AMESCoreStudio.WebApi/Models/AMES/OutfitStatusLog.cs @@ -0,0 +1,143 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; +using AMESCoreStudio.WebApi.Models.SYS; + +#nullable disable + +namespace AMESCoreStudio.WebApi.Models.AMES +{ + /// + /// 設備記錄檔 + /// + + [Table("OUTFIT_STATUS_LOG", Schema = "JHAMES")] + public partial class OutfitStatusLog + { + /// + /// 設備狀態ID + /// + [Key] + [Column("OUTFIT_LOG_ID")] + [DataMember] + [Required] + public int OutfitLogID { get; set; } + + /// + /// 設備ID + /// + [Column("OUTFIT_ID")] + [DataMember] + [Required] + [Display(Name = "使用設備")] + public int OutfitID { get; set; } + + /// + /// 設備狀態 + /// + [Column("STATUS_NO")] + [StringLength(2)] + [DataMember] + [Required] + [Display(Name = "設備狀態")] + public string StatusNo { get; set; }// + + + /// + /// 狀態人工號 + /// + [Column("STATUS_USERID")] + [DataMember] + [Required] + [Display(Name = "狀態人工號")] + public int StatusUserID { get; set; } + + /// + /// 狀態預計日期(送修/領用) + /// + [Column("STATUS_DATE")] + [DataMember] + [Required] + [Display(Name = "狀態預計日期")] + public DateTime StatusDate { get; set; } + + /// + /// 備註 + /// + [Column("REMARK")] + [StringLength(50)] + [DataMember] + [Display(Name = "備註")] + public string Remark { get; set; } + + /// + /// 判定者 + /// + [Column("CONFIRM_USERID")] + [DataMember] + [Display(Name = "判定者")] + public int ConfirmUserID { get; set; } + + /// + /// 責任人/製程 + /// + [Column("DUTY")] + [StringLength(300)] + [DataMember] + [Display(Name = "責任人/製程")] + public string Duty { get; set; } + + /// + /// 原因 + /// + [Column("REASON")] + [StringLength(100)] + [DataMember] + [Display(Name = "原因")] + public string Reason { get; set; } + + /// + /// 狀態數量 + /// + [Column("STATUS_QTY")] + [DataMember] + [Display(Name = "數量")] + public decimal StatusQty { get; set; } = 1; + + /// + /// 工單 + /// + [Column("WIP_NO")] + [StringLength(100)] + [DataMember] + [Display(Name = "工單")] + public string WipNo { get; set; } + + /// + /// 創建者ID + /// + [Column("CREATE_USERID")] + [DataMember] + public int CreateUserID { get; set; } = 0; + + /// + /// 創建日期 + /// + [Column("CREATE_DATE")] + [DataMember] + public DateTime CreateDate { get; set; } = System.DateTime.Now; + + /// + /// + /// + //[ForeignKey("StatusUserID")] + //public virtual UserInfo StatusUser { get; set; } + // + /// + /// + /// + //[ForeignKey("ConfirmUserID")] + //public virtual UserInfo ConfirmUser { get; set; } + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMESContext.cs b/AMESCoreStudio.WebApi/Models/AMESContext.cs index 84b14b15..2fcc9545 100644 --- a/AMESCoreStudio.WebApi/Models/AMESContext.cs +++ b/AMESCoreStudio.WebApi/Models/AMESContext.cs @@ -750,6 +750,12 @@ namespace AMESCoreStudio.WebApi /// PLM轉入料號說明 /// public virtual DbSet PlmMeterialInfos { get; set; } + /// + /// 設備狀態紀錄資料檔 + /// + public virtual DbSet OutfitStatusLogs { get; set; } + + } } diff --git a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml index 02b38d58..fe7c892c 100644 --- a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml +++ b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml @@ -2415,7 +2415,7 @@ - + @@ -2425,6 +2425,7 @@ + @@ -2449,6 +2450,66 @@ + + + 設備狀態紀錄維護 + + + + + 設備狀態紀錄維護 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 新增资料 + + + + + + + + + + + 工作群組維護 @@ -6133,6 +6194,66 @@ 更新日期 + + + MaterialKpDtp Select Dto + + + + + 料號KP_ID + + + + + 料號Name + + + + + KP料號名稱 + + + + + KP料號NO + + + + + KP料號NO + + + + + KP料號NO + + + + + 前置碼 + + + + + 站(前段) + + + + + 創建者ID + + + + + 創建日期 + + + + + 創建者ID + + 抽驗標準資料檔 DTO @@ -7420,6 +7541,11 @@ 治具資料檔 + + + 設備狀態紀錄資料檔 + + 條碼變更資料表 @@ -10639,6 +10765,11 @@ 狀態 + + + 使用狀態 + + 備註 @@ -10819,6 +10950,76 @@ 更新日期 + + + 設備記錄檔 + + + + + 設備狀態ID + + + + + 設備ID + + + + + 設備狀態 + + + + + 狀態人工號 + + + + + 狀態預計日期(送修/領用) + + + + + 備註 + + + + + 判定者 + + + + + 責任人/製程 + + + + + 原因 + + + + + 狀態數量 + + + + + 工單 + + + + + 創建者ID + + + + + 創建日期 + + 設備規格資料檔