|
@@ -33,6 +33,7 @@ import com.grkj.ui_base.utils.event.LoadingEvent
|
|
|
import com.grkj.ui_base.utils.event.TicketFinishedEvent
|
|
import com.grkj.ui_base.utils.event.TicketFinishedEvent
|
|
|
import com.grkj.ui_base.utils.event.UpdateTicketProgressEvent
|
|
import com.grkj.ui_base.utils.event.UpdateTicketProgressEvent
|
|
|
import com.grkj.ui_base.utils.extension.serialNo
|
|
import com.grkj.ui_base.utils.extension.serialNo
|
|
|
|
|
+import com.grkj.ui_base.utils.extension.tip
|
|
|
import com.grkj.ui_base.utils.modbus.DeviceConst
|
|
import com.grkj.ui_base.utils.modbus.DeviceConst
|
|
|
import com.grkj.ui_base.utils.modbus.ModBusController
|
|
import com.grkj.ui_base.utils.modbus.ModBusController
|
|
|
import com.kongzue.dialogx.dialogs.PopTip
|
|
import com.kongzue.dialogx.dialogs.PopTip
|
|
@@ -125,7 +126,7 @@ object BleBusinessManager {
|
|
|
val keyBean = ModBusController.getKeyByMac(bleBean.bleDevice.mac)
|
|
val keyBean = ModBusController.getKeyByMac(bleBean.bleDevice.mac)
|
|
|
if (keyBean == null) {
|
|
if (keyBean == null) {
|
|
|
LoadingEvent.sendLoadingEvent("未找到钥匙信息", true)
|
|
LoadingEvent.sendLoadingEvent("未找到钥匙信息", true)
|
|
|
- PopTip.tip(R.string.key_not_exists)
|
|
|
|
|
|
|
+ PopTip.build().tip(R.string.key_not_exists)
|
|
|
} else {
|
|
} else {
|
|
|
LoadingEvent.sendLoadingEvent(
|
|
LoadingEvent.sendLoadingEvent(
|
|
|
CommonUtils.getStr(R.string.take_out_key_tip), true
|
|
CommonUtils.getStr(R.string.take_out_key_tip), true
|
|
@@ -138,7 +139,7 @@ object BleBusinessManager {
|
|
|
ModBusController.updateKeyReadyStatus(
|
|
ModBusController.updateKeyReadyStatus(
|
|
|
bleBean.bleDevice.mac, false, 1
|
|
bleBean.bleDevice.mac, false, 1
|
|
|
)
|
|
)
|
|
|
- PopTip.tip(R.string.take_out_key)
|
|
|
|
|
|
|
+ PopTip.build().tip(R.string.take_out_key)
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
logger.error("切换工作模式失败 : ${bleBean.bleDevice.mac}")
|
|
logger.error("切换工作模式失败 : ${bleBean.bleDevice.mac}")
|
|
@@ -234,7 +235,7 @@ object BleBusinessManager {
|
|
|
sendTicketWithRetry(bleBean.ticketSend!!, bleBean.bleDevice, isNeedLoading)
|
|
sendTicketWithRetry(bleBean.ticketSend!!, bleBean.bleDevice, isNeedLoading)
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- PopTip.tip(R.string.send_ticket_fail)
|
|
|
|
|
|
|
+ PopTip.build().tip(R.string.send_ticket_fail)
|
|
|
logger.error("Send ticket fail")
|
|
logger.error("Send ticket fail")
|
|
|
ModBusController.getKeyByMac(bleBean.bleDevice.mac)?.let { itKey ->
|
|
ModBusController.getKeyByMac(bleBean.bleDevice.mac)?.let { itKey ->
|
|
|
ModbusBusinessManager.removeDeviceTake(
|
|
ModbusBusinessManager.removeDeviceTake(
|
|
@@ -363,7 +364,7 @@ object BleBusinessManager {
|
|
|
}
|
|
}
|
|
|
if (role == null) {
|
|
if (role == null) {
|
|
|
ThreadUtils.runOnMain {
|
|
ThreadUtils.runOnMain {
|
|
|
- PopTip.tip(CommonUtils.getStr(R.string.you_are_not_locker_tip))
|
|
|
|
|
|
|
+ PopTip.build().tip(CommonUtils.getStr(R.string.you_are_not_locker_tip))
|
|
|
}
|
|
}
|
|
|
return@getTicketDetail
|
|
return@getTicketDetail
|
|
|
}
|
|
}
|
|
@@ -406,7 +407,7 @@ object BleBusinessManager {
|
|
|
// 故障模式
|
|
// 故障模式
|
|
|
0x03.toByte() -> {
|
|
0x03.toByte() -> {
|
|
|
// TODO 上报?
|
|
// TODO 上报?
|
|
|
- PopTip.tip(
|
|
|
|
|
|
|
+ PopTip.build().tip(
|
|
|
"${currentModeEvent.bleBean.bleDevice.mac} : " + "${CommonUtils.getStr(R.string.key_is_in_failure_mode)}"
|
|
"${currentModeEvent.bleBean.bleDevice.mac} : " + "${CommonUtils.getStr(R.string.key_is_in_failure_mode)}"
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
@@ -499,7 +500,7 @@ object BleBusinessManager {
|
|
|
}
|
|
}
|
|
|
logger.info("作业票信息:${workTicketGet}")
|
|
logger.info("作业票信息:${workTicketGet}")
|
|
|
if (workTicketGet == null) {
|
|
if (workTicketGet == null) {
|
|
|
- PopTip.tip(R.string.ticket_data_error)
|
|
|
|
|
|
|
+ PopTip.build().tip(R.string.ticket_data_error)
|
|
|
switchReadyMode(bleDevice)
|
|
switchReadyMode(bleDevice)
|
|
|
return@handleTicketStatus
|
|
return@handleTicketStatus
|
|
|
}
|
|
}
|
|
@@ -518,7 +519,7 @@ object BleBusinessManager {
|
|
|
TipDialog.show(
|
|
TipDialog.show(
|
|
|
msg = CommonUtils.getStr(R.string.key_return_tip)!!, onConfirmClick = {
|
|
msg = CommonUtils.getStr(R.string.key_return_tip)!!, onConfirmClick = {
|
|
|
LoadingEvent.sendLoadingEvent()
|
|
LoadingEvent.sendLoadingEvent()
|
|
|
- PopTip.tip(CommonUtils.getStr(R.string.continue_the_ticket))
|
|
|
|
|
|
|
+ PopTip.build().tip(CommonUtils.getStr(R.string.continue_the_ticket))
|
|
|
BleManager.getInstance().disconnect(bleDevice)
|
|
BleManager.getInstance().disconnect(bleDevice)
|
|
|
// 打开卡扣,防止初始化的时候选择不处理钥匙导致无法使用
|
|
// 打开卡扣,防止初始化的时候选择不处理钥匙导致无法使用
|
|
|
val dock = ModBusController.getDockByKeyMac(bleDevice.mac)
|
|
val dock = ModBusController.getDockByKeyMac(bleDevice.mac)
|
|
@@ -586,7 +587,7 @@ object BleBusinessManager {
|
|
|
TicketFinishedEvent.sendTicketFinishedEvent(it.toLong())
|
|
TicketFinishedEvent.sendTicketFinishedEvent(it.toLong())
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- PopTip.tip(R.string.key_return_success)
|
|
|
|
|
|
|
+ PopTip.build().tip(R.string.key_return_success)
|
|
|
} else {
|
|
} else {
|
|
|
//更新作业票的状态
|
|
//更新作业票的状态
|
|
|
val jobTicketData =
|
|
val jobTicketData =
|
|
@@ -595,7 +596,7 @@ object BleBusinessManager {
|
|
|
data.taskCode?.let {
|
|
data.taskCode?.let {
|
|
|
TicketFinishedEvent.sendTicketFinishedEvent(it.toLong())
|
|
TicketFinishedEvent.sendTicketFinishedEvent(it.toLong())
|
|
|
}
|
|
}
|
|
|
- PopTip.tip(R.string.key_return_success)
|
|
|
|
|
|
|
+ PopTip.build().tip(R.string.key_return_success)
|
|
|
return@updateKeyReturn
|
|
return@updateKeyReturn
|
|
|
}
|
|
}
|
|
|
val ticketStepDataVo =
|
|
val ticketStepDataVo =
|
|
@@ -642,7 +643,7 @@ object BleBusinessManager {
|
|
|
)
|
|
)
|
|
|
// 确认归还,切换为待机模式
|
|
// 确认归还,切换为待机模式
|
|
|
switchReadyMode(bleDevice)
|
|
switchReadyMode(bleDevice)
|
|
|
- PopTip.tip(R.string.key_return_success)
|
|
|
|
|
|
|
+ PopTip.build().tip(R.string.key_return_success)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
@@ -650,7 +651,7 @@ object BleBusinessManager {
|
|
|
// 当前策略:作业票未完成禁止归还钥匙
|
|
// 当前策略:作业票未完成禁止归还钥匙
|
|
|
fun keyReturnErrorConfirm() {
|
|
fun keyReturnErrorConfirm() {
|
|
|
LoadingEvent.sendLoadingEvent()
|
|
LoadingEvent.sendLoadingEvent()
|
|
|
- PopTip.tip(R.string.continue_the_ticket)
|
|
|
|
|
|
|
+ PopTip.build().tip(R.string.continue_the_ticket)
|
|
|
// 打开卡扣,防止初始化的时候选择不处理钥匙导致无法使用
|
|
// 打开卡扣,防止初始化的时候选择不处理钥匙导致无法使用
|
|
|
if (workTicketGet.data?.all { it.dataList?.all { it.closed == 1 } == true } == true) {
|
|
if (workTicketGet.data?.all { it.dataList?.all { it.closed == 1 } == true } == true) {
|
|
|
workTicketGet.data?.firstOrNull()?.taskCode?.toLong()?.let {
|
|
workTicketGet.data?.firstOrNull()?.taskCode?.toLong()?.let {
|
|
@@ -709,7 +710,7 @@ object BleBusinessManager {
|
|
|
it.userId == MainDomainData.userInfo?.userId && currentStep?.currentUserCanConfirm() == true
|
|
it.userId == MainDomainData.userInfo?.userId && currentStep?.currentUserCanConfirm() == true
|
|
|
}
|
|
}
|
|
|
if (role == null) {
|
|
if (role == null) {
|
|
|
- PopTip.tip(R.string.you_are_not_locker_tip)
|
|
|
|
|
|
|
+ PopTip.build().tip(R.string.you_are_not_locker_tip)
|
|
|
return@getTicketDetail
|
|
return@getTicketDetail
|
|
|
}
|
|
}
|
|
|
if (currentStep?.enableLock == true) { // 上锁工作票
|
|
if (currentStep?.enableLock == true) { // 上锁工作票
|