feat(activity): 为 MasterScaleActivity 各秤格子新增清零点击事件,修复高频数据更新导致点击失效的问题

This commit is contained in:
2026-04-16 13:45:39 +08:00
parent b775b20ff1
commit 7fd2f02b87
2 changed files with 194 additions and 36 deletions
@@ -141,12 +141,13 @@ object ScaleServiceManager {
* @param deviceId 目标设备 ID
* @param address 目标秤地址
*/
fun sendTare(deviceId: String, address: Int) {
if (deviceId == GlobalData.deviceId) {
fun sendTare(deviceId: String, address: Int): Boolean {
return if (deviceId == GlobalData.deviceId) {
com.shuwei.dish.match.utils.WeightUtil.tareTwo(address)
true
} else {
val cmd = ScaleCommand(ScaleCommand.CMD_TARE, deviceId, address)
wsClient?.sendCommand(deviceId, cmd)
wsClient?.sendCommand(deviceId, cmd) ?: false
}
}