计算时附加电缆产品信息
This commit is contained in:
+10
-9
@@ -4,7 +4,7 @@ import time
|
||||
import base64
|
||||
import socket
|
||||
import httpx
|
||||
from config import *
|
||||
|
||||
from PySide6.QtCore import Signal, Slot,QObject,QMetaObject,Qt,QTimer
|
||||
from Manager.product_manager import productManager
|
||||
from Manager.history_manager import historyManager
|
||||
@@ -42,7 +42,7 @@ class MQTTClient(QObject):
|
||||
self.remote_client = mqtt.Client(client_id=device_id) # 创建远程客户端
|
||||
self.device_client = mqtt.Client(client_id = 'controller_dev_' + self.random_string(6)) # 创建设备客户端
|
||||
self.m_clienttimestamp = 0
|
||||
self.cur_product_id = "C8111D73-F387-981D-18D5-849816E1793C"
|
||||
|
||||
# 设置回调函数
|
||||
self.local_client.on_connect = self.on_connect
|
||||
self.local_client.on_message = self.on_message
|
||||
@@ -246,7 +246,7 @@ class MQTTClient(QObject):
|
||||
if json_obj.get("value") == "true":
|
||||
cid = json_obj.get("cid")
|
||||
print("Follow,",cid)
|
||||
self.send_current_product(self.cur_product_id)
|
||||
self.send_current_product(productManager.cur_product_id)
|
||||
elif method == "input":
|
||||
key = json_obj.get("key")
|
||||
value = json_obj.get("value")
|
||||
@@ -303,10 +303,11 @@ class MQTTClient(QObject):
|
||||
self.send_products()
|
||||
|
||||
elif method == "currentProduct":
|
||||
self.cur_product_id = json_obj.get("id")
|
||||
print(f"Current product id: {self.cur_product_id}")
|
||||
self.send_current_product(self.cur_product_id)
|
||||
self.send_current_product_id(self.cur_product_id)
|
||||
cur_product_id = json_obj.get("id")
|
||||
print(f"Current product id: {cur_product_id}")
|
||||
self.send_current_product(cur_product_id)
|
||||
self.send_current_product_id(cur_product_id)
|
||||
productManager.setCurProductId(cur_product_id)
|
||||
|
||||
elif method == "loadHistoryList":
|
||||
cid = json_obj.get("cid")
|
||||
@@ -571,10 +572,10 @@ class MQTTClient(QObject):
|
||||
def send_products(self):
|
||||
"""发送产品信息"""
|
||||
data = dict()
|
||||
data["current_id"] = self.cur_product_id
|
||||
data["current_id"] = productManager.cur_product_id
|
||||
data["method"] = "productList"
|
||||
data["infos"] = productManager.getInfo()
|
||||
print(f"Current product id: {self.cur_product_id}")
|
||||
print(f"Current product id: {productManager.cur_product_id}")
|
||||
self.publish_cpy(TOPICPRODUCT, data, 1) # 发布设备信息
|
||||
|
||||
def start_ys(self, flag):
|
||||
|
||||
Reference in New Issue
Block a user