Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
takeout_sbk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yunpeng.song
takeout_sbk
Commits
716544c1
Commit
716544c1
authored
Nov 23, 2017
by
yunpeng.song
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
功能完善
parent
a3c1aa47
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
366 additions
and
633 deletions
+366
-633
fmTakeaway/Control/flowControl.cpp
+0
-0
fmTakeaway/Control/flowControl.h
+56
-36
fmTakeaway/DTools/configManger.cpp
+4
-0
fmTakeaway/DTools/configManger.h
+5
-0
fmTakeaway/DTools/dataManger.cpp
+27
-21
fmTakeaway/DTools/dataManger.h
+12
-7
fmTakeaway/DTools/orderstatus.cpp
+26
-5
fmTakeaway/DTools/orderstatus.h
+4
-3
fmTakeaway/Model/orderObject.cpp
+19
-403
fmTakeaway/Model/orderObject.h
+0
-0
fmTakeaway/Network/billSocket.cpp
+0
-1
fmTakeaway/bstatusForm.cpp
+32
-0
fmTakeaway/bstatusForm.h
+3
-1
fmTakeaway/bstatusItem.cpp
+14
-20
fmTakeaway/bstatusItem.h
+8
-3
fmTakeaway/detailForm.cpp
+49
-32
fmTakeaway/detailForm.h
+5
-3
fmTakeaway/detailForm.ui
+8
-8
fmTakeaway/floatForm.cpp
+13
-5
fmTakeaway/floatForm.h
+1
-0
fmTakeaway/floatForm.ui
+3
-0
fmTakeaway/fmTakeaway.pro
+2
-7
fmTakeaway/main.cpp
+1
-0
fmTakeaway/mainForm.cpp
+35
-44
fmTakeaway/mainForm.h
+1
-10
fmTakeaway/mainForm.ui
+21
-16
fmTakeaway/preDefine.h
+4
-1
fmTakeaway/refdishesForm.cpp
+1
-1
fmTakeaway/refuseForm.cpp
+10
-5
fmTakeaway/refuseForm.h
+2
-1
No files found.
fmTakeaway/Control/flowControl.cpp
View file @
716544c1
This diff is collapsed.
Click to expand it.
fmTakeaway/Control/flowControl.h
View file @
716544c1
...
...
@@ -5,19 +5,19 @@
#ifndef FLOWCONTROL_H
#define FLOWCONTROL_H
#include <QObject>
//
#include <QObject>
#include "Network/billSocket.h"
#include "Model/orderObject.h"
#include "Model/deliverObject.h"
#include "Model/cashierObject.h"
#include "Model/dishesObject.h"
#include "alertForm.h"
#include <QMap>
#include <JQHttpServer.h>
#include <QMutex>
#include <QDateTime>
#include <QJsonArray>
#include <QTimer>
#include <QPair>
#include <QSemaphore>
class
FlowControl
:
public
QObject
{
...
...
@@ -32,9 +32,10 @@ private:
typedef
struct
ORDER_PROPERPY
{
bool
bReaded
;
bool
bCancled
;
bool
entryType
;
bool
bReaded
;
//是否成功入账过
bool
bCancled
;
//是否成功退款入账过
bool
entryType
;
//入账类型
int
pullNum
;
//入账失败次数
//QDateTime btimeStamp;
}
OrderProperpy
;
...
...
@@ -46,6 +47,14 @@ private:
QString
orderId
;
}
PullOrderInfo
;
typedef
struct
ORDER_OPERATION
{
int
operation
;
//1:接单,0:取消订单
int
result
;
//1:成功,0:失败
QString
orderId
;
}
OrderOperation
;
private
:
// 门店信息
QString
m_storeId
;
...
...
@@ -55,23 +64,23 @@ private:
QDateTime
m_bDate
;
QString
m_storeName
;
int
m_orderCount
;
QPair
<
QString
,
QString
>
m_orderPair
;
//订单清除定时器
QTimer
*
m_clearTimer
;
QTimer
*
m_heartTimer
;
QTimer
*
m_pullTimer
;
QTimer
*
m_operateTimer
;
QTimer
*
m_loginTimer
;
// 网络通信
BillSocket
*
m_loginSocket
;
BillSocket
*
m_pullOrderSocket
;
BillSocket
*
m_procOrderSocket
;
BillSocket
*
m_pullDishesSocket
;
// 拉取订单的时间戳
QString
m_timestamp
;
// 订单容器
QMap
<
QString
,
OrderObject
*>
m_ordersMap
;
// 是否第一次获取到门店信息
bool
m_bFirstRecvInfo
;
bool
m_bLoginResult
;
bool
m_bOperateResult
;
// HttpServer
JQHttpServer
::
TcpServerManage
*
m_tcpServerManage
;
...
...
@@ -80,11 +89,15 @@ private:
// 已接单的订单
QMap
<
QString
,
OrderProperpy
>
m_ordersMapXbk
;
QMap
<
QString
,
QString
>
m_view2Id
;
//记录当前订单操作
QMap
<
QString
,
int
>
m_orderOperatePair
;
QMutex
m_mutex
;
//订单拉取记录
QList
<
PullOrderInfo
>
m_orderPullList
;
//订单操作互斥信号
QSemaphore
semaphore
;
//订单操作状态
OrderOperation
orderOperation
;
signals
:
// 发送信号给自己 做登陆
void
doLogin
();
...
...
@@ -124,11 +137,6 @@ signals:
* 返回:NULL
* */
void
changeOrderStatus
(
OrderObject
*
orderObject
,
int
oldStatus
=-
100
);
/* 功能:显示配送员选择窗
* 参数:[1]订单编号[2]配送员信息
* 返回:NULL
* */
void
showDeliverPickForm
(
const
QString
&
orderId
,
const
QList
<
DeliverObject
>&
delivers
);
/* 功能:显示订单详情界面
* 参数:[1]收银员信息
* 返回:NULL
...
...
@@ -165,6 +173,17 @@ signals:
void
showDailyReportData
(
QJsonObject
);
void
doPullOrder
(
const
QString
&
orderId
,
const
QString
&
channel
);
/* 功能:通知开始提醒
* 参数:[1]提醒类型
* 返回:NULL
* */
void
startRemind
(
int
);
void
setStoreStatusChanged
(
QJsonArray
);
void
doConfirmOrder
(
const
QString
&
orderId
);
void
doRefundOrder
(
const
QString
&
orderId
,
int
reasonCode
,
const
QString
&
reason
);
void
doStartOperateTimer
();
private
slots
:
bool
_GetStoreInfo
();
...
...
@@ -183,22 +202,16 @@ private slots:
* 返回:是否成功
* */
bool
_SendHeart
();
/* 功能:获取配送员
* 参数:[1]订单编号
* 返回:是否成功
* */
bool
_GetDelivers
(
const
QString
&
orderId
);
/* 功能:确认订单
* 参数:[1]订单编号[2]配送员信息
* 返回:是否成功
* */
bool
_ConfirmOrder
(
const
QString
&
orderId
,
const
DeliverObject
&
deliverObj
);
bool
_ConfirmOrder
(
const
QString
&
orderId
);
/* 功能:拒绝订单
* 参数:[1]订单编号[2]拒单原因
* 返回:是否成功
* */
bool
_RefuseOrder
(
const
QString
&
orderId
,
int
refuseCode
);
bool
_RefuseOrder
(
const
QString
&
orderId
,
int
refuseCode
,
const
QString
reason
);
/* 功能:送出订单
* 参数:[1]订单编号
* 返回:是否成功
...
...
@@ -218,7 +231,7 @@ private slots:
* 参数:NULL
* 返回:是否成功
* */
bool
_RefundOrder
(
const
QString
&
orderId
,
QString
reason
);
bool
_RefundOrder
(
const
QString
&
orderId
,
int
reasonCode
,
const
QString
&
reason
);
/* 功能:获取Json对象的字符
* 参数:NULL
* 返回:Json字符串
...
...
@@ -228,29 +241,36 @@ private slots:
* 参数:NULL
* 返回:Json对象
* */
QJsonObject
_
Get
HttpReplyJson
(
const
int
status
,
const
QString
&
msg
,
const
QJsonObject
&
data
,
const
int
&
iscontinue
);
QJsonObject
_
Pack
HttpReplyJson
(
const
int
status
,
const
QString
&
msg
,
const
QJsonObject
&
data
,
const
int
&
iscontinue
);
/**
*功能:清空订单Map里的订单
*参数:无
*返回:无
**/
void
_ClearOrder
();
bool
_GetReplyJson
(
const
int
&
actionId
,
const
QJsonObject
&
content
,
QJsonObject
&
data
,
QString
&
error
,
const
QString
&
orderId
);
bool
_GetReplyJson
(
const
QJsonObject
&
content
,
QJsonObject
&
data
,
QString
&
error
);
bool
_Get01ReplyJson
(
const
QJsonObject
&
content
,
QJsonObject
&
data
,
QString
&
error
);
bool
_Get02ReplyJson
(
const
QJsonObject
&
content
,
QJsonObject
&
data
,
QString
&
error
);
bool
_Get03ReplyJson
(
const
QJsonObject
&
content
,
QJsonObject
&
data
,
QString
&
error
);
bool
_Get11ReplyJson
(
const
QJsonObject
&
content
,
QJsonObject
&
data
,
QString
&
error
);
bool
_Get12ReplyJson
(
const
QJsonObject
&
content
,
QJsonObject
&
data
,
QString
&
error
);
bool
_GetLoginReplyJson
(
const
QJsonObject
&
content
,
QString
&
error
);
bool
_GetQueryReplyJson
(
QJsonObject
&
data
,
QString
&
error
,
const
QString
&
orderId
);
bool
_GetPushReplyJson
(
QJsonObject
&
data
,
QString
&
error
);
void
_
HandleOrderOperation
(
bool
result
);
void
_HandleOrderOperation
(
const
QString
&
orderId
);
void
_
OperateTimeOut
(
);
// 单位转换
QString
_Penny2Dollar
(
int
penny
);
QString
_GetIpAddress
();
void
_AddOrder
(
const
QString
&
orderId
,
const
QString
&
channel
,
const
int
&
pageNumber
=
1
,
const
int
&
pageSize
=
100
);
void
_AddOrder
Pull
(
const
QString
&
orderId
,
const
QString
&
channel
,
const
int
&
pageNumber
=
1
,
const
int
&
pageSize
=
100
);
void
_GetOrder
(
const
QString
&
orderId
,
const
QString
&
channel
);
//点击屏幕指定区域
void
_ClickOMSAssignArea
();
void
_ClickToLogin
();
void
_StartOperateTimer
();
public
slots
:
...
...
@@ -264,7 +284,7 @@ public slots:
* 参数:[1]操作动作名[2]订单编号[3]配送员姓名
* 返回:NULL
* */
void
onProcessOrder
(
const
QString
&
operation
,
const
QString
&
orderId
,
const
DeliverObject
&
deliverObj
);
void
onProcessOrder
(
const
QString
&
operation
,
const
QString
&
orderId
);
/* 功能:获取订单详情
* 参数:NULL
* 返回:NULL
...
...
@@ -275,8 +295,8 @@ public slots:
* 返回:NULL
* */
void
onSerachOrder
(
const
QString
&
text
);
void
onProcessRejectOrder
(
const
QString
&
orderId
,
const
int
&
reason
);
void
onProcessRepealOrder
(
const
QString
&
orderId
,
const
QString
&
reason
);
void
onProcessRejectOrder
(
const
QString
&
orderId
,
const
int
&
reason
Code
,
const
QString
&
reason
);
void
onProcessRepealOrder
(
const
QString
&
orderId
,
const
int
&
reasonCode
,
const
QString
&
reason
);
/* 功能:获取门店营业状态
* 参数:NULL
...
...
@@ -303,7 +323,7 @@ public slots:
* 参数:NULL
* 返回:NULL
* */
void
onSetStoreOperatingStatus
(
QString
channel
,
int
business_status
);
void
onSetStoreOperatingStatus
(
const
QString
&
channelCode
,
const
QString
&
channelName
,
int
business_status
);
/* 功能:向服务端获取日结数据
* 参数:NULL
* 返回:NULL
...
...
fmTakeaway/DTools/configManger.cpp
View file @
716544c1
...
...
@@ -54,6 +54,10 @@ QString ConfigManger::GetOrderServerUrl()
{
return
m_config
->
value
(
INI_ORDERSERVER
).
toString
();
}
QString
ConfigManger
::
GetStoreServerUrl
()
{
return
m_config
->
value
(
INI_STORESERVER
).
toString
();
}
QString
ConfigManger
::
GetInterfaceName
(
const
QString
&
name
)
{
...
...
fmTakeaway/DTools/configManger.h
View file @
716544c1
...
...
@@ -42,6 +42,11 @@ public:
* 返回:服务器地址
* */
QString
GetOrderServerUrl
();
/* 功能:读取门店服务器地址
* 参数:NULL
* 返回:服务器地址
* */
QString
GetStoreServerUrl
();
/* 功能:读取接口名称
* 参数:NULL
* 返回:服务器地址
...
...
fmTakeaway/DTools/dataManger.cpp
View file @
716544c1
...
...
@@ -31,6 +31,11 @@ void DataManger::SetStoreId(const QString &storeId)
m_storeId
=
storeId
;
}
void
DataManger
::
SetPartnerId
(
const
QString
&
partnerId
)
{
m_partnerId
=
partnerId
;
}
QJsonObject
DataManger
::
GetLoginData
(
const
QString
&
partnerId
,
const
QString
&
storeId
,
const
QString
&
password
,
const
QString
&
stationId
,
const
QString
&
cashierId
,
const
QString
&
ipAddress
)
{
...
...
@@ -45,13 +50,13 @@ QJsonObject DataManger::GetLoginData(const QString &partnerId, const QString &st
return
rObj
;
}
QJsonObject
DataManger
::
GetHeartData
(
const
QString
&
pa
rtnerId
,
const
QString
&
storeId
,
const
QString
&
pa
ssword
,
const
QString
&
stationId
,
const
QString
&
cashierId
,
const
QString
&
ipAddress
)
QJsonObject
DataManger
::
GetHeartData
(
const
QString
&
password
,
const
QString
&
stationId
,
const
QString
&
ipAddress
)
{
QJsonObject
rObj
;
rObj
.
insert
(
JSON_IPADDRESS
,
ipAddress
);
rObj
.
insert
(
JSON_PARTNERID
,
partnerId
);
rObj
.
insert
(
JSON_ORGCODE
,
storeId
);
rObj
.
insert
(
JSON_PARTNERID
,
m_
partnerId
);
rObj
.
insert
(
JSON_ORGCODE
,
m_
storeId
);
rObj
.
insert
(
JSON_PASSWORD
,
password
);
rObj
.
insert
(
JSON_MACHINECODE
,
stationId
);
//rObj.insert(JSON_USERID, cashierId);
...
...
@@ -59,8 +64,7 @@ QJsonObject DataManger::GetHeartData(const QString &partnerId, const QString &st
}
QJsonObject
DataManger
::
GetPullOrderData
(
const
QString
&
orderId
,
const
QString
&
channel
,
/*const int &autoconfirm,*/
const
QString
&
storeId
,
const
int
&
pageNumber
,
const
int
&
pageSize
)
const
int
&
pageNumber
,
const
int
&
pageSize
)
{
QJsonObject
rObj
;
if
(
orderId
.
isEmpty
())
...
...
@@ -70,7 +74,7 @@ QJsonObject DataManger::GetPullOrderData(const QString &orderId, const QString &
}
rObj
.
insert
(
JSON_BUSINESSID
,
orderId
);
rObj
.
insert
(
JSON_CHANNEL
,
channel
);
rObj
.
insert
(
JSON_SHOPCODE
,
storeId
);
rObj
.
insert
(
JSON_SHOPCODE
,
m_
storeId
);
//rObj.insert(JSON_AUTOCONFIRM, autoconfirm);
return
rObj
;
}
...
...
@@ -86,13 +90,12 @@ QJsonObject DataManger::GetPullDeliverData(const QString &storeId, const QString
return
rObj
;
}
QJsonObject
DataManger
::
GetConfirmOrderData
(
const
QString
&
orderId
,
const
QString
&
channel
,
const
QString
&
shopCode
)
QJsonObject
DataManger
::
GetConfirmOrderData
(
const
QString
&
orderId
,
const
QString
&
channel
)
{
QJsonObject
rObj
;
//rObj.insert(JSON_REQTYPE, CONFIRM_ORDER);
rObj
.
insert
(
JSON_BUSINESSID
,
orderId
);
rObj
.
insert
(
JSON_CHANNEL
,
channel
);
rObj
.
insert
(
JSON_SHOPCODE
,
shopCode
);
rObj
.
insert
(
JSON_SHOPCODE
,
m_storeId
);
return
rObj
;
}
...
...
@@ -130,14 +133,14 @@ QJsonObject DataManger::GetCompleteOrderData(const QString &orderId)
return
rObj
;
}
QJsonObject
DataManger
::
GetRefundOrderData
(
const
QString
&
reason
,
const
QString
&
orderId
,
const
QString
&
channel
)
QJsonObject
DataManger
::
GetRefundOrderData
(
int
reasonCode
,
const
QString
&
reason
,
const
QString
&
orderId
,
const
QString
&
channel
)
{
QJsonObject
rObj
;
rObj
.
insert
(
JSON_BUSINESSID
,
orderId
);
//TEST
rObj
.
insert
(
JSON_REASON
,
"其它"
);
//
rObj.insert(JSON_REASON, reason);
rObj
.
insert
(
JSON_CODE
,
-
1
);
//
rObj.insert(JSON_REASON, "其它");
rObj
.
insert
(
JSON_REASON
,
reason
);
rObj
.
insert
(
JSON_CODE
,
reasonCode
);
rObj
.
insert
(
JSON_CHANNEL
,
channel
);
...
...
@@ -208,18 +211,21 @@ QJsonObject DataManger::GetUpdDishesData(QString channelCode, QMap<QString, int>
QJsonObject
DataManger
::
GetStoreChannelInfoData
()
{
QJsonObject
rObj
;
rObj
.
insert
(
JSON_
REQTYPE
,
GET_STORE_CHANNEL_INFO
);
rObj
.
insert
(
JSON_TOKEN
,
m_token
);
rObj
.
insert
(
JSON_
PARTNERID
,
m_partnerId
);
rObj
.
insert
(
"OrganizationCode"
,
m_storeId
);
return
rObj
;
}
QJsonObject
DataManger
::
GetOperatingStatusData
(
const
QString
&
channel
,
int
status
)
{
QJsonObject
rObj
;
rObj
.
insert
(
JSON_REQTYPE
,
SET_STORE_OPERATING_STATUS
);
rObj
.
insert
(
JSON_TOKEN
,
m_token
);
rObj
.
insert
(
JSON_CHANNEL
,
channel
);
rObj
.
insert
(
JSON_BUSINESSSTATUS
,
status
);
QJsonObject
rObj
,
cObj
;
QJsonArray
array
;
rObj
.
insert
(
JSON_PARTNERID
,
m_partnerId
);
rObj
.
insert
(
"OrganizationCode"
,
m_storeId
);
cObj
.
insert
(
JSON_CHANNEL
,
channel
);
cObj
.
insert
(
"state"
,
status
);
array
.
append
(
cObj
);
rObj
.
insert
(
"channel"
,
array
);
return
rObj
;
}
QJsonObject
DataManger
::
GetDayReportData
(
const
QString
&
business
)
...
...
fmTakeaway/DTools/dataManger.h
View file @
716544c1
...
...
@@ -14,10 +14,15 @@ public:
* */
void
SetToken
(
const
QString
&
token
);
/* 功能:设置门店信息
* 参数:[1]
token
* 参数:[1]
门店号
* 返回:NULL
* */
void
SetStoreId
(
const
QString
&
storeId
);
/* 功能:设置商户号
* 参数:[1]商户号
* 返回:NULL
* */
void
SetPartnerId
(
const
QString
&
partnerId
);
/* 功能:获取登录数据
* 参数:[1]门店号[2]密码[3]收银机号[4]收银员号
* 返回:登录数据
...
...
@@ -28,13 +33,13 @@ public:
* 参数:[1]门店号[2]密码[3]收银机号[4]收银员号
* 返回:登录数据
* */
QJsonObject
GetHeartData
(
const
QString
&
pa
rtnerId
,
const
QString
&
storeId
,
const
QString
&
pa
ssword
,
const
QString
&
stationId
,
const
QString
&
cashierId
,
const
QString
&
ipAddress
);
QJsonObject
GetHeartData
(
const
QString
&
password
,
const
QString
&
stationId
,
const
QString
&
ipAddress
);
/* 功能:获取拉取订单数据
* 参数:[1]时间戳
* 返回:登录数据
* */
QJsonObject
GetPullOrderData
(
const
QString
&
orderId
,
const
QString
&
channel
,
const
QString
&
storeId
,
QJsonObject
GetPullOrderData
(
const
QString
&
orderId
,
const
QString
&
channel
,
const
int
&
pageNumber
=
0
,
const
int
&
pageSize
=
100
);
/* 功能:获取拉取配送员数据
* 参数:[1]门店号[2]渠道代码
...
...
@@ -45,8 +50,7 @@ public:
* 参数:[1]订单编号[2]配送员编号[3]配送员姓名[4]配送员电话
* 返回:登录数据
* */
QJsonObject
GetConfirmOrderData
(
const
QString
&
orderId
,
const
QString
&
channel
,
const
QString
&
shopCode
);
QJsonObject
GetConfirmOrderData
(
const
QString
&
orderId
,
const
QString
&
channel
);
/* 功能:获取拒绝订单数据
* 参数:[1]拒单原因[2]订单编号
* 返回:登录数据
...
...
@@ -66,7 +70,7 @@ public:
* 参数:[1]时间戳
* 返回:登录数据
* */
QJsonObject
GetRefundOrderData
(
const
QString
&
reason
,
const
QString
&
orderId
,
const
QString
&
channel
);
QJsonObject
GetRefundOrderData
(
int
reasonCode
,
const
QString
&
reason
,
const
QString
&
orderId
,
const
QString
&
channel
);
/* 功能:获取拒绝退单数据
* 参数:[1]时间戳
* 返回:登录数据
...
...
@@ -112,6 +116,7 @@ private:
// token
QString
m_token
;
QString
m_storeId
;
QString
m_partnerId
;
};
#endif // DATAMANGER_H
fmTakeaway/DTools/orderstatus.cpp
View file @
716544c1
...
...
@@ -4,6 +4,7 @@
Orderstatus
::
Orderstatus
()
{
m_mutex
.
lock
();
QString
dbpath
=
QCoreApplication
::
applicationDirPath
()
+
QString
(
"/orderstatus.db"
);
db
=
QSqlDatabase
::
addDatabase
(
"QSQLITE"
,
"orderstaus_connection"
);
db
.
setDatabaseName
(
dbpath
);
...
...
@@ -34,6 +35,7 @@ Orderstatus::Orderstatus()
QLOG_INFO
()
<<
"table status exists"
;
}
db
.
close
();
m_mutex
.
unlock
();
//qDebug()<<query.lastError().text()<<"create table error";
}
...
...
@@ -43,9 +45,9 @@ Orderstatus &Orderstatus::getInstance()
return
order
;
}
bool
Orderstatus
::
statusinsert
(
const
QString
&
orderId
,
const
int
&
putstatus
,
const
int
&
refundstatus
,
const
int
&
reportstatus
,
const
int
&
refundreportstatus
,
const
QString
&
creatTime
)
bool
Orderstatus
::
statusinsert
(
const
QString
&
orderId
,
const
QString
&
creatTime
)
{
m_mutex
.
lock
();
if
(
!
db
.
open
())
{
QLOG_ERROR
()
<<
"sqlite open failed"
<<
db
.
lastError
().
text
();
...
...
@@ -53,9 +55,7 @@ bool Orderstatus::statusinsert(const QString &orderId, const int &putstatus,cons
}
bool
result
;
QSqlQuery
query
(
db
);
query
.
prepare
(
QString
(
"insert into status values('%1',%2,%3,%4,%5,'%6')"
).
arg
(
orderId
).
arg
(
QString
::
number
(
putstatus
))
.
arg
(
QString
::
number
(
refundstatus
)).
arg
(
QString
::
number
(
reportstatus
))
.
arg
(
QString
::
number
(
refundreportstatus
)).
arg
(
creatTime
));
query
.
prepare
(
QString
(
"insert into status values('%1',0,0,0,0,'%6')"
).
arg
(
orderId
).
arg
(
creatTime
));
qDebug
()
<<
creatTime
;
if
(
!
query
.
exec
())
{
...
...
@@ -67,11 +67,13 @@ bool Orderstatus::statusinsert(const QString &orderId, const int &putstatus,cons
result
=
true
;
}
db
.
close
();
m_mutex
.
unlock
();
return
result
;
}
bool
Orderstatus
::
putupdate
(
const
QString
&
orderId
,
const
int
&
putstatus
)
{
m_mutex
.
lock
();
if
(
!
db
.
open
())
{
QLOG_ERROR
()
<<
"sqlite open failed"
<<
db
.
lastError
().
text
();
...
...
@@ -91,11 +93,13 @@ bool Orderstatus::putupdate(const QString &orderId, const int &putstatus)
result
=
true
;
}
db
.
close
();
m_mutex
.
unlock
();
return
result
;
}
bool
Orderstatus
::
isput
(
const
QString
&
orderId
)
{
m_mutex
.
lock
();
if
(
!
db
.
open
())
{
QLOG_ERROR
()
<<
"sqlite open failed"
<<
db
.
lastError
().
text
();
...
...
@@ -114,11 +118,13 @@ bool Orderstatus::isput(const QString &orderId)
result
=
query
.
value
(
0
).
toBool
();
}
db
.
close
();
m_mutex
.
unlock
();
return
result
;
}
bool
Orderstatus
::
refundupdate
(
const
QString
&
orderId
,
const
int
&
refundstatus
)
{
m_mutex
.
lock
();
if
(
!
db
.
open
())
{
QLOG_ERROR
()
<<
"sqlite open failed"
<<
db
.
lastError
().
text
();
...
...
@@ -138,11 +144,13 @@ bool Orderstatus::refundupdate(const QString &orderId, const int &refundstatus)
result
=
true
;
}
db
.
close
();
m_mutex
.
unlock
();
return
result
;
}
bool
Orderstatus
::
isrefund
(
const
QString
&
orderId
)
{
m_mutex
.
lock
();
if
(
!
db
.
open
())
{
QLOG_ERROR
()
<<
"sqlite open failed"
<<
db
.
lastError
().
text
();
...
...
@@ -161,11 +169,13 @@ bool Orderstatus::isrefund(const QString &orderId)
result
=
query
.
value
(
0
).
toBool
();
}
db
.
close
();
m_mutex
.
unlock
();
return
result
;
}
bool
Orderstatus
::
reportupdate
(
const
QString
&
orderId
,
const
int
&
reportstatus
)
{
m_mutex
.
lock
();
if
(
!
db
.
open
())
{
QLOG_ERROR
()
<<
"sqlite open failed"
<<
db
.
lastError
().
text
();
...
...
@@ -185,11 +195,13 @@ bool Orderstatus::reportupdate(const QString &orderId, const int &reportstatus)
result
=
true
;
}
db
.
close
();
m_mutex
.
unlock
();
return
result
;
}
bool
Orderstatus
::
isreport
(
const
QString
&
orderId
)
{
m_mutex
.
lock
();
if
(
!
db
.
open
())
{
QLOG_ERROR
()
<<
"sqlite open failed"
<<
db
.
lastError
().
text
();
...
...
@@ -208,11 +220,13 @@ bool Orderstatus::isreport(const QString &orderId)
result
=
query
.
value
(
0
).
toBool
();
}
db
.
close
();
m_mutex
.
unlock
();
return
result
;
}
bool
Orderstatus
::
backreportupdate
(
const
QString
&
orderId
,
const
int
&
backreportstatus
)
{
m_mutex
.
lock
();
if
(
!
db
.
open
())
{
QLOG_ERROR
()
<<
"sqlite open failed"
<<
db
.
lastError
().
text
();
...
...
@@ -232,11 +246,13 @@ bool Orderstatus::backreportupdate(const QString &orderId, const int &backreport
result
=
true
;
}
db
.
close
();
m_mutex
.
unlock
();
return
result
;
}
bool
Orderstatus
::
isbackreport
(
const
QString
&
orderId
)
{
m_mutex
.
lock
();
if
(
!
db
.
open
())
{
QLOG_ERROR
()
<<
"sqlite open failed"
<<
db
.
lastError
().
text
();
...
...
@@ -255,10 +271,12 @@ bool Orderstatus::isbackreport(const QString &orderId)
result
=
query
.
value
(
0
).
toBool
();
}
db
.
close
();
m_mutex
.
unlock
();
return
result
;
}
bool
Orderstatus
::
isorderexit
(
const
QString
&
orderId
)
{
m_mutex
.
lock
();
if
(
!
db
.
open
())
{
QLOG_ERROR
()
<<
"sqlite open failed"
<<
db
.
lastError
().
text
();
...
...
@@ -280,11 +298,13 @@ bool Orderstatus::isorderexit(const QString &orderId)
result
=
false
;
}
db
.
close
();
m_mutex
.
unlock
();
return
result
;
}
bool
Orderstatus
::
deleteRecord
(
QString
creatTime
)
{
m_mutex
.
lock
();
if
(
!
db
.
open
())
{
QLOG_ERROR
()
<<
"sqlite open failed"
<<
db
.
lastError
().
text
();
...
...
@@ -299,6 +319,7 @@ bool Orderstatus::deleteRecord(QString creatTime)
result
=
false
;
}
db
.
close
();
m_mutex
.
unlock
();
return
result
;
}
fmTakeaway/DTools/orderstatus.h
View file @
716544c1
...
...
@@ -7,6 +7,7 @@
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlError>
#include <QObject>
#include <QMutex>
class
Orderstatus
:
public
QObject
{
...
...
@@ -17,11 +18,10 @@ public:
static
Orderstatus
&
getInstance
();
/**
*功能:插入一条新数据
*参数:[1]订单号
[2]入账状态[3]退款入账状态[4]汇报入账状态
*参数:[1]订单号
*返回:true操作成功,false失败
**/
bool
statusinsert
(
const
QString
&
orderId
,
const
int
&
putstatus
,
const
int
&
refundstatus
,
const
int
&
reportstatus
,
const
int
&
refundreportstatus
,
const
QString
&
creatTime
);
bool
statusinsert
(
const
QString
&
orderId
,
const
QString
&
creatTime
);
/**
*功能:更新入账状态
*参数:[1]订单号[2]入账状态
...
...
@@ -78,6 +78,7 @@ public:
bool
isorderexit
(
const
QString
&
orderId
);
bool
deleteRecord
(
QString
creatTime
);
private
:
QMutex
m_mutex
;
Orderstatus
();
Orderstatus
(
Orderstatus
const
&
);
Orderstatus
&
operator
=
(
Orderstatus
const
&
);
...
...
fmTakeaway/Model/orderObject.cpp
View file @
716544c1
...
...
@@ -10,412 +10,28 @@ void OrderObject::FromJson(const QJsonObject &json)
QJsonArray
products
=
json
[
JSON_PRODUCTS
].
toArray
();
foreach
(
QJsonValue
product
,
products
)
{
QJsonObject
pro
Json
=
product
.
toObject
();
ProductObject
*
proObject
=
new
Product
Object
(
this
);
proObject
->
FromJson
(
pro
Json
);
proList
.
append
(
pro
Object
);
QJsonObject
dish
Json
=
product
.
toObject
();
DishObject
*
dishObject
=
new
Dish
Object
(
this
);
dishObject
->
FetchDataFromJson
(
dish
Json
);
proList
.
append
(
dish
Object
);
}
return
;
}
int
OrderObject
::
getproduct_fee
()
const
{
return
product_fee
;
}
void
OrderObject
::
setproduct_fee
(
const
int
&
v
)
{
product_fee
=
v
;
}
int
OrderObject
::
getservice_fee
()
const
{
return
service_fee
;
}
void
OrderObject
::
setservice_fee
(
const
int
&
v
)
{
service_fee
=
v
;
}
int
OrderObject
::
getdis_platform_fee
()
const
{
return
dis_platform_fee
;
}
void
OrderObject
::
setdis_platform_fee
(
const
int
&
v
)
{
dis_platform_fee
=
v
;
}
int
OrderObject
::
getdis_shop_fee
()
const
{
return
dis_shop_fee
;
}
void
OrderObject
::
setdis_shop_fee
(
const
int
&
v
)
{
dis_shop_fee
=
v
;
}
int
OrderObject
::
getpackage_fee
()
const
{
return
package_fee
;
}
void
OrderObject
::
setpackage_fee
(
const
int
&
v
)
{
package_fee
=
v
;
}
int
OrderObject
::
getDelivery_type
()
const
{
return
delivery_type
;
}
void
OrderObject
::
setDelivery_type
(
const
int
&
v
)
{
delivery_type
=
v
;
}
int
OrderObject
::
getstatus
()
const
{
return
status
;
}
void
OrderObject
::
setstatus
(
const
int
&
v
)
{
status
=
v
;
}
QString
OrderObject
::
getChannel
()
const
{
return
channel
;
}
void
OrderObject
::
setChannel
(
const
QString
&
v
)
{
channel
=
v
;
}
QString
OrderObject
::
getchannelName
()
const
{
return
channelName
;
}
void
OrderObject
::
setchannelName
(
const
QString
&
v
)
{
channelName
=
v
;
}
QString
OrderObject
::
getphone
()
const
{
return
phone
;
}
void
OrderObject
::
setphone
(
const
QString
&
v
)
{
phone
=
v
;
}
QString
OrderObject
::
getaddress
()
const
{
return
address
;
}
void
OrderObject
::
setaddress
(
const
QString
&
v
)
{
address
=
v
;
}
QString
OrderObject
::
getcustomer
()
const
{
return
customer
;
}
void
OrderObject
::
setcustomer
(
const
QString
&
v
)
{
customer
=
v
;
}
QString
OrderObject
::
getdelivery_party
()
const
{
return
delivery_party
;
}
void
OrderObject
::
setdelivery_party
(
const
QString
&
v
)
{
delivery_party
=
v
;
}
QString
OrderObject
::
getOrder_id
()
const
{
return
order_id
;
}
void
OrderObject
::
setOrder_id
(
const
QString
&
v
)
{
order_id
=
v
;
}
QString
OrderObject
::
getposorder_id
()
const
{
return
posorder_id
;
}
void
OrderObject
::
setposorder_id
(
const
QString
&
v
)
{
posorder_id
=
v
;
}
int
OrderObject
::
getpaid_fee
()
const
{
return
paid_fee
;
}
void
OrderObject
::
setpaid_fee
(
const
int
&
v
)
{
paid_fee
=
v
;
}
int
OrderObject
::
getshop_fee
()
const
{
return
shop_fee
;
}
void
OrderObject
::
setshop_fee
(
const
int
&
v
)
{
shop_fee
=
v
;
}
int
OrderObject
::
getrest_fee
()
const
{
return
rest_fee
;
}
void
OrderObject
::
setrest_fee
(
const
int
&
v
)
{
rest_fee
=
v
;
}
int
OrderObject
::
getuser_fee
()
const
{
return
user_fee
;
}
void
OrderObject
::
setuser_fee
(
const
int
&
v
)
{
user_fee
=
v
;
}
QString
OrderObject
::
getCoupon
()
const
{
return
coupon
;
}
void
OrderObject
::
setCoupon
(
const
QString
&
v
)
{
coupon
=
v
;
}
QString
OrderObject
::
getRemark
()
const
{
return
remark
;
}
void
OrderObject
::
setRemark
(
const
QString
&
v
)
{
remark
=
v
;
}
int
OrderObject
::
getCreate_time
()
const
{
return
create_time
;
}
void
OrderObject
::
setCreate_time
(
const
int
&
v
)
{
create_time
=
v
;
}
int
OrderObject
::
getExpire_time
()
const
{
return
expire_time
;
}
void
OrderObject
::
setExpire_time
(
const
int
&
v
)
{
expire_time
=
v
;
}
QString
OrderObject
::
getTimestamp
()
const
{
return
timestamp
;
}
void
OrderObject
::
setTimestamp
(
const
QString
&
v
)
{
timestamp
=
v
;
}
QString
OrderObject
::
getpay_type
()
const
{
return
pay_type
;
}
void
OrderObject
::
setpay_type
(
const
QString
&
v
)
{
pay_type
=
v
;
}
QString
OrderObject
::
getprintcfg
()
const
{
return
printcfg
;
}
void
OrderObject
::
setprintcfg
(
const
QString
&
v
)
{
printcfg
=
v
;
}
int
OrderObject
::
gettotal_fee
()
const
{
return
total_fee
;
}
void
OrderObject
::
settotal_fee
(
const
int
&
v
)
{
total_fee
=
v
;
}
int
OrderObject
::
getdiscount_fee
()
const
{
return
discount_fee
;
}
void
OrderObject
::
setdiscount_fee
(
const
int
&
v
)
{
discount_fee
=
v
;
}
int
OrderObject
::
getsend_fee
()
const
{
return
send_fee
;
}
void
OrderObject
::
setsend_fee
(
const
int
&
v
)
{
send_fee
=
v
;
}
int
OrderObject
::
gettotal_Amount
()
const
{
return
total_amount
;
}
void
OrderObject
::
settotal_Amount
(
const
int
&
v
)
{
total_amount
=
v
;
}
int
OrderObject
::
getchannelNum
()
const
{
return
channelNum
;
}
void
OrderObject
::
setchannelNum
(
const
int
&
v
)
{
channelNum
=
v
;
}
int
OrderObject
::
getorder_index
()
const
{
return
order_index
;
}
void
OrderObject
::
setorder_index
(
const
int
&
v
)
{
order_index
=
v
;
}
bool
OrderObject
::
gethas_invoiced
()
const
{
return
has_invoiced
;
}
void
OrderObject
::
sethas_invoiced
(
const
bool
&
v
)
{
has_invoiced
=
v
;
}
QString
OrderObject
::
getinvoice_title
()
const
{
return
invoice_title
;
}
void
OrderObject
::
setinvoice_title
(
const
QString
&
v
)
{
invoice_title
=
v
;
}
QString
OrderObject
::
getcourier_name
()
const
{
return
courier_name
;
}
void
OrderObject
::
setcourier_name
(
const
QString
&
v
)
{
courier_name
=
v
;
}
QString
OrderObject
::
getcourier_phone
()
const
{
return
courier_phone
;
}
void
OrderObject
::
setcourier_phone
(
const
QString
&
v
)
{
courier_phone
=
v
;
}
QString
OrderObject
::
getstatus_desc
()
const
{
return
status_desc
;
}
void
OrderObject
::
setstatus_desc
(
const
QString
&
v
)
{
status_desc
=
v
;
}
int
OrderObject
::
getdelivery_time
()
const
{
return
delivery_time
;
}
void
OrderObject
::
setdelivery_time
(
const
int
&
v
)
{
delivery_time
=
v
;
}
QString
OrderObject
::
getfm_id
()
const
{
return
fm_id
;
}
void
OrderObject
::
setfm_id
(
const
QString
&
v
)
{
fm_id
=
v
;
}
int
OrderObject
::
getdelivery_status
()
const
{
return
delivery_status
;
}
void
OrderObject
::
setdelivery_status
(
const
int
&
v
)
{
delivery_status
=
v
;
}
QStringList
OrderObject
::
getrecords
()
const
void
DishObject
::
FetchDataFromJson
(
const
QJsonObject
&
json
)
{
return
records
;
}
foreach
(
QString
key
,
json
.
keys
())
{
setProperty
(
key
.
toUtf8
(),
json
[
key
].
toVariant
());
}
void
OrderObject
::
setrecords
(
const
QStringList
&
v
)
{
records
=
v
;
qDeleteAll
(
sub_products
);
sub_products
.
clear
();
QJsonArray
subDishesArray
=
json
[
"sub_product"
].
toArray
();
foreach
(
QJsonValue
subDish
,
subDishesArray
)
{
DishObject
*
item
=
new
DishObject
(
this
);
item
->
FetchDataFromJson
(
subDish
.
toObject
());
sub_products
.
append
(
item
);
}
return
;
}
fmTakeaway/Model/orderObject.h
View file @
716544c1
This diff is collapsed.
Click to expand it.
fmTakeaway/Network/billSocket.cpp
View file @
716544c1
...
...
@@ -23,7 +23,6 @@ bool BillSocket::Request(const QJsonObject &requestJson, QJsonObject &recvJson,
{
m_networkManger
.
setNetworkAccessible
(
QNetworkAccessManager
::
Accessible
);
}
QByteArray
sendArray
=
QJsonDocument
(
requestJson
).
toJson
(
QJsonDocument
::
Compact
);
QEventLoop
eventLoop
;
QNetworkReply
*
reply
=
m_networkManger
.
post
(
m_networkRequest
,
sendArray
);
...
...
fmTakeaway/bstatusForm.cpp
View file @
716544c1
...
...
@@ -10,6 +10,8 @@ BStatusForm::BStatusForm(QWidget *parent) :
ui
->
setupUi
(
this
);
connect
(
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
initChannelsData
,
this
,
&
BStatusForm
::
onInitChannelsData
);
connect
(
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
setStoreOperatingStatusFinsh
,
this
,
&
BStatusForm
::
onSetStoreOperatingStatusFinsh
);
connect
(
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
setStoreStatusChanged
,
this
,
&
BStatusForm
::
onStoreStatusChanged
);
setWindowFlags
(
this
->
windowFlags
()
|
Qt
::
FramelessWindowHint
);
setAttribute
(
Qt
::
WA_TranslucentBackground
);
...
...
@@ -32,11 +34,41 @@ void BStatusForm::onInitChannelsData(QStringList list)
foreach
(
QString
channelInfo
,
list
)
{
BStatusItem
*
item
=
new
BStatusItem
(
this
);
connect
(
item
,
&
BStatusItem
::
setStoreOperatingStatus
,
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
onSetStoreOperatingStatus
);
item
->
InitData
(
channelInfo
);
m_items
.
append
(
item
);
ui
->
verticalLayout
->
insertWidget
(
0
,
item
);
}
if
(
this
->
parentWidget
()
->
isVisible
())
{
this
->
show
();
}
}
void
BStatusForm
::
onSetStoreOperatingStatusFinsh
(
QString
channel
)
{
foreach
(
auto
value
,
m_items
)
{
if
(
channel
.
compare
(
value
->
getChannelCode
()))
{
value
->
onSetStoreOperatingStatusFinsh
();
}
}
}
void
BStatusForm
::
onStoreStatusChanged
(
QJsonArray
array
)
{
QString
channelCode
;
foreach
(
QJsonValue
v
,
array
)
{
QJsonObject
object
=
v
.
toObject
();
channelCode
=
object
[
"channelCode"
].
toString
();
foreach
(
auto
value
,
m_items
)
{
if
(
channelCode
.
compare
(
value
->
getChannelCode
()))
{
value
->
onSetStoreOperatingStatusFinsh
(
object
[
"state"
].
toInt
());
}
}
}
show
();
}
...
...
fmTakeaway/bstatusForm.h
View file @
716544c1
#ifndef BSTATUSFORM_H
#define BSTATUSFORM_H
#include <QDialog>
#include "bstatusItem.h"
#include <QJsonArray>
namespace
Ui
{
class
BStatusForm
;
...
...
@@ -23,6 +23,8 @@ private:
public
slots
:
void
onInitChannelsData
(
QStringList
list
);
void
onSetStoreOperatingStatusFinsh
(
QString
channel
);
void
onStoreStatusChanged
(
QJsonArray
array
);
private
slots
:
void
on_btsBtnClose_clicked
();
};
...
...
fmTakeaway/bstatusItem.cpp
View file @
716544c1
...
...
@@ -11,9 +11,6 @@ BStatusItem::BStatusItem(QWidget *parent) :
ui
->
btsItemYY
->
setEnabled
(
false
);
ui
->
btsItemZX
->
setEnabled
(
false
);
connect
(
this
,
&
BStatusItem
::
setStoreOperatingStatus
,
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
onSetStoreOperatingStatus
);
connect
(
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
setStoreOperatingStatusFinsh
,
this
,
&
BStatusItem
::
onSetStoreOperatingStatusFinsh
);
}
BStatusItem
::~
BStatusItem
()
...
...
@@ -44,30 +41,27 @@ void BStatusItem::InitData(QString str)
void
BStatusItem
::
on_btsItemYY_clicked
()
{
emit
setStoreOperatingStatus
(
m_channelCode
,
1
);
emit
setStoreOperatingStatus
(
m_channelCode
,
m_channelName
,
1
);
}
void
BStatusItem
::
on_btsItemZX_clicked
()
{
emit
setStoreOperatingStatus
(
m_channelCode
,
0
);
emit
setStoreOperatingStatus
(
m_channelCode
,
m_channelName
,
0
);
}
void
BStatusItem
::
onSetStoreOperatingStatusFinsh
(
QString
channel
)
void
BStatusItem
::
onSetStoreOperatingStatusFinsh
(
int
newStatus
)
{
if
(
!
channel
.
compare
(
m_channelCode
))
if
(
newStatus
==
m_channelStatus
){
return
;}
int
channelStatus
=
(
m_channelStatus
==
1
?
0
:
1
);
if
(
channelStatus
==
0
)
{
m_channelStatus
=
m_channelStatus
==
0
?
1
:
0
;
if
(
m_channelStatus
==
0
)
{
// 关店中
ui
->
btsItemYY
->
setEnabled
(
true
);
ui
->
btsItemZX
->
setEnabled
(
false
);
}
else
{
// 营业中
ui
->
btsItemYY
->
setEnabled
(
false
);
ui
->
btsItemZX
->
setEnabled
(
true
);
}
// 关店中
ui
->
btsItemYY
->
setEnabled
(
true
);
ui
->
btsItemZX
->
setEnabled
(
false
);
}
else
{
// 营业中
ui
->
btsItemYY
->
setEnabled
(
false
);
ui
->
btsItemZX
->
setEnabled
(
true
);
}
}
fmTakeaway/bstatusItem.h
View file @
716544c1
...
...
@@ -14,8 +14,13 @@ class BStatusItem : public QDialog
public
:
explicit
BStatusItem
(
QWidget
*
parent
=
0
);
~
BStatusItem
();
void
InitData
(
QString
);
QString
getChannelName
(){
return
m_channelName
;
}
QString
getChannelCode
(){
return
m_channelCode
;
}
private
slots
:
void
on_btsItemYY_clicked
();
...
...
@@ -30,10 +35,10 @@ private:
int
m_channelStatus
;
signals
:
void
setStoreOperatingStatus
(
const
QString
&
,
int
);
void
setStoreOperatingStatus
(
const
QString
&
,
const
QString
&
,
int
);
public
slots
:
void
onSetStoreOperatingStatusFinsh
(
QString
);
void
onSetStoreOperatingStatusFinsh
(
int
newStatus
=
1
);
};
#endif // BSTATUSITEM_H
fmTakeaway/detailForm.cpp
View file @
716544c1
...
...
@@ -32,28 +32,25 @@ void DetailForm::InitData(OrderObject *orderObject)
ui
->
detailBtn2
->
show
();
ui
->
detailBtn3
->
show
();
ui
->
detailBtn1
->
hide
();
ui
->
detailBtn0
->
hide
();
// 初始化界面
ui
->
detailLab0
->
setText
(
QString
(
"[%1
]"
).
arg
(
/*orderObject->channelN
ame,
orderObject->status_desc,
*/
ui
->
detailLab0
->
setText
(
QString
(
"[%1
# %2][%3][%4]"
).
arg
(
QString
::
number
(
orderObject
->
order_index
),
orderObject
->
channel_n
ame
,
orderObject
->
status_desc
,
orderObject
->
order_id
));
ui
->
detailLab1
->
setText
(
QString
(
"[%1]%2"
).
arg
(
orderObject
->
pay_type
,
orderObject
->
remark
));
ui
->
detailLab2
->
setText
(
QString
(
"[姓名]%1 [电话]%2"
).
arg
(
orderObject
->
customer
,
orderObject
->
phone
));
ui
->
detailLab3
->
setText
(
orderObject
->
address
);
ui
->
detailLab4
->
setText
(
QString
(
"[配送方式]%1 [配送费]%2"
).
arg
(
orderObject
->
delivery_party
,
Penny2Dollar
(
orderObject
->
send_fee
)));
ui
->
detailLab5
->
setText
(
orderObject
->
delivery_time
==
0
?
"立即送出"
:
QDateTime
::
fromTime_t
(
orderObject
->
delivery_time
).
toString
(
"MM/dd hh:mm"
));
ui
->
detailLab6
->
setText
(
orderObject
->
courier_name
.
isEmpty
()
?
"暂未指定"
:
QString
(
"[姓名]%1 [电话]%2"
)
//ui->detailLab5->setText(QString("[%1]").arg(orderObject->remark));
ui
->
detailLab1
->
setText
(
QString
(
"%1:%2"
).
arg
(
orderObject
->
customer
,
orderObject
->
phone
));
//ui->detailLab3->setText(orderObject->address);
//ui->detailLab4->setText(QString("[配送方式]%1 [配送费]%2").arg(orderObject->delivery_party,Penny2Dollar(orderObject->send_fee)));
ui
->
detailLab2
->
setText
(
orderObject
->
delivery_time
==
0
?
"立即送出"
:
QDateTime
::
fromTime_t
(
orderObject
->
delivery_time
).
toString
(
"MM/dd hh:mm"
));
ui
->
detailLab3
->
setText
(
orderObject
->
courier_name
.
isEmpty
()
?
"暂未指定"
:
QString
(
"[姓名]%1 [电话]%2"
)
.
arg
(
orderObject
->
courier_name
,
orderObject
->
courier_phone
));
ui
->
detailLab
7
->
setText
(
!
orderObject
->
pay_type
.
compare
(
"在线支付"
)
?
"0"
:
Penny2Dollar
(
orderObject
->
shop
_fee
));
ui
->
detailLab8
->
setText
(
orderObject
->
has_invoiced
?
QString
(
"发票抬头:%1"
).
arg
(
orderObject
->
invoice_title
)
:
"不需要发票"
);
ui
->
detailLab
4
->
setText
(
Penny2Dollar
(
orderObject
->
product
_fee
));
//
ui->detailLab8->setText(orderObject->has_invoiced? QString("发票抬头:%1").arg(orderObject->invoice_title) : "不需要发票");
ui
->
detailLab5
->
setText
(
QString
(
"[%1]"
).
arg
(
orderObject
->
remark
));
for
(
int
i
=
0
;
i
<
orderObject
->
proList
.
count
();
i
++
)
{
ui
->
detailTable0
->
insertRow
(
i
);
ui
->
detailTable0
->
setItem
(
i
,
0
,
new
QTableWidgetItem
(
orderObject
->
proList
.
at
(
i
)
->
name
));
// 商品名
ui
->
detailTable0
->
setItem
(
i
,
0
,
new
QTableWidgetItem
(
GetProductName
(
orderObject
->
proList
.
at
(
i
))
));
// 商品名
ui
->
detailTable0
->
item
(
i
,
0
)
->
setTextAlignment
(
Qt
::
AlignCenter
);
ui
->
detailTable0
->
setItem
(
i
,
1
,
new
QTableWidgetItem
(
Penny2Dollar
(
orderObject
->
proList
.
at
(
i
)
->
price
)));
// 价格
ui
->
detailTable0
->
item
(
i
,
1
)
->
setTextAlignment
(
Qt
::
AlignCenter
);
...
...
@@ -68,10 +65,10 @@ void DetailForm::InitData(OrderObject *orderObject)
}
ui
->
detailLabRecord
->
setText
(
records
);
if
(
!
ConfigManger
::
GetInstance
().
GetIsExistReEntryOrder
())
{
ui
->
detailBtn0
->
hide
();
}
//
if(!ConfigManger::GetInstance().GetIsExistReEntryOrder())
//
{
//
ui->detailBtn0->hide();
//
}
ui
->
detailBtn2
->
setText
(
GetOperNameByStatus
(
orderObject
->
status
,
true
));
ui
->
detailBtn2
->
setProperty
(
"operation"
,
GetOperByStatus
(
orderObject
->
status
,
true
));
...
...
@@ -112,29 +109,49 @@ void DetailForm::_Init()
ui
->
detailTable0
->
horizontalHeader
()
->
setSectionResizeMode
(
QHeaderView
::
Fixed
);
}
QString
DetailForm
::
GetProductName
(
DishObject
*
dish
)
{
QString
name
;
name
.
append
(
dish
->
name
).
append
(
QString
(
"(%1)"
).
arg
(
dish
->
property_tags
));
if
(
!
dish
->
sub_products
.
isEmpty
())
{
foreach
(
auto
value
,
dish
->
sub_products
)
{
name
.
append
(
value
->
name
);
}
// for(int j=0; j < dish->sub_products.count(); j++)
// {
// DishObject* subDish=dish->sub_products.at(j);
// name.append(subDish->name);
// }
}
return
name
;
}
void
DetailForm
::
onOperaBtnClicked
()
{
hide
();
QPushButton
*
pBtn
=
(
QPushButton
*
)
sender
();
if
(
pBtn
->
text
()
==
"拒单"
||
pBtn
->
text
()
==
"退单"
)
{
// m_rejectForm->show();
// if(m_rejectForm->exec()==QDialog::Accepted)
// {
// emit processRejectOrder( pBtn->property("orderId").toString(),m_rejectForm->GetReasonCode());
// }
// }
// else if(pBtn->text()=="退单")
// {
// m_rejectForm->show();
// if(m_rejectForm->exec()==QDialog::Accepted)
// {
// emit processRejectOrder( pBtn->property("orderId").toString(),m_rejectForm->GetReasonCode());
// }
// }
// else if(pBtn->text()=="退单")
// {
m_refuseForm
->
show
();
if
(
m_refuseForm
->
exec
()
==
QDialog
::
Accepted
)
{
emit
processRepealOrder
(
pBtn
->
property
(
"orderId"
).
toString
(),
m_refuseForm
->
m_reasonCode
);
}
{
emit
processRepealOrder
(
pBtn
->
property
(
"orderId"
).
toString
(),
m_refuseForm
->
m_reasonCode
,
m_refuseForm
->
m_reasonStr
);
}
}
else
{
emit
processOrder
(
pBtn
->
property
(
"operation"
).
toString
(),
pBtn
->
property
(
"orderId"
).
toString
()
,
DeliverObject
()
);
emit
processOrder
(
pBtn
->
property
(
"operation"
).
toString
(),
pBtn
->
property
(
"orderId"
).
toString
());
}
}
...
...
fmTakeaway/detailForm.h
View file @
716544c1
...
...
@@ -39,14 +39,16 @@ private:
RejectForm
*
m_rejectForm
;
RefuseForm
*
m_refuseForm
;
QString
GetProductName
(
DishObject
*
dish
);
signals
:
/* 功能:处理订单
* 参数:[1]操作动作名[2]订单编号[3]配送员信息
* 返回:NULL
* */
void
processOrder
(
const
QString
&
operation
,
const
QString
&
orderId
,
const
DeliverObject
&
deliverObj
);
void
processRejectOrder
(
const
QString
&
orderId
,
const
int
&
reason
);
void
processRepealOrder
(
const
QString
&
orderId
,
const
QString
&
reason
);
void
processOrder
(
const
QString
&
operation
,
const
QString
&
orderId
);
void
processRejectOrder
(
const
QString
&
orderId
,
const
int
&
reason
Code
,
const
QString
&
reason
);
void
processRepealOrder
(
const
QString
&
orderId
,
const
int
&
reasonCode
,
const
QString
&
reason
);
private
slots
:
/* 功能:处理订单按钮点击
...
...
fmTakeaway/detailForm.ui
View file @
716544c1
...
...
@@ -383,7 +383,7 @@
</size>
</property>
<property
name=
"text"
>
<string>
订单备注
:
</string>
<string>
顾客信息
:
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
...
...
@@ -440,7 +440,7 @@
</size>
</property>
<property
name=
"text"
>
<string>
顾客信息
:
</string>
<string>
送达时间
:
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
...
...
@@ -497,7 +497,7 @@
</size>
</property>
<property
name=
"text"
>
<string>
收货地址
:
</string>
<string>
送餐员
:
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
...
...
@@ -554,7 +554,7 @@
</size>
</property>
<property
name=
"text"
>
<string>
配送信息
:
</string>
<string>
订单金额
:
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
...
...
@@ -611,7 +611,7 @@
</size>
</property>
<property
name=
"text"
>
<string>
送达时间
:
</string>
<string>
订单备注
:
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
...
...
@@ -668,7 +668,7 @@
</size>
</property>
<property
name=
"text"
>
<string
>
送餐员:
</string
>
<string
/
>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
...
...
@@ -725,7 +725,7 @@
</size>
</property>
<property
name=
"text"
>
<string
>
应收现金:
</string
>
<string
/
>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
...
...
@@ -782,7 +782,7 @@
</size>
</property>
<property
name=
"text"
>
<string
>
发票信息:
</string
>
<string
/
>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
...
...
fmTakeaway/floatForm.cpp
View file @
716544c1
...
...
@@ -18,9 +18,9 @@ FloatForm::FloatForm(QWidget *parent) :
m_bReminding
=
false
;
QPixmap
imgNormal
(
":float_normal.
pn
g"
);
QPixmap
imgNormal
(
":float_normal.
jp
g"
);
m_imgNormalSize
=
imgNormal
.
size
();
QPixmap
imgRemind
(
":float_remind.
pn
g"
);
QPixmap
imgRemind
(
":float_remind.
jp
g"
);
m_imgRemindSize
=
imgRemind
.
size
();
m_animation
.
setTargetObject
(
this
);
...
...
@@ -80,6 +80,7 @@ void FloatForm::mouseReleaseEvent(QMouseEvent *event)
hide
();
m_raiseTimer
.
stop
();
emit
showMainForm
();
onStopRemind
();
}
m_bMouseMove
=
false
;
...
...
@@ -92,7 +93,9 @@ void FloatForm::_Init()
setAttribute
(
Qt
::
WA_TranslucentBackground
);
setFixedSize
(
m_imgNormalSize
);
setStyleSheet
(
"#floatWdg{ border-image: url(:float_normal.png); }"
);
setStyleSheet
(
"#floatWdg{ border-image: url(:float_normal.jpg); }"
);
//setStyleSheet("#floatWdg{ border-image: url(:logo.svg); }");
//setStyleSheet("#floatWdg{ border-image: url(:float_normal.png); }");
move
(
ConfigManger
::
GetInstance
().
GetFloatInitPostion
());
}
...
...
@@ -106,7 +109,8 @@ void FloatForm::_Blink()
m_animation
.
start
();
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.jpg);}"
);
//ui->floatWdg->setStyleSheet("#floatWdg{ border-image: url(:float_remind.png);}");
m_animation
.
setStartValue
(
0
);
m_animation
.
setEndValue
(
1
);
m_animation
.
start
();
...
...
@@ -116,7 +120,8 @@ void FloatForm::_Blink()
m_animation
.
start
();
loop
.
exec
();
this
->
setFixedSize
(
m_imgNormalSize
);
ui
->
floatWdg
->
setStyleSheet
(
"#floatWdg{ border-image: url(:float_normal.png)}"
);
//ui->floatWdg->setStyleSheet("#floatWdg{ border-image: url(:float_normal.png)}");
ui
->
floatWdg
->
setStyleSheet
(
"#floatWdg{ border-image: url(:float_normal.jpg);}"
);
m_animation
.
setStartValue
(
0
);
m_animation
.
setEndValue
(
1
);
m_animation
.
start
();
...
...
@@ -159,6 +164,9 @@ void FloatForm::onStartRemind(int type)
{
m_bReminding
=
true
;
}
m_remindTimer
.
start
(
1000
*
30
);
m_remindTimer
.
setSingleShot
(
true
);
connect
(
&
m_remindTimer
,
&
QTimer
::
timeout
,
this
,
&
FloatForm
::
onStopRemind
);
_Blink
();
_PlayWav
();
...
...
fmTakeaway/floatForm.h
View file @
716544c1
...
...
@@ -49,6 +49,7 @@ private:
int
m_wavPlayInterval
;
// 置顶定时器
QTimer
m_raiseTimer
;
QTimer
m_remindTimer
;
/* 功能:初始化
* 参数:NULL
...
...
fmTakeaway/floatForm.ui
View file @
716544c1
...
...
@@ -13,6 +13,9 @@
<property
name=
"windowTitle"
>
<string>
Dialog
</string>
</property>
<property
name=
"windowOpacity"
>
<double>
0.500000000000000
</double>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<property
name=
"leftMargin"
>
<number>
0
</number>
...
...
fmTakeaway/fmTakeaway.pro
View file @
716544c1
...
...
@@ -14,6 +14,8 @@ include("./JQLibrary/JQLibrary.pri")
TARGET
=
fmTakeaway
TEMPLATE
=
app
CONFIG
+=
c
++
11
INCLUDEPATH
+=
DTools
DEFINES
+=
TEST
TODO
...
...
@@ -27,11 +29,8 @@ SOURCES += main.cpp\
DTools
/
dataManger
.
cpp
\
Model
/
orderObject
.
cpp
\
Model
/
baseObject
.
cpp
\
Model
/
deliverObject
.
cpp
\
Model
/
productObject
.
cpp
\
DTools
/
util
.
cpp
\
Model
/
cashierObject
.
cpp
\
pickForm
.
cpp
\
settingForm
.
cpp
\
floatForm
.
cpp
\
detailForm
.
cpp
\
...
...
@@ -62,11 +61,8 @@ HEADERS += \
DTools
/
dataManger
.
h
\
Model
/
orderObject
.
h
\
Model
/
baseObject
.
h
\
Model
/
deliverObject
.
h
\
Model
/
productObject
.
h
\
DTools
/
util
.
h
\
Model
/
cashierObject
.
h
\
pickForm
.
h
\
settingForm
.
h
\
floatForm
.
h
\
detailForm
.
h
\
...
...
@@ -89,7 +85,6 @@ HEADERS += \
FORMS
+=
mainForm
.
ui
\
alertForm
.
ui
\
pickForm
.
ui
\
settingForm
.
ui
\
floatForm
.
ui
\
detailForm
.
ui
\
...
...
fmTakeaway/main.cpp
View file @
716544c1
...
...
@@ -79,6 +79,7 @@ int main(int argc, char *argv[])
FloatForm
f
;
MainForm
w
;
QObject
::
connect
(
&
w
,
&
MainForm
::
showFloatForm
,
&
f
,
&
FloatForm
::
onShow
);
QObject
::
connect
(
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
startRemind
,
&
f
,
&
FloatForm
::
onStartRemind
);
QObject
::
connect
(
&
w
,
&
MainForm
::
startRemind
,
&
f
,
&
FloatForm
::
onStartRemind
);
QObject
::
connect
(
&
w
,
&
MainForm
::
stopRemind
,
&
f
,
&
FloatForm
::
onStopRemind
);
QObject
::
connect
(
&
f
,
&
FloatForm
::
showMainForm
,
&
w
,
&
MainForm
::
show
);
...
...
fmTakeaway/mainForm.cpp
View file @
716544c1
...
...
@@ -25,15 +25,11 @@ MainForm::MainForm(QWidget *parent) :
m_tableList
.
append
(
ui
->
mainTableNew
);
m_tableList
.
append
(
ui
->
mainTableMake
);
m_tableList
.
append
(
ui
->
mainTableSend
);
m_tableList
.
append
(
ui
->
mainTable
Refund
);
m_tableList
.
append
(
ui
->
mainTable
Unusual
);
m_tableList
.
append
(
ui
->
mainTableFinsh
);
m_tableList
.
append
(
ui
->
mainTable
Other
);
m_tableList
.
append
(
ui
->
mainTable
Reserve
);
// 注册信号槽参数
qRegisterMetaType
<
CashierObject
>
(
"CashierObject"
);
qRegisterMetaType
<
QList
<
CashierObject
>
>
(
"QList<CashierObject>"
);
qRegisterMetaType
<
DeliverObject
>
(
"DeliverObject"
);
qRegisterMetaType
<
QList
<
DeliverObject
>
>
(
"QList<DeliverObject>"
);
qRegisterMetaType
<
AlertForm
::
Type
>
(
"AlertForm::Type"
);
qRegisterMetaType
<
dishesObject
>
(
"dishesObject"
);
...
...
@@ -41,7 +37,6 @@ MainForm::MainForm(QWidget *parent) :
qRegisterMetaType
<
QMap
<
QString
,
int
>
>
(
"QMap<QString, int>"
);
// 连接信号槽
//connect(this,&MainForm::flowStart,&FlowControl::GetInstance(),&FlowControl::onGetNewStoreInfo);
connect
(
&
m_timeTimer
,
&
QTimer
::
timeout
,
this
,
&
MainForm
::
onSetCurrentTime
);
connect
(
this
,
&
MainForm
::
processOrder
,
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
onProcessOrder
);
connect
(
this
,
&
MainForm
::
getOrderDetails
,
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
onGetOrderDetails
);
...
...
@@ -55,8 +50,7 @@ MainForm::MainForm(QWidget *parent) :
connect
(
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
setNetStatus
,
this
,
&
MainForm
::
onSetNetStatus
);
connect
(
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
setStoreInfo
,
this
,
&
MainForm
::
onSetStoreInfo
);
connect
(
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
setCashierInfo
,
this
,
&
MainForm
::
onSetCashierInfo
);
connect
(
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
changeOrderStatus
,
this
,
&
MainForm
::
onChangeOrderStatus
,
Qt
::
BlockingQueuedConnection
);
connect
(
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
showDeliverPickForm
,
this
,
&
MainForm
::
onShowDeliverPickForm
);
connect
(
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
changeOrderStatus
,
this
,
&
MainForm
::
onChangeOrderStatus
/*,Qt::BlockingQueuedConnection*/
);
connect
(
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
showOrderDetails
,
this
,
&
MainForm
::
onShowOrderDetails
);
connect
(
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
clearorder
,
this
,
&
MainForm
::
onOrderClear
);
// 搜索订单的信号槽
...
...
@@ -87,7 +81,6 @@ void MainForm::MyShow()
// 考虑到坐标问题放到这里构建
m_alertForm
=
new
AlertForm
(
this
);
m_pickForm
=
new
PickForm
(
this
);
m_settingForm
=
new
SettingForm
(
this
);
...
...
@@ -113,9 +106,9 @@ void MainForm::MyShow()
m_dailyReportForm
=
new
DailyReportForm
(
this
);
ui
->
mainBtnDayReport
->
hide
();
ui
->
mainBtnStoreManager
->
hide
();
#ifdef TODO
ui
->
mainBtnDishManager
->
hide
();
ui
->
mainBtnStoreManager
->
hide
();
#endif
//emit flowStart();
return
;
...
...
@@ -143,8 +136,8 @@ void MainForm::_Init()
foreach
(
QTableWidget
*
table
,
m_tableList
)
{
table
->
hide
();
if
(
table
==
ui
->
mainTableFinsh
||
table
==
ui
->
mainTable
Other
)
if
(
table
==
ui
->
mainTableFinsh
/*
||
table == ui->mainTable
Reserve*/
)
{
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
...
...
@@ -168,6 +161,7 @@ void MainForm::_Init()
m_prevBtn
=
ui
->
mainBtnNew
;
m_prevTable
=
ui
->
mainTableNew
;
m_currentTable
=
ui
->
mainTableNew
;
ui
->
mainBtnSet
->
hide
();
}
void
MainForm
::
onSetCurrentTime
()
...
...
@@ -197,7 +191,7 @@ void MainForm::onMainTabBtnClicked()
void
MainForm
::
onMainProcBtnClicked
()
{
QPushButton
*
pBtn
=
(
QPushButton
*
)
sender
();
emit
processOrder
(
pBtn
->
property
(
"operation"
).
toString
(),
pBtn
->
property
(
"orderId"
).
toString
()
,
DeliverObject
()
);
emit
processOrder
(
pBtn
->
property
(
"operation"
).
toString
(),
pBtn
->
property
(
"orderId"
).
toString
());
}
void
MainForm
::
on_mainBtnSet_clicked
()
...
...
@@ -294,14 +288,13 @@ QPushButton *MainForm::_GetTabBtnByOrderStatus(int orderStatus)
return
ui
->
mainBtnSend
;
break
;
case
OrderObject
:
:
Finished
:
// case 200:
return
ui
->
mainBtnFinsh
;
break
;
case
OrderObject
:
:
RequestRefund
:
return
ui
->
mainBtn
Refund
;
return
ui
->
mainBtn
Unusual
;
break
;
default
:
return
ui
->
mainBtn
Other
;
return
ui
->
mainBtn
Unusual
;
break
;
}
}
...
...
@@ -348,8 +341,16 @@ void MainForm::onChangeOrderStatus(OrderObject *orderObject, int oldStatus)
// 非首次收到的订单需要现在原先表中删除
if
(
oldStatus
!=
-
100
)
{
tabBtn
=
_GetTabBtnByOrderStatus
(
oldStatus
);
table
=
findChild
<
QTableWidget
*>
(
tabBtn
->
property
(
"tableName"
).
toString
());
if
(
2
==
orderObject
->
order_type
&&
(
1
==
oldStatus
||
2
==
oldStatus
))
{
table
=
ui
->
mainTableReserve
;
tabBtn
=
ui
->
mainBtnReserve
;
}
else
{
tabBtn
=
_GetTabBtnByOrderStatus
(
oldStatus
);
table
=
findChild
<
QTableWidget
*>
(
tabBtn
->
property
(
"tableName"
).
toString
());
}
for
(
int
i
=
0
;
i
<
table
->
rowCount
();
i
++
)
{
if
(
!
table
->
item
(
i
,
1
)
->
text
().
compare
(
orderObject
->
order_id
))
...
...
@@ -362,10 +363,19 @@ void MainForm::onChangeOrderStatus(OrderObject *orderObject, int oldStatus)
}
}
// 将数据插入到表中
tabBtn
=
_GetTabBtnByOrderStatus
(
orderObject
->
status
);
table
=
findChild
<
QTableWidget
*>
(
tabBtn
->
property
(
"tableName"
).
toString
());
if
(
2
==
orderObject
->
order_type
&&
(
1
==
orderObject
->
status
||
2
==
orderObject
->
status
))
{
table
=
ui
->
mainTableReserve
;
tabBtn
=
ui
->
mainBtnReserve
;
}
else
{
tabBtn
=
_GetTabBtnByOrderStatus
(
orderObject
->
status
);
table
=
findChild
<
QTableWidget
*>
(
tabBtn
->
property
(
"tableName"
).
toString
());
}
table
->
insertRow
(
0
);
QTableWidgetItem
*
item0
=
new
QTableWidgetItem
(
orderObject
->
channel
N
ame
);
QTableWidgetItem
*
item0
=
new
QTableWidgetItem
(
orderObject
->
channel
_n
ame
);
item0
->
setTextAlignment
(
Qt
::
AlignCenter
);
table
->
setItem
(
0
,
0
,
item0
);
// 渠道
QTableWidgetItem
*
item1
=
new
QTableWidgetItem
(
orderObject
->
order_id
);
...
...
@@ -383,10 +393,11 @@ void MainForm::onChangeOrderStatus(OrderObject *orderObject, int oldStatus)
QTableWidgetItem
*
item5
=
new
QTableWidgetItem
(
QDateTime
::
fromTime_t
(
orderObject
->
create_time
).
toString
(
"MM-dd hh:mm"
));
item5
->
setTextAlignment
(
Qt
::
AlignCenter
);
table
->
setItem
(
0
,
5
,
item5
);
// 下单时间
if
(
table
!=
ui
->
mainTableFinsh
&&
table
!=
ui
->
mainTableOther
)
if
(
table
!=
ui
->
mainTableFinsh
)
{
if
(
!
table
->
property
(
"operationName"
).
toString
().
compare
(
"接单"
))
if
(
!
table
->
property
(
"operationName"
).
toString
().
compare
(
"接单"
)
&&
1
==
orderObject
->
status
)
{
qDebug
()
<<
table
->
objectName
()
<<
"------"
;
QWidget
*
pWdg
=
new
QWidget
(
table
);
QHBoxLayout
*
hLayout
=
new
QHBoxLayout
(
pWdg
);
QPushButton
*
pBtn
=
new
QPushButton
(
pWdg
);
...
...
@@ -399,9 +410,7 @@ void MainForm::onChangeOrderStatus(OrderObject *orderObject, int oldStatus)
hLayout
->
addWidget
(
pBtn
);
hLayout
->
setMargin
(
0
);
pWdg
->
setLayout
(
hLayout
);
table
->
setCellWidget
(
0
,
6
,
pWdg
);
// 操作按钮
connect
(
pBtn
,
&
QPushButton
::
clicked
,
this
,
&
MainForm
::
onMainProcBtnClicked
);
}
}
...
...
@@ -410,26 +419,8 @@ void MainForm::onChangeOrderStatus(OrderObject *orderObject, int oldStatus)
tabBtn
->
setText
(
btnText
);
// 检测是否需要提示
if
(
ui
->
mainTableNew
->
rowCount
()
>
0
)
{
emit
startRemind
(
0
);
}
else
if
(
ui
->
mainTableRefund
->
rowCount
()
>
0
)
{
emit
startRemind
(
1
);
}
else
{
emit
stopRemind
();
}
_SetTablesSortEnable
(
true
);
}
void
MainForm
::
onShowDeliverPickForm
(
const
QString
&
orderId
,
const
QList
<
DeliverObject
>
&
delivers
)
{
m_pickForm
->
SetDeliversInfo
(
orderId
,
delivers
);
m_pickForm
->
show
();
}
void
MainForm
::
on_mainBtnUp_clicked
()
{
m_currentTable
->
scrollToTop
();
...
...
fmTakeaway/mainForm.h
View file @
716544c1
...
...
@@ -5,8 +5,6 @@
#include <QTableWidget>
#include "alertForm.h"
#include "Model/orderObject.h"
#include "Model/deliverObject.h"
#include "pickForm.h"
#include "settingForm.h"
#include "detailForm.h"
#include <QTimer>
...
...
@@ -49,8 +47,6 @@ private:
// 通知窗口
AlertForm
*
m_alertForm
;
// 人员选择窗口
PickForm
*
m_pickForm
;
// 设置窗口
SettingForm
*
m_settingForm
;
// 订单详情窗口
...
...
@@ -98,7 +94,7 @@ signals:
* 参数:[1]操作动作名[2]订单编号[3]配送员信息
* 返回:NULL
* */
void
processOrder
(
const
QString
&
operation
,
const
QString
&
orderId
,
const
DeliverObject
&
deliverObj
);
void
processOrder
(
const
QString
&
operation
,
const
QString
&
orderId
);
/* 功能:通知悬浮窗显示
* 参数:NULL
* 返回:NULL
...
...
@@ -253,11 +249,6 @@ public slots:
* 返回:NULL
* */
void
onChangeOrderStatus
(
OrderObject
*
orderObject
,
int
oldStatus
);
/* 功能:显示配送员选择窗口
* 参数:[1]订单编号[2]配送员信息
* 返回:NULL
* */
void
onShowDeliverPickForm
(
const
QString
&
orderId
,
const
QList
<
DeliverObject
>&
delivers
);
/* 功能:显示订单详情
* 参数:[1]订单对象
* 返回:NULL
...
...
fmTakeaway/mainForm.ui
View file @
716544c1
...
...
@@ -365,7 +365,7 @@
<number>
0
</number>
</property>
<item>
<widget
class=
"QPushButton"
name=
"mainBtn
Refund
"
>
<widget
class=
"QPushButton"
name=
"mainBtn
Unusual
"
>
<property
name=
"minimumSize"
>
<size>
<width>
97
</width>
...
...
@@ -383,16 +383,16 @@
</property>
<property
name=
"text"
>
<string>
0
需退
单
</string>
异常
单
</string>
</property>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
<property
name=
"tableName"
stdset=
"0"
>
<string>
mainTable
Refund
</string>
<string>
mainTable
Unusual
</string>
</property>
<property
name=
"name"
stdset=
"0"
>
<string>
需退
单
</string>
<string>
异常
单
</string>
</property>
</widget>
</item>
...
...
@@ -424,7 +424,7 @@
<number>
0
</number>
</property>
<item>
<widget
class=
"QPushButton"
name=
"mainBtn
Other
"
>
<widget
class=
"QPushButton"
name=
"mainBtn
Reserve
"
>
<property
name=
"minimumSize"
>
<size>
<width>
97
</width>
...
...
@@ -442,16 +442,16 @@
</property>
<property
name=
"text"
>
<string>
0
其他
</string>
预订单
</string>
</property>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
<property
name=
"tableName"
stdset=
"0"
>
<string>
mainTable
Other
</string>
<string>
mainTable
Reserve
</string>
</property>
<property
name=
"name"
stdset=
"0"
>
<string>
其他
</string>
<string>
预订单
</string>
</property>
</widget>
</item>
...
...
@@ -942,7 +942,7 @@
</widget>
</item>
<item>
<widget
class=
"QTableWidget"
name=
"mainTable
Refund
"
>
<widget
class=
"QTableWidget"
name=
"mainTable
Unusual
"
>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
...
...
@@ -1023,7 +1023,7 @@
</widget>
</item>
<item>
<widget
class=
"QTableWidget"
name=
"mainTable
Other
"
>
<widget
class=
"QTableWidget"
name=
"mainTable
Reserve
"
>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
...
...
@@ -1046,10 +1046,10 @@
<bool>
false
</bool>
</property>
<property
name=
"operationName"
stdset=
"0"
>
<string>
NULL
</string>
<string>
接单
</string>
</property>
<property
name=
"operation"
stdset=
"0"
>
<string>
NULL
</string>
<string>
getDelivers
</string>
</property>
<attribute
name=
"horizontalHeaderCascadingSectionResizes"
>
<bool>
false
</bool>
...
...
@@ -1096,6 +1096,11 @@
<string>
下单时间
</string>
</property>
</column>
<column>
<property
name=
"text"
>
<string>
操作
</string>
</property>
</column>
</widget>
</item>
<item>
...
...
@@ -1582,7 +1587,7 @@
</hints>
</connection>
<connection>
<sender>
mainBtn
Refund
</sender>
<sender>
mainBtn
Unusual
</sender>
<signal>
clicked()
</signal>
<receiver>
MainForm
</receiver>
<slot>
onMainTabBtnClicked()
</slot>
...
...
@@ -1598,7 +1603,7 @@
</hints>
</connection>
<connection>
<sender>
mainBtn
Other
</sender>
<sender>
mainBtn
Reserve
</sender>
<signal>
clicked()
</signal>
<receiver>
MainForm
</receiver>
<slot>
onMainTabBtnClicked()
</slot>
...
...
@@ -1678,7 +1683,7 @@
</hints>
</connection>
<connection>
<sender>
mainTable
Refund
</sender>
<sender>
mainTable
Unusual
</sender>
<signal>
itemClicked(QTableWidgetItem*)
</signal>
<receiver>
MainForm
</receiver>
<slot>
onMainTableItemClicked(QTableWidgetItem*)
</slot>
...
...
@@ -1694,7 +1699,7 @@
</hints>
</connection>
<connection>
<sender>
mainTable
Other
</sender>
<sender>
mainTable
Reserve
</sender>
<signal>
itemClicked(QTableWidgetItem*)
</signal>
<receiver>
MainForm
</receiver>
<slot>
onMainTableItemClicked(QTableWidgetItem*)
</slot>
...
...
fmTakeaway/preDefine.h
View file @
716544c1
...
...
@@ -21,6 +21,7 @@
#define INI_DB_PORT "DbInfo/port"
#define INI_LOGINSERVER "FmServer/loginUrl"
#define INI_ORDERSERVER "FmServer/orderUrl"
#define INI_STORESERVER "FmServer/storeUrl"
#define INI_PRINTERNAME "Printer/name"
#define INI_OMSBTNPOSTION "OmsBtn/postion"
#define INI_FLOATPOSTION "Float/postion"
...
...
@@ -117,7 +118,9 @@
//接口地址
#define INI_INTERFACE_ILOGIN "login"
#define INI_INTERFACE_ILOGIN "login"
#define INI_INTERFACE_GETSTORESTATE "getstorestate"
#define INI_INTERFACE_UPDATESTATE "updatestate"
#define INI_INTERFACE_PULLORDER "pullOrder"
#define INI_INTERFACE_HEART "heart"
#define INI_INTERFACE_CONFIRM "confirm"
...
...
fmTakeaway/refdishesForm.cpp
View file @
716544c1
...
...
@@ -26,7 +26,7 @@ void refDishesForm::InitData(OrderObject *obj)
_Init
();
int
i
=
0
;
foreach
(
Product
Object
*
product
,
obj
->
proList
)
foreach
(
Dish
Object
*
product
,
obj
->
proList
)
{
QPushButton
*
btn
=
new
QPushButton
(
this
);
btn
->
setFixedSize
(
260
,
50
);
...
...
fmTakeaway/refuseForm.cpp
View file @
716544c1
...
...
@@ -44,7 +44,8 @@ void RefuseForm::on_reason1_toggled(bool checked)
if
(
checked
)
{
ui
->
refuseBtnOk
->
setEnabled
(
true
);
m_reasonCode
=
"餐厅已打烊"
;
m_reasonStr
=
"餐厅已打烊"
;
m_reasonCode
=
2
;
}
}
...
...
@@ -67,7 +68,8 @@ void RefuseForm::on_reason2_toggled(bool checked)
if
(
checked
)
{
ui
->
refuseBtnOk
->
setEnabled
(
true
);
m_reasonCode
=
"菜品已售完"
;
m_reasonStr
=
"菜品已售完"
;
m_reasonCode
=
3
;
}
}
...
...
@@ -76,7 +78,8 @@ void RefuseForm::on_reason3_toggled(bool checked)
if
(
checked
)
{
ui
->
refuseBtnOk
->
setEnabled
(
true
);
m_reasonCode
=
"餐厅太忙"
;
m_reasonStr
=
"餐厅太忙"
;
m_reasonCode
=
5
;
}
}
...
...
@@ -85,7 +88,8 @@ void RefuseForm::on_reason4_toggled(bool checked)
if
(
checked
)
{
ui
->
refuseBtnOk
->
setEnabled
(
true
);
m_reasonCode
=
"联系不上客户"
;
m_reasonStr
=
"联系不上客户"
;
m_reasonCode
=
6
;
}
}
...
...
@@ -94,7 +98,8 @@ void RefuseForm::on_reason5_toggled(bool checked)
if
(
checked
)
{
ui
->
refuseBtnOk
->
setEnabled
(
true
);
m_reasonCode
=
"无人配送"
;
m_reasonStr
=
"无人配送"
;
m_reasonCode
=-
1
;
}
}
...
...
fmTakeaway/refuseForm.h
View file @
716544c1
...
...
@@ -18,7 +18,8 @@ class RefuseForm : public QDialog
public
:
explicit
RefuseForm
(
QWidget
*
parent
=
0
);
~
RefuseForm
();
QString
m_reasonCode
;
QString
m_reasonStr
;
int
m_reasonCode
;
void
SetOrderInfo
(
OrderObject
*
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment