240717班级,工业化控制系统,煤矿相关行业,昆仑系统
jiangkegeng
2024-10-31 db20118e0d507c8cc67fd9537ed5486c963cd853
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#ifndef PMSCLINETSOCKET_H
#define PMSCLINETSOCKET_H
#include <QTcpSocket>
#include <string>
#include "pmsqueryresult.h"
#include <vector>
#include "pmsplusparam.h"
#include <QDebug>
 
using namespace std;
 
struct Head{
    int type;
    int len;
};
 
enum option{
    QUERY_PMS_REQ,
    UPDATE_PMS_REQ,
    QUERY_PMS_RES,
    UPDATE_PMS_RES,
};
 
 
// 按员工编号、名字或职位查询人员权限信息请求
typedef struct QueryPmsRequest{
    Head head;
    char userNo[32];
    char name[32];
    char permissonType[32];
    QueryPmsRequest(){
        head.type=QUERY_PMS_REQ;
        userNo[32] = {0};
        name[32] = {0};
        permissonType[32] = {0};
        head.len = sizeof(QueryPmsRequest);
    }
} QueryPmsRequest;
 
// 按角色id更新权限信息请求
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 UserAboutPms{
 
    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 UserAboutPmsResponse{
    Head head;
    int success; // 1为成功 ,0为失败
    PmsRes  *pmsList;
    UserAboutPmsResponse(){
        head.type=QUERY_PMS_RES;
        pmsList = (PmsRes *)malloc(sizeof(PmsRes)*100);
        pmsList = {0};
        head.len = sizeof(UserAboutPmsResponse);
    }
} QueryPmsResponse;
 
// 权限更新结果响应体
typedef struct UpdatePmsResponse{
    Head head;
    int success; // 1为成功 ,0为失败
    UpdatePmsResponse(){
        head.type = UPDATE_PMS_RES;
        head.len = sizeof(UpdatePmsResponse);
    }
 
} UpdatePmsResponse ;
 
 
class PmsClientSocket : public QObject
{
    Q_OBJECT
 
    QTcpSocket *client;
 
    int port=88888;
    QString targetIp = "127.0.0.1";
 
    bool connectSuccess= false;
 
public:
    PmsClientSocket(QObject * parent=0);
    void queryAllUserAboutUser();
 
    void queryPmsByParam(PmsParam param);
 
    void updatePmsByParam(PmsPlusParma param);
signals:
    void notifyDateChange(vector<PmsQueryResult>);
 
private slots:
    void connected_Slot();    //声明槽函数
    void readyRead_Slot();
};
 
#endif // PMSCLINETSOCKET_H