Commit edc9a098 by wuyang.zou

First Init Pms Plugin Branch;

parent 6d726341
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "Network/billSocket.h" #include "Network/billSocket.h"
#include "Model/orderObject.h" #include "Model/orderObject.h"
#include "Model/dishesObject.h" #include "Model/dishesObject.h"
#include "LocalServer/loaclHttpServer.h" #include "LocalServer/localHttpServer.h"
#include "alertForm.h" #include "alertForm.h"
#include <QMap> #include <QMap>
#include <JQHttpServer.h> #include <JQHttpServer.h>
...@@ -91,8 +91,9 @@ private: ...@@ -91,8 +91,9 @@ private:
private: private:
// 门店信息 // 门店信息
QString m_storeId; QString m_storeId;
QString m_ipAddress; // 门店POS的 IP 地址 QString m_ipAddress = ""; // 门店POS的 IP 地址
QString m_ipPortAddress; // 门店POS的 IP+端口 地址 QString m_ipPortAddress; // 门店POS的 IP+端口 地址
QString m_pmsMachineNo; // 标志PMS 系统插件程序所在机器编号
QString m_password; QString m_password;
QString m_puginVersionComments; QString m_puginVersionComments;
QString m_posId; QString m_posId;
...@@ -129,8 +130,9 @@ private: ...@@ -129,8 +130,9 @@ private:
// 标记目前悬浮框是否 锁住状态[false:悬浮框解锁状态; true:悬浮框锁住状态]; // 标记目前悬浮框是否 锁住状态[false:悬浮框解锁状态; true:悬浮框锁住状态];
bool m_bFloatFromLockSt; bool m_bFloatFromLockSt;
// HttpServer // HttpServer
//JQHttpServer::TcpServerManage* m_tcpServerManage; // JQHttpServer::TcpServerManage* m_tcpServerManage;
LoaclHttpServer* loaclHttpServer; LocalHttpServer* localHttpServer;
// QtRedis Operat Process
QMap<QString, QMultiMap<QString, dishesObject> >m_dishesMap; QMap<QString, QMultiMap<QString, dishesObject> >m_dishesMap;
//等待Simphony拉取的有效订单队列list[orderId] //等待Simphony拉取的有效订单队列list[orderId]
...@@ -153,10 +155,12 @@ private: ...@@ -153,10 +155,12 @@ private:
bool m_initSimProcOrderDBRet; bool m_initSimProcOrderDBRet;
bool m_initPrintSumBillPosDBRet; bool m_initPrintSumBillPosDBRet;
bool m_initGetAuthPosDBRet; bool m_initGetAuthPosDBRet;
bool m_initPmsGetStoreConfigDBRet;
bool m_initPmsOrdersDataRet;
signals: signals:
// 发送信号给自己 做登陆 // 发送信号给自己 做登陆
void doLogin(); // void doLogin();
/* 功能:隐藏通知窗口 /* 功能:隐藏通知窗口
* 参数:NULL * 参数:NULL
...@@ -270,8 +274,22 @@ signals: ...@@ -270,8 +274,22 @@ signals:
void doRefundOrder(const QString& orderId, int reasonCode, const QString &reason, const QString & dishesListString); void doRefundOrder(const QString& orderId, int reasonCode, const QString &reason, const QString & dishesListString);
void doStartOperateTimer(); void doStartOperateTimer();
private slots: public slots:
void _TestRedis();
void _TestInsertOrderData();
bool _AppendOrderInfo2Redis(const OrderObject* orderObject);
bool _GetStoreInfo(); bool _GetStoreInfo();
/* 功能:登录前初始化数据;
* 参数:NULL
* 返回:NULL
* */
void _InitDataBeforeLogin();
/* 功能:登录 /* 功能:登录
* 参数:NULL * 参数:NULL
* 返回:是否成功 * 返回:是否成功
...@@ -326,7 +344,15 @@ private slots: ...@@ -326,7 +344,15 @@ private slots:
* 参数:NULL * 参数:NULL
* 返回:是否成功 * 返回:是否成功
* */ * */
bool _RefundOrder(const QString& orderId, int reasonCode, const QString &reason,const QString& dishesListString); bool _RefundOrder(const QString& orderId, int reasonCode, const QString &reason,
const QString& dishesListString);
/* 功能:更新数据库中订单状态后且 push Redis 成功后添加汇报list;
* 参数:[1] 订单对象指针;
* 返回:NULL
* */
void _AddOrderInfo2ReportList(const OrderObject* orderObject,const QString& operatStatus,
const QString& remarkMessage);
/* 功能:定时触发向OMS 汇报本地POS订单的入机情况; /* 功能:定时触发向OMS 汇报本地POS订单的入机情况;
* 参数:NULL * 参数:NULL
...@@ -343,7 +369,6 @@ private slots: ...@@ -343,7 +369,6 @@ private slots:
* 参数:NULL * 参数:NULL
* 返回:Json对象 * 返回:Json对象
* */ * */
//QJsonObject _PackHttpReplyJson(const int status, const QString& msg, const QJsonObject& data, const int &iscontinue);
/** /**
*功能:定时清空订单Map里两天前的订单 *功能:定时清空订单Map里两天前的订单
*参数:无 *参数:无
...@@ -545,6 +570,13 @@ public slots: ...@@ -545,6 +570,13 @@ public slots:
*参数:1、请求json参数;2、返回错误信息; *参数:1、请求json参数;2、返回错误信息;
*返回:是否登陆成功; *返回:是否登陆成功;
**/ **/
bool _PmsMachineReqTryLogin();
/**
*功能:FM外卖插件响应Simphony请求时,如果外卖插件未登录则进行登陆;
*参数:1、请求json参数;2、返回错误信息;
*返回:是否登陆成功;
**/
bool _ResponseSimReqTryLogin(const QJsonObject &content, QString &error); bool _ResponseSimReqTryLogin(const QJsonObject &content, QString &error);
/** /**
......
...@@ -43,7 +43,8 @@ void DataManger::SetPartnerId(const QString &partnerId) ...@@ -43,7 +43,8 @@ void DataManger::SetPartnerId(const QString &partnerId)
} }
QJsonObject DataManger::GetLoginData(const QString &partnerId, const QString &storeId, const QString &password, QJsonObject DataManger::GetLoginData(const QString &partnerId, const QString &storeId, const QString &password,
const QString &stationId, const QString &cashierId, const QString &ipAddress) const QString &stationId, const QString &cashierId, const QString &ipAddress
,const QString &pmsMachineNo)
{ {
QJsonObject rObj; QJsonObject rObj;
Q_UNUSED(cashierId); Q_UNUSED(cashierId);
...@@ -52,6 +53,7 @@ QJsonObject DataManger::GetLoginData(const QString &partnerId, const QString &st ...@@ -52,6 +53,7 @@ QJsonObject DataManger::GetLoginData(const QString &partnerId, const QString &st
rObj.insert(JSON_ORGCODE, storeId); rObj.insert(JSON_ORGCODE, storeId);
rObj.insert(JSON_PASSWORD, password); rObj.insert(JSON_PASSWORD, password);
rObj.insert(JSON_MACHINECODE, stationId); rObj.insert(JSON_MACHINECODE, stationId);
rObj.insert(JSON_PMSMACHINENO, pmsMachineNo);
//rObj.insert(JSON_USERID, cashierId); //rObj.insert(JSON_USERID, cashierId);
return rObj; return rObj;
} }
......
...@@ -37,7 +37,8 @@ public: ...@@ -37,7 +37,8 @@ public:
* 返回:登录数据 * 返回:登录数据
* */ * */
QJsonObject GetLoginData(const QString& partnerId,const QString& storeId, const QString& password, QJsonObject GetLoginData(const QString& partnerId,const QString& storeId, const QString& password,
const QString& stationId, const QString& cashierId,const QString& ipAddress); const QString& stationId, const QString& cashierId,
const QString& ipAddress,const QString& pmsMachineNo);
/* 功能:获取心跳数据 /* 功能:获取心跳数据
* 参数:[1]门店号[2]密码[3]收银机号[4]收银员号 * 参数:[1]门店号[2]密码[3]收银机号[4]收银员号
* 返回:登录数据 * 返回:登录数据
...@@ -78,7 +79,9 @@ public: ...@@ -78,7 +79,9 @@ public:
* 参数:[1]时间戳 * 参数:[1]时间戳
* 返回:登录数据 * 返回:登录数据
* */ * */
QJsonObject GetRefundOrderData(int reasonCode, const QString& reason, const QString& orderId, const QString &channel,const QString& dishesListString,const QString& cashierId,const QString& cashierName); QJsonObject GetRefundOrderData(int reasonCode, const QString& reason, const QString& orderId,
const QString &channel,const QString& dishesListString,
const QString& cashierId,const QString& cashierName);
/* 功能:获取拒绝退单数据 /* 功能:获取拒绝退单数据
* 参数:[1]时间戳 * 参数:[1]时间戳
* 返回:登录数据 * 返回:登录数据
......
#include "pmsGetStoreConfig.h"
#include "QsLog.h"
PmsGetStoreConfig::PmsGetStoreConfig()
{
QLOG_INFO()<<"[<<<<---PmsGetStoreConfig:: ConStructure PMS Get Store Config DataBase--->>>>]";
}
bool PmsGetStoreConfig::initPmsStoreConfigDB() {
bool bRet = false;
m_sqlDb = QSqlDatabase::addDatabase("QMYSQL","PmsGetStoreConfig"); //数据库驱动类型为Mysql
if(m_sqlDb.isValid()){
QLOG_INFO()<<"[<<<<---PmsGetStoreConfig driver is valid--->>>>]";
m_sqlDb.setHostName("192.168.99.100"); //连接数据库主机名,这里需要注意(若填的为”127.0.0.1“,出现不能连接,则改为localhost)
//m_sqlDb.setHostName("localhost"); // 本地测试;
m_sqlDb.setPort(3306); //连接数据库端口号,与设置一致
m_sqlDb.setDatabaseName("pms"); //连接数据库名,与设置一致
m_sqlDb.setUserName("oms"); //数据库用户名,与设置一致
m_sqlDb.setPassword("starbucks@oms");
if(!m_sqlDb.open()) { //打开数据库
QLOG_ERROR()<<"[<<<<---PmsGetStoreConfig Open Database error:--->>>>]"<<m_sqlDb.lastError().text();
} else {
QLOG_INFO()<<"[<<<<---PmsGetStoreConfig Test Open database success!:--->>>>]";
bRet = true;
m_sqlDb.close();
}
} else {
QLOG_ERROR()<<"[<<<<---PmsGetStoreConfig driver no valid--->>>>]";
}
return bRet;
}
PmsGetStoreConfig &PmsGetStoreConfig::getInstance() {
static PmsGetStoreConfig pmsGetStoreConfig;
return pmsGetStoreConfig;
}
bool PmsGetStoreConfig::GetStoreConfig(QString& storeId, QString& posId,
QString& cashierId,QString& cashierName,
QString& pmsMachineNo) {
QMutexLocker mutex(&m_mutex);
int bSelectRetNum = 0;
if(!m_sqlDb.open()) {
QLOG_ERROR()<<"[<<<<---PmsGetStoreConfig::GetStoreConfig Database:Open Failed--->>>>]"<<m_sqlDb.lastError().text();
}else {
QSqlQuery query(m_sqlDb);
//读取门店编号;
query.prepare(QString("select value from store_param where name = 'store_id' "));
if(!query.exec()) {
QLOG_ERROR()<<"[<<<<---PmsGetStoreConfig::Get store_id Select Failed--->>>>]"<<query.lastError().text();
}else if (query.first()) {
storeId = query.value(0).toString();
bSelectRetNum++;
}
//读取PMS 插件编号;
query.prepare(QString("select value from store_param where name = 'pms_plugin_no' "));
if(!query.exec()) {
QLOG_ERROR()<<"[<<<<---PmsGetStoreConfig::Get pms_plugin_no Select Failed--->>>>]"<<query.lastError().text();
}else if (query.first()) {
posId = query.value(0).toString();
bSelectRetNum++;
}
//读取PMS 收银员ID;
query.prepare(QString("select value from store_param where name = 'casher_id' "));
if(!query.exec()) {
QLOG_ERROR()<<"[<<<<---PmsGetStoreConfig::Get casher_id Select Failed--->>>>]"<<query.lastError().text();
} else if (query.first()) {
cashierId = query.value(0).toString();
bSelectRetNum++;
}
//读取PMS 收银员名字;
query.prepare(QString("select value from store_param where name = 'cashier_name' "));
if(!query.exec()) {
QLOG_ERROR()<<"[<<<<---PmsGetStoreConfig::Get cashier_name Select Failed--->>>>]"<<query.lastError().text();
} else if (query.first()) {
cashierName = query.value(0).toString();
bSelectRetNum++;
}
//读取PMS 机器编号;
query.prepare(QString("select value from store_param where name = 'pms_id' "));
if(!query.exec()) {
QLOG_ERROR()<<"[<<<<---PmsGetStoreConfig::Get pms_id Select Failed--->>>>]"<<query.lastError().text();
}else if (query.first()) {
pmsMachineNo = query.value(0).toString();
bSelectRetNum++;
}
QLOG_INFO()<<QString("[<<<<---PmsGetStoreConfig::GetStoreConfig storeId:%1,posId:%2,cashierId:%3,"
"cashierName:%4,pmsMachineNo:%5--->>>>]").arg(storeId).arg(posId)
.arg(cashierId).arg(cashierName).arg(pmsMachineNo);
m_sqlDb.close();
}
//判断上面 5 个配置数据是否查询成功;
if (5 == bSelectRetNum) {
return true;
} else {
return false;
}
}
#ifndef PMSGETSTORECONFIG_H
#define PMSGETSTORECONFIG_H
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlError>
#include <QObject>
#include <QMutex>
class PmsGetStoreConfig : public QObject
{
Q_OBJECT
public:
// explicit PmsGetStoreConfig(QObject *parent = 0);
static PmsGetStoreConfig& getInstance();
/**
*功能:初始化 Mysql 门店基本配置 数据库;方便后期判断 打开 Mysql 数据库是否成功;
*参数:[无]
*返回:true:能够成功打开数据库,false:不能够成功打开数据库
**/
bool initPmsStoreConfigDB();
/**
*功能:获取 Mysql 数据库中 门店配置信息;
*参数:[1]当前店员 操作员ID
*返回:true:获取门店配置数据成功,false:获取门店配置数据失败;
**/
bool GetStoreConfig(QString& storeId, QString& posId,
QString& cashierId,QString& cashierName,
QString& pmsMachineNo);
private:
QMutex m_mutex;
PmsGetStoreConfig();
PmsGetStoreConfig(PmsGetStoreConfig const&);
PmsGetStoreConfig& operator=(PmsGetStoreConfig const&);
QSqlDatabase m_sqlDb;
signals:
public slots:
};
#endif // PMSGETSTORECONFIG_H
#ifndef PMSORDERSDATA_H
#define PMSORDERSDATA_H
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlError>
#include <QObject>
#include <QMutex>
#include <Model/orderObject.h>
#include "preDefine.h"
class PmsOrdersData : public QObject
{
Q_OBJECT
public:
// explicit PmsOrdersData(QObject *parent = 0);
static PmsOrdersData& getInstance();
/**
*功能:初始化数据库;方便后期判断 打开数据库是否成功;
*参数:[无]
*返回:true:能够成功打开数据库,false:不能够成功打开数据库
**/
bool initPmsOrdersData();
/**
*功能:插入一条汇总单信息到PMS数据库中;
*参数:[1]订单对象指针 [2]返回插入成功后的自增序号;
*返回:true操作成功,false失败
**/
bool insertOrderData(OrderObject* orderObj, QString& pmsOrderRef);
/**
*功能:删除PMS数据库中的指定订单状态的订单数据;
*参数:[1]订单对象指针;
*返回:true操作成功,false失败
**/
bool deleteOrderData(OrderObject* orderObj);
/**
*功能:插入订单主商品列表信息到PMS数据库中;
*参数:[1]订单对象指针 [2]返回插入成功后的自增序号;
*返回:true操作成功,false失败
**/
bool insertProductData(const QList<dishesObject*> proList, const QString& OrderId, QString& ProInIdRef);
/**
*功能:删除PMS数据库中的指定订单状态的商品数据;
*参数:[1]订单对象指针;
*返回:true操作成功,false失败
**/
bool deleteProductData(OrderObject* orderObj);
/**
*功能:插入主商品的配料信息列表到PMS数据库中;
*参数:[1]订单对象指针 [2]返回插入成功后的自增序号;
*返回:true操作成功,false失败
**/
bool insertSubProductData(const QList<dishesObject*> sub_products, const QString& ProInIdRef, QString& SubProInIdRef);
/**
*功能: 根据订单ID 更新 数据库中 Order 订单状态信息;
*参数:[1]订单对象
*返回:true操作成功,false失败
**/
bool updateOrderStatus(OrderObject* orderObj, const int &OrderStatus);
/**
*功能:查询 订单号和 订单状态 是否存在PMS数据库中;
*参数:[1]订单号 [2]订单状态
*返回:true是,false否
**/
bool isOrderAndStatusExist(const QString& orderId, const int &OrderStatus);
/**
*功能:查询订单是否存在PMS数据库;
*参数:[1]订单号
*返回:true是,false否
**/
bool isOrderExist(const QString& orderId);
bool queryValue(const QString& orderId, const QString& key, QString& error, QVariant &value);
private:
QMutex m_mutex;
PmsOrdersData();
PmsOrdersData(PmsOrdersData const&);
PmsOrdersData& operator=(PmsOrdersData const&);
QSqlDatabase m_sqlDb;
signals:
public slots:
};
#endif // PMSORDERSDATA_H
#include "qtRedisClient.h"
#include "QsLog.h"
QtRedisClient::QtRedisClient()
{
QLOG_INFO()<<"[<<<<---QtRedisClient:: ConStructure Redis Begin --->>>>]";
initRedisClient();
m_RedisConnectCnf.setHost("192.168.99.100");
//m_RedisConnectCnf.setHost("127.0.0.1"); //本地测试;
m_RedisConnectCnf.setPort(6379);
//m_RedisConnectCnf.setAuth("123456"); //本地测试;
m_pRedisConnectOperat = new RedisClient::Connection(m_RedisConnectCnf);
if (!m_pRedisConnectOperat){
QLOG_INFO()<<"[<<<<---QtRedisClient:: ConStructure QtRedisClient m_pRedisConnectOperat Failed--->>>>]";
}
}
QtRedisClient &QtRedisClient::getInstance()
{
static QtRedisClient qtRedisClient;
return qtRedisClient;
}
bool QtRedisClient::initQtRedisClient(){
bool initRedisRet = false;
if(!m_pRedisConnectOperat){
QLOG_ERROR()<<"[<<<<---QtRedisClient::initQtRedisClient m_pRedisConnectOperat is NULL--->>>>]";
return initRedisRet;
}
QList<QByteArray> cmdInfoAllTest;
cmdInfoAllTest.append("INFO");
cmdInfoAllTest.append("ALL");
try {
m_pRedisConnectOperat->connect();
auto result = m_pRedisConnectOperat->commandSync(cmdInfoAllTest);
QVariant val = result.value();
QLOG_INFO() << RedisClient::Response::valueToHumanReadString(val);
//m_pRedisConnectOperat->disconnect(); //避免频繁重复操作,故不 disconnect;
initRedisRet = true;
} catch (const RedisClient::Connection::Exception& e) {
QLOG_ERROR() << "QtRedisClient::initQtRedisClient Cannot run command:" << e.what();
}
QLOG_INFO()<<"[<<<<---QtRedisClient::initQtRedisClient initRedisRet:--->>>>]"<< initRedisRet;
return initRedisRet;
}
bool QtRedisClient::testOrderRedisExist(const QString& orderId){
bool bOrderExist = false;
QList<QByteArray> cmdString;
cmdString.append("GET");
cmdString.append("ZWY");
try {
auto result = m_pRedisConnectOperat->commandSync(cmdString);
QVariant val = result.value();
Q_UNUSED(orderId);
if(val.toString().length()){
QLOG_INFO() << QString("[<<<<---QtRedisClient::isOrderRedisExist orderId:%1 Exist ; value:%2:--->>>>]").arg(orderId).arg(val.toString());
}else{
QLOG_ERROR() << QString("[<<<<---QtRedisClient::isOrderRedisExist orderId:%1 Not Exist ; value:%2:--->>>>]").arg(orderId).arg(val.toString());
}
bOrderExist = true;
} catch (const RedisClient::Connection::Exception& e) {
QLOG_ERROR() << "QtRedisClient::isOrderRedisExist Cannot run command:" << e.what();
}
return bOrderExist;
}
bool QtRedisClient::pushOrder2Redis(const QString& orderId,const int& orderStatus){
bool bPushOrderSuc = false;
QList<QByteArray> cmdString;
cmdString.append("LPUSH");
cmdString.append("PmsOrderStatusNotifyList");
QJsonObject orderStatusObj;
orderStatusObj.insert("ID",orderId);
orderStatusObj.insert("STATUS",orderStatus);
QJsonDocument orderStatusDoc = QJsonDocument(orderStatusObj);
cmdString.append(orderStatusDoc.toJson());
try {
auto result = m_pRedisConnectOperat->commandSync(cmdString);
QVariant val = result.value();
if(val.toInt()) {
QLOG_INFO() << QString("[<<<<---QtRedisClient::pushOrder2Redis orderId:%1 ; orderStatus:%2 ; ret:%3 Success--->>>>]").arg(orderId).arg(orderStatus).arg(val.toString());
bPushOrderSuc = true;
} else {
QLOG_ERROR() << QString("[<<<<---QtRedisClient::pushOrder2Redis orderId:%1 ; orderStatus:%2 ; val:%3 Failed--->>>>]").arg(orderId).arg(orderStatus).arg(val.toString());
}
} catch (const RedisClient::Connection::Exception& e) {
QLOG_ERROR() << "QtRedisClient::isOrderRedisExist Cannot run command:" << e.what();
}
return bPushOrderSuc;
}
/******************
*进行 Redis 操作 [单例]
******************/
#ifndef QTREDISCLIENT_H
#define QTREDISCLIENT_H
#include "qredisclient/redisclient.h"
#include <QCommandLineParser>
#include <QJsonDocument>
class QtRedisClient : public QObject
{
Q_OBJECT
public:
static QtRedisClient& getInstance();
/**
*功能:初始化 Redis;方便后期判断 redis 连接是否成功;
*参数:[无]
*返回:true:能够成功连接,false:连接失败
**/
bool initQtRedisClient();
/**
*功能:向 Redis 中push订单及订单状态信息;
*参数:[1]订单号; [2]订单状态;
*返回:true:追加成功,false:追加失败
**/
bool pushOrder2Redis(const QString& orderId, const int& orderStatus);
/**
*功能:查询订单是否已经存在 Redis中;
*参数:[1]订单号
*返回:true是,false否
**/
bool testOrderRedisExist(const QString& orderId);
private:
QMutex m_mutex;
QtRedisClient();
QtRedisClient(QtRedisClient const&);
QtRedisClient& operator=(QtRedisClient const&);
RedisClient::ConnectionConfig m_RedisConnectCnf;
RedisClient::Connection* m_pRedisConnectOperat = nullptr;
signals:
public slots:
};
#endif // QTREDISCLIENT_H
...@@ -16,23 +16,31 @@ bool SimProcOrderDB::initSimProcOrderDB(){ ...@@ -16,23 +16,31 @@ bool SimProcOrderDB::initSimProcOrderDB(){
return false; return false;
} }
bool bRet = false; bool bRet = false;
m_sqlDb=QSqlDatabase::addDatabase("QODBC","SimProcOrderDB"); //数据库驱动类型为SQL server; m_sqlDb=QSqlDatabase::addDatabase("QMYSQL","SimProcOrderDB"); //数据库驱动类型为Mysql;
if(m_sqlDb.isValid()){ if(m_sqlDb.isValid()){
QLOG_INFO()<<"[<<<<---SimProcOrderDB::SqlServer ODBC driver is valid--->>>>]"; QLOG_INFO()<<"[<<<<---SimProcOrderDB:: driver is valid--->>>>]";
/*
QString dsn="DRIVER={SQL SERVER};SERVER=127.0.0.1\\sqlexpress;DATABASE=MMXBenefits"; QString dsn="DRIVER={SQL SERVER};SERVER=127.0.0.1\\sqlexpress;DATABASE=MMXBenefits";
// Win10不支持属性: ;Trusted_Connection=yes ; 必须取消此属性,否则 QODBC3: Unable to connnet; // Win10不支持属性: ;Trusted_Connection=yes ; 必须取消此属性,否则 QODBC3: Unable to connnet;
m_sqlDb.setDatabaseName(dsn); //设置数据源名称 m_sqlDb.setDatabaseName(dsn); //设置数据源名称
m_sqlDb.setUserName("sa"); //登录用户 m_sqlDb.setUserName("sa"); //登录用户
m_sqlDb.setPassword("SIM29@123"); m_sqlDb.setPassword("SIM29@123");
*/
m_sqlDb.setHostName("192.168.99.100"); //连接数据库主机名,这里需要注意(若填的为”127.0.0.1“,出现不能连接,则改为localhost)
m_sqlDb.setPort(3306); //连接数据库端口号,与设置一致
m_sqlDb.setDatabaseName("pms"); //连接数据库名,与设置一致
m_sqlDb.setUserName("oms"); //数据库用户名,与设置一致
m_sqlDb.setPassword("starbucks@oms"); //数据库密码,与设置一致
if(!m_sqlDb.open()) { //打开数据库 if(!m_sqlDb.open()) { //打开数据库
QLOG_ERROR()<<"[<<<<---SimProcOrderDB::SqlServer Open Database error:--->>>>]"<<m_sqlDb.lastError().text(); QLOG_ERROR()<<"[<<<<---SimProcOrderDB:: Open Database error:--->>>>]"<<m_sqlDb.lastError().text();
bRet = false; bRet = false;
} else { } else {
QLOG_INFO()<<"[<<<<---SimProcOrderDB::SqlServer Test Open database success!:--->>>>]"; QLOG_INFO()<<"[<<<<---SimProcOrderDB:: Test Open database success!:--->>>>]";
QSqlQuery query(m_sqlDb); QSqlQuery query(m_sqlDb);
QString selectsql ="select * from sys.tables where name='SimProcOrderTable'" ; QString selectsql ="select table_name from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='pms' and TABLE_NAME='SimProcOrderTable'" ;
if(!query.exec(selectsql)) { if(!query.exec(selectsql)) {
QLOG_ERROR()<<"[<<<<---SimProcOrderDB::SqlServer Database check table SimProcOrderTable command failed--->>>>]"<<query.lastError().text(); QLOG_ERROR()<<"[<<<<---SimProcOrderDB:: Database check table SimProcOrderTable command failed--->>>>]"<<query.lastError().text();
} }
if(query.next()) { if(query.next()) {
QLOG_INFO() << "[<<<<---SimProcOrderDB::Table SimProcOrderTable Has Exist--->>>>]"; QLOG_INFO() << "[<<<<---SimProcOrderDB::Table SimProcOrderTable Has Exist--->>>>]";
...@@ -49,13 +57,15 @@ bool SimProcOrderDB::initSimProcOrderDB(){ ...@@ -49,13 +57,15 @@ bool SimProcOrderDB::initSimProcOrderDB(){
bRet = true; bRet = true;
} }
} else { } else {
QLOG_ERROR()<<"[<<<<---SimProcOrderDB::SqlServer ODBC driver no valid"; QLOG_ERROR()<<"[<<<<---SimProcOrderDB:: driver no valid";
bRet = false; bRet = false;
} }
if(bRet) { if(bRet) {
/*
QLOG_INFO()<<QString::fromLocal8Bit("[<<<<---SimProcOrderDB::FM TakeOut Plugin Version:2.20193**.1 Begin Alter Column orderId--->>>>]"); QLOG_INFO()<<QString::fromLocal8Bit("[<<<<---SimProcOrderDB::FM TakeOut Plugin Version:2.20193**.1 Begin Alter Column orderId--->>>>]");
bRet = alterTableSimProcOrderDB(); bRet = alterTableSimProcOrderDB();
*/
m_mutex.unlock(); m_mutex.unlock();
return bRet; return bRet;
} else { } else {
......
#include "SysTray.h" #include "sysTray.h"
#include <QApplication> #include <QApplication>
#include <QThread> #include <QThread>
extern QThread tcpThread; extern QThread tcpThread;
......
#include "loaclHttpServer.h" #include "localHttpServer.h"
#include "Control/flowControl.h" #include "Control/flowControl.h"
#include "DTools/configManger.h" #include "DTools/configManger.h"
#include "QsLog.h" #include "QsLog.h"
#include <QString> #include <QString>
LoaclHttpServer::LoaclHttpServer() LocalHttpServer::LocalHttpServer()
{ {
QLOG_INFO()<< QString::fromLocal8Bit("[<<<<---LoaclHttpServer::启动本地 Https Server [QThread]--->>>>]"); QLOG_INFO()<< QString::fromLocal8Bit("[<<<<---LocalHttpServer::启动本地 Https Server [QThread]--->>>>]");
m_tcpServerManage = new JQHttpServer::TcpServerManage(10); m_tcpServerManage = new JQHttpServer::TcpServerManage(10);
} }
void LoaclHttpServer::run() void LocalHttpServer::run()
{ {
/*** 启动Http服务:用来响应Http获取订单的请求***/ /*** 启动Http服务:用来响应Http获取订单的请求***/
QLOG_INFO()<< "[<<<<---LoaclHttpServer::Receive Http Request:m_tcpServerManage:--->>>>]" << m_tcpServerManage; QLOG_INFO()<< "[<<<<---LocalHttpServer::Receive Http Request:m_tcpServerManage:--->>>>]" << m_tcpServerManage;
m_tcpServerManage->setHttpAcceptedCallback( [this]( const QPointer< JQHttpServer::Session > &session ) m_tcpServerManage->setHttpAcceptedCallback( [this]( const QPointer< JQHttpServer::Session > &session )
{ {
QLOG_INFO()<< "[<<<<---LoaclHttpServer::Receive Http Request:currentThreadId:--->>>>]" << QThread::currentThreadId(); QLOG_INFO()<< "[<<<<---LocalHttpServer::Receive Http Request:currentThreadId:--->>>>]" << QThread::currentThreadId();
// 回调发生在新的线程内; // 回调发生在新的线程内;
/***解析FM外卖插件HTTP服务与Http请求的会话连接是否断开: 会话连接未断开***/ /***解析FM外卖插件HTTP服务与Http请求的会话连接是否断开: 会话连接未断开***/
if(!session.isNull()) if(!session.isNull())
...@@ -72,7 +72,7 @@ void LoaclHttpServer::run() ...@@ -72,7 +72,7 @@ void LoaclHttpServer::run()
} }
void LoaclHttpServer::stop() void LocalHttpServer::stop()
{ {
terminate(); terminate();
wait(); wait();
......
#ifndef LOACLHTTPSERVER_H #ifndef LOCALHTTPSERVER_H
#define LOACLHTTPSERVER_H #define LOCALHTTPSERVER_H
#include <QThread> #include <QThread>
#include "Network/billSocket.h" #include "Network/billSocket.h"
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
#include <QTimer> #include <QTimer>
#include <QPair> #include <QPair>
/*class:LoaclHttpServer 线程:接受客户端HTTP请求的服务*/ /*class:LocalHttpServer 线程:接受客户端HTTP请求的服务*/
class LoaclHttpServer: public QThread class LocalHttpServer: public QThread
{ {
Q_OBJECT Q_OBJECT
public: public:
...@@ -23,7 +23,7 @@ public: ...@@ -23,7 +23,7 @@ public:
* 参数:NULL * 参数:NULL
* 返回:NULL * 返回:NULL
* */ * */
LoaclHttpServer(); LocalHttpServer();
private: private:
// HttpServer // HttpServer
...@@ -42,4 +42,4 @@ public: ...@@ -42,4 +42,4 @@ public:
void stop(); void stop();
}; };
#endif // LOACLHTTPSERVER_H #endif // LOCALHTTPSERVER_H
...@@ -11,9 +11,13 @@ class dishesObject : public QObject ...@@ -11,9 +11,13 @@ class dishesObject : public QObject
Q_PROPERTY (QString id READ getId WRITE setId) Q_PROPERTY (QString id READ getId WRITE setId)
Q_PROPERTY (QString specId READ getspecId WRITE setspecId) Q_PROPERTY (QString specId READ getspecId WRITE setspecId)
Q_PROPERTY (QString name READ getname WRITE setname) Q_PROPERTY (QString name READ getname WRITE setname)
Q_PROPERTY (QString enProductName READ getEnProductName WRITE setEnProductName)
Q_PROPERTY (QString specName READ getspecName WRITE setspecName) Q_PROPERTY (QString specName READ getspecName WRITE setspecName)
Q_PROPERTY (QString enSpecificationName READ getEnSpecificationName WRITE setEnSpecificationName)
Q_PROPERTY (QString defaultImage READ getDefaultImage WRITE setDefaultImage)
Q_PROPERTY (QString code READ getcode WRITE setcode) Q_PROPERTY (QString code READ getcode WRITE setcode)
Q_PROPERTY (int packagePrice READ getpackagePrice WRITE setpackagePrice) Q_PROPERTY (int packagePrice READ getpackagePrice WRITE setpackagePrice)
Q_PROPERTY (int sequence READ getSequence WRITE setSequence)
Q_PROPERTY (int qty READ getqty WRITE setqty) Q_PROPERTY (int qty READ getqty WRITE setqty)
Q_PROPERTY (int price READ getprice WRITE setprice) Q_PROPERTY (int price READ getprice WRITE setprice)
Q_PROPERTY (QString options READ getoptions WRITE setoptions) Q_PROPERTY (QString options READ getoptions WRITE setoptions)
...@@ -33,26 +37,30 @@ public: ...@@ -33,26 +37,30 @@ public:
dishesObject(const dishesObject& dish,QObject* parent=0); dishesObject(const dishesObject& dish,QObject* parent=0);
dishesObject& operator =(const dishesObject& dish); dishesObject& operator =(const dishesObject& dish);
void FetchDataFromJson(const QJsonObject &json); void FetchDataFromJson(const QJsonObject &json);
QString couponSeq; //券序号 QString couponSeq = ""; //券序号
QString id; QString id = "";
QString name; QString name = "";
QString specId; QString enProductName = ""; //英文版商品名称;
QString specName; QString specId = "";
QString code; QString specName = "";
int qty; QString enSpecificationName = ""; //英文版规格名称;
int packagePrice; QString defaultImage = ""; //商品默认图片;
int price; QString code = "";
QString options; int qty = 0;
int packagePrice = 0;
int price = 0;
int sequence = 0;
QString options = "";
//卡券/红包优惠; //卡券/红包优惠;
QString promotionSku; QString promotionSku = "";
QString promotionName; QString promotionName = "";
int promotionQty; int promotionQty = 0;
int promotionPrice; int promotionPrice = 0;
//星星优惠; //星星优惠;
QString starPromotionSku; QString starPromotionSku = "";
QString starPromotionName; QString starPromotionName = "";
int starPromotionQty; int starPromotionQty = 0;
int starPromotionPrice; int starPromotionPrice = 0;
QList<dishesObject*> sub_products; QList<dishesObject*> sub_products;
...@@ -69,6 +77,9 @@ protected: ...@@ -69,6 +77,9 @@ protected:
inline QString getname(){ return name; } inline QString getname(){ return name; }
inline void setname(const QString& v){ name = v; } inline void setname(const QString& v){ name = v; }
inline QString getEnProductName(){ return enProductName; }
inline void setEnProductName(const QString& v){ enProductName = v; }
inline int getprice(){ return price; } inline int getprice(){ return price; }
inline void setprice(const int& v){ price = v; } inline void setprice(const int& v){ price = v; }
...@@ -78,9 +89,18 @@ protected: ...@@ -78,9 +89,18 @@ protected:
inline int getpackagePrice(){ return packagePrice; } inline int getpackagePrice(){ return packagePrice; }
inline void setpackagePrice(const int& v){ packagePrice = v; } inline void setpackagePrice(const int& v){ packagePrice = v; }
inline int getSequence(){ return sequence; }
inline void setSequence(const int& v){ sequence = v; }
inline QString getspecName(){ return specName; } inline QString getspecName(){ return specName; }
inline void setspecName(const QString& v){ specName = v; } inline void setspecName(const QString& v){ specName = v; }
inline QString getEnSpecificationName(){ return enSpecificationName; }
inline void setEnSpecificationName(const QString& v){ enSpecificationName = v; }
inline QString getDefaultImage(){ return defaultImage; }
inline void setDefaultImage(const QString& v){ defaultImage = v; }
inline QString getcode(){ return code; } inline QString getcode(){ return code; }
inline void setcode(const QString& v){ code = v; } inline void setcode(const QString& v){ code = v; }
......
...@@ -13,6 +13,7 @@ BillSocket::BillSocket(QObject *parent) ...@@ -13,6 +13,7 @@ BillSocket::BillSocket(QObject *parent)
{ {
//设置Http请求的 请求头; //设置Http请求的 请求头;
m_networkRequest.setRawHeader("Content-Type","application/json"); m_networkRequest.setRawHeader("Content-Type","application/json");
m_networkManger.moveToThread(parent->thread());
} }
BillSocket::~BillSocket() BillSocket::~BillSocket()
......
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "origin"]
url = https://github.com/uglide/qredisclient.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[submodule "3rdparty/asyncfuture"]
active = true
url = https://github.com/benlau/asyncfuture.git
[submodule "3rdparty/hiredis"]
active = true
url = https://github.com/redis/hiredis.git
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include "ui_dailyreportForm.h" #include "ui_dailyreportForm.h"
#include <QPainter> #include <QPainter>
#include "preDefine.h" #include "preDefine.h"
#include "Model/dailyobject.h" #include "Model/dailyObject.h"
#include <QJsonArray> #include <QJsonArray>
#include <QJsonValue> #include <QJsonValue>
#include <QDebug> #include <QDebug>
......
...@@ -245,8 +245,10 @@ void FloatForm::RefreshStoreStatus(int eleStoreStatus, int modStoreStatus,int mo ...@@ -245,8 +245,10 @@ void FloatForm::RefreshStoreStatus(int eleStoreStatus, int modStoreStatus,int mo
this->ui->Mod2Lable->move(70, 36); // 在 Mod1Lable 基础上 x+4; y-4; this->ui->Mod2Lable->move(70, 36); // 在 Mod1Lable 基础上 x+4; y-4;
if(1 == modStoreStatus){ if(1 == modStoreStatus){
this->ui->Mod2Lable->setPixmap(QPixmap(":StoreOn.png")); this->ui->Mod2Lable->setPixmap(QPixmap(":StoreOn.png"));
}else{ }else if(2 == modStoreStatus){
this->ui->Mod2Lable->setPixmap(QPixmap(":StoreOff.png")); this->ui->Mod2Lable->setPixmap(QPixmap(":StoreOff.png"));
}else {
this->ui->Mod2Lable->setPixmap(QPixmap(":StoreDef.png"));
} }
//准备Eleme门店营业状态Label; //准备Eleme门店营业状态Label;
...@@ -257,8 +259,10 @@ void FloatForm::RefreshStoreStatus(int eleStoreStatus, int modStoreStatus,int mo ...@@ -257,8 +259,10 @@ void FloatForm::RefreshStoreStatus(int eleStoreStatus, int modStoreStatus,int mo
this->ui->Eleme2Lable->move(70, 62); // x 与 Mod1Lable 对齐; y-4; this->ui->Eleme2Lable->move(70, 62); // x 与 Mod1Lable 对齐; y-4;
if(1 == eleStoreStatus){ if(1 == eleStoreStatus){
this->ui->Eleme2Lable->setPixmap(QPixmap(":StoreOn.png")); this->ui->Eleme2Lable->setPixmap(QPixmap(":StoreOn.png"));
}else{ }else if(2 == eleStoreStatus){
this->ui->Eleme2Lable->setPixmap(QPixmap(":StoreOff.png")); this->ui->Eleme2Lable->setPixmap(QPixmap(":StoreOff.png"));
} else {
this->ui->Eleme2Lable->setPixmap(QPixmap(":StoreDef.png"));
} }
//准备Mop门店营业状态Label; //准备Mop门店营业状态Label;
...@@ -269,8 +273,10 @@ void FloatForm::RefreshStoreStatus(int eleStoreStatus, int modStoreStatus,int mo ...@@ -269,8 +273,10 @@ void FloatForm::RefreshStoreStatus(int eleStoreStatus, int modStoreStatus,int mo
this->ui->Mop2Lable->move(70, 88); // x 与 Mod1Lable 对齐; y-4; this->ui->Mop2Lable->move(70, 88); // x 与 Mod1Lable 对齐; y-4;
if(1 == mopStoreStatus){ if(1 == mopStoreStatus){
this->ui->Mop2Lable->setPixmap(QPixmap(":StoreOn.png")); this->ui->Mop2Lable->setPixmap(QPixmap(":StoreOn.png"));
}else{ } else if(2 == mopStoreStatus) {
this->ui->Mop2Lable->setPixmap(QPixmap(":StoreOff.png")); this->ui->Mop2Lable->setPixmap(QPixmap(":StoreOff.png"));
} else {
this->ui->Mop2Lable->setPixmap(QPixmap(":StoreDef.png"));
} }
//准备订单管理状态Label; //准备订单管理状态Label;
......
...@@ -119,7 +119,7 @@ public slots: ...@@ -119,7 +119,7 @@ public slots:
* 参数:1 [ele开关店状态] 2[MOD开关店状态] 3[MOP开关店状态] * 参数:1 [ele开关店状态] 2[MOD开关店状态] 3[MOP开关店状态]
* 返回:NULL * 返回:NULL
* */ * */
void RefreshStoreStatus(int eleStoreStatus=1, int modStoreStatus=1,int mopStoreStatus=1); void RefreshStoreStatus(int eleStoreStatus=0, int modStoreStatus=0,int mopStoreStatus=0);
/* 功能:新订单到POS更新悬浮框显示; /* 功能:新订单到POS更新悬浮框显示;
* 参数:1 [是否存在新订单] * 参数:1 [是否存在新订单]
......
...@@ -10,8 +10,9 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets ...@@ -10,8 +10,9 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
include("./QsLog/QsLog.pri") include("./QsLog/QsLog.pri")
include("./JQLibrary/JQLibrary.pri") include("./JQLibrary/JQLibrary.pri")
include("./qredisclient/qredisclient.pri")
TARGET = fmTakeout TARGET = PmsPlugin
TEMPLATE = app TEMPLATE = app
CONFIG +=c++11 CONFIG +=c++11
...@@ -30,7 +31,6 @@ SOURCES += main.cpp\ ...@@ -30,7 +31,6 @@ SOURCES += main.cpp\
alertForm.cpp \ alertForm.cpp \
DTools/configManger.cpp \ DTools/configManger.cpp \
Control/flowControl.cpp \ Control/flowControl.cpp \
LocalServer/loaclHttpServer.cpp \
Network/billSocket.cpp \ Network/billSocket.cpp \
DTools/dataManger.cpp \ DTools/dataManger.cpp \
Model/orderObject.cpp \ Model/orderObject.cpp \
...@@ -59,7 +59,11 @@ SOURCES += main.cpp\ ...@@ -59,7 +59,11 @@ SOURCES += main.cpp\
DTools/getCaboxAReAuth.cpp \ DTools/getCaboxAReAuth.cpp \
Model/couponsObject.cpp \ Model/couponsObject.cpp \
Model/singleProductObject.cpp \ Model/singleProductObject.cpp \
Model/paymentObject.cpp Model/paymentObject.cpp \
LocalServer/localHttpServer.cpp \
DTools/qtRedisClient.cpp \
DTools/pmsGetStoreConfig.cpp \
DTools/pmsOrdersData.cpp
HEADERS += \ HEADERS += \
mainForm.h \ mainForm.h \
...@@ -67,7 +71,6 @@ HEADERS += \ ...@@ -67,7 +71,6 @@ HEADERS += \
alertForm.h \ alertForm.h \
DTools/configManger.h \ DTools/configManger.h \
Control/flowControl.h \ Control/flowControl.h \
LocalServer/loaclHttpServer.h \
Network/billSocket.h \ Network/billSocket.h \
DTools/dataManger.h \ DTools/dataManger.h \
Model/orderObject.h \ Model/orderObject.h \
...@@ -97,7 +100,11 @@ HEADERS += \ ...@@ -97,7 +100,11 @@ HEADERS += \
DTools/getCaboxAReAuth.h \ DTools/getCaboxAReAuth.h \
Model/couponsObject.h \ Model/couponsObject.h \
Model/singleProductObject.h \ Model/singleProductObject.h \
Model/paymentObject.h Model/paymentObject.h \
LocalServer/localHttpServer.h \
DTools/qtRedisClient.h \
DTools/pmsGetStoreConfig.h \
DTools/pmsOrdersData.h
FORMS += mainForm.ui \ FORMS += mainForm.ui \
alertForm.ui \ alertForm.ui \
......
...@@ -7,8 +7,8 @@ IDI_ICON ICON DISCARDABLE "logo.ico" ...@@ -7,8 +7,8 @@ IDI_ICON ICON DISCARDABLE "logo.ico"
#endif #endif
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
//***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***// //***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***//
FILEVERSION 2,2019,528,1 FILEVERSION 4,2019,701,1
PRODUCTVERSION 2,2019,528,1 PRODUCTVERSION 4,2019,701,1
//*************************************************************************// //*************************************************************************//
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
...@@ -25,14 +25,14 @@ VS_VERSION_INFO VERSIONINFO ...@@ -25,14 +25,14 @@ VS_VERSION_INFO VERSIONINFO
BLOCK "080404b0" BLOCK "080404b0"
BEGIN BEGIN
VALUE "CompanyName", "ShangHai.Freemud Co., Ltd." VALUE "CompanyName", "ShangHai.Freemud Co., Ltd."
VALUE "FileDescription", "Delivery Order Plugin Application" VALUE "FileDescription", "PMS Plugin Application"
VALUE "InternalName", "fmTakeout.exe" VALUE "InternalName", "PmsPlugin.exe"
VALUE "LegalCopyright", "Copyright (C)2013-2019" VALUE "LegalCopyright", "Copyright (C)2013-2019"
VALUE "OriginalFilename", "fmTakeout.exe" VALUE "OriginalFilename", "PmsPlugin.exe"
VALUE "ProductName", "Delivery Order Plugin" VALUE "ProductName", "PMS Plugin"
//***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***// //***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***//
VALUE "ProductVersion", "2.2019.528.1" VALUE "ProductVersion", "4.2019.701.1"
VALUE "FileVersion", "2.2019.528.1" VALUE "FileVersion", "4.2019.701.1"
//*************************************************************************// //*************************************************************************//
END END
END END
......
...@@ -16,25 +16,8 @@ ...@@ -16,25 +16,8 @@
using namespace QsLogging; using namespace QsLogging;
QString g_appDir; QString g_appDir;
QThread tcpThread; QThread tcpThread;
QThread workThread; QThread workThread;
/*
void InitLogger()
{
QString logDir = QString("%1/log").arg(g_appDir);
Logger& logger = Logger::instance();
logger.setLoggingLevel(TraceLevel);
QDir().mkdir(logDir);
QString logPath = QString("%1/%2").arg(logDir).arg("log");
DestinationPtr fileDst(DestinationFactory::MakeFileDestination(
logPath, EnableLogRotation, MaxSizeBytes(10*1024*1024), MaxOldLogCount(40)));
logger.addDestination(fileDst);
DestinationPtr consoleDst(DestinationFactory::MakeDebugOutputDestination());
logger.addDestination(consoleDst);
}
*/
void InitLogger(){ void InitLogger(){
QString logDir = QString("%1/log").arg(g_appDir); QString logDir = QString("%1/log").arg(g_appDir);
...@@ -72,11 +55,11 @@ int main(int argc, char *argv[]) ...@@ -72,11 +55,11 @@ int main(int argc, char *argv[])
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
SetUnhandledExceptionFilter(FMExcpHandler); SetUnhandledExceptionFilter(FMExcpHandler);
#endif #endif
HANDLE m_hMutex = CreateMutex(NULL, FALSE, L"Global\\fmTakeaway" ); HANDLE m_hMutex = CreateMutex(NULL, FALSE, L"Global\\PmsPlugin" );
if(NULL!=m_hMutex){ if(nullptr != m_hMutex){
if (GetLastError() == ERROR_ALREADY_EXISTS||GetLastError() == ERROR_ACCESS_DENIED) { if (GetLastError() == ERROR_ALREADY_EXISTS||GetLastError() == ERROR_ACCESS_DENIED) {
CloseHandle(m_hMutex); CloseHandle(m_hMutex);
m_hMutex = NULL; m_hMutex = nullptr;
return -1; return -1;
} }
} }
...@@ -93,9 +76,9 @@ int main(int argc, char *argv[]) ...@@ -93,9 +76,9 @@ int main(int argc, char *argv[])
// 加载主题 // 加载主题
LoadTheme(APP_THEME); LoadTheme(APP_THEME);
QLOG_INFO() << QString("[<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]"); QLOG_INFO() << QString("[<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>]");
QLOG_INFO() << QString("[<<<<<<<<<<<<<<<<<<<<<<<-- fmTakeaway Start -->>>>>>>>>>>>>>>>>>>>>>>>>>>]"); QLOG_INFO() << QString("[<<<<<<<<<<<-- fmPmsPlugin Start -->>>>>>>>>>>>>>>>]");
QLOG_INFO() << QString("[<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]"); QLOG_INFO() << QString("[<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>]");
// 将控制器移到工作线程 // 将控制器移到工作线程
FlowControl::GetInstance().moveToThread(&workThread); FlowControl::GetInstance().moveToThread(&workThread);
...@@ -103,17 +86,33 @@ int main(int argc, char *argv[]) ...@@ -103,17 +86,33 @@ int main(int argc, char *argv[])
FloatForm f; FloatForm f;
MainForm w; MainForm w;
bool connectRet = false;
qRegisterMetaType<AlertForm::Type>("AlertForm::Type");
QObject::connect(&w, &MainForm::showFloatForm, &f, &FloatForm::onShow); QObject::connect(&w, &MainForm::showFloatForm, &f, &FloatForm::onShow);
QObject::connect(&FlowControl::GetInstance(), &FlowControl::startRemind, &f, &FloatForm::onStartRemind); QObject::connect(&FlowControl::GetInstance(), &FlowControl::startRemind, &f, &FloatForm::onStartRemind);
QObject::connect(&FlowControl::GetInstance(), &FlowControl::doHideMainShowFloatFrom, &w, &MainForm::on_mainBtnHide_clicked); QObject::connect(&FlowControl::GetInstance(), &FlowControl::doHideMainShowFloatFrom, &w, &MainForm::on_mainBtnHide_clicked);
connectRet = QObject::connect(&FlowControl::GetInstance(), &FlowControl::showAlert, &w, &MainForm::onShowAlert);
if(!connectRet){
QLOG_INFO() << QString("Connect FlowControl::showAlert to MainForm::onShowAlert Failed");
}
connectRet = QObject::connect(&FlowControl::GetInstance(), &FlowControl::setStoreInfo, &w, &MainForm::onSetStoreInfo);
if(!connectRet){
QLOG_INFO() << QString("Connect FlowControl::setStoreInfo to MainForm::onSetStoreInfo Failed");
}
connectRet = QObject::connect(&FlowControl::GetInstance(), &FlowControl::setCashierInfo, &w, &MainForm::onSetCashierInfo);
if(!connectRet){
QLOG_INFO() << QString("Connect FlowControl::setCashierInfo to MainForm::onSetCashierInfo Failed");
}
QObject::connect(&FlowControl::GetInstance(), &FlowControl::doLockFloatForm, &f, &FloatForm::onLockFloatForm); QObject::connect(&FlowControl::GetInstance(), &FlowControl::doLockFloatForm, &f, &FloatForm::onLockFloatForm);
QObject::connect(&FlowControl::GetInstance(), &FlowControl::doUnLockFloatFrom, &f, &FloatForm::onUnLockFloatForm); QObject::connect(&FlowControl::GetInstance(), &FlowControl::doUnLockFloatFrom, &f, &FloatForm::onUnLockFloatForm);
QObject::connect(&FlowControl::GetInstance(), &FlowControl::doUpdateStoreStatus, &f, &FloatForm::onUpdateStoreStatus); QObject::connect(&FlowControl::GetInstance(), &FlowControl::doUpdateStoreStatus, &f, &FloatForm::onUpdateStoreStatus);
QObject::connect(&w, &MainForm::startRemind, &f, &FloatForm::onStartRemind); QObject::connect(&w, &MainForm::startRemind, &f, &FloatForm::onStartRemind);
QObject::connect(&w, &MainForm::stopRemind, &f, &FloatForm::onStopRemind); QObject::connect(&w, &MainForm::stopRemind, &f, &FloatForm::onStopRemind);
QObject::connect(&f, &FloatForm::showMainForm, &w, &MainForm::show); QObject::connect(&f, &FloatForm::showMainForm, &w, &MainForm::show);
w.MyShow(); w.MyShow();
......
...@@ -21,8 +21,8 @@ MainForm::MainForm(QWidget *parent) : ...@@ -21,8 +21,8 @@ MainForm::MainForm(QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
// 初始化成员变量 // 初始化成员变量
m_prevBtn = NULL; m_prevBtn = nullptr;
m_prevTable = NULL; m_prevTable = nullptr;
m_tableList.append(ui->mainTableNew); m_tableList.append(ui->mainTableNew);
m_tableList.append(ui->mainTableMake); m_tableList.append(ui->mainTableMake);
m_tableList.append(ui->mainTableSend); m_tableList.append(ui->mainTableSend);
...@@ -32,7 +32,6 @@ MainForm::MainForm(QWidget *parent) : ...@@ -32,7 +32,6 @@ MainForm::MainForm(QWidget *parent) :
// 注册信号槽参数 // 注册信号槽参数
qRegisterMetaType<AlertForm::Type>("AlertForm::Type"); qRegisterMetaType<AlertForm::Type>("AlertForm::Type");
qRegisterMetaType<dishesObject>("dishesObject"); qRegisterMetaType<dishesObject>("dishesObject");
qRegisterMetaType< QMap< QString, QMultiMap<QString, dishesObject> > >("QMap<QString, QMultiMap<QString, dishesObject>>"); qRegisterMetaType< QMap< QString, QMultiMap<QString, dishesObject> > >("QMap<QString, QMultiMap<QString, dishesObject>>");
qRegisterMetaType< QMap<QString, int> >("QMap<QString, int>"); qRegisterMetaType< QMap<QString, int> >("QMap<QString, int>");
...@@ -48,13 +47,14 @@ MainForm::MainForm(QWidget *parent) : ...@@ -48,13 +47,14 @@ MainForm::MainForm(QWidget *parent) :
connect(this, &MainForm::getDayReport, &FlowControl::GetInstance(), &FlowControl::onDailyReport); connect(this, &MainForm::getDayReport, &FlowControl::GetInstance(), &FlowControl::onDailyReport);
connect(this, &MainForm::sendSelfCheck, &FlowControl::GetInstance(), &FlowControl::onSendSelfCheck); connect(this, &MainForm::sendSelfCheck, &FlowControl::GetInstance(), &FlowControl::onSendSelfCheck);
connect(&FlowControl::GetInstance(), &FlowControl::showDailyReportData, this, &MainForm::onSetDailyReportData); connect(&FlowControl::GetInstance(), &FlowControl::showDailyReportData, this, &MainForm::onSetDailyReportData);
connect(&FlowControl::GetInstance(), &FlowControl::hideAlert, this, &MainForm::onHideAlert); connect(&FlowControl::GetInstance(), &FlowControl::hideAlert, this, &MainForm::onHideAlert,Qt::QueuedConnection);
connect(&FlowControl::GetInstance(), &FlowControl::showAlert, this, &MainForm::onShowAlert); //转移到Main.cpp中进行绑定;
connect(&FlowControl::GetInstance(), &FlowControl::setOpeStatus, this, &MainForm::onSetOpeStatus); //connect(&FlowControl::GetInstance(), &FlowControl::showAlert, this, &MainForm::onShowAlert,Qt::QueuedConnection);
connect(&FlowControl::GetInstance(), &FlowControl::setNetStatus, this, &MainForm::onSetNetStatus); //connect(&FlowControl::GetInstance(), &FlowControl::setStoreInfo, this, &MainForm::onSetStoreInfo,Qt::QueuedConnection);
connect(&FlowControl::GetInstance(), &FlowControl::setStoreInfo, this, &MainForm::onSetStoreInfo); //connect(&FlowControl::GetInstance(), &FlowControl::setCashierInfo, this, &MainForm::onSetCashierInfo,Qt::QueuedConnection);
connect(&FlowControl::GetInstance(), &FlowControl::setCashierInfo, this, &MainForm::onSetCashierInfo); connect(&FlowControl::GetInstance(), &FlowControl::setOpeStatus, this, &MainForm::onSetOpeStatus,Qt::QueuedConnection);
connect(&FlowControl::GetInstance(), &FlowControl::changeOrderStatus, this, &MainForm::onChangeOrderStatus/*,Qt::BlockingQueuedConnection*/); connect(&FlowControl::GetInstance(), &FlowControl::setNetStatus, this, &MainForm::onSetNetStatus,Qt::QueuedConnection);
connect(&FlowControl::GetInstance(), &FlowControl::changeOrderStatus, this, &MainForm::onChangeOrderStatus,Qt::QueuedConnection);
connect(&FlowControl::GetInstance(), &FlowControl::showOrderDetails, this, &MainForm::onShowOrderDetails); connect(&FlowControl::GetInstance(), &FlowControl::showOrderDetails, this, &MainForm::onShowOrderDetails);
connect(&FlowControl::GetInstance(), &FlowControl::clearorder, this, &MainForm::onOrderClear); connect(&FlowControl::GetInstance(), &FlowControl::clearorder, this, &MainForm::onOrderClear);
// 搜索订单的信号槽 // 搜索订单的信号槽
...@@ -246,7 +246,8 @@ void MainForm::onShowOrderDetails(OrderObject *orderObject) ...@@ -246,7 +246,8 @@ void MainForm::onShowOrderDetails(OrderObject *orderObject)
void MainForm::onShowSearchOrderResult(const QMap<QString,QString>& orderIdList) void MainForm::onShowSearchOrderResult(const QMap<QString,QString>& orderIdList)
{ {
QLOG_INFO() << QString("[<<<<---MainForm::onShowSearchOrderResult: orderIdList.length:%1 --->>>>]").arg(orderIdList.count()); QLOG_INFO() << QString("[<<<<---MainForm::onShowSearchOrderResult: orderIdList.length:%1 --->>>>]")
.arg(orderIdList.count());
if(orderIdList.isEmpty()) { if(orderIdList.isEmpty()) {
m_resultForm->hide(); m_resultForm->hide();
return; return;
...@@ -354,11 +355,13 @@ void MainForm::onShowAlert(AlertForm::Type type, const QString &msg) ...@@ -354,11 +355,13 @@ void MainForm::onShowAlert(AlertForm::Type type, const QString &msg)
void MainForm::onSetStoreInfo(const QString &storeId) void MainForm::onSetStoreInfo(const QString &storeId)
{ {
QLOG_INFO() << QString("[<<<<---MainForm::onSetStoreInfo: storeId:%1 --->>>>]").arg(storeId);
ui->mainLabStoreid->setText(storeId); ui->mainLabStoreid->setText(storeId);
} }
void MainForm::onSetCashierInfo(const QString &cashierInfo) void MainForm::onSetCashierInfo(const QString &cashierInfo)
{ {
QLOG_INFO() << QString("[<<<<---MainForm::onSetCashierInfo: cashierName:%1 --->>>>]").arg(cashierInfo);
ui->mainLabCashier->setText(cashierInfo); ui->mainLabCashier->setText(cashierInfo);
} }
......
...@@ -5,23 +5,10 @@ ...@@ -5,23 +5,10 @@
#define APP_THEME "deaufult" #define APP_THEME "deaufult"
//#define APP_VERSION "1.20171013.01"
//#define APP_VERSION "2.20180822.01"
//#define APP_VERSION "2.20180824.01"
//#define APP_VERSION "2.20180905.01"
//#define APP_VERSION "2.2018913.1"
//#define APP_VERSION "2.2018919.1"
//#define APP_VERSION "2.20181023.1"
//#define APP_VERSION "2.20181210.1"
//#define APP_VERSION "2.2019110.1"
//#define APP_VERSION "2.2019110.2"
//#define APP_VERSION "2.2019.225.1"
//#define APP_VERSION "2.2019.331.1"
//#define APP_VERSION "2.2019.410.1"
//#define APP_VERSION "2.2019.422.1"
//#define APP_VERSION "2.2019.520.1"
#define APP_VERSION "2.2019.528.1"
//#define APP_VERSION "2.2019.520.1"
//#define APP_VERSION "2.2019.528.1"
#define APP_VERSION "4.2019.701.1"
//修正版本号时,切记修正 FmTakeout.rc 中的版本号 //修正版本号时,切记修正 FmTakeout.rc 中的版本号
...@@ -73,6 +60,7 @@ ...@@ -73,6 +60,7 @@
#define JSON_PASSWORD "password" #define JSON_PASSWORD "password"
#define JSON_IPADDRESS "iPAddress" #define JSON_IPADDRESS "iPAddress"
#define JSON_MACHINECODE "machineCode" #define JSON_MACHINECODE "machineCode"
#define JSON_PMSMACHINENO "pmsMachineNo"
#define JSON_PARTNERID "partnerId" #define JSON_PARTNERID "partnerId"
#define JSON_ORGCODE "orgCode" #define JSON_ORGCODE "orgCode"
...@@ -209,7 +197,7 @@ ...@@ -209,7 +197,7 @@
// 尝试加锁程序内部超时时间[500ms] // 尝试加锁程序内部超时时间[500ms]
#define VALUE_TRYLOCKMEMTIMEOUT 500 #define VALUE_TRYLOCKMEMTIMEOUT 500
// 默认重新尝试登录的时间 // 默认重新尝试登录的时间
#define VALUE_RELOGINTIME 20000 #define VALUE_RELOGINTIME 10000
// 默认心跳间隔的时间 // 默认心跳间隔的时间
#define VALUE_SENDHEARTTIME 20000 #define VALUE_SENDHEARTTIME 20000
// 新订单提示音音频时长 // 新订单提示音音频时长
......
...@@ -43,5 +43,6 @@ ...@@ -43,5 +43,6 @@
<file>MopTitle.png</file> <file>MopTitle.png</file>
<file>StoreOff.png</file> <file>StoreOff.png</file>
<file>StoreOn.png</file> <file>StoreOn.png</file>
<file>StoreDef.png</file>
</qresource> </qresource>
</RCC> </RCC>
\ No newline at end of file
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment