From c705c155c032ed918823d650a0427ca0cb59422a Mon Sep 17 00:00:00 2001 From: Marvin Date: Fri, 16 Jun 2023 20:33:14 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9RPT001?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/BLL/RPTController.cs | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs b/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs index d93ac166..346ca946 100644 --- a/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs @@ -67,21 +67,29 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL var b = await new FqcInhouseMasterController(_context).GetFqcInhouseMasteMultiQuery("", "", "", "", date_str: sDate, date_end: eDate, ""); result.finishedProducts = b.DataTotal; - //異常工時:GetExceptionWorktimeByQueryWHS009 - var c = await new ExceptionWorktimesController(_context).GetExceptionWorktimeByQueryWHS009New("*", "*", "*", "*", sDate, eDate); + //異常工時:GetExceptionWorktime4RPT001 + var c = await new ExceptionWorktimesController(_context).GetExceptionWorktime4RPT001(sDate, eDate); decimal errorTime = 0; double errTime = 0.00; if (c.DataTotal > 0) { - foreach (var dat in c.Data) + foreach (var item in c.Data) { - JObject j1 = JObject.Parse(dat.ToString()); - decimal time = decimal.Parse(j1["time"].ToString()); + string str = item.ToString(); + string[] str2 = str.Replace("{", "").Replace("}", "").Split(','); + string str3 = ""; + for (int i = 0; i < str2.Length; i++) + { + string[] str21 = str2[i].Split("="); + str3 = str3 + str21[0].Trim() + ":" + "'" + str21[1].Trim() + "',"; + } + JObject j1 = JObject.Parse("{" + str3.Substring(0, str3.Length - 1) + "}"); + decimal time = decimal.Parse(j1["Time"].ToString()); errorTime = errorTime + time; } errTime = double.Parse(errorTime.ToString()) / 60.0; } - result.abnormalTime = errTime; + result.abnormalTime = double.Parse(errTime.ToString("0.00")); //直通率:GetWipStation4QRS014GroupALL var d = await new WipStationController(_context).GetWipStation4QRS014GroupALL(null, sDate, eDate, null, null, null); @@ -182,7 +190,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL } } } - result.test = sum_rate / sum_idx; + result.test = double.Parse((sum_rate / sum_idx).ToString("0.00")); } else {