Commit 31070969 by wuyang.zou

fix bug: 1、控制悬浮框的位置的可移动范围 2、支持第三方订单号的检索;

parent acf01b49
......@@ -671,8 +671,8 @@ bool FlowControl::_PullOrderDetail(const QString& orderId)
}else
{
//获取门店营业状态
QString strOpeStatus=QString::fromLocal8Bit("正常");
emit setOpeStatus(strOpeStatus);
//QString strOpeStatus=QString::fromLocal8Bit("开店");
//emit setOpeStatus(strOpeStatus);
QJsonObject order = recvJson[JSON_DATA].toObject();
_OrderAnalysis(order);
}
......@@ -735,8 +735,8 @@ bool FlowControl::_PullOrderList(const int &pageSize, const int &pageNo)
}else
{
//获取门店营业状态
QString strOpeStatus=QString::fromLocal8Bit("正常");
emit setOpeStatus(strOpeStatus);
//QString strOpeStatus=QString::fromLocal8Bit("开店");
//emit setOpeStatus(strOpeStatus);
QJsonArray orders = recvJson[JSON_DATA].toObject()[JSON_ORDERS].toArray();
foreach(QJsonValue order, orders)
{
......@@ -787,7 +787,6 @@ bool FlowControl::_SendHeart()
.arg(result).arg(error)<<recvJson;
if(!result)
{
//emit showAlert(AlertForm::MSGERROR, QString::fromLocal8Bit("发送心跳失败![网络错误]"));
emit setNetStatus(QString::fromLocal8Bit("<font color='#ff0000'>网络不稳定,正在重试</font>"));
}else
{
......@@ -795,11 +794,23 @@ bool FlowControl::_SendHeart()
if(JSON_STATUSCODE_OK != recvJson[JSON_LOGINCODE].toInt())
{
result = false;
//emit showAlert(AlertForm::MSGERROR, QString::fromLocal8Bit("发送心跳失败![%1]").arg(recvJson[JSON_MESSAGE].toString()));
emit setNetStatus(QString::fromLocal8Bit("<font color='#ff0000'>网络不稳定,正在重试</font>"));
}else{
result = true;
emit setNetStatus(QString::fromLocal8Bit("<font color='#f5f5f5'>正常</font>"));
/* //根据心跳来展示门店营业状态 [数据延迟比较严重:需要通过OMS推门店状态给我]
QJsonObject storeStatusData = recvJson[JSON_DATA].toObject();
int appStoreStatus = storeStatusData[JSON_APPSTORESTS].toInt();
int eleStoreStatus = storeStatusData[JSON_ELESTORESTS].toInt();
QLOG_INFO() << QString("[<<<<---FlowControl::_SendHeart appStoreStatus:%1 ;eleStoreStatus:%2 --->>>>]").arg(appStoreStatus).arg(eleStoreStatus);
if(1==appStoreStatus || 1==eleStoreStatus){
emit doUpdateStoreStatus(true);
emit setOpeStatus(QString::fromLocal8Bit("开店"));
}else{
emit doUpdateStoreStatus(false);
emit setOpeStatus(QString::fromLocal8Bit("关店"));
}
*/
}
}
return result;
......@@ -1833,8 +1844,8 @@ bool FlowControl::_ResponseHM21Request(const QJsonObject &content, QJsonObject &
if(result){
//<1>:更新 OrderObject 中的数据;
//获取门店营业状态
QString strOpeStatus=QString::fromLocal8Bit("正常");
emit setOpeStatus(strOpeStatus);
//QString strOpeStatus=QString::fromLocal8Bit("开店");
//emit setOpeStatus(strOpeStatus);
//增加筛选条件,判断当前POS系统录单的订单是否还没录单完成:如果该订单录单没有完成,不返回100,务必让服务的等待;
if(content[JSON_ORDER_ID].toString().isEmpty()) {
error =QString::fromLocal8Bit("订单号不能为空");
......@@ -2217,18 +2228,27 @@ void FlowControl::onSerachOrder(const QString &text)
{
QString orderId = order.key();
QString phoneId = order.value()->consigneePhone;
QString thirdPartyOrderId = order.value()->thirdPartyOrderId;
while (!orderId.at(0).isDigit())
{
orderId = orderId.mid(1);
}
if(orderId.startsWith(text))
{
orderMap.insert(QString::fromLocal8Bit("订单号:")+orderId,QString::fromLocal8Bit("手机号:")+phoneId);
orderMap.insert(QString::fromLocal8Bit("订单号:")+orderId,QString::fromLocal8Bit("三方订单号:")+thirdPartyOrderId);
}
//移除手机号检索
/*
if(phoneId.startsWith(text))
{
orderMap.insert(QString::fromLocal8Bit("订单号:")+orderId,QString::fromLocal8Bit("手机号:")+phoneId);
}
*/
//新增第三方订单号检索;
if(thirdPartyOrderId.startsWith(text))
{
orderMap.insert(QString::fromLocal8Bit("订单号:")+orderId,QString::fromLocal8Bit("三方订单号:")+thirdPartyOrderId);
}
}
}
emit showSearchOrderResult(orderMap);
......
......@@ -147,6 +147,12 @@ signals:
* */
void doUnLockFloatFrom();
/* 功能:通知 更新门店 开店/关店 状态;
* 参数:1 [true:开店; false:关店]
* 返回:Null
* */
void doUpdateStoreStatus(bool flag);
/* 功能:设置主界面门店信息
* 参数:[1]门店号
......
#include "floatForm.h"
#include "ui_floatForm.h"
#include "windows.h"
#include <QPixmap>
#include "DTools/configManger.h"
#include "preDefine.h"
......@@ -17,9 +18,14 @@ FloatForm::FloatForm(QWidget *parent) :
ui->setupUi(this);
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 imgRemind(":float_remind.png");
m_imgRemindSize = imgRemind.size();
......@@ -84,20 +90,48 @@ void FloatForm::mouseReleaseEvent(QMouseEvent *event)
}
m_bMouseMove = false;
QPoint point = this->pos();
QLOG_INFO()<<QString::fromLocal8Bit("float current Form position(x:%1,y:%2)").arg(point.x()).arg(point.y());
int nWidth = GetSystemMetrics(SM_CXSCREEN) - 200;
int nHeight = GetSystemMetrics(SM_CYSCREEN) - 220;
QLOG_INFO()<<QString::fromLocal8Bit("floatForm active_Range(x:%1,y:%2)").arg(nWidth).arg(nHeight);
if( (point.x()<nWidth && -80<=point.x() && -50<=point.y()) || (point.y()<nHeight && -80<=point.x() && -50<=point.y()) ){
ConfigManger::GetInstance().setFloatInitPostion(this->pos());
}else{
point.setX(nWidth);
point.setY(nHeight);
this->move(QPoint(nWidth, nHeight));
ConfigManger::GetInstance().setFloatInitPostion(point);
}
}
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); }");
//setStyleSheet("#floatWdg{ border-image: url(:logo.svg); }");
}else{
setFixedSize(m_imgStoreCloseSize);
setStyleSheet("#floatWdg{ border-image: url(:float_storeCloseStatus.png); }");
}
//setFixedSize(m_imgNormalSize);
//setStyleSheet("#floatWdg{ border-image: url(:float_normal.png); }");
move(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());
int nWidth = GetSystemMetrics(SM_CXSCREEN) - 200;
int nHeight = GetSystemMetrics(SM_CYSCREEN) - 220;
if( (point.x()<nWidth && -80<=point.x() && -50<=point.y()) || (point.y()<nHeight && -80<=point.x() && -50<=point.y()) ){
ConfigManger::GetInstance().setFloatInitPostion(point);
this->move(point);
}else{
point.setX(nWidth);
point.setY(nHeight);
this->move(QPoint(nWidth, nHeight));
ConfigManger::GetInstance().setFloatInitPostion(point);
}
}
void FloatForm::_Blink()
......@@ -110,7 +144,6 @@ void FloatForm::_Blink()
loop.exec();
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.setEndValue(1);
m_animation.start();
......@@ -119,9 +152,14 @@ void FloatForm::_Blink()
m_animation.setEndValue(0);
m_animation.start();
loop.exec();
if(m_bStoreStatus) {
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.setEndValue(1);
m_animation.start();
......@@ -195,3 +233,15 @@ void FloatForm::onUnLockFloatForm(){
//QThread::sleep(8);
this->setEnabled(true);
}
void FloatForm::onUpdateStoreStatus(bool flag){
QLOG_INFO()<<QString("[<<<----FloatForm::onUpdateStoreStatus:flag: --->>>>]")<<flag;
m_bStoreStatus = flag;
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);}");
}
}
......@@ -35,10 +35,16 @@ private:
QPoint m_lastMousePos;
// 此次拖动一共移动的距离
QPoint m_absMove;
// 记录门店营业状态
bool m_bStoreStatus;
// 记录正常状态图片的大小
QSize m_imgNormalSize;
// 记录提示状态图片的大小
QSize m_imgRemindSize;
// 记录门店关店状态图片的大小[和正常状态大小一样,此时主要用表现门店的关店状态:切换了图片]
QSize m_imgStoreCloseSize;
// 记录是否正在提示
bool m_bReminding;
// 闪烁动画
......@@ -105,6 +111,12 @@ public slots:
* */
void onUnLockFloatForm();
/* 功能:变更门店营业状态;
* 参数:bool [1:true-> 营业; false->关店/打烊]
* 返回:NULL
* */
void onUpdateStoreStatus(bool flag);
};
......
......@@ -95,6 +95,7 @@ int main(int argc, char *argv[])
QObject::connect(&FlowControl::GetInstance(), &FlowControl::doLockFloatForm, &f, &FloatForm::onLockFloatForm);
QObject::connect(&FlowControl::GetInstance(), &FlowControl::doUnLockFloatFrom, &f, &FloatForm::onUnLockFloatForm);
QObject::connect(&FlowControl::GetInstance(), &FlowControl::doUpdateStoreStatus, &f, &FloatForm::onUpdateStoreStatus);
QObject::connect(&w, &MainForm::startRemind, &f, &FloatForm::onStartRemind);
QObject::connect(&w, &MainForm::stopRemind, &f, &FloatForm::onStopRemind);
......
......@@ -98,8 +98,8 @@ void MainForm::MyShow()
m_resultForm = new QListWidget(this);
m_resultForm->setObjectName("mainListWdg0");
m_resultForm->setFixedSize(420, 200);
m_resultForm->move(70, ui->mainFrmSearch->pos().y()-190);
m_resultForm->setFixedSize(520, 200);
m_resultForm->move(10, ui->mainFrmSearch->pos().y()-190);
m_resultForm->hide();
connect(m_resultForm, &QListWidget::itemClicked, this, &MainForm::onSearchResultItemClicked);
......@@ -645,6 +645,7 @@ void MainForm::onSearchResultItemClicked(QListWidgetItem *item)
m_padForm->hide();
m_resultForm->hide();
QString str=item->text();
str=str.mid(4);
QString y = " ";
str=str.mid(0,str.indexOf(y));
......
......@@ -54,6 +54,8 @@
#define JSON_REQTYPE "reqtype"
#define JSON_CURRENTUSER "currentUser"
#define JSON_STOREID "storeId"
#define JSON_APPSTORESTS "appStoreStatus"
#define JSON_ELESTORESTS "eleStoreStatus"
#define JSON_PASSWORD "password"
#define JSON_IPADDRESS "iPAddress"
#define JSON_MACHINECODE "machineCode"
......
......@@ -18,6 +18,7 @@
<file>logo_0.png</file>
<file>float_normal.png</file>
<file>float_remind.png</file>
<file>float_storeCloseStatus.png</file>
<file>detailBtn_close_normal.png</file>
<file>detailBtn_close_press.png</file>
<file>fm.ico</file>
......
No preview for this file type
rcc -binary deaufult.qrc -o deaufult.rcc
pause
\ No newline at end of file
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