Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmp_takeout
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
zhenfei.zhang
fmp_takeout
Commits
0f065311
Commit
0f065311
authored
Jul 19, 2017
by
yunpeng.song
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加销售单结果记录sqlite,增加补录功能
parent
d97925b3
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
267 additions
and
12 deletions
+267
-12
Thread/workThread/flowcontroll.cpp
+65
-1
Thread/workThread/flowcontroll.h
+4
-1
Tool/orderstatus.cpp
+133
-0
Tool/orderstatus.h
+34
-0
Ui/DetailForm.cpp
+25
-6
Ui/DetailForm.h
+1
-1
fmp_takeout.pro
+4
-2
fmp_takeout_p.cpp
+1
-1
global/preDefine.h
+0
-0
No files found.
Thread/workThread/flowcontroll.cpp
View file @
0f065311
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include <QSqlError>
#include <QSqlError>
#include <QDateTime>
#include <QDateTime>
#include <QSqlRecord>
#include <QSqlRecord>
#include <Tool/orderstatus.h>
flowControll
::
flowControll
(
QObject
*
parent
)
:
QObject
(
parent
),
m_loginSocket
(
0
),
flowControll
::
flowControll
(
QObject
*
parent
)
:
QObject
(
parent
),
m_loginSocket
(
0
),
...
@@ -957,6 +958,43 @@ QString flowControll::getHostMacAddress()
...
@@ -957,6 +958,43 @@ QString flowControll::getHostMacAddress()
return
result
;
return
result
;
}
}
bool
flowControll
::
_EntryOrder
(
OrderObject
*
orderObject
)
{
int
result
;
if
((
orderObject
->
status
!=
100
&&
orderObject
->
status
!=
3
)
&&!
Orderstatus
::
getInstance
().
isentry
(
orderObject
->
order_id
))
{
if
(
!
DoSalesSlip
(
orderObject
,
0
))
{
QLOG_INFO
()
<<
QString
(
"entry order %1 failed[%2]"
).
arg
(
orderObject
->
order_id
).
arg
(
error
);
result
=
0
;
}
else
{
Orderstatus
::
getInstance
().
entryupdate
(
orderObject
->
order_id
,
1
);
QLOG_INFO
()
<<
QString
(
"[entry order %1 success]."
).
arg
(
orderObject
->
order_id
);
result
=
1
;
}
}
if
((
orderObject
->
status
==
100
||
orderObject
->
status
==
3
)
&&!
Orderstatus
::
getInstance
().
isrefund
(
orderObject
->
order_id
)
&&
Orderstatus
::
getInstance
().
isentry
(
orderObject
->
order_id
))
{
QString
tmpstr
=
""
;
if
(
!
RefuseSalesSlip
(
orderObject
))
{
tmpstr
=
QString
(
"
\r\n
[撤回销售单失败]"
);
QLOG_INFO
()
<<
QString
(
"entry order %1 failed[%2]"
).
arg
(
orderObject
->
order_id
).
arg
(
error
);
return
false
;
}
else
{
Orderstatus
::
getInstance
().
refundupdate
(
orderObject
->
order_id
,
1
);
tmpstr
=
QString
(
"
\r\n
[撤回销售单成功]"
);
return
true
;
}
}
}
// 撤单的id 记录
// 撤单的id 记录
QByteArray
flowControll
::
_GetRefundOrderData
(
const
QString
&
orderId
)
QByteArray
flowControll
::
_GetRefundOrderData
(
const
QString
&
orderId
)
{
{
...
@@ -1170,8 +1208,34 @@ bool flowControll::_RefundOrder(const QString& orderId, QString reason)//退单
...
@@ -1170,8 +1208,34 @@ bool flowControll::_RefundOrder(const QString& orderId, QString reason)//退单
emit
showOrderDetails
(
m_ordersMap
.
value
(
orderId
));
emit
showOrderDetails
(
m_ordersMap
.
value
(
orderId
));
}
}
void
flowControll
::
onReEntryOrder
(
const
QString
&
orderId
)
void
flowControll
::
onReEntryOrder
(
OrderObject
*
orderObject
,
int
operation
)
{
if
(
operation
==
OPERATIONMAME_ENTRY
)
{
{
if
(
!
DoSalesSlip
(
orderObject
,
0
))
{
QLOG_INFO
()
<<
QString
(
"entry order %1 failed[%2]"
).
arg
(
orderObject
->
order_id
).
arg
(
error
);
}
else
{
Orderstatus
::
getInstance
().
entryupdate
(
orderObject
->
order_id
,
1
);
QLOG_INFO
()
<<
QString
(
"[entry order %1 success]."
).
arg
(
orderObject
->
order_id
);
}
}
else
{
QString
tmpstr
=
""
;
if
(
!
RefuseSalesSlip
(
orderObject
))
{
tmpstr
=
QString
(
"
\r\n
[撤回销售单失败]"
);
QLOG_INFO
()
<<
QString
(
"entry order %1 failed[%2]"
).
arg
(
orderObject
->
order_id
).
arg
(
error
);
}
else
{
Orderstatus
::
getInstance
().
refundupdate
(
orderObject
->
order_id
,
1
);
tmpstr
=
QString
(
"
\r\n
[撤回销售单成功]"
);
}
}
}
}
void
flowControll
::
onNetReEntryOrder
(
const
QString
&
orderId
)
void
flowControll
::
onNetReEntryOrder
(
const
QString
&
orderId
)
...
...
Thread/workThread/flowcontroll.h
View file @
0f065311
...
@@ -118,11 +118,14 @@ public slots:
...
@@ -118,11 +118,14 @@ public slots:
void
onUpdateCashier
(
const
CashierObject
&
cashier
);
//更新收银员信息
void
onUpdateCashier
(
const
CashierObject
&
cashier
);
//更新收银员信息
void
onGetOnDutyCashiers
();
//获取在班收银员信息
void
onGetOnDutyCashiers
();
//获取在班收银员信息
void
onGetOrderDetails
(
const
QString
&
orderId
);
//获取订单详情
void
onGetOrderDetails
(
const
QString
&
orderId
);
//获取订单详情
void
onReEntryOrder
(
const
QString
&
orderId
);
//本地接受销售单
void
onReEntryOrder
(
OrderObject
*
orderObject
,
int
operation
);
//本地接受销售单
void
onNetReEntryOrder
(
const
QString
&
orderId
);
//发送数据到服务端
void
onNetReEntryOrder
(
const
QString
&
orderId
);
//发送数据到服务端
void
onProcessRejectOrder
(
const
QString
&
orderId
,
const
int
&
reason
,
const
int
&
reasontype
);
void
onProcessRejectOrder
(
const
QString
&
orderId
,
const
int
&
reason
,
const
int
&
reasontype
);
bool
_RefundOrder
(
const
QString
&
orderId
,
QString
reason
);
//退单
bool
_RefundOrder
(
const
QString
&
orderId
,
QString
reason
);
//退单
void
onStopTimer
();
void
onStopTimer
();
private
slots
:
bool
_EntryOrder
(
OrderObject
*
orderObject
);
};
};
...
...
Tool/orderstatus.cpp
0 → 100644
View file @
0f065311
#include "orderstatus.h"
#include "QsLog/QsLog.h"
#include <QCoreApplication>
Orderstatus
::
Orderstatus
()
{
QString
dbpath
=
QCoreApplication
::
applicationDirPath
()
+
QString
(
"/orderstatus.db"
);
//db.addDatabase("QSQLITE");
QSqlDatabase
db
=
QSqlDatabase
::
addDatabase
(
"QSQLITE"
);
//db.setDatabaseName("orderstatus.db");
db
.
setDatabaseName
(
dbpath
);
if
(
!
db
.
open
())
{
QString
error
=
db
.
lastError
().
text
();
QLOG_ERROR
()
<<
QString
(
"Qsqlite database open filed,%1"
).
arg
(
error
);
}
else
{
QLOG_INFO
()
<<
QString
(
"Qsqlite database open successed"
);
}
QSqlQuery
query
;
int
isTableExist
;
query
.
exec
(
QString
(
"select count(*) from sqlite_master where type='table' and name='%1'"
).
arg
(
"status"
));
while
(
query
.
next
())
{
isTableExist
=
query
.
value
(
0
).
toInt
();
}
if
(
!
isTableExist
){
QLOG_INFO
()
<<
"table status does not exist"
;
query
.
exec
(
QString
(
"create table status (orderId varchar(20) primary key, isentry int(1),isrefund int(1))"
));
}
else
{
QLOG_INFO
()
<<
"table status exists"
;
}
//qDebug()<<query.lastError().text()<<"create table error";
}
Orderstatus
&
Orderstatus
::
getInstance
()
{
static
Orderstatus
order
;
return
order
;
}
bool
Orderstatus
::
statusinsert
(
const
QString
&
orderId
,
const
int
&
entrystatus
,
const
int
&
refundstatus
)
{
QSqlQuery
query
;
query
.
prepare
(
QString
(
"insert into status values('%1',%2,%3)"
).
arg
(
orderId
).
arg
(
QString
::
number
(
entrystatus
)).
arg
(
QString
::
number
(
refundstatus
)));
if
(
!
query
.
exec
())
{
QLOG_ERROR
()
<<
query
.
lastError
().
text
()
<<
QString
::
number
(
query
.
lastError
().
type
())
<<
"statusinsert"
;
return
false
;
}
else
{
QLOG_INFO
()
<<
QString
(
"insert orderId %1 into status success"
).
arg
(
orderId
);
return
true
;
}
}
bool
Orderstatus
::
entryupdate
(
const
QString
&
orderId
,
const
int
&
entrystatus
)
{
QSqlQuery
query
;
query
.
prepare
(
QString
(
"update status set isentry=%1 where orderId='%2'"
).
arg
(
QString
::
number
(
entrystatus
)).
arg
(
orderId
));
if
(
!
query
.
exec
())
{
QLOG_ERROR
()
<<
query
.
lastError
().
text
()
<<
"entryupdate"
;
return
false
;
}
else
{
QLOG_INFO
()
<<
QString
(
"update orderId %1 entrystatus success"
).
arg
(
orderId
);
return
true
;
}
}
bool
Orderstatus
::
isentry
(
const
QString
&
orderId
)
{
QSqlQuery
query
;
query
.
prepare
(
QString
(
"select isentry from status where orderId='%1'"
).
arg
(
orderId
));
if
(
!
query
.
exec
())
{
QLOG_ERROR
()
<<
query
.
lastError
().
text
()
<<
"isentry"
;
return
false
;
}
while
(
query
.
next
())
{
return
query
.
value
(
0
).
toBool
();
}
}
bool
Orderstatus
::
refundupdate
(
const
QString
&
orderId
,
const
int
&
refundstatus
)
{
QSqlQuery
query
;
query
.
prepare
(
QString
(
"update status set isrefund=%1 where orderId='%2'"
).
arg
(
QString
::
number
(
refundstatus
)).
arg
(
orderId
));
if
(
!
query
.
exec
())
{
QLOG_ERROR
()
<<
query
.
lastError
().
text
()
<<
"refundupdate"
;
return
false
;
}
else
{
QLOG_INFO
()
<<
QString
(
"update orderId %1 status success"
).
arg
(
orderId
);
return
true
;
}
}
bool
Orderstatus
::
isrefund
(
const
QString
&
orderId
)
{
QSqlQuery
query
;
query
.
prepare
(
QString
(
"select isrefund from status where orderId='%1'"
).
arg
(
orderId
));
if
(
!
query
.
exec
())
{
QLOG_ERROR
()
<<
query
.
lastError
().
text
()
<<
"isrefund"
;
return
false
;
}
while
(
query
.
next
())
{
return
query
.
value
(
0
).
toBool
();
}
}
bool
Orderstatus
::
isorderexit
(
const
QString
&
orderId
)
{
QSqlQuery
query
;
query
.
prepare
(
QString
(
"select orderId from status where orderId='%1'"
).
arg
(
orderId
));
if
(
!
query
.
exec
())
{
QLOG_ERROR
()
<<
query
.
lastError
().
text
()
<<
"isorderexit"
;
return
false
;
}
if
(
query
.
first
())
{
return
true
;
}
else
{
return
false
;
}
}
Tool/orderstatus.h
0 → 100644
View file @
0f065311
#ifndef ORDERSTATUS_H
#define ORDERSTATUS_H
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlError>
#include <QObject>
class
Orderstatus
:
public
QObject
{
Q_OBJECT
public
:
// explicit Orderstatus(QObject *parent = 0);
static
Orderstatus
&
getInstance
();
bool
statusinsert
(
const
QString
&
orderId
,
const
int
&
entrystatus
,
const
int
&
refundstatus
);
bool
entryupdate
(
const
QString
&
orderId
,
const
int
&
entrystatus
);
//bool statusdelete(const QString&);
bool
isentry
(
const
QString
&
orderId
);
bool
refundupdate
(
const
QString
&
orderId
,
const
int
&
refundstatus
);
//bool statusdelete(const QString&);
bool
isrefund
(
const
QString
&
orderId
);
bool
isorderexit
(
const
QString
&
orderId
);
private
:
Orderstatus
();
Orderstatus
(
Orderstatus
const
&
);
Orderstatus
&
operator
=
(
Orderstatus
const
&
);
signals
:
public
slots
:
};
#endif // ORDERSTATUS_H
Ui/DetailForm.cpp
View file @
0f065311
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include "Ui/MateChooser.h"
#include "Ui/MateChooser.h"
#include <QHeaderView>
#include <QHeaderView>
#include <QFileInfo>
#include <QFileInfo>
#include "Tool/orderstatus.h"
DetailForm
::
DetailForm
(
QWidget
*
parent
)
:
DetailForm
::
DetailForm
(
QWidget
*
parent
)
:
QWidget
(
parent
),
QWidget
(
parent
),
...
@@ -38,7 +39,7 @@ DetailForm::DetailForm(QWidget *parent) :
...
@@ -38,7 +39,7 @@ DetailForm::DetailForm(QWidget *parent) :
connect
(
ui
->
refuseorder
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
onOthersOperate
()));
connect
(
ui
->
refuseorder
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
onOthersOperate
()));
connect
(
ui
->
detailnull
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
onOthersOperate
()));
connect
(
ui
->
detailnull
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
onOthersOperate
()));
connect
(
ui
->
detailBtnClose
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
onhideUi
()));
connect
(
ui
->
detailBtnClose
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
onhideUi
()));
//
connect(this,&DetailForm::reEntryOrder,&flowControll::GetInstance(),&flowControll::onReEntryOrder);
connect
(
this
,
&
DetailForm
::
reEntryOrder
,
&
flowControll
::
GetInstance
(),
&
flowControll
::
onReEntryOrder
);
connect
(
this
,
&
DetailForm
::
NetreEntryOrder
,
&
flowControll
::
GetInstance
(),
&
flowControll
::
onNetReEntryOrder
);
connect
(
this
,
&
DetailForm
::
NetreEntryOrder
,
&
flowControll
::
GetInstance
(),
&
flowControll
::
onNetReEntryOrder
);
connect
(
this
,
&
DetailForm
::
processOrder
,
&
flowControll
::
GetInstance
(),
&
flowControll
::
onProcessOrder
);
connect
(
this
,
&
DetailForm
::
processOrder
,
&
flowControll
::
GetInstance
(),
&
flowControll
::
onProcessOrder
);
connect
(
this
,
&
DetailForm
::
processRejectOrder
,
&
flowControll
::
GetInstance
(),
&
flowControll
::
onProcessRejectOrder
);
connect
(
this
,
&
DetailForm
::
processRejectOrder
,
&
flowControll
::
GetInstance
(),
&
flowControll
::
onProcessRejectOrder
);
...
@@ -120,11 +121,27 @@ void DetailForm::showUi(OrderObject *orderObject)
...
@@ -120,11 +121,27 @@ void DetailForm::showUi(OrderObject *orderObject)
}
}
ui
->
HandleRecord
->
setText
(
records
);
ui
->
HandleRecord
->
setText
(
records
);
QFile
orderFlag
(
QString
(
"%1/orders/%2"
).
arg
(
QApplication
::
applicationDirPath
(),
orderObject
->
order_id
));
// QFile orderFlag(QString("%1/orders/%2").arg(QApplication::applicationDirPath(), orderObject->order_id));
qDebug
()
<<
"qfile is "
<<
QString
(
"%1/orders/%2"
).
arg
(
QApplication
::
applicationDirPath
(),
orderObject
->
order_id
);
// qDebug()<<"qfile is "<<QString("%1/orders/%2").arg(QApplication::applicationDirPath(), orderObject->order_id);
if
(
!
orderFlag
.
exists
())
// if(!orderFlag.exists())
// {
// ui->againWrite->hide();
// }
if
(
orderObject
->
status
==
3
||
orderObject
->
status
==
100
)
{
if
(
!
Orderstatus
::
getInstance
().
isrefund
(
orderObject
->
order_id
))
{
{
ui
->
againWrite
->
hide
();
ui
->
againWrite
->
show
();
ui
->
againWrite
->
setProperty
(
"operation"
,
OPERATIONMAME_REFUDN
);
}
}
else
{
if
(
!
Orderstatus
::
getInstance
().
isentry
(
orderObject
->
order_id
))
{
ui
->
againWrite
->
show
();
ui
->
againWrite
->
setProperty
(
"operation"
,
OPERATIONMAME_ENTRY
);
}
}
}
ui
->
refuseorder
->
setProperty
(
"operation"
,
OPERATION_REFUSE
);
ui
->
refuseorder
->
setProperty
(
"operation"
,
OPERATION_REFUSE
);
...
@@ -152,6 +169,7 @@ void DetailForm::showUi(OrderObject *orderObject)
...
@@ -152,6 +169,7 @@ void DetailForm::showUi(OrderObject *orderObject)
{
{
ui
->
detailnull
->
hide
();
ui
->
detailnull
->
hide
();
}
}
if
(
m_rejectForm
==
NULL
)
m_rejectForm
=
new
RejectForm
(
this
);
m_rejectForm
=
new
RejectForm
(
this
);
bool
assigned
=
_ReadBilledMates
();
bool
assigned
=
_ReadBilledMates
();
...
@@ -178,12 +196,13 @@ void DetailForm::showUi(OrderObject *orderObject)
...
@@ -178,12 +196,13 @@ void DetailForm::showUi(OrderObject *orderObject)
void
DetailForm
::
WriteData
(
/*char data[]*/
)
void
DetailForm
::
WriteData
(
/*char data[]*/
)
{
{
QPushButton
*
btn
=
(
QPushButton
*
)
sender
();
//补录要用到接口
//补录要用到接口
if
(
0
==
m_orderObject
)
if
(
0
==
m_orderObject
)
{
{
return
;
return
;
}
}
emit
reEntryOrder
(
m_orderObject
->
order_id
);
emit
reEntryOrder
(
m_orderObject
,
btn
->
property
(
"opertion"
).
toInt
()
);
hide
();
hide
();
}
}
...
...
Ui/DetailForm.h
View file @
0f065311
...
@@ -64,7 +64,7 @@ private:
...
@@ -64,7 +64,7 @@ private:
public
:
public
:
Ui
::
DetailForm
*
ui
;
Ui
::
DetailForm
*
ui
;
Q_SIGNAL
void
reEntryOrder
(
const
QString
&
orderId
);
//补录订单
Q_SIGNAL
void
reEntryOrder
(
OrderObject
*
order
,
int
opertion
);
//补录订单
Q_SIGNAL
void
NetreEntryOrder
(
const
QString
&
orderId
);
//上传补录
Q_SIGNAL
void
NetreEntryOrder
(
const
QString
&
orderId
);
//上传补录
Q_SIGNAL
void
processOrder
(
const
QString
&
operation
,
const
QString
&
orderId
,
const
DeliverObject
&
deliverObj
);
// 处理订单1pra操作动作名2pra订单编号3pra配送员信息
Q_SIGNAL
void
processOrder
(
const
QString
&
operation
,
const
QString
&
orderId
,
const
DeliverObject
&
deliverObj
);
// 处理订单1pra操作动作名2pra订单编号3pra配送员信息
Q_SIGNAL
void
processRejectOrder
(
const
QString
&
orderId
,
const
int
&
reason
,
const
int
&
reasontype
);
Q_SIGNAL
void
processRejectOrder
(
const
QString
&
orderId
,
const
int
&
reason
,
const
int
&
reasontype
);
...
...
fmp_takeout.pro
View file @
0f065311
...
@@ -47,7 +47,8 @@ SOURCES +=fmp_takeout.cpp \
...
@@ -47,7 +47,8 @@ SOURCES +=fmp_takeout.cpp \
Ui
/
RejectForm
.
cpp
\
Ui
/
RejectForm
.
cpp
\
Tool
/
HttpSocket
.
cpp
\
Tool
/
HttpSocket
.
cpp
\
Ui
/
DrinkItem
.
cpp
\
Ui
/
DrinkItem
.
cpp
\
Ui
/
MateChooser
.
cpp
Ui
/
MateChooser
.
cpp
\
Tool
/
orderstatus
.
cpp
HEADERS
+=
fmp_takeout_i
.
h
\
HEADERS
+=
fmp_takeout_i
.
h
\
fmp_takeout
.
h
\
fmp_takeout
.
h
\
...
@@ -94,7 +95,8 @@ HEADERS +=fmp_takeout_i.h \
...
@@ -94,7 +95,8 @@ HEADERS +=fmp_takeout_i.h \
Tool
/
HttpSocket
.
h
\
Tool
/
HttpSocket
.
h
\
fmp_takeout_def
.
h
\
fmp_takeout_def
.
h
\
Ui
/
DrinkItem
.
h
\
Ui
/
DrinkItem
.
h
\
Ui
/
MateChooser
.
h
Ui
/
MateChooser
.
h
\
Tool
/
orderstatus
.
h
FORMS
+=
\
FORMS
+=
\
Ui
/
mainwindow
.
ui
\
Ui
/
mainwindow
.
ui
\
...
...
fmp_takeout_p.cpp
View file @
0f065311
...
@@ -82,7 +82,7 @@ void FMPTakeoutPrivate::sltStopBlink(int type)
...
@@ -82,7 +82,7 @@ void FMPTakeoutPrivate::sltStopBlink(int type)
void
FMPTakeoutPrivate
::
sltPrint
(
QString
data
,
QString
label
)
void
FMPTakeoutPrivate
::
sltPrint
(
QString
data
,
QString
label
)
{
{
if
(
_Printer
)
{
if
(
_Printer
)
{
emit
sgnReceiveStatus
(
_Printer
->
DoPrint
(
data
,
label
));
//
emit sgnReceiveStatus(_Printer->DoPrint(data,label));
}
}
}
}
...
...
global/preDefine.h
View file @
0f065311
No preview for this file type
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