Commit 9a475fd4 authored by UIUANG\Zsc's avatar UIUANG\Zsc

打印的bug

parent 2d054348
......@@ -224,7 +224,7 @@ class HttpRequestManger {
}
}
}
delay(480000L)
delay(10000L)
return uploadLog(posCode)
} else {
throw AppException(commandByPosCode.code, commandByPosCode.message)
......
......@@ -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
......@@ -153,7 +155,7 @@ object PrintUtils {
val name = if (discountMoney > 0.0 && isPromotion) {
"${index + 1} *${product.name}*"
}else{
} else {
"${index + 1} ${product.name}"
}
height += printerManager.drawTextEx(
......@@ -559,14 +561,18 @@ object PrintUtils {
var discountTime = 0.0 //分时
var discountSpecial = 0.0 //特价
var discountMoney = 0.0 //满减
val list: List<OrderActivityResponse> =
GsonUtils.fromJson(
var list: List<OrderActivityResponse>? =null
if (posBuy.activitys != null && posBuy.activitys != "") {
list =
Gson().fromJson(
posBuy.activitys,
object : TypeToken<List<OrderActivityResponse>>() {}.type
)
list.forEach { item ->
list?.forEach { item ->
item.toJson().dXLog()
discountMoney += item.discountMoney
}
}
// for ((index, product) in orderResponse.products.withIndex()) {
// if (product.activitys != null) {
......@@ -580,16 +586,22 @@ object PrintUtils {
// }
// }
// }
//
if (!posBuyParts.isNullOrEmpty()) {
for ((index, product) in posBuyParts.withIndex()) {
var discountMoney = 0.0
var isPromotion = false
if (product.activitys!=null&&product.activitys != "") {
// XLog.d(product.activitys)
val activityInfoDTO: List<ActivityInfoDTO> =
GsonUtils.fromJson(
Gson().fromJson(
product.activitys,
object : TypeToken<List<ActivityInfoDTO>>() {}.type
)
var discountMoney =0.0
activityInfoDTO.forEach { item ->
item.toJson().dXLog()
discountMoney = product.price - item.activityPrice
if (item.activityType == ProductActivityType.TIMESHARE_ACTIVITY.name) {
discountTime += discountMoney
......@@ -599,8 +611,8 @@ object PrintUtils {
}
}
}
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{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment