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
......@@ -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{
......
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