Commit ab794788 by 王宇航

1.5.1

1、修復接收到消息還會顯示超時的問題
2、去除OrderInfoBean和FoodInfoBean的id字段,不由用戶端賦值
parent 34d78140
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</deviceKey> </deviceKey>
</Target> </Target>
</runningDeviceTargetSelectedWithDropDown> </runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-05-29T08:01:27.843382700Z" /> <timeTargetWasSelectedWithDropDown value="2024-05-30T02:36:04.118903400Z" />
</State> </State>
</entry> </entry>
</value> </value>
......
...@@ -31,7 +31,7 @@ class MainActivity : Activity() { ...@@ -31,7 +31,7 @@ class MainActivity : Activity() {
tvConnect.isClickable = false tvConnect.isClickable = false
connect = GingerSoftConnect() connect = GingerSoftConnect()
msgSender = connect!!.connect( msgSender = connect!!.connect(
"192.168.1.19", "192.168.1.12",
12581, 12581,
object : GingerSoftConnect.SocketStateListener { object : GingerSoftConnect.SocketStateListener {
override fun onOpen() { override fun onOpen() {
...@@ -74,6 +74,7 @@ class MainActivity : Activity() { ...@@ -74,6 +74,7 @@ class MainActivity : Activity() {
pax = 10 pax = 10
senderId = 1965.toString() senderId = 1965.toString()
senderName = "Glen$count" senderName = "Glen$count"
tableName = "餐檯$count"
sendTime = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Date()) sendTime = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Date())
sendDeviceId = "6464646sdfs" sendDeviceId = "6464646sdfs"
sendDeviceName = "POS$count" sendDeviceName = "POS$count"
...@@ -86,7 +87,7 @@ class MainActivity : Activity() { ...@@ -86,7 +87,7 @@ class MainActivity : Activity() {
foodId = "${1 + i}" foodId = "${1 + i}"
printId = "1166$i" printId = "1166$i"
orderId = 1111L + count orderId = 1111L + count
foodName = "這是一個名字超級長的食品" foodName = "這是一個名字超級長的食品$i"
quantity = count.toString() quantity = count.toString()
price = count * 1.1 price = count * 1.1
type = (i % 3) + 1 type = (i % 3) + 1
......
...@@ -55,7 +55,7 @@ afterEvaluate { ...@@ -55,7 +55,7 @@ afterEvaluate {
groupId = "com.gingersoft.connect" groupId = "com.gingersoft.connect"
artifactId = "Connect" artifactId = "Connect"
version = "1.5.0" version = "1.5.1"
// 添加 POM 配置 // 添加 POM 配置
// pom { // pom {
// name.set("GingerSoftConnect") // name.set("GingerSoftConnect")
......
package com.gingersoft.connect.bean; package com.gingersoft.connect.bean;
public class FoodInfoBean { public class FoodInfoBean {
private Long id;
/** /**
* 食品id * 食品id
*/ */
...@@ -40,14 +39,6 @@ public class FoodInfoBean { ...@@ -40,14 +39,6 @@ public class FoodInfoBean {
*/ */
private boolean isPrintRedLetter; private boolean isPrintRedLetter;
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getFoodId() { public String getFoodId() {
return this.foodId; return this.foodId;
} }
......
...@@ -3,7 +3,6 @@ package com.gingersoft.connect.bean; ...@@ -3,7 +3,6 @@ package com.gingersoft.connect.bean;
import java.util.List; import java.util.List;
public class OrderInfoBean implements SendMsgType { public class OrderInfoBean implements SendMsgType {
private Long id;
/** /**
* 訂單ID * 訂單ID
*/ */
...@@ -65,14 +64,6 @@ public class OrderInfoBean implements SendMsgType { ...@@ -65,14 +64,6 @@ public class OrderInfoBean implements SendMsgType {
*/ */
private List<FoodInfoBean> foodInfoBeanList; private List<FoodInfoBean> foodInfoBeanList;
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public Long getOrderId() { public Long getOrderId() {
return this.orderId; return this.orderId;
} }
......
...@@ -31,8 +31,10 @@ class MyWebSocketClient( ...@@ -31,8 +31,10 @@ class MyWebSocketClient(
val bean = GsonUtils.GsonToBean(message, SocketCallbackBean::class.java) val bean = GsonUtils.GsonToBean(message, SocketCallbackBean::class.java)
Log.e("eeeaaa", "客戶端收到消息:$message") Log.e("eeeaaa", "客戶端收到消息:$message")
if (bean != null && map.containsKey(bean.msgCode)) { if (bean != null && map.containsKey(bean.msgCode)) {
map[message]?.callback(bean.success, bean.statusCode, bean.errorMsg) map[bean.msgCode]?.callback(bean.success, bean.statusCode, bean.errorMsg)
timerMap[message]?.cancel() timerMap[bean.msgCode]?.cancel()
map.remove(bean.msgCode)
timerMap.remove(bean.msgCode)
} }
} }
...@@ -55,11 +57,13 @@ class MyWebSocketClient( ...@@ -55,11 +57,13 @@ class MyWebSocketClient(
timerMap[msgCode] = Timer() timerMap[msgCode] = Timer()
timerMap[msgCode]?.schedule(object : TimerTask() { timerMap[msgCode]?.schedule(object : TimerTask() {
override fun run() { override fun run() {
callback.callback( if (!cancel()) {
false, callback.callback(
MessageBuilder.ERROR_CODE_SEND_TIMEOUT, false,
"接收服務端響應超時" MessageBuilder.ERROR_CODE_SEND_TIMEOUT,
) "接收服務端響應超時"
)
}
} }
}, 10000) }, 10000)
} }
......
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