Commit 65f73386 by wuyang.zou

1、支持 pcs-plugin 推拉两次请求,合并为一次请求模式;

V4.2023.10.12
parent 07d11173
......@@ -199,6 +199,7 @@ bool SocketCommunicate::connectTcpSvr()
tmpMap.insert(JSON_TCP_DEVICE_TYPE , "pcsPlugin");
tmpMap.insert(JSON_TCP_DEVICE_VER , _pcsPluginVersion);
tmpMap.insert(JSON_STOREID , _storeId);
tmpMap.insert(JSON_LOGIN_WITH_CONTAINS_ORDER_DETAIL, true);
setPosMetaData(tmpMap);
}
......
......@@ -369,6 +369,7 @@ private:
{
if(!map.contains(JSON_STOREID))
return false;
json = QJsonDocument::fromJson( QJsonDocument::fromVariant( QVariant(map) ).toJson() ).object();
/* JSON_TCP_DEVICE_ID JSON_TCP_DEVICE_IP JSON_TCP_DEVICE_PORT JSON_TCP_DEVICE_TYPE
* JSON_TCP_DEVICE_VER JSON_STOREID */
......
......@@ -73,6 +73,17 @@ private:
}PullOrderInfo;
typedef struct TOANALYSIS_ORDER
{
QString orderId;
QString callBackUrl;
QJsonObject orderDetailJson;
QJsonObject pushOptions;
} AnalysisOrderInfo;
typedef struct ORDER_OPERATION
{
int operation;//1:接单,0:取消订单
......@@ -132,6 +143,7 @@ private:
QTimer *m_clearTimer;
QTimer *m_heartTimer;
QTimer *m_pullTimer;
QTimer *m_analysisTimer;
QTimer *m_reportOMSReocrdOrderTimer;
QTimer *m_loginTimer;
QTimer *m_remindCasherBlinkFloatTimer; //插件程序收到外卖订单后,需要一致提醒店员[直到此外卖订单被全部录入到POS系统]
......@@ -171,10 +183,15 @@ private:
QMap<QString,QString> m_orderIdToPosCheckNoMap;
//记录当前订单操作
QMap<QString, int> m_orderOperatePair;
//订单拉取记录
//订单拉取订单详情 / 订单列表 记录
QList<PullOrderInfo*> m_orderPullList;
QMutex m_PullOrderDataMutex;
//解析订单详情数据 / 记录
QList<AnalysisOrderInfo*> m_orderAnalysisList;
QMutex m_analysisOrderDataMutex;
//向OMS汇报订单的POS入机情况 队列;
QList<RepOMSRecordOrderInfo*> m_orderRecordRepOMSList;
QMutex m_RepOMSRecordOrderMutex;
......@@ -352,11 +369,22 @@ public slots:
* 返回:是否成功
* */
bool _PullOrderList(const int &pageSize, const int &pageNo, const QString &callBackUrl);
/* 功能:解析订单详情数据;
* 参数:NULL
* 返回:是否成功
* */
void _AnalysisOrderDetailData();
/* 功能:发送心跳
* 参数:NULL
* 返回:是否成功
* */
bool _SendHeart();
/* 功能:确认订单
* 参数:[1]订单编号[2]配送员信息
* 返回:是否成功
......@@ -418,6 +446,9 @@ public slots:
// 避免获取较多历史订单的同时,OMS又有推单过来,导致死锁;
bool _TryAddOrderPull(const QString &orderId=0, const QString &channel=0, const QString &callBackUrl="", const int &pageNumber=1, const int &pageSize=30);
// 支持上游推送订单消息时,包含订单详情数据模式, 这种情况就可以提高插件处理订单速度;
bool _TryAddOrderQueueAnalysis (const QString& orderId, const QJsonObject& orderDetailJson, const QString& callBackUrl, const QJsonObject& pushOptions);
//点击屏幕指定区域
void _ClickOMSAssignArea();
void _ClickToLogin();
......
#include "jqdeclare.hpp"
#include "jqhttpserver.h"
/*
This file is part of JQLibrary
Copyright: Jason and others
Contact email: 188080501@qq.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef JQLIBRARY_INCLUDE_JQDECLARE_HPP_
#define JQLIBRARY_INCLUDE_JQDECLARE_HPP_
// Macro define
#define JQPROPERTYDECLARE( Type, name, setName, ... ) \
private: \
Type name##_ __VA_ARGS__; \
\
public: \
inline const Type &name() const { return name##_; } \
inline void setName( const Type &name ) { name##_ = name; } \
\
private:
#define JQPROPERTYDECLAREWITHSLOT( Type, name, setName, ... ) \
private: \
Type name##_ __VA_ARGS__; \
public Q_SLOTS: \
Type name() const { return name##_; } \
void setName( const Type &name ) { name##_ = name; } \
\
private:
#define JQPTRPROPERTYDECLARE( Type, name, setName, ... ) \
private: \
Type *name##_ __VA_ARGS__; \
\
public: \
inline const Type *name() const { return name##_; } \
inline void setName( const Type &name ) \
{ \
if ( name##_ ) \
{ \
delete name##_; \
} \
name##_ = new Type( name ); \
} \
\
private:
#define JQ_READ_AND_SET_PROPERTY( Type, name, setName ) \
public: \
inline const Type &name() const { return name##_; } \
inline void setName( const Type &name ) { name##_ = name; } \
\
private:
#define JQ_STATIC_READ_AND_SET_PROPERTY( Type, name, setName ) \
public: \
static inline const Type &name() { return name##_; } \
static inline void setName( const Type &name ) { name##_ = name; } \
\
private:
#define JQ_STATIC_SET_PROPERTY( Type, name, setName ) \
public: \
static inline void setName( const Type &name ) { name##_ = name; } \
\
private:
#define RUNONOUTRANGEHELPER2( x, y ) x##y
#define RUNONOUTRANGEHELPER( x, y ) RUNONOUTRANGEHELPER2( x, y )
#define RUNONOUTRANGE( ... ) \
auto RUNONOUTRANGEHELPER( runOnOutRangeCallback, __LINE__ ) = __VA_ARGS__; \
QSharedPointer< int > RUNONOUTRANGEHELPER( runOnOutRange, __LINE__ )( \
new int, \
[ RUNONOUTRANGEHELPER( runOnOutRangeCallback, __LINE__ ) ]( int *data ) { \
RUNONOUTRANGEHELPER( runOnOutRangeCallback, __LINE__ ) \
(); \
delete data; \
} ); \
if ( RUNONOUTRANGEHELPER( runOnOutRange, __LINE__ ).data() == nullptr ) \
{ \
exit( -1 ); \
}
#define RUNONOUTRANGETIMER( message ) \
const auto &&runOnOutRangeTimerTime = QDateTime::currentMSecsSinceEpoch(); \
RUNONOUTRANGE( [ = ]() { \
qDebug() << message << ( QDateTime::currentMSecsSinceEpoch() - runOnOutRangeTimerTime ); \
} )
#define JQCONST( property ) static_cast< const decltype( property ) >( property )
#define JQTICKCOUNTERMESSAGE( message ) \
{ \
static JQTickCounter tickCounter; \
tickCounter.tick(); \
qDebug() << message << tickCounter.tickPerSecond(); \
}
#define JQBUILDDATETIMESTRING \
( QDateTime( \
QLocale( QLocale::English ).toDate( QString( __DATE__ ).replace( " ", " 0" ), "MMM dd yyyy" ), \
QTime::fromString( __TIME__, "hh:mm:ss" ) ) \
.toString( "yyyy-MM-dd hh:mm:ss" ) \
.toLatin1() \
.data() )
#define JQONLYONCE \
if ( []() { \
static auto flag = true; \
if ( flag ) \
{ \
flag = false; \
return true; \
} \
return false; \
}() )
#define JQSKIPFIRST \
if ( []() { \
static auto flag = true; \
if ( flag ) \
{ \
flag = false; \
return false; \
} \
return true; \
}() )
#define JQINTERVAL( timeInterval ) \
if ( []() { \
static qint64 lastTime = 0; \
const auto && currentTime = QDateTime::currentMSecsSinceEpoch(); \
if ( qAbs( currentTime - lastTime ) > timeInterval ) \
{ \
lastTime = currentTime; \
return true; \
} \
return false; \
}() )
// Export
#ifdef JQLIBRARY_EXPORT_ENABLE
# ifdef JQLIBRARY_EXPORT_MODE
# define JQLIBRARY_EXPORT Q_DECL_EXPORT
# else
# define JQLIBRARY_EXPORT Q_DECL_IMPORT
# endif
#else
# define JQLIBRARY_EXPORT
#endif
#endif // JQLIBRARY_INCLUDE_JQDECLARE_HPP_
......@@ -21,7 +21,8 @@ void LocalHttpServer::run()
/***解析FM外卖插件HTTP服务与Http请求的会话连接是否断开: 会话连接未断开***/
if(!session.isNull())
{
QString recvData = QString::fromUtf8(session->requestRawData());
// QString recvData = QString::fromUtf8(session->requestRawData());
QString recvData = QString::fromUtf8(session->requestBody());
QLOG_INFO() << QString::fromLocal8Bit("[<<<<---Receive Http Request recvData: %1--->>>>]").arg(recvData);
QJsonParseError jsonError;
QJsonObject recvObject;
......
......@@ -613,6 +613,11 @@ public:
values.append(QString::number(json[keys[i]].toInt()));
values.append("|");
} else if ( json[keys[i]].isBool() ) {
values.append( json[keys[i]].toBool() ? "true" : "false" );
values.append("|");
}
}
......@@ -637,7 +642,14 @@ public:
values.append( "=" );
values.append( QString::number( json[keys[i]].toInt() ) );
values.append(":");
} else if ( json[keys[i]].isBool() ) {
values.append( keys[i] );
values.append( "=" );
values.append( json[keys[i]].toBool() ? "true" : "false" );
values.append(":");
}
}
values = values.left(values.length() - 1);
......
......@@ -7,8 +7,8 @@ IDI_ICON ICON DISCARDABLE "logo.ico"
#endif
VS_VERSION_INFO VERSIONINFO
//***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***//
FILEVERSION 4,2023,4,12
PRODUCTVERSION 4,2023,4,12
FILEVERSION 4,2023,10,12
PRODUCTVERSION 4,2023,10,12
//*************************************************************************//
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
......@@ -25,14 +25,14 @@ VS_VERSION_INFO VERSIONINFO
BLOCK "080404b0"
BEGIN
VALUE "CompanyName", "ShangHai.Freemud Co., Ltd."
VALUE "FileDescription", "PMS Plugin Application"
VALUE "InternalName", "PmsPlugin.exe"
VALUE "FileDescription", "PCS Plugin Application"
VALUE "InternalName", "PcsPlugin.exe"
VALUE "LegalCopyright", "Copyright (C)2014-2023"
VALUE "OriginalFilename", "PmsPlugin.exe"
VALUE "ProductName", "PMS Plugin"
VALUE "OriginalFilename", "PcsPlugin.exe"
VALUE "ProductName", "PCS Plugin"
//***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***//
VALUE "ProductVersion", "4.2023.4.12"
VALUE "FileVersion", "4.2023.4.12"
VALUE "ProductVersion", "4.2023.10.12"
VALUE "FileVersion", "4.2023.10.12"
//*************************************************************************//
END
END
......
......@@ -21,7 +21,8 @@
//#define APP_VERSION "4.2022.4.28"
//#define APP_VERSION "4.2022.8.1"
//#define APP_VERSION "4.2023.2.23"
#define APP_VERSION "4.2023.4.12"
// #define APP_VERSION "4.2023.4.12"
#define APP_VERSION "4.2023.10.12"
//修正版本号时,切记修正 FmTakeout.rc 中的版本号
#define SERVER_PASSWORD "posoperator@freemud.cn"
......@@ -102,6 +103,7 @@
#define JSON_ERRCODE "code"
#define JSON_STATUS "status"
#define JSON_ORDERSTATUS "orderStatus"
#define JSON_LOGIN_WITH_CONTAINS_ORDER_DETAIL "containsOrderDetail"
#define JSON_ORDERCOUNT "orderCount"
#define JSON_REFUNDFMID "refundFmId"
#define JSON_GLOBALORDERTYPE "globalOrderType"
......@@ -141,6 +143,7 @@
#define JSON_CALL_BACK_URL "callBackUrl"
#define JSON_SKIP_PRINT "skipPrint"
#define JSON_PUSH_OPTIONS "options"
#define JSON_PUSH_ORDER_DETAIL "orderDetail"
#define JSON_PUSH_PLUGIN_OPTIONS "pluginOptions"
#define JSON_PRINT_OPT "printOpt"
#define JSON_PRINT_OPT_ALL "all"
......
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