Commit b8fda1b3 by 李定达

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

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