Commit 6d726341 by wuyang.zou

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

parent 09ec3ce3
......@@ -745,11 +745,9 @@ bool FlowControl::_Login()
emit setCashierInfo(m_cashierName);
//***********************登陆时获取门店的营业状态 begin ************************//
QJsonObject storeStatusData = recvJson[JSON_DATA].toObject();
QLOG_INFO()<<"FlowControl::_Login:"<<storeStatusData;
m_eleStoreStatus = storeStatusData[JSON_ELESTORESTS].toInt();
m_modStoreStatus = storeStatusData[JSON_MODSTORESTS].toInt();
m_mopStoreStatus = storeStatusData[JSON_MOPSTORESTS].toInt();
m_eleStoreStatus = recvJson[JSON_ELESTORESTS].toInt();
m_modStoreStatus = recvJson[JSON_MODSTORESTS].toInt();
m_mopStoreStatus = recvJson[JSON_MOPSTORESTS].toInt();
QLOG_INFO()<<QString("[<<<<---FlowControl::_Login eleStoreStatus:%1;modStoreStatus:%2;mopStoreStatus:%3 --->>>>]").
arg(m_eleStoreStatus).arg(m_modStoreStatus).arg(m_mopStoreStatus);
emit doUpdateStoreStatus(m_eleStoreStatus,m_modStoreStatus,m_mopStoreStatus);
......@@ -983,15 +981,14 @@ bool FlowControl::_SendHeart()
emit setNetStatus(QString::fromLocal8Bit("<font color='#f5f5f5'>正常</font>"));
//只有上一次心跳是异常:才根据心跳来展示门店营业状态 [数据延迟比较严重:同时也需要通过OMS推门店状态给插件]
if(m_bLastHeartIsError){
QJsonObject storeStatusData = recvJson[JSON_DATA].toObject();
if( storeStatusData.contains(JSON_ELESTORESTS) ){
m_eleStoreStatus = storeStatusData[JSON_ELESTORESTS].toInt();
if( recvJson.contains(JSON_ELESTORESTS) ){
m_eleStoreStatus = recvJson[JSON_ELESTORESTS].toInt();
}
if( storeStatusData.contains(JSON_MODSTORESTS) ){
m_modStoreStatus = storeStatusData[JSON_MODSTORESTS].toInt();
if( recvJson.contains(JSON_MODSTORESTS) ){
m_modStoreStatus = recvJson[JSON_MODSTORESTS].toInt();
}
if( storeStatusData.contains(JSON_MOPSTORESTS) ){
m_mopStoreStatus = storeStatusData[JSON_MOPSTORESTS].toInt();
if( recvJson.contains(JSON_MOPSTORESTS) ){
m_mopStoreStatus = recvJson[JSON_MOPSTORESTS].toInt();
}
QLOG_INFO()<<QString("[<<<<---FlowControl::_SendHeart eleStoreStatus:%1;modStoreStatus:%2;mopStoreStatus:%3 --->>>>]").
arg(m_eleStoreStatus).arg(m_modStoreStatus).arg(m_mopStoreStatus);
......@@ -2341,15 +2338,13 @@ bool FlowControl::_ResponseOMS12Request(const QJsonObject &content, QJsonObject
//如果登录成功 or 插件正在尝试登录中:则return true 并返回相应的错误信息;
if(result){
if(!content["storeId"].toString().compare(m_storeId)) {
QJsonObject storeStatusData = content["data"].toObject();
QLOG_INFO()<<"FlowControl::_ResponseOMS12Request:"<<storeStatusData;
m_eleStoreStatus = storeStatusData[JSON_ELESTORESTS].toInt();
m_modStoreStatus = storeStatusData[JSON_MODSTORESTS].toInt();
m_mopStoreStatus = storeStatusData[JSON_MOPSTORESTS].toInt();
QLOG_INFO()<<"FlowControl::_ResponseOMS12Request:"<<content;
m_eleStoreStatus = content[JSON_ELESTORESTS].toInt();
m_modStoreStatus = content[JSON_MODSTORESTS].toInt();
m_mopStoreStatus = content[JSON_MOPSTORESTS].toInt();
QLOG_INFO()<<QString("[<<<<---FlowControl::_ResponseOMS12Request eleStoreStatus:%1;modStoreStatus:%2;mopStoreStatus:%3 --->>>>]").
arg(m_eleStoreStatus).arg(m_modStoreStatus).arg(m_mopStoreStatus);
emit doUpdateStoreStatus(m_eleStoreStatus,m_modStoreStatus,m_mopStoreStatus);
error=QString("success");
result = true;
} else {
......
......@@ -2,6 +2,7 @@
#include "ui_floatForm.h"
#include "windows.h"
#include <QPixmap>
#include <QLabel>
#include "DTools/configManger.h"
#include "preDefine.h"
#include "QsLog.h"
......@@ -19,12 +20,11 @@ FloatForm::FloatForm(QWidget *parent) :
m_bReminding = false;
m_bStoreStatus = true; //程序启动后,初始化为开店状态;
QPixmap imgNormal(":float_normal.png");
m_imgNormalSize = imgNormal.size();
QPixmap imgStoreClose(":float_storeCloseStatus.png");
m_imgStoreCloseSize = imgStoreClose.size();
/*
QPixmap imgNormal(":float_normal.png"); m_imgNormalSize = imgNormal.size();
*/
QPixmap imgStoreBusiStat(":StoreBusinessStatus.png");
m_imgStoreBusiStatSize = imgStoreBusiStat.size();
QPixmap imgRemind(":float_remind.png");
m_imgRemindSize = imgRemind.size();
......@@ -57,20 +57,19 @@ void FloatForm::mouseMoveEvent(QMouseEvent *event)
void FloatForm::mousePressEvent(QMouseEvent *event)
{
if (event->button()==Qt::LeftButton)
{
if (event->button()==Qt::LeftButton) {
m_bMousePress = true;
m_lastMousePos = event->globalPos();
m_absMove = QPoint(0,0);
}
// if(event->button()==Qt::RightButton)
// {
// sInfoThread.terminate();
// workThread.terminate();
// qApp->exit(-1);
// QProcess::startDetached(qApp->applicationFilePath(), QStringList(qApp->applicationFilePath()));
// }
/*
if(event->button()==Qt::RightButton) {
sInfoThread.terminate();
workThread.terminate();
qApp->exit(-1);
QProcess::startDetached(qApp->applicationFilePath(), QStringList(qApp->applicationFilePath()));
}
*/
}
void FloatForm::mouseReleaseEvent(QMouseEvent *event)
......@@ -109,16 +108,13 @@ void FloatForm::_Init()
{
setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool);
setAttribute(Qt::WA_TranslucentBackground);
//根据门店的开店/关店 状态来显示不同的图片;
if(m_bStoreStatus) {
setFixedSize(m_imgNormalSize);
setStyleSheet("#floatWdg{ border-image: url(:float_normal.png); }");
}else{
setFixedSize(m_imgStoreCloseSize);
setStyleSheet("#floatWdg{ border-image: url(:float_storeCloseStatus.png); }");
}
//setFixedSize(m_imgNormalSize);
//setStyleSheet("#floatWdg{ border-image: url(:float_normal.png); }");
setFixedSize(m_imgStoreBusiStatSize);
setStyleSheet("#floatWdg{ border-image: url(:StoreBusinessStatus.png); }");
//初始化悬浮框 多渠道门店营业状态;
RefreshStoreStatus();
QPoint point = ConfigManger::GetInstance().GetFloatInitPostion();
QLOG_INFO()<<QString::fromLocal8Bit("Float From Init Postion(x:%1,y:%2)").arg(point.x()).arg(point.y());
int nWidth = GetSystemMetrics(SM_CXSCREEN) - 200;
......@@ -142,8 +138,9 @@ void FloatForm::_Blink()
m_animation.setEndValue(0);
m_animation.start();
loop.exec();
this->setFixedSize(m_imgRemindSize);
ui->floatWdg->setStyleSheet("#floatWdg{ border-image: url(:float_remind.png);}");
//this->setFixedSize(m_imgRemindSize);
//ui->floatWdg->setStyleSheet("#floatWdg{ border-image: url(:float_remind.png);}");
m_animation.setStartValue(0);
m_animation.setEndValue(1);
m_animation.start();
......@@ -153,13 +150,12 @@ void FloatForm::_Blink()
m_animation.start();
loop.exec();
/*
if(m_bStoreStatus) {
this->setFixedSize(m_imgNormalSize);
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.setEndValue(1);
m_animation.start();
......@@ -197,6 +193,7 @@ void FloatForm::onStartRemind(int type)
if(!m_bReminding) {
m_bReminding = true;
RefreshOrderManagerStatus(1);
}
//10s后触发将闪烁提醒标志(m_bReminding)重置为False事件;
QTimer::singleShot(1000*10, this, &FloatForm::onStopRemind);
......@@ -208,6 +205,7 @@ void FloatForm::onStartRemind(int type)
void FloatForm::onStopRemind()
{
m_bReminding = false;
RefreshOrderManagerStatus(0);
}
void FloatForm::onShow()
......@@ -234,15 +232,63 @@ void FloatForm::onUnLockFloatForm(){
void FloatForm::onUpdateStoreStatus(int eleStoreStatus, int modStoreStatus,int mopStoreStatus){
QLOG_INFO()<<QString("[<<<----FloatForm::onUpdateStoreStatus:eleStoreStatus, modStoreStatus, mopStoreStatus: --->>>>]")<<eleStoreStatus <<modStoreStatus <<mopStoreStatus ;
RefreshStoreStatus(eleStoreStatus, modStoreStatus,mopStoreStatus);
}
/*
m_bStoreStatus = flag;
if(m_bStoreStatus) {
this->setFixedSize(m_imgNormalSize);
ui->floatWdg->setStyleSheet("#floatWdg{ border-image: url(:float_normal.png);}");
void FloatForm::RefreshStoreStatus(int eleStoreStatus, int modStoreStatus,int mopStoreStatus){
QLOG_INFO()<<QString("[<<<----FloatForm::RefreshStoreStatus:--->>>>]");
//准备MOD门店营业状态Label;
this->ui->Mod1Lable->resize(56, 14); //图片源文件大小
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{
this->setFixedSize(m_imgStoreCloseSize);
ui->floatWdg->setStyleSheet("#floatWdg{ border-image: url(:float_storeCloseStatus.png);}");
this->ui->Mod2Lable->setPixmap(QPixmap(":StoreOff.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:
// 记录门店营业状态
bool m_bStoreStatus;
// 记录正常状态图片的大小
QSize m_imgNormalSize;
// 记录提示状态图片的大小
QSize m_imgRemindSize;
// 记录门店关店状态图片的大小[和正常状态大小一样,此时主要用表现门店的关店状态:切换了图片]
QSize m_imgStoreCloseSize;
// 三个渠道的门店营业状态;
QSize m_imgStoreBusiStatSize;
// 记录是否正在提示
bool m_bReminding;
// 闪烁动画
......@@ -117,6 +115,18 @@ public slots:
* */
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
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>171</width>
<height>141</height>
<width>158</width>
<height>204</height>
</rect>
</property>
<property name="windowTitle">
......@@ -18,7 +18,108 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<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>
</layout>
</widget>
......
......@@ -35,5 +35,13 @@
<file>left_arrow.png</file>
<file>left_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>
</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