diff --git a/AMESCoreStudio.Web/Controllers/QRSController.cs b/AMESCoreStudio.Web/Controllers/QRSController.cs index 2444b457..b99b707f 100644 --- a/AMESCoreStudio.Web/Controllers/QRSController.cs +++ b/AMESCoreStudio.Web/Controllers/QRSController.cs @@ -3,8 +3,8 @@ using System.Threading.Tasks; using Microsoft.Extensions.Logging; using AMESCoreStudio.CommonTools.Result; using Microsoft.AspNetCore.Hosting; -using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using AMESCoreStudio.Web.Models; namespace AMESCoreStudio.Web.Controllers { @@ -92,17 +92,50 @@ namespace AMESCoreStudio.Web.Controllers } } - stationQty = stationQty + "" + okQty + "/" + ngQty + ""; + //stationQty = stationQty + "" + okQty + "/" + ngQty + ""; + stationQty = stationQty + "" + okQty + "/" + ngQty + ""; double rate = ((okQty * 1.0) / (okQty + ngQty)) * 100; if (j == rule_sation.Count - 2) { - stationRate = stationRate + "" + rate.ToString("0.00") + "%" + ""; + if (rate <= 90) + { + stationRate = stationRate + "" + rate.ToString("0.00") + "%" + ""; + } + else if (rate >= 95 && rate <= 97) + { + stationRate = stationRate + "" + rate.ToString("0.00") + "%" + ""; + } + else if (rate >= 98) + { + stationRate = stationRate + "" + rate.ToString("0.00") + "%" + ""; + } + else + { + stationRate = stationRate + "" + rate.ToString("0.00") + "%" + ""; + } + //stationRate = stationRate + "" + rate.ToString("0.00") + "%" + ""; } else { - stationRate = stationRate + "" + rate.ToString("0.00") + "%" + ""; + //stationRate = stationRate + "" + rate.ToString("0.00") + "%" + ""; + if (rate <= 90) + { + stationRate = stationRate + "" + rate.ToString("0.00") + "%" + ""; + } + else if (rate >= 95 && rate <= 97) + { + stationRate = stationRate + "" + rate.ToString("0.00") + "%" + ""; + } + else if (rate >= 98) + { + stationRate = stationRate + "" + rate.ToString("0.00") + "%" + ""; + } + else + { + stationRate = stationRate + "" + rate.ToString("0.00") + "%" + ""; + } stationRate = stationRate + "" + "" + " >> " + "" + ""; } } @@ -155,7 +188,7 @@ namespace AMESCoreStudio.Web.Controllers } } } - stationWip = stationWip + "" + (okQty1 + ngQty1 - okQty2 - ngQty2) + ""; + stationWip = stationWip + "" + (okQty1 + ngQty1 - okQty2 - ngQty2) + ""; } stationWip = stationWip + "
"; @@ -219,5 +252,86 @@ namespace AMESCoreStudio.Web.Controllers ViewData["WipDataList"] = wipDataList; return View(); } + + public IActionResult QRS009P(string id) + { + string[] param = id.Split("_"); + ViewBag.WIP_ID = param[0]; + ViewBag.RULE_STATION_ID = param[1]; + + return View(); + } + + public IActionResult QRS009F(string id) + { + string[] param = id.Split("_"); + ViewBag.WIP_ID = param[0]; + ViewBag.RULE_STATION_ID = param[1]; + + return View(); + } + + public IActionResult QRS009W(string id) + { + string[] param = id.Split("_"); + ViewBag.WIP_ID = param[0]; + ViewBag.RULE_STATION_ID = param[1]; + + return View(); + } + + [ResponseCache(Duration = 0)] + [HttpGet] + public async Task GetWipStationPassBarcode(string id, int page = 1, int limit = 10) + { + string[] param = id.Split("_"); + int wip_id = int.Parse(param[0]); + int rule_station_id = int.Parse(param[1]); + + var result = await _pcsApi.GetWipStationBarcode4QRS009(wip_id, rule_station_id, "P", 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 GetWipStationFailBarcode(string id, int page = 1, int limit = 10) + { + string[] param = id.Split("_"); + int wip_id = int.Parse(param[0]); + int rule_station_id = int.Parse(param[1]); + + var result = await _pcsApi.GetWipStationBarcode4QRS009(wip_id, rule_station_id, "F", 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 GetWipStationBarcode(string id, int page = 1, int limit = 10) + { + string[] param = id.Split("_"); + int wip_id = int.Parse(param[0]); + int rule_station_id = int.Parse(param[1]); + + var result = await _pcsApi.GetWipBarcode4QRS009(wip_id, rule_station_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 }); + } } } diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 6df36cd4..eb9e8250 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -739,6 +739,20 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/WipStation/GetWipStation4QRS009")] ITask> GetWipStation4QRS009(int wipID,int ruleStationID); + /// + /// 查詢工單站別條碼資料 + /// + /// + [WebApiClient.Attributes.HttpGet("api/BarcodeStation/GetWipStationBarcode4QRS009")] + ITask> GetWipStationBarcode4QRS009(int wipID, int ruleStationID, string ruleStatus, int page, int limit); + + /// + /// 查詢工單站別在製條碼資料 + /// + /// + [WebApiClient.Attributes.HttpGet("api/BarcodeInfoes/GetWipBarcode4QRS009")] + ITask> GetWipBarcode4QRS009(int wipID, int ruleStationID, int page, int limit); + #endregion diff --git a/AMESCoreStudio.Web/Views/QRS/QRS009F.cshtml b/AMESCoreStudio.Web/Views/QRS/QRS009F.cshtml new file mode 100644 index 00000000..931d5750 --- /dev/null +++ b/AMESCoreStudio.Web/Views/QRS/QRS009F.cshtml @@ -0,0 +1,53 @@ +@{ + ViewData["Title"] = "在製分布圖-過站FAIL條碼資料"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + +
+
+ + +
+
+
+ +@section Scripts{ + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/QRS/QRS009P.cshtml b/AMESCoreStudio.Web/Views/QRS/QRS009P.cshtml new file mode 100644 index 00000000..588705c6 --- /dev/null +++ b/AMESCoreStudio.Web/Views/QRS/QRS009P.cshtml @@ -0,0 +1,53 @@ +@{ + ViewData["Title"] = "在製分布圖-過站PASS條碼資料"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + +
+
+ + +
+
+
+ +@section Scripts{ + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/QRS/QRS009W.cshtml b/AMESCoreStudio.Web/Views/QRS/QRS009W.cshtml new file mode 100644 index 00000000..57cff918 --- /dev/null +++ b/AMESCoreStudio.Web/Views/QRS/QRS009W.cshtml @@ -0,0 +1,53 @@ +@{ + ViewData["Title"] = "在製分布圖-在製條碼資料"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + +
+
+ + +
+
+
+ +@section Scripts{ + +} \ No newline at end of file diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs index 67cbb228..1966a8b1 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs @@ -89,6 +89,58 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return barcodeInfo; } + /// + /// 查詢工單站別在製條碼資料 + /// + /// + [Route("[action]")] + [HttpGet] + public async Task> GetWipBarcode4QRS009(int wipID, int ruleStationID, int page = 1, int limit = 10) + { + ResultModel result = new ResultModel(); + var q = from q1 in _context.BarcodeInfoes + join q2 in _context.WipInfos on q1.WipID equals q2.WipID + join q3 in _context.LineInfoes on q2.LineID equals q3.LineID + join q4 in _context.UserInfoes on q1.CreateUserID equals q4.UserID + select new + { + q1.BarcodeID, + q1.WipID, + q1.RuleStationID, + q1.BarcodeNo, + q3.LineDesc, + q1.RuleStatus, + q1.SysType, + q1.CreateDate, + q4.UserName + }; + + q = q.Where(w => w.WipID == wipID && w.RuleStationID == ruleStationID); + + + //紀錄筆數 + result.DataTotal = q.Count(); + + //Table 頁數 + if (page > 0) + { + q = q.Skip((page - 1) * limit).Take(limit); + } + + result.Data = await q.ToListAsync(); + + if (result == null) + { + result.Msg = "查無資料"; + result.Success = false; + return result; + } + + result.Success = true; + result.Msg = "OK"; + return result; + } + /// /// 用工單號碼获取该條碼资料 /// diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeStationController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeStationController.cs index acad5dd6..afafa7b6 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeStationController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeStationController.cs @@ -93,6 +93,58 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return barcodeStation; } + /// + /// 查詢工單站別條碼資料 + /// + /// + [Route("[action]")] + [HttpGet] + public async Task> GetWipStationBarcode4QRS009(int wipID, int ruleStationID, string ruleStatus, int page = 1, int limit = 10) + { + ResultModel result = new ResultModel(); + var q = from q1 in _context.BarcodeStation + join q2 in _context.BarcodeInfoes on q1.BarcodeID equals q2.BarcodeID + join q3 in _context.LineInfoes on q1.LineId equals q3.LineID + join q4 in _context.UserInfoes on q1.CreateUserID equals q4.UserID + select new + { + q1.BarcodeID, + q1.WipID, + q1.RuleStationID, + q2.BarcodeNo, + q3.LineDesc, + q1.RuleStatus, + q1.Systype, + q1.InputDate, + q4.UserName + }; + + q = q.Where(w => w.WipID == wipID && w.RuleStationID == ruleStationID && w.RuleStatus == ruleStatus); + + + //紀錄筆數 + result.DataTotal = q.Count(); + + //Table 頁數 + if (page > 0) + { + q = q.Skip((page - 1) * limit).Take(limit); + } + + result.Data = await q.ToListAsync(); + + if (result == null) + { + result.Msg = "查無資料"; + result.Success = false; + return result; + } + + result.Success = true; + result.Msg = "OK"; + return result; + } + /// /// 用工單ID查是否有過站紀錄 ///