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: () =>