Commit befce6e5 by wuyang.zou

<1> 支持 WSG-MOP 美好咖啡; [OK]

<2> 插件接受 门店通告消息 并展示的功能(标题 & 内容)[OK];
<3> 插件支持获取 o2o-fulfillment(EC-MOP)新履约链路的订单(订单列表&扫码-EC-MOP) [OK];
<4> 插件实时同步 隐私号(inAdvanceTakemeal=3) [OK];
<5> 插件优化日志输出 [OK];
parent 450964c2
Pipeline #39526 failed with stage
in 0 seconds
......@@ -11,6 +11,7 @@
#include "Model/dishesObject.h"
#include "LocalServer/loaclHttpServer.h"
#include "alertForm.h"
#include "noticeForm.h"
#include <QMap>
#include <JQHttpServer.h>
#include <QMutex>
......@@ -129,6 +130,7 @@ private:
int m_mtModStoreStatus;
bool m_bLastHeartIsError;
int m_orderCount;
int m_o2ofulfillmentOrderCount;
int m_clickPosCount;
// int m_skipRecordPos; //使用订单级别: OrderObject->decouplePosVersion 标识;
// 标识是否着急打印汇总单; 1:着急打印,提前将汇总单和打印记录添加到数据库; 0:默认,不着急打印,入机后才会将汇总单和打印记录添加到数据库
......@@ -229,6 +231,13 @@ signals:
* */
void showAlert(AlertForm::Type type, const QString& msg);
/* 功能:显示门店通告展示窗口
* 参数:[1]窗口类型 [2]显示通告标题 [3]显示通告内容
* 返回:NULL
* */
void showNotice(NoticeForm::Type type, const QString& title, const QString& content);
/* 功能:隐藏主界面显示悬浮窗口
* 参数:[1]窗口类型[2]显示信息
* 返回:NULL
......@@ -345,7 +354,7 @@ private slots:
* 参数:[1]订单编号
* 返回:是否成功
* */
bool _PullOrderDetail( const QString &orderId, const QString &channel, const QString &callBackUrl );
bool _PullOrderDetail( const QString &orderId, const QString &channel, const QString &callBackUrl, const bool &skipErrorDisplay = false );
/* 功能:拉取订单
* 参数:NULL
* 返回:是否成功
......@@ -404,7 +413,7 @@ private slots:
QString _Penny2Dollar(int penny);
void _GetIpAddress();
void _AddOrderPull(const QString& orderId=0,const QString& channel=0,const int& pageNumber=1,const int& pageSize=30);
void _AddOrderPull ( const QString& orderId=0, const QString& channel=0, const QString& callBackUrl="", const int& pageNumber=1, const int& pageSize=30 );
// 避免获取较多历史订单的同时,OMS又有推单过来,导致死锁;
bool _TryAddOrderPull(const QString &orderId=0, const QString &channel=0, const QString &callBackUrl="", const int &pageNumber=1, const int &pageSize=30);
......@@ -614,6 +623,12 @@ public slots:
**/
bool _ResponseOMS12Request(const QJsonObject &content, QJsonObject &data,QString &error);
/**
*功能:FM外卖插件为响应OMS推送 宣导提醒消息 请求[action:13 -> OMS->POS 推送宣导提醒消息]准备返回数据
*参数:1、请求json参数;2、准备返回请求数据的Buff;3、返回错误信息;
*返回:是否准备成功;
**/
bool _ResponseOMS13Request(const QJsonObject &content, QJsonObject &data, QString &error);
/**
*功能:FM外卖插件为响应盒马生鲜 推订单请求[action:21]准备返回数据
......
......@@ -137,7 +137,7 @@ bool PrintOrderPromotionDB::insertOrderPromotion(OrderObject* orderObj, const QS
bool retInsCoupProm = false;
bool retInsNorProm = false;
// WSG-杯贴祝福-商品券号关联数据;
if ( "WSG-MOD" == orderObj->channel && "4" == orderObj->platformSource ) {
if ( ( "WSG-MOD" == orderObj->channel || "WSG-MOP" == orderObj->channel ) && "4" == orderObj->platformSource ) {
retInsCoupProm = insertCouponPromotion(orderObj, posCheckNo);
} else { // All Channel 商品关联数据;
retInsNorProm = insertNormalPromotion(orderObj, posCheckNo);
......
......@@ -129,14 +129,14 @@ PrintCupStickPosDB &PrintCupStickPosDB::getInstance()
bool PrintCupStickPosDB::insertOrderProduct(OrderObject* orderObj,const QString& posCheckNo, bool &checkProductValidRet) {
// WSG-杯贴祝福-商品券号关联数据;
if ( "WSG-MOD" == orderObj->channel && "4" == orderObj->platformSource ) {
if ( ( "WSG-MOD" == orderObj->channel || "WSG-MOP" == orderObj->channel ) && "4" == orderObj->platformSource ) {
checkProductValidRet = checkCouponProdAllVaild(orderObj);
} else { // All Channel 商品关联数据;
checkProductValidRet = checkNormalProdAllVaild(orderObj);
}
if ( !checkProductValidRet ) {
QLOG_ERROR()<<"insertOrderProduct:: Before Insert Normal Product Or Coupon Product Db, Check PosKey Is Invalid Or Qty Is 0";
QLOG_ERROR()<<"insertOrderProduct:: Before Insert Normal Product Or Coupon Product Db, Check PosKey Is Invalid Or Qty Is 0 Or Main Product Not Exist ";
return false;
}
......@@ -159,7 +159,7 @@ bool PrintCupStickPosDB::insertOrderProduct(OrderObject* orderObj,const QString&
bool retInsCoupProd = false;
bool retInsNorProd = false;
// WSG-杯贴祝福-商品券号关联数据;
if ( "WSG-MOD" == orderObj->channel && "4" == orderObj->platformSource ) {
if ( ( "WSG-MOD" == orderObj->channel || "WSG-MOP" == orderObj->channel ) && "4" == orderObj->platformSource ) {
retInsCoupProd = insertCouponProd(orderObj, posCheckNo);
} else { // All Channel 商品关联数据;
retInsNorProd = insertNormalProd(orderObj, posCheckNo);
......@@ -645,6 +645,23 @@ bool PrintCupStickPosDB::checkNormalProdAllVaild(OrderObject* orderObj){
QString error = "";
QString requestType = orderObj->orderStatus==6?QString::fromLocal8Bit("6"):QString::fromLocal8Bit("3");
// 主商品列表是空时, 向上游系统汇报异常;
if ( orderObj->proList.empty() ) {
error = QString::fromLocal8Bit("This Order Main Product List Is Empty, Product Data Is Invalid !!! ");
if (orderObj->decouplePosVersion < 20 ) {
FlowControl::GetInstance()._AddOrUpdateReportOmsList(orderObj->id, orderObj->channel,requestType, QString("2"), QString(""), error, QString("1110"));
} else {
FlowControl::GetInstance()._AddOrUpdateReportOmsList(orderObj->id, orderObj->channel,requestType, QString("4"), QString(""), error, QString("1110"));
// 非法数据, 弹框告警;
QString warnMsg = QString::fromLocal8Bit("Invalid Goods data, Please Check...; OrderId Last 5: %1; GoodsName: %2; GoodsPosKey: %3; GoodsQty: %4")
.arg( orderObj->id.mid(orderObj->id.length() - 5, 5) ).arg("Empty").arg("Empty").arg("Empty");
emit triggerFlowContrlAlert(AlertForm::WARNNING,warnMsg);
}
return false;
}
// 校验商品 Poskey 是否在本地数据库中有效;
for (int i=0; i < orderObj->proList.count(); i++) {
dishesObject* dish=orderObj->proList.at(i);
......
......@@ -895,7 +895,7 @@ bool PrintSumBillPosDB::insertOrderSumBill(OrderObject* orderObj, const QString&
// 与 oms协定此块业务出现 歧异 故在此处转换;
int tempBusinessType = orderObj->businessType.toInt();
if ( "WSG-MOD" == orderObj->channel && "4" == orderObj->platformSource) {
if ( ( "WSG-MOD" == orderObj->channel || "WSG-MOP" == orderObj->channel ) && "4" == orderObj->platformSource) {
if ( 1 == orderObj->isGiftitForward )
tempBusinessType = 21;
else
......@@ -917,7 +917,9 @@ bool PrintSumBillPosDB::insertOrderSumBill(OrderObject* orderObj, const QString&
query.addBindValue(tempAppointedRemindTemplate);
query.addBindValue(orderObj->orderType);
QString tempChannel = ("WSG-MOD" == orderObj->channel)?"MOD" :orderObj->channel;
QString tempChannel = ("WSG-MOD" == orderObj->channel) ? "MOD" : orderObj->channel;
tempChannel = ("WSG-MOP" == tempChannel ) ? "MOP" : tempChannel;
query.addBindValue(tempChannel);
query.addBindValue(orderObj->platformSource);
query.addBindValue(orderObj->payWay);
......@@ -1114,10 +1116,10 @@ int PrintSumBillPosDB::syncOrderTimeInfo(OrderObject* orderObj) {
if ( 3 == orderObj->inAdvanceTakemeal ) {
QSqlQuery updateQuery(m_sqlDb);
updateQuery.prepare(QString("update tb_msr_customer_info set appointed_remindTemplate='%1', appointed_time ='%4', reserve5='%2', reserve10='%5' "
updateQuery.prepare(QString("update tb_msr_customer_info set appointed_remindTemplate='%1', appointed_time ='%4', reserve5='%2', reserve9='%6', reserve10='%5' "
" where order_id='%3' and order_status !=6")
.arg(QString::number(orderObj->inAdvanceTakemeal) + ";" + orderObj->reserveMakeTime)
.arg(orderObj->lastExpectDate).arg(orderObj->id).arg(orderObj->expectDate).arg(orderObj->remindTicketTime) );
.arg(orderObj->lastExpectDate).arg(orderObj->id).arg(orderObj->expectDate).arg(orderObj->remindTicketTime).arg(orderObj->privacyPhone) );
if(!updateQuery.exec()) {
QLOG_ERROR()<<updateQuery.lastError().text()<<QString("[<<<<---DB::Sync OrderId %1 appointed* Time Failed--->>>>]").arg(orderObj->id);
syncRet= 0;
......@@ -1129,10 +1131,10 @@ int PrintSumBillPosDB::syncOrderTimeInfo(OrderObject* orderObj) {
} else if ( orderObj->inAdvanceTakemeal != tempRemindTemplate.toInt() ) {
QSqlQuery updateQuery(m_sqlDb);
updateQuery.prepare(QString("update tb_msr_customer_info set appointed_remindTemplate='%1', appointed_time ='%4', reserve5='%2' "
updateQuery.prepare(QString("update tb_msr_customer_info set appointed_remindTemplate='%1', appointed_time ='%4', reserve9='%5', reserve5='%2' "
" where order_id='%3' and order_status !=6")
.arg(QString::number(orderObj->inAdvanceTakemeal) + ";" + orderObj->reserveMakeTime)
.arg(orderObj->lastExpectDate).arg(orderObj->id).arg(orderObj->expectDate) );
.arg(orderObj->lastExpectDate).arg(orderObj->id).arg(orderObj->expectDate).arg(orderObj->privacyPhone) );
if(!updateQuery.exec()) {
QLOG_ERROR()<<updateQuery.lastError().text()<<QString("[<<<<---DB::Sync OrderId %1 appointed* Time Failed--->>>>]").arg(orderObj->id);
syncRet= 0;
......@@ -1175,9 +1177,9 @@ int PrintSumBillPosDB::updateOrderDataToDB(OrderObject* orderObj, const QString
if ( OrderObject::Refunded != orderObj->orderStatus && ( 7 == orderObj->orderType || 11 == orderObj->orderType ) && orderObj->inAdvanceTakemeal ) {
updateOrderTimeRet = updateOrderTimeInfo(orderObj);
QLOG_INFO()<<QString("[<<<<---updateOrderDataToDB OrderId: %1 ArriverAhead: %2 updateOrderTimeRet: %3 "
" reserveMakeTime:%4 lastExpectDate:%5 expectDate:%6 remindTicketTime:%7 --->>>>]")
" reserveMakeTime:%4 lastExpectDate:%5 expectDate:%6 remindTicketTime:%7 privacyPhone:%8 --->>>>]")
.arg(orderObj->id).arg(orderObj->inAdvanceTakemeal).arg(updateOrderTimeRet).arg(orderObj->reserveMakeTime).arg(orderObj->lastExpectDate)
.arg(orderObj->expectDate).arg(orderObj->remindTicketTime);
.arg(orderObj->expectDate).arg(orderObj->remindTicketTime).arg(orderObj->privacyPhone);
}
}
......@@ -1194,10 +1196,10 @@ bool PrintSumBillPosDB::updateOrderTimeInfo(OrderObject* orderObj) {
bool updateRet = false;
QSqlQuery query(m_sqlDb);
query.prepare(QString("update tb_msr_customer_info set appointed_remindTemplate='%1', appointed_time ='%4', reserve5='%2', reserve10='%5' "
query.prepare(QString("update tb_msr_customer_info set appointed_remindTemplate='%1', appointed_time ='%4', reserve5='%2', reserve9='%6', reserve10='%5' "
" where order_id='%3' and order_status !=6")
.arg(QString::number(orderObj->inAdvanceTakemeal) + ";" + orderObj->reserveMakeTime)
.arg(orderObj->lastExpectDate).arg(orderObj->id).arg(orderObj->expectDate).arg(orderObj->remindTicketTime) );
.arg(orderObj->lastExpectDate).arg(orderObj->id).arg(orderObj->expectDate).arg(orderObj->remindTicketTime).arg(orderObj->privacyPhone) );
if(!query.exec()) {
QLOG_ERROR()<<query.lastError().text()<<QString("[<<<<---SqlServer Database:update OrderId %1 appointed* Time Failed--->>>>]").arg(orderObj->id);
......
#include "saveNoticeMsgDB.h"
#include "QsLog.h"
#include <QDateTime>
#include "Control/flowControl.h"
SaveNoticeMsgDB::SaveNoticeMsgDB()
{
QLOG_INFO()<<"[<<<<---SaveNoticeMsgDB:: Structure POS Notice Message INFO DataBase--->>>>]";
}
bool SaveNoticeMsgDB::initSaveNoticeMsgDB(){
bool bRet = false;
m_sqlDb = QSqlDatabase::addDatabase("QODBC","SaveNoticeMsgDB"); //数据库驱动类型为SQL Server
if ( m_sqlDb.isValid() ) {
QLOG_INFO()<<"[<<<<---SqlServer ODBC driver is valid--->>>>]";
QString dsn="DRIVER={SQL SERVER};SERVER=127.0.0.1\\sqlexpress;DATABASE=MMXBenefits";
m_sqlDb.setDatabaseName(dsn); //设置数据源名称
m_sqlDb.setUserName("sa"); //登录用户
m_sqlDb.setPassword("SIM29@123");
if(!m_sqlDb.open()) { //打开数据库
QLOG_ERROR()<<"[<<<<---SqlServer Open Database error:--->>>>]"<<m_sqlDb.lastError().text();
} else {
QLOG_INFO()<<"[<<<<---SaveNoticeMsgDB::SqlServer Test Open database success!:--->>>>]";
QSqlQuery query(m_sqlDb);
QString selectsql ="select * from sys.tables where name='tb_notice_msg'" ;
if(!query.exec(selectsql)) {
QLOG_ERROR()<<"[<<<<---SaveNoticeMsgDB::SqlServer Database check tb_notice_msg failed--->>>>]"<<query.lastError().text();
}
if(query.next()) {
QLOG_INFO() << "[<<<<---SaveNoticeMsgDB::Table tb_notice_msg Has Exist--->>>>]";
bRet = true;
} else {
QLOG_INFO() << "[<<<<---SaveNoticeMsgDB::Table tb_notice_msg Does Not Exist--->>>>]";
query.prepare( QString("CREATE TABLE [dbo].[tb_notice_msg] ("
" [id] [int] IDENTITY(1,1) NOT NULL, "
" [title] [varchar](200) NULL, [content] [varchar](1200) NULL,"
" [create_datetime] [datetime] NULL, [modify_datetime] [datetime] NULL,"
" [reserve0] [int] NULL, [reserve1] [int] NULL,[reserve2] [int] NULL,"
" [reserve3] [varchar](100) NULL, [reserve4] [varchar](200) NULL,[reserve5] [varchar](400) NULL,"
" [reserve6] [int] NULL, [reserve7] [int] NULL, [reserve8] [varchar](80) NULL, [reserve9] [varchar](80) NULL"
" PRIMARY KEY CLUSTERED ( [id] ASC"
")WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = "
" OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]") );
if(!query.exec()){
QLOG_ERROR()<< "[<<<<---Create Table tb_notice_msg Faild--->>>>]" <<query.lastError().text()<<QString::number(query.lastError().type());
}else {
bRet = true;
}
}
QLOG_INFO()<<"[<<<<---SqlServer Test Open database success!:--->>>>]";
m_sqlDb.close();
}
} else {
QLOG_ERROR()<<"[<<<<---SqlServer ODBC driver no valid--->>>>]";
}
return bRet;
}
SaveNoticeMsgDB &SaveNoticeMsgDB::getInstance()
{
static SaveNoticeMsgDB saveNoticeMsgDB;
return saveNoticeMsgDB;
}
bool SaveNoticeMsgDB::insertNoticeMsg( NoticeObject* noticeObj ) {
QMutexLocker mutex(&m_mutex);
if(!m_sqlDb.open()) {
QLOG_ERROR()<<"[<<<<---SqlServer Database:Open Failed--->>>>]"<<m_sqlDb.lastError().text();
return false;
}
bool result = false;
QSqlQuery query(m_sqlDb);
query.prepare("INSERT INTO tb_notice_msg( title, content, create_datetime ) VALUES (?, ?, ?) ");
query.addBindValue( noticeObj->title ); // --通告标题;
query.addBindValue( noticeObj->content ); // --通告内容;
QDateTime qdaTi = QDateTime::currentDateTimeUtc();
QString createTime = qdaTi.addSecs(60*60*8).toString("yyyy-MM-dd hh:mm:ss");
query.addBindValue(createTime); // --通告创建时间;
if(!query.exec())
{
QLOG_ERROR()<<"[<<<<---SqlServer Database: tb_notice_msg Insert Error--->>>>]"<<query.lastError().text()<<QString::number(query.lastError().type());
QLOG_INFO()<<QString("INSERT INTO tb_notice_msg( title, content, create_datetime ) VALUES(%1, %2, %3) ").arg( noticeObj->title ).arg( noticeObj->content ).arg(createTime);
} else {
result = true;
QLOG_INFO()<<QString("[<<<<---SaveNoticeMsgDB::insertNoticeMsg Insert title: %1,content:%2 Into Success--->>>>]").arg( noticeObj->title ).arg( noticeObj->content );
}
m_sqlDb.close();
return result;
}
bool SaveNoticeMsgDB::updateNoticeMsg( NoticeObject* noticeObj ){
QMutexLocker mutex(&m_mutex);
if(!m_sqlDb.open()) {
QLOG_ERROR()<<"[<<<<---SqlServer Database:Open Failed--->>>>]"<<m_sqlDb.lastError().text();
return false;
}
// 同时更新 创建时间戳 ???????? ;
bool result;
QDateTime qdaTi = QDateTime::currentDateTimeUtc();
QString createTime = qdaTi.addSecs(60*60*8).toString("yyyy-MM-dd hh:mm:ss");
QSqlQuery query(m_sqlDb);
query.prepare( QString("update tb_notice_msg set content='%1', create_datetime='%2' where title='%3' ").arg( noticeObj->content ).arg(createTime).arg(noticeObj->title) );
if(!query.exec()) {
QLOG_ERROR()<<query.lastError().text()<<"[<<<<---SqlServer Database:update notice content Failed--->>>>]";
result= false;
} else {
QLOG_INFO()<<QString("[<<<<---SqlServer Database:Update notice->title: %1 Content success--->>>>]").arg(noticeObj->title);
result = true;
}
m_sqlDb.close();
return result;
}
bool SaveNoticeMsgDB::isNoticeMsgExist(NoticeObject* noticeObj){
QMutexLocker mutex(&m_mutex);
if(!m_sqlDb.open()) {
QLOG_ERROR()<<"[<<<<---SqlServer Database:Open Failed--->>>>]"<<m_sqlDb.lastError().text();
return false;
}
bool result;
QSqlQuery query(m_sqlDb);
query.prepare(QString("select top 1 content from tb_notice_msg where title='%1' order by create_datetime desc ").arg(noticeObj->title) );
if ( !query.exec() ) {
QLOG_ERROR()<<"[<<<<---SqlServer Database:: isNoticeMsgExist Failed--->>>>] noticeObj->title: "<< noticeObj->title <<query.lastError().text();
result= false;
}
if ( query.first() ) {
result= true;
} else {
result = false;
}
return result;
}
bool SaveNoticeMsgDB::deleteNoticeMsgRecord(QString creatTime)
{
//QMutexLocker mutex(&m_mutex);
bool retTryLock = m_mutex.tryLock(VALUE_TRYLOCKNETTIMEOUT);
if(!retTryLock){
QLOG_ERROR()<<"[<<<<---SaveNoticeMsgDB::delete notice msg Record Try Lock Failed--->>>>]";
return false;
}
if(!m_sqlDb.open()) {
QLOG_ERROR()<<"[<<<<---SaveNoticeMsgDB::delete notice msg Open Failed--->>>>]"<<m_sqlDb.lastError().text();
m_mutex.unlock();
return false;
}
bool result=true;
QLOG_INFO()<<QString("[<<<<---SaveNoticeMsgDB::begin delete notice msg create_datetime: %1--->>>>]").arg(creatTime);
QSqlQuery query(m_sqlDb);
query.prepare(QString("delete from tb_notice_msg where create_datetime < '%1' ").arg(creatTime));
if ( !query.exec() ) {
QLOG_ERROR()<<query.lastError().text()<<__FUNCTION__;
result= false;
}
m_sqlDb.close();
m_mutex.unlock();
return result;
}
#ifndef SAVENOTICEMSGDB_H
#define SAVENOTICEMSGDB_H
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlError>
#include <QObject>
#include <QMutex>
#include <Model/NoticeObject.h>
#include "preDefine.h"
#include "windows.h"
class SaveNoticeMsgDB : public QObject
{
Q_OBJECT
public:
// explicit SaveNoticeMsgDB(QObject *parent = 0);
static SaveNoticeMsgDB& getInstance();
/**
*功能:初始化pos本地数据库;方便后期判断 打开pos本地数据库是否成功;
*参数:[无]
*返回:true:能够成功打开POS本地数据库,false:不能够成功打开POS本地数据库
**/
bool initSaveNoticeMsgDB();
/**
*功能:插入一条 门店通告消息 到pos本地数据库中;
*参数:[1]通告对象指针
*返回:true操作成功,false失败
**/
bool insertNoticeMsg( NoticeObject* noticeObj );
/**
*功能: 根据门店通告对象指针 更新 pos本地数据库中 门店通告消息表中数据;
*参数:[1]门店通告消息
*返回:true操作成功,false失败
**/
bool updateNoticeMsg( NoticeObject* noticeObj );
/**
*功能:查询 门店通告消息记录 是否存在本地的POS系统中;
*参数:[1]门店通告消息指针
*返回:true: 存在,false: 不存在
**/
bool isNoticeMsgExist(NoticeObject* noticeObj);
/**
*功能:删除本地数据库中的 通告消息记录;
*参数:[1] 删除日期;
*返回:true 删除成功,false 删除失败;
**/
bool deleteNoticeMsgRecord(QString creatTime);
private:
QMutex m_mutex;
SaveNoticeMsgDB();
SaveNoticeMsgDB(SaveNoticeMsgDB const&);
SaveNoticeMsgDB& operator=(SaveNoticeMsgDB const&);
QSqlDatabase m_sqlDb;
signals:
public slots:
};
#endif // SAVENOTICEMSGDB_H
#include "NoticeObject.h"
NoticeObject::NoticeObject(const NoticeObject &noticeObj, QObject *parent):QObject(parent)
{
const QMetaObject *m = noticeObj.metaObject();
for( int i=m->propertyOffset(); i<m->propertyCount(); i++)
{
QMetaProperty qmp = m->property(i);
QString key = QString::fromLatin1(qmp.name());
QVariant value = noticeObj.property(key.toUtf8());
this->setProperty(key.toUtf8(), value);
}
}
NoticeObject& NoticeObject::operator =(const NoticeObject& noticeObj)
{
const QMetaObject *m = noticeObj.metaObject();
for( int i=m->propertyOffset(); i<m->propertyCount(); i++)
{
QMetaProperty qmp = m->property(i);
QString key = QString::fromLatin1(qmp.name());
QVariant value = noticeObj.property(key.toUtf8());
this->setProperty(key.toUtf8(), value);
}
return *this;
}
void NoticeObject::FetchDataFromJson(const QJsonObject &json)
{
foreach(QString key, json.keys())
{
setProperty(key.toUtf8(), json[key].toVariant());
}
return;
}
#ifndef NOTICEOBJECT_H
#define NOTICEOBJECT_H
#include <QObject>
#include <QJsonObject>
#include <QVariant>
#include <QMetaProperty>
class NoticeObject : public QObject
{
Q_OBJECT
Q_PROPERTY (QString title READ getTitle WRITE setTitle)
Q_PROPERTY (QString content READ getContent WRITE setContent)
public:
explicit NoticeObject(QObject *parent = 0):QObject(parent){}
NoticeObject(const NoticeObject& noticeObj,QObject* parent=0);
NoticeObject& operator =(const NoticeObject& noticeObj);
void FetchDataFromJson(const QJsonObject &json);
QString title;
QString content;
protected:
inline QString getTitle(){ return title; }
inline void setTitle(const QString& v){ title = v; }
inline QString getContent(){ return content; }
inline void setContent(const QString& v){ content = v; }
};
#endif // NOTICEOBJECT_H
......@@ -275,7 +275,14 @@ QString OrderObject::getChannelName()
if ( 1 == isGiftitForward ) {
return QString::fromLocal8Bit("美好咖啡");
} else {
return QString::fromLocal8Bit("微信用星说");
return QString::fromLocal8Bit("用星说");
}
} else if ("WSG-MOP" == channel) {
if ( 1 == isGiftitForward ) {
return QString::fromLocal8Bit("美好咖啡");
} else {
return QString::fromLocal8Bit("WSG-MOP");
}
} else if ("ELE" == channel) {
......@@ -309,6 +316,15 @@ QString OrderObject::getChannelName()
}
}
} else if ( "MT-MOP" == channel ) {
if ( 7 == orderType ) {
return QString::fromLocal8Bit("预-美团-当日");
} else if ( 11 == orderType ) {
return QString::fromLocal8Bit("预-美团-隔日");
} else {
return QString::fromLocal8Bit("美团-MOP");
}
} else if ( "EC-MOP" == channel ){
return QString::fromLocal8Bit("电商MOP");
} else{
......
......@@ -65,11 +65,17 @@ void AlertForm::SetContent(AlertForm::Type type, const QString &msg)
ui->alertLabWarn->show();
ui->alertLabError->hide();
break;
case ACK_MSG:
ui->alertBtnOk->show();
ui->alertLabOk->hide();
ui->alertLabIng->hide();
ui->alertLabWarn->show();
ui->alertLabError->hide();
break;
}
if ( type == WARNNING ) {
ui->alertLabMsg->hide();
QStringList mopExceptInfoList = msg.split(';');
if ( mopExceptInfoList.size() >4 ) {
ui->alertLabWarn1->setText( mopExceptInfoList[0] );
......@@ -108,6 +114,14 @@ void AlertForm::SetContent(AlertForm::Type type, const QString &msg)
ui->alertLabMsg->setText(msg);
}
} else if ( type == ACK_MSG) {
ui->alertLabWarn_space->hide();
ui->alertLabWarn1->hide();
ui->alertLabWarn2->hide();
ui->alertLabWarn3->hide();
ui->alertLabWarn4->hide();
ui->alertLabWarn5->hide();
ui->alertLabMsg->hide();
} else {
ui->alertLabWarn_space->hide();
ui->alertLabWarn1->hide();
......@@ -118,7 +132,7 @@ void AlertForm::SetContent(AlertForm::Type type, const QString &msg)
ui->alertLabMsg->setText(msg);
}
if ( type == WARNNING ) {
if ( type == WARNNING || type == ACK_MSG ) {
m_timer->stop();
} else if ( type == BRIEF_TIPS ) {
if(!m_timer->isActive() )
......
......@@ -25,7 +25,8 @@ public:
LOADING,
BRIEF_TIPS,
SYNCDATA,
WARNNING
WARNNING,
ACK_MSG
}Type;
/* 功能:设置显示内容
......
......@@ -79,7 +79,10 @@ SOURCES += main.cpp\
refuseForm.cpp \
RejectForm.cpp \
settingForm.cpp \
DTools/checkPoskeyExistPosDB.cpp
DTools/checkPoskeyExistPosDB.cpp \
noticeForm.cpp \
DTools/saveNoticeMsgDB.cpp \
Model/NoticeObject.cpp
HEADERS += \
Control/flowControl.h \
......@@ -140,7 +143,10 @@ HEADERS += \
refuseForm.h \
RejectForm.h \
settingForm.h \
DTools/checkPoskeyExistPosDB.h
DTools/checkPoskeyExistPosDB.h \
noticeForm.h \
DTools/saveNoticeMsgDB.h \
Model/NoticeObject.h
FORMS += mainForm.ui \
alertForm.ui \
......@@ -157,7 +163,8 @@ FORMS += mainForm.ui \
disTabWdg.ui \
refdishesForm.ui \
refuseForm.ui \
dailyreportForm.ui
dailyreportForm.ui \
noticeForm.ui
RC_FILE += fmTakeout.rc
......
......@@ -7,8 +7,8 @@ IDI_ICON ICON DISCARDABLE "logo.ico"
#endif
VS_VERSION_INFO VERSIONINFO
//***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***//
FILEVERSION 2,2022,1,18
PRODUCTVERSION 2,2022,1,18
FILEVERSION 2,2022,3,3
PRODUCTVERSION 2,2022,3,3
//*************************************************************************//
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
......@@ -31,8 +31,8 @@ VS_VERSION_INFO VERSIONINFO
VALUE "OriginalFilename", "fmTakeout.exe"
VALUE "ProductName", "Delivery Order Plugin"
//***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***//
VALUE "ProductVersion", "2.2022.1.18"
VALUE "FileVersion", "2.2022.1.18"
VALUE "ProductVersion", "2.2022.3.3"
VALUE "FileVersion", "2.2022.3.3"
//*************************************************************************//
END
END
......
......@@ -31,6 +31,7 @@ MainForm::MainForm(QWidget *parent) :
// 注册信号槽参数
qRegisterMetaType<AlertForm::Type>("AlertForm::Type");
qRegisterMetaType<NoticeForm::Type>("NoticeForm::Type");
qRegisterMetaType<dishesObject>("dishesObject");
qRegisterMetaType< QMap< QString, QMultiMap<QString, dishesObject> > >("QMap<QString, QMultiMap<QString, dishesObject>>");
......@@ -50,6 +51,7 @@ MainForm::MainForm(QWidget *parent) :
connect(&FlowControl::GetInstance(), &FlowControl::showDailyReportData, this, &MainForm::onSetDailyReportData);
connect(&FlowControl::GetInstance(), &FlowControl::hideAlert, this, &MainForm::onHideAlert);
connect(&FlowControl::GetInstance(), &FlowControl::showAlert, this, &MainForm::onShowAlert);
connect(&FlowControl::GetInstance(), &FlowControl::showNotice, this, &MainForm::onShowNotice);
connect(&FlowControl::GetInstance(), &FlowControl::setOpeStatus, this, &MainForm::onSetOpeStatus);
connect(&FlowControl::GetInstance(), &FlowControl::setNetStatus, this, &MainForm::onSetNetStatus);
connect(&FlowControl::GetInstance(), &FlowControl::setStoreInfo, this, &MainForm::onSetStoreInfo);
......@@ -85,12 +87,11 @@ void MainForm::MyShow()
// 考虑到坐标问题放到这里构建
m_alertForm = new AlertForm(this);
m_noticeForm = new NoticeForm(this);
m_settingForm = new SettingForm(this);
m_detailForm = new DetailForm(this);
m_padForm = new PadForm(this);
m_padForm->move(pos().x()+width()-300, pos().y()+height()-438);
m_padForm->hide();
connect(m_padForm, &PadForm::numClicked, this, &MainForm::onNumClicked);
......@@ -170,6 +171,7 @@ void MainForm::_Init()
m_prevTable = ui->mainTableNew;
m_currentTable = ui->mainTableNew;
ui->mainBtnSet->hide();
ui->mainTableNotice->hide();
// 特别处理点击表中排序问题;
_TableWidgetHeaderClickConnect();
......@@ -232,10 +234,15 @@ void MainForm::on_mainBtnHide_clicked()
QLOG_INFO() << QString("[<<<<---MainForm::on_mainBtnHide_clicked: m_detailForm=--->>>>]")<< m_detailForm;
m_detailForm->hideDetailAllFrom();
}
if (m_alertForm) {
m_alertForm->hide();
}
if ( m_noticeForm ) {
m_noticeForm->hide();
}
emit showFloatForm();
}
......@@ -355,7 +362,7 @@ void MainForm::onShowAlert(AlertForm::Type type, const QString &msg)
{
m_alertForm->SetContent(type, msg);
m_alertForm->show();
}else if( AlertForm::WARNNING ==type ) {
}else if ( AlertForm::WARNNING ==type || AlertForm::ACK_MSG ==type ) {
emit hideFloatForm();
this->show();
m_alertForm->SetContent(type, msg);
......@@ -363,6 +370,27 @@ void MainForm::onShowAlert(AlertForm::Type type, const QString &msg)
}
}
void MainForm::onHideNotice()
{
m_noticeForm->hide();
}
void MainForm::onShowNotice ( NoticeForm::Type type, const QString &title, const QString &content)
{
QLOG_INFO() << QString("[<<<<---MainForm::onShowNotice: title:%1, content:%2 --->>>>]").arg(title).arg(content);
if ( m_noticeForm->isVisible() ) {
// emit hideFloatForm();
// this->show();
m_noticeForm->SetContent(type, title, content);
m_noticeForm->show();
} else {
m_noticeForm->SetContent(type, title, content);
m_noticeForm->show();
}
}
void MainForm::onSetStoreInfo(const QString &storeId)
{
ui->mainLabStoreid->setText(storeId);
......
......@@ -4,6 +4,7 @@
#include <QDialog>
#include <QTableWidget>
#include "alertForm.h"
#include "noticeForm.h"
#include "Model/orderObject.h"
#include "settingForm.h"
#include "detailForm.h"
......@@ -47,6 +48,8 @@ private:
// 通知窗口
AlertForm *m_alertForm;
// 门店通告展示窗口
NoticeForm *m_noticeForm;
// 设置窗口
SettingForm *m_settingForm;
// 订单详情窗口
......@@ -279,11 +282,26 @@ public slots:
* 返回:NULL
* */
void onHideAlert();
/* 功能:显示通知窗口
* 参数:[1]窗口类型[2]显示信息
* 返回:NULL
* */
void onShowAlert(AlertForm::Type type, const QString& msg);
/* 功能:隐藏门店通告展示窗口
* 参数:NULL
* 返回:NULL
* */
void onHideNotice();
/* 功能:显示门店通告展示窗口
* 参数:[1]窗口类型[2]显示信息
* 返回:NULL
* */
void onShowNotice(NoticeForm::Type type, const QString& title, const QString& content);
/* 功能:设置门店信息
* 参数:[1]门店编号
* 返回:NULL
......
......@@ -1306,6 +1306,16 @@
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="mainTableNotice">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>68</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
......
#include "noticeForm.h"
#include "ui_noticeForm.h"
NoticeForm::NoticeForm(QWidget *parent) :
QDialog(parent),
ui(new Ui::NoticeForm)
{
ui->setupUi(this);
m_timer =new QTimer(this);
m_timer->setSingleShot(true);
connect(m_timer,&QTimer::timeout,this,&NoticeForm::hideForm);
_Init();
}
NoticeForm::~NoticeForm()
{
delete ui;
}
void NoticeForm::SetContent(NoticeForm::Type type, const QString &title, const QString &msg)
{
switch(type)
{
case SUCCESS:
case MSGERROR:
case LOADING:
case BRIEF_TIPS:
case SYNCDATA:
case WARNNING:
break;
case ACK_MSG:
ui->noticeBtnOk->show();
ui->noticeLabOk->hide();
ui->noticeLabIng->hide();
ui->noticeLabWarn->show();
ui->noticeLabError->hide();
break;
}
if ( type == WARNNING ) {
} else if ( type == ACK_MSG) {
QStringList msgInfoList = msg.split('^');
QString noticeTitle = title;
QString noticeContent = msgInfoList.join("\n");
ui->noticeTitleLab->setText(noticeTitle);
ui->noticeTitleLab->setAlignment(Qt::AlignLeft);
QFont font1 ( "Microsoft YaHei", 16, QFont::Bold);
ui->noticeTitleLab->setFont(font1);
QPalette palette1;
palette1.setColor(QPalette::WindowText,Qt::red);
ui->noticeTitleLab->setPalette(palette1);
ui->noticeTitleLab->show();
ui->noticeLabWarn_textBs->clear();
ui->noticeLabWarn_textBs->setText(noticeContent);
ui->noticeLabWarn_textBs->setAlignment(Qt::AlignLeft);
// ui->noticeLabWarn_textBs->resize(800,600);
//ui->alertLabWarn_textBs->move(10,11);
QFont font2 ( "Microsoft YaHei", 14, QFont::Bold);
ui->noticeLabWarn_textBs->setFont(font2);
QPalette palette2;
palette2.setColor(QPalette::WindowText,Qt::black);
ui->noticeLabWarn_textBs->setPalette(palette2);
ui->noticeLabWarn_textBs->show();
} else {
ui->noticeLabWarn_textBs->hide();
ui->noticeTitleLab->hide();
}
if ( type == WARNNING || type == ACK_MSG ) {
m_timer->stop();
} else if ( type == BRIEF_TIPS ) {
if(!m_timer->isActive() )
m_timer->start(3000);
} else {
if(!m_timer->isActive() )
m_timer->start(20000);
}
return;
}
void NoticeForm::_Init()
{
setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint);
setAttribute(Qt::WA_TranslucentBackground);
this->setModal(true);
// 初始化Gif动画
m_movie = new QMovie(this);
m_movie->setFileName(":loading.gif");
ui->noticeLabIng->setMovie(m_movie);
ui->noticeLabIng->setScaledContents(true);
m_movie->start();
ui->noticeLabOk->hide();
ui->noticeLabIng->hide();
ui->noticeLabError->hide();
// ui->noticeLabWarn->hide();
}
void NoticeForm::hideForm()
{
this->hide();
}
void NoticeForm::on_noticeBtnOk_clicked()
{
this->hide();
return;
}
#ifndef NOTICEFORM_H
#define NOTICEFORM_H
// 通知窗口
#include <QDialog>
#include <QMovie>
#include <QTimer>
namespace Ui {
class NoticeForm;
}
class NoticeForm : public QDialog
{
Q_OBJECT
public:
explicit NoticeForm(QWidget *parent = 0);
~NoticeForm();
typedef enum
{
SUCCESS=0,
MSGERROR,
LOADING,
BRIEF_TIPS,
SYNCDATA,
WARNNING,
ACK_MSG
}Type;
/* 功能:设置显示内容
* 参数:[1]窗体类型[2]信息内容
* 返回:NULL
* */
void SetContent(NoticeForm::Type type, const QString& title, const QString& msg);
private:
QTimer *m_timer;
Ui::NoticeForm *ui;
// 动画对象
QMovie *m_movie;
/* 功能:初始化
* 参数:NULL
* 返回:NULL
* */
void _Init();
void hideForm();
private slots:
void on_noticeBtnOk_clicked();
};
#endif // NOTICEFORM_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NoticeForm</class>
<widget class="QDialog" name="NoticeForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>800</width>
<height>600</height>
</size>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QWidget" name="noticeWdg" native="true">
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0">
<property name="spacing">
<number>5</number>
</property>
<property name="topMargin">
<number>25</number>
</property>
<property name="bottomMargin">
<number>25</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="noticeLabError">
<property name="minimumSize">
<size>
<width>68</width>
<height>68</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>68</width>
<height>68</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="noticeLabIng">
<property name="minimumSize">
<size>
<width>68</width>
<height>68</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>68</width>
<height>68</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="noticeLabWarn">
<property name="minimumSize">
<size>
<width>68</width>
<height>68</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>68</width>
<height>68</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="noticeLabOk">
<property name="minimumSize">
<size>
<width>68</width>
<height>68</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>68</width>
<height>68</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="noticeTitleLab">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTextBrowser" name="noticeLabWarn_textBs"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="noticeBtnOk">
<property name="minimumSize">
<size>
<width>80</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>40</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>确 认</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -41,7 +41,8 @@
//#define APP_VERSION "2.2021.9.7"
//#define APP_VERSION "2.2021.9.24"
//#define APP_VERSION "2.2021.12.20"
#define APP_VERSION "2.2022.1.18"
//#define APP_VERSION "2.2022.1.18"
#define APP_VERSION "2.2022.3.3"
//修正版本号时,切记修正 FmTakeout.rc 中的版本号
......@@ -97,6 +98,8 @@
#define JSON_MODSTORESTS "modStoreStatus"
#define JSON_MOPSTORESTS "mopStoreStatus"
#define JSON_MTMODSTORESTS "mtModStoreStatus"
#define JSON_NOTICE_TITLE "noticeTitle"
#define JSON_NOTICE_CONTENT "noticeContent"
#define JSON_SKIPRECORDPOS "skipRecord"
#define JSON_PASSWORD "password"
#define JSON_IPADDRESS "iPAddress"
......@@ -315,4 +318,12 @@
#define OPENSTORE 1
#define CLOSESTORE 2
// o2ofulfillment 履约服务 CallBackUrl 地址;
#define GET_O2OFULFILLMENT_STG_CBL "https://o2ofulfillment.stg.starbucks.net/fulfillment/pos"
#define GET_O2OFULFILLMENT_PRO_CBL "https://o2ofulfillment.starbucks.net/fulfillment/pos"
#define GET_O2OFULFILLMENT_UAT_CBL "https://o2ofulfillment.uat.starbucks.net/fulfillment/pos"
#define GET_O2OFULFILLMENT_DEV_CBL "https://o2ofulfillment.dev.starbucks.net/fulfillment/pos"
#define GET_O2OFULFILLMENT_GRAY_CBL "https://o2ofulfillment.gray.starbucks.net/fulfillment/pos"
#endif // PREDEFINE_H
......@@ -576,6 +576,44 @@ QTabBar QToolButton::left-arrow:disabled {
}
/*---------------------------------alertForm[ end ]---------------------------------*/
/*---------------------------------noticeForm[begin]---------------------------------*/
#noticeWdg
{
border-image: url(:alert_bg.png);
}
#noticeLabError
{
border-image: url(:error.png);
}
#noticeLabOk
{
border-image: url(:ok.png);
}
#noticeLabWarn
{
border-image: url(:warn.png);
}
#noticeTitleLab
{
color: rgb(129, 129, 129);
}
#noticeBtnOk
{
color: #878787;
background-color: #ffffff;
border: 1px solid #878787;
border-radius: 4px;
}
#noticeBtnOk:pressed
{
color: #3de17b;
background-color: #ffffff;
border: 1px solid #3de17b;
border-radius: 4px;
}
/*---------------------------------noticeForm[ end ]---------------------------------*/
/*---------------------------------DetailForm[begin]---------------------------------*/
#DetailForm
{
......
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