240717班级,工业化控制系统,煤矿相关行业,昆仑系统
lzh
2024-11-01 74a7faf2cbde2efdc02df4f96cf4e15a33b5750c
Client/½ª¿É¸ý/code/2024kunlun_project_permisson/PmsClientSocket.h
New file
@@ -0,0 +1,122 @@
#ifndef PMSCLINETSOCKET_H
#define PMSCLINETSOCKET_H
#include <QTcpSocket>
#include <string>
#include "pmsqueryresult.h"
#include <vector>
#include "pmsplusparam.h"
#include <QDebug>
#include <QWidget>
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;
        memset(userNo,0,32);
        memset(permissonType,0,32);
        memset(name,0,32);
        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[100];
    char pmsList[0];
    UserAboutPmsResponse(){
        head.type=QUERY_PMS_RES;
//        memset(pmsList,0,sizeof(PmsRes));
//        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 QWidget
{
    Q_OBJECT
    QTcpSocket *client;
    int port=88888;
    QString targetIp = "127.0.0.1";
    bool connectSuccess= false;
public:
    PmsClientSocket(QWidget * 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