Commit 7338ad68 authored by UIUANG\Zsc's avatar UIUANG\Zsc

修改bug

parent 197c8c9d
......@@ -15,8 +15,8 @@ android {
applicationId "com.ypsx.yppos"
minSdkVersion 21
targetSdkVersion 30
versionCode 100007
versionName "1.00.007"
versionCode 100010
versionName "1.00.010"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
......
......@@ -10,9 +10,9 @@
{
"type": "SINGLE",
"filters": [],
"versionCode": 100007,
"versionName": "1.00.007",
"outputFile": "yppos_v100007-1.00.007-release-2021-11-11.apk"
"versionCode": 100010,
"versionName": "1.00.010",
"outputFile": "yppos_v100010-1.00.010-release-2021-11-16.apk"
}
]
}
\ No newline at end of file
......@@ -9,10 +9,12 @@ import android.content.Intent
import android.os.Build
import android.os.IBinder
import com.ypsx.base.base.appContext
import com.ypsx.base.util.eXLog
import com.ypsx.yppos.R
import com.ypsx.yppos.http.repository.request.HttpRequestCoroutine
import com.ypsx.yppos.room.entity.PosConfig
import com.ypsx.yppos.room.repository.PosConfigRepository
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
......@@ -46,8 +48,12 @@ class LogService : Service() {
override fun onCreate() {
super.onCreate()
posConfig = PosConfigRepository.getInstance().loadConfig()
job = GlobalScope.launch {
HttpRequestCoroutine.uploadLog(posConfig?.code!!)
try {
job = GlobalScope.launch(Dispatchers.IO) {
HttpRequestCoroutine.uploadLog(posConfig?.code!!)
}
} catch (e: Exception) {
e.message?.eXLog()
}
}
......
......@@ -9,10 +9,12 @@ import android.content.Intent
import android.os.Build
import android.os.IBinder
import com.ypsx.base.base.appContext
import com.ypsx.base.util.eXLog
import com.ypsx.yppos.R
import com.ypsx.yppos.http.repository.request.HttpRequestCoroutine
import com.ypsx.yppos.room.entity.PosConfig
import com.ypsx.yppos.room.repository.PosConfigRepository
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
......@@ -48,9 +50,13 @@ class SyncProductService: Service() {
override fun onCreate() {
super.onCreate()
posConfig = PosConfigRepository.getInstance().loadConfig()
job = GlobalScope.launch {
val storeId = posConfig?.storeId!!
HttpRequestCoroutine.syncProduct(storeId)
job = GlobalScope.launch(Dispatchers.IO) {
try {
val storeId = posConfig?.storeId!!
HttpRequestCoroutine.syncProduct(storeId)
} catch (e: Exception) {
e.message?.eXLog()
}
}
}
......
......@@ -130,10 +130,10 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
if (payAmountPopupWindow != null && payAmountPopupWindow!!.isShowing && payAmountPopupWindow!!.timeIsStart()) {
var payMethod = payAmountPopupWindow?.getPayMethod() ?: PosPayMethod.CCB_BAR_PAY
var orderNo = mViewModel.orderNo.get()
var totalAmount = mViewModel.amount.get()
var totalAmount = mViewModel.payAmount.get()
var payAmount = mViewModel.payAmount.get()
var promotionOnSaleTotal = mViewModel.discountSpecial.get()
var discountTotal = mViewModel.discount.get()
var discountTotal = mViewModel.discountMoney.get()
var data = orderProductAdapter.data
var arrayList = ArrayList<InsertOrderProductDTO>()
arrayList.addAll(data)
......@@ -142,7 +142,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
"$realName 付款方式:${payMethod.name} 支付码:$barcode".dXLog()
requestMainViewModel.createOrder(
orderNo,
totalAmount,
totalAmount.toDouble(),
payAmount.toDouble(),
promotionOnSaleTotal.toDouble(),
discountTotal.toDouble(),
......@@ -355,6 +355,13 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
orderPayAmountPopupWindow.setPayClick { it ->
orderPayAmountPopupWindow.dismiss()
if (it == PosPayMethod.CASHPAY) {
val rawData = BigDecimal(payment)
val scale = rawData.setScale(1, RoundingMode.HALF_UP)
if (scale.toDouble() < 0.1) {
"现金收款金额不能小于0.1元".toastFailed()
return@setPayClick
}
val cashPayPopupWindow = CashPayPopupWindow(this@MainActivity)
cashPayPopupWindow.showPopupWindow()
cashPayPopupWindow.setData(it, payment)
......
......@@ -146,6 +146,11 @@ class RegisterActivity : BaseActivity<RegisterViewModel, ActivityRegisterBinding
mViewModel.submitState.set(true)
mViewModel.submitText.set("提交申请")
requestMeViewModel.cancelJob()
}else{
it.errorMsg.toast()
mViewModel.submitState.set(true)
mViewModel.submitText.set("提交申请")
}
})
......
......@@ -4,10 +4,12 @@ import android.content.Context
import android.view.Gravity
import android.view.View
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import com.ypsx.base.base.appContext
import com.ypsx.base.ext.util.screenWidth
import com.ypsx.base.ext.view.afterTextChange
import com.ypsx.base.util.dXLog
import com.ypsx.common.app.ext.hideSoftKeyboard
import com.ypsx.yppos.R
import com.ypsx.yppos.databinding.PopupCashPayBinding
import com.ypsx.yppos.http.data.entity.PosPayMethod
......@@ -68,7 +70,9 @@ class CashPayPopupWindow(context: Context) : BasePopupWindow(context) {
}
bind.textView20.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_DONE) {
ProxyClick().confirm()
val imm: InputMethodManager =
context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(bind.textView20.windowToken, InputMethodManager.HIDE_NOT_ALWAYS)
return@setOnEditorActionListener true
}
return@setOnEditorActionListener false
......@@ -97,12 +101,11 @@ class CashPayPopupWindow(context: Context) : BasePopupWindow(context) {
}
fun confirm() {
val payMoney:String = bind.textView20.text.toString()
var payMoney:String = bind.textView20.text.toString()
val receivables: Double? = bind.vm?.receivables?.get()
val changeMoney:Double? = bind.vm?.changeMoney?.get()
if (payMoney.isEmpty()) {
"应付金额不允许为空!".toastFailed()
return
payMoney = receivables.toString()
}
if (receivables != null && changeMoney != null) {
if (receivables > payMoney.toDouble()) {
......
......@@ -12,6 +12,7 @@ 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.entity.PosPayMethod
import com.ypsx.yppos.http.data.entity.PosProductStyle
import com.ypsx.yppos.http.data.entity.ProductActivityType
import com.ypsx.yppos.room.entity.PosBuy
import com.ypsx.yppos.room.entity.PosBuyPart
......@@ -123,6 +124,7 @@ object PrintUtils {
height += printerManager.drawTextEx(
"商品名称 数量 单价 成交价", 0, height, 384, -1, fontName, fontSize, 0, fontStyle, 0
)
var buyNum = 0
var discountTime = 0.0 //分时
var discountSpecial = 0.0 //特价
var discountMoney = 0.0 //满减
......@@ -155,6 +157,11 @@ object PrintUtils {
}
}
}
if (product.style == PosProductStyle.WEIGHT.name) {
buyNum += 1
} else if (product.style == PosProductStyle.SINGLE.name) {
buyNum += product.quantity.toInt()
}
val name = if (discountMoney > 0.0 && isPromotion) {
"${index + 1} *${product.name}*"
......@@ -184,18 +191,18 @@ object PrintUtils {
)
}
height += printerManager.drawTextEx(
" ",
0,
height,
384,
-1,
fontName,
fontSize,
0,
fontStyle,
0
)
// height += printerManager.drawTextEx(
// " ",
// 0,
// height,
// 384,
// -1,
// fontName,
// fontSize,
// 0,
// fontStyle,
// 0
// )
height += printerManager.drawTextEx(
"促销特价优惠:${BigDecimalUtils.forPlus(discountSpecial)}",
0,
......@@ -241,8 +248,8 @@ object PrintUtils {
height += printerManager.drawTextEx(
getAmountCenterSpace(
"应付款:${orderResponse.totalAmount}",
"数量:${orderResponse.buyNumber}"
"应付款:${orderResponse.payAmount}",
"数量:${buyNum}"
),
0,
height,
......@@ -254,7 +261,7 @@ object PrintUtils {
fontStyle,
0
)
val minus = BigDecimal.valueOf(orderResponse.totalAmount)
val minus = BigDecimal.valueOf(orderResponse.payAmount)
.minus(BigDecimal.valueOf(orderResponse.roundPrice))
val scale1 =
minus.plus(BigDecimal.valueOf(orderResponse.changeAmount))
......@@ -518,7 +525,7 @@ object PrintUtils {
0
)
height += printerManager.drawTextEx(
getSpace("销售小票"), 0, height, 384, -1, fontName, fontSize, 0, fontStyle, 0
getSpace("重打销售小票"), 0, height, 384, -1, fontName, fontSize, 0, fontStyle, 0
)
height += printerManager.drawTextEx(
......@@ -569,7 +576,7 @@ object PrintUtils {
height += printerManager.drawTextEx(
"商品名称 数量 单价 成交价", 0, height, 384, -1, fontName, fontSize, 0, fontStyle, 0
)
var buyNum = 0
var discountTime = 0.0 //分时
var discountSpecial = 0.0 //特价
var discountMoney = 0.0 //满减
......@@ -640,6 +647,11 @@ object PrintUtils {
} else {
"${index + 1} ${product.name}"
}
if (product.style == PosProductStyle.WEIGHT.name) {
buyNum += 1
} else if (product.style == PosProductStyle.SINGLE.name) {
buyNum += product.quantity.toInt()
}
height += printerManager.drawTextEx(
name,
0,
......@@ -664,18 +676,18 @@ object PrintUtils {
}
}
height += printerManager.drawTextEx(
" ",
0,
height,
384,
-1,
fontName,
fontSize,
0,
fontStyle,
0
)
// height += printerManager.drawTextEx(
// " ",
// 0,
// height,
// 384,
// -1,
// fontName,
// fontSize,
// 0,
// fontStyle,
// 0
// )
height += printerManager.drawTextEx(
"促销特价优惠:${BigDecimalUtils.forPlus(discountSpecial)}",
0,
......@@ -722,7 +734,7 @@ object PrintUtils {
height += printerManager.drawTextEx(
getAmountCenterSpace(
"应付款:${posBuy.totalAmount}",
"数量:${posBuy.buyNumber}"
"数量:${buyNum}"
),
0,
height,
......
......@@ -175,7 +175,7 @@
android:hint="@string/login_password_hint"
android:inputType="textPassword"
android:lines="1"
android:maxLength="20"
android:maxLength="6"
android:textColor="#333333"
android:textColorHint="#999999"
android:textSize="20sp"
......
......@@ -122,7 +122,7 @@
android:layout_height="wrap_content"
android:paddingVertical="15dp"
android:paddingEnd="20dp"
android:maxLength="6"
android:maxLength="10"
android:text="@{vm.change2}"
android:textColor="#333333"
android:textSize="20sp"
......
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