diff --git a/.vs/AMESCoreStudio/DesignTimeBuild/.dtbcache.v2 b/.vs/AMESCoreStudio/DesignTimeBuild/.dtbcache.v2 index 670e2084..6056793e 100644 Binary files a/.vs/AMESCoreStudio/DesignTimeBuild/.dtbcache.v2 and b/.vs/AMESCoreStudio/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/AMESCoreStudio/v16/.suo b/.vs/AMESCoreStudio/v16/.suo index dc00f008..314e8ed8 100644 Binary files a/.vs/AMESCoreStudio/v16/.suo and b/.vs/AMESCoreStudio/v16/.suo differ diff --git a/AMESCoreStudio.Web/Controllers/LABController.cs b/AMESCoreStudio.Web/Controllers/LABController.cs index e4f7d32c..c19d0335 100644 --- a/AMESCoreStudio.Web/Controllers/LABController.cs +++ b/AMESCoreStudio.Web/Controllers/LABController.cs @@ -147,9 +147,9 @@ namespace AMESCoreStudio.Web.Controllers [ResponseCache(Duration = 0)] [HttpGet] - public async Task GetLabParamsAsync(int page = 0, int limit = 10) + public async Task GetLabParamsAsync(string status = "*" ,int page = 0, int limit = 10) { - var result = await _labApi.GetLabParamsByLabelID(page, limit); + var result = await _labApi.GetLabParamsByStatus(status,page, limit); if (result.Data.Count() > 0) { @@ -191,7 +191,32 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Table() { count = 0, data = null }); } + public IActionResult LAB002_COPY(string ImgFile, string LabMatnr) + { + if (System.IO.File.Exists(ImgFile)) + { + + var FileName = Path.GetFileName(ImgFile); + + //指定要寫入的路徑、檔名和副檔名 + var FilePath = $"\\LABFile\\" + LabMatnr + "\\";//本機目錄 + + if (!System.IO.Directory.Exists(_env.WebRootPath + FilePath)) + { + System.IO.Directory.CreateDirectory(_env.WebRootPath + FilePath); + } + var targetFilePath = _env.WebRootPath + FilePath + FileName; + + System.IO.File.Copy(ImgFile, targetFilePath, true); + return Json(new Result() { success = true, msg = FilePath + FileName }); + } + else + { + return Json(new Result() { success = false, msg = "圖片檔案不存在" }); + } + + } //新增頁面 @@ -489,13 +514,13 @@ namespace AMESCoreStudio.Web.Controllers } [HttpGet] - public async Task GetLab004(string OrderNo, string ModelNo, DateTime? strdate, DateTime? enddate, string UserNo) + public async Task GetLab004(string OrderNo, string ModelNo, DateTime? strdate, DateTime? enddate, string UserNo,string Status) { List xx = new List(); UserInfo User = new UserInfo(); if (UserNo != null) User = await _sysApi.GetUserInfoByUserNo(UserNo); - var result = await _labApi.GetLabelItemMaster(OrderNo, ModelNo, strdate, enddate, User.UserID); + var result = await _labApi.GetLabelItemMaster(OrderNo, ModelNo, strdate, enddate, User.UserID, Status); if (result != null) { @@ -508,8 +533,22 @@ namespace AMESCoreStudio.Web.Controllers public async Task LAB003P(string LabMat) { var result = await _labApi.GetLabelPicture(LabMat); - var x = result.Data.FirstOrDefault(); - ViewBag.Picture = x; + var ImgFile = result.Data.FirstOrDefault(); + var FileName = Path.GetFileName(ImgFile); + + //指定要寫入的路徑、檔名和副檔名 + var FilePath = $"\\LABFile\\" + LabMat + "\\";//本機目錄 + + if (!System.IO.Directory.Exists(_env.WebRootPath + FilePath)) + { + System.IO.Directory.CreateDirectory(_env.WebRootPath + FilePath); + } + var targetFilePath = _env.WebRootPath + FilePath + FileName; + + System.IO.File.Copy(ImgFile, targetFilePath, true); + + // var x = result.Data.FirstOrDefault(); + ViewBag.Picture = FilePath + FileName; return View(result.Data); } @@ -541,10 +580,10 @@ namespace AMESCoreStudio.Web.Controllers } [HttpGet] - public async Task GetLabelField(string Labmat) + public async Task GetLabelField(string Labmat,string ItemNo) { ResultModel result = new ResultModel(); - result = await _labApi.GetLabelField(Labmat); + result = await _labApi.GetLabelField(Labmat, ItemNo); if(result.Data.Count()>0) return Json(new Result() { success = result.Success, msg = result.Msg, data = result.Data }); else @@ -558,7 +597,7 @@ namespace AMESCoreStudio.Web.Controllers { int Sn = 1; ResultModel result = new ResultModel(); - result = await _labApi.GetLabelItemMaster(OrderNo, null, null, null, -1); + result = await _labApi.GetLabelItemMaster(OrderNo, null, null, null, -1,"A"); if (result.Data.Any()) { var r2 = result.Data.Max(x => x.ordeR_NO).ToString(); diff --git a/AMESCoreStudio.Web/Controllers/QRSController.cs b/AMESCoreStudio.Web/Controllers/QRSController.cs index 6c7f6ba1..ef11077d 100644 --- a/AMESCoreStudio.Web/Controllers/QRSController.cs +++ b/AMESCoreStudio.Web/Controllers/QRSController.cs @@ -933,8 +933,9 @@ namespace AMESCoreStudio.Web.Controllers LineDesc = jo["lineDesc"].ToString(), ModelNO = jo["modelNO"].ToString(), FirstCnt = int.Parse(joPass["firstCnt"].ToString()), - PassCnt = int.Parse(jo["passCnt"].ToString()), - Yield = double.Parse((int.Parse(joPass["firstCnt"].ToString()) * 1.0 / int.Parse(jo["passCnt"].ToString()) * 100.0).ToString("0.00")) + //PassCnt = int.Parse(jo["passCnt"].ToString()), + PassCnt = int.Parse(joPass["passCnt"].ToString()), + Yield = double.Parse((int.Parse(joPass["firstCnt"].ToString()) * 1.0 / int.Parse(joPass["passCnt"].ToString()) * 100.0).ToString("0.00")) }); } } @@ -1114,6 +1115,7 @@ namespace AMESCoreStudio.Web.Controllers JObject jo = JObject.Parse(item.ToString()); int wip_id = int.Parse(jo["wipID"].ToString()); + //2024-03-26 BB.Wang Modify 修正良率(代小平) //double sum_rate = 100.0; //int sum_idx = 1; @@ -1198,11 +1200,12 @@ namespace AMESCoreStudio.Web.Controllers string dateEnd01 = yCode + "-02-01"; var wipStaiton01 = await _pcsApi.GetWipStation4QRS014GroupS(param[1], dateStart01, dateEnd01, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate01 = 100.0; - //int sum_idx01 = 1; - double sum_rate01 = 0.0; - int sum_idx01 = 0; + double sum_rate01 = 100.0; + int sum_idx01 = 1; + //double sum_rate01 = 0.0; + //int sum_idx01 = 0; if (wipStaiton01.DataTotal > 0) { @@ -1284,9 +1287,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate01 = sum_rate01 * (rate / 100.0); - sum_idx01 = sum_idx01 + 1; - sum_rate01 = sum_rate01 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate01 = sum_rate01 * (rate / 100.0); + //sum_idx01 = sum_idx01 + 1; + //sum_rate01 = sum_rate01 + rate; } } } @@ -1308,12 +1312,13 @@ namespace AMESCoreStudio.Web.Controllers string dateStart02 = yCode + "-02-01"; string dateEnd02 = yCode + "-03-01"; var wipStaiton02 = await _pcsApi.GetWipStation4QRS014GroupS(param[1], dateStart02, dateEnd02, param[5], param[6], param[7]); - + + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate02 = 100.0; - //int sum_idx02 = 1; - double sum_rate02 = 0.0; - int sum_idx02 = 0; + double sum_rate02 = 100.0; + int sum_idx02 = 1; + //double sum_rate02 = 0.0; + //int sum_idx02 = 0; if (wipStaiton02.DataTotal > 0) { @@ -1395,9 +1400,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate02 = sum_rate02 * (rate / 100.0); - sum_idx02 = sum_idx02 + 1; - sum_rate02 = sum_rate02 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate02 = sum_rate02 * (rate / 100.0); + //sum_idx02 = sum_idx02 + 1; + //sum_rate02 = sum_rate02 + rate; } } } @@ -1419,11 +1425,14 @@ namespace AMESCoreStudio.Web.Controllers string dateStart03 = yCode + "-03-01"; string dateEnd03 = yCode + "-04-01"; var wipStaiton03 = await _pcsApi.GetWipStation4QRS014GroupS(param[1], dateStart03, dateEnd03, param[5], param[6], param[7]); + + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate03 = 100.0; - //int sum_idx03 = 1; - double sum_rate03 = 0.0; - int sum_idx03 = 0; + double sum_rate03 = 100.0; + int sum_idx03 = 1; + //double sum_rate03 = 0.0; + //int sum_idx03 = 0; + if (wipStaiton03.DataTotal > 0) { DataTable dtRate = new DataTable(); @@ -1504,9 +1513,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate03 = sum_rate03 * (rate / 100.0); - sum_idx03 = sum_idx03 + 1; - sum_rate03 = sum_rate03 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate03 = sum_rate03 * (rate / 100.0); + //sum_idx03 = sum_idx03 + 1; + //sum_rate03 = sum_rate03 + rate; } } } @@ -1528,11 +1538,14 @@ namespace AMESCoreStudio.Web.Controllers string dateStart04 = yCode + "-04-01"; string dateEnd04 = yCode + "-05-01"; var wipStaiton04 = await _pcsApi.GetWipStation4QRS014GroupS(param[1], dateStart04, dateEnd04, param[5], param[6], param[7]); + + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate04 = 100.0; - //int sum_idx04 = 1; - double sum_rate04 = 0.0; - int sum_idx04 = 0; + double sum_rate04 = 100.0; + int sum_idx04 = 1; + //double sum_rate04 = 0.0; + //int sum_idx04 = 0; + if (wipStaiton04.DataTotal > 0) { DataTable dtRate = new DataTable(); @@ -1613,9 +1626,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate04 = sum_rate04 * (rate / 100.0); - sum_idx04 = sum_idx04 + 1; - sum_rate04 = sum_rate04 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate04 = sum_rate04 * (rate / 100.0); + //sum_idx04 = sum_idx04 + 1; + //sum_rate04 = sum_rate04 + rate; } } } @@ -1637,11 +1651,14 @@ namespace AMESCoreStudio.Web.Controllers string dateStart05 = yCode + "-05-01"; string dateEnd05 = yCode + "-06-01"; var wipStaiton05 = await _pcsApi.GetWipStation4QRS014GroupS(param[1], dateStart05, dateEnd05, param[5], param[6], param[7]); + + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate05 = 100.0; - //int sum_idx05 = 1; - double sum_rate05 = 0.0; - int sum_idx05 = 0; + double sum_rate05 = 100.0; + int sum_idx05 = 1; + //double sum_rate05 = 0.0; + //int sum_idx05 = 0; + if (wipStaiton05.DataTotal > 0) { DataTable dtRate = new DataTable(); @@ -1722,9 +1739,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate05 = sum_rate05 * (rate / 100.0); - sum_idx05 = sum_idx05 + 1; - sum_rate05 = sum_rate05 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate05 = sum_rate05 * (rate / 100.0); + //sum_idx05 = sum_idx05 + 1; + //sum_rate05 = sum_rate05 + rate; } } } @@ -1746,11 +1764,14 @@ namespace AMESCoreStudio.Web.Controllers string dateStart06 = yCode + "-06-01"; string dateEnd06 = yCode + "-07-01"; var wipStaiton06 = await _pcsApi.GetWipStation4QRS014GroupS(param[1], dateStart06, dateEnd06, param[5], param[6], param[7]); + + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate06 = 100.0; - //int sum_idx06 = 1; - double sum_rate06 = 0.0; - int sum_idx06 = 0; + double sum_rate06 = 100.0; + int sum_idx06 = 1; + //double sum_rate06 = 0.0; + //int sum_idx06 = 0; + if (wipStaiton06.DataTotal > 0) { DataTable dtRate = new DataTable(); @@ -1831,9 +1852,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate06 = sum_rate06 * (rate / 100.0); - sum_idx06 = sum_idx06 + 1; - sum_rate06 = sum_rate06 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate06 = sum_rate06 * (rate / 100.0); + //sum_idx06 = sum_idx06 + 1; + //sum_rate06 = sum_rate06 + rate; } } } @@ -1855,11 +1877,14 @@ namespace AMESCoreStudio.Web.Controllers string dateStart07 = yCode + "-07-01"; string dateEnd07 = yCode + "-08-01"; var wipStaiton07 = await _pcsApi.GetWipStation4QRS014GroupS(param[1], dateStart07, dateEnd07, param[5], param[6], param[7]); + + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate07 = 100.0; - //int sum_idx07 = 1; - double sum_rate07 = 0.0; - int sum_idx07 = 0; + double sum_rate07 = 100.0; + int sum_idx07 = 1; + //double sum_rate07 = 0.0; + //int sum_idx07 = 0; + if (wipStaiton07.DataTotal > 0) { DataTable dtRate = new DataTable(); @@ -1940,9 +1965,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate07 = sum_rate07 * (rate / 100.0); - sum_idx07 = sum_idx07 + 1; - sum_rate07 = sum_rate07 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate07 = sum_rate07 * (rate / 100.0); + //sum_idx07 = sum_idx07 + 1; + //sum_rate07 = sum_rate07 + rate; } } } @@ -1964,11 +1990,14 @@ namespace AMESCoreStudio.Web.Controllers string dateStart08 = yCode + "-08-01"; string dateEnd08 = yCode + "-09-01"; var wipStaiton08 = await _pcsApi.GetWipStation4QRS014GroupS(param[1], dateStart08, dateEnd08, param[5], param[6], param[7]); + + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate08 = 100.0; - //int sum_idx08 = 1; - double sum_rate08 = 0.0; - int sum_idx08 = 0; + double sum_rate08 = 100.0; + int sum_idx08 = 1; + //double sum_rate08 = 0.0; + //int sum_idx08 = 0; + if (wipStaiton08.DataTotal > 0) { DataTable dtRate = new DataTable(); @@ -2073,11 +2102,14 @@ namespace AMESCoreStudio.Web.Controllers string dateStart09 = yCode + "-09-01"; string dateEnd09 = yCode + "-10-01"; var wipStaiton09 = await _pcsApi.GetWipStation4QRS014GroupS(param[1], dateStart09, dateEnd09, param[5], param[6], param[7]); + + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate09 = 100.0; - //int sum_idx09 = 1; - double sum_rate09 = 0.0; - int sum_idx09 = 0; + double sum_rate09 = 100.0; + int sum_idx09 = 1; + //double sum_rate09 = 0.0; + //int sum_idx09 = 0; + if (wipStaiton09.DataTotal > 0) { DataTable dtRate = new DataTable(); @@ -2182,11 +2214,14 @@ namespace AMESCoreStudio.Web.Controllers string dateStart10 = yCode + "-10-01"; string dateEnd10 = yCode + "-11-01"; var wipStaiton10 = await _pcsApi.GetWipStation4QRS014GroupS(param[1], dateStart10, dateEnd10, param[5], param[6], param[7]); + + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate10 = 100.0; - //int sum_idx10 = 1; - double sum_rate10 = 0.0; - int sum_idx10 = 0; + double sum_rate10 = 100.0; + int sum_idx10 = 1; + //double sum_rate10 = 0.0; + //int sum_idx10 = 0; + if (wipStaiton10.DataTotal > 0) { DataTable dtRate = new DataTable(); @@ -2267,9 +2302,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate10 = sum_rate10 * (rate / 100.0); - sum_idx10 = sum_idx10 + 1; - sum_rate10 = sum_rate10 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate10 = sum_rate10 * (rate / 100.0); + //sum_idx10 = sum_idx10 + 1; + //sum_rate10 = sum_rate10 + rate; } } } @@ -2291,11 +2327,14 @@ namespace AMESCoreStudio.Web.Controllers string dateStart11 = yCode + "-11-01"; string dateEnd11 = yCode + "-12-01"; var wipStaiton11 = await _pcsApi.GetWipStation4QRS014GroupS(param[1], dateStart11, dateEnd11, param[5], param[6], param[7]); + + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate11 = 100.0; - //int sum_idx11 = 1; - double sum_rate11 = 0.0; - int sum_idx11 = 0; + double sum_rate11 = 100.0; + int sum_idx11 = 1; + //double sum_rate11 = 0.0; + //int sum_idx11 = 0; + if (wipStaiton11.DataTotal > 0) { DataTable dtRate = new DataTable(); @@ -2400,12 +2439,13 @@ namespace AMESCoreStudio.Web.Controllers string dateStart12 = yCode + "-12-01"; string dateEnd12 = (int.Parse(yCode) + 1).ToString() + "-01-01"; var wipStaiton12 = await _pcsApi.GetWipStation4QRS014GroupS(param[1], dateStart12, dateEnd12, param[5], param[6], param[7]); - + + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate12 = 100.0; - //int sum_idx12 = 1; - double sum_rate12 = 0.0; - int sum_idx12 = 0; + double sum_rate12 = 100.0; + int sum_idx12 = 1; + //double sum_rate12 = 0.0; + //int sum_idx12 = 0; if (wipStaiton12.DataTotal > 0) { @@ -2487,9 +2527,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate12 = sum_rate12 * (rate / 100.0); - sum_idx12 = sum_idx12 + 1; - sum_rate12 = sum_rate12 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate12 = sum_rate12 * (rate / 100.0); + //sum_idx12 = sum_idx12 + 1; + //sum_rate12 = sum_rate12 + rate; } } } @@ -2531,11 +2572,12 @@ namespace AMESCoreStudio.Web.Controllers string dateEnd01 = yCode + "-02-01"; var wipStaiton01 = await _pcsApi.GetWipStation4QRS014GroupB(param[1], dateStart01, dateEnd01, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate01 = 100.0; - //int sum_idx01 = 1; - double sum_rate01 = 0.0; - int sum_idx01 = 0; + double sum_rate01 = 100.0; + int sum_idx01 = 1; + //double sum_rate01 = 0.0; + //int sum_idx01 = 0; if (wipStaiton01.DataTotal > 0) { @@ -2617,9 +2659,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate01 = sum_rate01 * (rate / 100.0); - sum_idx01 = sum_idx01 + 1; - sum_rate01 = sum_rate01 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate01 = sum_rate01 * (rate / 100.0); + //sum_idx01 = sum_idx01 + 1; + //sum_rate01 = sum_rate01 + rate; } } } @@ -2642,11 +2685,12 @@ namespace AMESCoreStudio.Web.Controllers string dateEnd02 = yCode + "-03-01"; var wipStaiton02 = await _pcsApi.GetWipStation4QRS014GroupB(param[1], dateStart02, dateEnd02, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate02 = 100.0; - //int sum_idx02 = 1; - double sum_rate02 = 0.0; - int sum_idx02 = 0; + double sum_rate02 = 100.0; + int sum_idx02 = 1; + //double sum_rate02 = 0.0; + //int sum_idx02 = 0; if (wipStaiton02.DataTotal > 0) { @@ -2728,9 +2772,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate02 = sum_rate02 * (rate / 100.0); - sum_idx02 = sum_idx02 + 1; - sum_rate02 = sum_rate02 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate02 = sum_rate02 * (rate / 100.0); + //sum_idx02 = sum_idx02 + 1; + //sum_rate02 = sum_rate02 + rate; } } } @@ -2752,12 +2797,13 @@ namespace AMESCoreStudio.Web.Controllers string dateStart03 = yCode + "-03-01"; string dateEnd03 = yCode + "-04-01"; var wipStaiton03 = await _pcsApi.GetWipStation4QRS014GroupB(param[1], dateStart03, dateEnd03, param[5], param[6], param[7]); - + + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate03 = 100.0; - //int sum_idx03 = 1; - double sum_rate03 = 0.0; - int sum_idx03 = 0; + double sum_rate03 = 100.0; + int sum_idx03 = 1; + //double sum_rate03 = 0.0; + //int sum_idx03 = 0; if (wipStaiton03.DataTotal > 0) { @@ -2839,9 +2885,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate03 = sum_rate03 * (rate / 100.0); - sum_idx03 = sum_idx03 + 1; - sum_rate03 = sum_rate03 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate03 = sum_rate03 * (rate / 100.0); + //sum_idx03 = sum_idx03 + 1; + //sum_rate03 = sum_rate03 + rate; } } } @@ -2864,11 +2911,12 @@ namespace AMESCoreStudio.Web.Controllers string dateEnd04 = yCode + "-05-01"; var wipStaiton04 = await _pcsApi.GetWipStation4QRS014GroupB(param[1], dateStart04, dateEnd04, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate04 = 100.0; - //int sum_idx04 = 1; - double sum_rate04 = 0.0; - int sum_idx04 = 0; + double sum_rate04 = 100.0; + int sum_idx04 = 1; + //double sum_rate04 = 0.0; + //int sum_idx04 = 0; if (wipStaiton04.DataTotal > 0) { @@ -2950,9 +2998,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate04 = sum_rate04 * (rate / 100.0); - sum_idx04 = sum_idx04 + 1; - sum_rate04 = sum_rate04 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate04 = sum_rate04 * (rate / 100.0); + //sum_idx04 = sum_idx04 + 1; + //sum_rate04 = sum_rate04 + rate; } } } @@ -2975,11 +3024,12 @@ namespace AMESCoreStudio.Web.Controllers string dateEnd05 = yCode + "-06-01"; var wipStaiton05 = await _pcsApi.GetWipStation4QRS014GroupB(param[1], dateStart05, dateEnd05, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate05 = 100.0; - //int sum_idx05 = 1; - double sum_rate05 = 0.0; - int sum_idx05 = 0; + double sum_rate05 = 100.0; + int sum_idx05 = 1; + //double sum_rate05 = 0.0; + //int sum_idx05 = 0; if (wipStaiton05.DataTotal > 0) { @@ -3061,9 +3111,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate05 = sum_rate05 * (rate / 100.0); - sum_idx05 = sum_idx05 + 1; - sum_rate05 = sum_rate05 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate05 = sum_rate05 * (rate / 100.0); + //sum_idx05 = sum_idx05 + 1; + //sum_rate05 = sum_rate05 + rate; } } } @@ -3086,11 +3137,12 @@ namespace AMESCoreStudio.Web.Controllers string dateEnd06 = yCode + "-07-01"; var wipStaiton06 = await _pcsApi.GetWipStation4QRS014GroupB(param[1], dateStart06, dateEnd06, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate06 = 100.0; - //int sum_idx06 = 1; - double sum_rate06 = 0.0; - int sum_idx06 = 0; + double sum_rate06 = 100.0; + int sum_idx06 = 1; + //double sum_rate06 = 0.0; + //int sum_idx06 = 0; if (wipStaiton06.DataTotal > 0) { @@ -3172,9 +3224,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate06 = sum_rate06 * (rate / 100.0); - sum_idx06 = sum_idx06 + 1; - sum_rate06 = sum_rate06 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate06 = sum_rate06 * (rate / 100.0); + //sum_idx06 = sum_idx06 + 1; + //sum_rate06 = sum_rate06 + rate; } } } @@ -3197,11 +3250,12 @@ namespace AMESCoreStudio.Web.Controllers string dateEnd07 = yCode + "-08-01"; var wipStaiton07 = await _pcsApi.GetWipStation4QRS014GroupB(param[1], dateStart07, dateEnd07, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate07 = 100.0; - //int sum_idx07 = 1; - double sum_rate07 = 0.0; - int sum_idx07 = 0; + double sum_rate07 = 100.0; + int sum_idx07 = 1; + //double sum_rate07 = 0.0; + //int sum_idx07 = 0; if (wipStaiton07.DataTotal > 0) { @@ -3283,9 +3337,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate07 = sum_rate07 * (rate / 100.0); - sum_idx07 = sum_idx07 + 1; - sum_rate07 = sum_rate07 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate07 = sum_rate07 * (rate / 100.0); + //sum_idx07 = sum_idx07 + 1; + //sum_rate07 = sum_rate07 + rate; } } } @@ -3308,11 +3363,12 @@ namespace AMESCoreStudio.Web.Controllers string dateEnd08 = yCode + "-09-01"; var wipStaiton08 = await _pcsApi.GetWipStation4QRS014GroupB(param[1], dateStart08, dateEnd08, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate08 = 100.0; - //int sum_idx08 = 1; - double sum_rate08 = 0.0; - int sum_idx08 = 0; + double sum_rate08 = 100.0; + int sum_idx08 = 1; + //double sum_rate08 = 0.0; + //int sum_idx08 = 0; if (wipStaiton08.DataTotal > 0) { @@ -3394,9 +3450,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate08 = sum_rate08 * (rate / 100.0); - sum_idx08 = sum_idx08 + 1; - sum_rate08 = sum_rate08 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate08 = sum_rate08 * (rate / 100.0); + //sum_idx08 = sum_idx08 + 1; + //sum_rate08 = sum_rate08 + rate; } } } @@ -3419,11 +3476,12 @@ namespace AMESCoreStudio.Web.Controllers string dateEnd09 = yCode + "-10-01"; var wipStaiton09 = await _pcsApi.GetWipStation4QRS014GroupB(param[1], dateStart09, dateEnd09, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate09 = 100.0; - //int sum_idx09 = 1; - double sum_rate09 = 0.0; - int sum_idx09 = 0; + double sum_rate09 = 100.0; + int sum_idx09 = 1; + //double sum_rate09 = 0.0; + //int sum_idx09 = 0; if (wipStaiton09.DataTotal > 0) { @@ -3505,9 +3563,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate09 = sum_rate09 * (rate / 100.0); - sum_idx09 = sum_idx09 + 1; - sum_rate09 = sum_rate09 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate09 = sum_rate09 * (rate / 100.0); + //sum_idx09 = sum_idx09 + 1; + //sum_rate09 = sum_rate09 + rate; } } } @@ -3530,11 +3589,12 @@ namespace AMESCoreStudio.Web.Controllers string dateEnd10 = yCode + "-11-01"; var wipStaiton10 = await _pcsApi.GetWipStation4QRS014GroupB(param[1], dateStart10, dateEnd10, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate10 = 100.0; - //int sum_idx10 = 1; - double sum_rate10 = 0.0; - int sum_idx10 = 0; + double sum_rate10 = 100.0; + int sum_idx10 = 1; + //double sum_rate10 = 0.0; + //int sum_idx10 = 0; if (wipStaiton10.DataTotal > 0) { @@ -3616,9 +3676,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate10 = sum_rate10 * (rate / 100.0); - sum_idx10 = sum_idx10 + 1; - sum_rate10 = sum_rate10 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate10 = sum_rate10 * (rate / 100.0); + //sum_idx10 = sum_idx10 + 1; + //sum_rate10 = sum_rate10 + rate; } } } @@ -3641,11 +3702,12 @@ namespace AMESCoreStudio.Web.Controllers string dateEnd11 = yCode + "-12-01"; var wipStaiton11 = await _pcsApi.GetWipStation4QRS014GroupB(param[1], dateStart11, dateEnd11, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate11 = 100.0; - //int sum_idx11 = 1; - double sum_rate11 = 0.0; - int sum_idx11 = 0; + double sum_rate11 = 100.0; + int sum_idx11 = 1; + //double sum_rate11 = 0.0; + //int sum_idx11 = 0; if (wipStaiton11.DataTotal > 0) { @@ -3727,9 +3789,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate11 = sum_rate11 * (rate / 100.0); - sum_idx11 = sum_idx11 + 1; - sum_rate11 = sum_rate11 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate11 = sum_rate11 * (rate / 100.0); + //sum_idx11 = sum_idx11 + 1; + //sum_rate11 = sum_rate11 + rate; } } } @@ -3752,11 +3815,12 @@ namespace AMESCoreStudio.Web.Controllers string dateEnd12 = (int.Parse(yCode) + 1).ToString() + "-01-01"; var wipStaiton12 = await _pcsApi.GetWipStation4QRS014GroupB(param[1], dateStart12, dateEnd12, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate12 = 100.0; - //int sum_idx12 = 1; - double sum_rate12 = 0.0; - int sum_idx12 = 0; + double sum_rate12 = 100.0; + int sum_idx12 = 1; + //double sum_rate12 = 0.0; + //int sum_idx12 = 0; if (wipStaiton12.DataTotal > 0) { @@ -3838,9 +3902,10 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate12 = sum_rate12 * (rate / 100.0); - sum_idx12 = sum_idx12 + 1; - sum_rate12 = sum_rate12 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate12 = sum_rate12 * (rate / 100.0); + //sum_idx12 = sum_idx12 + 1; + //sum_rate12 = sum_rate12 + rate; } } } @@ -3861,11 +3926,11 @@ namespace AMESCoreStudio.Web.Controllers } [HttpPost] - public async Task GetYieldData4QRS014CBAsync(string id) + public async Task GetYieldData4QRS014BMAsync(string id) { string[] param = id.Split('_'); - var query = new QRS014CViewModel(); + var query = new QRS014BViewModel(); string yCode = DateTime.Now.Year.ToString(); if (param[3] != null) @@ -3876,28 +3941,39 @@ namespace AMESCoreStudio.Web.Controllers } } - var wipStation = await _pcsApi.GetWipStation4QRS014GroupBByWeek(param[1], param[3], param[4], param[5], param[6], param[7]); + #region 01 - if (wipStation.DataTotal > 0) + string dateStart01 = yCode + "-01-01"; + string dateEnd01 = yCode + "-02-01"; + var wipStaiton01 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart01, dateEnd01, param[5], param[6], param[7]); + + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + //2024-03-26 BB.Wang Modify 修正良率(代小平) + double sum_rate01 = 100.0; + int sum_idx01 = 1; + //double sum_rate01 = 0.0; + //int sum_idx01 = 0; + + if (wipStaiton01.DataTotal > 0) { DataTable dtRate = new DataTable(); - dtRate.Columns.Add("WEEK_CODE"); + dtRate.Columns.Add("STATION_ID"); dtRate.Columns.Add("OK_QTY"); dtRate.Columns.Add("NG_QTY"); dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; dtRate.AcceptChanges(); - foreach (var data in wipStation.Data) + foreach (var data in wipStaiton01.Data) { JObject j0 = JObject.Parse(data.ToString()); - string weekCode = j0["weekCode"].ToString(); + int stationID = int.Parse(j0["stationID"].ToString()); bool existFlag = false; int idx = 0; for (int i = 0; i < dtRate.Rows.Count; i++) { - if (dtRate.Rows[i]["WEEK_CODE"].ToString() == weekCode) + if (dtRate.Rows[i]["STATION_ID"].ToString() == stationID.ToString()) { idx = i; existFlag = true; @@ -3932,7 +4008,7 @@ namespace AMESCoreStudio.Web.Controllers else { DataRow dr = dtRate.NewRow(); - dr[0] = weekCode; + dr[0] = stationID; dr[1] = okQty; dr[2] = ngQty; @@ -3945,7 +4021,6 @@ namespace AMESCoreStudio.Web.Controllers { for (int j = 0; j < dtRate.Rows.Count; j++) { - string week_code = dtRate.Rows[j][0].ToString(); int okQty = int.Parse(dtRate.Rows[j][1].ToString()); int ngQty = int.Parse(dtRate.Rows[j][2].ToString()); @@ -3957,56 +4032,61 @@ namespace AMESCoreStudio.Web.Controllers rate = (okQty * 1.0 / inputQty) * 100; } - query.FPYDatas.Add(new FPY4WeekGroup + if (rate > 0) { - Week = week_code, - Yield = double.Parse(rate.ToString("0.00")) - }); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate01 = sum_rate01 * (rate / 100.0); + //sum_idx01 = sum_idx01 + 1; + //sum_rate01 = sum_rate01 + rate; + } } } } + else + { + sum_rate01 = 0.00; + } + query.FPYDatas.Add(new FPY4MonthGroup + { + Month = yCode + "-01", + Yield = double.Parse((sum_rate01 / sum_idx01).ToString("0.00")) + }); - return Json(query.FPYDatas); - } - - [HttpPost] - public async Task GetYieldData4QRS014CMAsync(string id) - { - string[] param = id.Split('_'); + #endregion - var query = new QRS014CViewModel(); + #region 02 - string yCode = DateTime.Now.Year.ToString(); - if (param[3] != null) - { - if (param[3] != "") - { - yCode = param[3].Substring(0, 4); - } - } + string dateStart02 = yCode + "-02-01"; + string dateEnd02 = yCode + "-03-01"; + var wipStaiton02 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart02, dateEnd02, param[5], param[6], param[7]); - var wipStation = await _pcsApi.GetWipStation4QRS014GroupMByWeek(param[1], param[3], param[4], param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + //2024-03-26 BB.Wang Modify 修正良率(代小平) + double sum_rate02 = 100.0; + int sum_idx02 = 1; + //double sum_rate02 = 0.0; + //int sum_idx02 = 0; - if (wipStation.DataTotal > 0) + if (wipStaiton02.DataTotal > 0) { DataTable dtRate = new DataTable(); - dtRate.Columns.Add("WEEK_CODE"); + dtRate.Columns.Add("STATION_ID"); dtRate.Columns.Add("OK_QTY"); dtRate.Columns.Add("NG_QTY"); dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; dtRate.AcceptChanges(); - foreach (var data in wipStation.Data) + foreach (var data in wipStaiton02.Data) { JObject j0 = JObject.Parse(data.ToString()); - string weekCode = j0["weekCode"].ToString(); + int stationID = int.Parse(j0["stationID"].ToString()); bool existFlag = false; int idx = 0; for (int i = 0; i < dtRate.Rows.Count; i++) { - if (dtRate.Rows[i]["WEEK_CODE"].ToString() == weekCode) + if (dtRate.Rows[i]["STATION_ID"].ToString() == stationID.ToString()) { idx = i; existFlag = true; @@ -4041,7 +4121,7 @@ namespace AMESCoreStudio.Web.Controllers else { DataRow dr = dtRate.NewRow(); - dr[0] = weekCode; + dr[0] = stationID; dr[1] = okQty; dr[2] = ngQty; @@ -4054,7 +4134,6 @@ namespace AMESCoreStudio.Web.Controllers { for (int j = 0; j < dtRate.Rows.Count; j++) { - string week_code = dtRate.Rows[j][0].ToString(); int okQty = int.Parse(dtRate.Rows[j][1].ToString()); int ngQty = int.Parse(dtRate.Rows[j][2].ToString()); @@ -4066,57 +4145,61 @@ namespace AMESCoreStudio.Web.Controllers rate = (okQty * 1.0 / inputQty) * 100; } - query.FPYDatas.Add(new FPY4WeekGroup + if (rate > 0) { - Week = week_code, - Yield = double.Parse(rate.ToString("0.00")) - }); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate02 = sum_rate02 * (rate / 100.0); + //sum_idx02 = sum_idx02 + 1; + //sum_rate02 = sum_rate02 + rate; + } } } } + else + { + sum_rate02 = 0.00; + } + query.FPYDatas.Add(new FPY4MonthGroup + { + Month = yCode + "-02", + Yield = double.Parse((sum_rate02 / sum_idx02).ToString("0.00")) + }); - return Json(query.FPYDatas); - } - - //直通率 --- 周 - [HttpPost] - public async Task GetYieldData4QRS014CSAsync(string id) - { - string[] param = id.Split('_'); + #endregion - var query = new QRS014CViewModel(); + #region 03 - string yCode = DateTime.Now.Year.ToString(); - if (param[3] != null) - { - if (param[3] != "") - { - yCode = param[3].Substring(0, 4); - } - } + string dateStart03 = yCode + "-03-01"; + string dateEnd03 = yCode + "-04-01"; + var wipStaiton03 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart03, dateEnd03, param[5], param[6], param[7]); - var wipStation = await _pcsApi.GetWipStation4QRS014GroupSByWeek(param[1], param[3], param[4], param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + //2024-03-26 BB.Wang Modify 修正良率(代小平) + double sum_rate03 = 100.0; + int sum_idx03 = 1; + //double sum_rate03 = 0.0; + //int sum_idx03 = 0; - if (wipStation.DataTotal > 0) + if (wipStaiton03.DataTotal > 0) { DataTable dtRate = new DataTable(); - dtRate.Columns.Add("WEEK_CODE"); + dtRate.Columns.Add("STATION_ID"); dtRate.Columns.Add("OK_QTY"); dtRate.Columns.Add("NG_QTY"); dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; dtRate.AcceptChanges(); - foreach (var data in wipStation.Data) + foreach (var data in wipStaiton03.Data) { JObject j0 = JObject.Parse(data.ToString()); - string weekCode = j0["weekCode"].ToString(); + int stationID = int.Parse(j0["stationID"].ToString()); bool existFlag = false; int idx = 0; for (int i = 0; i < dtRate.Rows.Count; i++) { - if (dtRate.Rows[i]["WEEK_CODE"].ToString() == weekCode) + if (dtRate.Rows[i]["STATION_ID"].ToString() == stationID.ToString()) { idx = i; existFlag = true; @@ -4151,7 +4234,7 @@ namespace AMESCoreStudio.Web.Controllers else { DataRow dr = dtRate.NewRow(); - dr[0] = weekCode; + dr[0] = stationID; dr[1] = okQty; dr[2] = ngQty; @@ -4164,7 +4247,6 @@ namespace AMESCoreStudio.Web.Controllers { for (int j = 0; j < dtRate.Rows.Count; j++) { - string week_code = dtRate.Rows[j][0].ToString(); int okQty = int.Parse(dtRate.Rows[j][1].ToString()); int ngQty = int.Parse(dtRate.Rows[j][2].ToString()); @@ -4176,47 +4258,42 @@ namespace AMESCoreStudio.Web.Controllers rate = (okQty * 1.0 / inputQty) * 100; } - query.FPYDatas.Add(new FPY4WeekGroup + if (rate > 0) { - Week = week_code, - Yield = double.Parse(rate.ToString("0.00")) - }); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate03 = sum_rate03 * (rate / 100.0); + //sum_idx03 = sum_idx03 + 1; + //sum_rate03 = sum_rate03 + rate; + } } } } - - return Json(query.FPYDatas); - } - - [HttpPost] - public async Task GetYieldData4QRS014BMAsync(string id) - { - string[] param = id.Split('_'); - - var query = new QRS014BViewModel(); - - string yCode = DateTime.Now.Year.ToString(); - if (param[3] != null) + else { - if (param[3] != "") - { - yCode = param[3].Substring(0, 4); - } + sum_rate03 = 0.00; } + query.FPYDatas.Add(new FPY4MonthGroup + { + Month = yCode + "-03", + Yield = double.Parse((sum_rate03 / sum_idx03).ToString("0.00")) + }); - #region 01 + #endregion - string dateStart01 = yCode + "-01-01"; - string dateEnd01 = yCode + "-02-01"; - var wipStaiton01 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart01, dateEnd01, param[5], param[6], param[7]); + #region 04 + + string dateStart04 = yCode + "-04-01"; + string dateEnd04 = yCode + "-05-01"; + var wipStaiton04 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart04, dateEnd04, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate01 = 100.0; - //int sum_idx01 = 1; - double sum_rate01 = 0.0; - int sum_idx01 = 0; + double sum_rate04 = 100.0; + int sum_idx04 = 1; + //double sum_rate04 = 0.0; + //int sum_idx04 = 0; - if (wipStaiton01.DataTotal > 0) + if (wipStaiton04.DataTotal > 0) { DataTable dtRate = new DataTable(); dtRate.Columns.Add("STATION_ID"); @@ -4225,7 +4302,7 @@ namespace AMESCoreStudio.Web.Controllers dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; dtRate.AcceptChanges(); - foreach (var data in wipStaiton01.Data) + foreach (var data in wipStaiton04.Data) { JObject j0 = JObject.Parse(data.ToString()); int stationID = int.Parse(j0["stationID"].ToString()); @@ -4296,38 +4373,40 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate01 = sum_rate01 * (rate / 100.0); - sum_idx01 = sum_idx01 + 1; - sum_rate01 = sum_rate01 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate04 = sum_rate04 * (rate / 100.0); + //sum_idx04 = sum_idx04 + 1; + //sum_rate04 = sum_rate04 + rate; } } } } else { - sum_rate01 = 0.00; + sum_rate04 = 0.00; } query.FPYDatas.Add(new FPY4MonthGroup { - Month = yCode + "-01", - Yield = double.Parse((sum_rate01 / sum_idx01).ToString("0.00")) + Month = yCode + "-04", + Yield = double.Parse((sum_rate04 / sum_idx04).ToString("0.00")) }); #endregion - #region 02 + #region 05 - string dateStart02 = yCode + "-02-01"; - string dateEnd02 = yCode + "-03-01"; - var wipStaiton02 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart02, dateEnd02, param[5], param[6], param[7]); + string dateStart05 = yCode + "-05-01"; + string dateEnd05 = yCode + "-06-01"; + var wipStaiton05 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart05, dateEnd05, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate02 = 100.0; - //int sum_idx02 = 1; - double sum_rate02 = 0.0; - int sum_idx02 = 0; + double sum_rate05 = 100.0; + int sum_idx05 = 1; + //double sum_rate05 = 0.0; + //int sum_idx05 = 0; - if (wipStaiton02.DataTotal > 0) + if (wipStaiton05.DataTotal > 0) { DataTable dtRate = new DataTable(); dtRate.Columns.Add("STATION_ID"); @@ -4336,7 +4415,7 @@ namespace AMESCoreStudio.Web.Controllers dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; dtRate.AcceptChanges(); - foreach (var data in wipStaiton02.Data) + foreach (var data in wipStaiton05.Data) { JObject j0 = JObject.Parse(data.ToString()); int stationID = int.Parse(j0["stationID"].ToString()); @@ -4407,38 +4486,40 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate02 = sum_rate02 * (rate / 100.0); - sum_idx02 = sum_idx02 + 1; - sum_rate02 = sum_rate02 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate05 = sum_rate05 * (rate / 100.0); + //sum_idx05 = sum_idx05 + 1; + //sum_rate05 = sum_rate05 + rate; } } } } else { - sum_rate02 = 0.00; + sum_rate05 = 0.00; } query.FPYDatas.Add(new FPY4MonthGroup { - Month = yCode + "-02", - Yield = double.Parse((sum_rate02 / sum_idx02).ToString("0.00")) + Month = yCode + "-05", + Yield = double.Parse((sum_rate05 / sum_idx05).ToString("0.00")) }); #endregion - #region 03 + #region 06 - string dateStart03 = yCode + "-03-01"; - string dateEnd03 = yCode + "-04-01"; - var wipStaiton03 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart03, dateEnd03, param[5], param[6], param[7]); + string dateStart06 = yCode + "-06-01"; + string dateEnd06 = yCode + "-07-01"; + var wipStaiton06 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart06, dateEnd06, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate03 = 100.0; - //int sum_idx03 = 1; - double sum_rate03 = 0.0; - int sum_idx03 = 0; + double sum_rate06 = 100.0; + int sum_idx06 = 1; + //double sum_rate06 = 0.0; + //int sum_idx06 = 0; - if (wipStaiton03.DataTotal > 0) + if (wipStaiton06.DataTotal > 0) { DataTable dtRate = new DataTable(); dtRate.Columns.Add("STATION_ID"); @@ -4447,7 +4528,7 @@ namespace AMESCoreStudio.Web.Controllers dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; dtRate.AcceptChanges(); - foreach (var data in wipStaiton03.Data) + foreach (var data in wipStaiton06.Data) { JObject j0 = JObject.Parse(data.ToString()); int stationID = int.Parse(j0["stationID"].ToString()); @@ -4518,38 +4599,40 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate03 = sum_rate03 * (rate / 100.0); - sum_idx03 = sum_idx03 + 1; - sum_rate03 = sum_rate03 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate06 = sum_rate06 * (rate / 100.0); + //sum_idx06 = sum_idx06 + 1; + //sum_rate06 = sum_rate06 + rate; } } } } else { - sum_rate03 = 0.00; + sum_rate06 = 0.00; } query.FPYDatas.Add(new FPY4MonthGroup { - Month = yCode + "-03", - Yield = double.Parse((sum_rate03 / sum_idx03).ToString("0.00")) + Month = yCode + "-06", + Yield = double.Parse((sum_rate06 / sum_idx06).ToString("0.00")) }); #endregion - #region 04 - - string dateStart04 = yCode + "-04-01"; - string dateEnd04 = yCode + "-05-01"; - var wipStaiton04 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart04, dateEnd04, param[5], param[6], param[7]); + #region 07 - //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate04 = 100.0; - //int sum_idx04 = 1; - double sum_rate04 = 0.0; - int sum_idx04 = 0; + string dateStart07 = yCode + "-07-01"; + string dateEnd07 = yCode + "-08-01"; + var wipStaiton07 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart07, dateEnd07, param[5], param[6], param[7]); - if (wipStaiton04.DataTotal > 0) + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + //2024-03-26 BB.Wang Modify 修正良率(代小平) + double sum_rate07 = 100.0; + int sum_idx07 = 1; + //double sum_rate07 = 0.0; + //int sum_idx07 = 0; + + if (wipStaiton07.DataTotal > 0) { DataTable dtRate = new DataTable(); dtRate.Columns.Add("STATION_ID"); @@ -4558,7 +4641,7 @@ namespace AMESCoreStudio.Web.Controllers dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; dtRate.AcceptChanges(); - foreach (var data in wipStaiton04.Data) + foreach (var data in wipStaiton07.Data) { JObject j0 = JObject.Parse(data.ToString()); int stationID = int.Parse(j0["stationID"].ToString()); @@ -4629,38 +4712,39 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate04 = sum_rate04 * (rate / 100.0); - sum_idx04 = sum_idx04 + 1; - sum_rate04 = sum_rate04 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate07 = sum_rate07 * (rate / 100.0); + //sum_idx07 = sum_idx07 + 1; + //sum_rate07 = sum_rate07 + rate; } } } } else { - sum_rate04 = 0.00; + sum_rate07 = 0.00; } query.FPYDatas.Add(new FPY4MonthGroup { - Month = yCode + "-04", - Yield = double.Parse((sum_rate04 / sum_idx04).ToString("0.00")) + Month = yCode + "-07", + Yield = double.Parse((sum_rate07 / sum_idx07).ToString("0.00")) }); #endregion - #region 05 + #region 08 - string dateStart05 = yCode + "-05-01"; - string dateEnd05 = yCode + "-06-01"; - var wipStaiton05 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart05, dateEnd05, param[5], param[6], param[7]); - + string dateStart08 = yCode + "-08-01"; + string dateEnd08 = yCode + "-09-01"; + var wipStaiton08 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart08, dateEnd08, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate05 = 100.0; - //int sum_idx05 = 1; - double sum_rate05 = 0.0; - int sum_idx05 = 0; + double sum_rate08 = 100.0; + int sum_idx08 = 1; + //double sum_rate08 = 0.0; + //int sum_idx08 = 0; - if (wipStaiton05.DataTotal > 0) + if (wipStaiton08.DataTotal > 0) { DataTable dtRate = new DataTable(); dtRate.Columns.Add("STATION_ID"); @@ -4669,7 +4753,7 @@ namespace AMESCoreStudio.Web.Controllers dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; dtRate.AcceptChanges(); - foreach (var data in wipStaiton05.Data) + foreach (var data in wipStaiton08.Data) { JObject j0 = JObject.Parse(data.ToString()); int stationID = int.Parse(j0["stationID"].ToString()); @@ -4740,38 +4824,40 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate05 = sum_rate05 * (rate / 100.0); - sum_idx05 = sum_idx05 + 1; - sum_rate05 = sum_rate05 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate08 = sum_rate08 * (rate / 100.0); + //sum_idx08 = sum_idx08 + 1; + //sum_rate08 = sum_rate08 + rate; } } } } else { - sum_rate05 = 0.00; + sum_rate08 = 0.00; } query.FPYDatas.Add(new FPY4MonthGroup { - Month = yCode + "-05", - Yield = double.Parse((sum_rate05 / sum_idx05).ToString("0.00")) + Month = yCode + "-08", + Yield = double.Parse((sum_rate08 / sum_idx08).ToString("0.00")) }); #endregion - #region 06 + #region 09 - string dateStart06 = yCode + "-06-01"; - string dateEnd06 = yCode + "-07-01"; - var wipStaiton06 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart06, dateEnd06, param[5], param[6], param[7]); + string dateStart09 = yCode + "-09-01"; + string dateEnd09 = yCode + "-10-01"; + var wipStaiton09 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart09, dateEnd09, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate06 = 100.0; - //int sum_idx06 = 1; - double sum_rate06 = 0.0; - int sum_idx06 = 0; + double sum_rate09 = 100.0; + int sum_idx09 = 1; + //double sum_rate09 = 0.0; + //int sum_idx09 = 0; - if (wipStaiton06.DataTotal > 0) + if (wipStaiton09.DataTotal > 0) { DataTable dtRate = new DataTable(); dtRate.Columns.Add("STATION_ID"); @@ -4780,7 +4866,7 @@ namespace AMESCoreStudio.Web.Controllers dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; dtRate.AcceptChanges(); - foreach (var data in wipStaiton06.Data) + foreach (var data in wipStaiton09.Data) { JObject j0 = JObject.Parse(data.ToString()); int stationID = int.Parse(j0["stationID"].ToString()); @@ -4851,38 +4937,40 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate06 = sum_rate06 * (rate / 100.0); - sum_idx06 = sum_idx06 + 1; - sum_rate06 = sum_rate06 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate09 = sum_rate09 * (rate / 100.0); + //sum_idx09 = sum_idx09 + 1; + //sum_rate09 = sum_rate09 + rate; } } } } else { - sum_rate06 = 0.00; + sum_rate09 = 0.00; } query.FPYDatas.Add(new FPY4MonthGroup { - Month = yCode + "-06", - Yield = double.Parse((sum_rate06 / sum_idx06).ToString("0.00")) + Month = yCode + "-09", + Yield = double.Parse((sum_rate09 / sum_idx09).ToString("0.00")) }); #endregion - #region 07 + #region 10 - string dateStart07 = yCode + "-07-01"; - string dateEnd07 = yCode + "-08-01"; - var wipStaiton07 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart07, dateEnd07, param[5], param[6], param[7]); - + string dateStart10 = yCode + "-10-01"; + string dateEnd10 = yCode + "-11-01"; + var wipStaiton10 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart10, dateEnd10, param[5], param[6], param[7]); + + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate07 = 100.0; - //int sum_idx07 = 1; - double sum_rate07 = 0.0; - int sum_idx07 = 0; + double sum_rate10 = 100.0; + int sum_idx10 = 1; + //double sum_rate10 = 0.0; + //int sum_idx10 = 0; - if (wipStaiton07.DataTotal > 0) + if (wipStaiton10.DataTotal > 0) { DataTable dtRate = new DataTable(); dtRate.Columns.Add("STATION_ID"); @@ -4891,7 +4979,7 @@ namespace AMESCoreStudio.Web.Controllers dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; dtRate.AcceptChanges(); - foreach (var data in wipStaiton07.Data) + foreach (var data in wipStaiton10.Data) { JObject j0 = JObject.Parse(data.ToString()); int stationID = int.Parse(j0["stationID"].ToString()); @@ -4962,38 +5050,40 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate07 = sum_rate07 * (rate / 100.0); - sum_idx07 = sum_idx07 + 1; - sum_rate07 = sum_rate07 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate10 = sum_rate10 * (rate / 100.0); + //sum_idx10 = sum_idx10 + 1; + //sum_rate10 = sum_rate10 + rate; } } } } else { - sum_rate07 = 0.00; + sum_rate10 = 0.00; } query.FPYDatas.Add(new FPY4MonthGroup { - Month = yCode + "-07", - Yield = double.Parse((sum_rate07 / sum_idx07).ToString("0.00")) + Month = yCode + "-10", + Yield = double.Parse((sum_rate10 / sum_idx10).ToString("0.00")) }); #endregion - #region 08 + #region 11 - string dateStart08 = yCode + "-08-01"; - string dateEnd08 = yCode + "-09-01"; - var wipStaiton08 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart08, dateEnd08, param[5], param[6], param[7]); + string dateStart11 = yCode + "-11-01"; + string dateEnd11 = yCode + "-12-01"; + var wipStaiton11 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart11, dateEnd11, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate08 = 100.0; - //int sum_idx08 = 1; - double sum_rate08 = 0.0; - int sum_idx08 = 0; + double sum_rate11 = 100.0; + int sum_idx11 = 1; + //double sum_rate11 = 0.0; + //int sum_idx11 = 0; - if (wipStaiton08.DataTotal > 0) + if (wipStaiton11.DataTotal > 0) { DataTable dtRate = new DataTable(); dtRate.Columns.Add("STATION_ID"); @@ -5002,7 +5092,7 @@ namespace AMESCoreStudio.Web.Controllers dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; dtRate.AcceptChanges(); - foreach (var data in wipStaiton08.Data) + foreach (var data in wipStaiton11.Data) { JObject j0 = JObject.Parse(data.ToString()); int stationID = int.Parse(j0["stationID"].ToString()); @@ -5073,38 +5163,40 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate08 = sum_rate08 * (rate / 100.0); - sum_idx08 = sum_idx08 + 1; - sum_rate08 = sum_rate08 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate11 = sum_rate11 * (rate / 100.0); + //sum_idx11 = sum_idx11 + 1; + //sum_rate11 = sum_rate11 + rate; } } } } else { - sum_rate08 = 0.00; + sum_rate11 = 0.00; } query.FPYDatas.Add(new FPY4MonthGroup { - Month = yCode + "-08", - Yield = double.Parse((sum_rate08 / sum_idx08).ToString("0.00")) + Month = yCode + "-11", + Yield = double.Parse((sum_rate11 / sum_idx11).ToString("0.00")) }); #endregion - #region 09 + #region 12 - string dateStart09 = yCode + "-09-01"; - string dateEnd09 = yCode + "-10-01"; - var wipStaiton09 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart09, dateEnd09, param[5], param[6], param[7]); + string dateStart12 = yCode + "-12-01"; + string dateEnd12 = (int.Parse(yCode) + 1).ToString() + "-01-01"; + var wipStaiton12 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart12, dateEnd12, param[5], param[6], param[7]); + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate09 = 100.0; - //int sum_idx09 = 1; - double sum_rate09 = 0.0; - int sum_idx09 = 0; + double sum_rate12 = 100.0; + int sum_idx12 = 1; + //double sum_rate12 = 0.0; + //int sum_idx12 = 0; - if (wipStaiton09.DataTotal > 0) + if (wipStaiton12.DataTotal > 0) { DataTable dtRate = new DataTable(); dtRate.Columns.Add("STATION_ID"); @@ -5113,7 +5205,7 @@ namespace AMESCoreStudio.Web.Controllers dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; dtRate.AcceptChanges(); - foreach (var data in wipStaiton09.Data) + foreach (var data in wipStaiton12.Data) { JObject j0 = JObject.Parse(data.ToString()); int stationID = int.Parse(j0["stationID"].ToString()); @@ -5184,57 +5276,67 @@ namespace AMESCoreStudio.Web.Controllers if (rate > 0) { - //sum_rate09 = sum_rate09 * (rate / 100.0); - sum_idx09 = sum_idx09 + 1; - sum_rate09 = sum_rate09 + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate12 = sum_rate12 * (rate / 100.0); + //sum_idx12 = sum_idx12 + 1; + //sum_rate12 = sum_rate12 + rate; } } } } else { - sum_rate09 = 0.00; + sum_rate12 = 0.00; } query.FPYDatas.Add(new FPY4MonthGroup { - Month = yCode + "-09", - Yield = double.Parse((sum_rate09 / sum_idx09).ToString("0.00")) + Month = yCode + "-12", + Yield = double.Parse((sum_rate12 / sum_idx12).ToString("0.00")) }); #endregion - #region 10 + return Json(query.FPYDatas); + } - string dateStart10 = yCode + "-10-01"; - string dateEnd10 = yCode + "-11-01"; - var wipStaiton10 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart10, dateEnd10, param[5], param[6], param[7]); + [HttpPost] + public async Task GetYieldData4QRS014CBAsync(string id) + { + string[] param = id.Split('_'); - //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate10 = 100.0; - //int sum_idx10 = 1; - double sum_rate10 = 0.0; - int sum_idx10= 0; + var query = new QRS014CViewModel(); - if (wipStaiton10.DataTotal > 0) + string yCode = DateTime.Now.Year.ToString(); + if (param[3] != null) + { + if (param[3] != "") + { + yCode = param[3].Substring(0, 4); + } + } + + var wipStation = await _pcsApi.GetWipStation4QRS014GroupBByWeek(param[1], param[3], param[4], param[5], param[6], param[7]); + + if (wipStation.DataTotal > 0) { DataTable dtRate = new DataTable(); - dtRate.Columns.Add("STATION_ID"); + dtRate.Columns.Add("WEEK_CODE"); dtRate.Columns.Add("OK_QTY"); dtRate.Columns.Add("NG_QTY"); dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; dtRate.AcceptChanges(); - foreach (var data in wipStaiton10.Data) + foreach (var data in wipStation.Data) { JObject j0 = JObject.Parse(data.ToString()); - int stationID = int.Parse(j0["stationID"].ToString()); + string weekCode = j0["weekCode"].ToString(); bool existFlag = false; int idx = 0; for (int i = 0; i < dtRate.Rows.Count; i++) { - if (dtRate.Rows[i]["STATION_ID"].ToString() == stationID.ToString()) + if (dtRate.Rows[i]["WEEK_CODE"].ToString() == weekCode) { idx = i; existFlag = true; @@ -5269,7 +5371,7 @@ namespace AMESCoreStudio.Web.Controllers else { DataRow dr = dtRate.NewRow(); - dr[0] = stationID; + dr[0] = weekCode; dr[1] = okQty; dr[2] = ngQty; @@ -5282,6 +5384,7 @@ namespace AMESCoreStudio.Web.Controllers { for (int j = 0; j < dtRate.Rows.Count; j++) { + string week_code = dtRate.Rows[j][0].ToString(); int okQty = int.Parse(dtRate.Rows[j][1].ToString()); int ngQty = int.Parse(dtRate.Rows[j][2].ToString()); @@ -5293,59 +5396,56 @@ namespace AMESCoreStudio.Web.Controllers rate = (okQty * 1.0 / inputQty) * 100; } - if (rate > 0) + query.FPYDatas.Add(new FPY4WeekGroup { - //sum_rate10 = sum_rate10 * (rate / 100.0); - sum_idx10 = sum_idx10 + 1; - sum_rate10 = sum_rate10 + rate; - } + Week = week_code, + Yield = double.Parse(rate.ToString("0.00")) + }); } } } - else - { - sum_rate10 = 0.00; - } - query.FPYDatas.Add(new FPY4MonthGroup - { - Month = yCode + "-10", - Yield = double.Parse((sum_rate10 / sum_idx10).ToString("0.00")) - }); - #endregion + return Json(query.FPYDatas); + } - #region 11 + [HttpPost] + public async Task GetYieldData4QRS014CMAsync(string id) + { + string[] param = id.Split('_'); - string dateStart11 = yCode + "-11-01"; - string dateEnd11 = yCode + "-12-01"; - var wipStaiton11 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart11, dateEnd11, param[5], param[6], param[7]); + var query = new QRS014CViewModel(); - //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate11 = 100.0; - //int sum_idx11 = 1; - double sum_rate11 = 0.0; - int sum_idx11 = 0; + string yCode = DateTime.Now.Year.ToString(); + if (param[3] != null) + { + if (param[3] != "") + { + yCode = param[3].Substring(0, 4); + } + } - if (wipStaiton11.DataTotal > 0) + var wipStation = await _pcsApi.GetWipStation4QRS014GroupMByWeek(param[1], param[3], param[4], param[5], param[6], param[7]); + + if (wipStation.DataTotal > 0) { DataTable dtRate = new DataTable(); - dtRate.Columns.Add("STATION_ID"); + dtRate.Columns.Add("WEEK_CODE"); dtRate.Columns.Add("OK_QTY"); dtRate.Columns.Add("NG_QTY"); dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; dtRate.AcceptChanges(); - foreach (var data in wipStaiton11.Data) + foreach (var data in wipStation.Data) { JObject j0 = JObject.Parse(data.ToString()); - int stationID = int.Parse(j0["stationID"].ToString()); + string weekCode = j0["weekCode"].ToString(); bool existFlag = false; int idx = 0; for (int i = 0; i < dtRate.Rows.Count; i++) { - if (dtRate.Rows[i]["STATION_ID"].ToString() == stationID.ToString()) + if (dtRate.Rows[i]["WEEK_CODE"].ToString() == weekCode) { idx = i; existFlag = true; @@ -5380,7 +5480,7 @@ namespace AMESCoreStudio.Web.Controllers else { DataRow dr = dtRate.NewRow(); - dr[0] = stationID; + dr[0] = weekCode; dr[1] = okQty; dr[2] = ngQty; @@ -5393,6 +5493,7 @@ namespace AMESCoreStudio.Web.Controllers { for (int j = 0; j < dtRate.Rows.Count; j++) { + string week_code = dtRate.Rows[j][0].ToString(); int okQty = int.Parse(dtRate.Rows[j][1].ToString()); int ngQty = int.Parse(dtRate.Rows[j][2].ToString()); @@ -5404,59 +5505,57 @@ namespace AMESCoreStudio.Web.Controllers rate = (okQty * 1.0 / inputQty) * 100; } - if (rate > 0) + query.FPYDatas.Add(new FPY4WeekGroup { - //sum_rate11 = sum_rate11 * (rate / 100.0); - sum_idx11 = sum_idx11 + 1; - sum_rate11 = sum_rate11 + rate; - } + Week = week_code, + Yield = double.Parse(rate.ToString("0.00")) + }); } } } - else - { - sum_rate11 = 0.00; - } - query.FPYDatas.Add(new FPY4MonthGroup - { - Month = yCode + "-11", - Yield = double.Parse((sum_rate11 / sum_idx11).ToString("0.00")) - }); - #endregion + return Json(query.FPYDatas); + } - #region 12 + //直通率 --- 周 + [HttpPost] + public async Task GetYieldData4QRS014CSAsync(string id) + { + string[] param = id.Split('_'); - string dateStart12 = yCode + "-12-01"; - string dateEnd12 = (int.Parse(yCode) + 1).ToString() + "-01-01"; - var wipStaiton12 = await _pcsApi.GetWipStation4QRS014GroupM(param[1], dateStart12, dateEnd12, param[5], param[6], param[7]); + var query = new QRS014CViewModel(); - //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate12 = 100.0; - //int sum_idx12 = 1; - double sum_rate12 = 0.0; - int sum_idx12 = 0; + string yCode = DateTime.Now.Year.ToString(); + if (param[3] != null) + { + if (param[3] != "") + { + yCode = param[3].Substring(0, 4); + } + } - if (wipStaiton12.DataTotal > 0) + var wipStation = await _pcsApi.GetWipStation4QRS014GroupSByWeek(param[1], param[3], param[4], param[5], param[6], param[7]); + + if (wipStation.DataTotal > 0) { DataTable dtRate = new DataTable(); - dtRate.Columns.Add("STATION_ID"); + dtRate.Columns.Add("WEEK_CODE"); dtRate.Columns.Add("OK_QTY"); dtRate.Columns.Add("NG_QTY"); dtRate.PrimaryKey = new DataColumn[] { dtRate.Columns[0] }; dtRate.AcceptChanges(); - foreach (var data in wipStaiton12.Data) + foreach (var data in wipStation.Data) { JObject j0 = JObject.Parse(data.ToString()); - int stationID = int.Parse(j0["stationID"].ToString()); + string weekCode = j0["weekCode"].ToString(); bool existFlag = false; int idx = 0; for (int i = 0; i < dtRate.Rows.Count; i++) { - if (dtRate.Rows[i]["STATION_ID"].ToString() == stationID.ToString()) + if (dtRate.Rows[i]["WEEK_CODE"].ToString() == weekCode) { idx = i; existFlag = true; @@ -5491,7 +5590,7 @@ namespace AMESCoreStudio.Web.Controllers else { DataRow dr = dtRate.NewRow(); - dr[0] = stationID; + dr[0] = weekCode; dr[1] = okQty; dr[2] = ngQty; @@ -5504,6 +5603,7 @@ namespace AMESCoreStudio.Web.Controllers { for (int j = 0; j < dtRate.Rows.Count; j++) { + string week_code = dtRate.Rows[j][0].ToString(); int okQty = int.Parse(dtRate.Rows[j][1].ToString()); int ngQty = int.Parse(dtRate.Rows[j][2].ToString()); @@ -5515,30 +5615,20 @@ namespace AMESCoreStudio.Web.Controllers rate = (okQty * 1.0 / inputQty) * 100; } - if (rate > 0) + query.FPYDatas.Add(new FPY4WeekGroup { - //sum_rate12 = sum_rate12 * (rate / 100.0); - sum_idx12 = sum_idx12 + 1; - sum_rate12 = sum_rate12 + rate; - } + Week = week_code, + Yield = double.Parse(rate.ToString("0.00")) + }); } } } - else - { - sum_rate12 = 0.00; - } - query.FPYDatas.Add(new FPY4MonthGroup - { - Month = yCode + "-12", - Yield = double.Parse((sum_rate12 / sum_idx12).ToString("0.00")) - }); - - #endregion return Json(query.FPYDatas); } + + public async Task QRS014AAsync(string unitNo, string werksNo, string itemNO, string wipNO, string dateStart, string dateEnd, string modelNO, string dateType) { if (werksNo == "*") @@ -5607,8 +5697,8 @@ namespace AMESCoreStudio.Web.Controllers rateDataList = rateDataList + "" + wip_no + "" + type + "" + item_no + ""; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - double sum_rate = 100.0; int sum_idx = 1; //double sum_rate = 0.0; @@ -5714,6 +5804,7 @@ namespace AMESCoreStudio.Web.Controllers var wipStaiton01 = await _pcsApi.GetWipStation4QRS014GroupS(itemNO, dateStart01, dateEnd01, modelNO, werksNo, dateType); if (wipStaiton01.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 照著小平的寫法(QRS014A) double sum_rate = 100.0; int sum_idx = 1; @@ -5820,6 +5911,7 @@ namespace AMESCoreStudio.Web.Controllers var wipStaiton02 = await _pcsApi.GetWipStation4QRS014GroupS(itemNO, dateStart02, dateEnd02, modelNO, werksNo, dateType); if (wipStaiton02.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -5926,6 +6018,7 @@ namespace AMESCoreStudio.Web.Controllers var wipStaiton03 = await _pcsApi.GetWipStation4QRS014GroupS(itemNO, dateStart03, dateEnd03, modelNO, werksNo, dateType); if (wipStaiton03.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -6032,6 +6125,7 @@ namespace AMESCoreStudio.Web.Controllers var wipStaiton04 = await _pcsApi.GetWipStation4QRS014GroupS(itemNO, dateStart04, dateEnd04, modelNO, werksNo, dateType); if (wipStaiton04.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -6138,6 +6232,7 @@ namespace AMESCoreStudio.Web.Controllers var wipStaiton05 = await _pcsApi.GetWipStation4QRS014GroupS(itemNO, dateStart05, dateEnd05, modelNO, werksNo, dateType); if (wipStaiton05.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -6244,6 +6339,7 @@ namespace AMESCoreStudio.Web.Controllers var wipStaiton06 = await _pcsApi.GetWipStation4QRS014GroupS(itemNO, dateStart06, dateEnd06, modelNO, werksNo, dateType); if (wipStaiton06.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -6350,6 +6446,7 @@ namespace AMESCoreStudio.Web.Controllers var wipStaiton07 = await _pcsApi.GetWipStation4QRS014GroupS(itemNO, dateStart07, dateEnd07, modelNO, werksNo, dateType); if (wipStaiton07.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -6456,6 +6553,7 @@ namespace AMESCoreStudio.Web.Controllers var wipStaiton08 = await _pcsApi.GetWipStation4QRS014GroupS(itemNO, dateStart08, dateEnd08, modelNO, werksNo, dateType); if (wipStaiton08.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -6562,6 +6660,7 @@ namespace AMESCoreStudio.Web.Controllers var wipStaiton09 = await _pcsApi.GetWipStation4QRS014GroupS(itemNO, dateStart09, dateEnd09, modelNO, werksNo, dateType); if (wipStaiton09.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -6668,6 +6767,7 @@ namespace AMESCoreStudio.Web.Controllers var wipStaiton10 = await _pcsApi.GetWipStation4QRS014GroupS(itemNO, dateStart10, dateEnd10, modelNO, werksNo, dateType); if (wipStaiton10.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -6774,6 +6874,7 @@ namespace AMESCoreStudio.Web.Controllers var wipStaiton11 = await _pcsApi.GetWipStation4QRS014GroupS(itemNO, dateStart11, dateEnd11, modelNO, werksNo, dateType); if (wipStaiton11.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -6880,6 +6981,7 @@ namespace AMESCoreStudio.Web.Controllers var wipStaiton12 = await _pcsApi.GetWipStation4QRS014GroupS(itemNO, dateStart12, dateEnd12, modelNO, werksNo, dateType); if (wipStaiton12.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -6991,6 +7093,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton01 = await _pcsApi.GetWipStation4QRS014GroupB(itemNO, dateStart01, dateEnd01, modelNO, werksNo, dateType); if (wipStaiton01.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -7097,6 +7200,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton02 = await _pcsApi.GetWipStation4QRS014GroupB(itemNO, dateStart02, dateEnd02, modelNO, werksNo, dateType); if (wipStaiton02.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -7203,6 +7307,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton03 = await _pcsApi.GetWipStation4QRS014GroupB(itemNO, dateStart03, dateEnd03, modelNO, werksNo, dateType); if (wipStaiton03.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -7309,6 +7414,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton04 = await _pcsApi.GetWipStation4QRS014GroupB(itemNO, dateStart04, dateEnd04, modelNO, werksNo, dateType); if (wipStaiton04.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -7415,6 +7521,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton05 = await _pcsApi.GetWipStation4QRS014GroupB(itemNO, dateStart05, dateEnd05, modelNO, werksNo, dateType); if (wipStaiton05.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -7521,6 +7628,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton06 = await _pcsApi.GetWipStation4QRS014GroupB(itemNO, dateStart06, dateEnd06, modelNO, werksNo, dateType); if (wipStaiton06.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -7627,6 +7735,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton07 = await _pcsApi.GetWipStation4QRS014GroupB(itemNO, dateStart07, dateEnd07, modelNO, werksNo, dateType); if (wipStaiton07.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -7733,6 +7842,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton08 = await _pcsApi.GetWipStation4QRS014GroupB(itemNO, dateStart08, dateEnd08, modelNO, werksNo, dateType); if (wipStaiton08.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -7839,6 +7949,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton09 = await _pcsApi.GetWipStation4QRS014GroupB(itemNO, dateStart09, dateEnd09, modelNO, werksNo, dateType); if (wipStaiton09.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -7945,6 +8056,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton10 = await _pcsApi.GetWipStation4QRS014GroupB(itemNO, dateStart10, dateEnd10, modelNO, werksNo, dateType); if (wipStaiton10.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -8051,6 +8163,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton11 = await _pcsApi.GetWipStation4QRS014GroupB(itemNO, dateStart11, dateEnd11, modelNO, werksNo, dateType); if (wipStaiton11.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -8157,6 +8270,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton12 = await _pcsApi.GetWipStation4QRS014GroupB(itemNO, dateStart12, dateEnd12, modelNO, werksNo, dateType); if (wipStaiton12.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -8268,6 +8382,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton01 = await _pcsApi.GetWipStation4QRS014GroupM(itemNO, dateStart01, dateEnd01, modelNO, werksNo, dateType); if (wipStaiton01.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -8374,6 +8489,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton02 = await _pcsApi.GetWipStation4QRS014GroupM(itemNO, dateStart02, dateEnd02, modelNO, werksNo, dateType); if (wipStaiton02.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -8480,6 +8596,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton03 = await _pcsApi.GetWipStation4QRS014GroupM(itemNO, dateStart03, dateEnd03, modelNO, werksNo, dateType); if (wipStaiton03.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -8586,6 +8703,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton04 = await _pcsApi.GetWipStation4QRS014GroupM(itemNO, dateStart04, dateEnd04, modelNO, werksNo, dateType); if (wipStaiton04.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -8692,6 +8810,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton05 = await _pcsApi.GetWipStation4QRS014GroupM(itemNO, dateStart05, dateEnd05, modelNO, werksNo, dateType); if (wipStaiton05.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -8798,6 +8917,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton06 = await _pcsApi.GetWipStation4QRS014GroupM(itemNO, dateStart06, dateEnd06, modelNO, werksNo, dateType); if (wipStaiton06.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -8904,6 +9024,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton07 = await _pcsApi.GetWipStation4QRS014GroupM(itemNO, dateStart07, dateEnd07, modelNO, werksNo, dateType); if (wipStaiton07.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -9010,6 +9131,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton08 = await _pcsApi.GetWipStation4QRS014GroupM(itemNO, dateStart08, dateEnd08, modelNO, werksNo, dateType); if (wipStaiton08.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -9116,6 +9238,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton09 = await _pcsApi.GetWipStation4QRS014GroupM(itemNO, dateStart09, dateEnd09, modelNO, werksNo, dateType); if (wipStaiton09.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -9222,6 +9345,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton10 = await _pcsApi.GetWipStation4QRS014GroupM(itemNO, dateStart10, dateEnd10, modelNO, werksNo, dateType); if (wipStaiton10.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -9328,6 +9452,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton11 = await _pcsApi.GetWipStation4QRS014GroupM(itemNO, dateStart11, dateEnd11, modelNO, werksNo, dateType); if (wipStaiton11.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; @@ -9434,6 +9559,7 @@ namespace AMESCoreStudio.Web.Controllers wipStaiton12 = await _pcsApi.GetWipStation4QRS014GroupM(itemNO, dateStart12, dateEnd12, modelNO, werksNo, dateType); if (wipStaiton12.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) double sum_rate = 100.0; int sum_idx = 1; diff --git a/AMESCoreStudio.Web/Controllers/RPTController.cs b/AMESCoreStudio.Web/Controllers/RPTController.cs index 09576cfb..229175aa 100644 --- a/AMESCoreStudio.Web/Controllers/RPTController.cs +++ b/AMESCoreStudio.Web/Controllers/RPTController.cs @@ -2527,7 +2527,27 @@ namespace AMESCoreStudio.Web.Controllers #endregion - #endregion + #endregion + + #region RPT006 生產效率報表 + + public IActionResult RPT006() + { + return View(); + } + + public async Task RPT006Query(string strDate, string endDate) + { + var result = await _rptApi.GetRPT006View(strDate, endDate); + + if (result.Any()) + { + return Json(new Table() { code = 0, msg = "", data = result, count = result.Count }); + } + return Json(new Table() { count = 0, data = null }); + } + + #endregion /// /// 登入UserID diff --git a/AMESCoreStudio.Web/HttpApis/AMES/ILAB.cs b/AMESCoreStudio.Web/HttpApis/AMES/ILAB.cs index a6865718..5d436e5d 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/ILAB.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/ILAB.cs @@ -23,7 +23,7 @@ namespace AMESCoreStudio.Web /// /// [WebApiClient.Attributes.HttpGet("api/LabelItem/GetLabelField")] - ITask> GetLabelField(string LabMat); + ITask> GetLabelField(string LabMat,string ItemNo); [WebApiClient.Attributes.HttpGet("api/LabelItem/GetLabel")] ITask> GetLabel(string Model); @@ -32,7 +32,7 @@ namespace AMESCoreStudio.Web ITask> GetMetInfo(string Model); [WebApiClient.Attributes.HttpGet("api/LabelItem/GetLabelItemMaster")] - ITask> GetLabelItemMaster(string OrderNo, string ModelNo, DateTime? strdate, DateTime? enddate, int UserId); + ITask> GetLabelItemMaster(string OrderNo, string ModelNo, DateTime? strdate, DateTime? enddate, int UserId,string Status); [WebApiClient.Attributes.HttpPost("api/LabelItem")] ITask> PostLabelItemMaster([FromBody, RawJsonContent] string model); @@ -98,6 +98,13 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/LabelParam/byLabelID/{id}")] ITask> GetLabParamsByLabelID(int page = 0, int limit = 10); + /// + /// 獲取Label 全部參數資料 + /// + /// + [WebApiClient.Attributes.HttpGet("api/LabelParam/byStatus/{status}")] + ITask> GetLabParamsByStatus(string status,int page = 0, int limit = 10); + /// /// Label 參數儲存 /// diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IRPT.cs b/AMESCoreStudio.Web/HttpApis/AMES/IRPT.cs index 372855f7..e1688389 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IRPT.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IRPT.cs @@ -98,5 +98,16 @@ namespace AMESCoreStudio.Web ITask GetRPT004View(string unitNo, int lineId); #endregion + + #region RPT006 生產效率報表 + + /// + /// 生產效率報表 + /// + /// + [WebApiClient.Attributes.HttpGet("api/RPT/GetRPT006View")] + ITask> GetRPT006View(string strDate, string endDate); + + #endregion } } diff --git a/AMESCoreStudio.Web/Views/LAB/LAB001.cshtml b/AMESCoreStudio.Web/Views/LAB/LAB001.cshtml index fdc216f9..2c71fb62 100644 --- a/AMESCoreStudio.Web/Views/LAB/LAB001.cshtml +++ b/AMESCoreStudio.Web/Views/LAB/LAB001.cshtml @@ -9,6 +9,23 @@
@ViewBag.Title
+
+
+ +
+ +
+
+
+ +
+
@@ -73,7 +90,7 @@ } ]; //基本数据表格 - var table = hg.table.datatable('test', 'Label 需填寫欄位', '/LAB/GetLabParams', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); + var table = hg.table.datatable('test', 'Label 需填寫欄位', '/LAB/GetLabParams' , {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); } \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/LAB/LAB002.cshtml b/AMESCoreStudio.Web/Views/LAB/LAB002.cshtml index b4c20560..54ef7e34 100644 --- a/AMESCoreStudio.Web/Views/LAB/LAB002.cshtml +++ b/AMESCoreStudio.Web/Views/LAB/LAB002.cshtml @@ -132,7 +132,7 @@ } //通过行tool编辑,lay-event="show" - function Show(obj) { + function Show1(obj) { layui.use('layer', function () { var layer = layui.layer; @@ -153,6 +153,40 @@ }; + + function Show(obj) { + $.ajax({ + url: '/LAB/LAB002_COPY', + method: 'POST', + data: { ImgFile: obj.data.imagE_NAME, LabMatnr: obj.data.labeL_MATNR}, + success: function (data) { + if (data.success) { + layui.use('layer', function () { + var layer = layui.layer; + layer.open({ + type: 2, + title: '預覽文件', + shadeClose: true,//点击遮罩关闭层 + shade: 0.8, + area: ['90%', '90%'], + content: data.msg, // 图片路径作为内容, // 完整的图片路径 + zIndex: 19891014 + }); + }); + } + else { + hg.msg(data.msg); + } + }, + error: function () { + hg.msg("网络请求失败!"); + } + + }); + + + }; + //通过行tool删除,lay-event="del" function del(obj) { var status; diff --git a/AMESCoreStudio.Web/Views/LAB/LAB002C.cshtml b/AMESCoreStudio.Web/Views/LAB/LAB002C.cshtml index f6c8efa0..255b2916 100644 --- a/AMESCoreStudio.Web/Views/LAB/LAB002C.cshtml +++ b/AMESCoreStudio.Web/Views/LAB/LAB002C.cshtml @@ -19,6 +19,7 @@ white-space: normal } +
@@ -41,76 +42,78 @@
- +
-
-
+
+
- + + +
-
+ @*
-
+
*@
- +
-
-
+
+
- + + +
-
+ @*
-
-
- -
- - -
-
-
-
-
+
*@ +
+ +
+ + +
+
+
+
+
+
-
-
- +
+
+
+ @Html.ValidationMessage("error") + +
-
-
-
- @Html.ValidationMessage("error") -
-
-
-
+
+
@@ -121,11 +124,13 @@ @section Scripts{ diff --git a/AMESCoreStudio.Web/Views/LAB/LAB002U.cshtml b/AMESCoreStudio.Web/Views/LAB/LAB002U.cshtml index fb13e752..49c66562 100644 --- a/AMESCoreStudio.Web/Views/LAB/LAB002U.cshtml +++ b/AMESCoreStudio.Web/Views/LAB/LAB002U.cshtml @@ -38,49 +38,54 @@ +
- +
-
-
+
+
- + + +
-
-
- - -
-
-
+ @*
+
+ + +
+
+
*@
- +
-
-
+
+
- + + +
-
-
- - -
-
+ @*
+
+ + +
+
-
+
*@
@@ -128,27 +133,94 @@ @section Scripts{ +} \ No newline at end of file diff --git a/AMESCoreStudio.WebApi/AMESCoreStudio.WebApi/AMESCoreStudio.WebApi.xml b/AMESCoreStudio.WebApi/AMESCoreStudio.WebApi/AMESCoreStudio.WebApi.xml index a9f1409b..30be0410 100644 --- a/AMESCoreStudio.WebApi/AMESCoreStudio.WebApi/AMESCoreStudio.WebApi.xml +++ b/AMESCoreStudio.WebApi/AMESCoreStudio.WebApi/AMESCoreStudio.WebApi.xml @@ -48,6 +48,33 @@ Swagger:隐藏属性 + + + 報工資料檔 + + + + + + + + + + + + + + + + + + + + + + + + 條碼變更資料表 @@ -2189,10 +2216,11 @@ - + 用FormID获取该巡檢結果资料 + diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/ExceptionWorktimesController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/ExceptionWorktimesController.cs index 62af6e77..94904e0e 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/ExceptionWorktimesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/ExceptionWorktimesController.cs @@ -351,14 +351,29 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES public async Task> GetExceptionWorktime4RPT001(string sdate, string edate) { ResultModel result = new ResultModel(); + //--------------------------------------------------------------------------- + //var q = from q1 in _context.ExceptionWorktimes + // select new + // { + // q1.ExceptionID, + // q1.ExceptionDate, + // q1.Time + + // }; + //--------------------------------------------------------------------------- var q = from q1 in _context.ExceptionWorktimes + join q2 in _context.ExceptionCodes on q1.ExceptionNo equals q2.ExceptionNo + join q3 in _context.ExceptionClasses on q2.ExceptionClassNo equals q3.ExceptionClassNo select new { q1.ExceptionID, q1.ExceptionDate, - q1.Time - + q1.Time, + q1.ExceptionNo, + q3.ExceptionClassNo + }; + //--------------------------------------------------------------------------- DateTime dateValue; if (sdate != "*") diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/LabelItemController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/LabelItemController.cs index cb70d68c..2c490f0d 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/LabelItemController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/LabelItemController.cs @@ -36,7 +36,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES [Route("[action]")] [HttpGet] - public async Task> GetLabelField(string LabMat) + public async Task> GetLabelField(string LabMat,string ItemNo) { ResultModel result = new ResultModel(); @@ -58,7 +58,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES LABEL_FIELD_ID =x.LABEL_FIELD_ID, LABEL_FIELD_NAME=x.LABEL_FIELD_NAME, PARAM_NAME=x.PARAM_NAME, - value= GetParamValue(x.LABEL_FIELD_ID, x.LABEL_MATNR).ToString() + value= GetParamValue(x.LABEL_FIELD_ID, ItemNo).ToString() }); @@ -109,7 +109,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES LABEL_FIELD_ID = x.LABEL_FIELD_ID, LABEL_FIELD_NAME = x.LABEL_FIELD_NAME, PARAM_NAME = x.PARAM_NAME, - value = GetParamValue(x.LABEL_FIELD_ID, x.LABEL_MATNR).ToString() + value = GetParamValue(x.LABEL_FIELD_ID, Model).ToString() }); //q = q.Where(x => w.Contains(x.LABEL_MATNR)).OrderBy(x => x.LABEL_MATNR); @@ -160,7 +160,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES [Route("[action]")] [HttpGet] - public async Task> GetLabelItemMaster(string OrderNo,string ModelNo,DateTime strdate, DateTime enddate,int UserId) + public async Task> GetLabelItemMaster(string OrderNo,string ModelNo,DateTime strdate, DateTime enddate,int UserId,string Status) { ResultModel result = new ResultModel(); IQueryable q = _context.LabelItemMaster; @@ -172,6 +172,9 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES if (OrderNo != null || OrderNo == "") q = q.Where(x => x.ORDER_NO.Contains(OrderNo)); + if (Status != "A") + q = q.Where(x => x.STATUS == Status); + if (ModelNo != null || ModelNo == "") q = q.Where(x => x.MODEL == ModelNo); @@ -630,7 +633,9 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES private string GetParamValue(int LabelFieldID,string ItemNo) { - IQueryable pmi = _context.PlmMeterialInfos; + IQueryable pmi = _context.PlmMeterialInfos; + IQueryable ssn = _context.SampleSipmentSNs; + IQueryable wa = _context.WipAtts; string Data = string.Empty; switch (LabelFieldID) @@ -642,7 +647,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES case 1002: //ModelName if (pmi.Where(x => x.MeterialNo == ItemNo).Any()) { - Data = pmi.Where(x => x.MeterialNo == ItemNo).Select(x => x.ModelName).FirstOrDefault(); + Data = pmi.Where(x => x.MeterialNo == ItemNo).Select(x => x.MeterialNo).FirstOrDefault(); } else { @@ -669,13 +674,50 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { Data = ""; //無資料,不給值 } - - break; + break; + case 1005://EAN + if (pmi.Where(x => x.MeterialNo == ItemNo).Any()) + { + Data = pmi.Where(x => x.MeterialNo == ItemNo).Select(x => x.EAN).FirstOrDefault(); + } + else + { + Data = ""; //無資料,不給值 + } + break; + case 1006://ECN + if (ssn.Where(x => x.ItemNo == ItemNo).Any()) + { + var wip = ssn.Where(x => x.ItemNo == ItemNo) + .OrderByDescending(x => x.CreateDate).Select(x => x.SampleWipNo).FirstOrDefault(); + Data = wa.Where(x => x.WipNO == wip).Select(x => x.ECN).FirstOrDefault(); + + } + else + { + Data = ""; //無資料,不給值 + } + break; + case 1007://BIOSVS + if (pmi.Where(x => x.MeterialNo == ItemNo).Any()) + { + Data = pmi.Where(x => x.MeterialNo == ItemNo).Select(x => x.BiosVer).FirstOrDefault(); + } + else + { + Data = ""; //無資料,不給值 + } + break; default: Data = ""; break; } + if(Data==null) + { + Data = ""; + } + return Data; } diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/LabelParamController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/LabelParamController.cs index d4bf6103..f910b5a5 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/LabelParamController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/LabelParamController.cs @@ -73,6 +73,31 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES } + // GET: api/LabelParam/5 + [HttpGet("byStatus/{status}")] + public async Task> GetLabelParambyStatus(string status, int page = 0, int limit = 10) + { + ResultModel result = new ResultModel(); + IQueryable q = _context.LabelParam; + if (status != "*") + { + q = q.Where(w => w.STATUS_NO == status); + + } + result.DataTotal = q.Count(); + + // Table 頁數 + if (page > 0) + { + q = q.Skip((page - 1) * limit).Take(limit); + } + + result.Data = await q.ToListAsync(); + + return result; + } + + /// /// 更新Label參數檔 /// diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/LabelTemplateMasterController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/LabelTemplateMasterController.cs index 48537dd4..bbc533f5 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/LabelTemplateMasterController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/LabelTemplateMasterController.cs @@ -145,7 +145,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES if (!string.IsNullOrEmpty(LabelMatnr) && LabelMatnr != "*") { - q = q.Where(w => w.LABEL_MATNR.StartsWith(LabelMatnr)); + q = q.Where(w => w.LABEL_MATNR.Contains(LabelMatnr)); } result.DataTotal = q.Count(); diff --git a/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs b/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs index 831a83ba..4698973c 100644 --- a/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs @@ -109,7 +109,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL double errTime = 0.00; if (c.DataTotal > 0) { - foreach (var item in c.Data) + foreach (var item in c.Data.Where(w => w.ExceptionClassNo == "O")) { string str = item.ToString(); string[] str2 = str.Replace("{", "").Replace("}", "").Split(','); @@ -135,11 +135,12 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL var d = await new WipStationController(_context).GetWipStation4QRS014GroupALL(null, sDate, eDate, null, "YS00", "FqcDate"); if (d.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate = 100.0; - //int sum_idx = 1; - double sum_rate = 0.0; - int sum_idx = 0; + double sum_rate = 100.0; + int sum_idx = 1; + //double sum_rate = 0.0; + //int sum_idx = 0; DataTable dtRate = new DataTable(); @@ -228,9 +229,10 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL if (rate > 0) { - //sum_rate = sum_rate * (rate / 100.0); - sum_idx = sum_idx + 1; - sum_rate = sum_rate + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate = sum_rate * (rate / 100.0); + //sum_idx = sum_idx + 1; + //sum_rate = sum_rate + rate; } } } @@ -1266,11 +1268,12 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL var f_FPYBoard_LEI = await new WipStationController(_context).GetWipStation4QRS014GroupS(null, sDate, sEnd_Date, null, "YS00", "FqcDate"); if (f_FPYBoard_LEI.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate = 100.0; - //int sum_idx = 1; - double sum_rate = 0.0; - int sum_idx = 0; + double sum_rate = 100.0; + int sum_idx = 1; + //double sum_rate = 0.0; + //int sum_idx = 0; DataTable dtRate = new DataTable(); dtRate.Columns.Add("STATION_ID"); @@ -1358,9 +1361,10 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL if (rate > 0) { - //sum_rate = sum_rate * (rate / 100.0); - sum_idx = sum_idx + 1; - sum_rate = sum_rate + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate = sum_rate * (rate / 100.0); + //sum_idx = sum_idx + 1; + //sum_rate = sum_rate + rate; } } } @@ -1376,11 +1380,12 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL var f_FPYSystem_LEI = await new WipStationController(_context).GetWipStation4QRS014GroupB(null, sDate, sEnd_Date, null, "YS00", "FqcDate"); if (f_FPYSystem_LEI.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate = 100.0; - //int sum_idx = 1; - double sum_rate = 0.0; - int sum_idx = 0; + double sum_rate = 100.0; + int sum_idx = 1; + //double sum_rate = 0.0; + //int sum_idx = 0; DataTable dtRate = new DataTable(); dtRate.Columns.Add("STATION_ID"); @@ -1468,9 +1473,10 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL if (rate > 0) { - //sum_rate = sum_rate * (rate / 100.0); - sum_idx = sum_idx + 1; - sum_rate = sum_rate + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate = sum_rate * (rate / 100.0); + //sum_idx = sum_idx + 1; + //sum_rate = sum_rate + rate; } } } @@ -1486,11 +1492,12 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL var f_FPYMedical_LEI = await new WipStationController(_context).GetWipStation4QRS014GroupM(null, sDate, sEnd_Date, null, "YS00", "FqcDate"); if (f_FPYMedical_LEI.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate = 100.0; - //int sum_idx = 1; - double sum_rate = 0.0; - int sum_idx = 0; + double sum_rate = 100.0; + int sum_idx = 1; + //double sum_rate = 0.0; + //int sum_idx = 0; DataTable dtRate = new DataTable(); dtRate.Columns.Add("STATION_ID"); @@ -1578,9 +1585,10 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL if (rate > 0) { - //sum_rate = sum_rate * (rate / 100.0); - sum_idx = sum_idx + 1; - sum_rate = sum_rate + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate = sum_rate * (rate / 100.0); + //sum_idx = sum_idx + 1; + //sum_rate = sum_rate + rate; } } } @@ -1596,11 +1604,12 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL var f_FPYBoard = await new WipStationController(_context).GetWipStation4QRS014GroupS(null, sDate, sEnd_Date, null, werksNo, "FqcDate"); if (f_FPYBoard.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate = 100.0; - //int sum_idx = 1; - double sum_rate = 0.0; - int sum_idx = 0; + double sum_rate = 100.0; + int sum_idx = 1; + //double sum_rate = 0.0; + //int sum_idx = 0; DataTable dtRate = new DataTable(); dtRate.Columns.Add("STATION_ID"); @@ -1688,9 +1697,10 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL if (rate > 0) { - //sum_rate = sum_rate * (rate / 100.0); - sum_idx = sum_idx + 1; - sum_rate = sum_rate + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate = sum_rate * (rate / 100.0); + //sum_idx = sum_idx + 1; + //sum_rate = sum_rate + rate; } } } @@ -1706,11 +1716,12 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL var f_FPYSystem = await new WipStationController(_context).GetWipStation4QRS014GroupB(null, sDate, sEnd_Date, null, werksNo, "FqcDate"); if (f_FPYSystem.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate = 100.0; - //int sum_idx = 1; - double sum_rate = 0.0; - int sum_idx = 0; + double sum_rate = 100.0; + int sum_idx = 1; + //double sum_rate = 0.0; + //int sum_idx = 0; DataTable dtRate = new DataTable(); dtRate.Columns.Add("STATION_ID"); @@ -1798,9 +1809,10 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL if (rate > 0) { - //sum_rate = sum_rate * (rate / 100.0); - sum_idx = sum_idx + 1; - sum_rate = sum_rate + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate = sum_rate * (rate / 100.0); + //sum_idx = sum_idx + 1; + //sum_rate = sum_rate + rate; } } } @@ -1816,11 +1828,12 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL var f_FPYMedical = await new WipStationController(_context).GetWipStation4QRS014GroupM(null, sDate, sEnd_Date, null, werksNo, "FqcDate"); if (f_FPYMedical.DataTotal > 0) { + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 //2024-03-26 BB.Wang Modify 修正良率(代小平) - //double sum_rate = 100.0; - //int sum_idx = 1; - double sum_rate = 0.0; - int sum_idx = 0; + double sum_rate = 100.0; + int sum_idx = 1; + //double sum_rate = 0.0; + //int sum_idx = 0; DataTable dtRate = new DataTable(); dtRate.Columns.Add("STATION_ID"); @@ -1908,9 +1921,10 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL if (rate > 0) { - //sum_rate = sum_rate * (rate / 100.0); - sum_idx = sum_idx + 1; - sum_rate = sum_rate + rate; + //2024-04-11 Marvin 修正,安勤品管Jeason提出,直通率改回原先系統算法,各站良率相乘 + sum_rate = sum_rate * (rate / 100.0); + //sum_idx = sum_idx + 1; + //sum_rate = sum_rate + rate; } } } @@ -2098,6 +2112,122 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL return result; } + /// + /// 生產效率報表 + /// + /// + [HttpGet("GetRPT006View")] + public async Task> GetRPT006View(string strDate, string endDate) + { + if (string.IsNullOrWhiteSpace(strDate) || string.IsNullOrWhiteSpace(endDate)) + { + strDate = DateTime.Now.ToString("yyyy/MM/dd"); + endDate = DateTime.Now.ToString("yyyy/MM/dd"); + } + + var query = @$" SELECT I.WIP_NO , I.PLAN_QTY , A.ITEM_NO , S.TOTAL_CT , S.OP_CNT , + E.START_TIME AS EXCEPTIONSTRTIME , E.END_TIME AS EXCEPTIONENDTIME , + M.* FROM( + SELECT WIP_ID , STATION_ID , + TO_CHAR(CREATE_DATE, 'YYYY/MM/DD') AS WORKDATE, + COUNT(DISTINCT BARCODE_ID) AS QTY , + MIN(CREATE_DATE) AS EARLIEST, + MAX(CREATE_DATE) AS LATEST + FROM JHAMES.BARCODE_STATION + WHERE CREATE_DATE BETWEEN TO_DATE(:StrDate, 'YYYY/MM/DD HH24:MI:SS') + AND TO_DATE(:EndDate, 'YYYY/MM/DD HH24:MI:SS') + AND STATION_ID IN ('1096','1099','1105') + GROUP BY WIP_ID , STATION_ID , TO_CHAR(CREATE_DATE, 'YYYY/MM/DD') + )M + INNER JOIN JHAMES.WIP_INFO I ON I.WIP_ID = M.WIP_ID + INNER JOIN JHAMES.WIP_ATT A ON A.WIP_NO = I.WIP_NO + LEFT JOIN JHAMES.STANDARD_WORKTIME S ON S.ITEM_NO = A.ITEM_NO AND S.STATION_ID = M.STATION_ID + LEFT JOIN JHAMES.EXCEPTION_WORKTIME E ON I.WIP_NO = E.WIP_NO AND M.STATION_ID = E.STATION_ID + AND TO_CHAR(E.EXCEPTION_DATE, 'YYYY/MM/DD') = M.WORKDATE + ORDER BY I.WIP_NO , M.WORKDATE , M.STATION_ID "; + + DynamicParameters p = new DynamicParameters(); + p.Add("StrDate", strDate + " 00:00:00"); + p.Add("EndDate", endDate + " 23:59:59"); + try + { + var result = await _context.Database.DapperQueryAsync(query, p); + foreach (var item in result) + { + // 計算作業時間 + DateTime str = Convert.ToDateTime(item.earliest); + DateTime end = Convert.ToDateTime(item.latest); + TimeSpan ts = end.Subtract(str); + // 實際工時 + item.workTime = (double)Math.Abs(Math.Round(ts.TotalMinutes, 2)); + // 加一台標工時間 + item.workTime += item.total_Ct; + // 總標工時數 標工 * 生產數量 / 人數 + item.alltotal_Ct = item.total_Ct == 0 ? 0 : + Math.Round((item.total_Ct * item.qty / item.op_Cnt), 2); + + // 製程判定 1096 1099 1105 + item.unitNo = item.station_Id == "1096" ? "組裝" : + item.station_Id == "1105" ? "測試" : + item.station_Id == "1099" ? "包裝" : + ""; + + // 中午休息時間 12:00 ~ 13:00 + if (str.TimeOfDay < TimeSpan.Parse("12:10:00") && TimeSpan.Parse("12:20:00") < end.TimeOfDay) + item.restTime += 60; + + // 早上休息時間 10:00 ~ 10:10 + if (str.TimeOfDay < TimeSpan.Parse("10:02:00") && TimeSpan.Parse("10:04:00") < end.TimeOfDay) + item.restTime += 10; + + // 下午休息時間 15:00 ~ 15:10 + if (str.TimeOfDay < TimeSpan.Parse("15:02:00") && TimeSpan.Parse("15:04:00") < end.TimeOfDay) + item.restTime += 10; + + // 加班休息時間 17:15 ~ 17:45 + if (str.TimeOfDay < TimeSpan.Parse("17:20:00") && TimeSpan.Parse("17:30:00") < end.TimeOfDay) + item.restTime += 30; + + // 異常工時 + if (item.exceptionStrTime != null && item.exceptionEndTime != null) + { + DateTime exceptionStr = Convert.ToDateTime(item.exceptionStrTime); + DateTime exceptionEnd = Convert.ToDateTime(item.exceptionEndTime); + TimeSpan exceptionTs = exceptionEnd.Subtract(exceptionStr); + item.abnormalTime = (double)Math.Abs(Math.Round(exceptionTs.TotalMinutes, 2)); + + // 中午休息時間 12:00 ~ 13:00 + if (exceptionStr.TimeOfDay < TimeSpan.Parse("12:10:00") && TimeSpan.Parse("12:20:00") < exceptionEnd.TimeOfDay) + item.abnormalTime += 60; + + // 早上休息時間 10:00 ~ 10:10 + if (exceptionStr.TimeOfDay < TimeSpan.Parse("10:02:00") && TimeSpan.Parse("10:04:00") < exceptionEnd.TimeOfDay) + item.abnormalTime += 10; + + // 下午休息時間 15:00 ~ 15:10 + if (exceptionStr.TimeOfDay < TimeSpan.Parse("15:02:00") && TimeSpan.Parse("15:04:00") < exceptionEnd.TimeOfDay) + item.abnormalTime += 10; + + // 加班休息時間 17:15 ~ 17:45 + if (exceptionStr.TimeOfDay < TimeSpan.Parse("17:20:00") && TimeSpan.Parse("17:30:00") < exceptionEnd.TimeOfDay) + item.abnormalTime += 30; + } + + // 計算效率 + // 總標準工時 / 實際工時 - 休息時間 - 異常工時 + item.efficiency = item.alltotal_Ct / (item.workTime - item.restTime - item.abnormalTime); + item.efficiency = Math.Round((item.efficiency * 100), 2); + + } + return result.ToList(); + } + catch (Exception ex) + { + return new List(); + } + + } + #endregion } } diff --git a/AMESCoreStudio.WebApi/DTO/AMES/RPT006VIiewDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/RPT006VIiewDto.cs new file mode 100644 index 00000000..d4426759 --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/RPT006VIiewDto.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +#nullable disable + +namespace AMESCoreStudio.WebApi.DTO.AMES +{ + public partial class RPT006ViewDto + { + public RPT006ViewDto() + { + + } + + /// + /// 工單號碼 + /// + public string wip_No { get; set; } + + /// + /// 料號 + /// + public string item_No { get; set; } + + /// + /// 生產日期 + /// + public DateTime workDate { get; set; } + + /// + /// 工單數量 + /// + public int plan_Qty { get; set; } + + /// + /// 生產數量 + /// + public int qty { get; set; } + + /// + /// 標準工時 + /// + public double total_Ct { get; set; } = 0; + + /// + /// 人數 + /// + public int op_Cnt { get; set; } = 0; + + /// + /// 作業站ID + /// + public string station_Id { get; set; } + + /// + /// 製程 + /// + public string unitNo { get; set; } + + /// + /// 當天最早產出時間 + /// + public DateTime earliest { get; set; } + + /// + /// 當天最後產出時間 + /// + public DateTime latest { get; set; } + + /// + /// 實際作業時間 + /// + public double workTime { get; set; } = 0; + + /// + /// 休息時間 + /// + public double restTime { get; set; } = 0; + + /// + /// 異常報工 開始時間 + /// + public DateTime? exceptionStrTime { get; set; } + + /// + /// 異常報工 結束時間 + /// + public DateTime? exceptionEndTime { get; set; } + + /// + /// 異常時間 + /// + public double abnormalTime { get; set; } = 0; + + /// + /// 總標準工時 + /// + public double alltotal_Ct { get; set; } = 0; + + /// + /// 生產效率 + /// + public double efficiency { get; set; } = 0; + + } +}