Commit e9bb0e8b authored by UIUANG\Zsc's avatar UIUANG\Zsc

修改打印

parent 14df108f
...@@ -15,8 +15,8 @@ android { ...@@ -15,8 +15,8 @@ android {
applicationId "com.ypsx.yppos" applicationId "com.ypsx.yppos"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 30 targetSdkVersion 30
versionCode 100003 versionCode 100006
versionName "1.00.003" versionName "1.00.006"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
{ {
"type": "SINGLE", "type": "SINGLE",
"filters": [], "filters": [],
"versionCode": 100003, "versionCode": 100006,
"versionName": "1.00.003", "versionName": "1.00.006",
"outputFile": "yppos_v100003-1.00.003-release-2021-10-27.apk" "outputFile": "yppos_v100006-1.00.006-release-2021-11-01.apk"
} }
] ]
} }
\ No newline at end of file
...@@ -11,5 +11,6 @@ enum class PosPayMethod { ...@@ -11,5 +11,6 @@ enum class PosPayMethod {
GROUP_PAY, GROUP_PAY,
BUY_CARDPAY, BUY_CARDPAY,
CASH_TICKET_PAY, CASH_TICKET_PAY,
AGGREGATE_SCAN_CODE_PAY AGGREGATE_SCAN_CODE_PAY,
LCSW_BAR_PAY
} }
\ No newline at end of file
...@@ -37,8 +37,7 @@ abstract class PosDatabase : RoomDatabase() { ...@@ -37,8 +37,7 @@ abstract class PosDatabase : RoomDatabase() {
context.applicationContext, context.applicationContext,
PosDatabase::class.java, PosDatabase::class.java,
name name
).allowMainThreadQueries() ).allowMainThreadQueries().build()
.fallbackToDestructiveMigration().build()
INSTANCE = instance INSTANCE = instance
return instance return instance
} }
......
...@@ -81,7 +81,7 @@ class PosBuyRepository { ...@@ -81,7 +81,7 @@ class PosBuyRepository {
quantity = product.paymentProductQuantity, quantity = product.paymentProductQuantity,
barCode = product.barCode, barCode = product.barCode,
tailAmount = product.tailAmount, tailAmount = product.tailAmount,
amount = product.amount, amount = product.productAmount,
weightCode = product.weightCode, weightCode = product.weightCode,
deleted = false, deleted = false,
conversionRatio = product.conversionRatio, conversionRatio = product.conversionRatio,
......
...@@ -454,7 +454,9 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(), ...@@ -454,7 +454,9 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
requestMainViewModel.paySuccessState.observe(this, { requestMainViewModel.paySuccessState.observe(this, {
payAmountPopupWindow!!.dismiss() payAmountPopupWindow!!.dismiss()
if (it.isSuccess) { if (it.isSuccess) {
if (payFailedPopWindow != null) {
payFailedPopWindow!!.dismiss() payFailedPopWindow!!.dismiss()
}
paySuccessPopWindow = PaySuccessPopWindow(this) paySuccessPopWindow = PaySuccessPopWindow(this)
paySuccessPopWindow!!.showPopupWindow() paySuccessPopWindow!!.showPopupWindow()
paySuccessPopWindow!!.setData(it.data!!) paySuccessPopWindow!!.setData(it.data!!)
......
...@@ -75,7 +75,25 @@ class OrderPayAmountPopupWindow(context: Context) : BasePopupWindow(context) { ...@@ -75,7 +75,25 @@ class OrderPayAmountPopupWindow(context: Context) : BasePopupWindow(context) {
fun pay() { fun pay() {
var checkedRadioButtonId = bind?.radio?.checkedRadioButtonId var checkedRadioButtonId = bind?.radio?.checkedRadioButtonId
val payMethod = when (checkedRadioButtonId) { val payMethod = when (checkedRadioButtonId) {
R.id.rb_offline -> PosPayMethod.CCB_BAR_PAY R.id.rb_offline -> {
val payName = bind!!.vm?.payName?.get()
if (payName!!.isNotEmpty()) {
when (payName) {
PosPayMethod.CCB_BAR_PAY.name -> {
PosPayMethod.CCB_BAR_PAY
}
PosPayMethod.LCSW_BAR_PAY.name -> {
PosPayMethod.LCSW_BAR_PAY
}
else -> {
PosPayMethod.CCB_BAR_PAY
}
}
} else {
PosPayMethod.CCB_BAR_PAY
}
}
R.id.rbCardPay -> PosPayMethod.CARDPAY R.id.rbCardPay -> PosPayMethod.CARDPAY
else -> PosPayMethod.CCB_BAR_PAY else -> PosPayMethod.CCB_BAR_PAY
} }
......
...@@ -68,6 +68,7 @@ class PayAmountPopupWindow(context: Context) : BasePopupWindow(context) { ...@@ -68,6 +68,7 @@ class PayAmountPopupWindow(context: Context) : BasePopupWindow(context) {
var title = "" var title = ""
when (payMethod) { when (payMethod) {
PosPayMethod.LCSW_BAR_PAY,
PosPayMethod.CCB_BAR_PAY -> { PosPayMethod.CCB_BAR_PAY -> {
title = "扫码支付" title = "扫码支付"
binding?.vm?.payTitle?.set("扫码支付") binding?.vm?.payTitle?.set("扫码支付")
......
...@@ -278,7 +278,7 @@ object PrintUtils { ...@@ -278,7 +278,7 @@ object PrintUtils {
if (payments.isNotEmpty()) { if (payments.isNotEmpty()) {
total = payments[0].total.toString() total = payments[0].total.toString()
payMethod = when (payments[0].payMethod) { payMethod = when (payments[0].payMethod) {
PosPayMethod.CCB_BAR_PAY.name -> { PosPayMethod.CCB_BAR_PAY.name, PosPayMethod.LCSW_BAR_PAY.name -> {
"扫码支付" "扫码支付"
} }
PosPayMethod.CARDPAY.name -> { PosPayMethod.CARDPAY.name -> {
...@@ -562,7 +562,7 @@ object PrintUtils { ...@@ -562,7 +562,7 @@ 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 //满减
var list: List<OrderActivityResponse>? =null var list: List<OrderActivityResponse>? = null
if (posBuy.activitys != null && posBuy.activitys != "") { if (posBuy.activitys != null && posBuy.activitys != "") {
list = list =
Gson().fromJson( Gson().fromJson(
...@@ -593,7 +593,7 @@ object PrintUtils { ...@@ -593,7 +593,7 @@ object PrintUtils {
var discountMoney = 0.0 var discountMoney = 0.0
var isPromotion = false var isPromotion = false
if (product.activitys!=null&&product.activitys != "") { if (product.activitys != null && product.activitys != "") {
// XLog.d(product.activitys) // XLog.d(product.activitys)
val activityInfoDTO: List<ActivityInfoDTO> = val activityInfoDTO: List<ActivityInfoDTO> =
...@@ -626,7 +626,7 @@ object PrintUtils { ...@@ -626,7 +626,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(
...@@ -710,7 +710,7 @@ object PrintUtils { ...@@ -710,7 +710,7 @@ object PrintUtils {
height += printerManager.drawTextEx( height += printerManager.drawTextEx(
getAmountCenterSpace( getAmountCenterSpace(
"应付款:${posBuy.totalAmount}", "应付款:${posBuy.payAmount}",
"数量:${posBuy.buyNumber}" "数量:${posBuy.buyNumber}"
), ),
0, 0,
...@@ -749,7 +749,7 @@ object PrintUtils { ...@@ -749,7 +749,7 @@ object PrintUtils {
if (posBuyPayment != null) { if (posBuyPayment != null) {
total = posBuyPayment.total.toString() total = posBuyPayment.total.toString()
payMethod = when (posBuyPayment.payMethod) { payMethod = when (posBuyPayment.payMethod) {
PosPayMethod.CCB_BAR_PAY.name -> { PosPayMethod.CCB_BAR_PAY.name, PosPayMethod.LCSW_BAR_PAY.name -> {
"扫码支付" "扫码支付"
} }
PosPayMethod.CARDPAY.name -> { PosPayMethod.CARDPAY.name -> {
......
...@@ -20,6 +20,9 @@ class OrderPayAmountViewModel : BaseViewModel() { ...@@ -20,6 +20,9 @@ class OrderPayAmountViewModel : BaseViewModel() {
var scanCardPay = BooleanObservableField(false) var scanCardPay = BooleanObservableField(false)
var payName = StringObservableField("")
var offlineVisible = object : ObservableInt(scanOffline) { var offlineVisible = object : ObservableInt(scanOffline) {
override fun get(): Int { override fun get(): Int {
return if (scanOffline.get()) { return if (scanOffline.get()) {
...@@ -48,11 +51,13 @@ class OrderPayAmountViewModel : BaseViewModel() { ...@@ -48,11 +51,13 @@ class OrderPayAmountViewModel : BaseViewModel() {
if (!payMethods.isNullOrEmpty()) { if (!payMethods.isNullOrEmpty()) {
val payMethod:List<String> = payMethods.split(",") val payMethod:List<String> = payMethods.split(",")
for (str in payMethod) { for (str in payMethod) {
if (str == PosPayMethod.CCB_BAR_PAY.name) { when (str) {
PosPayMethod.CCB_BAR_PAY.name,
PosPayMethod.LCSW_BAR_PAY.name->{
payName.set(str)
scanOffline.set(true) scanOffline.set(true)
} }
if (str == PosPayMethod.CARDPAY.name) { PosPayMethod.CARDPAY.name-> scanCardPay.set(true)
scanCardPay.set(true)
} }
} }
} }
......
...@@ -39,7 +39,14 @@ dependencies { ...@@ -39,7 +39,14 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1' implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1' implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation project(path: ':common')
implementation project(path: ':base')
testImplementation 'junit:junit:4.+' testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'io.github.razerdp:BasePopup:3.1.8'
implementation 'com.github.jenly1314.AppUpdater:app-updater:1.1.0'
implementation 'com.github.getActivity:ToastUtils:9.5'
implementation 'com.aliyun.dpa:oss-android-sdk:2.1.0'
} }
\ No newline at end of file
package com.ypsx.ypselfpos.ui.popup
import android.content.Context
import android.view.Gravity
import com.ypsx.base.base.appContext
import com.ypsx.base.ext.util.screenWidth
import com.ypsx.ypselfpos.R
import razerdp.basepopup.BasePopupWindow
class AppUpdaterPopupWindow(context: Context) : BasePopupWindow(context) {
init {
setContentView(R.layout.popup_app_updater)
width = appContext.screenWidth / 4 * 3
setPopupGravity(GravityMode.RELATIVE_TO_ANCHOR, Gravity.CENTER)
isOutSideTouchable = false
setOutSideDismiss(false)
setBackgroundColor(R.color.black_60)
}
override fun onBackPressed(): Boolean {
return false
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -7,4 +7,5 @@ ...@@ -7,4 +7,5 @@
<color name="teal_700">#FF018786</color> <color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color> <color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color> <color name="white">#FFFFFFFF</color>
<color name="black_60">#99000000</color>
</resources> </resources>
\ No newline at end of file
<resources> <resources>
<string name="app_name">self_yppos</string> <string name="app_name">自助收银POS</string>
</resources> </resources>
\ No newline at end of file
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