From 1fea4c3b112aefc7076092b34eeec7de1a67a50c Mon Sep 17 00:00:00 2001
From: wangky <m1561510467@163.com>
Date: 星期五, 01 十一月 2024 15:25:04 +0800
Subject: [PATCH] Merge branch 'master' of ssh://115.28.86.8:29418/~admin/昆仑_1025
---
Client/李宵增/document/历史查询分析模块需求分析.docx | 0
Server/马渝杭/log/20241031昆仑日报.doc | 0
Client/冀浩昶/log/日志_冀浩昶_1031.doc | 0
Server/李转转/log/配置管理_1101.doc | 0
Client/姜可庚/code/2024kunlun_project_permisson/main.cpp | 2
Client/黎弘霖/log/设备管理_黎弘霖_1031.doc | 0
Client/姜可庚/log/姜可庚_1101.doc | 0
Client/姜可庚/code/2024kunlun_project_permisson/permissonwindow.h | 2
Client/刘子航/log/日志_刘子航_1101.doc | 0
Server/马丽萍/log/log_1031.doc | 0
Client/郑凯文/log/郑凯文1101.doc | 0
Client/姜可庚/code/2024kunlun_project_permisson/2024kunlun_project_permisson.pro.user | 2
Client/王鑫鑫/log/日志_王鑫鑫_1031.doc | 0
Client/姜可庚/code/2024kunlun_project_permisson/PmsClientSocket.cpp | 11
Client/王鑫鑫/log/昆仑_1101项目日报.doc | 0
Client/黎弘霖/log/设备管理_黎弘霖_1101.doc | 0
Client/姜可庚/code/2024kunlun_project_permisson/PmsClientSocket.h | 7
Client/姜可庚/code/2024kunlun_project_permisson/permissondialog.h | 2
Client/姜可庚/log/姜可庚_1031.doc | 0
Client/郑凯文/document/昆仑1031_项目日报.doc | 0
Server/陈楚丹/log/日志_陈楚丹_1031.doc | 0
Client/姜可庚/code/2024kunlun_project_permisson/permissondialog.cpp | 4
Client/申烜/log/日志_申烜_1031.doc | 0
Server/马丽萍/document/日志需求分析文档.docx | 0
Client/李宵增/log/历史查询_李宵增_1031.doc | 0
/dev/null | 0
Client/宋昊昳/log/日志_宋昊昳_1101.doc | 0
Server/马丽萍/code/log/log.cpp | 209 +++++++-
Client/姜可庚/code/2024kunlun_project_permisson/permissonwindow.cpp | 20
Client/姜可庚/log/姜可庚_1030.doc | 0
Server/马丽萍/code/log/log.h | 46 +
Client/申烜/log/日志_申烜_1101.doc | 0
Client/黎弘霖/code/Devices_Management_Struct.h | 121 +++++
common.h | 873 +++++++++++++++++++++++++++++++++++++++
Client/冀浩昶/document/生产计划管理_需求分析.docx | 0
Server/胡家明/log/日志_胡家明_1031.doc | 0
Client/李宵增/log/历史查询_李宵增_1030.doc | 0
37 files changed, 1,217 insertions(+), 82 deletions(-)
diff --git "a/Client/\345\206\200\346\265\251\346\230\266/document/\347\224\237\344\272\247\350\256\241\345\210\222\347\256\241\347\220\206_\351\234\200\346\261\202\345\210\206\346\236\220.docx" "b/Client/\345\206\200\346\265\251\346\230\266/document/\347\224\237\344\272\247\350\256\241\345\210\222\347\256\241\347\220\206_\351\234\200\346\261\202\345\210\206\346\236\220.docx"
index 9d55fac..8b40728 100644
--- "a/Client/\345\206\200\346\265\251\346\230\266/document/\347\224\237\344\272\247\350\256\241\345\210\222\347\256\241\347\220\206_\351\234\200\346\261\202\345\210\206\346\236\220.docx"
+++ "b/Client/\345\206\200\346\265\251\346\230\266/document/\347\224\237\344\272\247\350\256\241\345\210\222\347\256\241\347\220\206_\351\234\200\346\261\202\345\210\206\346\236\220.docx"
Binary files differ
diff --git "a/Client/\345\206\200\346\265\251\346\230\266/log/\346\227\245\345\277\227_\345\206\200\346\265\251\346\230\266_1031.doc" "b/Client/\345\206\200\346\265\251\346\230\266/log/\346\227\245\345\277\227_\345\206\200\346\265\251\346\230\266_1031.doc"
new file mode 100644
index 0000000..f77c0ed
--- /dev/null
+++ "b/Client/\345\206\200\346\265\251\346\230\266/log/\346\227\245\345\277\227_\345\206\200\346\265\251\346\230\266_1031.doc"
Binary files differ
diff --git "a/Client/\345\210\230\345\255\220\350\210\252/log/\346\227\245\345\277\227_\345\210\230\345\255\220\350\210\252_1101.doc" "b/Client/\345\210\230\345\255\220\350\210\252/log/\346\227\245\345\277\227_\345\210\230\345\255\220\350\210\252_1101.doc"
new file mode 100644
index 0000000..5b39481
--- /dev/null
+++ "b/Client/\345\210\230\345\255\220\350\210\252/log/\346\227\245\345\277\227_\345\210\230\345\255\220\350\210\252_1101.doc"
Binary files differ
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/2024kunlun_project_permisson.pro.user" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/2024kunlun_project_permisson.pro.user"
index 1e45d46..afa3031 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/2024kunlun_project_permisson.pro.user"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/2024kunlun_project_permisson.pro.user"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.5.0, 2024-10-31T15:06:39. -->
+<!-- Written by QtCreator 4.5.0, 2024-10-31T16:02:45. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.cpp" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.cpp"
index bf4d8d6..8449947 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.cpp"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.cpp"
@@ -68,10 +68,9 @@
res = (QueryPmsResponse *)buf.data();
if(res->success){
vector<PmsQueryResult> vecs;
-
- for(int i =0;i<100;i++){
- PmsRes structRes =res->pmsList[i];
- if(*(int *)&structRes){
+ int pmsLen = res->head.len-sizeof(QueryPmsResponse);
+ for(int i =0;i<pmsLen;i+=sizeof(PmsRes)){
+ PmsRes structRes = *(PmsRes*)(res + sizeof(QueryPmsResponse) + i*sizeof(PmsRes));
PmsQueryResult res;
res.setName(string(structRes.name));
res.setUserNo(string(structRes.userNo));
@@ -83,12 +82,8 @@
res.setDevManage(structRes.devManage);
res.setProductPlan(structRes.productPlan);
res.setQueryHistory(structRes.queryHistory);
-
res.setPermissonType(string(structRes.permissonType));
-
vecs.push_back(res);
-
- }else break;
}
if(!vecs.empty()){
emit notifyDateChange(vecs);
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.h" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.h"
index 2795585..0a0e535 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.h"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/PmsClientSocket.h"
@@ -72,11 +72,12 @@
typedef struct UserAboutPmsResponse{
Head head;
int success; // 1涓烘垚鍔� ,0涓哄け璐�
- PmsRes pmsList[100];
+ //PmsRes pmsList[100];
+ char pmsList[0];
UserAboutPmsResponse(){
head.type=QUERY_PMS_RES;
- memset(pmsList,0,sizeof(PmsRes));
- head.len = sizeof(UserAboutPmsResponse);
+// memset(pmsList,0,sizeof(PmsRes));
+// head.len = sizeof(UserAboutPmsResponse);
}
} QueryPmsResponse;
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/main.cpp" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/main.cpp"
index 41b03d3..9200eaf 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/main.cpp"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/main.cpp"
@@ -6,6 +6,8 @@
QApplication a(argc, argv);
PermissonWindow w;
w.show();
+ QString dlgTitle = "鏇存柊缁撴灉";
+ QString strInfo = "鏉冮檺淇℃伅鏇存柊鎴愬姛";
return a.exec();
}
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.cpp" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.cpp"
index 258f81e..98d0f81 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.cpp"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.cpp"
@@ -66,6 +66,8 @@
btnList[3][res.getDevManage()]->setChecked(true);
btnList[4][res.getProductPlan()]->setChecked(true);
+ curRes = res;
+
}
@@ -80,7 +82,7 @@
param.setDevManage(findBoxCheck(btnList[3]));
param.setProductPlan(findBoxCheck(btnList[4]));
-
+ param.setRoleId(curRes.getRoleId());
client->updatePmsByParam(param);
}
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.h" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.h"
index 3ddff06..ecf68b2 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.h"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissondialog.h"
@@ -28,6 +28,8 @@
int findBoxCheck(map<int,QRadioButton *> map);
+ PmsQueryResult curRes;
+
private slots:
void recvUserNo(PmsQueryResult pms);
void on_buttonBox_accepted();
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.cpp" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.cpp"
index cd23094..71580ef 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.cpp"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.cpp"
@@ -78,9 +78,11 @@
+
connect(ac1,&QAction::triggered,[=]{
int row = ui->tableView->currentIndex().row();
- qDebug() << globalPms[row].getDevManage();
+ qDebug() << "鏇存柊褰撳墠鍛樺伐淇℃伅"
+ << QString::fromStdString( globalPms[row].getUserNo());
// 鍙戦�佸憳宸ョ紪鍙蜂俊鎭�
emit sendUserNo(globalPms[row]);
@@ -99,7 +101,9 @@
if(watch == ui->tableView->viewport() || watch == ui->tableView->verticalHeader()->viewport()
|| watch == ui->tableView->horizontalHeader()->viewport()){
- if(event->type()==QEvent::MouseButtonPress && ((QMouseEvent *)event)->button()==Qt::RightButton){
+ if(event->type()==QEvent::MouseButtonPress
+ && ((QMouseEvent *)event)->button()==Qt::RightButton
+ && m_model->rowCount() > 0){
m->exec(QCursor::pos());
}
@@ -132,12 +136,14 @@
void PermissonWindow::listenItemChange(QStandardItem *item)
{
- qDebug() << "鏁版嵁寮�濮嬫洿鏂�";
QString localText = item->text();
- PmsPlusParma pm;
- pm.setPermissonType(localText.toStdString());
- pm.setRoleId(roleMap[localText.toStdString()]);
- clientSocket->updatePmsByParam(pm);
+ if(roleMap.count(localText.toStdString())){
+ qDebug() << "鍙戣捣鑱屼綅鏇存柊璇锋眰";
+ PmsPlusParma pm;
+ pm.setPermissonType(localText.toStdString());
+ pm.setRoleId(roleMap[localText.toStdString()]);
+ clientSocket->updatePmsByParam(pm);
+ }
}
void PermissonWindow::renderItemData(vector<PmsQueryResult> res)
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.h" "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.h"
index aeb776b..a9f57be 100644
--- "a/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.h"
+++ "b/Client/\345\247\234\345\217\257\345\272\232/code/2024kunlun_project_permisson/permissonwindow.h"
@@ -10,6 +10,8 @@
#include "syncdatatodb.h"
#include "PmsClientSocket.h"
+#include <QMessageBox>
+
using namespace std;
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/log/\345\247\234\345\217\257\345\272\232_1030.doc" "b/Client/\345\247\234\345\217\257\345\272\232/log/\345\247\234\345\217\257\345\272\232_1030.doc"
new file mode 100644
index 0000000..2c2d918
--- /dev/null
+++ "b/Client/\345\247\234\345\217\257\345\272\232/log/\345\247\234\345\217\257\345\272\232_1030.doc"
Binary files differ
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/log/\345\247\234\345\217\257\345\272\232_1031.doc" "b/Client/\345\247\234\345\217\257\345\272\232/log/\345\247\234\345\217\257\345\272\232_1031.doc"
new file mode 100644
index 0000000..60ec89f
--- /dev/null
+++ "b/Client/\345\247\234\345\217\257\345\272\232/log/\345\247\234\345\217\257\345\272\232_1031.doc"
Binary files differ
diff --git "a/Client/\345\247\234\345\217\257\345\272\232/log/\345\247\234\345\217\257\345\272\232_1101.doc" "b/Client/\345\247\234\345\217\257\345\272\232/log/\345\247\234\345\217\257\345\272\232_1101.doc"
new file mode 100644
index 0000000..f262959
--- /dev/null
+++ "b/Client/\345\247\234\345\217\257\345\272\232/log/\345\247\234\345\217\257\345\272\232_1101.doc"
Binary files differ
diff --git "a/Client/\345\256\213\346\230\212\346\230\263/log/\346\227\245\345\277\227_\345\256\213\346\230\212\346\230\263_1101.doc" "b/Client/\345\256\213\346\230\212\346\230\263/log/\346\227\245\345\277\227_\345\256\213\346\230\212\346\230\263_1101.doc"
new file mode 100644
index 0000000..b906225
--- /dev/null
+++ "b/Client/\345\256\213\346\230\212\346\230\263/log/\346\227\245\345\277\227_\345\256\213\346\230\212\346\230\263_1101.doc"
Binary files differ
diff --git "a/Client/\346\235\216\345\256\265\345\242\236/document/\345\216\206\345\217\262\346\237\245\350\257\242\345\210\206\346\236\220\346\250\241\345\235\227\351\234\200\346\261\202\345\210\206\346\236\220.docx" "b/Client/\346\235\216\345\256\265\345\242\236/document/\345\216\206\345\217\262\346\237\245\350\257\242\345\210\206\346\236\220\346\250\241\345\235\227\351\234\200\346\261\202\345\210\206\346\236\220.docx"
index 6b3025b..deffe06 100644
--- "a/Client/\346\235\216\345\256\265\345\242\236/document/\345\216\206\345\217\262\346\237\245\350\257\242\345\210\206\346\236\220\346\250\241\345\235\227\351\234\200\346\261\202\345\210\206\346\236\220.docx"
+++ "b/Client/\346\235\216\345\256\265\345\242\236/document/\345\216\206\345\217\262\346\237\245\350\257\242\345\210\206\346\236\220\346\250\241\345\235\227\351\234\200\346\261\202\345\210\206\346\236\220.docx"
Binary files differ
diff --git "a/Client/\346\235\216\345\256\265\345\242\236/log/\345\216\206\345\217\262\346\237\245\350\257\242_\346\235\216\345\256\265\345\242\236_1030.doc" "b/Client/\346\235\216\345\256\265\345\242\236/log/\345\216\206\345\217\262\346\237\245\350\257\242_\346\235\216\345\256\265\345\242\236_1030.doc"
index 8158c3a..cebcc04 100644
--- "a/Client/\346\235\216\345\256\265\345\242\236/log/\345\216\206\345\217\262\346\237\245\350\257\242_\346\235\216\345\256\265\345\242\236_1030.doc"
+++ "b/Client/\346\235\216\345\256\265\345\242\236/log/\345\216\206\345\217\262\346\237\245\350\257\242_\346\235\216\345\256\265\345\242\236_1030.doc"
Binary files differ
diff --git "a/Client/\346\235\216\345\256\265\345\242\236/log/\345\216\206\345\217\262\346\237\245\350\257\242_\346\235\216\345\256\265\345\242\236_1031.doc" "b/Client/\346\235\216\345\256\265\345\242\236/log/\345\216\206\345\217\262\346\237\245\350\257\242_\346\235\216\345\256\265\345\242\236_1031.doc"
new file mode 100644
index 0000000..593bbbc
--- /dev/null
+++ "b/Client/\346\235\216\345\256\265\345\242\236/log/\345\216\206\345\217\262\346\237\245\350\257\242_\346\235\216\345\256\265\345\242\236_1031.doc"
Binary files differ
diff --git "a/Client/\347\216\213\351\221\253\351\221\253/log/\346\227\245\345\277\227_\347\216\213\351\221\253\351\221\253_1031.doc" "b/Client/\347\216\213\351\221\253\351\221\253/log/\346\227\245\345\277\227_\347\216\213\351\221\253\351\221\253_1031.doc"
index 9148e4b..bd1f6d1 100644
--- "a/Client/\347\216\213\351\221\253\351\221\253/log/\346\227\245\345\277\227_\347\216\213\351\221\253\351\221\253_1031.doc"
+++ "b/Client/\347\216\213\351\221\253\351\221\253/log/\346\227\245\345\277\227_\347\216\213\351\221\253\351\221\253_1031.doc"
Binary files differ
diff --git "a/Client/\347\216\213\351\221\253\351\221\253/log/\346\230\206\344\273\221_1101\351\241\271\347\233\256\346\227\245\346\212\245.doc" "b/Client/\347\216\213\351\221\253\351\221\253/log/\346\230\206\344\273\221_1101\351\241\271\347\233\256\346\227\245\346\212\245.doc"
new file mode 100644
index 0000000..4f8d51c
--- /dev/null
+++ "b/Client/\347\216\213\351\221\253\351\221\253/log/\346\230\206\344\273\221_1101\351\241\271\347\233\256\346\227\245\346\212\245.doc"
Binary files differ
diff --git "a/Client/\347\224\263\347\203\234/log/\346\227\245\345\277\227_\346\263\250\345\206\214\347\231\273\345\275\225_2024.10.31.doc" "b/Client/\347\224\263\347\203\234/log/\346\227\245\345\277\227_\347\224\263\347\203\234_1031.doc"
similarity index 100%
rename from "Client/\347\224\263\347\203\234/log/\346\227\245\345\277\227_\346\263\250\345\206\214\347\231\273\345\275\225_2024.10.31.doc"
rename to "Client/\347\224\263\347\203\234/log/\346\227\245\345\277\227_\347\224\263\347\203\234_1031.doc"
Binary files differ
diff --git "a/Client/\347\224\263\347\203\234/log/\346\227\245\345\277\227_\347\224\263\347\203\234_1101.doc" "b/Client/\347\224\263\347\203\234/log/\346\227\245\345\277\227_\347\224\263\347\203\234_1101.doc"
new file mode 100644
index 0000000..64bbd1f
--- /dev/null
+++ "b/Client/\347\224\263\347\203\234/log/\346\227\245\345\277\227_\347\224\263\347\203\234_1101.doc"
Binary files differ
diff --git "a/Client/\351\203\221\345\207\257\346\226\207/document/\346\230\206\344\273\2211031_\351\241\271\347\233\256\346\227\245\346\212\245.doc" "b/Client/\351\203\221\345\207\257\346\226\207/document/\346\230\206\344\273\2211031_\351\241\271\347\233\256\346\227\245\346\212\245.doc"
new file mode 100644
index 0000000..b8194ea
--- /dev/null
+++ "b/Client/\351\203\221\345\207\257\346\226\207/document/\346\230\206\344\273\2211031_\351\241\271\347\233\256\346\227\245\346\212\245.doc"
Binary files differ
diff --git "a/Client/\351\203\221\345\207\257\346\226\207/log/\351\203\221\345\207\257\346\226\2071101.doc" "b/Client/\351\203\221\345\207\257\346\226\207/log/\351\203\221\345\207\257\346\226\2071101.doc"
new file mode 100644
index 0000000..7cbcb68
--- /dev/null
+++ "b/Client/\351\203\221\345\207\257\346\226\207/log/\351\203\221\345\207\257\346\226\2071101.doc"
Binary files differ
diff --git "a/Client/\351\273\216\345\274\230\351\234\226/code/Devices_Management_Struct.h" "b/Client/\351\273\216\345\274\230\351\234\226/code/Devices_Management_Struct.h"
new file mode 100644
index 0000000..67b38a2
--- /dev/null
+++ "b/Client/\351\273\216\345\274\230\351\234\226/code/Devices_Management_Struct.h"
@@ -0,0 +1,121 @@
+#pragma once
+enum TypeInfo
+{
+ AD_Req,//添加设备请求
+ AD_Res,//添加设备响应
+ CD_Req,//关闭设备请求
+ CD_Res,//关闭设备请求
+ PD_Req,//暂停设备请求
+ PD_Res,//暂停设备请求
+};
+struct Head
+{
+ int type;
+ int len;
+};
+
+//添加设备
+struct ADReq
+{
+ Head head;
+ char Device_Name[32];
+ ADReq() {
+ head.type = AD_Req;
+ head.len = sizeof(AD_Req);
+ }
+
+};
+struct ADPermission
+{
+ char Device_Name[32];
+ char Device_Status[32];
+ char Manufacturer[100];
+ char Devices_Type[32];
+ double Longitude;
+ double Latitude;
+};
+struct ADRes
+{
+ Head head;
+ char Device_Name[32];
+ char Device_Status[32];
+ char Start_Time[32];
+ char Work_Time[32];
+ char Manufacturer[100];
+ char Devices_Type[32];
+ double Longitude;
+ double Latitude;
+ ADPermission per;
+ ADRes() {
+ head.type = AD_Res;
+ head.len = sizeof(ADRes);
+ }
+
+};
+
+//关闭设备
+struct CDReq
+{
+ Head head;
+ char Device_Name[32];
+ CDReq() {
+ head.type = CD_Req;
+ head.len = sizeof(CDReq);
+ }
+};
+struct CDPermission
+{
+ char Device_Name[32];
+ char Device_Status[32];
+ char Start_Time[32];
+ char Work_Time[32];
+ char Manufacturer[100];
+ char Devices_Type[32];
+ double Longitude;
+ double Latitude;
+};
+struct CDRes
+{
+ Head head;
+ char Device_Status[32];
+ int status;
+ CDPermission per;
+ CDRes() {
+ head.type = CD_Res;
+ head.len = sizeof(CDRes);
+ }
+};
+
+//暂停设备
+struct PDReq
+{
+ Head head;
+ char Device_Name[32];
+ PDReq() {
+ head.type = PD_Req;
+ head.len = sizeof(PDReq);
+ }
+};
+struct PDPermission
+{
+ char Device_Name[32];
+ char Device_Status[32];
+ char Start_Time[32];
+ char Work_Time[32];
+ char Manufacturer[100];
+ char Devices_Type[32];
+ double Longitude;
+ double Latitude;
+};
+struct PDRes
+{
+ Head head;
+ char Device_Status[32];
+ char Work_Time[32];
+ int status;
+ PDPermission per;
+ PDRes() {
+ head.type = PD_Res;
+ head.len = sizeof(PDRes);
+ }
+};
\ No newline at end of file
diff --git "a/Client/\351\273\216\345\274\230\351\234\226/code/device_management.zip" "b/Client/\351\273\216\345\274\230\351\234\226/code/device_management.zip"
deleted file mode 100644
index 98e3eae..0000000
--- "a/Client/\351\273\216\345\274\230\351\234\226/code/device_management.zip"
+++ /dev/null
Binary files differ
diff --git "a/Client/\351\273\216\345\274\230\351\234\226/log/\350\256\276\345\244\207\347\256\241\347\220\206_\351\273\216\345\274\230\351\234\226_1031.doc" "b/Client/\351\273\216\345\274\230\351\234\226/log/\350\256\276\345\244\207\347\256\241\347\220\206_\351\273\216\345\274\230\351\234\226_1031.doc"
new file mode 100644
index 0000000..e8f66d0
--- /dev/null
+++ "b/Client/\351\273\216\345\274\230\351\234\226/log/\350\256\276\345\244\207\347\256\241\347\220\206_\351\273\216\345\274\230\351\234\226_1031.doc"
Binary files differ
diff --git "a/Client/\351\273\216\345\274\230\351\234\226/log/\350\256\276\345\244\207\347\256\241\347\220\206_\351\273\216\345\274\230\351\234\226_1101.doc" "b/Client/\351\273\216\345\274\230\351\234\226/log/\350\256\276\345\244\207\347\256\241\347\220\206_\351\273\216\345\274\230\351\234\226_1101.doc"
new file mode 100644
index 0000000..c9ef8ff
--- /dev/null
+++ "b/Client/\351\273\216\345\274\230\351\234\226/log/\350\256\276\345\244\207\347\256\241\347\220\206_\351\273\216\345\274\230\351\234\226_1101.doc"
Binary files differ
diff --git "a/Server/\346\235\216\350\275\254\350\275\254/log/\351\205\215\347\275\256\347\256\241\347\220\206_1101.doc" "b/Server/\346\235\216\350\275\254\350\275\254/log/\351\205\215\347\275\256\347\256\241\347\220\206_1101.doc"
new file mode 100644
index 0000000..051ea88
--- /dev/null
+++ "b/Server/\346\235\216\350\275\254\350\275\254/log/\351\205\215\347\275\256\347\256\241\347\220\206_1101.doc"
Binary files differ
diff --git "a/Server/\350\203\241\345\256\266\346\230\216/log/\346\227\245\345\277\227_\350\203\241\345\256\266\346\230\216_1031.doc" "b/Server/\350\203\241\345\256\266\346\230\216/log/\346\227\245\345\277\227_\350\203\241\345\256\266\346\230\216_1031.doc"
new file mode 100644
index 0000000..cfb108c
--- /dev/null
+++ "b/Server/\350\203\241\345\256\266\346\230\216/log/\346\227\245\345\277\227_\350\203\241\345\256\266\346\230\216_1031.doc"
Binary files differ
diff --git "a/Server/\351\231\210\346\245\232\344\270\271/log/\346\227\245\345\277\227_\351\231\210\346\245\232\344\270\271_1031.doc" "b/Server/\351\231\210\346\245\232\344\270\271/log/\346\227\245\345\277\227_\351\231\210\346\245\232\344\270\271_1031.doc"
new file mode 100644
index 0000000..409d72e
--- /dev/null
+++ "b/Server/\351\231\210\346\245\232\344\270\271/log/\346\227\245\345\277\227_\351\231\210\346\245\232\344\270\271_1031.doc"
Binary files differ
diff --git "a/Server/\351\251\254\344\270\275\350\220\215/code/log/log.cpp" "b/Server/\351\251\254\344\270\275\350\220\215/code/log/log.cpp"
index 9a0dbea..3c6e62c 100644
--- "a/Server/\351\251\254\344\270\275\350\220\215/code/log/log.cpp"
+++ "b/Server/\351\251\254\344\270\275\350\220\215/code/log/log.cpp"
@@ -1,21 +1,14 @@
-#include <string.h>
#include <time.h>
#include <chrono>
-#include <ctime>
#include <stdarg.h>
#include "log.h"
-#include <sstream>
#include <fstream>
#include <iostream>
-#include <chrono>
using namespace std;
// 鏋勯�犲嚱鏁�
-Log::Log() {
- m_count = 0; // 鍒濆鍖栨棩蹇楄鏁�
- m_is_async = false; // 鍒濆鍖栦负鍚屾
-}
+Log::Log() : m_count(0), m_is_async(false) {}
// 鏋愭瀯鍑芥暟
Log::~Log() {
@@ -24,31 +17,82 @@
}
}
-// 鎺ユ敹鍘熷鏃ュ織骞惰В鏋�
-void Log::receiveLog(const std::string &raw_log) {
- ParsedLog parsed_log = parseLog(raw_log);
- write_log(levelToInt(parsed_log.level), "%s [%s] %s", parsed_log.timestamp.c_str(), parsed_log.device_id.c_str(), parsed_log.content.c_str());
+//寮傛鍐欏叆
+void Log::async_write_log() {
+ while (m_is_async) {
+ char* log;
+ if (m_log_queue->pop(log)) {
+ ParsedLog parsed_log = parseLog(log);
+ write_log(INFO, "%s", log); // 鍏堝啓鍏ユ棩蹇楁枃浠�
+ writeLogToDatabase(parsed_log); // 鍐嶅啓鍏ユ暟鎹簱
+ delete[] log; // 閲婃斁鍐呭瓨
+ }
+ }
}
+bool Log::check_log_size() {
+ if (m_fp.tellp() >= max_size) {
+ rotate_logs(); // 濡傛灉鏃ュ織鏂囦欢澶у皬瓒呰繃鏈�澶у�硷紝杞崲鏃ュ織
+ return true;
+ }
+ return false;
+}
+
+
+// 鎺ユ敹鍘熷鏃ュ織骞惰В鏋�
+void Log::receiveLog(const char* raw_log) {
+ ParsedLog parsed_log = parseLog(raw_log);
+ write_log(levelToInt(parsed_log.level), "%s [%s] %s",
+ parsed_log.timestamp,
+ parsed_log.device_id,
+ parsed_log.content);
+}
+
+//鍐欏叆鏁版嵁搴�
+void Log::writeLogToDatabase(const ParsedLog& log) {
+ const char* sql = "INSERT INTO parsed_logs (timestamp, device_id, level, content, source, user_id) VALUES (?, ?, ?, ?, ?, ?)";
+ sqlite3_stmt* stmt;
+
+ if (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK) {
+ cerr << "Error: Failed to prepare statement: " << sqlite3_errmsg(db) << endl;
+ return;
+ }
+
+ sqlite3_bind_text(stmt, 1, log.timestamp, -1, SQLITE_STATIC);
+ sqlite3_bind_text(stmt, 2, log.device_id, -1, SQLITE_STATIC);
+ sqlite3_bind_text(stmt, 3, log.level, -1, SQLITE_STATIC);
+ sqlite3_bind_text(stmt, 4, log.content, -1, SQLITE_STATIC);
+ sqlite3_bind_text(stmt, 5, log.source, -1, SQLITE_STATIC);
+ sqlite3_bind_text(stmt, 6, log.user_id, -1, SQLITE_STATIC);
+
+ if (sqlite3_step(stmt) != SQLITE_DONE) {
+ cerr << "Error: Failed to execute statement: " << sqlite3_errmsg(db) << endl;
+ }
+
+ sqlite3_finalize(stmt); // 娓呯悊鍑嗗璇彞
+}
+
+
// 瑙f瀽鏃ュ織瀛楃涓�
-ParsedLog Log::parseLog(const std::string &log) {
+ParsedLog Log::parseLog(const char* log) {
ParsedLog parsed_log;
- std::istringstream iss(log);
- std::string level;
+ char level[16];
// 璇诲彇鏃堕棿鎴炽�佽澶嘔D鍜屾棩蹇楃骇鍒�
- iss >> parsed_log.timestamp >> parsed_log.device_id >> level;
- std::getline(iss, parsed_log.content);
- parsed_log.level = level; // 璁剧疆瑙f瀽鍚庣殑绾у埆
+ sscanf(log, "%s %s %s %[^\n]", parsed_log.timestamp, parsed_log.device_id, level, parsed_log.content);
+ // 璁剧疆瑙f瀽鍚庣殑绾у埆
+ for (int i = 0; i < 16; ++i) {
+ parsed_log.level[i] = level[i];
+ }
return parsed_log;
}
// 鍒濆鍖栨棩蹇楃郴缁�
-bool Log::init(const std::string &file_name, int close_log, int log_buf_size, int split_lines, int max_queue_size) {
+bool Log::init(const char* file_name, int close_log, int log_buf_size, int split_lines, int max_queue_size) {
if (max_queue_size >= 1) {
m_is_async = true; // 鍚敤寮傛鍐欏叆
- m_log_queue = new block_queue<string>(max_queue_size); // 鍒涘缓闃诲闃熷垪
+ m_log_queue = new block_queue<char*>(max_queue_size); // 鍒涘缓闃诲闃熷垪
std::thread(&Log::flush_log_thread, this).detach(); // 鍒涘缓鍒锋柊鏃ュ織绾跨▼
}
@@ -60,43 +104,76 @@
time_t t = time(NULL);
struct tm *sys_tm = localtime(&t);
- std::string log_full_name;
+ char log_full_name[256];
// 鏍规嵁鏂囦欢璺緞鍜屽綋鍓嶆棩鏈熺敓鎴愬畬鏁存棩蹇楁枃浠跺悕
- if (file_name.find('/') == std::string::npos) {
- log_full_name = to_string(sys_tm->tm_year + 1900) + "_" + to_string(sys_tm->tm_mon + 1) + "_" + to_string(sys_tm->tm_mday) + "_" + file_name;
+ if (strchr(file_name, '/') == nullptr) {
+ sprintf(log_full_name, "%d_%d_%d_%s",
+ sys_tm->tm_year + 1900, sys_tm->tm_mon + 1, sys_tm->tm_mday, file_name);
} else {
- std::string log_name = file_name.substr(file_name.find_last_of('/') + 1);
- std::string dir_name = file_name.substr(0, file_name.find_last_of('/') + 1);
-
- log_full_name = dir_name + to_string(sys_tm->tm_year + 1900) + "_" + to_string(sys_tm->tm_mon + 1) + "_" + to_string(sys_tm->tm_mday) + "_" + log_name;
+ char log_name[128];
+ char dir_name[128];
+ char* last_slash = strrchr(file_name, '/');
+ int dir_len = last_slash - file_name + 1;
+ strncpy(dir_name, file_name, dir_len);
+ dir_name[dir_len] = '\0';
+ strcpy(log_name, last_slash + 1);
+
+ sprintf(log_full_name, "%s%d_%d_%d_%s",
+ dir_name, sys_tm->tm_year + 1900, sys_tm->tm_mon + 1, sys_tm->tm_mday, log_name);
}
m_today = sys_tm->tm_mday; // 璁板綍浠婂ぉ鐨勬棩鏈�
m_fp.open(log_full_name, std::ios::out | std::ios::app); // 鎵撳紑鏃ュ織鏂囦欢
if (!m_fp.is_open()) {
+ cerr << "Error: Could not open log file: " << log_full_name << endl;
return false; // 鎵撳紑澶辫触
}
return true; // 鍒濆鍖栨垚鍔�
}
-#include <chrono>
+//鏌ヨ鏃ュ織鑽夋渶
+void Log::queryLogs(const char *device_id) {
+ const char* sql = "SELECT * FROM parsed_logs WHERE device_id = ?";
+ sqlite3_stmt* stmt;
+ if (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK) {
+ cerr << "Error: Failed to prepare statement: " << sqlite3_errmsg(db) << endl;
+ return;
+ }
+
+ sqlite3_bind_text(stmt, 1, device_id, -1, SQLITE_STATIC);
+
+ while (sqlite3_step(stmt) == SQLITE_ROW) {
+ cout << "Timestamp: " << sqlite3_column_text(stmt, 1) << ", "
+ << "Device ID: " << sqlite3_column_text(stmt, 2) << ", "
+ << "Level: " << sqlite3_column_text(stmt, 3) << ", "
+ << "Content: " << sqlite3_column_text(stmt, 4) << ", "
+ << "Source: " << sqlite3_column_text(stmt, 5) << ", "
+ << "User ID: " << sqlite3_column_text(stmt, 6) << endl;
+ }
+
+ sqlite3_finalize(stmt); // 娓呯悊鍑嗗璇彞
+}
+
+
+
+// 鍐欏叆鏃ュ織
void Log::write_log(int level, const char *format, ...) {
auto now = std::chrono::system_clock::now();
auto now_time_t = std::chrono::system_clock::to_time_t(now);
struct tm *sys_tm = localtime(&now_time_t);
- std::string s;
+ char s[32];
// 鏍规嵁鏃ュ織绾у埆璁剧疆鍓嶇紑
switch (level) {
- case DEBUG: s = "[debug]: "; break;
- case INFO: s = "[info]: "; break;
- case WARN: s = "[warn]: "; break;
- case ERROR: s = "[error]: "; break;
- default: s = "[info]: "; break;
+ case DEBUG: strcpy(s, "[debug]: "); break;
+ case INFO: strcpy(s, "[info]: "); break;
+ case WARN: strcpy(s, "[warn]: "); break;
+ case ERROR: strcpy(s, "[error]: "); break;
+ default: strcpy(s, "[info]: "); break;
}
m_mutex.lock(); // 閿佸畾浜掓枼浣�
@@ -104,7 +181,7 @@
// 妫�鏌ユ槸鍚﹂渶瑕佽疆鎹㈡棩蹇�
if (m_today != sys_tm->tm_mday || m_count % m_split_lines == 0) {
- // ... (鏃ュ織杞崲浠g爜)
+ rotate_logs(); // 璋冪敤鏃ュ織杞崲鍑芥暟
}
// 鍐欏叆鏃ュ織鍐呭
@@ -113,6 +190,7 @@
vsnprintf(m_buf, m_log_buf_size, format, valist); // 鍐欏叆鏃ュ織鍐呭
m_fp << s << m_buf << std::endl; // 浣跨敤ofstream鍐欏叆鏂囦欢
+ va_end(valist);
m_mutex.unlock(); // 瑙i攣浜掓枼浣�
@@ -133,18 +211,65 @@
void Log::flush_log_thread() {
while (m_is_async) {
// 浠庨槦鍒椾腑鑾峰彇鏃ュ織骞跺啓鍏�
- string log;
+ char* log;
if (m_log_queue->pop(log)) {
- write_log(INFO, "%s", log.c_str());
+ write_log(INFO, "%s", log);
}
}
}
+//杞崲瀛楃涓�
+const char* Log::log_level_to_string(int level) {
+ switch (level) {
+ case DEBUG: return "[debug]: ";
+ case INFO: return "[info]: ";
+ case WARN: return "[warn]: ";
+ case ERROR: return "[error]: ";
+ default: return "[info]: "; // 榛樿杩斿洖INFO
+ }
+}
+
// 鏃ュ織绾у埆杞崲涓烘暣鏁�
-int Log::levelToInt(const std::string &level) {
- if (level == "[debug]:") return DEBUG;
- if (level == "[info]:") return INFO;
- if (level == "[warn]:") return WARN;
- if (level == "[error]:") return ERROR;
+int Log::levelToInt(const char* level) {
+ if (strcmp(level, "[debug]:") == 0) return DEBUG;
+ if (strcmp(level, "[info]:") == 0) return INFO;
+ if (strcmp(level, "[warn]:") == 0) return WARN;
+ if (strcmp(level, "[error]:") == 0) return ERROR;
return INFO; // 榛樿杩斿洖INFO
}
+
+//鎵撳紑鍏抽棴鏁版嵁搴�
+void Log::openDatabase(const char *db_name) {
+ if (sqlite3_open(db_name, &db) != SQLITE_OK) {
+ cerr << "鎵撲笉寮�鏁版嵁搴擄紒锛侀敊璇細 " << sqlite3_errmsg(db) << endl;
+ }
+}
+
+void Log::closeDatabase() {
+ if (db) {
+ sqlite3_close(db);
+ }
+}
+
+// 鏃ュ織杞崲鍑芥暟
+void Log::rotate_logs() {
+ // 鍏抽棴褰撳墠鏂囦欢
+ m_fp.close();
+
+ // 鐢熸垚鏂版枃浠跺悕
+ time_t t = time(NULL);
+ struct tm *sys_tm = localtime(&t);
+ char new_log_name[256];
+ sprintf(new_log_name, "%d_%d_%d_log.txt",
+ sys_tm->tm_year + 1900, sys_tm->tm_mon + 1, sys_tm->tm_mday);
+
+ // 鎵撳紑鏂扮殑鏃ュ織鏂囦欢
+ m_fp.open(new_log_name, std::ios::out | std::ios::app);
+ if (!m_fp.is_open()) {
+ cerr << "Error: Could not open new log file: " << new_log_name << endl;
+ return;
+ }
+
+ m_today = sys_tm->tm_mday; // 鏇存柊浠婂ぉ鐨勬棩鏈�
+ m_count = 0; // 閲嶇疆鏃ュ織璁℃暟
+}
diff --git "a/Server/\351\251\254\344\270\275\350\220\215/code/log/log.h" "b/Server/\351\251\254\344\270\275\350\220\215/code/log/log.h"
index be28a84..83df983 100644
--- "a/Server/\351\251\254\344\270\275\350\220\215/code/log/log.h"
+++ "b/Server/\351\251\254\344\270\275\350\220\215/code/log/log.h"
@@ -3,12 +3,12 @@
#include <stdio.h>
#include <iostream>
-#include <string>
#include <stdarg.h>
-#include <thread>
+#include <thread>
#include "block_queue.h"
-#include "locker.h" // 纭繚 locker.h 琚寘鍚�
+#include "locker.h"
#include <fstream>
+#include <sqlite3.h> // 娣诲姞 SQLite 鏁版嵁搴撶殑澶存枃浠�
using namespace std;
@@ -22,10 +22,12 @@
// 瀛樺偍瑙f瀽鏃ュ織鏂囦欢鐨勭粨鏋勪綋
struct ParsedLog {
- std::string timestamp; // 鏃堕棿鎴�
- std::string device_id; // 璁惧ID
- std::string level; // 鏃ュ織绾у埆
- std::string content; // 鏃ュ織鍐呭
+ char timestamp[64]; // 鏃堕棿鎴�
+ char device_id[64]; // 璁惧ID
+ char level[16]; // 鏃ュ織绾у埆
+ char content[256]; // 鏃ュ織鍐呭
+ char source[64]; // 鏉ユ簮妯″潡
+ char user_id[64]; // 鐢ㄦ埛ID
};
class Log
@@ -42,17 +44,19 @@
void flush_log_thread(); // 淇敼涓洪潪闈欐�佹垚鍛樺嚱鏁�
// 鍒濆鍖栨棩蹇楃郴缁燂紝鍙傛暟鍖呮嫭鏂囦欢鍚嶃�佹槸鍚﹀叧闂棩蹇椼�佺紦鍐插尯澶у皬銆佹渶澶ц鏁板拰鏈�澶ч槦鍒楀ぇ灏�
- bool Log::init(const char *file_name, int close_log, int log_buf_size, int split_lines, int max_queue_size);
+ bool init(const char *file_name, int close_log, int log_buf_size, int split_lines, int max_queue_size);
-
// 鍐欏叆鏃ュ織
void write_log(int level, const char *format, ...);
// 鍒锋柊鏃ュ織鏂囦欢
void flush(void);
- //鎺ユ敹鍘熷鐨勮鍏叡绫�
- void receiveLog(const std::string& raw_log); // 鎺ユ敹鍘熷鏃ュ織
+ // 鎺ユ敹鍘熷鏃ュ織
+ void receiveLog(const char* raw_log);
+
+ // 灏嗘棩蹇楀啓鍏ユ暟鎹簱
+ void writeLogToDatabase(const ParsedLog& log);
private:
Log(); // 鏋勯�犲嚱鏁�
@@ -62,12 +66,12 @@
bool check_log_size(); // 妫�鏌ユ棩蹇楁枃浠跺ぇ灏�
void rotate_logs(); // 杞崲鏃ュ織鏂囦欢
- ParsedLog parseLog(const std::string& log); // 瑙f瀽鏃ュ織
- bool init(const std::string &file_name, int close_log, int log_buf_size, int split_lines, int max_queue_size);
- void queryLogs(const std::string &device_id); // 鏌ヨ鏃ュ織
+ ParsedLog parseLog(const char* log); // 瑙f瀽鏃ュ織
+ bool init(const char *file_name, int close_log, int log_buf_size, int split_lines, int max_queue_size);
+ void queryLogs(const char *device_id); // 鏌ヨ鏃ュ織
const char* log_level_to_string(int level); // 灏嗘棩蹇楃骇鍒浆鎹负瀛楃涓�
- int levelToInt(const std::string &level);
+ int levelToInt(const char *level);
private:
char dir_name[128]; // 鏃ュ織鏂囦欢鐩綍
@@ -78,16 +82,18 @@
int m_today; // 璁板綍褰撳墠鏃堕棿
std::ofstream m_fp; // 灏� FILE * m_fp 鏇存敼涓� std::ofstream m_fp
char *m_buf; // 鏃ュ織缂撳啿鍖�
- block_queue<string> *m_log_queue; // 闃诲闃熷垪
+ block_queue<char*> *m_log_queue; // 闃诲闃熷垪
bool m_is_async; // 鏄惁寮傛鏍囧織浣�
locker m_mutex; // 浜掓枼閿�
int m_close_log; // 鍏抽棴鏃ュ織鐨勬爣蹇�
- long max_size = 10 * 1024 * 1024; // 10MB
- //娴嬭瘯鏂囦欢閲岄潰鐨�
- int m_close_log; // 纭繚鍦ㄨ繖閲屽畾涔�
+ long max_size = 10 * 1024 * 1024; // 鍗曚釜鏃ュ織鏂囦欢鐨勫ぇ灏� 10MB
+
+ // 鏁版嵁搴撶浉鍏�
+ sqlite3 *db; // SQLite 鏁版嵁搴撴寚閽�
+ void openDatabase(const char *db_name); // 鎵撳紑鏁版嵁搴�
+ void closeDatabase(); // 鍏抽棴鏁版嵁搴�
};
-// 瀹忓畾涔夌敤浜庝笉鍚岀骇鍒殑鏃ュ織璁板綍
#define LOG_DEBUG(format, ...) if(0 == m_close_log) {Log::get_instance()->write_log(DEBUG, format, ##__VA_ARGS__); Log::get_instance()->flush();}
#define LOG_INFO(format, ...) if(0 == m_close_log) {Log::get_instance()->write_log(INFO, format, ##__VA_ARGS__); Log::get_instance()->flush();}
#define LOG_WARN(format, ...) if(0 == m_close_log) {Log::get_instance()->write_log(WARN, format, ##__VA_ARGS__); Log::get_instance()->flush();}
diff --git "a/Server/\351\251\254\344\270\275\350\220\215/document/\346\227\245\345\277\227\351\234\200\346\261\202\345\210\206\346\236\220\346\226\207\346\241\243.docx" "b/Server/\351\251\254\344\270\275\350\220\215/document/\346\227\245\345\277\227\351\234\200\346\261\202\345\210\206\346\236\220\346\226\207\346\241\243.docx"
index 13a9cda..8ce7464 100644
--- "a/Server/\351\251\254\344\270\275\350\220\215/document/\346\227\245\345\277\227\351\234\200\346\261\202\345\210\206\346\236\220\346\226\207\346\241\243.docx"
+++ "b/Server/\351\251\254\344\270\275\350\220\215/document/\346\227\245\345\277\227\351\234\200\346\261\202\345\210\206\346\236\220\346\226\207\346\241\243.docx"
Binary files differ
diff --git "a/Server/\351\251\254\344\270\275\350\220\215/log/log_1031.doc" "b/Server/\351\251\254\344\270\275\350\220\215/log/log_1031.doc"
new file mode 100644
index 0000000..9740cdd
--- /dev/null
+++ "b/Server/\351\251\254\344\270\275\350\220\215/log/log_1031.doc"
Binary files differ
diff --git "a/Server/\351\251\254\346\270\235\346\235\255/log/20241031\346\230\206\344\273\221\346\227\245\346\212\245.doc" "b/Server/\351\251\254\346\270\235\346\235\255/log/20241031\346\230\206\344\273\221\346\227\245\346\212\245.doc"
new file mode 100644
index 0000000..4021a6c
--- /dev/null
+++ "b/Server/\351\251\254\346\270\235\346\235\255/log/20241031\346\230\206\344\273\221\346\227\245\346\212\245.doc"
Binary files differ
diff --git a/common.h b/common.h
new file mode 100644
index 0000000..182b8e6
--- /dev/null
+++ b/common.h
@@ -0,0 +1,873 @@
+#ifndef COMMON_H
+#define COMMON_H
+
+#include <string.h>
+
+enum TypeInfo{
+
+ //娉ㄥ唽鐧诲綍
+ LOGIN_REQ, // 鐧诲綍璇锋眰
+ LOGIN_RES, // 鐧诲綍鍝嶅簲
+ REGISTER_REQ, //娉ㄥ唽璇锋眰
+ REGISTER_RES, //娉ㄥ唽鍝嶅簲
+ RESET_REQ, //閲嶇疆瀵嗙爜璇锋眰
+ RESET_RES, //閲嶇疆瀵嗙爜鍝嶅簲
+
+
+ //鏉冮檺绠$悊
+ QUERY_PMS_REQ, // 鎸夊憳宸ョ紪鍙枫�佸悕瀛楁垨鑱屼綅鏌ヨ浜哄憳鏉冮檺淇℃伅璇锋眰
+ UPDATE_PMS_REQ, // 鎸夎鑹瞚d鏇存柊鏉冮檺淇℃伅璇锋眰
+ QUERY_PMS_RES, // 鏌ヨ浜哄憳鍜岃鑹蹭俊鎭殑鍝嶅簲缁撴瀯浣�
+ UPDATE_PMS_RES, // 鏉冮檺鏇存柊缁撴灉鍝嶅簲浣�
+
+ //璁惧绠$悊
+ AD_Req,//娣诲姞璁惧璇锋眰
+ AD_Res,//娣诲姞璁惧鍝嶅簲
+ CD_Req,//鍏抽棴璁惧璇锋眰
+ CD_Res,//鍏抽棴璁惧璇锋眰
+ PD_Req,//鏆傚仠璁惧璇锋眰
+ PD_Res,//鏆傚仠璁惧璇锋眰
+
+ //鍦板浘鏍囨敞
+ MAPMARK_REQ,//鍦板浘鏍囨敞璇锋眰
+ MAPMARK_RES//鍦板浘鏍囨敞鍝嶅簲
+
+ //澶у睆鏄剧ず
+ ENVIRONMENT_REQ,//鐜鏁版嵁璇锋眰
+ ENVIRONMENT_RES,//鐜鏁版嵁鍝嶅簲
+ DEVICESTATUS_REQ,//璁惧鐘舵�佽姹�
+ DEVICESTATUS_RES,//璁惧鐘舵�佸搷搴�
+ MOVEMENTRECORD_REQ,//鎿嶄綔鏃ュ織璇锋眰
+ MOVEMENTRECORD_RES,//鎿嶄綔鏃ュ織鍝嶅簲
+ ALARMRECORD_REQ,//璀︽姤璁板綍璇锋眰
+ ALARMRECORD_RES,//璀︽姤璁板綍鍝嶅簲
+ YIELD_REQ,//鐓ょ熆浜ч噺璇锋眰
+ YIELD_RES,//鐓ょ熆浜ч噺鍝嶅簲
+
+ //璀︽姤绠$悊
+ WARNING_REQ, // 璀︽姤璇锋眰
+ WARNING_RES, // 璀︽姤鍝嶅簲
+
+
+ //鐢熶骇璁″垝绠$悊
+ ADD_PRODUCTION_PLAN_REQ,//娣诲姞涓�琛屾暟鎹殑璇锋眰缁撴瀯浣�
+ ADD_PRODUCTION_PLAN_RES,//娣诲姞涓�琛屾暟鎹殑鍝嶅簲缁撴瀯浣�
+ UPDATE_PRODUCTION_PLAN_QUANTITY_REQ,// 鏇存柊鐢熶骇璁″垝锛堣鍒掔敓浜ч噺锛夌殑璇锋眰缁撴瀯浣�
+ UPDATE_PRODUCTION_PLAN_QUANTITY_RES,// 鏇存柊鐢熶骇璁″垝锛堣鍒掔敓浜ч噺锛夌殑鍝嶅簲缁撴瀯浣�
+ UPDATE_PRODUCTION_PLAN_LOG_REQ,//鏇存柊鐢熶骇璁″垝锛堟棩蹇楋級鐨勮姹傜粨鏋勪綋
+ UPDATE_PRODUCTION_PLAN_LOG_RES,//鏇存柊鐢熶骇璁″垝锛堟棩蹇楋級鐨勫搷搴旂粨鏋勪綋
+ PRODUCTION_PLAN_REQ,// 鏌ヨ鐢熶骇璁″垝淇℃伅鐨勮姹傜粨鏋勪綋
+ PRODUCTION_PLAN_RES,// 鏌ヨ鐢熶骇璁″垝淇℃伅鐨勫搷搴旂粨鏋勪綋
+ FORRECENT_FOURTEEN_PRODUCTION_PLANS_REQ,//鏌ヨ杩戝崄鍥涙潯鐨勮姹傜粨鏋勪綋
+ FORRECENT_FOURTEEN_PRODUCTION_PLANS_RES //鏌ヨ杩戝崄鍥涙潯鐨勫搷搴旂粨鏋勪綋
+
+
+ //鍘嗗彶鏌ヨ鍒嗘瀽
+ HISTORY_QUERY_REQ, // 鍘嗗彶鏌ヨ璇锋眰
+ HISTORY_QUERY_RES, // 鍘嗗彶鏌ヨ鍝嶅簲
+
+ //鑷姩鍗囩骇
+ VERSIONNUM_REQ, // 鐗堟湰鍙疯姹�
+ VERSIONNUM_RES, // 鐗堟湰鍙峰搷搴�
+ UPLOAD_FILE_REQ, // 涓婁紶鏂囦欢鐨勮姹�
+ UPLOAD_FILE_RES, // 涓婁紶鏂囦欢鐨勫搷搴�
+ VERSIONINFOENTRY_REQ, // 鐗堟湰淇℃伅褰曞叆璇锋眰
+ VERSIONINFOENTRY_RES, //鐗堟湰淇℃伅褰曞叆鍝嶅簲
+ VERSIONUPDATE_REQ, // 鐗堟湰鏇存柊璇锋眰
+ VERSIONUPDATE_RES, // 鐗堟湰鏇存柊鍝嶅簲
+ FILEDOWNLOADS_REQ, // 鐗堟湰鏇存柊鏂囦欢涓嬭浇璇锋眰
+ FILEDOWNLOADS_RES, // 鐗堟湰鏇存柊鏂囦欢涓嬭浇鍝嶅簲
+ DOWNLOADSUCCESSFULLY_RES // 鏇存柊鏂囦欢涓嬭浇鎴愬姛鐨勫搷搴�
+
+ //鏃ュ織
+ LOGSEARCH_REQ;//鏃ュ織鏌ヨ璇锋眰
+ LOGSEARCH_RES;//鏃ュ織鏌ヨ鍝嶅簲
+
+
+};
+
+struct Head{
+ int type;
+ int len;
+};
+
+//娉ㄥ唽鐧诲綍
+//鐧诲綍璇锋眰
+ struct LoginReq
+ {
+ Head head;
+ char user_name[32];
+ char password[32];
+ LoginReq(){
+ head.type = LOGIN_REQ;
+ head.len = sizeof(LoginReq);
+ }
+ };
+
+ struct Permission
+ {
+ int admin;
+ int log_search; //鏃ュ織鏌ヨ
+ int history; //鍘嗗彶璁板綍
+ int map_change;//鍦板浘
+ int version_manage; // 鐗堟湰绠$悊
+ int warning; //璀︽姤
+ int device_manage; //璁惧绠$悊
+ int pro_plan;//鐢熶骇璁″垝
+ char role_name[32]; // 瑙掕壊鍚�
+ };
+
+ //鐧诲綍鍝嶅簲
+ struct LoginRes
+ {
+ Head head;
+ char user_name[32];
+ int status; // 鐧诲綍鐘舵��
+ // 鐧诲綍鎴愬姛鏃讹紝璇ヨ处鍙峰搴旂殑鏉冮檺缁勫悎
+ Permission per;
+ LoginRes()
+ {
+ head.type = LOGIN_RES;
+ head.len = sizeof(LoginRes);
+ };
+ };
+
+ //娉ㄥ唽璇锋眰
+ struct RegisterReq
+ {
+ Head head;
+ char user_name[32];
+ char password[32];
+ char email[50];
+ int telephone;
+ RegisterReq(){
+ head.type = REGISTER_REQ;
+ head.len = sizeof(RegisterReq);
+ }
+ };
+
+ //娉ㄥ唽鍝嶅簲
+ struct RegisterRes
+ {
+ Head head;
+ char user_name[32];
+ int status; // 娉ㄥ唽鐘舵��
+ //娉ㄥ唽鎴愬姛锛岄粯璁ゆ渶灏忔潈闄愮粍鍚�
+ Permission per;
+ RegisterRes()
+ {
+ head.type = REGISTER_RES;
+ head.len = sizeof(RegisterRes);
+ };
+ };
+
+ //閲嶇疆瀵嗙爜璇锋眰
+ struct ResetReq
+ {
+ Head head;
+ char email[50];
+ char password[32];
+ ResetReq(){
+ head.type = RESET_REQ;
+ head.len = sizeof(ResetReq);
+ }
+ };
+
+ //閲嶇疆瀵嗙爜鍝嶅簲
+ struct ResetRes
+ {
+ Head head;
+ char user_name[32];
+ int status; // 閲嶇疆瀵嗙爜鐘舵��
+ ResetRes()
+ {
+ head.type = RESET_RES;
+ head.len = sizeof(ResetRes);
+ };
+ };
+
+
+//鏉冮檺绠$悊
+// 鎸夊憳宸ョ紪鍙枫�佸悕瀛楁垨鑱屼綅鏌ヨ浜哄憳鏉冮檺淇℃伅璇锋眰
+typedef struct QueryPmsRequest{
+ Head head;
+ char userNo[32];
+ char name[32];
+ char permissonType[32];
+ QueryPmsRequest(){
+ head.type=QUERY_PMS_REQ;
+ memset(userNo,0,32);
+ memset(permissonType,0,32);
+ memset(name,0,32);
+ head.len = sizeof(QueryPmsRequest);
+ }
+} QueryPmsRequest;
+
+// 鎸夎鑹瞚d鏇存柊鏉冮檺淇℃伅璇锋眰
+typedef struct UpdatePmsRequest{
+ Head head;
+ int roleId;
+ int queryHistory;
+ int loggerSearch;
+ int mapMark;
+ int devManage;
+ int productPlan;
+ UpdatePmsRequest(){
+ head.type=QUERY_PMS_RES;
+ head.len = sizeof(UpdatePmsRequest);
+ }
+} UpdatePmsRequest;
+
+// 鍗曚釜浜哄憳鏉冮檺缁撴瀯浣�
+typedef struct PmsRes{
+ int queryHistory;
+ int loggerSearch;
+ int mapMark;
+ int devManage;
+ int productPlan;
+ int roleId;
+ char userNo[32];
+ char name[32];
+ char permissonType[32];
+ char startDateTime[32];
+ char endDateTime[32];
+} PmsRes;
+
+// 鏌ヨ浜哄憳鍜岃鑹蹭俊鎭殑鍝嶅簲缁撴瀯浣�
+typedef struct QueryPmsResponse{
+ Head head;
+ int success; // 1涓烘垚鍔� ,0涓哄け璐�
+ char pmsList[0];
+ QueryPmsResponse(){
+ head.type=QUERY_PMS_RES;
+ }
+} QueryPmsResponse;
+
+// 鏉冮檺鏇存柊缁撴灉鍝嶅簲浣�
+struct UpdatePmsResponse{
+ Head head;
+ int success; // 1涓烘垚鍔� ,0涓哄け璐�
+ UpdatePmsResponse(){
+ head.type = UPDATE_PMS_RES;
+ head.len = sizeof(UpdatePmsResponse);
+ }
+
+} UpdatePmsResponse ;
+
+
+//璁惧绠$悊
+//娣诲姞璁惧
+struct ADReq
+{
+ Head head;
+ char Device_Name[32];
+ ADReq() {
+ head.type = AD_Req;
+ head.len = sizeof(AD_Req);
+ }
+
+};
+struct ADPermission
+{
+ char Device_Name[32];
+ char Device_Status[32];
+ char Manufacturer[100];
+ char Devices_Type[32];
+ double Longitude;
+ double Latitude;
+};
+struct ADRes
+{
+ Head head;
+ char Device_Name[32];
+ char Device_Status[32];
+ char Start_Time[32];
+ char Work_Time[32];
+ char Manufacturer[100];
+ char Devices_Type[32];
+ double Longitude;
+ double Latitude;
+ ADPermission per;
+ ADRes() {
+ head.type = AD_Res;
+ head.len = sizeof(ADRes);
+ }
+
+};
+
+//鍏抽棴璁惧
+struct CDReq
+{
+ Head head;
+ char Device_Name[32];
+ CDReq() {
+ head.type = CD_Req;
+ head.len = sizeof(CDReq);
+ }
+};
+struct CDPermission
+{
+ char Device_Name[32];
+ char Device_Status[32];
+ char Start_Time[32];
+ char Work_Time[32];
+ char Manufacturer[100];
+ char Devices_Type[32];
+ double Longitude;
+ double Latitude;
+};
+struct CDRes
+{
+ Head head;
+ char Device_Status[32];
+ int status;
+ CDPermission per;
+ CDRes() {
+ head.type = CD_Res;
+ head.len = sizeof(CDRes);
+ }
+};
+
+//鏆傚仠璁惧
+struct PDReq
+{
+ Head head;
+ char Device_Name[32];
+ PDReq() {
+ head.type = PD_Req;
+ head.len = sizeof(PDReq);
+ }
+};
+struct PDPermission
+{
+ char Device_Name[32];
+ char Device_Status[32];
+ char Start_Time[32];
+ char Work_Time[32];
+ char Manufacturer[100];
+ char Devices_Type[32];
+ double Longitude;
+ double Latitude;
+};
+struct PDRes
+{
+ Head head;
+ char Device_Status[32];
+ char Work_Time[32];
+ int status;
+ PDPermission per;
+ PDRes() {
+ head.type = PD_Res;
+ head.len = sizeof(PDRes);
+ }
+};
+
+
+//鍦板浘鏍囨敞
+struct MapMarkReq
+{
+ Head head;
+ int marktype;//鎻掑叆銆佸垹闄ゃ�佸姞杞�
+ MaskInfo msg[0];//鏌旀�ф暟缁�
+ MapMarkReq(){
+ head.type = MAPMARK_REQ;
+ head.len = sizeof(MapMarkReq);
+ }
+};
+
+//鍦板浘鍝嶅簲锛�
+struct MarkInfo
+{
+ int markId;//鏍囨敞鐐筰d
+ double latitude;//绾害
+ double longitude;//缁忓害
+ int deviceId;//璁惧ID
+ int deviceStatus;//璁惧鐘舵��
+ char deviceName[32];//璁惧鍚嶇О
+};
+
+struct MapMarkRes
+{
+ Head head;
+ int markType;//鎻掑叆杩樻槸鍒犻櫎
+ int status; // 鎿嶄綔鐘舵�乢鎴愬姛/澶辫触
+ MaskInfo info[0];//鏌旀�ф暟缁�
+ MapMarkRes()
+ {
+ head.type = MAPMARK_RES;
+ head.len = sizeof(MapMarkRes);
+ };
+};
+
+//澶у睆鏄剧ず
+//鐜鏁版嵁璇锋眰
+struct EnvironmentReq
+{
+ Head head;
+ float temp;//娓╁害
+ float humidity;//婀垮害
+ float oxygen;//姘ф皵娴撳害
+ float carbon;//涓�姘у寲纰虫祿搴�
+ EnvironmentReq(){
+ head.type = ENVIRONMENT_REQ;
+ head.len = sizeof(EnvironmentReq);
+ }
+};
+//璁惧鐘舵�佽姹�
+struct DeviceStatusReq
+{
+ Head head;
+ int device_ID;//璁惧缂栧彿
+ char device_Name[32];//璁惧鍚嶇О
+ char device_Status[32];//璁惧鐘舵��
+ DeviceStatusReq(){
+ head.type = DEVICESTATUS_REQ;
+ head.len = sizeof(DeviceStatusReq);
+ }
+};
+//鎿嶄綔鏃ュ織璇锋眰
+struct MovementRecordReq
+{
+ Head head;
+ char user_Name;//鎿嶄綔鐢ㄦ埛鍚�
+ char operate_Time[32];//鎿嶄綔鏃堕棿
+ char device_Name[32];//鎿嶄綔璁惧
+ char movement[256];//鎿嶄綔鎻忚堪
+ MovementRecordReq(){
+ head.type = MOVEMENTRECORD_REQ;
+ head.len = sizeof(MovementRecordReq);
+ }
+};
+//璀︽姤璁板綍璇锋眰
+struct AlarmRecordReq
+{
+ Head head;
+ char alarm_Time[32];//璀︽姤鏃堕棿
+ char alarm_type[32];//瑙e喅鏃堕棿
+ char alarm_Content[256];//璀︽姤鍐呭
+ AlarmRecordReq(){
+ head.type = ALARMRECORD_REQ;
+ head.len = sizeof(AlarmRecordReq);
+ }
+};
+//鐓ょ熆浜ч噺璇锋眰
+struct YieldReq
+{
+ Head head;
+ int month;//鏈堜唤
+ int yield;//浜ч噺
+ YieldReq(){
+ head.type = YIELD_REQ;
+ head.len = sizeof(YieldReq);
+ }
+};
+
+//璀︽姤绠$悊
+// 璀︽姤璇锋眰缁撴瀯浣�
+struct WarningReq {
+ Head head;
+ float oxygen; // 姘ф皵娴撳害
+ float carbon; // 涓�姘у寲纰虫祿搴�
+ float temp; // 娓╁害
+ float humidity; // 婀垮害
+
+ WarningReq() {
+ head.type = WARNING_REQ;
+ head.len = sizeof(WarningReq);
+ }
+};
+
+// 璀︽姤鍝嶅簲缁撴瀯浣�
+struct WarningRes {
+ Head head;
+ int status; // 鍝嶅簲鐘舵�侊紙姣斿 0 琛ㄧず鎴愬姛锛�1 琛ㄧず澶辫触绛夛級
+ const char* message; // 鍝嶅簲娑堟伅鎻忚堪
+
+ WarningRes(int stat, const char* msg) {
+ head.type = WARNING_RES;
+ head.len = sizeof(WarningRes);
+ status = stat;
+ message = msg;
+ }
+};
+
+//鐢熶骇璁″垝绠$悊
+//娣诲姞涓�琛屾暟鎹殑璇锋眰缁撴瀯浣�
+struct AddProductionPlanReq {
+ Head head;
+ int type;
+ char productionDate[32];
+ int productionQuantity;
+ int plannedProductionQuantity;
+ int predictedProductionQuantity;
+ char logText[256];
+ AddProductionPlanReq() {
+ head.type = ADD_PRODUCTION_PLAN_REQ;
+ head.len = sizeof(AddProductionPlanReq);
+ }
+};
+//娣诲姞涓�琛屾暟鎹殑鍝嶅簲缁撴瀯浣�
+struct AddProductionPlanRes {
+ Head head;
+ int type;
+ int status; // 鍙互琛ㄧず娣诲姞鏄惁鎴愬姛锛� 0 琛ㄧず澶辫触锛�1 琛ㄧず鎴愬姛
+ AddProductionPlanRes() {
+ head.type = ADD_PRODUCTION_PLAN_RES;
+ head.len = sizeof(AddProductionPlanRes);
+ }
+};
+
+// 鏇存柊鐢熶骇璁″垝锛堣鍒掔敓浜ч噺锛夌殑璇锋眰缁撴瀯浣�
+struct UpdateProductionPlanQuantityReq {
+ Head head;
+ int type;
+ int plannedProductionQuantity;
+ char productionDate[32];
+ UpdateProductionPlanQuantityReq() {
+ head.type = UPDATE_PRODUCTION_PLAN_QUANTITY_REQ;
+ head.len = sizeof(UpdateProductionPlanQuantityReq);
+ }
+};
+// 鏇存柊鐢熶骇璁″垝锛堣鍒掔敓浜ч噺锛夌殑鍝嶅簲缁撴瀯浣�
+struct UpdateProductionPlanQuantityRes {
+ Head head;
+ int type;
+ int status; // 鍙互琛ㄧず鏇存柊鏄惁鎴愬姛锛屼緥濡� 0 琛ㄧず澶辫触锛�1 琛ㄧず鎴愬姛
+ UpdateProductionPlanQuantityRes() {
+ head.type = UPDATE_PRODUCTION_PLAN_QUANTITY_RES;
+ head.len = sizeof(UpdateProductionPlanQuantityRes);
+ }
+};
+
+
+// 鏇存柊鐢熶骇璁″垝锛堟棩蹇楋級鐨勮姹傜粨鏋勪綋
+struct UpdateProductionPlanLogReq {
+ Head head;
+ int type;
+ char logText[256];
+ char productionDate[32];
+ UpdateProductionPlanLogReq() {
+ head.type = UPDATE_PRODUCTION_PLAN_LOG_REQ;
+ head.len = sizeof(UpdateProductionPlanLogReq);
+ }
+};
+// 鏇存柊鐢熶骇璁″垝璇锋眰锛堟棩蹇楋級鐨勫搷搴旂粨鏋勪綋
+struct UpdateProductionPlanLogRes {
+ Head head;
+ int type;
+ int status; // 鍙互琛ㄧず鏇存柊鏄惁鎴愬姛锛屼緥濡� 0 琛ㄧず澶辫触锛�1 琛ㄧず鎴愬姛
+ UpdateProductionPlanLogRes() {
+ head.type = UPDATE_PRODUCTION_PLAN_LOG_RES;
+ head.len = sizeof(UpdateProductionPlanLogRes);
+ }
+};
+
+
+
+// 鏌ヨ鐢熶骇璁″垝淇℃伅璇锋眰
+struct ProductionPlanReq {
+ Head head;
+ int type;
+ int len;
+ char productionDate[32];
+ int productionQuantity;
+ int plannedProductionQuantity;
+ int predictedProductionQuantity;
+ char logText[256];
+ ProductionPlanReq() {
+ head.type = PRODUCTION_PLAN_REQ;
+ head.len = sizeof(ProductionPlanReq);
+ }
+};
+// 鏌ヨ鐢熶骇璁″垝淇℃伅鐨勫搷搴旂粨鏋勪綋
+struct ProductionPlanRes {
+ Head head;
+ int type;
+ int len;
+ int productionQuantity;
+ int plannedProductionQuantity;
+ int predictedProductionQuantity;
+ int roleId;
+ char productionDate[32];
+ char logText[256];
+ ProductionPlanRes() {
+ head.type = PRODUCTION_PLAN_REQ;
+ head.len = sizeof(ProductionPlanRes);
+ }
+};
+
+
+
+//鏌ヨ杩戝崄鍥涙潯鐨勮姹傜粨鏋勪綋
+struct RecentFourteenProductionPlansReq {
+ Head head;
+ int requestType;
+ RecentFourteenProductionPlansReq() {
+ head.type = RECENTFOURTEENPRODUCTIONPLANS_REQ;
+ head.len = sizeof(RecentFourteenProductionPlansReq);
+ }
+};
+//鏌ヨ杩戝崄鍥涙潯鐨勫搷搴旂粨鏋勪綋
+struct RecentFourteenProductionPlansRes {
+ Head head;
+ int responseType;
+ int responseLength;
+ int productionQuantities[14];
+ int plannedProductionQuantities[14];
+ int predictedProductionQuantities[14];
+ int roleIds[14];
+ char productionDates[14][32];
+ char logTexts[14][256];
+ RecentFourteenProductionPlansRes() {
+ head.type = UPDATE_PRODUCTION_PLAN_QUANTITY_REQ;
+ head.len = sizeof(RecentFourteenProductionPlansRes);
+ }
+};
+
+
+
+//鍘嗗彶鏌ヨ鍒嗘瀽
+// 鍘嗗彶鏌ヨ璇锋眰缁撴瀯浣�
+struct HistoryQueryReq {
+ Head head;
+ //鏍规嵁鏃堕棿鑼冨洿鏌ヨ
+ char start_time[32];
+ char end_time[32];
+
+ HistoryQueryReq() {
+ // 鍒濆鍖栨暟鎹ご
+ head.type = HISTORY_QUERY_REQ;
+ head.len = sizeof(HistoryQueryReq);
+ // 鍒濆鍖栨煡璇㈡潯浠跺瓧娈�
+ std::memset(start_time, 0, sizeof(start_time));
+ std::memset(end_time, 0, sizeof(end_time));
+ }
+};
+
+// 绯荤粺杩愯鐘舵�佽〃鐩稿叧淇℃伅
+struct Histroy_Info{
+ int sysId; // 瀵瑰簲绯荤粺杩愯鐘舵�佽〃鐨勮褰曠紪鍙�
+ char sysDataCollectionTime[50]; // 鏁版嵁閲囬泦鏃堕棿
+ char sysDeviceType[50]; // 璁惧绫诲瀷
+ char sysDeviceId[50]; // 璁惧缂栧彿
+ char sysDeviceStatus[50]; // 璁惧鐘舵��
+ char sysSystemStatus[50]; // 绯荤粺鏁翠綋杩愯鐘舵�佹弿杩�
+
+ int devId; // 瀵瑰簲璁惧璇︾粏淇℃伅琛ㄧ殑璁板綍缂栧彿
+ char devDeviceType[50]; // 璁惧绫诲瀷锛堜笌绯荤粺杩愯鐘舵�佽〃涓殑璁惧绫诲瀷瀵瑰簲锛屽彲鐢ㄤ簬鍏宠仈锛�
+ char devDeviceId[50]; // 璁惧缂栧彿锛堜笌绯荤粺杩愯鐘舵�佽〃涓殑璁惧缂栧彿瀵瑰簲锛屽彲鐢ㄤ簬鍏宠仈锛�
+ char devModel[50]; // 璁惧鍨嬪彿
+ char runDeviceStatus[50]; // 璁惧鐘舵��
+ char runFaultAlarmTime[50]; // 鏁呴殰鎶ヨ鏃堕棿
+ char runFaultDescription[50]; // 鏁呴殰璇︾粏鎻忚堪
+
+ int safetyId; // 瀵瑰簲璁惧瀹夊叏鐘舵�佽〃鐨勮褰曠紪鍙�
+ char safetyDataCollectionTime[50]; // 鏁版嵁閲囬泦鏃堕棿锛堝彲鐢ㄤ簬鍏宠仈涓嶅悓琛ㄥ湪鍚屼竴鏃堕棿鐐圭殑鏁版嵁鎯呭喌锛�
+ char safetyDeviceType[50]; // 璁惧绫诲瀷锛堢敤浜庡叧鑱旓級
+ char safetyDeviceId[50]; // 璁惧缂栧彿锛堢敤浜庡叧鑱旓級
+ char safetyStatus[50]; // 璁惧瀹夊叏鐘舵��
+ char safetyParameter[50]; // 瀹夊叏鍙傛暟
+};
+// 鍘嗗彶鏌ヨ鍝嶅簲缁撴瀯浣�
+// 瀹夊叏鐘舵�佽〃鐩稿叧淇℃伅
+struct HistoryQueryRes {
+ Head head;
+ Histroy_Info sys[0];
+
+ HistoryQueryRes() {
+ // 鍒濆鍖栨暟鎹ご
+ head.type = HISTORY_QUERY_RES;
+ head.len = sizeof(HistoryQueryRes);
+ }
+
+};
+
+//鑷姩鍗囩骇
+struct VersionNumReq // 鐗堟湰鍙疯姹�
+{
+ Head head;
+ VersionNumReq() {
+ head.type = VERSIONNUM_REQ;
+ head.len = sizeof(VersionNumReq);
+ }
+};
+
+struct VersionNumRes // 鐗堟湰鍙峰搷搴�
+{
+ Head head;
+ char version_id[64]; // 鐗堟湰鍙�
+ VersionNumRes() {
+ head.type = VERSIONNUM_RES;
+ head.len = sizeof(VersionNumRes);
+ }
+};
+
+// 鏂囦欢浼犺緭
+struct FileInfo
+{
+ char file_name[256];
+ long long file_size;
+ char s_filepath[128];
+ char content[0];
+};
+
+struct UploadFileReq // 涓婁紶鏂囦欢鐨勮姹�
+{
+ Head head;
+ FileInfo fileInfo;
+ UploadFileReq() {
+ head.type = UPLOAD_FILE_REQ;
+ head.len = sizeof(UploadFileReq);
+ }
+};
+
+struct UploadFileRes { // 涓婁紶鏂囦欢鐨勫搷搴�
+ Head head;
+ bool state = false;
+ char file_name[256];
+ long long file_size;
+ UploadFileRes()
+ {
+ head.type = UPLOAD_FILE_RES;
+ head.len = sizeof(UploadFileRes);
+ }
+};
+
+// 鐗堟湰淇℃伅褰曞叆
+// 璇锋眰
+struct VersionInfoEntryReq {
+ Head head;
+ char version_id[64]; // 鐗堟湰鍙�
+ char version_id_old[64]; // 涓婁竴涓増鏈彿
+ char s_filepath[16][128]; //鏈嶅姟鍣ㄦ斁鏈�鏂扮増鏈殑璺緞
+ char version_description[256]; //鏇存柊鍐呭
+ char version_creattime[32]; // 鏇存柊鏃堕棿
+ char filename[16][128];
+ long long filesize[16];
+ char c_filepath[16][128];
+ int fileNum;
+
+ VersionInfoEntryReq()
+ {
+ head.type = VERSIONINFOENTRY_REQ;
+ head.len = sizeof(VersionInfoEntryReq);
+ }
+};
+
+// 鐗堟湰淇℃伅褰曞叆鍝嶅簲
+struct VersionInfoEntryRes {
+ Head head;
+ bool state = false;
+ VersionInfoEntryRes()
+ {
+ head.type = VERSIONINFOENTRY_RES;
+ head.len = sizeof(VersionInfoEntryRes);
+ }
+};
+
+// 鐗堟湰鏇存柊璇锋眰
+struct VersionUpdateReq {
+ Head head;
+
+ char cur_version_id[64]; // 鐗堟湰鍙�
+ VersionUpdateReq()
+ {
+ head.type = VERSIONUPDATE_REQ;
+ head.len = sizeof(VersionUpdateReq);
+ }
+};
+
+// 鐗堟湰鏇存柊鍝嶅簲
+struct VersionUpdateRes {
+ Head head;
+ bool state = false;
+ char version_id[64]; // 鐗堟湰鍙�
+ char update_date[32]; // 鏇存柊鏃堕棿
+ char version_description[1024]; //鏇存柊鎻忚堪
+
+ VersionUpdateRes()
+ {
+ head.type = VERSIONUPDATE_RES;
+ head.len = sizeof(VersionUpdateRes);
+ }
+};
+
+// 鐗堟湰鏇存柊鏂囦欢涓嬭浇璇锋眰
+struct FileDownloadsReq {
+ Head head;
+ char version_id[64]; // 鐗堟湰鍙�
+ FileDownloadsReq()
+ {
+ head.type = FILEDOWNLOADS_REQ;
+ head.len = sizeof(FileDownloadsReq);
+ }
+};
+
+// 鐗堟湰鏇存柊鏂囦欢涓嬭浇鍝嶅簲
+struct FileDownloadsRes {
+ Head head;
+ char version_id[64]; // 鐗堟湰鍙�
+ char filename[128]; //鏂囦欢鍚�
+ long long filesize; //鏂囦欢澶у皬
+ char c_filepath[128]; //瀹㈡埛绔斁鏈�鏂扮増鏈殑鏈湴璺緞
+ int fileNum; // 鏂囦欢鏁伴噺
+ long long all_fileSize; // 鏂囦欢鎬诲ぇ灏�
+ char content[0];
+ FileDownloadsRes()
+ {
+ head.type = FILEDOWNLOADS_RES;
+ head.len = sizeof(FileDownloadsRes);
+ }
+};
+
+// 鏇存柊鏂囦欢涓嬭浇鎴愬姛鐨勫搷搴�
+struct DownloadSuccessfullyRes{
+ Head head;
+ bool state = false;
+ char file_name[256];
+ long long file_size;
+ DownloadSuccessfullyRes()
+ {
+ head.type = DOWNLOADSUCCESSFULLY_RES;
+ head.len = sizeof(DownloadSuccessfullyRes);
+ }
+};
+
+//鏃ュ織
+struct ParsedLog {
+ char timestamp[64]; // 鏃堕棿鎴�
+ char device_id[64]; // 璁惧ID
+ char level[16]; 聽 聽 // 鏃ュ織绾у埆
+ char content[256]; 聽// 鏃ュ織鍐呭
+ char source[64]; 聽 聽// 鏉ユ簮妯″潡
+ char user_id[64]; 聽 // 鐢ㄦ埛ID
+};
+
+// 鏃ュ織鏌ヨ璇锋眰缁撴瀯浣�
+struct LogQueryReq {
+ Head head; // 鏁版嵁澶�
+ char keyWords[32]; // 瀛樺偍鍏抽敭瀛楃殑鏁扮粍
+ // 鏃犲弬鏋勯�犲嚱鏁�
+ LogQueryReq() {
+ head.type = LOGSEARCH_REQ;
+ head.len = sizeof(LogQueryReq);
+ }
+};
+
+// 鏃ュ織鏌ヨ鍝嶅簲缁撴瀯浣�
+struct LogQueryRes {
+ Head head;
+ int status; // 鍝嶅簲鐘舵�� (濡� 0 琛ㄧず鎴愬姛锛岄潪 0 琛ㄧず澶辫触)
+ char errorMessage[256]; // 閿欒淇℃伅锛堝鏋滄湁锛�
+
+ // 鏃犲弬鏋勯�犲嚱鏁�
+ LogQueryRes() {
+ head.type = LOGSEARCH_RES;
+ head.len = sizeof(LogQueryRes);
+ }
+};
+
+
+
+
+#endif // COMMON_H
\ No newline at end of file
--
Gitblit v1.8.0