747575620@qq.com 1 year ago
parent
commit
39e3dff6f4
10 changed files with 2856 additions and 20 deletions
  1. +1
    -1
      backend/BPA.MES.Base.Application/Services/KepServerDataService/Services/IKepDataService.cs
  2. +23
    -12
      backend/BPA.MES.Base.Application/Services/KepServerDataService/Services/KepDataService.cs
  3. +1
    -0
      frontend/package.json
  4. +16
    -0
      frontend/src/api/KepService.ts
  5. +0
    -2
      frontend/src/app.tsx
  6. BIN
     
  7. +39
    -0
      frontend/src/components/KepData/index.less
  8. +2757
    -0
      frontend/src/components/KepData/index.tsx
  9. +0
    -2
      frontend/src/components/datav/TopLeftCmp.js
  10. +19
    -3
      frontend/src/pages/kep/index.tsx

+ 1
- 1
backend/BPA.MES.Base.Application/Services/KepServerDataService/Services/IKepDataService.cs View File

@@ -9,6 +9,6 @@ namespace BPA.MES.Base.Application.Services.KepServerDataService.Services

public interface IKepDataService
{
Task<Dictionary<string, object>> GetList();
Task<List<object>> GetList();
}
}

+ 23
- 12
backend/BPA.MES.Base.Application/Services/KepServerDataService/Services/KepDataService.cs View File

@@ -20,21 +20,32 @@ namespace BPA.MES.Base.Application.Services.KepServerDataService.Services
}
[HttpPost]
[AllowAnonymous]
public async Task<Dictionary<string, object>> GetList()
public async Task<List<object>> GetList()
{
var data =await KepDb.Queryable<ch1_device1>().Where(x=> SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Take(1000).ToListAsync();
var dicdatass = KepDb.Queryable<ch1_device1>().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<object>().AS("ch01_device1", "o").Where(" to_days(o._TIMESTAMP) = to_days(now())").ToList();
//var data =await KepDb.Queryable<ch1_device1>().Where(x=> SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Take(1000).ToListAsync();
//var dicdatass = KepDb.Queryable<ch1_device1>().GroupBy(x => x._NAME).Where(x => SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Select(x => x._NAME).ToArray();
//var dicdata = KepDb.Queryable<ch1_device1>().GroupBy(x => x._NAME).Where(x => SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Select(x=>x._NAME).ToDictionary();
Dictionary<string, object> dic = new Dictionary<string, object>();
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<bool> DeleteKep()
{
var sql = "delete from ch01_device1 where 1=1 order by id limit 1000;";
var list = KepDb.Ado.ExecuteCommand(sql);
return true;
}
}
}

+ 1
- 0
frontend/package.json View File

@@ -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",


+ 16
- 0
frontend/src/api/KepService.ts View File

@@ -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',
});
},
}

+ 0
- 2
frontend/src/app.tsx View File

@@ -107,7 +107,6 @@ export const layout: RunTimeLayoutConfig = ({ initialState }) => {
},
footerRender: () => <Footer />,
onPageChange: () => {
console.log("11111111111111")
const userToken = localStorage.getItem('USER_TOKEN');
if (userToken) {
const userInfo = JSON.parse(userToken);
@@ -122,7 +121,6 @@ export const layout: RunTimeLayoutConfig = ({ initialState }) => {
menuDataRender: () => loopMenuItem(initialState?.menuData as any[]),
childrenRender: (children: any) => {
// children.pathname = history.location.pathname;
console.log(children,"3333333333")
return (
<>
{children}


BIN
View File


+ 39
- 0
frontend/src/components/KepData/index.less View File

@@ -0,0 +1,39 @@
#data-view {
width: 100%;
height: 100%;
background-color: #030409;
color: #fff;
#dv-full-screen-container {
background-image: url('./img/bg.png');
background-size: 100% 100%;
box-shadow: 0 0 3px blue;
display: flex;
flex-direction: column;
#chart_title{
padding:10;
color: '#04b2f7';
font-size: '18px';
font-weight: 'bold'
}
}
.head_title{
text-align: center;
position: relative;
}
.head_title_txt{
position: absolute;
top: 15px;
font-size: 24px;
right: 46%;
}
.g2-tooltip-title{
color: white;
}
.g2-html-annotation{
font-size: 14px;
}
}



+ 2757
- 0
frontend/src/components/KepData/index.tsx
File diff suppressed because it is too large
View File


+ 0
- 2
frontend/src/components/datav/TopLeftCmp.js View File

@@ -42,7 +42,6 @@ export default () => (
</div>
</BorderBox5>
</div> */}
<BorderBox8>
<BorderBox13>
<div className="dc-text">
传感器
@@ -73,6 +72,5 @@ export default () => (
<span style={{'margin-left': '10px',fontSize:18}}>P</span>
</div>
</BorderBox13>
</BorderBox8>
</div>
)

+ 19
- 3
frontend/src/pages/kep/index.tsx View File

@@ -1,11 +1,27 @@
import { Card } from 'antd';
import React from 'react';
import React,{ useState, useEffect } from 'react';
import { PageContainer } from '@ant-design/pro-components';
import DataV from '../../components/datav'
// import DataV from '../../components/datav'
import KepServiceAPI from '@/api/KepService';
import KepData from '../../components/KepData'
const Kep: React.FC = () => {

useEffect( () => {
// const timer = window.setInterval(() => {
// KepServiceAPI.List().then((t)=>{
// console.log(JSON.stringify(t.data))
// })
// }, 1000);
// return () => {
// clearInterval(timer);
// };
// KepServiceAPI.List().then((t)=>{
// console.log(JSON.stringify(t.data[0]))
// })
},[])
return (
<div id="app">
<DataV />
<KepData />
</div>
);
};


Loading…
Cancel
Save