Commit 6d726341 by wuyang.zou

1、多渠道门店营业状态显示;

parent 09ec3ce3
...@@ -745,11 +745,9 @@ bool FlowControl::_Login() ...@@ -745,11 +745,9 @@ bool FlowControl::_Login()
emit setCashierInfo(m_cashierName); emit setCashierInfo(m_cashierName);
//***********************登陆时获取门店的营业状态 begin ************************// //***********************登陆时获取门店的营业状态 begin ************************//
QJsonObject storeStatusData = recvJson[JSON_DATA].toObject(); m_eleStoreStatus = recvJson[JSON_ELESTORESTS].toInt();
QLOG_INFO()<<"FlowControl::_Login:"<<storeStatusData; m_modStoreStatus = recvJson[JSON_MODSTORESTS].toInt();
m_eleStoreStatus = storeStatusData[JSON_ELESTORESTS].toInt(); m_mopStoreStatus = recvJson[JSON_MOPSTORESTS].toInt();
m_modStoreStatus = storeStatusData[JSON_MODSTORESTS].toInt();
m_mopStoreStatus = storeStatusData[JSON_MOPSTORESTS].toInt();
QLOG_INFO()<<QString("[<<<<---FlowControl::_Login eleStoreStatus:%1;modStoreStatus:%2;mopStoreStatus:%3 --->>>>]"). QLOG_INFO()<<QString("[<<<<---FlowControl::_Login eleStoreStatus:%1;modStoreStatus:%2;mopStoreStatus:%3 --->>>>]").
arg(m_eleStoreStatus).arg(m_modStoreStatus).arg(m_mopStoreStatus); arg(m_eleStoreStatus).arg(m_modStoreStatus).arg(m_mopStoreStatus);
emit doUpdateStoreStatus(m_eleStoreStatus,m_modStoreStatus,m_mopStoreStatus); emit doUpdateStoreStatus(m_eleStoreStatus,m_modStoreStatus,m_mopStoreStatus);
...@@ -983,15 +981,14 @@ bool FlowControl::_SendHeart() ...@@ -983,15 +981,14 @@ bool FlowControl::_SendHeart()
emit setNetStatus(QString::fromLocal8Bit("<font color='#f5f5f5'>正常</font>")); emit setNetStatus(QString::fromLocal8Bit("<font color='#f5f5f5'>正常</font>"));
//只有上一次心跳是异常:才根据心跳来展示门店营业状态 [数据延迟比较严重:同时也需要通过OMS推门店状态给插件] //只有上一次心跳是异常:才根据心跳来展示门店营业状态 [数据延迟比较严重:同时也需要通过OMS推门店状态给插件]
if(m_bLastHeartIsError){ if(m_bLastHeartIsError){
QJsonObject storeStatusData = recvJson[JSON_DATA].toObject(); if( recvJson.contains(JSON_ELESTORESTS) ){
if( storeStatusData.contains(JSON_ELESTORESTS) ){ m_eleStoreStatus = recvJson[JSON_ELESTORESTS].toInt();
m_eleStoreStatus = storeStatusData[JSON_ELESTORESTS].toInt();
} }
if( storeStatusData.contains(JSON_MODSTORESTS) ){ if( recvJson.contains(JSON_MODSTORESTS) ){
m_modStoreStatus = storeStatusData[JSON_MODSTORESTS].toInt(); m_modStoreStatus = recvJson[JSON_MODSTORESTS].toInt();
} }
if( storeStatusData.contains(JSON_MOPSTORESTS) ){ if( recvJson.contains(JSON_MOPSTORESTS) ){
m_mopStoreStatus = storeStatusData[JSON_MOPSTORESTS].toInt(); m_mopStoreStatus = recvJson[JSON_MOPSTORESTS].toInt();
} }
QLOG_INFO()<<QString("[<<<<---FlowControl::_SendHeart eleStoreStatus:%1;modStoreStatus:%2;mopStoreStatus:%3 --->>>>]"). QLOG_INFO()<<QString("[<<<<---FlowControl::_SendHeart eleStoreStatus:%1;modStoreStatus:%2;mopStoreStatus:%3 --->>>>]").
arg(m_eleStoreStatus).arg(m_modStoreStatus).arg(m_mopStoreStatus); arg(m_eleStoreStatus).arg(m_modStoreStatus).arg(m_mopStoreStatus);
...@@ -2341,15 +2338,13 @@ bool FlowControl::_ResponseOMS12Request(const QJsonObject &content, QJsonObject ...@@ -2341,15 +2338,13 @@ bool FlowControl::_ResponseOMS12Request(const QJsonObject &content, QJsonObject
//如果登录成功 or 插件正在尝试登录中:则return true 并返回相应的错误信息; //如果登录成功 or 插件正在尝试登录中:则return true 并返回相应的错误信息;
if(result){ if(result){
if(!content["storeId"].toString().compare(m_storeId)) { if(!content["storeId"].toString().compare(m_storeId)) {
QJsonObject storeStatusData = content["data"].toObject(); QLOG_INFO()<<"FlowControl::_ResponseOMS12Request:"<<content;
QLOG_INFO()<<"FlowControl::_ResponseOMS12Request:"<<storeStatusData; m_eleStoreStatus = content[JSON_ELESTORESTS].toInt();
m_eleStoreStatus = storeStatusData[JSON_ELESTORESTS].toInt(); m_modStoreStatus = content[JSON_MODSTORESTS].toInt();
m_modStoreStatus = storeStatusData[JSON_MODSTORESTS].toInt(); m_mopStoreStatus = content[JSON_MOPSTORESTS].toInt();
m_mopStoreStatus = storeStatusData[JSON_MOPSTORESTS].toInt();
QLOG_INFO()<<QString("[<<<<---FlowControl::_ResponseOMS12Request eleStoreStatus:%1;modStoreStatus:%2;mopStoreStatus:%3 --->>>>]"). QLOG_INFO()<<QString("[<<<<---FlowControl::_ResponseOMS12Request eleStoreStatus:%1;modStoreStatus:%2;mopStoreStatus:%3 --->>>>]").
arg(m_eleStoreStatus).arg(m_modStoreStatus).arg(m_mopStoreStatus); arg(m_eleStoreStatus).arg(m_modStoreStatus).arg(m_mopStoreStatus);
emit doUpdateStoreStatus(m_eleStoreStatus,m_modStoreStatus,m_mopStoreStatus); emit doUpdateStoreStatus(m_eleStoreStatus,m_modStoreStatus,m_mopStoreStatus);
error=QString("success"); error=QString("success");
result = true; result = true;
} else { } else {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include "ui_floatForm.h" #include "ui_floatForm.h"
#include "windows.h" #include "windows.h"
#include <QPixmap> #include <QPixmap>
#include <QLabel>
#include "DTools/configManger.h" #include "DTools/configManger.h"
#include "preDefine.h" #include "preDefine.h"
#include "QsLog.h" #include "QsLog.h"
...@@ -19,12 +20,11 @@ FloatForm::FloatForm(QWidget *parent) : ...@@ -19,12 +20,11 @@ FloatForm::FloatForm(QWidget *parent) :
m_bReminding = false; m_bReminding = false;
m_bStoreStatus = true; //程序启动后,初始化为开店状态; m_bStoreStatus = true; //程序启动后,初始化为开店状态;
/*
QPixmap imgNormal(":float_normal.png"); QPixmap imgNormal(":float_normal.png"); m_imgNormalSize = imgNormal.size();
m_imgNormalSize = imgNormal.size(); */
QPixmap imgStoreBusiStat(":StoreBusinessStatus.png");
QPixmap imgStoreClose(":float_storeCloseStatus.png"); m_imgStoreBusiStatSize = imgStoreBusiStat.size();
m_imgStoreCloseSize = imgStoreClose.size();
QPixmap imgRemind(":float_remind.png"); QPixmap imgRemind(":float_remind.png");
m_imgRemindSize = imgRemind.size(); m_imgRemindSize = imgRemind.size();
...@@ -57,20 +57,19 @@ void FloatForm::mouseMoveEvent(QMouseEvent *event) ...@@ -57,20 +57,19 @@ void FloatForm::mouseMoveEvent(QMouseEvent *event)
void FloatForm::mousePressEvent(QMouseEvent *event) void FloatForm::mousePressEvent(QMouseEvent *event)
{ {
if (event->button()==Qt::LeftButton) if (event->button()==Qt::LeftButton) {
{
m_bMousePress = true; m_bMousePress = true;
m_lastMousePos = event->globalPos(); m_lastMousePos = event->globalPos();
m_absMove = QPoint(0,0); m_absMove = QPoint(0,0);
} }
// if(event->button()==Qt::RightButton) /*
// { if(event->button()==Qt::RightButton) {
sInfoThread.terminate();
// sInfoThread.terminate(); workThread.terminate();
// workThread.terminate(); qApp->exit(-1);
// qApp->exit(-1); QProcess::startDetached(qApp->applicationFilePath(), QStringList(qApp->applicationFilePath()));
// QProcess::startDetached(qApp->applicationFilePath(), QStringList(qApp->applicationFilePath())); }
// } */
} }
void FloatForm::mouseReleaseEvent(QMouseEvent *event) void FloatForm::mouseReleaseEvent(QMouseEvent *event)
...@@ -109,16 +108,13 @@ void FloatForm::_Init() ...@@ -109,16 +108,13 @@ void FloatForm::_Init()
{ {
setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool); setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool);
setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_TranslucentBackground);
//根据门店的开店/关店 状态来显示不同的图片; //根据门店的开店/关店 状态来显示不同的图片;
if(m_bStoreStatus) { setFixedSize(m_imgStoreBusiStatSize);
setFixedSize(m_imgNormalSize); setStyleSheet("#floatWdg{ border-image: url(:StoreBusinessStatus.png); }");
setStyleSheet("#floatWdg{ border-image: url(:float_normal.png); }"); //初始化悬浮框 多渠道门店营业状态;
}else{ RefreshStoreStatus();
setFixedSize(m_imgStoreCloseSize);
setStyleSheet("#floatWdg{ border-image: url(:float_storeCloseStatus.png); }");
}
//setFixedSize(m_imgNormalSize);
//setStyleSheet("#floatWdg{ border-image: url(:float_normal.png); }");
QPoint point = ConfigManger::GetInstance().GetFloatInitPostion(); QPoint point = ConfigManger::GetInstance().GetFloatInitPostion();
QLOG_INFO()<<QString::fromLocal8Bit("Float From Init Postion(x:%1,y:%2)").arg(point.x()).arg(point.y()); QLOG_INFO()<<QString::fromLocal8Bit("Float From Init Postion(x:%1,y:%2)").arg(point.x()).arg(point.y());
int nWidth = GetSystemMetrics(SM_CXSCREEN) - 200; int nWidth = GetSystemMetrics(SM_CXSCREEN) - 200;
...@@ -142,8 +138,9 @@ void FloatForm::_Blink() ...@@ -142,8 +138,9 @@ void FloatForm::_Blink()
m_animation.setEndValue(0); m_animation.setEndValue(0);
m_animation.start(); m_animation.start();
loop.exec(); loop.exec();
this->setFixedSize(m_imgRemindSize); //this->setFixedSize(m_imgRemindSize);
ui->floatWdg->setStyleSheet("#floatWdg{ border-image: url(:float_remind.png);}"); //ui->floatWdg->setStyleSheet("#floatWdg{ border-image: url(:float_remind.png);}");
m_animation.setStartValue(0); m_animation.setStartValue(0);
m_animation.setEndValue(1); m_animation.setEndValue(1);
m_animation.start(); m_animation.start();
...@@ -153,13 +150,12 @@ void FloatForm::_Blink() ...@@ -153,13 +150,12 @@ void FloatForm::_Blink()
m_animation.start(); m_animation.start();
loop.exec(); loop.exec();
/*
if(m_bStoreStatus) { if(m_bStoreStatus) {
this->setFixedSize(m_imgNormalSize); this->setFixedSize(m_imgNormalSize);
ui->floatWdg->setStyleSheet("#floatWdg{ border-image: url(:float_normal.png);}"); ui->floatWdg->setStyleSheet("#floatWdg{ border-image: url(:float_normal.png);}");
}else{ }*/
this->setFixedSize(m_imgStoreCloseSize);
ui->floatWdg->setStyleSheet("#floatWdg{ border-image: url(:float_storeCloseStatus.png);}");
}
m_animation.setStartValue(0); m_animation.setStartValue(0);
m_animation.setEndValue(1); m_animation.setEndValue(1);
m_animation.start(); m_animation.start();
...@@ -197,6 +193,7 @@ void FloatForm::onStartRemind(int type) ...@@ -197,6 +193,7 @@ void FloatForm::onStartRemind(int type)
if(!m_bReminding) { if(!m_bReminding) {
m_bReminding = true; m_bReminding = true;
RefreshOrderManagerStatus(1);
} }
//10s后触发将闪烁提醒标志(m_bReminding)重置为False事件; //10s后触发将闪烁提醒标志(m_bReminding)重置为False事件;
QTimer::singleShot(1000*10, this, &FloatForm::onStopRemind); QTimer::singleShot(1000*10, this, &FloatForm::onStopRemind);
...@@ -208,6 +205,7 @@ void FloatForm::onStartRemind(int type) ...@@ -208,6 +205,7 @@ void FloatForm::onStartRemind(int type)
void FloatForm::onStopRemind() void FloatForm::onStopRemind()
{ {
m_bReminding = false; m_bReminding = false;
RefreshOrderManagerStatus(0);
} }
void FloatForm::onShow() void FloatForm::onShow()
...@@ -234,15 +232,63 @@ void FloatForm::onUnLockFloatForm(){ ...@@ -234,15 +232,63 @@ void FloatForm::onUnLockFloatForm(){
void FloatForm::onUpdateStoreStatus(int eleStoreStatus, int modStoreStatus,int mopStoreStatus){ void FloatForm::onUpdateStoreStatus(int eleStoreStatus, int modStoreStatus,int mopStoreStatus){
QLOG_INFO()<<QString("[<<<----FloatForm::onUpdateStoreStatus:eleStoreStatus, modStoreStatus, mopStoreStatus: --->>>>]")<<eleStoreStatus <<modStoreStatus <<mopStoreStatus ; QLOG_INFO()<<QString("[<<<----FloatForm::onUpdateStoreStatus:eleStoreStatus, modStoreStatus, mopStoreStatus: --->>>>]")<<eleStoreStatus <<modStoreStatus <<mopStoreStatus ;
RefreshStoreStatus(eleStoreStatus, modStoreStatus,mopStoreStatus);
}
/* void FloatForm::RefreshStoreStatus(int eleStoreStatus, int modStoreStatus,int mopStoreStatus){
m_bStoreStatus = flag; QLOG_INFO()<<QString("[<<<----FloatForm::RefreshStoreStatus:--->>>>]");
if(m_bStoreStatus) { //准备MOD门店营业状态Label;
this->setFixedSize(m_imgNormalSize); this->ui->Mod1Lable->resize(56, 14); //图片源文件大小
ui->floatWdg->setStyleSheet("#floatWdg{ border-image: url(:float_normal.png);}"); this->ui->Mod1Lable->move(10, 40); //左边距10像素;
this->ui->Mod1Lable->setPixmap(QPixmap(":ModTitle.png"));
this->ui->Mod2Lable->resize(44, 20); //图片源文件大小
this->ui->Mod2Lable->move(70, 36); // 在 Mod1Lable 基础上 x+4; y-4;
if(1 == modStoreStatus){
this->ui->Mod2Lable->setPixmap(QPixmap(":StoreOn.png"));
}else{ }else{
this->setFixedSize(m_imgStoreCloseSize); this->ui->Mod2Lable->setPixmap(QPixmap(":StoreOff.png"));
ui->floatWdg->setStyleSheet("#floatWdg{ border-image: url(:float_storeCloseStatus.png);}");
} }
*/
//准备Eleme门店营业状态Label;
this->ui->Eleme1Lable->resize(43, 14); //图片源文件大小
this->ui->Eleme1Lable->move(10, 66); //左边距10像素;高度距离上面一个标签 高度 + 10 像素间隔;
this->ui->Eleme1Lable->setPixmap(QPixmap(":ElemeTitle.png"));
this->ui->Eleme2Lable->resize(44, 20); //图片源文件大小
this->ui->Eleme2Lable->move(70, 62); // x 与 Mod1Lable 对齐; y-4;
if(1 == eleStoreStatus){
this->ui->Eleme2Lable->setPixmap(QPixmap(":StoreOn.png"));
}else{
this->ui->Eleme2Lable->setPixmap(QPixmap(":StoreOff.png"));
}
//准备Mop门店营业状态Label;
this->ui->Mop1Lable->resize(56, 14); //图片源文件大小
this->ui->Mop1Lable->move(10, 92); //左边距10像素;高度距离上面一个标签 高度 + 10 像素间隔;
this->ui->Mop1Lable->setPixmap(QPixmap(":MopTitle.png"));
this->ui->Mop2Lable->resize(44, 20); //图片源文件大小
this->ui->Mop2Lable->move(70, 88); // x 与 Mod1Lable 对齐; y-4;
if(1 == mopStoreStatus){
this->ui->Mop2Lable->setPixmap(QPixmap(":StoreOn.png"));
}else{
this->ui->Mop2Lable->setPixmap(QPixmap(":StoreOff.png"));
}
//准备订单管理状态Label;
this->ui->OrderManagerLable->resize(120, 36); //图片源文件大小; x缩小10像素;
this->ui->OrderManagerLable->move(2, 118); //左边距0像素;高度距离上面一个标签 高度 + 10 像素间隔;
this->ui->OrderManagerLable->setPixmap(QPixmap(":NomalOrderManager.png"));
} }
void FloatForm::RefreshOrderManagerStatus(int existNewOrder){
QLOG_INFO()<<QString("[<<<----FloatForm::RefreshOrderManagerStatus:%1--->>>>]").arg(existNewOrder);
if(existNewOrder){ //有新订单;
this->ui->OrderManagerLable->resize(120, 36); //图片源文件大小; x缩小10像素;
this->ui->OrderManagerLable->move(2, 118); //左边距0像素;高度距离上面一个标签 高度 + 10 像素间隔;
this->ui->OrderManagerLable->setPixmap(QPixmap(":ComeNewOrder.png"));
} else { //无新订单;
this->ui->OrderManagerLable->resize(120, 36); //图片源文件大小; x缩小10像素;
this->ui->OrderManagerLable->move(2, 118); //左边距0像素;高度距离上面一个标签 高度 + 10 像素间隔;
this->ui->OrderManagerLable->setPixmap(QPixmap(":NomalOrderManager.png"));
}
}
...@@ -39,12 +39,10 @@ private: ...@@ -39,12 +39,10 @@ private:
// 记录门店营业状态 // 记录门店营业状态
bool m_bStoreStatus; bool m_bStoreStatus;
// 记录正常状态图片的大小
QSize m_imgNormalSize;
// 记录提示状态图片的大小 // 记录提示状态图片的大小
QSize m_imgRemindSize; QSize m_imgRemindSize;
// 记录门店关店状态图片的大小[和正常状态大小一样,此时主要用表现门店的关店状态:切换了图片] // 三个渠道的门店营业状态;
QSize m_imgStoreCloseSize; QSize m_imgStoreBusiStatSize;
// 记录是否正在提示 // 记录是否正在提示
bool m_bReminding; bool m_bReminding;
// 闪烁动画 // 闪烁动画
...@@ -117,6 +115,18 @@ public slots: ...@@ -117,6 +115,18 @@ public slots:
* */ * */
void onUpdateStoreStatus(int eleStoreStatus, int modStoreStatus,int mopStoreStatus); void onUpdateStoreStatus(int eleStoreStatus, int modStoreStatus,int mopStoreStatus);
/* 功能:更新多渠道门店营业状态显示;
* 参数:1 [ele开关店状态] 2[MOD开关店状态] 3[MOP开关店状态]
* 返回:NULL
* */
void RefreshStoreStatus(int eleStoreStatus=1, int modStoreStatus=1,int mopStoreStatus=1);
/* 功能:新订单到POS更新悬浮框显示;
* 参数:1 [是否存在新订单]
* 返回:NULL
* */
void RefreshOrderManagerStatus(int existNewOrder=0);
}; };
#endif // FLOATFORM_H #endif // FLOATFORM_H
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>171</width> <width>158</width>
<height>141</height> <height>204</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -18,7 +18,108 @@ ...@@ -18,7 +18,108 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QWidget" name="floatWdg" native="true"/> <widget class="QWidget" name="floatWdg" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QLabel" name="Mod1Lable">
<property name="geometry">
<rect>
<x>0</x>
<y>30</y>
<width>61</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="Mod2Lable">
<property name="geometry">
<rect>
<x>60</x>
<y>30</y>
<width>61</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="Eleme1Lable">
<property name="geometry">
<rect>
<x>0</x>
<y>70</y>
<width>61</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="Eleme2Lable">
<property name="geometry">
<rect>
<x>60</x>
<y>70</y>
<width>61</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="Mop1Lable">
<property name="geometry">
<rect>
<x>0</x>
<y>100</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="Mop2Lable">
<property name="geometry">
<rect>
<x>60</x>
<y>90</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="OrderManagerLable">
<property name="geometry">
<rect>
<x>0</x>
<y>121</y>
<width>121</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
......
...@@ -35,5 +35,13 @@ ...@@ -35,5 +35,13 @@
<file>left_arrow.png</file> <file>left_arrow.png</file>
<file>left_arrow_press.png</file> <file>left_arrow_press.png</file>
<file>right_arrow_press.png</file> <file>right_arrow_press.png</file>
<file>StoreBusinessStatus.png</file>
<file>ComeNewOrder.png</file>
<file>NomalOrderManager.png</file>
<file>ElemeTitle.png</file>
<file>ModTitle.png</file>
<file>MopTitle.png</file>
<file>StoreOff.png</file>
<file>StoreOn.png</file>
</qresource> </qresource>
</RCC> </RCC>
\ No newline at end of file
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment