#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
|