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
142206b6
Commit
142206b6
authored
Sep 18, 2021
by
UIUANG\Zsc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改数据库,修改打印
parent
02187684
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
160 additions
and
56 deletions
+160
-56
.gitignore
.gitignore
+2
-0
build.gradle
app/build.gradle
+18
-18
InsertOrderProductDTO.kt
...va/com/ypsx/yppos/http/data/bean/InsertOrderProductDTO.kt
+3
-1
OrderProductDTO.kt
...ain/java/com/ypsx/yppos/http/data/bean/OrderProductDTO.kt
+1
-1
UnifiedCashPaySignRequest.kt
...ypsx/yppos/http/data/request/UnifiedCashPaySignRequest.kt
+1
-0
HttpRequestManger.kt
...m/ypsx/yppos/http/repository/request/HttpRequestManger.kt
+7
-2
PosBuyPayment.kt
...src/main/java/com/ypsx/yppos/room/entity/PosBuyPayment.kt
+2
-1
PosBuyRepository.kt
...n/java/com/ypsx/yppos/room/repository/PosBuyRepository.kt
+10
-2
MainActivity.kt
app/src/main/java/com/ypsx/yppos/ui/activity/MainActivity.kt
+1
-1
OrderProductAdapter.kt
...ain/java/com/ypsx/yppos/ui/adapter/OrderProductAdapter.kt
+1
-1
SettingsPopupWindow.kt
.../main/java/com/ypsx/yppos/ui/popup/SettingsPopupWindow.kt
+2
-0
PrintUtils.kt
app/src/main/java/com/ypsx/yppos/utils/PrintUtils.kt
+84
-15
RequestMainViewModel.kt
.../com/ypsx/yppos/viewmodel/request/RequestMainViewModel.kt
+16
-2
ic_launcher.png
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
+0
-0
ic_launcher_round.png
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
+0
-0
build.gradle
base/build.gradle
+12
-12
No files found.
.gitignore
View file @
142206b6
...
@@ -15,3 +15,5 @@
...
@@ -15,3 +15,5 @@
local.properties
local.properties
app/sit/output-metadata.json
app/sit/output-metadata.json
app/sit/yppos-v-sit.apk
app/sit/yppos-v-sit.apk
app/debug/output-metadata.json
app/debug/yppos-v-debug.apk
app/build.gradle
View file @
142206b6
...
@@ -38,31 +38,31 @@ android {
...
@@ -38,31 +38,31 @@ android {
}
}
buildTypes
{
buildTypes
{
debug
{
//
debug {
buildConfigField
'String'
,
'HOST'
,
DEBUG_HOST
//
buildConfigField 'String', 'HOST', DEBUG_HOST
minifyEnabled
false
//
minifyEnabled false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
//
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig
signingConfigs
.
config
//
signingConfig signingConfigs.config
}
//
}
sit
{
debug
{
buildConfigField
'String'
,
'HOST'
,
SIT_HOST
buildConfigField
'String'
,
'HOST'
,
SIT_HOST
minifyEnabled
false
minifyEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
signingConfig
signingConfigs
.
config
signingConfig
signingConfigs
.
config
}
}
pre
{
//
pre {
buildConfigField
'String'
,
'HOST'
,
PRE_HOST
//
buildConfigField 'String', 'HOST', PRE_HOST
minifyEnabled
false
//
minifyEnabled false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
//
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
//
}
release
{
//
release {
buildConfigField
'String'
,
'HOST'
,
RELEASE_HOST
//
buildConfigField 'String', 'HOST', RELEASE_HOST
minifyEnabled
false
//
minifyEnabled false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
//
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig
signingConfigs
.
config
//
signingConfig signingConfigs.config
}
//
}
}
}
compileOptions
{
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1_8
sourceCompatibility
JavaVersion
.
VERSION_1_8
...
...
app/src/main/java/com/ypsx/yppos/http/data/bean/InsertOrderProductDTO.kt
View file @
142206b6
...
@@ -38,6 +38,8 @@ data class InsertOrderProductDTO(
...
@@ -38,6 +38,8 @@ data class InsertOrderProductDTO(
var
merchantItemId
:
String
?
=
null
,
var
merchantItemId
:
String
?
=
null
,
//称重码
//称重码
var
weightCode
:
String
?
=
null
,
var
weightCode
:
String
?
=
null
,
var
isPromotion
:
Boolean
=
false
)
)
app/src/main/java/com/ypsx/yppos/http/data/bean/OrderProductDTO.kt
View file @
142206b6
...
@@ -36,6 +36,6 @@ data class OrderProductDTO(
...
@@ -36,6 +36,6 @@ data class OrderProductDTO(
var
paymentProductQuantity
:
Double
,
var
paymentProductQuantity
:
Double
,
var
paymentProductCode
:
String
,
var
paymentProductCode
:
String
,
var
paymentProductName
:
String
,
var
paymentProductName
:
String
,
var
activitys
:
List
<
OrderActivityResponse
>?=
null
,
var
activitys
:
List
<
ActivityInfoDTO
>?=
null
,
)
)
app/src/main/java/com/ypsx/yppos/http/data/request/UnifiedCashPaySignRequest.kt
View file @
142206b6
...
@@ -7,4 +7,5 @@ data class UnifiedCashPaySignRequest(
...
@@ -7,4 +7,5 @@ data class UnifiedCashPaySignRequest(
var
entry
:
String
?
=
"ORDER"
,
var
entry
:
String
?
=
"ORDER"
,
var
roundPrice
:
Double
=
0.0
,
var
roundPrice
:
Double
=
0.0
,
var
total
:
Double
,
var
total
:
Double
,
var
cardPayPassword
:
String
?=
null
)
)
app/src/main/java/com/ypsx/yppos/http/repository/request/HttpRequestManger.kt
View file @
142206b6
...
@@ -112,16 +112,21 @@ class HttpRequestManger {
...
@@ -112,16 +112,21 @@ class HttpRequestManger {
val
data
=
uploadData
[
0
]
val
data
=
uploadData
[
0
]
val
success
=
data
.
success
val
success
=
data
.
success
if
(
success
)
{
if
(
success
)
{
var
cardPayPassword
:
String
?
=
null
if
(
payMethod
==
PosPayMethod
.
CARDPAY
)
{
cardPayPassword
=
""
}
val
unifiedCashPaySignRequest
=
val
unifiedCashPaySignRequest
=
UnifiedCashPaySignRequest
(
UnifiedCashPaySignRequest
(
authCode
,
authCode
,
data
.
orderId
,
data
.
orderId
,
payMethod
.
name
,
payMethod
.
name
,
total
=
insertOrderRequest
.
totalAmount
total
=
insertOrderRequest
.
payAmount
,
cardPayPassword
=
cardPayPassword
)
)
val
cashPaySignData
=
apiService
.
getCashPaySign
(
unifiedCashPaySignRequest
)
val
cashPaySignData
=
apiService
.
getCashPaySign
(
unifiedCashPaySignRequest
)
if
(
cashPaySignData
.
isSuccess
())
{
if
(
cashPaySignData
.
isSuccess
())
{
data
.
total
=
insertOrderRequest
.
total
Amount
data
.
total
=
insertOrderRequest
.
pay
Amount
data
.
authCode
=
authCode
data
.
authCode
=
authCode
return
data
return
data
}
else
{
}
else
{
...
...
app/src/main/java/com/ypsx/yppos/room/entity/PosBuyPayment.kt
View file @
142206b6
...
@@ -32,6 +32,7 @@ data class PosBuyPayment(
...
@@ -32,6 +32,7 @@ data class PosBuyPayment(
var
realPayFlowNo
:
String
?
=
null
,
var
realPayFlowNo
:
String
?
=
null
,
var
payFlowNo
:
String
,
var
payFlowNo
:
String
,
var
status
:
String
,
var
status
:
String
,
var
openId
:
String
,
// var openId: String,
var
openId
:
String
?=
null
,
)
)
app/src/main/java/com/ypsx/yppos/room/repository/PosBuyRepository.kt
View file @
142206b6
package
com.ypsx.yppos.room.repository
package
com.ypsx.yppos.room.repository
import
com.ypsx.base.base.appContext
import
com.ypsx.base.base.appContext
import
com.ypsx.base.ext.util.toJson
import
com.ypsx.yppos.http.data.bean.OrderDetailsResponse
import
com.ypsx.yppos.http.data.bean.OrderDetailsResponse
import
com.ypsx.yppos.room.dao.PosBuyDao
import
com.ypsx.yppos.room.dao.PosBuyDao
import
com.ypsx.yppos.room.dao.PosBuyPartDao
import
com.ypsx.yppos.room.dao.PosBuyPartDao
...
@@ -9,6 +10,8 @@ import com.ypsx.yppos.room.database.PosDatabase
...
@@ -9,6 +10,8 @@ import com.ypsx.yppos.room.database.PosDatabase
import
com.ypsx.yppos.room.entity.PosBuy
import
com.ypsx.yppos.room.entity.PosBuy
import
com.ypsx.yppos.room.entity.PosBuyPart
import
com.ypsx.yppos.room.entity.PosBuyPart
import
com.ypsx.yppos.room.entity.PosBuyPayment
import
com.ypsx.yppos.room.entity.PosBuyPayment
import
com.ypsx.yppos.utils.dXLog
import
com.ypsx.yppos.utils.eXLog
class
PosBuyRepository
{
class
PosBuyRepository
{
...
@@ -33,8 +36,9 @@ class PosBuyRepository {
...
@@ -33,8 +36,9 @@ class PosBuyRepository {
}
}
fun
savePosBuy
(
orderResponse
:
OrderDetailsResponse
,
authCode
:
String
)
{
fun
savePosBuy
(
orderResponse
:
OrderDetailsResponse
,
authCode
:
String
)
{
orderResponse
.
toString
().
eXLog
()
val
isEmpty
=
orderResponse
.
activitys
?.
isEmpty
()
?:
true
val
isEmpty
=
orderResponse
.
activitys
?.
isEmpty
()
?:
true
val
activitys
=
if
(
isEmpty
)
""
else
orderResponse
.
activitys
.
to
String
()
val
activitys
=
if
(
isEmpty
)
""
else
orderResponse
.
activitys
.
to
Json
()
val
posBuy
=
PosBuy
(
val
posBuy
=
PosBuy
(
id
=
orderResponse
.
id
,
id
=
orderResponse
.
id
,
orderNo
=
orderResponse
.
orderNo
,
orderNo
=
orderResponse
.
orderNo
,
...
@@ -64,9 +68,11 @@ class PosBuyRepository {
...
@@ -64,9 +68,11 @@ class PosBuyRepository {
payment
.
payCode
=
authCode
payment
.
payCode
=
authCode
getPosBuyPaymentDao
().
insert
(
payment
)
getPosBuyPaymentDao
().
insert
(
payment
)
}
}
orderResponse
.
products
.
toJson
().
dXLog
()
for
(
product
in
orderResponse
.
products
)
{
for
(
product
in
orderResponse
.
products
)
{
product
.
toJson
().
dXLog
()
val
isEmpty1
=
product
.
activitys
?.
isEmpty
()
?:
true
val
isEmpty1
=
product
.
activitys
?.
isEmpty
()
?:
true
val
activity
=
if
(
isEmpty1
)
""
else
product
.
activitys
.
to
String
()
val
activity
=
if
(
isEmpty1
)
""
else
product
.
activitys
.
to
Json
()
val
activityType
=
if
(
isEmpty1
)
""
else
product
.
activitys
?.
get
(
0
)
?.
activityType
val
activityType
=
if
(
isEmpty1
)
""
else
product
.
activitys
?.
get
(
0
)
?.
activityType
val
posBuyPart
=
PosBuyPart
(
val
posBuyPart
=
PosBuyPart
(
id
=
product
.
id
,
id
=
product
.
id
,
...
@@ -94,11 +100,13 @@ class PosBuyRepository {
...
@@ -94,11 +100,13 @@ class PosBuyRepository {
discountTotal
=
product
.
discountTotal
,
discountTotal
=
product
.
discountTotal
,
payApportionAmount
=
product
.
payApportionAmount
,
payApportionAmount
=
product
.
payApportionAmount
,
)
)
posBuyPart
.
toJson
().
dXLog
()
getPosBuyPartDao
().
insert
(
posBuyPart
)
getPosBuyPartDao
().
insert
(
posBuyPart
)
}
}
for
(
deleteProduct
in
orderResponse
.
deleteProducts
)
{
for
(
deleteProduct
in
orderResponse
.
deleteProducts
)
{
deleteProduct
.
deleted
=
true
deleteProduct
.
deleted
=
true
deleteProduct
.
orderId
=
orderResponse
.
id
deleteProduct
.
orderId
=
orderResponse
.
id
deleteProduct
.
toString
().
dXLog
()
getPosBuyPartDao
().
insert
(
deleteProduct
)
getPosBuyPartDao
().
insert
(
deleteProduct
)
}
}
...
...
app/src/main/java/com/ypsx/yppos/ui/activity/MainActivity.kt
View file @
142206b6
...
@@ -375,7 +375,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -375,7 +375,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
val
data
=
orderProductAdapter
.
data
val
data
=
orderProductAdapter
.
data
for
(
item
in
data
)
{
for
(
item
in
data
)
{
val
productItem
=
ProductItem
(
val
productItem
=
ProductItem
(
""
,
item
.
merchantItemId
?:
""
,
item
.
productId
,
item
.
productId
,
item
.
quantity
,
item
.
quantity
,
item
.
price
item
.
price
...
...
app/src/main/java/com/ypsx/yppos/ui/adapter/OrderProductAdapter.kt
View file @
142206b6
...
@@ -18,7 +18,7 @@ class OrderProductAdapter(data: ArrayList<InsertOrderProductDTO>) :
...
@@ -18,7 +18,7 @@ class OrderProductAdapter(data: ArrayList<InsertOrderProductDTO>) :
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
InsertOrderProductDTO
)
{
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
InsertOrderProductDTO
)
{
item
.
run
{
item
.
run
{
holder
.
setText
(
R
.
id
.
tv_barCode
,
"条码:$barCode"
)
holder
.
setText
(
R
.
id
.
tv_barCode
,
"条码:$barCode"
)
if
(
discountTotal
>
0.0
)
{
if
(
discountTotal
>
0.0
||
isPromotion
)
{
val
ssb
=
SpannableStringBuilder
(
"促销 $name"
)
val
ssb
=
SpannableStringBuilder
(
"促销 $name"
)
var
roundBackgroundColorSpan
=
var
roundBackgroundColorSpan
=
RoundBackgroundColorSpan
(
RoundBackgroundColorSpan
(
...
...
app/src/main/java/com/ypsx/yppos/ui/popup/SettingsPopupWindow.kt
View file @
142206b6
...
@@ -68,9 +68,11 @@ class SettingsPopupWindow(context: Context?) : BasePopupWindow(context) {
...
@@ -68,9 +68,11 @@ class SettingsPopupWindow(context: Context?) : BasePopupWindow(context) {
}
else
{
}
else
{
val
posBuyParts
=
val
posBuyParts
=
PosBuyRepository
.
getInstance
().
queryPosBuyPartByOrderNo
(
posBuy
.
id
)
PosBuyRepository
.
getInstance
().
queryPosBuyPartByOrderNo
(
posBuy
.
id
)
posBuyParts
.
toString
().
dXLog
()
val
posBuyPayment
=
val
posBuyPayment
=
PosBuyRepository
.
getInstance
()
PosBuyRepository
.
getInstance
()
.
queryPosBuyPaymentByOrderNo
(
posBuy
.
id
)
.
queryPosBuyPaymentByOrderNo
(
posBuy
.
id
)
posBuyPayment
.
toString
().
dXLog
()
PrintUtils
.
printLast
(
posConfig
!!
,
posBuyPayment
,
posBuy
,
posBuyParts
)
PrintUtils
.
printLast
(
posConfig
!!
,
posBuyPayment
,
posBuy
,
posBuyParts
)
}
}
}
}
...
...
app/src/main/java/com/ypsx/yppos/utils/PrintUtils.kt
View file @
142206b6
package
com.ypsx.yppos.utils
package
com.ypsx.yppos.utils
import
android.device.PrinterManager
import
android.device.PrinterManager
import
android.widget.Toast
import
com.blankj.utilcode.util.GsonUtils
import
com.blankj.utilcode.util.Utils.runOnUiThread
import
com.blankj.utilcode.util.Utils.runOnUiThread
import
com.google.gson.Gson
import
com.google.gson.reflect.TypeToken
import
com.ypsx.yppos.http.data.bean.ActivityInfoDTO
import
com.ypsx.yppos.http.data.bean.OrderActivityResponse
import
com.ypsx.yppos.http.data.bean.OrderDetailsResponse
import
com.ypsx.yppos.http.data.bean.OrderDetailsResponse
import
com.ypsx.yppos.http.data.entity.PosPayMethod
import
com.ypsx.yppos.http.data.entity.PosPayMethod
import
com.ypsx.yppos.http.data.entity.ProductActivityType
import
com.ypsx.yppos.room.entity.PosBuy
import
com.ypsx.yppos.room.entity.PosBuy
import
com.ypsx.yppos.room.entity.PosBuyPart
import
com.ypsx.yppos.room.entity.PosBuyPart
import
com.ypsx.yppos.room.entity.PosBuyPayment
import
com.ypsx.yppos.room.entity.PosBuyPayment
...
@@ -113,7 +118,28 @@ object PrintUtils {
...
@@ -113,7 +118,28 @@ object PrintUtils {
height
+=
printerManager
.
drawTextEx
(
height
+=
printerManager
.
drawTextEx
(
"商品名称 数量 单价 成交价"
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
"商品名称 数量 单价 成交价"
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
)
)
var
discountTime
=
0.0
//分时
var
discountSpecial
=
0.0
//特价
var
discountMoney
=
0.0
//满减
orderResponse
.
activitys
?.
forEach
{
item
->
discountMoney
+=
item
.
discountMoney
}
for
((
index
,
product
)
in
orderResponse
.
products
.
withIndex
())
{
for
((
index
,
product
)
in
orderResponse
.
products
.
withIndex
())
{
if
(
product
.
activitys
!=
null
)
{
product
.
activitys
!!
.
forEach
{
item
->
var
d
=
product
.
price
-
item
.
activityPrice
if
(
item
.
activityType
==
ProductActivityType
.
TIMESHARE_ACTIVITY
.
name
)
{
discountTime
+=
d
}
else
{
if
(
d
>
0.0
)
{
discountSpecial
+=
d
}
}
}
}
height
+=
printerManager
.
drawTextEx
(
height
+=
printerManager
.
drawTextEx
(
"${index + 1} ${product.name}"
,
"${index + 1} ${product.name}"
,
0
,
0
,
...
@@ -150,7 +176,7 @@ object PrintUtils {
...
@@ -150,7 +176,7 @@ object PrintUtils {
0
0
)
)
height
+=
printerManager
.
drawTextEx
(
height
+=
printerManager
.
drawTextEx
(
"促销特价优惠:${
orderResponse.promotionOnSaleTotal
}"
,
"促销特价优惠:${
BigDecimalUtils.forPlus(discountSpecial)
}"
,
0
,
0
,
height
,
height
,
384
,
384
,
...
@@ -163,7 +189,7 @@ object PrintUtils {
...
@@ -163,7 +189,7 @@ object PrintUtils {
)
)
height
+=
printerManager
.
drawTextEx
(
height
+=
printerManager
.
drawTextEx
(
"分时折扣优惠:${
orderResponse.discountTotal
}"
,
"分时折扣优惠:${
BigDecimalUtils.forPlus(discountTime)
}"
,
0
,
0
,
height
,
height
,
384
,
384
,
...
@@ -176,7 +202,7 @@ object PrintUtils {
...
@@ -176,7 +202,7 @@ object PrintUtils {
)
)
height
+=
printerManager
.
drawTextEx
(
height
+=
printerManager
.
drawTextEx
(
"满金额减免优惠:${
orderResponse.discountTotal
}"
,
"满金额减免优惠:${
BigDecimalUtils.forPlus(discountMoney)
}"
,
0
,
0
,
height
,
height
,
384
,
384
,
...
@@ -194,7 +220,7 @@ object PrintUtils {
...
@@ -194,7 +220,7 @@ object PrintUtils {
height
+=
printerManager
.
drawTextEx
(
height
+=
printerManager
.
drawTextEx
(
getAmountCenterSpace
(
getAmountCenterSpace
(
"应付款:${orderResponse.
total
Amount}"
,
"应付款:${orderResponse.
pay
Amount}"
,
"数量:${orderResponse.buyNumber}"
"数量:${orderResponse.buyNumber}"
),
),
0
,
0
,
...
@@ -237,7 +263,7 @@ object PrintUtils {
...
@@ -237,7 +263,7 @@ object PrintUtils {
"扫码支付"
"扫码支付"
}
}
PosPayMethod
.
CARDPAY
.
name
->
{
PosPayMethod
.
CARDPAY
.
name
->
{
"会员余额"
"会员余额
支付
"
}
}
else
->
{
else
->
{
""
""
...
@@ -404,22 +430,22 @@ object PrintUtils {
...
@@ -404,22 +430,22 @@ object PrintUtils {
runOnUiThread
(
Runnable
{
runOnUiThread
(
Runnable
{
when
(
status
)
{
when
(
status
)
{
PRNSTS_OUT_OF_PAPER
->
{
PRNSTS_OUT_OF_PAPER
->
{
"缺纸!!!"
.
toast
()
"缺纸!!!"
.
toast
Sign
()
}
}
PRNSTS_OVER_HEAT
->
{
PRNSTS_OVER_HEAT
->
{
"过温保护!!!"
.
toast
()
"过温保护!!!"
.
toast
Sign
()
}
}
PRNSTS_UNDER_VOLTAGE
->
{
PRNSTS_UNDER_VOLTAGE
->
{
"电池电压过低!!!"
.
toast
()
"电池电压过低!!!"
.
toast
Sign
()
}
}
PRNSTS_BUSY
->
{
PRNSTS_BUSY
->
{
"打印机忙!!!"
.
toast
()
"打印机忙!!!"
.
toast
Sign
()
}
}
PRNSTS_ERR
->
{
PRNSTS_ERR
->
{
"打印机出错!!!"
.
toast
()
"打印机出错!!!"
.
toast
Sign
()
}
}
PRNSTS_ERR_DRIVER
->
{
PRNSTS_ERR_DRIVER
->
{
"打印机驱动出错!!!"
.
toast
()
"打印机驱动出错!!!"
.
toast
Sign
()
}
}
}
}
})
})
...
@@ -513,8 +539,51 @@ object PrintUtils {
...
@@ -513,8 +539,51 @@ object PrintUtils {
height
+=
printerManager
.
drawTextEx
(
height
+=
printerManager
.
drawTextEx
(
"商品名称 数量 单价 成交价"
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
"商品名称 数量 单价 成交价"
,
0
,
height
,
384
,
-
1
,
fontName
,
fontSize
,
0
,
fontStyle
,
0
)
)
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
}
// for ((index, product) in orderResponse.products.withIndex()) {
// if (product.activitys != null) {
// product.activitys!!.forEach { item ->
// if (item.activityType == ProductActivityType.TIMESHARE_ACTIVITY.name) {
// discountTime += item.discountMoney
// } else {
// if (item.discountMoney > 0.0) {
// discountSpecial += item.discountMoney
// }
// }
// }
// }
if
(!
posBuyParts
.
isNullOrEmpty
())
{
if
(!
posBuyParts
.
isNullOrEmpty
())
{
for
((
index
,
product
)
in
posBuyParts
.
withIndex
())
{
for
((
index
,
product
)
in
posBuyParts
.
withIndex
())
{
val
list
:
List
<
ActivityInfoDTO
>
=
GsonUtils
.
fromJson
(
product
.
activitys
,
object
:
TypeToken
<
List
<
ActivityInfoDTO
>>()
{}.
type
)
// if (product.activitys != null) {
list
.
forEach
{
item
->
val
discountMoney
=
product
.
price
-
item
.
activityPrice
if
(
item
.
activityType
==
ProductActivityType
.
TIMESHARE_ACTIVITY
.
name
)
{
discountTime
+=
discountMoney
}
else
{
if
(
discountMoney
>
0.0
)
{
discountSpecial
+=
discountMoney
}
}
}
// }
height
+=
printerManager
.
drawTextEx
(
height
+=
printerManager
.
drawTextEx
(
"${index + 1} ${product.name}"
,
"${index + 1} ${product.name}"
,
0
,
0
,
...
@@ -552,7 +621,7 @@ object PrintUtils {
...
@@ -552,7 +621,7 @@ object PrintUtils {
0
0
)
)
height
+=
printerManager
.
drawTextEx
(
height
+=
printerManager
.
drawTextEx
(
"促销特价优惠:${
posBuy.promotionOnSaleTotal
}"
,
"促销特价优惠:${
BigDecimalUtils.forPlus(discountSpecial)
}"
,
0
,
0
,
height
,
height
,
384
,
384
,
...
@@ -565,7 +634,7 @@ object PrintUtils {
...
@@ -565,7 +634,7 @@ object PrintUtils {
)
)
height
+=
printerManager
.
drawTextEx
(
height
+=
printerManager
.
drawTextEx
(
"分时折扣优惠:${
posBuy.discountTotal
}"
,
"分时折扣优惠:${
BigDecimalUtils.forPlus(discountTime)
}"
,
0
,
0
,
height
,
height
,
384
,
384
,
...
@@ -578,7 +647,7 @@ object PrintUtils {
...
@@ -578,7 +647,7 @@ object PrintUtils {
)
)
height
+=
printerManager
.
drawTextEx
(
height
+=
printerManager
.
drawTextEx
(
"满金额减免优惠:${
posBuy.discountTotal
}"
,
"满金额减免优惠:${
BigDecimalUtils.forPlus(discountMoney)
}"
,
0
,
0
,
height
,
height
,
384
,
384
,
...
...
app/src/main/java/com/ypsx/yppos/viewmodel/request/RequestMainViewModel.kt
View file @
142206b6
...
@@ -220,6 +220,18 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -220,6 +220,18 @@ class RequestMainViewModel : BaseViewModel() {
break
break
}
}
}
}
var
isPromotion
=
false
if
(!
orderPromotions
.
isNullOrEmpty
())
{
for
(
orderPromotion
in
orderPromotions
!!
)
{
for
(
productPromotionDetailDTO
in
orderPromotion
.
productIds
)
{
if
(
productPromotionDetailDTO
.
productId
==
product
.
productId
)
{
isPromotion
=
true
break
}
}
}
}
var
activitys
=
product
.
activityInfo
var
activitys
=
product
.
activityInfo
var
activitysList
:
ArrayList
<
ActivityInfoDTO
>?
=
null
var
activitysList
:
ArrayList
<
ActivityInfoDTO
>?
=
null
if
(
activitys
!=
null
)
{
if
(
activitys
!=
null
)
{
...
@@ -248,7 +260,9 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -248,7 +260,9 @@ class RequestMainViewModel : BaseViewModel() {
style
=
posProduct
.
style
,
style
=
posProduct
.
style
,
pluLevel
=
posProduct
.
pluLevel
,
pluLevel
=
posProduct
.
pluLevel
,
merchantItemId
=
posProduct
.
merchantItemId
,
merchantItemId
=
posProduct
.
merchantItemId
,
productNumber
=
posProduct
.
productNumber
productNumber
=
posProduct
.
productNumber
,
isPromotion
=
isPromotion
,
isVirtual
=
posProduct
.
isVirtual
)
)
posBuyPart
.
toJson
().
dXLog
()
posBuyPart
.
toJson
().
dXLog
()
list
.
add
(
posBuyPart
)
list
.
add
(
posBuyPart
)
...
@@ -326,8 +340,8 @@ class RequestMainViewModel : BaseViewModel() {
...
@@ -326,8 +340,8 @@ class RequestMainViewModel : BaseViewModel() {
request
({
apiService
.
getOrderDetailById
(
orderId
)
},
{
request
({
apiService
.
getOrderDetailById
(
orderId
)
},
{
"${CacheUtil.getRealName()}付款成功,保存数据库并打印"
.
dXLog
()
"${CacheUtil.getRealName()}付款成功,保存数据库并打印"
.
dXLog
()
launch
({
launch
({
PosBuyRepository
.
getInstance
().
savePosBuy
(
it
,
authCode
)
PrintUtils
.
print
(
posConfig
!!
,
it
)
PrintUtils
.
print
(
posConfig
!!
,
it
)
PosBuyRepository
.
getInstance
().
savePosBuy
(
it
,
authCode
)
},
{
},
{
"打印完成"
.
dXLog
()
"打印完成"
.
dXLog
()
"打印完成"
.
toastSuccess
()
"打印完成"
.
toastSuccess
()
...
...
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
deleted
100644 → 0
View file @
02187684
10.4 KB
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
deleted
100644 → 0
View file @
02187684
16.2 KB
base/build.gradle
View file @
142206b6
...
@@ -20,22 +20,22 @@ android {
...
@@ -20,22 +20,22 @@ android {
}
}
buildTypes
{
buildTypes
{
// debug {
// minifyEnabled false
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// }
debug
{
debug
{
minifyEnabled
false
minifyEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
}
}
sit
{
// pre {
minifyEnabled
false
// minifyEnabled false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
// }
pre
{
// release {
minifyEnabled
false
// minifyEnabled false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
// }
release
{
minifyEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
}
}
}
...
...
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