Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Y
YPPos
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
朱世闯
YPPos
Commits
9a475fd4
Commit
9a475fd4
authored
Sep 23, 2021
by
UIUANG\Zsc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
打印的bug
parent
2d054348
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
28 deletions
+42
-28
HttpRequestManger.kt
...m/ypsx/yppos/http/repository/request/HttpRequestManger.kt
+1
-1
PrintUtils.kt
app/src/main/java/com/ypsx/yppos/utils/PrintUtils.kt
+41
-27
No files found.
app/src/main/java/com/ypsx/yppos/http/repository/request/HttpRequestManger.kt
View file @
9a475fd4
...
...
@@ -224,7 +224,7 @@ class HttpRequestManger {
}
}
}
delay
(
48
0000L
)
delay
(
1
0000L
)
return
uploadLog
(
posCode
)
}
else
{
throw
AppException
(
commandByPosCode
.
code
,
commandByPosCode
.
message
)
...
...
app/src/main/java/com/ypsx/yppos/utils/PrintUtils.kt
View file @
9a475fd4
...
...
@@ -3,8 +3,10 @@ package com.ypsx.yppos.utils
import
android.device.PrinterManager
import
com.blankj.utilcode.util.GsonUtils
import
com.blankj.utilcode.util.Utils.runOnUiThread
import
com.elvishew.xlog.XLog
import
com.google.gson.Gson
import
com.google.gson.reflect.TypeToken
import
com.ypsx.base.ext.util.toJson
import
com.ypsx.yppos.http.data.bean.ActivityInfoDTO
import
com.ypsx.yppos.http.data.bean.OrderActivityResponse
import
com.ypsx.yppos.http.data.bean.OrderDetailsResponse
...
...
@@ -151,10 +153,10 @@ object PrintUtils {
}
}
val
name
=
if
(
discountMoney
>
0.0
&&
isPromotion
)
{
"${index + 1} *${product.name}*"
}
else
{
"${index + 1} ${product.name}"
val
name
=
if
(
discountMoney
>
0.0
&&
isPromotion
)
{
"${index + 1} *${product.name}*"
}
else
{
"${index + 1} ${product.name}"
}
height
+=
printerManager
.
drawTextEx
(
name
,
...
...
@@ -559,13 +561,17 @@ object PrintUtils {
var
discountTime
=
0.0
//分时
var
discountSpecial
=
0.0
//特价
var
discountMoney
=
0.0
//满减
val
list
:
List
<
OrderActivityResponse
>
=
GsonUtils
.
fromJson
(
posBuy
.
activitys
,
object
:
TypeToken
<
List
<
OrderActivityResponse
>>()
{}.
type
)
list
.
forEach
{
item
->
discountMoney
+=
item
.
discountMoney
var
list
:
List
<
OrderActivityResponse
>?
=
null
if
(
posBuy
.
activitys
!=
null
&&
posBuy
.
activitys
!=
""
)
{
list
=
Gson
().
fromJson
(
posBuy
.
activitys
,
object
:
TypeToken
<
List
<
OrderActivityResponse
>>()
{}.
type
)
list
?.
forEach
{
item
->
item
.
toJson
().
dXLog
()
discountMoney
+=
item
.
discountMoney
}
}
// for ((index, product) in orderResponse.products.withIndex()) {
...
...
@@ -580,27 +586,33 @@ object PrintUtils {
// }
// }
// }
//
if
(!
posBuyParts
.
isNullOrEmpty
())
{
for
((
index
,
product
)
in
posBuyParts
.
withIndex
())
{
val
activityInfoDTO
:
List
<
ActivityInfoDTO
>
=
GsonUtils
.
fromJson
(
product
.
activitys
,
object
:
TypeToken
<
List
<
ActivityInfoDTO
>>()
{}.
type
)
var
discountMoney
=
0.0
activityInfoDTO
.
forEach
{
item
->
discountMoney
=
product
.
price
-
item
.
activityPrice
if
(
item
.
activityType
==
ProductActivityType
.
TIMESHARE_ACTIVITY
.
name
)
{
discountTime
+=
discountMoney
}
else
{
if
(
discountMoney
>
0.0
)
{
discountSpecial
+=
discountMoney
var
discountMoney
=
0.0
var
isPromotion
=
false
if
(
product
.
activitys
!=
null
&&
product
.
activitys
!=
""
)
{
// XLog.d(product.activitys)
val
activityInfoDTO
:
List
<
ActivityInfoDTO
>
=
Gson
().
fromJson
(
product
.
activitys
,
object
:
TypeToken
<
List
<
ActivityInfoDTO
>>()
{}.
type
)
activityInfoDTO
.
forEach
{
item
->
item
.
toJson
().
dXLog
()
discountMoney
=
product
.
price
-
item
.
activityPrice
if
(
item
.
activityType
==
ProductActivityType
.
TIMESHARE_ACTIVITY
.
name
)
{
discountTime
+=
discountMoney
}
else
{
if
(
discountMoney
>
0.0
)
{
discountSpecial
+=
discountMoney
}
}
}
}
var
isPromotion
=
false
list
.
forEach
{
item
->
list
?.
forEach
{
item
->
for
(
productPromotionDetailDTO
in
item
.
productIds
)
{
if
(
productPromotionDetailDTO
.
productId
==
product
.
productId
)
{
isPromotion
=
true
...
...
@@ -609,6 +621,8 @@ object PrintUtils {
}
}
//
val
name
=
if
(
discountMoney
>
0.0
&&
isPromotion
)
{
"${index + 1} *${product.name}*"
}
else
{
...
...
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