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
...@@ -153,7 +155,7 @@ object PrintUtils { ...@@ -153,7 +155,7 @@ 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(
...@@ -559,14 +561,18 @@ object PrintUtils { ...@@ -559,14 +561,18 @@ 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 != "") {
list =
Gson().fromJson(
posBuy.activitys, posBuy.activitys,
object : TypeToken<List<OrderActivityResponse>>() {}.type object : TypeToken<List<OrderActivityResponse>>() {}.type
) )
list.forEach { item -> list?.forEach { item ->
item.toJson().dXLog()
discountMoney += item.discountMoney discountMoney += item.discountMoney
} }
}
// for ((index, product) in orderResponse.products.withIndex()) { // for ((index, product) in orderResponse.products.withIndex()) {
// if (product.activitys != null) { // if (product.activitys != null) {
...@@ -580,16 +586,22 @@ object PrintUtils { ...@@ -580,16 +586,22 @@ object PrintUtils {
// } // }
// } // }
// } // }
//
if (!posBuyParts.isNullOrEmpty()) { if (!posBuyParts.isNullOrEmpty()) {
for ((index, product) in posBuyParts.withIndex()) { 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> = val activityInfoDTO: List<ActivityInfoDTO> =
GsonUtils.fromJson( Gson().fromJson(
product.activitys, product.activitys,
object : TypeToken<List<ActivityInfoDTO>>() {}.type object : TypeToken<List<ActivityInfoDTO>>() {}.type
) )
var discountMoney =0.0
activityInfoDTO.forEach { item -> activityInfoDTO.forEach { item ->
item.toJson().dXLog()
discountMoney = product.price - item.activityPrice discountMoney = product.price - item.activityPrice
if (item.activityType == ProductActivityType.TIMESHARE_ACTIVITY.name) { if (item.activityType == ProductActivityType.TIMESHARE_ACTIVITY.name) {
discountTime += discountMoney discountTime += discountMoney
...@@ -599,8 +611,8 @@ object PrintUtils { ...@@ -599,8 +611,8 @@ object PrintUtils {
} }
} }
} }
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