Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmtakeout
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
李定达
fmtakeout
Commits
4c7cb82d
Commit
4c7cb82d
authored
Mar 11, 2019
by
xiaoqing.gu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
外卖 自提 后厨打印模板调试完成
parent
e041f27d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
152 additions
and
33 deletions
+152
-33
takeout/base/Print/newprintlib.cpp
+0
-0
takeout/base/Print/newprintlib.h
+2
-0
takeout/control/orderprintwork.cpp
+2
-2
takeout/control/prtmodelgetwork.cpp
+116
-21
takeout/control/prtmodelgetwork.h
+8
-2
takeout/preDefine.h
+15
-6
takeout/takeout.pro
+2
-2
takeout/view/newmainform.cpp
+7
-0
No files found.
takeout/base/Print/newprintlib.cpp
View file @
4c7cb82d
This diff is collapsed.
Click to expand it.
takeout/base/Print/newprintlib.h
View file @
4c7cb82d
...
...
@@ -77,6 +77,8 @@ private:
void
PrintProcudt
(
const
QList
<
LineNode
*>
&
list
,
const
QList
<
int
>
&
protlist
,
OrderObject
*
_order
);
void
AddProdJson
(
OrderObject
&
des_order
,
ProductObject
*
prod
);
bool
GetObjList
(
int
page_depart
,
int
prod_depart
,
QStringList
prodlist
,
QList
<
OrderObject
>
&
orderlist
,
OrderObject
*
order
);
bool
GetProdObject
(
int
prod_depart
,
QList
<
OrderObject
>
&
orderlist
,
OrderObject
*
order
);
...
...
takeout/control/orderprintwork.cpp
View file @
4c7cb82d
...
...
@@ -116,7 +116,7 @@ bool orderprintwork::GetPrtTemplet(int prttype, int pagew, QString &context, con
}
else
if
(
order
.
order_type
==
6
)
{
file
.
setFileName
(
qApp
->
applicationDirPath
()
+
"/"
+
FILE_PRINTYY80_TEMPLET
);
file
.
setFileName
(
qApp
->
applicationDirPath
()
+
"/"
+
XML_YYINTAKE80_TEMPLATE
);
}
else
{
...
...
@@ -145,7 +145,7 @@ bool orderprintwork::GetPrtTemplet(int prttype, int pagew, QString &context, con
}
else
if
(
order
.
order_type
==
6
)
{
file
.
setFileName
(
qApp
->
applicationDirPath
()
+
"/"
+
FILE_PRINTYY_TEMPLET
);
file
.
setFileName
(
qApp
->
applicationDirPath
()
+
"/"
+
XML_YYINTAKE56_TEMPLATE
);
}
else
{
...
...
takeout/control/prtmodelgetwork.cpp
View file @
4c7cb82d
...
...
@@ -5,9 +5,10 @@
#include "base/DB/fm_database.h"
#include "QsLog.h"
#include <QJsonArray>
#include <Q
tXml/Q
DomDocument>
#include <QDomDocument>
#include <QApplication>
#include <QDir>
#include <Windows.h>
prtModelGetWork
::
prtModelGetWork
(
WorkObject
*
parent
)
:
WorkObject
(
parent
)
{
...
...
@@ -169,8 +170,12 @@ bool prtModelGetWork::CheckPrtModelInfo(QJsonObject &json)
for
(
int
i
=
0
;
i
!=
array
.
size
();
++
i
)
{
if
(
array
.
at
(
i
).
toObject
().
contains
(
"template"
)
&&
array
.
at
(
i
).
toObject
().
contains
(
"print_type"
))
{
if
(
array
.
at
(
i
).
toObject
()[
"template"
].
toString
()
!=
0
)
{
QString
str
=
array
.
at
(
i
).
toObject
()[
"template"
].
toString
();
QLOG_DEBUG
()
<<
array
.
at
(
i
).
toObject
()[
"print_type"
].
toInt
();
if
(
praseXmlPrtModel
(
str
))
{
_templateMap
.
insert
(
array
.
at
(
i
).
toObject
()[
"print_type"
].
toInt
(),
array
.
at
(
i
).
toObject
()[
"template"
].
toString
());
}
}
}
else
{
return
false
;
}
...
...
@@ -195,16 +200,7 @@ bool prtModelGetWork::CheckPrtModelInfo(QJsonObject &json)
prtModelLocalize
();
logoImageLocalize
();
// for(int i = 0;i != _templateList.size(); ++i) {
// QFile file(QApplication::applicationDirPath() + "/prtinfo/1.xml");
// if(file.open(QIODevice::ReadWrite)) {
// qDebug() << "--------------------4040-----------------" << _templateList.at(i) << QString(_templateList.at(i)).toUtf8();
// file.write(QString(_templateList.at(i)).toUtf8());
// file.close();
// return true;
// }
// }
qrCodeImageLocalize
();
return
true
;
}
...
...
@@ -212,19 +208,18 @@ bool prtModelGetWork::CheckPrtModelInfo(QJsonObject &json)
bool
prtModelGetWork
::
prtModelLocalize
()
{
qDebug
()
<<
"-------------------------------4040---------------------"
<<
_templateMap
;
QMap
<
int
,
QString
>::
iterator
it
;
for
(
it
=
_templateMap
.
begin
();
it
!=
_templateMap
.
end
();
++
it
)
{
QString
dir_str
=
QApplication
::
applicationDirPath
()
+
QString
(
"/prtinfo"
);
// 检查目录是否存在,若不存在则新建
QString
dir_str
=
QApplication
::
applicationDirPath
()
+
QString
(
"/prtinfo"
);
QDir
dir
;
if
(
!
dir
.
exists
(
dir_str
))
{
bool
res
=
dir
.
mkpath
(
dir_str
);
qDebug
()
<<
"新建目录是否成功"
<<
res
;
}
QMap
<
int
,
QString
>::
iterator
it
;
for
(
it
=
_templateMap
.
begin
();
it
!=
_templateMap
.
end
();
++
it
)
{
QFile
file
(
QApplication
::
applicationDirPath
()
+
QString
(
"/prtinfo/%1.xml"
).
arg
(
it
.
key
()));
if
(
file
.
open
(
Q
IODevice
::
ReadWri
te
))
{
if
(
file
.
open
(
Q
File
::
WriteOnly
|
QFile
::
Trunca
te
))
{
file
.
write
(
QString
(
it
.
value
()).
toUtf8
());
file
.
close
();
}
else
{
...
...
@@ -243,11 +238,24 @@ bool prtModelGetWork::logoImageLocalize()
}
QMap
<
int
,
QString
>::
iterator
it
;
for
(
it
=
_logoMap
.
begin
();
it
!=
_logoMap
.
end
();
++
it
)
{
downloadImage
(
it
.
value
(),
QApplication
::
applicationDirPath
()
+
QString
(
"/prtinfo/%1.png"
).
arg
(
it
.
key
()));
downloadImage
(
it
.
value
(),
QApplication
::
applicationDirPath
()
+
QString
(
"/prtinfo/%1.bmp"
).
arg
(
it
.
key
()));
}
//将图片二值化
// img_rgb2gray();
return
true
;
}
bool
prtModelGetWork
::
qrCodeImageLocalize
()
{
if
(
_qrCodeMap
.
size
()
==
0
)
{
return
false
;
}
QMap
<
int
,
QString
>::
iterator
it
;
for
(
it
=
_qrCodeMap
.
begin
();
it
!=
_qrCodeMap
.
end
();
++
it
)
{
downloadImage
(
it
.
value
(),
QApplication
::
applicationDirPath
()
+
QString
(
"/prtinfo/%1p.bmp"
).
arg
(
it
.
key
()));
}
// downloadImage("https://picture.sandload.cn/1551195158116.png", QApplication::applicationDirPath()+"/prtinfo/1.bmp");
// Downloader downloader;
// downloader.downloadFileFromURL("https://picture.sandload.cn/1551195158116.png", QApplication::applicationDirPath()+"/prtinfo");
return
true
;
}
...
...
@@ -280,7 +288,7 @@ bool prtModelGetWork::downloadImage(QString url, QString fileName)
reply
->
deleteLater
();
QFile
file
(
fileName
);
if
(
!
file
.
open
(
Q
IODevice
::
WriteOnly
))
if
(
!
file
.
open
(
Q
File
::
WriteOnly
|
QFile
::
Truncate
))
return
false
;
file
.
write
(
reply
->
readAll
());
file
.
close
();
...
...
@@ -288,4 +296,91 @@ bool prtModelGetWork::downloadImage(QString url, QString fileName)
return
true
;
}
bool
prtModelGetWork
::
praseXmlPrtModel
(
QString
str
)
{
QDomDocument
doc
;
QString
errorMsg
;
int
errorLine
;
int
errorColumn
;
if
(
!
doc
.
setContent
(
str
,
&
errorMsg
,
&
errorLine
,
&
errorColumn
))
{
QLOG_ERROR
()
<<
"xml prtmodel prase failed!"
<<
errorMsg
;
return
false
;
}
return
true
;
}
void
prtModelGetWork
::
img_rgb2gray
()
{
int
threshold
=
200
;
FILE
*
stream
=
fopen
(
"D:
\\
6.bmp"
,
"rb"
);
if
(
stream
==
NULL
)
{
QLOG_ERROR
()
<<
"FILE didn't exist!"
;
return
;
}
int
sizeFileHeader
=
sizeof
(
BITMAPFILEHEADER
);
int
sizeInfoHeader
=
sizeof
(
BITMAPINFOHEADER
);
BITMAPFILEHEADER
*
bitmapFileHeader
=
new
BITMAPFILEHEADER
[
sizeFileHeader
+
1
];
BITMAPINFOHEADER
*
bitmapInfoHeader
=
new
BITMAPINFOHEADER
[
sizeInfoHeader
+
1
];
memset
(
bitmapFileHeader
,
0
,
sizeFileHeader
+
1
);
memset
(
bitmapInfoHeader
,
0
,
sizeInfoHeader
+
1
);
fread
(
bitmapFileHeader
,
sizeof
(
char
),
sizeFileHeader
,
stream
);
fseek
(
stream
,
sizeFileHeader
,
0
);
fread
(
bitmapInfoHeader
,
sizeof
(
char
),
sizeInfoHeader
,
stream
);
fseek
(
stream
,
sizeInfoHeader
+
sizeFileHeader
,
0
);
RGBQUAD
*
pRgbQuards
=
new
RGBQUAD
[
256
];
for
(
int
k
=
0
;
k
<
256
;
k
++
)
{
fread
(
&
pRgbQuards
[
k
],
sizeof
(
RGBQUAD
),
1
,
stream
);
}
int
count
=
(((
bitmapInfoHeader
->
biWidth
)
*
8
+
31
)
/
32
)
*
4
-
bitmapInfoHeader
->
biWidth
*
(
bitmapInfoHeader
->
biBitCount
/
8
);
BYTE
*
tempData
=
new
BYTE
[
count
+
1
];
memset
(
tempData
,
0
,
count
+
1
);
fseek
(
stream
,
sizeFileHeader
+
sizeInfoHeader
+
256
*
sizeof
(
RGBQUAD
),
0
);
BYTE
**
data
=
new
BYTE
*
[
bitmapInfoHeader
->
biHeight
];
for
(
int
i
=
0
;
i
<
bitmapInfoHeader
->
biHeight
;
i
++
)
{
data
[
i
]
=
new
BYTE
[
bitmapInfoHeader
->
biWidth
];
for
(
int
j
=
0
;
j
<
bitmapInfoHeader
->
biWidth
;
j
++
)
{
fread
(
&
data
[
i
][
j
],
sizeof
(
char
),
1
,
stream
);
if
(
data
[
i
][
j
]
>
threshold
)
data
[
i
][
j
]
=
255
;
else
data
[
i
][
j
]
=
0
;
}
for
(
int
n
=
0
;
n
<
count
;
n
++
)
{
fread
(
&
tempData
[
n
],
sizeof
(
char
),
1
,
stream
);
}
}
fclose
(
stream
);
//写入。。
FILE
*
fileWrite
=
fopen
(
"D:
\\
9.bmp"
,
"a+"
);
fwrite
(
bitmapFileHeader
,
sizeof
(
char
),
sizeof
(
BITMAPFILEHEADER
),
fileWrite
);
fwrite
(
bitmapInfoHeader
,
sizeof
(
char
),
sizeof
(
BITMAPINFOHEADER
),
fileWrite
);
fwrite
(
pRgbQuards
,
sizeof
(
RGBQUAD
),
256
,
fileWrite
);
for
(
int
i
=
0
;
i
<
bitmapInfoHeader
->
biHeight
;
i
++
)
{
for
(
int
j
=
0
;
j
<
bitmapInfoHeader
->
biWidth
;
j
++
)
{
fwrite
(
&
data
[
i
][
j
],
sizeof
(
BYTE
),
1
,
fileWrite
);
}
for
(
int
m
=
0
;
m
<
count
;
m
++
)
fwrite
(
&
tempData
[
m
],
sizeof
(
char
),
1
,
fileWrite
);
}
fclose
(
fileWrite
);
}
takeout/control/prtmodelgetwork.h
View file @
4c7cb82d
...
...
@@ -42,8 +42,14 @@ private:
bool
logoImageLocalize
();
bool
qrCodeImageLocalize
();
bool
downloadImage
(
QString
url
,
QString
fileName
);
bool
praseXmlPrtModel
(
QString
str
);
void
img_rgb2gray
();
private
:
QVariantMap
_storeinfo
;
...
...
@@ -70,7 +76,7 @@ private:
switch
(
REQ
)
{
case
ADVANCEORDER
:
action
=
QString
(
"saas.
printFile
.query"
);
action
=
QString
(
"saas.
ticketSet
.query"
);
return
true
;
default
:
return
false
;
...
...
@@ -79,7 +85,7 @@ private:
switch
(
REQ
)
{
case
ADVANCEORDER
:
action
=
QString
(
"saas.ticketSet.query"
);
action
=
QString
(
"
qa
saas.ticketSet.query"
);
return
true
;
default
:
return
false
;
...
...
takeout/preDefine.h
View file @
4c7cb82d
...
...
@@ -260,6 +260,12 @@
#define OPERATIONNAME_AGREE "同意"
#define OPERATIONNAME_REFUNDNEWORDER "拒绝接单"
//订单类型汉化
#define ORDER_TYPE_TIMELYTAKEOUT "小程序外卖"
#define ORDER_TYPE_TIMELYINVITE "小程序自提"
#define ORDER_TYPE_APPOINTMENTTAKEOUT "小程序预约"
#define REJECTUITYPE_REFUSEREFUND 0
#define REJECTUITYPE_AGREEREFUND 1
#define REJECTUITYPE_REFUSEORDER 2
...
...
@@ -316,12 +322,15 @@
#define FILE_BACKPRINT_TEMPLET "backtemplet.txt"
#define FILE_BACKPRINT80_TEMPLET "backtemplet80.txt"
#define XML_TAKEOUT56_TEMPLATE "prtinfo/1.xml"
#define XML_INTAKE56_TEMPLATE "prtinfo/2.xml"
#define XML_LABEL_TEMPLATE "prtinfo/3.xml"
#define XML_BACK_TEMPLATE "prtinfo/4.xml"
#define XML_TAKEOUT80_TEMPLATE "prtinfo/5.xml"
#define XML_INTAKE80_TEMPLATE "prtinfo/6.xml"
#define XML_TAKEOUT56_TEMPLATE "prtinfo/1.xml" //外卖小票56
#define XML_INTAKE56_TEMPLATE "prtinfo/2.xml" //到店取餐56
#define XML_LABEL_TEMPLATE "prtinfo/3.xml" //杯贴
#define XML_BACK_TEMPLATE "prtinfo/4.xml" //厨打56
#define XML_TAKEOUT80_TEMPLATE "prtinfo/1.xml" //外卖小票80
#define XML_INTAKE80_TEMPLATE "prtinfo/2.xml" //到店取餐80
#define XML_YYINTAKE56_TEMPLATE "prtinfo/7.xml" //预约到店56
#define XML_YYINTAKE80_TEMPLATE "prtinfo/8.xml" //预约到店80
#define XML_BACK80_TEMPLATE "prtinfo/9.xml" //厨打80
#define DEFAULT_PRINTF_MAIN_SESSION "Printer"
...
...
takeout/takeout.pro
View file @
4c7cb82d
...
...
@@ -4,7 +4,7 @@
#
#-------------------------------------------------
QT
+=
core
gui
network
multimedia
sql
printsupport
QT
+=
core
gui
network
multimedia
sql
printsupport
xml
greaterThan
(
QT_MAJOR_VERSION
,
4
)
:
QT
+=
widgets
...
...
@@ -21,7 +21,7 @@ LIBS += -L$$PWD/lib -llibeay32 -lssleay32 -lwinspool
LIBS
+=
-
lWs2_32
LIBS
+=
-
lDbghelp
DEFINES
+=
USE_QAACTION
#
DEFINES += USE_QAACTION
DEFINES
+=
FM_NEW_UI
#DEFINES += FM_TEST
...
...
takeout/view/newmainform.cpp
View file @
4c7cb82d
...
...
@@ -1660,6 +1660,13 @@ void NewMainForm::on_newmainbtn_prttest_clicked()
prod3
->
product_amount
=
1
;
prod3
->
property_tags
=
QString
::
fromUtf8
(
"
\xE5\x8A\xA0\xE5\x8D\xA4\xE8\x9B\x8B
"
);
QJsonObject
json
;
json
.
insert
(
"order_id"
,
"888888"
);
json
.
insert
(
"code"
,
"12"
);
json
.
insert
(
"customer"
,
QString
::
fromUtf8
(
"
\xE6\x96\xB9\xE4\xBE\xBF\xE9\x9D\xA2
"
));
order
.
_orderObject
=
json
;
order
.
proList
.
append
(
prod3
);
QStringList
list
;
...
...
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