diff --git a/AMESCoreStudio.Web/Controllers/REPController.cs b/AMESCoreStudio.Web/Controllers/REPController.cs index bddd6f6c..69429f02 100644 --- a/AMESCoreStudio.Web/Controllers/REPController.cs +++ b/AMESCoreStudio.Web/Controllers/REPController.cs @@ -330,6 +330,9 @@ namespace AMESCoreStudio.Web.Controllers } else { + NgRepair ngRepair = new NgRepair(); + model.ngRepair = ngRepair; + ViewBag.Image1Url = $"\\REPImage\\" + "noimage.jfif"; ViewBag.Image2Url = $"\\REPImage\\" + "noimage.jfif"; ViewBag.Image3Url = $"\\REPImage\\" + "noimage.jfif"; @@ -933,6 +936,99 @@ namespace AMESCoreStudio.Web.Controllers } return Json(new Table() { count = 0, data = null }); } + + public IActionResult REP012B(string id) + { + ViewData["ParamList"] = id; + return View(); + } + + [HttpPost] + public async Task GetRMACode4REP012Async(string id) + { + string[] param = id.Split('_'); + + var result = await _repApi.GetRMACode4REP012(param[0], param[1], param[2], param[3], param[4], param[5], param[6], param[7], param[8]); + + return Json(result.Data); + //return Json(new { data = result.Data }); + } + + public async Task GetRMACode4REP012ListAsync(string id) + { + + string[] param = id.Split('_'); + + var result = await _repApi.GetRMACode4REP012(param[0], param[1], param[2], param[3], param[4], param[5], param[6], param[7], param[8]); + + 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 }); + } + + public IActionResult REP012C(string id) + { + ViewData["ParamList"] = id; + return View(); + } + + [HttpPost] + public async Task GetLocation4REP012Async(string id) + { + string[] param = id.Split('_'); + + var result = await _repApi.GetLocation4REP012(param[0], param[1], param[2], param[3], param[4], param[5], param[6], param[7], param[8]); + + return Json(result.Data); + //return Json(new { data = result.Data }); + } + + public async Task GetLocation4REP012ListAsync(string id) + { + + string[] param = id.Split('_'); + + var result = await _repApi.GetLocation4REP012(param[0], param[1], param[2], param[3], param[4], param[5], param[6], param[7], param[8]); + + 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 }); + } + + public IActionResult REP012D(string id) + { + ViewData["ParamList"] = id; + return View(); + } + + [HttpPost] + public async Task GetRepairResponsibleUnit4REP012Async(string id) + { + string[] param = id.Split('_'); + + var result = await _repApi.GetRepairResponsibleUnit4REP012(param[0], param[1], param[2], param[3], param[4], param[5], param[6], param[7], param[8]); + + return Json(result.Data); + //return Json(new { data = result.Data }); + } + + public async Task GetRepairResponsibleUnit4REP012ListAsync(string id) + { + + string[] param = id.Split('_'); + + var result = await _repApi.GetRepairResponsibleUnit4REP012(param[0], param[1], param[2], param[3], param[4], param[5], param[6], param[7], param[8]); + + 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 }); + } #endregion } } diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IREP.cs b/AMESCoreStudio.Web/HttpApis/AMES/IREP.cs index ce1d89a9..fd6ef8d1 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IREP.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IREP.cs @@ -100,6 +100,27 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/NgRepairs/GetErrorCode4REP012")] ITask> GetErrorCode4REP012(string productType, string testType, string unitNo, string lineID, string stationID, string wipNo, string itemNo, string dateStart, string dateEnd); + /// + /// 查詢維修資料by维修代碼 + /// + /// + [WebApiClient.Attributes.HttpGet("api/NgRepairs/GetRMACode4REP012")] + ITask> GetRMACode4REP012(string productType, string testType, string unitNo, string lineID, string stationID, string wipNo, string itemNo, string dateStart, string dateEnd); + + /// + /// 查詢維修資料by维修代碼 + /// + /// + [WebApiClient.Attributes.HttpGet("api/NgRepairs/GetLocation4REP012")] + ITask> GetLocation4REP012(string productType, string testType, string unitNo, string lineID, string stationID, string wipNo, string itemNo, string dateStart, string dateEnd); + + /// + /// 查詢維修資料by维修代碼 + /// + /// + [WebApiClient.Attributes.HttpGet("api/NgRepairs/GetRepairResponsibleUnit4REP012")] + ITask> GetRepairResponsibleUnit4REP012(string productType, string testType, string unitNo, string lineID, string stationID, string wipNo, string itemNo, string dateStart, string dateEnd); + /// /// 根據COMPONENT_ID獲取指定維修過程資料 diff --git a/AMESCoreStudio.Web/Views/REP/REP012.cshtml b/AMESCoreStudio.Web/Views/REP/REP012.cshtml index 36167c70..1033b66b 100644 --- a/AMESCoreStudio.Web/Views/REP/REP012.cshtml +++ b/AMESCoreStudio.Web/Views/REP/REP012.cshtml @@ -143,6 +143,9 @@
+ + +
@@ -251,6 +254,21 @@ hg.open('不良代碼統計', '/REP/REP012A/' + param, 800, 600); }); + $('#btnChart2').click(function () { + var param = productTypeNo.value + '_' + testTypeNo.value + '_' + unitNo.value + '_' + lineID.value + '_' + stationID.value + '_' + wipNO.value + '_' + itemNO.value + '_' + dateStart.value + '_' + dateEnd.value; + hg.open('維修代碼統計', '/REP/REP012B/' + param, 800, 600); + }); + + $('#btnChart3').click(function () { + var param = productTypeNo.value + '_' + testTypeNo.value + '_' + unitNo.value + '_' + lineID.value + '_' + stationID.value + '_' + wipNO.value + '_' + itemNO.value + '_' + dateStart.value + '_' + dateEnd.value; + hg.open('維修位置統計', '/REP/REP012C/' + param, 800, 600); + }); + + $('#btnChart4').click(function () { + var param = productTypeNo.value + '_' + testTypeNo.value + '_' + unitNo.value + '_' + lineID.value + '_' + stationID.value + '_' + wipNO.value + '_' + itemNO.value + '_' + dateStart.value + '_' + dateEnd.value; + hg.open('責任單位統計', '/REP/REP012D/' + param, 800, 600); + }); + //监听表单提交事件 hg.form.onsubmit('querysubmit', function (data) { hg.msghide("重新載入資料.."); @@ -264,6 +282,18 @@ title: '製程單位', sort: true }, + { + field: 'lineDesc', + width: 100, + title: '線別', + sort: true + }, + { + field: 'stationName', + width: 100, + title: '站別', + sort: true + }, { field: 'wipNO', width: 160, @@ -299,6 +329,18 @@ width: 120, sort: true }, + { + field: 'locationNo', + title: '維修位置', + width: 120, + sort: true + }, + { + field: 'rrDesc', + title: '責任單位', + width: 120, + sort: true + }, { field: 'createDate', title: '維修日期', diff --git a/AMESCoreStudio.Web/Views/REP/REP012A.cshtml b/AMESCoreStudio.Web/Views/REP/REP012A.cshtml index 27e6bab2..f2b8b7da 100644 --- a/AMESCoreStudio.Web/Views/REP/REP012A.cshtml +++ b/AMESCoreStudio.Web/Views/REP/REP012A.cshtml @@ -78,7 +78,7 @@ }, series: [{ type: 'pie', - name: '不良數量', + name: '數量', data: errorData }] }); @@ -99,7 +99,7 @@ { field: 'errorQty', width: 160, - title: '不良次數', + title: '統計次數', sort: true }] ]; diff --git a/AMESCoreStudio.Web/Views/REP/REP012B.cshtml b/AMESCoreStudio.Web/Views/REP/REP012B.cshtml new file mode 100644 index 00000000..c1b6dfcf --- /dev/null +++ b/AMESCoreStudio.Web/Views/REP/REP012B.cshtml @@ -0,0 +1,113 @@ +@{ ViewData["Title"] = "REP012B"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; } + + + + + + + +
+
+
+
+
+
+ +
+
+
+
+
+ +
+ +@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + + + +} + diff --git a/AMESCoreStudio.Web/Views/REP/REP012C.cshtml b/AMESCoreStudio.Web/Views/REP/REP012C.cshtml new file mode 100644 index 00000000..07c2cfa4 --- /dev/null +++ b/AMESCoreStudio.Web/Views/REP/REP012C.cshtml @@ -0,0 +1,113 @@ +@{ ViewData["Title"] = "REP012C"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; } + + + + + + + +
+
+
+
+
+
+ +
+
+
+
+
+ +
+ +@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + + + +} + diff --git a/AMESCoreStudio.Web/Views/REP/REP012D.cshtml b/AMESCoreStudio.Web/Views/REP/REP012D.cshtml new file mode 100644 index 00000000..772ce7c4 --- /dev/null +++ b/AMESCoreStudio.Web/Views/REP/REP012D.cshtml @@ -0,0 +1,113 @@ +@{ ViewData["Title"] = "REP012D"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; } + + + + + + + +
+
+
+
+
+
+ +
+
+
+
+
+ +
+ +@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + + + +} + diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs index b91ef194..0fe16906 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs @@ -111,6 +111,8 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES join q5 in _context.WipAtts on q4.WipNO equals q5.WipNO join q6 in _context.LineInfoes on q4.LineID equals q6.LineID join q7 in _context.Stationses on q2.StationId equals q7.StationID + join q8 in _context.NgComponents on q2.NgID equals q8.NgID + join q9 in _context.RepairResponsibleUnitses on q1.RepairResponsibleID equals q9.RRID select new { q4.UnitNO, @@ -126,7 +128,9 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES q2.ReasonNo, q1.RmaNo, q1.RepairTypeNo, - q1.RepairDesc + q1.RepairDesc, + q8.LocationNo, + q9.RRDesc }; if (productType != "*") { @@ -236,9 +240,16 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES join q3 in _context.BarcodeInfoes on q2.BarcodeID equals q3.BarcodeID join q4 in _context.WipInfos on q3.WipID equals q4.WipID join q5 in _context.WipAtts on q4.WipNO equals q5.WipNO + join q6 in _context.LineInfoes on q4.LineID equals q6.LineID + join q7 in _context.Stationses on q2.StationId equals q7.StationID + join q8 in _context.NgComponents on q2.NgID equals q8.NgID + join q9 in _context.RepairResponsibleUnitses on q1.RepairResponsibleID equals q9.RRID select new { q4.UnitNO, + q6.LineDesc, + q1.CreateDate, + q7.StationName, q4.WipNO, q5.ItemNO, q4.LineID, @@ -247,7 +258,10 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES q2.StationId, q2.ReasonNo, q1.RmaNo, - q1.CreateDate + q1.RepairTypeNo, + q1.RepairDesc, + q8.LocationNo, + q9.RRDesc }; if (productType != "*") { @@ -334,6 +348,402 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return result; } + /// + /// 維修資料統計by維修代碼 + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + [Route("[action]")] + [HttpGet] + public async Task> GetRMACode4REP012(string productType, string testType, string unitNo, string lineID, string stationID, string wipNo, string itemNo, string dateStart, string dateEnd) + { + ResultModel result = new ResultModel(); + var q = from q1 in _context.NgRepairs + join q2 in _context.NgInfos on q1.NgID equals q2.NgID + join q3 in _context.BarcodeInfoes on q2.BarcodeID equals q3.BarcodeID + join q4 in _context.WipInfos on q3.WipID equals q4.WipID + join q5 in _context.WipAtts on q4.WipNO equals q5.WipNO + join q6 in _context.LineInfoes on q4.LineID equals q6.LineID + join q7 in _context.Stationses on q2.StationId equals q7.StationID + join q8 in _context.NgComponents on q2.NgID equals q8.NgID + join q9 in _context.RepairResponsibleUnitses on q1.RepairResponsibleID equals q9.RRID + select new + { + q4.UnitNO, + q6.LineDesc, + q1.CreateDate, + q7.StationName, + q4.WipNO, + q5.ItemNO, + q4.LineID, + q3.BarcodeNo, + q2.TypeNo, + q2.StationId, + q2.ReasonNo, + q1.RmaNo, + q1.RepairTypeNo, + q1.RepairDesc, + q8.LocationNo, + q9.RRDesc + }; + if (productType != "*") + { + + } + + if (testType != null) + { + if (testType != "*") + { + q = q.Where(w => w.TypeNo == testType); + } + } + + if (unitNo != null) + { + if (unitNo != "*") + { + q = q.Where(w => w.UnitNO == unitNo); + } + } + + if (lineID != null) + { + if (lineID != "0") + { + q = q.Where(w => w.LineID == int.Parse(lineID)); + } + } + + if (stationID != null) + { + if (stationID != "0") + { + q = q.Where(w => w.StationId == int.Parse(lineID)); + } + } + if (wipNo != null) + { + if (wipNo != "") + { + q = q.Where(w => w.WipNO == wipNo); + } + } + + if (itemNo != null) + { + if (itemNo != "") + { + q = q.Where(w => w.ItemNO == itemNo); + } + } + + if (dateStart != null && dateEnd != null) + { + if (dateStart != "" && dateEnd != "") + { + q = q.Where(w => w.CreateDate >= DateTime.Parse(dateStart) && w.CreateDate <= DateTime.Parse(dateEnd)); + } + } + + q = q.OrderBy(w => w.CreateDate); + + var g = q.GroupBy(x => new { x.RmaNo }).Select(x => new + { + RMACode = x.Key.RmaNo, + RMAQty = x.Count() + }).ToList(); + + //紀錄筆數 + result.DataTotal = g.Count(); + + result.Data = g; + + if (result == null) + { + result.Msg = "查無資料"; + result.Success = false; + return result; + } + + result.Success = true; + result.Msg = "OK"; + return result; + } + + + /// + /// 維修資料統計by維修位置 + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + [Route("[action]")] + [HttpGet] + public async Task> GetLocation4REP012(string productType, string testType, string unitNo, string lineID, string stationID, string wipNo, string itemNo, string dateStart, string dateEnd) + { + ResultModel result = new ResultModel(); + var q = from q1 in _context.NgRepairs + join q2 in _context.NgInfos on q1.NgID equals q2.NgID + join q3 in _context.BarcodeInfoes on q2.BarcodeID equals q3.BarcodeID + join q4 in _context.WipInfos on q3.WipID equals q4.WipID + join q5 in _context.WipAtts on q4.WipNO equals q5.WipNO + join q6 in _context.LineInfoes on q4.LineID equals q6.LineID + join q7 in _context.Stationses on q2.StationId equals q7.StationID + join q8 in _context.NgComponents on q2.NgID equals q8.NgID + join q9 in _context.RepairResponsibleUnitses on q1.RepairResponsibleID equals q9.RRID + select new + { + q4.UnitNO, + q6.LineDesc, + q1.CreateDate, + q7.StationName, + q4.WipNO, + q5.ItemNO, + q4.LineID, + q3.BarcodeNo, + q2.TypeNo, + q2.StationId, + q2.ReasonNo, + q1.RmaNo, + q1.RepairTypeNo, + q1.RepairDesc, + q8.LocationNo, + q9.RRDesc + }; + if (productType != "*") + { + + } + + if (testType != null) + { + if (testType != "*") + { + q = q.Where(w => w.TypeNo == testType); + } + } + + if (unitNo != null) + { + if (unitNo != "*") + { + q = q.Where(w => w.UnitNO == unitNo); + } + } + + if (lineID != null) + { + if (lineID != "0") + { + q = q.Where(w => w.LineID == int.Parse(lineID)); + } + } + + if (stationID != null) + { + if (stationID != "0") + { + q = q.Where(w => w.StationId == int.Parse(lineID)); + } + } + if (wipNo != null) + { + if (wipNo != "") + { + q = q.Where(w => w.WipNO == wipNo); + } + } + + if (itemNo != null) + { + if (itemNo != "") + { + q = q.Where(w => w.ItemNO == itemNo); + } + } + + if (dateStart != null && dateEnd != null) + { + if (dateStart != "" && dateEnd != "") + { + q = q.Where(w => w.CreateDate >= DateTime.Parse(dateStart) && w.CreateDate <= DateTime.Parse(dateEnd)); + } + } + + q = q.OrderBy(w => w.CreateDate); + + var g = q.GroupBy(x => new { x.LocationNo }).Select(x => new + { + LocationNo = x.Key.LocationNo, + LocationQty = x.Count() + }).ToList(); + + //紀錄筆數 + result.DataTotal = g.Count(); + + result.Data = g; + + if (result == null) + { + result.Msg = "查無資料"; + result.Success = false; + return result; + } + + result.Success = true; + result.Msg = "OK"; + return result; + } + + + /// + /// 維修資料統計by責任單位 + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + [Route("[action]")] + [HttpGet] + public async Task> GetRepairResponsibleUnit4REP012(string productType, string testType, string unitNo, string lineID, string stationID, string wipNo, string itemNo, string dateStart, string dateEnd) + { + ResultModel result = new ResultModel(); + var q = from q1 in _context.NgRepairs + join q2 in _context.NgInfos on q1.NgID equals q2.NgID + join q3 in _context.BarcodeInfoes on q2.BarcodeID equals q3.BarcodeID + join q4 in _context.WipInfos on q3.WipID equals q4.WipID + join q5 in _context.WipAtts on q4.WipNO equals q5.WipNO + join q6 in _context.LineInfoes on q4.LineID equals q6.LineID + join q7 in _context.Stationses on q2.StationId equals q7.StationID + join q8 in _context.NgComponents on q2.NgID equals q8.NgID + join q9 in _context.RepairResponsibleUnitses on q1.RepairResponsibleID equals q9.RRID + select new + { + q4.UnitNO, + q6.LineDesc, + q1.CreateDate, + q7.StationName, + q4.WipNO, + q5.ItemNO, + q4.LineID, + q3.BarcodeNo, + q2.TypeNo, + q2.StationId, + q2.ReasonNo, + q1.RmaNo, + q1.RepairTypeNo, + q1.RepairDesc, + q8.LocationNo, + q9.RRDesc + }; + if (productType != "*") + { + + } + + if (testType != null) + { + if (testType != "*") + { + q = q.Where(w => w.TypeNo == testType); + } + } + + if (unitNo != null) + { + if (unitNo != "*") + { + q = q.Where(w => w.UnitNO == unitNo); + } + } + + if (lineID != null) + { + if (lineID != "0") + { + q = q.Where(w => w.LineID == int.Parse(lineID)); + } + } + + if (stationID != null) + { + if (stationID != "0") + { + q = q.Where(w => w.StationId == int.Parse(lineID)); + } + } + if (wipNo != null) + { + if (wipNo != "") + { + q = q.Where(w => w.WipNO == wipNo); + } + } + + if (itemNo != null) + { + if (itemNo != "") + { + q = q.Where(w => w.ItemNO == itemNo); + } + } + + if (dateStart != null && dateEnd != null) + { + if (dateStart != "" && dateEnd != "") + { + q = q.Where(w => w.CreateDate >= DateTime.Parse(dateStart) && w.CreateDate <= DateTime.Parse(dateEnd)); + } + } + + q = q.OrderBy(w => w.CreateDate); + + var g = q.GroupBy(x => new { x.RRDesc }).Select(x => new + { + RRDesc = x.Key.RRDesc, + RRDescQty = x.Count() + }).ToList(); + + //紀錄筆數 + result.DataTotal = g.Count(); + + result.Data = g; + + if (result == null) + { + result.Msg = "查無資料"; + result.Success = false; + return result; + } + + result.Success = true; + result.Msg = "OK"; + return result; + } + + /// /// ///