Commit b8fda1b3 by 李定达

1.添加自提退单和外卖退单界面展示;2.悬浮窗重新调整调整

parent 6ea54e48
...@@ -26,12 +26,16 @@ QStringList PosOrderPool::s_order_list; ...@@ -26,12 +26,16 @@ QStringList PosOrderPool::s_order_list;
int PosOrderPool::s_takeout_new = 0; int PosOrderPool::s_takeout_new = 0;
//外卖制作单 //外卖制作单
int PosOrderPool::s_takeout_make = 0; int PosOrderPool::s_takeout_make = 0;
//外卖退单
int PosOrderPool::s_takeout_refund;
//外卖票配送单 //外卖票配送单
int PosOrderPool::s_takeout_send = 0; int PosOrderPool::s_takeout_send = 0;
//自提新订单 //自提新订单
int PosOrderPool::s_self_new = 0; int PosOrderPool::s_self_new = 0;
//自提制作单 //自提制作单
int PosOrderPool::s_self_make = 0; int PosOrderPool::s_self_make = 0;
//自提退单
int PosOrderPool::s_self_refund = 0;
//维护以上订单数量的锁 //维护以上订单数量的锁
QMutex PosOrderPool::s_order_num_mutex; QMutex PosOrderPool::s_order_num_mutex;
...@@ -392,13 +396,15 @@ bool PosOrderPool::GetOrderBaseInfo(QString key, QVariantHash &hash) ...@@ -392,13 +396,15 @@ bool PosOrderPool::GetOrderBaseInfo(QString key, QVariantHash &hash)
return true; return true;
} }
void PosOrderPool::GetOrderNum(int &tk_new, int &tk_make, int &tk_send, int &self_new, int &self_make) void PosOrderPool::GetOrderNum(int &tk_new, int &tk_make, int &tk_send, int tk_refund, int &self_new, int &self_make, int &self_refund)
{ {
tk_new = s_takeout_new; tk_new = s_takeout_new;
tk_make = s_takeout_make; tk_make = s_takeout_make;
tk_send = s_takeout_send; tk_send = s_takeout_send;
tk_refund = s_takeout_refund;
self_new = s_self_new; self_new = s_self_new;
self_make = s_self_make; self_make = s_self_make;
self_refund = s_self_refund;
} }
bool PosOrderPool::event(QEvent *e) bool PosOrderPool::event(QEvent *e)
...@@ -489,11 +495,11 @@ void PosOrderPool::UpdateOrderNum(const OrderObject *order, const OrderObject *o ...@@ -489,11 +495,11 @@ void PosOrderPool::UpdateOrderNum(const OrderObject *order, const OrderObject *o
if(orderold->order_type == TimelyTakeout || orderold->order_type == AppointmentTakeout) if(orderold->order_type == TimelyTakeout || orderold->order_type == AppointmentTakeout)
{ {
DECTAKEOUT(status, s_takeout_new, s_takeout_make, s_takeout_send); DECTAKEOUT(status, s_takeout_new, s_takeout_make, s_takeout_send, s_takeout_refund);
} }
else if(orderold->order_type == TimelyInvite || orderold->order_type == AppointmentInvite) else if(orderold->order_type == TimelyInvite || orderold->order_type == AppointmentInvite)
{ {
DECSELF(status, s_self_new, s_self_make); DECSELF(status, s_self_new, s_self_make, s_self_refund);
} }
} }
...@@ -506,11 +512,11 @@ void PosOrderPool::UpdateOrderNum(const OrderObject *order, const OrderObject *o ...@@ -506,11 +512,11 @@ void PosOrderPool::UpdateOrderNum(const OrderObject *order, const OrderObject *o
if(order->order_type == TimelyTakeout || order->order_type == AppointmentTakeout) if(order->order_type == TimelyTakeout || order->order_type == AppointmentTakeout)
{ {
INCTAKEOUT(status, s_takeout_new, s_takeout_make, s_takeout_send); INCTAKEOUT(status, s_takeout_new, s_takeout_make, s_takeout_send, s_takeout_refund);
} }
else if(order->order_type == TimelyInvite || order->order_type == AppointmentInvite) else if(order->order_type == TimelyInvite || order->order_type == AppointmentInvite)
{ {
INCSELF(status, s_self_new, s_self_make); INCSELF(status, s_self_new, s_self_make, s_self_refund);
} }
} }
} }
......
...@@ -53,36 +53,44 @@ ...@@ -53,36 +53,44 @@
info.order_change_time = QDateTime::currentDateTime().toTime_t(); \ info.order_change_time = QDateTime::currentDateTime().toTime_t(); \
} while (0) } while (0)
#define INCTAKEOUT(tmpstatus, tk_new, tk_make, tk_send) do { \ #define INCTAKEOUT(tmpstatus, tk_new, tk_make, tk_send, tk_refund) do { \
if(tmpstatus == NewOrder) \ if(tmpstatus == NewOrder) \
++ tk_new; \ ++ tk_new; \
else if(tmpstatus == FirmOrder) \ else if(tmpstatus == FirmOrder) \
++ tk_make; \ ++ tk_make; \
else if(tmpstatus == DispatchingOrder) \ else if(tmpstatus == DispatchingOrder) \
++ tk_send; \ ++ tk_send; \
else if(tmpstatus == ApplicationRefundOrder || tmpstatus == ApplicationPartialRefundOrder) \
++ tk_refund; \
} while (0) } while (0)
#define INCSELF(tmpstatus, self_new, self_make) do { \ #define INCSELF(tmpstatus, self_new, self_make, self_refund) do { \
if(tmpstatus == NewOrder) \ if(tmpstatus == NewOrder) \
++ self_new; \ ++ self_new; \
else if(tmpstatus == FirmOrder) \ else if(tmpstatus == FirmOrder) \
++ self_make; \ ++ self_make; \
else if(tmpstatus == ApplicationRefundOrder || tmpstatus == ApplicationPartialRefundOrder) \
++ self_refund; \
} while (0) } while (0)
#define DECTAKEOUT(tmpstatus, tk_new, tk_make, tk_send) do { \ #define DECTAKEOUT(tmpstatus, tk_new, tk_make, tk_send, tk_refund) do { \
if(tmpstatus == NewOrder) \ if(tmpstatus == NewOrder) \
-- tk_new; \ -- tk_new; \
else if(tmpstatus == FirmOrder) \ else if(tmpstatus == FirmOrder) \
-- tk_make; \ -- tk_make; \
else if(tmpstatus == DispatchingOrder) \ else if(tmpstatus == DispatchingOrder) \
-- tk_send; \ -- tk_send; \
else if(tmpstatus == ApplicationRefundOrder || tmpstatus == ApplicationPartialRefundOrder) \
-- tk_refund; \
} while (0) } while (0)
#define DECSELF(tmpstatus, self_new, self_make) do { \ #define DECSELF(tmpstatus, self_new, self_make, self_refund) do { \
if(tmpstatus == NewOrder) \ if(tmpstatus == NewOrder) \
-- self_new; \ -- self_new; \
else if(tmpstatus == FirmOrder) \ else if(tmpstatus == FirmOrder) \
-- self_make; \ -- self_make; \
else if(tmpstatus == ApplicationRefundOrder || tmpstatus == ApplicationPartialRefundOrder) \
-- self_refund; \
} while (0) } while (0)
typedef enum typedef enum
...@@ -185,7 +193,7 @@ public: ...@@ -185,7 +193,7 @@ public:
static bool GetOrderBaseInfo(QString key, QVariantHash &hash); static bool GetOrderBaseInfo(QString key, QVariantHash &hash);
static void GetOrderNum(int &tk_new, int &tk_make, int &tk_send, int &self_new, int &self_make); static void GetOrderNum(int &tk_new, int &tk_make, int &tk_send, int tk_refund, int &self_new, int &self_make, int &self_refund);
virtual bool event(QEvent *e); virtual bool event(QEvent *e);
...@@ -220,10 +228,15 @@ private: ...@@ -220,10 +228,15 @@ private:
static int s_takeout_make; static int s_takeout_make;
//外卖票配送单 //外卖票配送单
static int s_takeout_send; static int s_takeout_send;
//外卖退单
static int s_takeout_refund;
//自提新订单 //自提新订单
static int s_self_new; static int s_self_new;
//自提制作单 //自提制作单
static int s_self_make; static int s_self_make;
//自提退单
static int s_self_refund;
//维护以上订单数量的锁 //维护以上订单数量的锁
static QMutex s_order_num_mutex; static QMutex s_order_num_mutex;
//定时清理订单池 //定时清理订单池
......
...@@ -49,6 +49,11 @@ FloatForm::FloatForm(QWidget *parent) : ...@@ -49,6 +49,11 @@ FloatForm::FloatForm(QWidget *parent) :
connect(&m_raiseTimer, &QTimer::timeout, this, &FloatForm::raise); connect(&m_raiseTimer, &QTimer::timeout, this, &FloatForm::raise);
desktopSize= QApplication::desktop()->screenGeometry().size(); desktopSize= QApplication::desktop()->screenGeometry().size();
desktopSize-= QSize(242, 100); desktopSize-= QSize(242, 100);
//界面数据初始化
ui->label_newnum->setText("0");
ui->label_refundnum->setText("0");
_Init(); _Init();
} }
...@@ -88,18 +93,16 @@ bool FloatForm::event(QEvent *e) ...@@ -88,18 +93,16 @@ bool FloatForm::event(QEvent *e)
int refundstatus, orderstatus; int refundstatus, orderstatus;
bool oldorder; bool oldorder;
int tk_new = 0, tk_make = 0, tk_send = 0; int tk_new = 0, tk_make = 0, tk_send = 0, tk_refund = 0;
int self_new = 0, self_make = 0; int self_new = 0, self_make = 0, self_refund = 0;
PosOrderPool::GetOrderNum(tk_new, tk_make, tk_send, self_new, self_make); PosOrderPool::GetOrderNum(tk_new, tk_make, tk_send, tk_refund, self_new, self_make, self_refund);
QLOG_DEBUG() << "tk_new" << tk_new << "tk_make" << tk_make << "tk_send" << tk_send << "self_new" << self_new << "self_make" << self_make; QLOG_DEBUG() << "tk_new" << tk_new << "tk_make" << tk_make << "tk_send" << tk_send << "self_new" << self_new << "self_make" << self_make;
QLOG_DEBUG() << "tk_refund" << tk_refund << "self_refund" << self_refund;
ui->label_tknew->setText(QString::number(tk_new)); ui->label_newnum->setText(QString::number(tk_new + self_new + tk_make + self_make));
ui->label_tkmake->setText(QString::number(tk_make)); ui->label_refundnum->setText(QString::number(self_refund + tk_refund));
ui->label_tksend->setText(QString::number(tk_send));
ui->label_sfnew->setText(QString::number(self_new));
ui->label_sfmake->setText(QString::number(self_make));
if(!PosOrderPool::GetOrderStatus(orderid, orderstatus, refundstatus, oldorder)) if(!PosOrderPool::GetOrderStatus(orderid, orderstatus, refundstatus, oldorder))
return true; return true;
...@@ -131,18 +134,16 @@ bool FloatForm::event(QEvent *e) ...@@ -131,18 +134,16 @@ bool FloatForm::event(QEvent *e)
if(e->type() == PosEvent::s_delete_order) if(e->type() == PosEvent::s_delete_order)
{ {
int tk_new = 0, tk_make = 0, tk_send = 0; int tk_new = 0, tk_make = 0, tk_send = 0, tk_refund = 0;
int self_new = 0, self_make = 0; int self_new = 0, self_make = 0, self_refund = 0;
PosOrderPool::GetOrderNum(tk_new, tk_make, tk_send, self_new, self_make); PosOrderPool::GetOrderNum(tk_new, tk_make, tk_send, tk_refund, self_new, self_make, self_refund);
QLOG_DEBUG() << "tk_new" << tk_new << "tk_make" << tk_make << "tk_send" << tk_send << "self_new" << self_new << "self_make" << self_make; QLOG_DEBUG() << "tk_new" << tk_new << "tk_make" << tk_make << "tk_send" << tk_send << "self_new" << self_new << "self_make" << self_make;
QLOG_DEBUG() << "tk_refund" << tk_refund << "self_refund" << self_refund;
ui->label_tknew->setText(QString::number(tk_new)); ui->label_newnum->setText(QString::number(tk_new + self_new + tk_make + self_make));
ui->label_tkmake->setText(QString::number(tk_make)); ui->label_refund->setText(QString::number(self_refund + tk_refund));
ui->label_tksend->setText(QString::number(tk_send));
ui->label_sfnew->setText(QString::number(self_new));
ui->label_sfmake->setText(QString::number(self_make));
return true; return true;
} }
...@@ -167,14 +168,20 @@ void FloatForm::mouseMoveEvent(QMouseEvent *event) ...@@ -167,14 +168,20 @@ void FloatForm::mouseMoveEvent(QMouseEvent *event)
{ {
if ((event->buttons()==Qt::LeftButton) && m_bMousePress) if ((event->buttons()==Qt::LeftButton) && m_bMousePress)
{ {
QSize tmpdesktopSize= QApplication::desktop()->screenGeometry().size();
if(!m_is_login)
tmpdesktopSize-= QSize(ui->widget_base->width(), ui->widget_base->height());
else
tmpdesktopSize-= QSize(this->width(), this->height());
QPoint moveAmount = event->globalPos() - m_lastMousePos; QPoint moveAmount = event->globalPos() - m_lastMousePos;
m_absMove += moveAmount; m_absMove += moveAmount;
int x=0,y=0; int x=0,y=0;
x=pos().x()+moveAmount.x(); x=pos().x()+moveAmount.x();
y=pos().y()+moveAmount.y(); y=pos().y()+moveAmount.y();
if(x>desktopSize.width()){x=desktopSize.width();} if(x>tmpdesktopSize.width()){x=tmpdesktopSize.width();}
if(x<0){x=0;} if(x<0){x=0;}
if(y>desktopSize.height()){y=desktopSize.height();} if(y>tmpdesktopSize.height()){y=tmpdesktopSize.height();}
if(y<0){y=0;} if(y<0){y=0;}
move(x,y); move(x,y);
m_lastMousePos = event->globalPos(); m_lastMousePos = event->globalPos();
...@@ -217,6 +224,12 @@ void FloatForm::mouseReleaseEvent(QMouseEvent *event) ...@@ -217,6 +224,12 @@ void FloatForm::mouseReleaseEvent(QMouseEvent *event)
void FloatForm::_Init() void FloatForm::_Init()
{ {
QSize tmpdesktopSize= QApplication::desktop()->screenGeometry().size();
if(!m_is_login)
tmpdesktopSize-= QSize(ui->widget_base->width(), ui->widget_base->height());
else
tmpdesktopSize-= QSize(this->width(), this->height());
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);
...@@ -235,13 +248,13 @@ void FloatForm::_Init() ...@@ -235,13 +248,13 @@ void FloatForm::_Init()
{ {
pos.setY(0); pos.setY(0);
} }
if(pos.x()>desktopSize.width()) if(pos.x()>tmpdesktopSize.width())
{ {
pos.setX(desktopSize.width()); pos.setX(tmpdesktopSize.width());
} }
if(pos.y()>desktopSize.height()) if(pos.y()>tmpdesktopSize.height())
{ {
pos.setY(desktopSize.height()); pos.setY(tmpdesktopSize.height());
} }
move(pos); move(pos);
} }
...@@ -330,12 +343,12 @@ void FloatForm::onStartRemind(int type) ...@@ -330,12 +343,12 @@ void FloatForm::onStartRemind(int type)
m_remindWav = QString("%1/wav/msg.wav").arg(QApplication::applicationDirPath()); m_remindWav = QString("%1/wav/msg.wav").arg(QApplication::applicationDirPath());
// 加上音频的时长 // 加上音频的时长
m_wavPlayInterval = ConfigManger::GetInstance().GetSoundInterval() + VALUE_NEWORDERTIME; m_wavPlayInterval = ConfigManger::GetInstance().GetSoundInterval() + VALUE_NEWORDERTIME;
ui->label_newmsg->setText(QString::fromLocal8Bit("您有新的订单了!\r\n点击打开查看订单")); ui->label_newmsg->setText(QString::fromLocal8Bit("您有新的订单了!\r\n点击打开查看订单!"));
break; break;
case 1: case 1:
m_remindWav = QString("%1/wav/msg1.wav").arg(QApplication::applicationDirPath()); m_remindWav = QString("%1/wav/msg1.wav").arg(QApplication::applicationDirPath());
m_wavPlayInterval = ConfigManger::GetInstance().GetSoundInterval() + VALUE_REFUNDORDERTIME; m_wavPlayInterval = ConfigManger::GetInstance().GetSoundInterval() + VALUE_REFUNDORDERTIME;
ui->label_newmsg->setText(QString::fromLocal8Bit("您有新的退单了!\r\n点击打开查看订单")); ui->label_newmsg->setText(QString::fromLocal8Bit("您有新的退单了!\r\n点击打开查看订单!"));
break; break;
} }
if(m_bReminding) if(m_bReminding)
......
...@@ -25,131 +25,65 @@ ...@@ -25,131 +25,65 @@
<widget class="QLabel" name="label_new"> <widget class="QLabel" name="label_new">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>122</x> <x>127</x>
<y>14</y> <y>20</y>
<width>18</width> <width>20</width>
<height>18</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string></string> <string></string>
</property> </property>
</widget> <property name="alignment">
<widget class="QLabel" name="label_make"> <set>Qt::AlignCenter</set>
<property name="geometry">
<rect>
<x>148</x>
<y>14</y>
<width>18</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string></string>
</property>
</widget>
<widget class="QLabel" name="label_send">
<property name="geometry">
<rect>
<x>175</x>
<y>14</y>
<width>18</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string></string>
</property>
</widget>
<widget class="QLabel" name="label_tknew">
<property name="geometry">
<rect>
<x>122</x>
<y>35</y>
<width>20</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>0</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_tkmake"> <widget class="QLabel" name="label_refund">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>148</x> <x>177</x>
<y>35</y> <y>20</y>
<width>20</width> <width>20</width>
<height>18</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>0</string> <string>退</string>
</property> </property>
</widget> <property name="alignment">
<widget class="QLabel" name="label_tksend"> <set>Qt::AlignCenter</set>
<property name="geometry">
<rect>
<x>175</x>
<y>35</y>
<width>20</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>0</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_tk"> <widget class="QLabel" name="label_newnum">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>100</x> <x>118</x>
<y>35</y> <y>54</y>
<width>20</width> <width>36</width>
<height>20</height> <height>24</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>9999</string>
</property>
</widget>
<widget class="QLabel" name="label_sf">
<property name="geometry">
<rect>
<x>100</x>
<y>65</y>
<width>20</width>
<height>20</height>
</rect>
</property> </property>
<property name="text"> <property name="alignment">
<string/> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_sfnew"> <widget class="QLabel" name="label_refundnum">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>122</x> <x>170</x>
<y>65</y> <y>54</y>
<width>20</width> <width>36</width>
<height>18</height> <height>24</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>0</string> <string>9999</string>
</property>
</widget>
<widget class="QLabel" name="label_sfmake">
<property name="geometry">
<rect>
<x>148</x>
<y>65</y>
<width>20</width>
<height>18</height>
</rect>
</property> </property>
<property name="text"> <property name="alignment">
<string>999</string> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</widget> </widget>
......
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