Commit 0eb226bd by wuyang.zou

New Feature: 1、PosPlugin 自动获取门店号&工作站后自动登录

2、PosPlugin 支持现有订单补打功能

Version: 2.2022.10.20
parent 5eaa8db0
Pipeline #41694 failed with stage
in 0 seconds
......@@ -21,6 +21,7 @@ SocketCommunicate::SocketCommunicate(ThreadSocket *parent) : ThreadSocket(parent
_macAddress = "";
_hostName = "";
_workStationNum = "";
_backupPos = false;
_localIp = "";
_localPort = 24409;
_httpLoginResult = false;
......@@ -194,6 +195,7 @@ bool SocketCommunicate::connectTcpSvr()
tmpMap.insert(JSON_TCP_DEVICE_ID , _macAddress);
tmpMap.insert(JSON_TCP_DEVICE_HOST_NAME , _hostName);
tmpMap.insert(JSON_TCP_DEVICE_WORKS_NUM , _workStationNum);
tmpMap.insert(JSON_POS_BACKUP_PC, _backupPos);
tmpMap.insert(JSON_TCP_DEVICE_IP , _localIp);
tmpMap.insert(JSON_TCP_DEVICE_PORT , _localPort);
tmpMap.insert(JSON_TCP_DEVICE_TYPE , "posPlugin");
......@@ -763,9 +765,10 @@ bool SocketCommunicate::GetSvrIpPort()
void SocketCommunicate::onFlowControlLoginSuccess(bool fcLoginResult, bool fcOpenTcpFlag, QString &storeId, QString &posIp, QString &posHostName, QString &posWorkStationNum) {
// 只有 FlowControl Http 登录成功后, FlowControl 才会发生信号 过来(跨线程);
// 只有 FlowControl Http 登录成功后, FlowControl 才会发送信号过来(跨线程);
// 存在一定概率出现跨线程 发送信号 失败;
QLOG_INFO() << QString("SocketCommunicate::onFlowControlLoginSuccess:: fcLoginResult: %1, fcOpenTcpFlag: %2 , storeId: %3 , posIp: %4 , posHostName: %5 , posWorkStationNum: %6")
QLOG_INFO() << QString("SocketCommunicate::onFlowControlLoginSuccess:: fcLoginResult: %1, fcOpenTcpFlag: %2, "
" storeId: %3, posIp: %4, posHostName: %5, posWorkStationNum: %6")
.arg( fcLoginResult?1:0 ).arg( fcOpenTcpFlag?1:0 ).arg( storeId ).arg( posIp ).arg( posHostName ).arg(posWorkStationNum);
_httpLoginResult = fcLoginResult;
_openTcpChannel = fcOpenTcpFlag;
......@@ -774,6 +777,11 @@ void SocketCommunicate::onFlowControlLoginSuccess(bool fcLoginResult, bool fcOpe
_hostName = posHostName;
_workStationNum = posWorkStationNum;
_localIp = posIp;
// CNSHBK01S00000(国家+城市+BK01+S+5位店号)其中的BK01代表PC
// _hostName..contains("BK01",Qt::CaseInsensitive)
if ( _hostName.indexOf("BK01",Qt::CaseInsensitive) > 2 ) {
_backupPos = true;
}
}
......@@ -791,7 +799,7 @@ void SocketCommunicate::threadStart()
QLOG_INFO() << QString("Waitting HttpLogin / openTcpChannel / GetSvrIpPort Failed, Wait 60 Seconds, _httpLoginResult:%1, _openTcpChannel:%2, _stopFlag:%3")
.arg( _httpLoginResult?1:0 ).arg(_openTcpChannel?1:0).arg(_stopFlag?1:0);
Sleep(60*1000);
FlowControl::GetInstance()._GetFcMajorInfo(_httpLoginResult, _openTcpChannel, _storeId, _localIp, _hostName,_workStationNum);
FlowControl::GetInstance()._GetFcMajorInfo(_httpLoginResult, _openTcpChannel, _storeId, _localIp, _hostName,_workStationNum,_backupPos);
}
// <2> 向目标 IP + 端口发起长连接 与 登录请求, 登录成功后接受 Server Response Msg;
......
......@@ -158,6 +158,8 @@ public:
QString _hostName;
// WorkStation Id POS工作站编号;
QString _workStationNum;
// Backup POS 机器(无显示器,后台运行的POS机);
bool _backupPos;
// Pos Local Machine IP;
QString _localIp;
// Pos Plugin Server Port;
......@@ -369,8 +371,6 @@ 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 */
QLOG_INFO() << "getJsonFormatLoginReq:: "<< json;
return true;
}
......
......@@ -79,6 +79,7 @@ FlowControl::FlowControl()
m_existNoAckNotice = 0;
//初始化上次心跳状态是否异常(false:代表心跳正常 | true:代表心跳异常);
m_bLastHeartIsError = false;
m_backupPosFlag = false; // 初始化备机POS标志为 false;
m_loginSocket = NULL;
m_pullOrderSocket = NULL;
......@@ -187,13 +188,20 @@ void FlowControl::_GetIpAddress()
QHostInfo info = QHostInfo::fromName(QHostInfo::localHostName());
m_posHostName = info.hostName();
QLOG_INFO()<<QString("[<<<<---FlowControl::_GetIpAddress HostName:%1--->>>>]").arg(m_posHostName);
// CNSHBK01S00000(国家+城市+BK01+S+5位店号)其中的BK01代表PC
// m_posHostName..contains("BK01",Qt::CaseInsensitive)
if ( m_posHostName.indexOf("BK01",Qt::CaseInsensitive) > 2 ) {
m_backupPosFlag = true;
}
foreach(QHostAddress address,info.addresses()) {
if(address.protocol() == QAbstractSocket::IPv4Protocol) {
QLOG_INFO()<<QString("[<<<<---FlowControl::_GetIpAddress getFromLocalHostName:%1--->>>>]").arg(address.toString());
QLOG_INFO()<<QString("[<<<<---FlowControl::_GetIpAddress IP:%1--->>>>]").arg(address.toString());
//1.1.1.1 > length > 7
if(address.toString().length()>7 && address.toString()!= "127.0.0.1" ) {
ipAddress=address.toString();
QLOG_INFO()<<QString("[<<<<---FlowControl::_GetIpAddress Request Real ipAddress: %1 hostName: %2 macAddress: %3 --->>>>]")
QLOG_INFO()<<QString("[<<<<---FlowControl::_GetIpAddress Real Right ipAddress: %1 hostName: %2 macAddress: %3 --->>>>]")
.arg(ipAddress).arg(m_posHostName).arg(m_posMacAddress);
break;
}
......@@ -307,9 +315,17 @@ void FlowControl::_ClickToLogin()
QLOG_INFO()<<QString::fromLocal8Bit("[<<<<---触发按钮点击事件:_ClickToLogin: m_bLoginResult:%1 --->>>>>]").arg(m_bLoginResult);
if(!m_bLoginResult)
{
QLOG_INFO()<<QString::fromLocal8Bit("[<<<<---触发按钮点击事件:FM外卖插件10s后再次尝试登陆--->>>>]");
_ClickOMSAssignArea();
}else{
// 先获取 posHostName; 识别是否 backup-pc机;
_GetIpAddress();
if ( m_backupPosFlag ) {
_AutoLoginSkipCashier();
} else {
QLOG_INFO()<<QString::fromLocal8Bit("[<<<<---触发按钮点击事件:FM外卖插件10s后再次尝试登陆--->>>>]");
_ClickOMSAssignArea();
}
} else {
m_loginTimer->start(1000*60);
}
}
......@@ -848,6 +864,7 @@ void FlowControl::_OrderAnalysis(const QJsonObject& jsonObject)
orderObject->callBackUrl = "";
orderObject->skipPrint = false;
orderObject->privacyPhone = "";
orderObject->backupPosFlag = m_backupPosFlag;
orderObject->FromJson(jsonObject);
......@@ -1140,31 +1157,25 @@ void FlowControl::onGetNewStoreInfo()
m_procOrderSocket = new BillSocket(this);
m_pullDishesSocket = new BillSocket(this);
m_pullOrderListSocket = new BillSocket(this);
_GetStoreInfo();
_Login();
m_bFirstRecvInfo =false;
return ;
}
//鸡肋:没有用到此函数的实际功能【仅仅用来获取门店登陆用的密码:m_password】;
bool FlowControl::_GetStoreInfo()
{
bool result=true;
emit showAlert(AlertForm::LOADING, QString::fromLocal8Bit("正在获取门店信息......"));
QLOG_INFO() << QString("[<<<<---Get StoreInfo--->>>>]");
QString tmp;
ConfigManger::GetInstance().GetStoreInfo(tmp/*, m_posId, m_cashierId*/, m_password);
return result;
ConfigManger::GetInstance().GetStoreInfo(tmp, m_password);
_Login();
m_bFirstRecvInfo =false;
return ;
}
void FlowControl::_GetFcMajorInfo(bool &loginResult, bool &openTcpChannel, QString &storeId, QString &posIp, QString &posHostName, QString &posWorkStationNum){
void FlowControl::_GetFcMajorInfo(bool &loginResult, bool &openTcpChannel, QString &storeId, QString &posIp, QString &posHostName, QString &posWorkStationNum, bool &backupPos) {
loginResult = m_bLoginResult;
openTcpChannel = m_openTcpChannel;
storeId = m_storeId;
posIp = m_ipAddress;
posHostName = m_posHostName;
posWorkStationNum = m_posWorkstationNum;
backupPos = m_backupPosFlag;
}
......@@ -1194,19 +1205,18 @@ bool FlowControl::_Login()
QJsonObject recvJson;
//获取POS机的 [IP地址] + [IP+PORT地址] -> 更新到成员变量:m_ipAddress, m_ipPortAddress;
//必须在登录请求的时候才能去实时获取POS的IP地址;否则可能会出现 127.0.0.1的情况出现;
//必须在登录请求的时候才能去实时获取POS的IP地址;否则可能会出现 127.0.0.1的情况出现; 插件未登录前就接受请求会出现 m_backupPosFlag 未及时更新;
_GetIpAddress();
m_existNoAckNotice = SaveNoticeMsgDB::getInstance().existNoAckNotice() ? 1 : 0;
m_subStoreId = ConfigManger::GetInstance().GetSubStoreId();
// 跳过 校验配置 子门店 与 母门店的前三位是否一致;增加安全保护机制 (同时实现参数可控 校验功能 );
if ( ConfigManger::GetInstance().GetSubStoreSkipVerify() ) {
m_storeId = m_subStoreId.length()?m_subStoreId:m_storeId;
m_storeId = m_subStoreId.length() ? m_subStoreId : m_storeId;
} else {
m_storeId = (m_subStoreId.length() && m_subStoreId.left(3) == m_storeId.left(3) )?m_subStoreId:m_storeId;
m_storeId = (m_subStoreId.length() && m_subStoreId.left(3) == m_storeId.left(3) ) ? m_subStoreId : m_storeId;
}
m_existNoAckNotice = SaveNoticeMsgDB::getInstance().existNoAckNotice() ? 1 : 0;
m_puginVersionComments = ConfigManger::GetInstance().GetOrderServerUrl();
sendJson = DataManger::GetInstance().GetLoginData(ConfigManger::GetInstance().GetPartnerId(),m_storeId,
m_password, m_posId, m_cashierId, m_ipPortAddress, m_puginVersionComments);
......@@ -1215,12 +1225,12 @@ bool FlowControl::_Login()
sendJson.insert(JSON_POS_WORKS_NUM, m_posWorkstationNum);
sendJson.insert(JSON_POS_HOST_NAME, m_posHostName);
sendJson.insert(JSON_POS_MAC_ADDRESS, m_posMacAddress);
sendJson.insert(JSON_POS_BACKUP_PC, m_backupPosFlag);
emit showAlert(AlertForm::LOADING, QString::fromLocal8Bit("正在登录......"));
if ( ConfigManger::GetInstance().GetLoginSslConfig() ) {
m_loginSocket->SetSslConfig();
QLOG_INFO() << QString("[<<<<---_Login Set ssl Config--->>>>]");
}
// 如果前3次使用初始地址登录失败 3 次, 则切换使用 备用地址 再尝试3次, 合计超过6次,则切回初始地址继续登录;
......@@ -1621,6 +1631,7 @@ bool FlowControl::_SendHeart()
sendJson.insert(JSON_POS_WORKS_NUM, m_posWorkstationNum);
sendJson.insert(JSON_POS_HOST_NAME, m_posHostName);
sendJson.insert(JSON_POS_MAC_ADDRESS, m_posMacAddress);
sendJson.insert(JSON_POS_BACKUP_PC, m_backupPosFlag);
// 如果前3次使用初始地址心跳失败 3 次, 则切换使用 备用地址 再尝试3次, 合计超过6次,则切回初始地址继续心跳;
if ( m_serviceCallBackUrl.length() && m_sendHeartErrorCount > 2 && m_sendHeartErrorCount < 6 ) {
......@@ -1635,7 +1646,7 @@ bool FlowControl::_SendHeart()
QLOG_INFO() << QString("[<<<<---Send Heart--->>>>][Url: %1, RequestData: ]").arg(url) << sendJson;
result = m_loginSocket->PostRequest(sendJson, recvJson, error);
QLOG_INFO() << QString("[<<<<---Send Heart Finish--->>>>][result:%1][msg:%2][recvData:%3]").arg(result).arg(error)<<recvJson;
QLOG_INFO() << QString("[<<<<---Send Heart Finish--->>>>][result:%1][msg:%2][recvData:]").arg(result).arg(error)<<recvJson;
if ( !result ) {
m_bLastHeartIsError = true;
......@@ -1872,6 +1883,7 @@ void FlowControl::_ReportOMSRecordOrderInfo()
sendJson.insert(JSON_POS_MAC_ADDRESS, m_posMacAddress);
sendJson.insert(JSON_POS_PLUGIN_VERSION, RepOMSRecOrderIn->posPluginVersion);
sendJson.insert(JSON_TCP_DEVICE_TYPE , "posPlugin");
sendJson.insert(JSON_POS_BACKUP_PC, m_backupPosFlag);
QLOG_INFO() << QString("[<<<<---_ReportOMSRecordOrderInfo:Begin--->>>>][requestData:%1]")<<sendJson;
// 查找到 orderObject point 后,查找到 callBackUrl ;
......@@ -2331,10 +2343,10 @@ bool FlowControl::_ResponseHttpRequest(const QJsonObject &content,QJsonObject &d
result=_ResponseSimphony01Request(content,data,error);
break;
case 2://simphony确认接单
result=_ResponseSimphony02Request(content,data,error);
result=true;
break;
case 3://simphony取消接单
result=_ResponseSimphony03Request(content,data,error);
result=true;
break;
case 4://simphony汇报小票号信息回复
result=_ResponseSimphony04Request(content,data,error);
......@@ -2374,15 +2386,24 @@ bool FlowControl::_ResponseSimphony01Request(const QJsonObject &content, QJsonOb
{
QLOG_INFO()<<__FUNCTION__;
bool result=true;
// 优先判断此POS机是否是备机
if ( m_backupPosFlag ) {
error = QString("Pos Is Backup PC, No Need Simulator Input Simphony, HostName: %1 simValidOrdersList.size: %2").arg( m_posHostName ).arg( m_simValidOrdersList.size() );
m_simValidOrdersList.isEmpty() ? 1 : m_simValidOrdersList.removeFirst();
QLOG_INFO()<< error;
return result;
}
if(!m_bLoginResult&&content.contains("storeId")) {
result=_ResponseSimReqTryLogin(content,error);
}
if(result/*&&content.contains("orderId")*/){
if( result ){
result=_ResponseSimReqFristOrderData(content, data,error,content["orderId"].toString());
} else {
result = false;
if(error.isEmpty()) {
if ( error.isEmpty() ) {
error=QString::fromLocal8Bit("Response Simphony_Script Request 01: Login Store Failed");
}
}
......@@ -2390,24 +2411,6 @@ bool FlowControl::_ResponseSimphony01Request(const QJsonObject &content, QJsonOb
}
bool FlowControl::_ResponseSimphony02Request(const QJsonObject &content, QJsonObject &data, QString &error)
{
Q_UNUSED(content);
Q_UNUSED(data);
Q_UNUSED(error);
return true;
}
bool FlowControl::_ResponseSimphony03Request(const QJsonObject &content, QJsonObject &data, QString &error)
{
Q_UNUSED(content);
Q_UNUSED(data);
Q_UNUSED(error);
return true;
}
bool FlowControl::_ResponseSimphony04Request(const QJsonObject &content, QJsonObject &data, QString &error)
{
QLOG_INFO()<<__FUNCTION__;
......@@ -3079,8 +3082,8 @@ bool FlowControl::_ResponseHM21Request(const QJsonObject &content, QJsonObject &
bool FlowControl::_ResponseSimReqTryLogin(const QJsonObject &content,QString &error)
{
QLOG_INFO()<<__FUNCTION__;
// 插件点击 POS右下角触发的 登录请求;
m_storeId=content["storeId"].toString(); //未登陆成功前 storeId;
m_subStoreId = ConfigManger::GetInstance().GetSubStoreId();
// 跳过 校验配置 子门店 与 母门店的前三位是否一致;增加安全保护机制 (同时实现参数可控 校验功能 );
if ( ConfigManger::GetInstance().GetSubStoreSkipVerify() ) {
......@@ -3090,7 +3093,6 @@ bool FlowControl::_ResponseSimReqTryLogin(const QJsonObject &content,QString &er
}
QLOG_INFO()<<QString::fromLocal8Bit("[<<<<---_ResponseSimReqTryLogin: m_storeId=%1 , m_subStoreId=%2 --->>>>>]").arg(m_storeId).arg(m_subStoreId);
//m_deviceNo=content["posId"].toString(); //将来用来扩展新字段值
m_posId= "111111111111111"; // 避免上游出现多条 POS插件登录记录(设备id不一致);
m_posWorkstationNum=content["businessDay"].toString(); // 折中方案,使用营业时间透传 POS WorkStation Num;
m_cashierId=content["operatorId"].toString();
......@@ -3850,12 +3852,38 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
}
void FlowControl::_AutoLoginSkipCashier() {
QLOG_INFO()<<__FUNCTION__;
m_storeId = GetCaboxAReAuth::getInstance().getDbStoreId(); //未登陆成功前 DB storeId;
m_subStoreId = ConfigManger::GetInstance().GetSubStoreId();
m_posId= "222222222222222"; // 避免上游出现多条 POS插件登录记录(设备id不一致);
m_posWorkstationNum = GetCaboxAReAuth::getInstance().getDbWorkStationNum(); //POS DB WorkStation Num;
QLOG_INFO()<<QString::fromLocal8Bit("[<<<<---_AutoLoginSkipCashier: m_storeId=%1, m_subStoreId=%2 "
" m_posWorkstationNum: %3 --->>>>>]").arg(m_storeId).arg(m_subStoreId).arg(m_posWorkstationNum);
m_cashierId="90001";
m_cashierName="MICROS";
if ( m_storeId.length() ) {
// emit doLogin(); signal Can't Send Success; Same Pthread, No Need Use Signal & Slot;
onGetNewStoreInfo(); // New Timer And Login Upstream Service;
} else {
//人性化提示:门店号没有正常从POS DB 中获取到;
emit showAlert(AlertForm::MSGERROR, QString::fromLocal8Bit("从POS数据库中获取门店号失败"));
QLOG_INFO()<<QString::fromLocal8Bit("[<<<<---_AutoLoginSkipCashier: Get m_storeId Is Empty From DataBase Error--->>>>>]");
}
return;
}
QString FlowControl::_Penny2Dollar(int penny)
{
double dollar = (double)penny/100;
return QString::number(dollar,'f',1);
}
void FlowControl::onGetBusinessStatus()
{
}
......@@ -4078,7 +4106,25 @@ void FlowControl::onProcessRepealOrder(const QString &orderId, const int &reason
}
void FlowControl::onProcessReTryInputOrder(const QString &orderId)
void FlowControl::onProcessRetryPrintOrder(const QString& orderId, const int& printTicketTypeCode, const QString& printTicketTypeStr)
{
QLOG_INFO() << QString("[<<<<---FlowControl::onProcessRetryPrintOrder: OrderId: %1 TicketTypeCode: %2 TicketTypeStr: %3--->>>>]")
.arg(orderId).arg(printTicketTypeCode).arg(printTicketTypeStr);
//先判断非码订单容器不为空;
if ( !m_FmOrdersMap.isEmpty() ) {
OrderObject* tempOrder = NULL;
if ( m_FmOrdersMap.value( orderId ) ) {
tempOrder = m_FmOrdersMap.value( orderId );
}
PrintMsgQueueDB::getInstance().resetPrintMsgStatus(tempOrder, printTicketTypeCode);
} else {
QLOG_INFO() << QString("[<<<<---FlowControl::onProcessRetryPrintOrder: m_FmOrdersMap Is Empty --->>>>]");
}
}
void FlowControl::onProcessRetryInputOrder(const QString &orderId)
{
QLOG_INFO() << QString("[<<<<---FlowControl::onProcessReTryInputOrder: OrderId: %1 --->>>>]").arg(orderId);
//先判断非码订单容器不为空;
......
......@@ -34,7 +34,7 @@ public:
* 参数: 1. 是否登录成功; 2.门店号; 3.PosPluginIp; 4.PosPlugin Port;
* 返回: Void;
* */
void _GetFcMajorInfo(bool &loginResult, bool &openTcpChannel, QString &storeId, QString &posIp, QString &posHostName, QString &posWorkStationNum);
void _GetFcMajorInfo(bool &loginResult, bool &openTcpChannel, QString &storeId, QString &posIp, QString &posHostName, QString &posWorkStationNum,bool &backupPos);
/* 功能:获取收银员ID
* 参数:NULL
......@@ -133,6 +133,7 @@ private:
QString m_ipAddress; // 门店POS的 IP 地址
QString m_ipPortAddress; // 门店POS的 IP+端口 地址
QString m_posHostName; // Pos 主机名;
bool m_backupPosFlag; // 备机POS标识;
QString m_posMacAddress; // Pos Mac地址;
QString m_posWorkstationNum; // Pos 工作站编号
QString m_password;
......@@ -246,7 +247,7 @@ signals:
void doLogin();
// http门店POS登录成功后 发送信号给 SocketCommunicate;
void doLoginSuccess(bool loginResult,bool openTcpFlag, QString &storeId, QString &posIp, QString &posHostName, QString &posWorkStationNum);
void doLoginSuccess(bool loginResult, bool openTcpFlag, QString &storeId, QString &posIp, QString &posHostName, QString &posWorkStationNum);
/* 功能:隐藏通知窗口
* 参数:NULL
......@@ -367,32 +368,37 @@ signals:
void doStartOperateTimer();
private slots:
bool _GetStoreInfo();
/* 功能:登录
* 参数:NULL
* 返回:是否成功
* */
bool _Login();
/* 功能:拉取订单
* 参数:[1]订单编号
* 返回:是否成功
* */
void _PullOrderData();
/* 功能:拉取指定订单
* 参数:[1]订单编号
* 返回:是否成功
* */
bool _PullOrderDetail( const QString& orderId, const QString& channel, const QString& callBackUrl, const bool& skipPrint = false, const bool& skipErrorDisplay = false );
/* 功能:拉取订单
* 参数:NULL
* 返回:是否成功
* */
bool _PullOrderList( const int &pageSize, const int &pageNo, const QString &callBackUrl );
/* 功能:发送心跳
* 参数:NULL
* 返回:是否成功
* */
bool _SendHeart();
/* 功能:确认订单
* 参数:[1]订单编号[2]配送员信息
* 返回:是否成功
......@@ -404,6 +410,7 @@ private slots:
* 返回:是否成功
* */
bool _SendOrder(const QString& orderId);
/* 功能:完成订单
* 参数:NULL
* 返回:是否成功
......@@ -477,9 +484,12 @@ private slots:
void _SmartTriggerClickPosBtn(const bool bTimerTrigger = false);
public slots:
/* 全部订单都是解耦2.0模式下: 插件自动登录 跳过收银员账号登录 */
void _AutoLoginSkipCashier();
/* 功能:获取到新的门店信息
* 参数:[1]操作员ID[2]POS机ID
* [3]门店ID[4]营业日
* 参数:无
* 返回:NULL
* */
void onGetNewStoreInfo();
......@@ -549,7 +559,13 @@ public slots:
* 参数:[1]订单号
* 返回:NULL
* */
void onProcessReTryInputOrder(const QString& orderId);
void onProcessRetryInputOrder(const QString& orderId);
/* 功能:重新打印订单;
* 参数:[1]订单号
* 返回:NULL
* */
void onProcessRetryPrintOrder(const QString& orderId, const int& printTicketTypeCode, const QString& printTicketTypeStr);
/* 功能:获取门店营业状态
* 参数:NULL
......@@ -624,20 +640,6 @@ public slots:
bool _ResponseSimphony01Request(const QJsonObject &content, QJsonObject &data,QString &error);
/**
*功能:FM外卖插件为响应Simphony请求[action:02 -> 确认订单]准备返回数据
*参数:1、请求json参数;2、准备返回请求数据的Buff;3、返回错误信息;
*返回:是否准备成功;
**/
bool _ResponseSimphony02Request(const QJsonObject &content, QJsonObject &data,QString &error);
/**
*功能:FM外卖插件为响应Simphony请求[action:03 -> 取消订单]准备返回数据
*参数:1、请求json参数;2、准备返回请求数据的Buff;3、返回错误信息;
*返回:是否准备成功;
**/
bool _ResponseSimphony03Request(const QJsonObject &content, QJsonObject &data,QString &error);
/**
*功能:FM外卖插件为响应Simphony请求[action:04 -> 汇报订单Sim/POS产生的小票号]准备返回数据
*参数:1、请求json参数;2、准备返回请求数据的Buff;3、返回错误信息;
*返回:是否准备成功;
......
......@@ -5,7 +5,7 @@
#include "preDefine.h"
GetCaboxAReAuth::GetCaboxAReAuth() {
QLOG_INFO()<<"[<<<<---GetCaboxAReAuth:: Structure POS Get Has Cash Box Or Refund Auth DataBase--->>>>]";
QLOG_INFO()<<"[<<<<---GetCaboxAReAuth:: Structure POS Get Has Cash Box Or StoreId Or Workstation Num DataBase--->>>>]";
}
bool GetCaboxAReAuth::initGetAuthPosDB(){
......@@ -85,3 +85,66 @@ int GetCaboxAReAuth::getUserRefundAuth(const QString& operatorId){
return result;
}
QString GetCaboxAReAuth::getDbStoreId() {
QMutexLocker mutex(&m_mutex);
if(!m_sqlDb.open()) {
QLOG_ERROR()<<"[<<<<---SqlServer Database:Open Failed--->>>>]"<<m_sqlDb.lastError().text();
return "";
}
QString result = "";
QSqlQuery query(m_sqlDb);
QLOG_INFO()<< QString("SELECT TOP 1 ObjectNumber FROM [DataStore].[dbo].[V_HIERARCHY] where Parent1=1");
query.prepare( QString("SELECT TOP 1 ObjectNumber FROM [DataStore].[dbo].[V_HIERARCHY] where Parent1=1") );
if ( !query.exec() ) {
QLOG_ERROR()<<"[<<<<---SqlServer Database:getDbStoreId--->>>>]"<<query.lastError().text();
result= "";
}
if ( query.first() ) {
result= query.value(0).toString();
QLOG_INFO()<<QString("[<<<<---SqlServer Database, getDbStoreId: %1--->>>>]").arg(result);
} else {
result = "";
}
m_sqlDb.close();
return result;
}
QString GetCaboxAReAuth::getDbWorkStationNum() {
QMutexLocker mutex(&m_mutex);
if(!m_sqlDb.open()) {
QLOG_ERROR()<<"[<<<<---SqlServer Database:getDbWorkStationNum Open Failed--->>>>]"<<m_sqlDb.lastError().text();
return "";
}
QString result = "";
QSqlQuery query(m_sqlDb);
// SELECT TOP 1 ObjectNumber FROM [DataStore].[dbo].[WORKSTATION] WHERE CashDrawers is NULL
// -- DrawerOneTillGuid IS NOT NULL OR DrawerTWOTillGuid IS NOT NULL
QLOG_INFO()<<QString("SELECT TOP 1 ObjectNumber FROM [DataStore].[dbo].[WORKSTATION] WHERE CashDrawers is NULL");
query.prepare( QString("SELECT TOP 1 ObjectNumber FROM [DataStore].[dbo].[WORKSTATION] WHERE CashDrawers is NULL") );
if(!query.exec()) {
QLOG_ERROR()<<"[<<<<---SqlServer Database:getDbWorkStationNum--->>>>]"<<query.lastError().text();
result= "";
}
if(query.first()) {
if (query.value(0).isValid() ) {
result= query.value(0).toString();
} else {
result = "";
}
QLOG_INFO()<<QString("[<<<<---SqlServer Database, getDbWorkStationNum: %1--->>>>]").arg(result);
} else {
result = "";
}
m_sqlDb.close();
return result;
}
......@@ -34,6 +34,20 @@ public:
**/
int getUserRefundAuth(const QString& operatorId);
/**
*功能:查询本地的POS系统中 门店号信息;
*参数:无
*返回:POS机设定的门店号
**/
QString getDbStoreId();
/**
*功能:查询本地的POS系统中 WorkStationNum;
*参数:无
*返回:POS机设定的WorkStationNum
**/
QString getDbWorkStationNum();
private:
QMutex m_mutex;
GetCaboxAReAuth();
......
......@@ -174,6 +174,74 @@ bool PrintMsgQueueDB::updatePrintMsgStatus(OrderObject* orderObj, const int &pri
}
bool PrintMsgQueueDB::resetPrintMsgStatus(const OrderObject* orderObj, const int &printTypeCode) {
QMutexLocker mutex(&m_mutex);
if(!m_sqlDb.open()) {
QLOG_ERROR()<<"[<<<<---SqlServer Database:Open Failed--->>>>]"<<m_sqlDb.lastError().text();
return false;
}
bool result;
QString preExeSql = "";
QString preExeSqlAnother = "";
QSqlQuery query(m_sqlDb);
switch (printTypeCode) {
case 1: // 全部小票
preExeSql = QString("update tb_print_msr_customer set print_status=0, reserve0=0, reserve1=0, reserve6=0 where order_id='%1' ").arg(orderObj->id);
preExeSqlAnother = QString("update tb_main_prod_refinfo set prod_resv1=0 where order_id='%1' ").arg(orderObj->id);
break;
case 2: // 汇总小票
preExeSql = QString("update tb_print_msr_customer set print_status=0 where order_id='%1' ").arg(orderObj->id);
break;
case 3: // 杯贴小票
// tb_print_msr_customer -> reserve0 unused;
preExeSql =QString("update tb_main_prod_refinfo set prod_resv1=0 where order_id='%1' ").arg(orderObj->id);
break;
case 4: // 预约提醒小票
preExeSql = QString("update tb_print_msr_customer set reserve1=0 where order_id='%1' ").arg(orderObj->id);
break;
case 5: // 街送小票
preExeSql = QString("update tb_print_msr_customer set reserve6=0 where order_id='%1' ").arg(orderObj->id);
break;
default:
m_sqlDb.close();
return false;
}
if (orderObj->orderStatus != 6) {
preExeSql = preExeSql + " and order_status != 6 ";
query.prepare(preExeSql);
if ( preExeSqlAnother.length() )
preExeSqlAnother = preExeSqlAnother + " and order_status != 6 ";
} else {
preExeSql = preExeSql + " and order_status = 6 ";
query.prepare(preExeSql);
if ( preExeSqlAnother.length() )
preExeSqlAnother = preExeSqlAnother + " and order_status = 6 ";
}
QLOG_INFO()<< QString("[<<<<---SqlServer Database:Reset OrderId %1 Print Status: sql1: %2 ; sql2: %3 --->>>>]").arg(orderObj->id).arg(preExeSql).arg(preExeSqlAnother);
if(!query.exec()) {
QLOG_ERROR()<<query.lastError().text()<<"[<<<<---SqlServer Database:Reset Order Print Status Failed--->>>>]";
result= false;
} else {
QLOG_INFO()<<QString("[<<<<---SqlServer Database:Reset OrderId %1 Print Status success--->>>>]").arg(orderObj->id);
result = true;
if ( preExeSqlAnother.length() ) {
query.prepare(preExeSqlAnother);
if ( !query.exec() ){
QLOG_ERROR()<<query.lastError().text()<<"[<<<<---SqlServer Database:Reset OrderId Cup Ticket Print Status Failed--->>>>]";
result= false;
} else {
QLOG_INFO()<<QString("[<<<<---SqlServer Database:Reset OrderId %1 Cup Ticket Print Status success--->>>>]").arg(orderObj->id);
}
}
}
m_sqlDb.close();
return result;
}
bool PrintMsgQueueDB::isOrderPrtMsgExist(OrderObject* orderObj){
QMutexLocker mutex(&m_mutex);
if(!m_sqlDb.open()) {
......
......@@ -42,6 +42,13 @@ public:
bool updatePrintMsgStatus(OrderObject* orderObj, const int &printStatus);
/**
*功能: 根据订单对象指针, 触发重置 pos本地数据库中打印消息队列表中 打印状态;
*参数:[1]订单对象指针, [2]打印小票类型的选择:
*返回:true操作成功,false失败
**/
bool resetPrintMsgStatus(const OrderObject* orderObj, const int &printTypeCode);
/**
*功能:查询订单的打印消息记录是否存在本地的POS系统中;
*参数:[1]订单号
*返回:true是,false否
......
......@@ -13,7 +13,7 @@ LoaclHttpServer::LoaclHttpServer()
void LoaclHttpServer::run()
{
/*** 启动Http服务:用来响应Http获取订单的请求***/
QLOG_INFO()<< "[<<<<---LoaclHttpServer::Receive Http Requestm_tcpServerManage:--->>>>]" << m_tcpServerManage;
QLOG_INFO()<< "[<<<<---LoaclHttpServer::Receive Http Request: m_tcpServerManage:--->>>>]" << m_tcpServerManage;
m_tcpServerManage->setHttpAcceptedCallback( [this]( const QPointer< JQHttpServer::Session > &session )
{
QLOG_INFO()<< "[<<<<---LoaclHttpServer::Receive Http Request:currentThreadId:--->>>>]" << QThread::currentThreadId();
......
......@@ -283,10 +283,10 @@ public:
int dataBaseIsORSPushInt;
int dataBaseIsORSCancleInt;
QString dataBasePosOrderCheckNo;
int sbkAppPayType;
QString sbkAppPayValue;
QString sbkAppRefundPayValue;
bool backupPosFlag;
QString getChannelName();
......
#include "PrintTicketSelectForm.h"
#include "ui_PrintTicketSelectForm.h"
#include <QDebug>
#include "QsLog.h"
PrintTicketSelectForm::PrintTicketSelectForm(QWidget *parent) :
QDialog(parent),
ui(new Ui::PrintTicketSelectForm)
{
ui->setupUi(this);
setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint);
this->setModal(true);
ui->BtnOk->setEnabled(false);
}
PrintTicketSelectForm::~PrintTicketSelectForm()
{
QLOG_INFO() << QString("[<<<<---PrintTicketSelectForm::~PrintTicketSelectForm: begin--->>>>]");
delete ui;
QLOG_INFO() << QString("[<<<<---PrintTicketSelectForm::~PrintTicketSelectForm: end--->>>>]");
}
void PrintTicketSelectForm::on_BtnCancle_clicked()
{
this->reject();
}
void PrintTicketSelectForm::on_BtnOk_clicked()
{
this->accept();
}
void PrintTicketSelectForm::on_allTicket_toggled(bool checked)
{
if(checked)
{
ui->BtnOk->setEnabled(true);
m_printTicketTypeStr = QString::fromLocal8Bit(TICKET_ALL);
m_printTicketTypeCode=1;
}
}
void PrintTicketSelectForm::on_summaryTicket_toggled(bool checked)
{
if(checked)
{
ui->BtnOk->setEnabled(true);
m_printTicketTypeStr = QString::fromLocal8Bit(TICKET_SUMMARY);
m_printTicketTypeCode = 2;
}
}
void PrintTicketSelectForm::on_cupTicket_toggled(bool checked)
{
if(checked)
{
ui->BtnOk->setEnabled(true);
m_printTicketTypeStr = QString::fromLocal8Bit(TICKET_CUP);
m_printTicketTypeCode=3;
}
}
void PrintTicketSelectForm::on_reserveTicket_toggled(bool checked)
{
if(checked)
{
ui->BtnOk->setEnabled(true);
m_printTicketTypeStr = QString::fromLocal8Bit(TICKET_RESERVE);
m_printTicketTypeCode=4;
}
}
void PrintTicketSelectForm::on_curbsideTicket_toggled(bool checked)
{
if(checked)
{
ui->BtnOk->setEnabled(true);
m_printTicketTypeStr = QString::fromLocal8Bit(TICKET_CURBSIDE);
m_printTicketTypeCode=5;
}
}
void PrintTicketSelectForm::clearAllRadioBtnCheck(){
QLOG_INFO() << QString("[<<<<---PrintTicketSelectForm::clearAllRadioBtnCheck Clear All Check --->>>>]");
ui->summaryTicket->setAutoExclusive(false);
ui->summaryTicket->setChecked(false);
ui->summaryTicket->setAutoExclusive(true);
ui->cupTicket->setAutoExclusive(false);
ui->cupTicket->setChecked(false);
ui->cupTicket->setAutoExclusive(true);
ui->reserveTicket->setAutoExclusive(false);
ui->reserveTicket->setChecked(false);
ui->reserveTicket->setAutoExclusive(true);
ui->curbsideTicket->setAutoExclusive(false);
ui->curbsideTicket->setChecked(false);
ui->curbsideTicket->setAutoExclusive(true);
ui->allTicket->setAutoExclusive(false);
ui->allTicket->setChecked(false);
ui->allTicket->setAutoExclusive(true);
}
#ifndef PRINTTICKETSELECTFORM_H
#define PRINTTICKETSELECTFORM_H
#include <QDialog>
#include <QMap>
#include <QRadioButton>
#include <Model/orderObject.h>
#include "refdishesForm.h"
#include "preDefine.h"
namespace Ui {
class PrintTicketSelectForm;
}
class PrintTicketSelectForm : public QDialog
{
Q_OBJECT
public:
explicit PrintTicketSelectForm(QWidget *parent = 0);
~PrintTicketSelectForm();
QString m_printTicketTypeStr;
int m_printTicketTypeCode;
private slots:
/* 功能:取消按钮对应的操作
* 参数:NULL
* 返回:NULL
* */
void on_BtnCancle_clicked();
/* 功能:确定按钮对应的操作
* 参数:[bEnable]是否启用
* 返回:NULL
* */
void on_BtnOk_clicked();
// 全部小票
void on_allTicket_toggled(bool checked);
// 汇总小票
void on_summaryTicket_toggled(bool checked);
// 杯贴小票
void on_cupTicket_toggled(bool checked);
// 预约提醒小票
void on_reserveTicket_toggled(bool checked);
// 街送小票
void on_curbsideTicket_toggled(bool checked);
public slots:
void clearAllRadioBtnCheck();
private:
Ui::PrintTicketSelectForm *ui;
void _Init();
};
#endif // PRINTTICKETSELECTFORM_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PrintTicketSelectForm</class>
<widget class="QDialog" name="PrintTicketSelectForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>287</width>
<height>419</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>40</x>
<y>60</y>
<width>221</width>
<height>271</height>
</rect>
</property>
<layout class="QVBoxLayout" name="vlBody_2">
<property name="spacing">
<number>10</number>
</property>
<property name="leftMargin">
<number>40</number>
</property>
<item>
<widget class="QRadioButton" name="allTicket">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>全部小票</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="summaryTicket">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>汇总单</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="cupTicket">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>杯贴</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="reserveTicket">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>预约提醒小票</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="curbsideTicket">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>街送小票</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="ticketSelectLab0">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>281</width>
<height>34</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>34</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>34</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>选择-重打小票类型</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QPushButton" name="BtnCancle">
<property name="geometry">
<rect>
<x>150</x>
<y>360</y>
<width>70</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>70</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>取 消</string>
</property>
</widget>
<widget class="QPushButton" name="BtnOk">
<property name="geometry">
<rect>
<x>60</x>
<y>360</y>
<width>70</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>70</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>确 定</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
......@@ -61,7 +61,7 @@ public:
QString address ="";
auto interfaces = QNetworkInterface::allInterfaces();
for (int i = 0; i < interfaces.length(); i++) {
QLOG_INFO()<<QString("GetMacByAdaptersAddresses:: interfaces[ %1 ] = %2 ").arg( i+1 ).arg( interfaces[i].hardwareAddress() );
QLOG_INFO()<<QString("GetMacByAdaptersAddresses:: interfaces[%1]= %2 ").arg( i+1 ).arg( interfaces[i].hardwareAddress() );
if ( interfaces[i].isValid() ) {
/* if( interfaces[i].flags().testFlag(QNetworkInterface::IsUp) &&
interfaces[i].flags().testFlag(QNetworkInterface::IsRunning) &&
......@@ -77,7 +77,7 @@ public:
ret = 1;
address = address.replace(QRegExp(":"), "-");
macOut = address.toStdString();
QLOG_INFO()<<QString("GetMacByAdaptersAddresses::MAC= %1 ").arg( address );
QLOG_INFO()<<QString("GetMacByAdaptersAddresses:: MAC= %1 ").arg( address );
}
return ret;
}
......
......@@ -587,7 +587,7 @@ public:
keys.clear();
for(it = json.begin(); it != json.end(); ++it) {
if(it.value().isString() || it.value().isDouble())
if(it.value().isString() || it.value().isDouble() || it.value().isBool() )
keys.append(it.key());
}
}
......@@ -605,14 +605,18 @@ public:
values.clear();
for(int i = 0; i < keys.length(); ++i) {
if(json[keys[i]].isString()) {
if ( json[keys[i]].isString() ) {
values.append(json[keys[i]].toString());
values.append("|");
} else if ( json[keys[i]].isDouble() ) {
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("|");
}
}
......@@ -625,18 +629,23 @@ public:
values.clear();
for(int i = 0; i < keys.length(); ++i) {
if(json[keys[i]].isString()) {
if( json[keys[i]].isString() ) {
values.append( keys[i] );
values.append( "=" );
values.append(json[keys[i]].toString());
values.append(":");
} else if ( json[keys[i]].isDouble() ) {
values.append( keys[i] );
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(":");
}
}
......
......@@ -14,9 +14,11 @@ DetailForm::DetailForm(QWidget *parent) :
connect(this, &DetailForm::processOrder, &FlowControl::GetInstance(), &FlowControl::onProcessOrder);
connect(this, &DetailForm::processRejectOrder, &FlowControl::GetInstance(), &FlowControl::onProcessRejectOrder);
connect(this, &DetailForm::processRepealOrder, &FlowControl::GetInstance(), &FlowControl::onProcessRepealOrder);
connect(this, &DetailForm::processReTryInputOrder, &FlowControl::GetInstance(), &FlowControl::onProcessReTryInputOrder);
connect(this, &DetailForm::processRetryInputOrder, &FlowControl::GetInstance(), &FlowControl::onProcessRetryInputOrder);
connect(this, &DetailForm::processRetryPrintOrder, &FlowControl::GetInstance(), &FlowControl::onProcessRetryPrintOrder);
m_refuseForm=NULL;
m_refuseForm = NULL;
m_printTicketSelectForm = NULL;
_Init();
}
......@@ -31,19 +33,29 @@ DetailForm::~DetailForm()
void DetailForm::InitData(OrderObject *orderObject)
{
m_orderObject = orderObject;
if ( !m_orderObject ) {
QLOG_INFO() << QString("[<<<<---DetailForm::InitData m_orderObject Point Is NULL --->>>>]");
return;
}
// 恢复界面
ui->detailTable0->clearContents();
ui->detailTable0->setRowCount(0);
ui->detailBtn2->show();
ui->detailBtn3->show();
ui->detailBtn1->hide();
//重新打印按钮;
if ( m_orderObject->backupPosFlag ) {
ui->detailBtn1->show();
} else {
ui->detailBtn1->hide();
}
// 重新录单按钮;
ui->detailBtn0->hide();
// 初始化界面
ui->detailLab0->setText(QString("[%1 # %2][%3][%4]").arg(QString::number(orderObject->orderIndex),orderObject->getChannelName(),
orderObject->getOrderStatusDec(),
orderObject->id));
QLOG_INFO() << QString("[<<<<---DetailForm::InitData ui->detailLab0->setText --->>>>]");
ui->detailLab1->setText(QString("[ %1 ]:[ %2 ]:[%3:%4]").arg(orderObject->consigneeName,orderObject->consigneePhone,
QString::fromLocal8Bit("暗号"),orderObject->secretSignal));
//订单完成后,送达时间需要更新为 finishTime
......@@ -59,19 +71,13 @@ void DetailForm::InitData(OrderObject *orderObject)
deliveryFinishTime = deliveryFinishTime + QString::fromLocal8Bit(" 预约时间: ") + orderObject->expectDate;
}
ui->detailLab2->setText(deliveryFinishTime);
QLOG_INFO() << QString("[<<<<---DetailForm::InitData ui->detailLab2->setText --->>>>]");
ui->detailLab3->setText(orderObject->riderName.isEmpty() ? QString::fromLocal8Bit("暂未指定") : QString::fromLocal8Bit("[姓名]%1 [电话]%2")
.arg(orderObject->riderName, orderObject->riderPhone));
//TODO
ui->detailLab4->setText(Penny2Dollar(orderObject->totalPrice));
//先隐藏发票信息
//ui->detailLab6->setText(orderObject->needInvoice? orderObject->invoiceTitle : QString::fromLocal8Bit("不需要发票"));
ui->detailSlab6->setText(QString::fromLocal8Bit("三方订单号"));
ui->detailLab6->setText(orderObject->thirdPartyOrderId);
QLOG_INFO() << QString("[<<<<---DetailForm::InitData ui->detailSlab6 --->>>>]");
ui->detailLab7->setText(orderObject->msr_no.length()? orderObject->msr_no : orderObject->customerId); // MSR_NO
ui->detailLab5->setText( QString("[%1 | %2 ]").arg( orderObject->memo).arg(orderObject->consumerRemark) );
//订单在 POS 上最新开单号:红色属性设置;
......@@ -101,9 +107,6 @@ void DetailForm::InitData(OrderObject *orderObject)
ui->detailTable0->item(pNum, 1)->setTextAlignment(Qt::AlignCenter);
}
QLOG_INFO() << QString("[<<<<---DetailForm::InitData ui->detailTable0 --->>>>]");
//ui->detailTable0->setItem(pNum, 1, new QTableWidgetItem(Penny2Dollar(orderObject->proList.at(i)->price))); // 价格
//ui->detailTable0->item(pNum, 1)->setTextAlignment(Qt::AlignCenter);
ui->detailTable0->setItem(pNum, 2, new QTableWidgetItem(QString::number(orderObject->proList.at(i)->qty))); // 数量
ui->detailTable0->item(pNum, 2)->setTextAlignment(Qt::AlignCenter);
......@@ -306,10 +309,8 @@ void DetailForm::InitData(OrderObject *orderObject)
}
/*********************************** 遍历 组合支付券列表:券信息展示 end *********************************************************/
//设置行高根据文字进行自适应;用来重复显示主商品的配料信息;
ui->detailTable0->resizeRowsToContents();
ui->detailBtn2->setText(GetOperNameByStatus(orderObject->orderStatus, true));
ui->detailBtn2->setProperty("operation", GetOperByStatus(orderObject->orderStatus, true));
ui->detailBtn2->setProperty("orderId", orderObject->id);
......@@ -344,6 +345,10 @@ void DetailForm::InitData(OrderObject *orderObject)
m_refuseForm = new RefuseForm(this);
}
if ( m_printTicketSelectForm == NULL ) {
m_printTicketSelectForm = new PrintTicketSelectForm(this);
}
#ifdef TODO
ui->detailBtn3->hide();
#endif
......@@ -352,9 +357,7 @@ void DetailForm::InitData(OrderObject *orderObject)
void DetailForm::_Init()
{
setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint);
setGeometry(((QWidget*)parent())->geometry());
int tableWidth = this->width()/2 - 65;
ui->detailTable0->setColumnWidth(0, tableWidth*12/15);
ui->detailTable0->setColumnWidth(1, tableWidth*2/15);
......@@ -424,13 +427,40 @@ void DetailForm::onOperaBtnClicked()
void DetailForm::on_detailBtn1_clicked()
{
if ( m_orderObject ) {
QLOG_INFO()<<QString("[<<<<---DetailForm::on_detailBtn1_clicked: begin, orderId: %1--->>>>]").arg(m_orderObject->id) << QString::fromLocal8Bit("重新打印");
//hide(); //隐藏详情界面将会产生一种BUG: 在选择重打类型时,详情页面+主界面都隐藏了,即使不选择,点击取消,主程序也会崩溃(无dump文件);
//hide(); //为了友好用户的使用体验感,hide() 还是需要在接受完选择后,再隐藏;
if ( !m_printTicketSelectForm ) {
QLOG_INFO() << QString("[<<<<---DetailForm::on_detailBtn1_clicked: m_printTicketSelectForm Is Null, Return Now --->>>>]");
return;
}
m_printTicketSelectForm->show();
if(m_printTicketSelectForm->exec()==QDialog::Accepted)
{
QLOG_INFO() << QString("[<<<<---DetailForm::on_detailBtn1_clicked: m_printTicketSelectForm->exec()==QDialog::Accepted--->>>>]");
QLOG_INFO() << QString("[<<<<---DetailForm::on_detailBtn1_clicked: m_printTicketTypeCode: %1 m_printTicketTypeStr: %2--->>>>]")
.arg(m_printTicketSelectForm->m_printTicketTypeCode).arg(m_printTicketSelectForm->m_printTicketTypeStr);
emit processRetryPrintOrder( m_orderObject->id, m_printTicketSelectForm->m_printTicketTypeCode, m_printTicketSelectForm->m_printTicketTypeStr);
this->hide(); //为了友好用户的使用体验感,hide() 还是需要在接受完取消订单原因后,再隐藏;
} else {
QLOG_INFO() << QString("[<<<<---DetailForm::on_detailBtn1_clicked: m_printTicketSelectForm->exec() != QDialog::Accepted--->>>>]");
}
if ( m_printTicketSelectForm )
m_printTicketSelectForm->clearAllRadioBtnCheck();
} else {
QLOG_ERROR()<<QString("[<<<<---DetailForm::on_detailBtn1_clicked: m_orderObject point is NULL--->>>>]");
}
}
void DetailForm::on_detailBtn0_clicked()
{
QLOG_INFO()<<QString("[<<<<---DetailForm::on_detailBtn0_clicked: begin:--->>>>]")<<QString("重新录单")<< m_orderObject->id;
if(m_orderObject) {
emit processReTryInputOrder(m_orderObject->id);
if ( m_orderObject ) {
QLOG_INFO()<<QString("[<<<<---DetailForm::on_detailBtn0_clicked: begin, orderId: %1 --->>>>]").arg(m_orderObject->id) << QString("重新录单");
emit processRetryInputOrder(m_orderObject->id);
this->hide();
} else {
QLOG_ERROR()<<QString("[<<<<---DetailForm::on_detailBtn0_clicked: m_orderObject point is NULL--->>>>]");
......@@ -449,6 +479,11 @@ void DetailForm::hideDetailAllFrom()
m_refuseForm->reject();
}
if ( m_printTicketSelectForm && m_printTicketSelectForm->isVisible() ) {
m_printTicketSelectForm->reject();
m_printTicketSelectForm->hide();
}
QLOG_INFO()<<QString("[<<<<---DetailForm::hideDetailAllFrom: middle:--->>>>]");
this->hide();
......
......@@ -8,6 +8,7 @@
#include "Model/PromotionItemObject.h"
#include "RejectForm.h"
#include "refuseForm.h"
#include "PrintTicketSelectForm.h"
namespace Ui {
class DetailForm;
......@@ -39,6 +40,7 @@ private:
void _Init();
RefuseForm *m_refuseForm;
PrintTicketSelectForm *m_printTicketSelectForm;
QString GetProductName(dishesObject* dish);
signals:
......@@ -59,7 +61,13 @@ signals:
* 参数:[1]订单编号
* 返回:NULL
* */
void processReTryInputOrder(const QString& orderId);
void processRetryInputOrder(const QString& orderId);
/* 功能:重新打印订单
* 参数:[1]订单编号
* 返回:NULL
* */
void processRetryPrintOrder(const QString& orderId, const int& printTicketTypeCode, const QString& printTicketTypeStr);
private slots:
/* 功能:处理订单按钮点击
......
......@@ -82,7 +82,8 @@ SOURCES += main.cpp\
DTools/checkPoskeyExistPosDB.cpp \
noticeForm.cpp \
DTools/saveNoticeMsgDB.cpp \
Model/NoticeObject.cpp
Model/NoticeObject.cpp \
PrintTicketSelectForm.cpp
HEADERS += \
Control/flowControl.h \
......@@ -146,7 +147,8 @@ HEADERS += \
DTools/checkPoskeyExistPosDB.h \
noticeForm.h \
DTools/saveNoticeMsgDB.h \
Model/NoticeObject.h
Model/NoticeObject.h \
PrintTicketSelectForm.h
FORMS += mainForm.ui \
alertForm.ui \
......@@ -164,7 +166,8 @@ FORMS += mainForm.ui \
refdishesForm.ui \
refuseForm.ui \
dailyreportForm.ui \
noticeForm.ui
noticeForm.ui \
PrintTicketSelectForm.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,8,18
PRODUCTVERSION 2,2022,8,18
FILEVERSION 2,2022,10,20
PRODUCTVERSION 2,2022,10,20
//*************************************************************************//
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.8.18"
VALUE "FileVersion", "2.2022.8.18"
VALUE "ProductVersion", "2.2022.10.20"
VALUE "FileVersion", "2.2022.10.20"
//*************************************************************************//
END
END
......
......@@ -50,6 +50,7 @@ void InitLogger(){
logger.addDestination(consoleDst);
}
void LoadTheme(const QString& theme)
{
QString rccPath = QString("%1/skin/%2.rcc").arg(g_appDir).arg(theme);
......@@ -68,6 +69,7 @@ void LoadTheme(const QString& theme)
qssFile.close();
}
int main(int argc, char *argv[])
{
#ifdef Q_OS_WIN
......
......@@ -43,7 +43,8 @@
//#define APP_VERSION "2.2021.12.20"
//#define APP_VERSION "2.2022.1.18"
//#define APP_VERSION "2.2022.8.1"
#define APP_VERSION "2.2022.8.18"
//#define APP_VERSION "2.2022.8.18"
#define APP_VERSION "2.2022.10.20"
//修正版本号时,切记修正 FmTakeout.rc 中的版本号
......@@ -112,6 +113,7 @@
#define JSON_SUBORGCODE "subOrgCode"
#define JSON_POSNO "posNo"
#define JSON_POS_IP_ADDR "posIp"
#define JSON_POS_BACKUP_PC "backup"
#define JSON_POS_WORKS_NUM "decouplePosNo"
#define JSON_POS_HOST_NAME "posHostName"
#define JSON_POS_MAC_ADDRESS "posMacAddress"
......@@ -263,6 +265,12 @@
#define OPERATIONNAME_REFUSEREFUND "拒绝"
#define OPERATIONNAME_REFUNDORDER "退单"
#define TICKET_SUMMARY "汇总小票"
#define TICKET_CUP "杯贴小票"
#define TICKET_RESERVE "预约小票"
#define TICKET_CURBSIDE "街送小票"
#define TICKET_ALL "全部小票"
// 定义性别:
#define FM_MALE "男"
#define FM_FEMALE "女"
......
......@@ -819,14 +819,37 @@ QTabBar QToolButton::left-arrow:disabled {
}
/*---------------------------------refuseForm[end]-------------------------------------*/
/*---------------------------------PrintTicketSelectForm[start]-------------------------------------*/
#PrintTicketSelectForm
{
background-color:rgb(245,245,245);
}
#ticketSelectLab0
{
font: 14pt "微软雅黑";
background-color:rgb(238, 122, 42);
}
#BtnOk,#BtnCancle
{
font: 14pt "微软雅黑";
color: rgb(255, 255, 255);
background-color: rgb(238,122,42);
border-radius: 3px;
}
#BtnOk:pressed,#BtnCancle:pressed
{
color: rgb(161, 161, 161);
background-color: rgb(222,184,135);
border-radius: 3px;
}
#summaryTicket,#cupTicket,#reserveTicket,#curbsideTicket,#allTicket
{
font: 14pt "微软雅黑";
}
#BtnOk:disabled
{
color: #3d3d3d;
background-color: rgb(230, 230, 230);
border-radius: 3px;
}
/*---------------------------------PrintTicketSelectForm[end]-------------------------------------*/
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