From d26ea6e240101ad4e1b704b20979b1ec976b9ab3 Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Wed, 30 Aug 2023 15:45:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9B=91=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/IKepDataService.cs | 2 +- .../Services/KepDataService.cs | 35 +- frontend/package.json | 1 + frontend/src/api/KepService.ts | 16 + frontend/src/app.tsx | 2 - frontend/src/components/KepData/img/bg.png | Bin 0 -> 206566 bytes frontend/src/components/KepData/index.less | 39 + frontend/src/components/KepData/index.tsx | 2757 +++++++++++++++++ frontend/src/components/datav/TopLeftCmp.js | 2 - frontend/src/pages/kep/index.tsx | 22 +- 10 files changed, 2856 insertions(+), 20 deletions(-) create mode 100644 frontend/src/api/KepService.ts create mode 100644 frontend/src/components/KepData/img/bg.png create mode 100644 frontend/src/components/KepData/index.less create mode 100644 frontend/src/components/KepData/index.tsx diff --git a/backend/BPA.MES.Base.Application/Services/KepServerDataService/Services/IKepDataService.cs b/backend/BPA.MES.Base.Application/Services/KepServerDataService/Services/IKepDataService.cs index 02ca7c0..6971bf4 100644 --- a/backend/BPA.MES.Base.Application/Services/KepServerDataService/Services/IKepDataService.cs +++ b/backend/BPA.MES.Base.Application/Services/KepServerDataService/Services/IKepDataService.cs @@ -9,6 +9,6 @@ namespace BPA.MES.Base.Application.Services.KepServerDataService.Services public interface IKepDataService { - Task> GetList(); + Task> GetList(); } } diff --git a/backend/BPA.MES.Base.Application/Services/KepServerDataService/Services/KepDataService.cs b/backend/BPA.MES.Base.Application/Services/KepServerDataService/Services/KepDataService.cs index 94149f6..89d512b 100644 --- a/backend/BPA.MES.Base.Application/Services/KepServerDataService/Services/KepDataService.cs +++ b/backend/BPA.MES.Base.Application/Services/KepServerDataService/Services/KepDataService.cs @@ -20,21 +20,32 @@ namespace BPA.MES.Base.Application.Services.KepServerDataService.Services } [HttpPost] [AllowAnonymous] - public async Task> GetList() + public async Task> GetList() { - var data =await KepDb.Queryable().Where(x=> SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Take(1000).ToListAsync(); - var dicdatass = KepDb.Queryable().GroupBy(x => x._NAME).Where(x => SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Select(x => x._NAME).ToArray(); + //to_days(now()) - to_days(o._TIMESTAMP) = 1 + // to_days(o._TIMESTAMP) = to_days(now()) + var list = KepDb.Queryable().AS("ch01_device1", "o").Where(" to_days(o._TIMESTAMP) = to_days(now())").ToList(); + //var data =await KepDb.Queryable().Where(x=> SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Take(1000).ToListAsync(); + //var dicdatass = KepDb.Queryable().GroupBy(x => x._NAME).Where(x => SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Select(x => x._NAME).ToArray(); //var dicdata = KepDb.Queryable().GroupBy(x => x._NAME).Where(x => SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Select(x=>x._NAME).ToDictionary(); Dictionary dic = new Dictionary(); - DataTable table = new DataTable(); - foreach (var item in dicdatass) - { - var key = item.ToString(); - var values = data.Where(x => x._NAME == key).Select(x=>x._VALUE).ToList(); - dic.Add(key, values); - } - var JsonString = JsonConvert.SerializeObject(dic); - return dic; + //DataTable table = new DataTable(); + //foreach (var item in dicdatass) + //{ + // var key = item.ToString(); + // var values = data.Where(x => x._NAME == key).Select(x=>x._VALUE).ToList(); + // dic.Add(key, values); + //} + //var JsonString = JsonConvert.SerializeObject(dic); + return list; + } + [HttpGet] + [AllowAnonymous] + public async Task DeleteKep() + { + var sql = "delete from ch01_device1 where 1=1 order by id limit 1000;"; + var list = KepDb.Ado.ExecuteCommand(sql); + return true; } } } diff --git a/frontend/package.json b/frontend/package.json index 38da16a..e9834e6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -48,6 +48,7 @@ "not ie <= 10" ], "dependencies": { + "@ant-design/charts": "^1.4.2", "@ant-design/icons": "^4.8.0", "@ant-design/pro-components": "^2.3.44", "@ant-design/pro-layout": "^7.8.3", diff --git a/frontend/src/api/KepService.ts b/frontend/src/api/KepService.ts new file mode 100644 index 0000000..acb0923 --- /dev/null +++ b/frontend/src/api/KepService.ts @@ -0,0 +1,16 @@ +import { request } from '@umijs/max'; + + +export default { + //列表 + List() { + return request('/api/kepdata/getlist', { + method: 'POST', + }); + }, + DeleteKep() { + return request('/api/kepdata/deletekep', { + method: 'Get', + }); + }, +} \ No newline at end of file diff --git a/frontend/src/app.tsx b/frontend/src/app.tsx index dbc1874..9904b86 100644 --- a/frontend/src/app.tsx +++ b/frontend/src/app.tsx @@ -107,7 +107,6 @@ export const layout: RunTimeLayoutConfig = ({ initialState }) => { }, footerRender: () =>