Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
NewParkAPP
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YONG-LIN SU
NewParkAPP
Commits
91f34e7e
Commit
91f34e7e
authored
Jan 09, 2024
by
陳煦元
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1130109調整列印位置
parent
6b1dd5e3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
28 deletions
+49
-28
compiler.xml
.idea/compiler.xml
+1
-1
gradle.xml
.idea/gradle.xml
+1
-1
misc.xml
.idea/misc.xml
+1
-2
vcs.xml
.idea/vcs.xml
+1
-1
CarPrinter_LKP34L.java
...va/ecom/android/newparkapp/printer/CarPrinter_LKP34L.java
+45
-23
No files found.
.idea/compiler.xml
View file @
91f34e7e
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"CompilerConfiguration"
>
<bytecodeTargetLevel
target=
"1
1
"
/>
<bytecodeTargetLevel
target=
"1
7
"
/>
</component>
</project>
\ No newline at end of file
.idea/gradle.xml
View file @
91f34e7e
...
...
@@ -7,7 +7,7 @@
<option
name=
"testRunner"
value=
"GRADLE"
/>
<option
name=
"distributionType"
value=
"DEFAULT_WRAPPED"
/>
<option
name=
"externalProjectPath"
value=
"$PROJECT_DIR$"
/>
<option
name=
"gradleJvm"
value=
"
11
"
/>
<option
name=
"gradleJvm"
value=
"
jbr-17
"
/>
<option
name=
"modules"
>
<set>
<option
value=
"$PROJECT_DIR$"
/>
...
...
.idea/misc.xml
View file @
91f34e7e
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"DesignSurface"
>
<option
name=
"filePathToZoomLevelMap"
>
...
...
@@ -71,7 +70,7 @@
</map>
</option>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1
1"
default=
"true"
project-jdk-name=
"11
"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1
7"
default=
"true"
project-jdk-name=
"jbr-17
"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
<component
name=
"ProjectType"
>
...
...
.idea/vcs.xml
View file @
91f34e7e
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"
$PROJECT_DIR$
"
vcs=
"Git"
/>
<mapping
directory=
""
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
app/src/main/java/ecom/android/newparkapp/printer/CarPrinter_LKP34L.java
View file @
91f34e7e
...
...
@@ -42,9 +42,10 @@ public class CarPrinter_LKP34L{
// 嘉義路邊停車列印測試
// 紙張 黑色標記底部 至 黑色標記頂部 距離為 14.6 cm,減去 1.5 mm 為 印表機最大高度 14.45 cm
// 紙張 寬為 5.6 cm
// LK-P34L dpi 為 203,最大高度為 1155 px,最大寬度為 448px
int
nLineWidth
=
448
;
cpclPrinter
.
setForm
(
102
,
203
,
203
,
1155
,
nLineWidth
,
1
);
// LK-P34L dpi 為 203,最大高度為 1155 px,最大寬度為 448px
// LK-P12 dpi 為 203,最大高度為 1155 px,最大寬度為 448px
int
nLineWidth
=
448
;
//int nLineWidth = 448;
cpclPrinter
.
setForm
(
0
,
203
,
203
,
1155
,
nLineWidth
,
1
);
//cpclPrinter.setForm(102, 203, 203, 1155, nLineWidth,1);
int
paper_type
=
1
;
// 0 -> Gas Paper, 1 -> Black Mark Paper, 2 -> Continuous Paper
cpclPrinter
.
setMedia
(
paper_type
);
...
...
@@ -61,23 +62,24 @@ public class CarPrinter_LKP34L{
// 列印 車號
String
plateNumber
=
carCase
.
plateNumber
;
cpclPrinter
.
printAndroidFont
(
110
,
1
0
0
,
Typeface
.
SANS_SERIF
,
plateNumber
,
nLineWidth
,
35
);
cpclPrinter
.
printAndroidFont
(
110
,
1
1
0
,
Typeface
.
SANS_SERIF
,
plateNumber
,
nLineWidth
,
35
);
// 列印 車格編號
String
spaceWithRoad
=
carCase
.
space
.
id
+
" "
+
carCase
.
space
.
road
.
name
;
cpclPrinter
.
printAndroidFont
(
110
,
1
5
0
,
Typeface
.
SANS_SERIF
,
spaceWithRoad
,
nLineWidth
,
35
);
cpclPrinter
.
printAndroidFont
(
110
,
1
6
0
,
Typeface
.
SANS_SERIF
,
spaceWithRoad
,
nLineWidth
,
35
);
// 列印 停車日期
Calendar
parkingDateCalendar
=
Calendar
.
getInstance
();
parkingDateCalendar
.
setTime
(
carCase
.
caseTime
);
String
rocParkingDate
=
Common
.
getDate
(
parkingDateCalendar
,
true
);
String
parkingDate
=
rocParkingDate
.
substring
(
0
,
3
)
+
"年"
+
rocParkingDate
.
substring
(
3
,
5
)
+
"月"
+
rocParkingDate
.
substring
(
5
,
7
)
+
"日"
;
cpclPrinter
.
printAndroidFont
(
110
,
2
0
0
,
Typeface
.
SANS_SERIF
,
parkingDate
,
nLineWidth
,
35
);
cpclPrinter
.
printAndroidFont
(
110
,
2
1
0
,
Typeface
.
SANS_SERIF
,
parkingDate
,
nLineWidth
,
35
);
// 列印 billNumber2 Code 39
String
billNumber2
=
carCase
.
billingNumber2
;
cpclPrinter
.
setCPCLBarcode
(
7
,
0
,
0
);
cpclPrinter
.
printCPCLBarcode
(
CPCLConst
.
LK_CPCL_0_ROTATION
,
CPCLConst
.
LK_CPCL_BCS_39
,
1
,
CPCLConst
.
LK_CPCL_BCS_1RATIO
,
70
,
0
,
260
,
billNumber2
,
0
);
//cpclPrinter.printCPCLBarcode(CPCLConst.LK_CPCL_0_ROTATION, CPCLConst.LK_CPCL_BCS_39,1,CPCLConst.LK_CPCL_BCS_1RATIO, 70, 0, 270, billNumber2, 0);
cpclPrinter
.
printCPCLBarcode
(
CPCLConst
.
LK_CPCL_0_ROTATION
,
CPCLConst
.
LK_CPCL_BCS_39
,
1
,
CPCLConst
.
LK_CPCL_BCS_1RATIO
,
70
,
0
,
270
,
billNumber2
,
0
);
//
// 列印 繳費期限
Calendar
terminateDateCalendar
=
Calendar
.
getInstance
();
...
...
@@ -86,9 +88,9 @@ public class CarPrinter_LKP34L{
String
terminateYear
=
rocTerminateDate
.
substring
(
0
,
3
);
String
terminateMonth
=
rocTerminateDate
.
substring
(
3
,
5
);
String
terminateDay
=
rocTerminateDate
.
substring
(
5
,
7
);
cpclPrinter
.
printAndroidFont
(
103
,
380
,
Typeface
.
SANS_SERIF
,
terminateYear
,
nLineWidth
,
25
);
cpclPrinter
.
printAndroidFont
(
203
,
3
80
,
Typeface
.
SANS_SERIF
,
terminateMonth
,
nLineWidth
,
25
);
cpclPrinter
.
printAndroidFont
(
303
,
3
80
,
Typeface
.
SANS_SERIF
,
terminateDay
,
nLineWidth
,
25
);
cpclPrinter
.
printAndroidFont
(
103
,
3
90
,
Typeface
.
SANS_SERIF
,
terminateYear
,
nLineWidth
,
25
);
//cpclPrinter.printAndroidFont(103, 3
80, Typeface.SANS_SERIF, terminateYear, nLineWidth, 25);
cpclPrinter
.
printAndroidFont
(
203
,
3
90
,
Typeface
.
SANS_SERIF
,
terminateMonth
,
nLineWidth
,
25
);
// cpclPrinter.printAndroidFont(203, 380, Typeface.SANS_SERIF, terminateYear
, nLineWidth, 25);
cpclPrinter
.
printAndroidFont
(
303
,
3
90
,
Typeface
.
SANS_SERIF
,
terminateDay
,
nLineWidth
,
25
);
// cpclPrinter.printAndroidFont(303, 380, Typeface.SANS_SERIF, terminateYear
, nLineWidth, 25);
// 列印 停車時間
Calendar
nowCalendar
=
(
Calendar
)
parkingDateCalendar
.
clone
();
...
...
@@ -96,15 +98,17 @@ public class CarPrinter_LKP34L{
boolean
b60Min
=
false
;
String
parkingTime
,
parkingFee
,
userName
;
int
printYMovement
=
50
;
int
printY
=
480
;
int
printYMovement
=
50
;
// int printYMovement = 50;
int
printY
=
4
90
;
// int printY = 4
80;
// 開單累積最多 4 次
for
(
int
i
=
0
;
i
<
4
;
i
++){
// TODO: 2022/8/18 超過上班時間,則停止列印
if
(
i
==
0
){
// 停車時間
parkingTime
=
nHour
+
":"
+
nowCalendar
.
get
(
Calendar
.
MINUTE
);
String
m
=
String
.
format
(
"%02d"
,
nowCalendar
.
get
(
Calendar
.
MINUTE
));
String
H
=
String
.
format
(
"%02d"
,
nHour
);
parkingTime
=
H
+
":"
+
m
;
// 停車費
parkingFee
=
String
.
valueOf
(
carCase
.
getPricing
());
...
...
@@ -114,8 +118,10 @@ public class CarPrinter_LKP34L{
printY
+=
printYMovement
;
// 停車時間
parkingTime
=
(
nHour
+
(
b60Min
?
1
:
0
)
)+
":"
+
(
b60Min
?
0
:
(
nowCalendar
.
get
(
Calendar
.
MINUTE
)
+
1
)
);
String
m
=
String
.
format
(
"%02d"
,
b60Min
?
0
:
(
nowCalendar
.
get
(
Calendar
.
MINUTE
)
+
1
));
String
H
=
String
.
format
(
"%02d"
,
nHour
+
(
b60Min
?
1
:
0
));
//parkingTime = ( nHour + (b60Min ? 1 : 0) )+ ":" + ( b60Min ? 0 : (nowCalendar.get(Calendar.MINUTE) + 1) );
parkingTime
=
H
+
":"
+
m
;
// 停車費
parkingFee
=
""
;
...
...
@@ -131,16 +137,21 @@ public class CarPrinter_LKP34L{
{
// TODO: 2022/8/18 身心障礙 (府-2) 優惠處理
if
(
i
==
0
){
String
m
=
String
.
format
(
"%02d"
,
nowCalendar
.
get
(
Calendar
.
MINUTE
));
String
H
=
String
.
format
(
"%02d"
,
nHour
);
// 停車時間
parkingTime
=
nHour
+
":"
+
nowCalendar
.
get
(
Calendar
.
MINUTE
)
;
parkingTime
=
H
+
":"
+
m
;
//parkingTime = nHour+ ":" + nowCalendar.get(Calendar.MINUTE);
// 停車費
parkingFee
=
String
.
valueOf
(
carCase
.
getPricing
());
// 使用者名稱
userName
=
carCase
.
user
.
name
;
}
else
if
(
i
==
1
){
// 停車時間
parkingTime
=
(
nHour
+
(
b60Min
?
1
:
0
)
)+
":"
+
(
b60Min
?
0
:
(
nowCalendar
.
get
(
Calendar
.
MINUTE
)
+
1
)
);
String
m
=
String
.
format
(
"%02d"
,
b60Min
?
0
:
(
nowCalendar
.
get
(
Calendar
.
MINUTE
)
+
1
));
String
H
=
String
.
format
(
"%02d"
,
nHour
+
(
b60Min
?
1
:
0
));
parkingTime
=
H
+
":"
+
m
;
//parkingTime = ( nHour + (b60Min ? 1 : 0) )+ ":" + ( b60Min ? 0 : (nowCalendar.get(Calendar.MINUTE) + 1) );
// 停車費
parkingFee
=
String
.
valueOf
(
carCase
.
getPricing
());
...
...
@@ -149,7 +160,10 @@ public class CarPrinter_LKP34L{
userName
=
"________"
;
}
else
{
// 停車時間
parkingTime
=
(
nHour
+
(
b60Min
?
1
:
0
)
)+
":"
+
(
b60Min
?
0
:
(
nowCalendar
.
get
(
Calendar
.
MINUTE
)
+
1
)
);
String
m
=
String
.
format
(
"%02d"
,
b60Min
?
0
:
(
nowCalendar
.
get
(
Calendar
.
MINUTE
)
+
1
));
String
H
=
String
.
format
(
"%02d"
,
nHour
+
(
b60Min
?
1
:
0
));
parkingTime
=
H
+
":"
+
m
;
//parkingTime = ( nHour + (b60Min ? 1 : 0) )+ ":" + ( b60Min ? 0 : (nowCalendar.get(Calendar.MINUTE) + 1) );
// 停車費
parkingFee
=
""
;
...
...
@@ -163,15 +177,21 @@ public class CarPrinter_LKP34L{
// TODO: 2022/8/18 身心障礙(社-4) 優惠處理
if
(
i
==
0
){
// 停車時間
parkingTime
=
nHour
+
":"
+
nowCalendar
.
get
(
Calendar
.
MINUTE
);
String
m
=
String
.
format
(
"%02d"
,
nowCalendar
.
get
(
Calendar
.
MINUTE
));
String
H
=
String
.
format
(
"%02d"
,
nHour
);
// 停車時間
parkingTime
=
H
+
":"
+
m
;
//parkingTime = nHour+ ":" + nowCalendar.get(Calendar.MINUTE);
// 停車費
parkingFee
=
String
.
valueOf
(
carCase
.
getPricing
());
// 使用者名稱
userName
=
carCase
.
user
.
name
;
}
else
{
// 停車時間
parkingTime
=
(
nHour
+
(
b60Min
?
1
:
0
)
)+
":"
+
(
b60Min
?
0
:
(
nowCalendar
.
get
(
Calendar
.
MINUTE
)
+
1
)
);
String
m
=
String
.
format
(
"%02d"
,
b60Min
?
0
:
(
nowCalendar
.
get
(
Calendar
.
MINUTE
)
+
1
));
String
H
=
String
.
format
(
"%02d"
,
nHour
+
(
b60Min
?
1
:
0
));
parkingTime
=
H
+
":"
+
m
;
//parkingTime = ( nHour + (b60Min ? 1 : 0) )+ ":" + ( b60Min ? 0 : (nowCalendar.get(Calendar.MINUTE) + 1) );
// 停車費
parkingFee
=
String
.
valueOf
(
carCase
.
getPricing
());
...
...
@@ -185,23 +205,25 @@ public class CarPrinter_LKP34L{
// 列印繳費金額
if
(!
parkingFee
.
trim
().
isEmpty
()){
//cpclPrinter.printAndroidFont(-10, printY, Typeface.SANS_SERIF, parkingFee, nLineWidth, 30);
cpclPrinter
.
printAndroidFont
(
130
,
printY
,
Typeface
.
SANS_SERIF
,
parkingFee
,
nLineWidth
,
30
);
}
// 列印停車時間
if
(!
parkingTime
.
trim
().
isEmpty
()){
// cpclPrinter.printAndroidFont(-125, printY, Typeface.SANS_SERIF, parkingTime, nLineWidth, 30);
cpclPrinter
.
printAndroidFont
(
15
,
printY
,
Typeface
.
SANS_SERIF
,
parkingTime
,
nLineWidth
,
30
);
}
// 列印簽章 或 底線
if
(!
userName
.
trim
().
isEmpty
()){
// cpclPrinter.printAndroidFont(100, printY, Typeface.SANS_SERIF, userName, nLineWidth, 30);
cpclPrinter
.
printAndroidFont
(
240
,
printY
,
Typeface
.
SANS_SERIF
,
userName
,
nLineWidth
,
30
);
}
// 累加下一圈
nowCalendar
.
add
(
Calendar
.
MINUTE
,
carCase
.
space
.
getAddMinutes
());
nHour
=
nowCalendar
.
get
(
Calendar
.
HOUR_OF_DAY
);
b60Min
=
nowCalendar
.
get
(
Calendar
.
MINUTE
)
==
59
;
}
...
...
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