fix: SerialNet 下发目标端口改为设备UDP 4900
This commit is contained in:
@@ -8,6 +8,10 @@ UDP_MSG_PORT = int(os.getenv("EDC_UDP_MSG_PORT", "5505"))
|
|||||||
TCP_PORT = int(os.getenv("EDC_TCP_PORT", "5550"))
|
TCP_PORT = int(os.getenv("EDC_TCP_PORT", "5550"))
|
||||||
BIND_HOST = os.getenv("EDC_BIND_HOST", "0.0.0.0")
|
BIND_HOST = os.getenv("EDC_BIND_HOST", "0.0.0.0")
|
||||||
|
|
||||||
|
# 设备端接收端口
|
||||||
|
DEVICE_UDP_PORT = int(os.getenv("EDC_DEVICE_UDP_PORT", "4900"))
|
||||||
|
DEVICE_TCP_PORT = int(os.getenv("EDC_DEVICE_TCP_PORT", "5550"))
|
||||||
|
|
||||||
# MySQL
|
# MySQL
|
||||||
MYSQL_HOST = os.getenv("EDC_MYSQL_HOST", "127.0.0.1")
|
MYSQL_HOST = os.getenv("EDC_MYSQL_HOST", "127.0.0.1")
|
||||||
MYSQL_PORT = int(os.getenv("EDC_MYSQL_PORT", "3306"))
|
MYSQL_PORT = int(os.getenv("EDC_MYSQL_PORT", "3306"))
|
||||||
|
|||||||
@@ -376,12 +376,13 @@ async def _send_serialnet_cmd(device_id: str, dnt_id: int, record: dict):
|
|||||||
|
|
||||||
# 获取设备 IP 和 msgport
|
# 获取设备 IP 和 msgport
|
||||||
dnt = await get_dnt_by_serial(device_id)
|
dnt = await get_dnt_by_serial(device_id)
|
||||||
if not dnt or not dnt.get("ip") or not dnt.get("msgport"):
|
if not dnt or not dnt.get("ip"):
|
||||||
logger.warning(f"设备 {device_id} 无 IP/msgport 信息,跳过")
|
logger.warning(f"设备 {device_id} 无 IP 信息,跳过")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
from src.config import DEVICE_UDP_PORT
|
||||||
send_pkg = record["send_pkg"]
|
send_pkg = record["send_pkg"]
|
||||||
addr = (dnt["ip"], dnt["msgport"])
|
addr = (dnt["ip"], DEVICE_UDP_PORT)
|
||||||
|
|
||||||
# 构造 SerialNet JSON
|
# 构造 SerialNet JSON
|
||||||
msg = {
|
msg = {
|
||||||
|
|||||||
Reference in New Issue
Block a user