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

打印的bug

parent 2d054348
...@@ -224,7 +224,7 @@ class HttpRequestManger { ...@@ -224,7 +224,7 @@ class HttpRequestManger {
} }
} }
} }
delay(480000L) delay(10000L)
return uploadLog(posCode) return uploadLog(posCode)
} else { } else {
throw AppException(commandByPosCode.code, commandByPosCode.message) throw AppException(commandByPosCode.code, commandByPosCode.message)
......
...@@ -3,8 +3,10 @@ package com.ypsx.yppos.utils ...@@ -3,8 +3,10 @@ package com.ypsx.yppos.utils
import android.device.PrinterManager import android.device.PrinterManager
import com.blankj.utilcode.util.GsonUtils import com.blankj.utilcode.util.GsonUtils
import com.blankj.utilcode.util.Utils.runOnUiThread import com.blankj.utilcode.util.Utils.runOnUiThread
import com.elvishew.xlog.XLog
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.reflect.TypeToken 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.ActivityInfoDTO
import com.ypsx.yppos.http.data.bean.OrderActivityResponse import com.ypsx.yppos.http.data.bean.OrderActivityResponse
import com.ypsx.yppos.http.data.bean.OrderDetailsResponse import com.ypsx.yppos.http.data.bean.OrderDetailsResponse
...@@ -151,10 +153,10 @@ object PrintUtils { ...@@ -151,10 +153,10 @@ object PrintUtils {
} }
} }
val name = if (discountMoney > 0.0 && isPromotion) { val name = if (discountMoney > 0.0 && isPromotion) {
"${index + 1} *${product.name}*" "${index + 1} *${product.name}*"
}else{ } else {
"${index + 1} ${product.name}" "${index + 1} ${product.name}"
} }
height += printerManager.drawTextEx( height += printerManager.drawTextEx(
name, name,
...@@ -559,13 +561,17 @@ object PrintUtils { ...@@ -559,13 +561,17 @@ object PrintUtils {
var discountTime = 0.0 //分时 var discountTime = 0.0 //分时
var discountSpecial = 0.0 //特价 var discountSpecial = 0.0 //特价
var discountMoney = 0.0 //满减 var discountMoney = 0.0 //满减
val list: List<OrderActivityResponse> = var list: List<OrderActivityResponse>? =null
GsonUtils.fromJson( if (posBuy.activitys != null && posBuy.activitys != "") {
posBuy.activitys, list =
object : TypeToken<List<OrderActivityResponse>>() {}.type Gson().fromJson(
) posBuy.activitys,
list.forEach { item -> object : TypeToken<List<OrderActivityResponse>>() {}.type
discountMoney += item.discountMoney )
list?.forEach { item ->
item.toJson().dXLog()
discountMoney += item.discountMoney
}
} }
// for ((index, product) in orderResponse.products.withIndex()) { // for ((index, product) in orderResponse.products.withIndex()) {
...@@ -580,27 +586,33 @@ object PrintUtils { ...@@ -580,27 +586,33 @@ object PrintUtils {
// } // }
// } // }
// } // }
//
if (!posBuyParts.isNullOrEmpty()) { if (!posBuyParts.isNullOrEmpty()) {
for ((index, product) in posBuyParts.withIndex()) { for ((index, product) in posBuyParts.withIndex()) {
val activityInfoDTO: List<ActivityInfoDTO> = var discountMoney = 0.0
GsonUtils.fromJson( var isPromotion = false
product.activitys,
object : TypeToken<List<ActivityInfoDTO>>() {}.type if (product.activitys!=null&&product.activitys != "") {
) // XLog.d(product.activitys)
var discountMoney =0.0
activityInfoDTO.forEach { item -> val activityInfoDTO: List<ActivityInfoDTO> =
discountMoney = product.price - item.activityPrice Gson().fromJson(
if (item.activityType == ProductActivityType.TIMESHARE_ACTIVITY.name) { product.activitys,
discountTime += discountMoney object : TypeToken<List<ActivityInfoDTO>>() {}.type
} else { )
if (discountMoney > 0.0) { activityInfoDTO.forEach { item ->
discountSpecial += discountMoney 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) { for (productPromotionDetailDTO in item.productIds) {
if (productPromotionDetailDTO.productId == product.productId) { if (productPromotionDetailDTO.productId == product.productId) {
isPromotion = true isPromotion = true
...@@ -609,6 +621,8 @@ object PrintUtils { ...@@ -609,6 +621,8 @@ object PrintUtils {
} }
} }
//
val name = if (discountMoney > 0.0 && isPromotion) { val name = if (discountMoney > 0.0 && isPromotion) {
"${index + 1} *${product.name}*" "${index + 1} *${product.name}*"
}else{ }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