From e2e836e536ef23f8867da53445f2434bb924910a Mon Sep 17 00:00:00 2001 From: Marvin Date: Wed, 10 Aug 2022 00:23:57 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=96=B0=E5=A2=9EREP008=E5=A0=B1=E5=BB=A2?= =?UTF-8?q?=E8=B3=87=E6=96=99=E6=9F=A5=E8=A9=A2=202.=E6=96=B0=E5=A2=9EREP0?= =?UTF-8?q?09=E8=BD=89=E5=87=BA=E8=B3=87=E6=96=99=E6=9F=A5=E8=A9=A2=203.?= =?UTF-8?q?=E4=BF=AE=E6=94=B9REP006=E5=A0=B1=E5=BB=A2=E4=BD=9C=E6=A5=AD,?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9B=B4=E6=96=B0barcode=5Finfo=E7=9A=84stat?= =?UTF-8?q?us=5Fid,rule=5Fstatus,=E4=BF=AE=E6=94=B9=E5=BD=88=E7=AA=97?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=204.=E4=BF=AE=E6=94=B9REP007=E8=BD=89?= =?UTF-8?q?=E5=87=BA=E4=BD=9C=E6=A5=AD,=E5=A2=9E=E5=8A=A0=E6=9B=B4?= =?UTF-8?q?=E6=96=B0barcode=5Finfo=E7=9A=84status=5Fid,rule=5Fstatus,?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BD=88=E7=AA=97=E5=A4=A7=E5=B0=8F=205.?= =?UTF-8?q?=E4=BF=AE=E6=94=B9BarcodeQngInfo=E7=9A=84=E6=AC=84=E4=BD=8D?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/REPController.cs | 40 +++- AMESCoreStudio.Web/HttpApis/AMES/IREP.cs | 14 ++ AMESCoreStudio.Web/Views/REP/REP006.cshtml | 2 +- AMESCoreStudio.Web/Views/REP/REP007.cshtml | 2 +- AMESCoreStudio.Web/Views/REP/REP008.cshtml | 225 ++++++++++++++++++ AMESCoreStudio.Web/Views/REP/REP009.cshtml | 225 ++++++++++++++++++ .../AMES/BarcodeQngInfoesController.cs | 213 +++++++++++++++++ .../Models/AMES/BarcodeQngInfo.cs | 2 +- 8 files changed, 718 insertions(+), 5 deletions(-) create mode 100644 AMESCoreStudio.Web/Views/REP/REP008.cshtml create mode 100644 AMESCoreStudio.Web/Views/REP/REP009.cshtml diff --git a/AMESCoreStudio.Web/Controllers/REPController.cs b/AMESCoreStudio.Web/Controllers/REPController.cs index 26b78dde..8429f79e 100644 --- a/AMESCoreStudio.Web/Controllers/REPController.cs +++ b/AMESCoreStudio.Web/Controllers/REPController.cs @@ -1036,7 +1036,7 @@ namespace AMESCoreStudio.Web.Controllers } model.barcodeQngInfo.BarcodeID = model.barcodeInfo.BarcodeID; - model.barcodeQngInfo.WipID = model.barcodeInfo.GetWipInfo.WipID; + model.barcodeQngInfo.WipID = model.barcodeInfo.WipID; model.barcodeQngInfo.RuleStationID = model.barcodeInfo.RuleStationID; model.barcodeQngInfo.UnitNo = model.barcodeInfo.GetWipInfo.UnitNO; @@ -1113,7 +1113,7 @@ namespace AMESCoreStudio.Web.Controllers } model.barcodeQngInfo.BarcodeID = model.barcodeInfo.BarcodeID; - model.barcodeQngInfo.WipID = model.barcodeInfo.GetWipInfo.WipID; + model.barcodeQngInfo.WipID = model.barcodeInfo.WipID; model.barcodeQngInfo.RuleStationID = model.barcodeInfo.RuleStationID; model.barcodeQngInfo.UnitNo = model.barcodeInfo.GetWipInfo.UnitNO; @@ -1169,6 +1169,42 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Table() { count = 0, data = null }); } + public async Task REP008() + { + await GetUnitList(); + + return View(); + } + + public async Task REP008QueryAsync(string unitNo, string wipNO, string itemNO, string dateStart, string dateEnd, int page = 0, int limit = 10) + { + var result = await _repApi.GetQngInfoData4REP008(unitNo, wipNO, itemNO, 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 }); + } + + public async Task REP009() + { + await GetUnitList(); + + return View(); + } + + public async Task REP009QueryAsync(string unitNo, string wipNO, string itemNO, string dateStart, string dateEnd, int page = 0, int limit = 10) + { + var result = await _repApi.GetQngInfoData4REP008(unitNo, wipNO, itemNO, 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 e73e8d43..bc5db522 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IREP.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IREP.cs @@ -265,6 +265,20 @@ namespace AMESCoreStudio.Web #endregion + /// + /// 報廢資料查詢 + /// + /// + [WebApiClient.Attributes.HttpGet("api/BarcodeQngInfoes/GetQngInfoData4REP008")] + ITask> GetQngInfoData4REP008(string unitNo, string wipNo, string itemNo, string dateStart, string dateEnd, int page, int limit); + + /// + /// 轉出資料查詢 + /// + /// + [WebApiClient.Attributes.HttpGet("api/BarcodeQngInfoes/GetQngInfoData4REP009")] + ITask> GetQngInfoData4REP009(string unitNo, string wipNo, string itemNo, string dateStart, string dateEnd, int page, int limit); + /// /// 維修進/出統計報表 /// diff --git a/AMESCoreStudio.Web/Views/REP/REP006.cshtml b/AMESCoreStudio.Web/Views/REP/REP006.cshtml index e664ea29..e9299bb1 100644 --- a/AMESCoreStudio.Web/Views/REP/REP006.cshtml +++ b/AMESCoreStudio.Web/Views/REP/REP006.cshtml @@ -111,7 +111,7 @@ function detail(obj) { if (obj.data.barcodeNo) { - hg.open('條碼報廢資料維護', '/REP/REP006C/' + obj.data.barcodeNo, 1080, 800); + hg.open('條碼報廢資料維護', '/REP/REP006C/' + obj.data.barcodeNo, 1080, 600); } } diff --git a/AMESCoreStudio.Web/Views/REP/REP007.cshtml b/AMESCoreStudio.Web/Views/REP/REP007.cshtml index 3bb88647..98708c36 100644 --- a/AMESCoreStudio.Web/Views/REP/REP007.cshtml +++ b/AMESCoreStudio.Web/Views/REP/REP007.cshtml @@ -111,7 +111,7 @@ function detail(obj) { if (obj.data.barcodeNo) { - hg.open('條碼轉出資料維護', '/REP/REP007C/' + obj.data.barcodeNo, 1080, 800); + hg.open('條碼轉出資料維護', '/REP/REP007C/' + obj.data.barcodeNo, 1080, 600); } } diff --git a/AMESCoreStudio.Web/Views/REP/REP008.cshtml b/AMESCoreStudio.Web/Views/REP/REP008.cshtml new file mode 100644 index 00000000..6448ee83 --- /dev/null +++ b/AMESCoreStudio.Web/Views/REP/REP008.cshtml @@ -0,0 +1,225 @@ +@{ + ViewData["Title"] = "報廢資料查詢"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + + + + +
+
+
+
+
@ViewBag.Title
+
+
+
+
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +@section Scripts{ + + +} diff --git a/AMESCoreStudio.Web/Views/REP/REP009.cshtml b/AMESCoreStudio.Web/Views/REP/REP009.cshtml new file mode 100644 index 00000000..5347e7c7 --- /dev/null +++ b/AMESCoreStudio.Web/Views/REP/REP009.cshtml @@ -0,0 +1,225 @@ +@{ + ViewData["Title"] = "轉出資料查詢"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + + + + +
+
+
+
+
@ViewBag.Title
+
+
+
+
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +@section Scripts{ + + +} diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeQngInfoesController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeQngInfoesController.cs index 636014db..4fc9b40c 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeQngInfoesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeQngInfoesController.cs @@ -119,6 +119,210 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return barcodeQngInfo; } + /// + /// 報廢資料查詢 + /// + /// + /// + /// + /// + /// + /// + /// + /// + [Route("[action]")] + [HttpGet] + public async Task> GetQngInfoData4REP008(string unitNo, string wipNO, string itemNO, string dateStart, string dateEnd, int page = 0, int limit = 10) + { + Helper helper = new Helper(_context); + + ResultModel result = new ResultModel(); + var q = from a in _context.BarcodeQngInfos + join b in _context.BarcodeInfoes on a.BarcodeID equals b.BarcodeID + join c in _context.WipInfos on a.WipID equals c.WipID + join d in _context.WipAtts on c.WipNO equals d.WipNO + join e in _context.RuleStations on a.RuleStationID equals e.RuleStationID + join f in _context.RepairResponsibleUnitses on a.DeptID equals f.RRID + select new + { + a.UnitNo, + b.BarcodeNo, + c.WipNO, + d.ModelNO, + d.ItemNO, + e.StationDesc, + ScrapDate = a.ScrapTime, + OpUserNo = helper.GetUserNo(a.OperatorID).Result, + IPQAUserNo = helper.GetUserNo(a.IPQAID).Result, + PEUserNo = helper.GetUserNo(a.PEID).Result, + ManagerUserNo = helper.GetUserNo(a.ManagerID).Result, + f.RRDesc, + a.NGReason, + a.NGReasonPrtreatment, + a.Precaution, + a.PreventiveTreatment, + a.RuleStatus + }; + + + if (dateStart != null && dateEnd != null) + { + if (dateStart != "" && dateEnd != "") + { + q = q.Where(w => w.ScrapDate >= DateTime.Parse(dateStart) && w.ScrapDate <= DateTime.Parse(dateEnd)); + } + } + if (unitNo != null) + { + if (unitNo != "*") + { + q = q.Where(w => w.UnitNo == unitNo); + } + } + if (wipNO != null) + { + if (wipNO != "") + { + q = q.Where(w => w.WipNO == wipNO); + } + } + + if (itemNO != null) + { + if (itemNO != "") + { + q = q.Where(w => w.ItemNO == itemNO); + } + } + q = q.Where(w => w.RuleStatus.Equals("S")); + + q = q.OrderBy(w => w.ScrapDate); + + //紀錄筆數 + 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; + } + + /// + /// 轉出資料查詢 + /// + /// + /// + /// + /// + /// + /// + /// + /// + [Route("[action]")] + [HttpGet] + public async Task> GetQngInfoData4REP009(string unitNo, string wipNO, string itemNO, string dateStart, string dateEnd, int page = 0, int limit = 10) + { + Helper helper = new Helper(_context); + + ResultModel result = new ResultModel(); + var q = from a in _context.BarcodeQngInfos + join b in _context.BarcodeInfoes on a.BarcodeID equals b.BarcodeID + join c in _context.WipInfos on a.WipID equals c.WipID + join d in _context.WipAtts on c.WipNO equals d.WipNO + join e in _context.RuleStations on a.RuleStationID equals e.RuleStationID + join f in _context.RepairResponsibleUnitses on a.DeptID equals f.RRID + select new + { + a.UnitNo, + b.BarcodeNo, + c.WipNO, + d.ModelNO, + d.ItemNO, + e.StationDesc, + ScrapDate = a.ScrapTime, + OpUserNo = helper.GetUserNo(a.OperatorID).Result, + IPQAUserNo = helper.GetUserNo(a.IPQAID).Result, + PEUserNo = helper.GetUserNo(a.PEID).Result, + ManagerUserNo = helper.GetUserNo(a.ManagerID).Result, + f.RRDesc, + a.NGReason, + a.NGReasonPrtreatment, + a.Precaution, + a.PreventiveTreatment, + a.RuleStatus + }; + + + if (dateStart != null && dateEnd != null) + { + if (dateStart != "" && dateEnd != "") + { + q = q.Where(w => w.ScrapDate >= DateTime.Parse(dateStart) && w.ScrapDate <= DateTime.Parse(dateEnd)); + } + } + if (unitNo != null) + { + if (unitNo != "*") + { + q = q.Where(w => w.UnitNo == unitNo); + } + } + if (wipNO != null) + { + if (wipNO != "") + { + q = q.Where(w => w.WipNO == wipNO); + } + } + + if (itemNO != null) + { + if (itemNO != "") + { + q = q.Where(w => w.ItemNO == itemNO); + } + } + q = q.Where(w => w.RuleStatus.Equals("C")); + + q = q.OrderBy(w => w.ScrapDate); + + //紀錄筆數 + 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修改單一筆報廢轉出資料 /// @@ -182,6 +386,15 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES barcodeQngInfo.QngID = helper.GetIDKey("QNG_ID").Result; _context.BarcodeQngInfos.Add(barcodeQngInfo); + + var barcodeInfo = await _context.BarcodeInfoes.FindAsync(barcodeQngInfo.BarcodeID); + barcodeInfo.StatusID = -1; + barcodeInfo.RuleStatus = barcodeQngInfo.RuleStatus; + _context.Attach(barcodeInfo); + + _context.Entry(barcodeInfo).Property(p => p.RuleStatus).IsModified = true; + _context.Entry(barcodeInfo).Property(p => p.StatusID).IsModified = true; + await _context.SaveChangesAsync(); result.Success = true; diff --git a/AMESCoreStudio.WebApi/Models/AMES/BarcodeQngInfo.cs b/AMESCoreStudio.WebApi/Models/AMES/BarcodeQngInfo.cs index c3c49d08..aebacee2 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/BarcodeQngInfo.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/BarcodeQngInfo.cs @@ -101,7 +101,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES [DataMember] [Display(Name = "根本原因預防處理")] [Column("NGREASON_PRTREATMENT")] - [StringLength(10)] + [StringLength(120)] public string NGReasonPrtreatment { get; set; } ///