diff --git a/AMESCoreStudio.Web/Controllers/REPController.cs b/AMESCoreStudio.Web/Controllers/REPController.cs index ff452018..18d751a8 100644 --- a/AMESCoreStudio.Web/Controllers/REPController.cs +++ b/AMESCoreStudio.Web/Controllers/REPController.cs @@ -939,6 +939,25 @@ namespace AMESCoreStudio.Web.Controllers } #endregion + public async Task REP005() + { + await GetStationList(); + + return View(); + } + + public async Task REP005QueryAsync(string stationID, string stateID, string dateStart, string dateEnd, int page = 0, int limit = 10) + { + + var result = await _repApi.GetRepairData4REP005(stationID, stateID, dateStart, dateEnd, 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 }); + } + #region 維修資料統計 public async Task REP012() diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IREP.cs b/AMESCoreStudio.Web/HttpApis/AMES/IREP.cs index f1c65493..3e4d3df1 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IREP.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IREP.cs @@ -86,6 +86,13 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/NgRepairs/{id}")] ITask> GetNgRepair(int id); + /// + /// 維修進/出條碼查詢 + /// + /// + [WebApiClient.Attributes.HttpGet("api/NgRepairs/GetRepairData4REP005")] + ITask> GetRepairData4REP005(string stationID, string stateID, string dateStart, string dateEnd, int page, int limit); + /// /// 查詢維修資料 /// diff --git a/AMESCoreStudio.Web/Views/REP/REP001R.cshtml b/AMESCoreStudio.Web/Views/REP/REP001R.cshtml index eab107ef..c01fdba6 100644 --- a/AMESCoreStudio.Web/Views/REP/REP001R.cshtml +++ b/AMESCoreStudio.Web/Views/REP/REP001R.cshtml @@ -248,6 +248,18 @@ +
+
+ +
+ + + + +
+ +
+
@@ -268,18 +280,6 @@
-
-
- -
- - - - -
- -
-
diff --git a/AMESCoreStudio.Web/Views/REP/REP002R.cshtml b/AMESCoreStudio.Web/Views/REP/REP002R.cshtml index 9fe516b5..5bb0e721 100644 --- a/AMESCoreStudio.Web/Views/REP/REP002R.cshtml +++ b/AMESCoreStudio.Web/Views/REP/REP002R.cshtml @@ -248,6 +248,18 @@
+
+
+ +
+ + + + +
+ +
+
@@ -268,18 +280,6 @@
-
-
- -
- - - - -
- -
-
diff --git a/AMESCoreStudio.Web/Views/REP/REP005.cshtml b/AMESCoreStudio.Web/Views/REP/REP005.cshtml new file mode 100644 index 00000000..d13f3468 --- /dev/null +++ b/AMESCoreStudio.Web/Views/REP/REP005.cshtml @@ -0,0 +1,222 @@ +@{ + ViewData["Title"] = "維修進/出條碼查詢"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + + + + +
+
+
+
+
@ViewBag.Title
+
+
+
+
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+ +
+ +
+ +
+
+ +
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +@section Scripts{ + + +} diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs index fb418e7e..d504b8ca 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs @@ -88,6 +88,95 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return ngRepair; } + /// + /// 維修進/出條碼查詢 + /// + /// + /// + /// + /// + /// + /// + /// + [Route("[action]")] + [HttpGet] + public async Task> GetRepairData4REP005(string stationID, string stateID, string dateStart, string dateEnd, int page = 0, int limit = 10) + { + 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.Stationses on q2.StationId equals q6.StationID + join q7 in _context.UserInfoes on q1.CreateUserID equals q7.UserID + join q8 in _context.UserInfoes on q2.CreateUserID equals q8.UserID + select new + { + q3.BarcodeNo, + q4.WipNO, + q5.ModelNO, + q5.ItemNO, + q6.StationName, + TestDate = q2.CreateDate, + TestUserNo = q8.UserNo, + TestUserName = q8.UserName, + RepairUserNo = q7.UserNo, + RepairUserName = q7.UserName, + q2.StationId, + q1.CreateDate, + StateDesc = (q7.UserName != "" ? "出站" : "進站") + }; + //StateDesc= (q7.UserName == "" ? "進站" : (q7.UserName != "" ? "出站":"")) + if (stationID != null) + { + if (stationID != "0") + { + q = q.Where(w => w.StationId == int.Parse(stationID)); + } + } + + if (stateID != null) + { + if (stateID != "0") + { + q = q.Where(w => w.StateDesc == "進站"); + } + } + + 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); + + //紀錄筆數 + 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; + } + /// /// 維修資料統計 ///