feat: opt 板箱过磅 print
This commit is contained in:
@@ -21,9 +21,11 @@ import com.lukouguoji.module_base.ktx.noNull
|
||||
import com.lukouguoji.module_base.ktx.showToast
|
||||
import com.lukouguoji.module_base.ktx.toRequestBody
|
||||
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
|
||||
import com.lukouguoji.module_base.model.BluetoothDialogModel
|
||||
import com.lukouguoji.module_base.model.ScanModel
|
||||
import com.lukouguoji.module_base.util.Common
|
||||
import com.lukouguoji.module_base.util.DictUtils
|
||||
import com.lukouguoji.module_base.util.PrinterUtils
|
||||
import dev.utils.app.info.KeyValue
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.Calendar
|
||||
@@ -333,6 +335,12 @@ class GjcBoxWeighingAddViewModel : BaseViewModel() {
|
||||
onSuccess = { result ->
|
||||
if (result.verifySuccess()) {
|
||||
showToast("添加成功")
|
||||
|
||||
// 如果勾选了打印挂签,则执行打印
|
||||
if (printTag.value == true) {
|
||||
executePrint()
|
||||
}
|
||||
|
||||
// 发送刷新事件
|
||||
viewModelScope.launch {
|
||||
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).emit("refresh")
|
||||
@@ -345,6 +353,19 @@ class GjcBoxWeighingAddViewModel : BaseViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行打印
|
||||
*/
|
||||
private fun executePrint() {
|
||||
val bean = dataBean.value ?: return
|
||||
|
||||
// 使用 BluetoothDialogModel 选择打印机并打印
|
||||
BluetoothDialogModel()
|
||||
.showCallBack {
|
||||
PrinterUtils.printGjcBoxWeighing(bean)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理扫码结果
|
||||
*/
|
||||
|
||||
@@ -389,7 +389,7 @@
|
||||
<CheckBox
|
||||
android:id="@+id/cbPrint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_toStartOf="@+id/btnReset"
|
||||
|
||||
Reference in New Issue
Block a user