747575620@qq.com 1 年之前
父節點
當前提交
39e3dff6f4
共有 10 個文件被更改,包括 2856 次插入20 次删除
  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. 二進制
     
  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 查看文件

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


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

+ 23
- 12
backend/BPA.MES.Base.Application/Services/KepServerDataService/Services/KepDataService.cs 查看文件

@@ -20,21 +20,32 @@ namespace BPA.MES.Base.Application.Services.KepServerDataService.Services
} }
[HttpPost] [HttpPost]
[AllowAnonymous] [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(); //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>(); 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 查看文件

@@ -48,6 +48,7 @@
"not ie <= 10" "not ie <= 10"
], ],
"dependencies": { "dependencies": {
"@ant-design/charts": "^1.4.2",
"@ant-design/icons": "^4.8.0", "@ant-design/icons": "^4.8.0",
"@ant-design/pro-components": "^2.3.44", "@ant-design/pro-components": "^2.3.44",
"@ant-design/pro-layout": "^7.8.3", "@ant-design/pro-layout": "^7.8.3",


+ 16
- 0
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',
});
},
}

+ 0
- 2
frontend/src/app.tsx 查看文件

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


二進制
查看文件


+ 39
- 0
frontend/src/components/KepData/index.less 查看文件

@@ -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
文件差異過大導致無法顯示
查看文件


+ 0
- 2
frontend/src/components/datav/TopLeftCmp.js 查看文件

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

+ 19
- 3
frontend/src/pages/kep/index.tsx 查看文件

@@ -1,11 +1,27 @@
import { Card } from 'antd'; import { Card } from 'antd';
import React from 'react';
import React,{ useState, useEffect } from 'react';
import { PageContainer } from '@ant-design/pro-components'; 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 = () => { 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 ( return (
<div id="app"> <div id="app">
<DataV />
<KepData />
</div> </div>
); );
}; };


Loading…
取消
儲存