Commit e425d871 authored by 赵鹏翔's avatar 赵鹏翔

调整打印时间间隔到4s

parent fe3304e3
...@@ -3,10 +3,7 @@ package com.miya.fastcashier.log ...@@ -3,10 +3,7 @@ package com.miya.fastcashier.log
import android.app.Dialog import android.app.Dialog
import android.content.Context import android.content.Context
import com.miya.fastcashier.service.AccountService.getAccountInfo import com.miya.fastcashier.service.AccountService.getAccountInfo
import com.miya.fastcashier.utils.getVersion
import com.miya.fastcashier.net.ApiConfig.baseUrl import com.miya.fastcashier.net.ApiConfig.baseUrl
import com.miya.fastcashier.utils.getWifyName
import com.miya.fastcashier.utils.getNetIp
import com.miya.fastcashier.R import com.miya.fastcashier.R
import com.miya.fastcashier.beans.SelfCashierAccountInfo import com.miya.fastcashier.beans.SelfCashierAccountInfo
import com.miya.fastcashier.service.AccountService import com.miya.fastcashier.service.AccountService
...@@ -19,6 +16,8 @@ import android.view.Gravity ...@@ -19,6 +16,8 @@ import android.view.Gravity
import android.view.View import android.view.View
import com.miya.fastcashier.BuildConfig import com.miya.fastcashier.BuildConfig
import com.miya.fastcashier.databinding.DialogSystemParameterBinding import com.miya.fastcashier.databinding.DialogSystemParameterBinding
import com.miya.fastcashier.utils.*
import java.util.*
class SystemParameterDialog(context: Context) : Dialog(context, R.style.CommonDialog) { class SystemParameterDialog(context: Context) : Dialog(context, R.style.CommonDialog) {
...@@ -46,7 +45,10 @@ class SystemParameterDialog(context: Context) : Dialog(context, R.style.CommonDi ...@@ -46,7 +45,10 @@ class SystemParameterDialog(context: Context) : Dialog(context, R.style.CommonDi
setInfo(viewBinding.tvEquipment, "sunmi_v2pro") setInfo(viewBinding.tvEquipment, "sunmi_v2pro")
setInfo(viewBinding.tvServerUrl, baseUrl) setInfo(viewBinding.tvServerUrl, baseUrl)
setInfo(viewBinding.tvWifiName, getWifyName(context)) setInfo(viewBinding.tvWifiName, getWifyName(context))
setInfo(viewBinding.tvNetIp, if (getNetIp(context) == null) "未知" else getNetIp(context)) setInfo(
viewBinding.tvLog,
"${getVersionCode(context)}_${DateUtils.format8(Date())}.txt"
)
setInfo( setInfo(
viewBinding.tvPrintType, viewBinding.tvPrintType,
if (PrinterManager.getInstance().printer == null) context.resources.getString(R.string.app_unkown) else PrinterManager.getInstance().printer.printerName if (PrinterManager.getInstance().printer == null) context.resources.getString(R.string.app_unkown) else PrinterManager.getInstance().printer.printerName
......
...@@ -70,7 +70,7 @@ object PrintService { ...@@ -70,7 +70,7 @@ object PrintService {
serialNumber serialNumber
) )
Timer().schedule(3000) { Timer().schedule(4000) {
printCustomer( printCustomer(
printer, printer,
payServiceResponse, payServiceResponse,
...@@ -275,7 +275,7 @@ object PrintService { ...@@ -275,7 +275,7 @@ object PrintService {
payServiceResponse, payServiceResponse,
selfCashierAccountInfo selfCashierAccountInfo
) )
Timer().schedule(3000) { Timer().schedule(4000) {
refundPrintCustomer( refundPrintCustomer(
printer, printer,
payServiceResponse, payServiceResponse,
......
...@@ -103,6 +103,18 @@ fun getVersion(context: Context): String? { ...@@ -103,6 +103,18 @@ fun getVersion(context: Context): String? {
return version return version
} }
fun getVersionCode(context: Context): String? {
val packageManager = context.packageManager
val packageInfo: PackageInfo
var version = ""
try {
packageInfo = packageManager.getPackageInfo(context.packageName, 0)
version = "${packageInfo.versionCode}"
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
}
return version
}
/** /**
* 判断是否有网络连接 * 判断是否有网络连接
......
...@@ -277,18 +277,18 @@ ...@@ -277,18 +277,18 @@
app:layout_constraintTop_toTopOf="@id/tv_wifi_name_text" /> app:layout_constraintTop_toTopOf="@id/tv_wifi_name_text" />
<TextView <TextView
android:id="@+id/tv_net_ip_text" android:id="@+id/tv_log_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:text="网络IP" android:text="日志名称"
android:textColor="@color/color_333333" android:textColor="@color/color_333333"
android:textSize="30sp" android:textSize="30sp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_wifi_name_text" /> app:layout_constraintTop_toBottomOf="@id/tv_wifi_name_text" />
<TextView <TextView
android:id="@+id/tv_net_ip" android:id="@+id/tv_log"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="right" android:gravity="right"
...@@ -296,7 +296,7 @@ ...@@ -296,7 +296,7 @@
android:textColor="@color/color_333333" android:textColor="@color/color_333333"
android:textSize="30sp" android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_net_ip_text" /> app:layout_constraintTop_toTopOf="@id/tv_log_text" />
<TextView <TextView
android:id="@+id/tv_print_type_text" android:id="@+id/tv_print_type_text"
...@@ -307,7 +307,7 @@ ...@@ -307,7 +307,7 @@
android:textColor="@color/color_333333" android:textColor="@color/color_333333"
android:textSize="30sp" android:textSize="30sp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_net_ip_text" /> app:layout_constraintTop_toBottomOf="@id/tv_log_text" />
<TextView <TextView
android:id="@+id/tv_print_type" android:id="@+id/tv_print_type"
......
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