Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FmTakeaway
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
shangshang.dai
FmTakeaway
Commits
88cf4e7b
Commit
88cf4e7b
authored
Sep 27, 2016
by
ss.dai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复打印机不打印、乱码问题,更改销售单写入提示语
parent
48a42b72
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
13 deletions
+23
-13
fmPrinter/fmPrinter.cpp
+4
-3
fmTakeaway/Control/flowControl.cpp
+9
-9
fmTakeaway/detailForm.cpp
+1
-0
fmTakeaway/main.cpp
+9
-0
fmTakeaway/mainForm.cpp
+0
-1
No files found.
fmPrinter/fmPrinter.cpp
View file @
88cf4e7b
...
...
@@ -87,7 +87,8 @@ QString FmPrinter::_GetPrintData(OrderObject *pData)
bool
FmPrinter
::
_RawDataToPrinter
(
QString
printerName
,
QString
data
)
{
LPTSTR
szPrinterName
=
(
LPTSTR
)
printerName
.
toStdWString
().
c_str
();
LPBYTE
lpData
=
(
LPBYTE
)
data
.
toLocal8Bit
().
data
();
QByteArray
tmpData
=
data
.
toLocal8Bit
();
LPBYTE
lpData
=
(
LPBYTE
)
tmpData
.
data
();
DWORD
dwCount
=
strlen
((
char
*
)
lpData
);
BOOL
bStatus
=
FALSE
;
HANDLE
hPrinter
=
NULL
;
...
...
@@ -99,9 +100,9 @@ bool FmPrinter::_RawDataToPrinter(QString printerName, QString data)
bStatus
=
OpenPrinter
(
szPrinterName
,
&
hPrinter
,
NULL
);
if
(
bStatus
)
{
// Fill in the structure with info about this "document."
DocInfo
.
pDocName
=
(
LPTSTR
)
QString
(
"TakeawayDoc"
).
toStdWString
().
c_str
()
;
DocInfo
.
pDocName
=
(
LPTSTR
)
L"TakeawayDoc"
;
DocInfo
.
pOutputFile
=
NULL
;
DocInfo
.
pDatatype
=
(
LPTSTR
)
QString
(
"RAW"
).
toStdWString
().
c_str
()
;
DocInfo
.
pDatatype
=
(
LPTSTR
)
L"RAW"
;
// Inform the spooler the document is beginning.
dwJob
=
StartDocPrinter
(
hPrinter
,
1
,
(
LPBYTE
)
&
DocInfo
);
...
...
fmTakeaway/Control/flowControl.cpp
View file @
88cf4e7b
...
...
@@ -242,10 +242,10 @@ bool FlowControl::_ConfirmOrder(const QString &orderId, const DeliverObject &del
{
OrderObject
*
orderObject
=
m_ordersMap
.
value
(
orderId
);
emit
showAlert
(
AlertForm
::
LOADING
,
"正在
写入销售单
......"
);
emit
showAlert
(
AlertForm
::
LOADING
,
"正在
录入天天饮食
......"
);
QLOG_INFO
()
<<
QString
(
"[---order entry begin---]"
);
// 写入销售单
QString
orderEntryError
(
"
\r\n
写入销售单成功
"
);
QString
orderEntryError
(
"
[此单录入天天饮食成功]
"
);
if
(
!
FmPlugin
::
GetInstance
().
DoOrderEntry
(
orderObject
,
m_cashierObject
.
id
,
m_cashierObject
.
name
,
m_cashierObject
.
shiftId
,
m_cashierObject
.
shiftName
,
error
))
{
...
...
@@ -258,7 +258,7 @@ bool FlowControl::_ConfirmOrder(const QString &orderId, const DeliverObject &del
file
.
open
(
QFile
::
WriteOnly
);
file
.
close
();
}
orderEntryError
=
QString
(
"
\r\n
[写入销售单失败,可在订单详情页补录.]
"
);
orderEntryError
=
QString
(
"
<font color=
\"
#FF0000
\"
>[此单录入天天饮食失败,请务必及时在订单详情页补录]</font>
"
);
QLOG_ERROR
()
<<
QString
(
"order entry failed,[%1]"
).
arg
(
error
);
}
else
{
...
...
@@ -266,9 +266,9 @@ bool FlowControl::_ConfirmOrder(const QString &orderId, const DeliverObject &del
}
QString
remark
(
orderObject
->
remark
),
deliveryTime
;
remark
=
remark
.
isEmpty
()
?
""
:
QString
(
"
\r\n
[备注: %1]"
).
arg
(
remark
);
deliveryTime
=
QString
(
"
\r\n
[期望送达时间: %1]"
).
arg
(
QDateTime
::
fromTime_t
(
orderObject
->
delivery_time
).
toString
(
"yyyy-MM-dd hh:mm:ss"
));
emit
showAlert
(
AlertForm
::
SUCCESS
,
QString
(
"接单成功!%1
%2
%3"
).
arg
(
remark
).
arg
(
deliveryTime
).
arg
(
orderEntryError
));
remark
=
remark
.
isEmpty
()
?
""
:
QString
(
"[备注: %1]"
).
arg
(
remark
);
deliveryTime
=
QString
(
"[期望送达时间: %1]"
).
arg
(
QDateTime
::
fromTime_t
(
orderObject
->
delivery_time
).
toString
(
"yyyy-MM-dd hh:mm:ss"
));
emit
showAlert
(
AlertForm
::
SUCCESS
,
QString
(
"接单成功!%1
<br/>%2<br/>
%3"
).
arg
(
remark
).
arg
(
deliveryTime
).
arg
(
orderEntryError
));
// 通知主界面移动订单
int
oldStatus
=
orderObject
->
status
;
...
...
@@ -615,7 +615,7 @@ void FlowControl::onGetOrderDetails(const QString &orderId)
void
FlowControl
::
onReEntryOrder
(
const
QString
&
orderId
)
{
emit
showAlert
(
AlertForm
::
LOADING
,
"正在补录
销售单
......"
);
emit
showAlert
(
AlertForm
::
LOADING
,
"正在补录
到天天饮食
......"
);
QLOG_INFO
()
<<
QString
(
"[---order reEntry begin---]"
);
// 写入销售单
...
...
@@ -625,13 +625,13 @@ void FlowControl::onReEntryOrder(const QString &orderId)
m_cashierObject
.
shiftId
,
m_cashierObject
.
shiftName
,
error
))
{
QLOG_ERROR
()
<<
QString
(
"order reEntry failed,[%1]"
).
arg
(
error
);
emit
showAlert
(
AlertForm
::
ERROR
,
"
补录销售单失败
"
);
emit
showAlert
(
AlertForm
::
ERROR
,
"
<font color=
\"
#FF0000
\"
>补录天天饮食失败,请联系管理员或者进群咨询(205821431)</font>
"
);
}
else
{
QFile
file
(
QString
(
"%1/orders/%2"
).
arg
(
QApplication
::
applicationDirPath
(),
orderObject
->
order_id
));
file
.
remove
();
QLOG_INFO
()
<<
QString
(
"order reEentry success."
);
emit
showAlert
(
AlertForm
::
SUCCESS
,
"补录
销售单
成功"
);
emit
showAlert
(
AlertForm
::
SUCCESS
,
"补录
天天饮食
成功"
);
}
}
...
...
fmTakeaway/detailForm.cpp
View file @
88cf4e7b
...
...
@@ -7,6 +7,7 @@
#include "fmPrinter.h"
#include <QApplication>
#include <QFile>
#include "QsLog.h"
DetailForm
::
DetailForm
(
QWidget
*
parent
)
:
QDialog
(
parent
),
...
...
fmTakeaway/main.cpp
View file @
88cf4e7b
...
...
@@ -10,6 +10,7 @@
#include "Control/refundControl.h"
#include "floatForm.h"
#include "DTools/configManger.h"
#include <windows.h>
using
namespace
QsLogging
;
...
...
@@ -49,6 +50,14 @@ void LoadTheme(const QString& theme)
int
main
(
int
argc
,
char
*
argv
[])
{
HANDLE
m_hMutex
=
CreateMutex
(
NULL
,
FALSE
,
L"fmTakeaway"
);
if
(
GetLastError
()
==
ERROR_ALREADY_EXISTS
)
{
CloseHandle
(
m_hMutex
);
m_hMutex
=
NULL
;
return
-
1
;
}
QApplication
a
(
argc
,
argv
);
g_appDir
=
a
.
applicationDirPath
();
...
...
fmTakeaway/mainForm.cpp
View file @
88cf4e7b
...
...
@@ -93,7 +93,6 @@ void MainForm::MyShow()
void
MainForm
::
_Init
()
{
this
->
setWindowFlags
(
this
->
windowFlags
()
|
Qt
::
FramelessWindowHint
|
Qt
::
WindowStaysOnTopHint
);
// TODO
this
->
showFullScreen
();
// 显示托盘
m_tray
.
show
();
...
...
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