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
610a61ca
Commit
610a61ca
authored
Aug 23, 2022
by
YONG-LIN SU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加部分說明
新增YH-TP250兼容性
parent
ca126615
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
136 additions
and
2 deletions
+136
-2
deploymentTargetDropDown.xml
.idea/deploymentTargetDropDown.xml
+1
-1
CarPrinter_TPB250.java
...va/ecom/android/newparkapp/printer/CarPrinter_TPB250.java
+112
-0
BlueToothPortViewModel.java
.../android/newparkapp/viewModel/BlueToothPortViewModel.java
+23
-1
新APP-巡場模式.png
相關文件/技術文件相關圖片/新APP-巡場模式.png
+0
-0
新APP-開啟自動導航.png
相關文件/技術文件相關圖片/新APP-開啟自動導航.png
+0
-0
新APP-附近續單提醒.png
相關文件/技術文件相關圖片/新APP-附近續單提醒.png
+0
-0
新嘉義開單APP-內部技術文件.docx
相關文件/新嘉義開單APP-內部技術文件.docx
+0
-0
No files found.
.idea/deploymentTargetDropDown.xml
View file @
610a61ca
...
...
@@ -12,6 +12,6 @@
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown
value=
"2022-08-23T0
6:16:20.971608
400Z"
/>
<timeTargetWasSelectedWithDropDown
value=
"2022-08-23T0
8:32:55.773946
400Z"
/>
</component>
</project>
\ No newline at end of file
app/src/main/java/ecom/android/newparkapp/printer/CarPrinter_TPB250.java
View file @
610a61ca
...
...
@@ -10,6 +10,8 @@ import static ecom.android.newparkapp.printer.IBluetoothPrinter.ResultCode.PRINT
import
android.bluetooth.BluetoothSocket
;
import
com.sewoo.port.android.BluetoothPort
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.Calendar
;
...
...
@@ -132,4 +134,114 @@ public class CarPrinter_TPB250 implements IBluetoothPrinter {
InitPrinter
(
outPutBT
);
return
PRINT_SUCCESS
;
}
// 透過新的sdk列印
public
ResultCode
print
(
BluetoothPort
bluetoothPort
,
Case
thisCase
)
throws
IOException
{
OutputStream
outPutBT
=
bluetoothPort
.
getOutputStream
();
boolean
b60Min
=
false
;
Calendar
nowCalendar
;
Case
carCase
=
thisCase
;
if
(
outPutBT
==
null
||
!
bluetoothPort
.
isConnected
())
{
return
NOT_CONNECT
;
}
InitPrinter
(
outPutBT
);
PrintChangeLine
(
outPutBT
,
1
,
76
);
if
(!
carCase
.
autoPay
)
{
//第一段條碼//
PrintBarCode
(
outPutBT
,
carCase
.
billingNumber1
,
false
);
}
else
{
PrintString
(
outPutBT
,
"※本車已約定金融、電信帳戶代繳,請勿重複繳費、並維持正常扣繳;如扣繳失敗請依背面說明補單繳款。"
,
32
,
false
);
//PrintChangeLine(outPutBT, 1, 24);
}
PrintChangeLine
(
outPutBT
,
1
,
24
);
//-------------------------------------------
//車牌
PrintString
(
outPutBT
,
" "
+
carCase
.
plateNumber
,
52
,
true
);
//-------------------------------------------
//路段、格號
PrintString
(
outPutBT
,
" "
+
carCase
.
space
.
id
+
" "
+
carCase
.
space
.
road
.
name
,
52
,
true
);
//-------------------------------------------
//日期
PrintString
(
outPutBT
,
" "
+
String
.
format
(
"%s年%s月%s日"
,
Common
.
getDate
(
carCase
.
getCaseCalendar
(),
true
).
substring
(
0
,
3
),
Common
.
getDate
(
carCase
.
getCaseCalendar
(),
true
).
substring
(
3
,
5
),
Common
.
getDate
(
carCase
.
getCaseCalendar
(),
true
).
substring
(
5
,
7
)),
40
,
true
);
//-------------------------------------------
//單號2
PrintBarCode
(
outPutBT
,
carCase
.
billingNumber2
,
false
);
PrintChangeLine
(
outPutBT
,
1
,
34
);
//-------------------------------------------
//繳費期限
PrintString
(
outPutBT
,
" "
+
String
.
format
(
"%s %s %s"
,
Common
.
getDate
(
carCase
.
getTermCalendar
(),
true
).
substring
(
0
,
3
),
Common
.
getDate
(
carCase
.
getTermCalendar
(),
true
).
substring
(
3
,
5
),
Common
.
getDate
(
carCase
.
getTermCalendar
(),
true
).
substring
(
5
,
7
)),
90
,
false
);
//-------------------------------------------
nowCalendar
=
(
Calendar
)
carCase
.
getCaseCalendar
().
clone
();
int
nHour
=
carCase
.
getCaseCalendar
().
get
(
Calendar
.
HOUR_OF_DAY
);
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
//開單累加最多累積4次
if
(!
carCase
.
isWorkTime
(
nowCalendar
))
{
//若第i行時間已超過該班次區間,則停止列印(PS.列印長度太短會導致黑點定位查找距離不夠到下一個黑點,利用換行增加)
for
(
int
j
=
0
;
j
<
4
-
i
;
j
++)
{
PrintString
(
outPutBT
,
""
,
52
,
false
);
}
break
;
}
String
szList
=
(
0
==
i
)
?
String
.
format
(
Locale
.
TAIWAN
,
" %02d:%02d %5d %s"
,
nHour
,
nowCalendar
.
get
(
Calendar
.
MINUTE
),
carCase
.
getPricing
(),
carCase
.
user
.
name
)
:
String
.
format
(
Locale
.
TAIWAN
,
" %02d:%02d %5s %s"
,
nHour
+
(
b60Min
?
1
:
0
),
b60Min
?
0
:
(
nowCalendar
.
get
(
Calendar
.
MINUTE
)
+
1
),
" "
,
"________"
);
if
(
carCase
.
space
.
spaceType
==
SpaceType
.
HANDICAPPED_SPACE
)
{
//身障車格
if
(
carCase
.
vehicleType
.
id
==
12
)
{
//身心障礙(府-2)
if
(
i
==
0
)
{
szList
=
String
.
format
(
Locale
.
TAIWAN
,
" %02d:%02d %5d %s"
,
nHour
,
nowCalendar
.
get
(
Calendar
.
MINUTE
),
carCase
.
getPricing
(),
carCase
.
user
.
name
);
}
else
if
(
i
==
1
)
{
szList
=
String
.
format
(
Locale
.
TAIWAN
,
" %02d:%02d %5s %s"
,
nHour
+
(
b60Min
?
1
:
0
),
b60Min
?
0
:
(
nowCalendar
.
get
(
Calendar
.
MINUTE
)
+
1
),
carCase
.
getPricing
(),
"________"
);
}
else
{
szList
=
String
.
format
(
Locale
.
TAIWAN
,
" %02d:%02d %5s %s"
,
nHour
+
(
b60Min
?
1
:
0
),
b60Min
?
0
:
(
nowCalendar
.
get
(
Calendar
.
MINUTE
)
+
1
),
" "
,
"________"
);
}
}
else
if
(
carCase
.
vehicleType
.
id
==
13
)
{
//身心障礙(社-4)
szList
=
(
0
==
i
)
?
String
.
format
(
Locale
.
TAIWAN
,
" %02d:%02d %5d %s"
,
nHour
,
nowCalendar
.
get
(
Calendar
.
MINUTE
),
carCase
.
getPricing
(),
carCase
.
user
.
name
)
:
String
.
format
(
Locale
.
TAIWAN
,
" %02d:%02d %5s %s"
,
nHour
+
(
b60Min
?
1
:
0
),
b60Min
?
0
:
(
nowCalendar
.
get
(
Calendar
.
MINUTE
)
+
1
),
carCase
.
getPricing
(),
"________"
);
}
}
nowCalendar
.
add
(
Calendar
.
MINUTE
,
carCase
.
space
.
getAddMinutes
());
nHour
=
nowCalendar
.
get
(
Calendar
.
HOUR_OF_DAY
);
b60Min
=
nowCalendar
.
get
(
Calendar
.
MINUTE
)
==
59
;
PrintString
(
outPutBT
,
szList
,
40
,
new
byte
[]{
0x1D
,
0x21
,
0x01
});
}
PrintChangeLine
(
outPutBT
,
1
,
120
);
//PrintString(outPutBT, "※如已有申請停車費自動扣款或行動支付服務,請勿持本單重複繳費。", 26, false);
PrintChangeLine
(
outPutBT
,
2
,
80
);
//減少黑點定位查找距離
//-------------------------------------------
ToBlackMark
(
outPutBT
);
InitPrinter
(
outPutBT
);
return
PRINT_SUCCESS
;
}
}
app/src/main/java/ecom/android/newparkapp/viewModel/BlueToothPortViewModel.java
View file @
610a61ca
...
...
@@ -32,6 +32,7 @@ import java.util.concurrent.Executors;
import
ecom.android.newparkapp.R
;
import
ecom.android.newparkapp.entity.Case
;
import
ecom.android.newparkapp.printer.CarPrinter_LKP34L
;
import
ecom.android.newparkapp.printer.CarPrinter_TPB250
;
import
ecom.android.newparkapp.printer.IBluetoothPrinter
;
import
ecom.android.newparkapp.printer.Sample_Print
;
...
...
@@ -53,7 +54,9 @@ public class BlueToothPortViewModel extends AndroidViewModel {
private
BluetoothPort
bluetoothPort
;
private
Thread
bluetoothRequestThread
;
private
CarPrinter_LKP34L
printer
=
new
CarPrinter_LKP34L
();
private
CarPrinter_TPB250
carPrinterTPB250
=
new
CarPrinter_TPB250
();
public
BlueToothPortViewModel
(
@NonNull
Application
application
)
{
super
(
application
);
...
...
@@ -103,6 +106,12 @@ public class BlueToothPortViewModel extends AndroidViewModel {
getPrinterPowerPercentFullTimerTask
=
new
TimerTask
()
{
@Override
public
void
run
()
{
if
(
getBluetoothDevice
().
getValue
()
==
null
){
return
;
}
if
(!
getBluetoothDevice
().
getValue
().
getName
().
equals
(
"SW_891D"
)){
return
;
}
updatePrinterPowerPercentFull
();
}
};
...
...
@@ -258,7 +267,20 @@ public class BlueToothPortViewModel extends AndroidViewModel {
blueToothStatusMutableLiveData
.
setValue
(
BlueToothViewModel
.
BlueToothStatus
.
PRINTING
);
executorService
.
execute
(()
->{
try
{
printer
.
print
(
bluetoothPort
,
tempCase
);
String
deviceName
=
getBluetoothDevice
().
getValue
().
getName
();
if
(
deviceName
!=
null
){
switch
(
deviceName
){
case
"YH-TPB250"
:
carPrinterTPB250
.
print
(
bluetoothPort
,
tempCase
);
break
;
case
"SW_891D"
:
printer
.
print
(
bluetoothPort
,
tempCase
);
break
;
default
:
break
;
}
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
...
...
相關文件/技術文件相關圖片/新APP-巡場模式.png
0 → 100644
View file @
610a61ca
138 KB
相關文件/技術文件相關圖片/新APP-開啟自動導航.png
0 → 100644
View file @
610a61ca
495 KB
相關文件/技術文件相關圖片/新APP-附近續單提醒.png
0 → 100644
View file @
610a61ca
83.2 KB
相關文件/新嘉義開單APP-內部技術文件.docx
View file @
610a61ca
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