1.添加--添加TemperatureStatus状态 CN=4 中文数据\n2.添加--康达.parse_vaule添加检测中文正则表达式.\n3.修改--event_sync_service 同步ocr数据时,添加中文检测,有中文数据不写入Temperature表.\n4.删除--删除同步机器人数据时多余的输出
This commit is contained in:
parent
458eb2c973
commit
739380d6fc
@ -286,19 +286,20 @@ class EventSyncService:
|
||||
|
||||
|
||||
|
||||
if len(values) > 0:
|
||||
if len(values) > 0 and len(values) < 3:
|
||||
|
||||
status = self.kangda.parse_value(values)
|
||||
|
||||
# 插入temperature表数据
|
||||
temperature = Temperature(
|
||||
eventId=image.eventId,
|
||||
imageId=image.imageId,
|
||||
temperature = ",".join(values),
|
||||
confidence = ",".join(map(str, conf)),
|
||||
status = status.value
|
||||
)
|
||||
session.add(temperature)
|
||||
if status.value != 4:
|
||||
# 插入temperature表数据
|
||||
temperature = Temperature(
|
||||
eventId=image.eventId,
|
||||
imageId=image.imageId,
|
||||
temperature = ",".join(values),
|
||||
confidence = ",".join(map(str, conf)),
|
||||
status = status.value
|
||||
)
|
||||
session.add(temperature)
|
||||
|
||||
# # 异常消息.--- 现改为统一发送消息
|
||||
# if status.value != 0:
|
||||
|
||||
@ -85,8 +85,8 @@ class WebSocketClient:
|
||||
|
||||
# 机器人状态消息
|
||||
elif self._process_robot_status(message_dict):
|
||||
print("处理机器人状态消息...")
|
||||
print(f"{datetime.now()}收到消息: {message}") # 只打印前100个字符
|
||||
# print("处理机器人状态消息...")
|
||||
# print(f"{datetime.now()}收到消息: {message}") # 只打印前100个字符
|
||||
await self.event_sync_service.sync_robot_status(message_dict)
|
||||
|
||||
# await run_sync_event(t)
|
||||
|
||||
@ -392,6 +392,7 @@ class Kangda:
|
||||
# 定义正则表达式模式
|
||||
temperature_pattern = re.compile(r'^[+-]?\d+\.\d+C$') # 匹配温度数据
|
||||
al_pattern = re.compile(r'^AL\d+$') # 匹配AL后跟数字
|
||||
cn_pattern = re.compile(r'[\u4e00-\u9fff]') # 判断是否有中文
|
||||
|
||||
start = self.config["temperature_range"]["start"]
|
||||
end = self.config["temperature_range"]["end"]
|
||||
@ -399,8 +400,11 @@ class Kangda:
|
||||
status = list()
|
||||
|
||||
for value in values:
|
||||
if cn_pattern.match(value):
|
||||
status.append(TemperatureStatus.CN)
|
||||
|
||||
# 检查是否为正常数据
|
||||
if temperature_pattern.match(value):
|
||||
elif temperature_pattern.match(value):
|
||||
# 处理温度数据
|
||||
temp_str = value[:-1] # 去掉末尾的'C'
|
||||
try:
|
||||
@ -417,8 +421,9 @@ class Kangda:
|
||||
else:
|
||||
status.append(TemperatureStatus.BLURRY)
|
||||
|
||||
|
||||
if TemperatureStatus.UNNORMAL in status:
|
||||
if TemperatureStatus.CN in status:
|
||||
return TemperatureStatus.CN
|
||||
elif TemperatureStatus.UNNORMAL in status:
|
||||
return TemperatureStatus.UNNORMAL
|
||||
elif TemperatureStatus.BLURRY in status:
|
||||
return TemperatureStatus.BLURRY
|
||||
|
||||
@ -8,6 +8,7 @@ class TemperatureStatus(Enum):
|
||||
UNNORMAL = 1 # 温度值异常
|
||||
ALDATE = 2 # AL53数据
|
||||
BLURRY = 3 # 图片模糊--读数异常
|
||||
CN = 4 # 中文数据
|
||||
|
||||
@unique
|
||||
class EventType(Enum):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user