Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
31f191cf4d
|
|
@ -6,7 +6,7 @@ from typing import List
|
|||
import grpc
|
||||
|
||||
from app.global_source import g_config
|
||||
|
||||
from google.protobuf.json_format import MessageToDict
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../proto')))
|
||||
from proto import phase_server_pb2_grpc, phase_server_pb2
|
||||
|
||||
|
|
@ -101,6 +101,7 @@ def GetQueryCrossPhaseRelativeOffset(citycode: int = 0, crossids: List[str] = []
|
|||
finally:
|
||||
channel.close()
|
||||
|
||||
|
||||
#更新单绿波配时方案时段与路口配时方案时段对比异常状态
|
||||
def QueryGreenWaveCrossPhaseTpCheck(waveid: str, citycode: int):
|
||||
stub, channel = channel_stub()
|
||||
|
|
@ -113,12 +114,44 @@ def QueryGreenWaveCrossPhaseTpCheck(waveid: str, citycode: int):
|
|||
channel.close()
|
||||
|
||||
|
||||
def QueryCrossRunningPhase(citycode: int, crossids: [], date_list:[], tp=''):
|
||||
def QueryCrossRunningPhase(citycode: int, crossids: [], date_list: [], tp=''):
|
||||
"""
|
||||
路口运行中配时方案
|
||||
"""
|
||||
stub, channel = channel_stub()
|
||||
try:
|
||||
request_params = phase_server_pb2.CrossRunningPhaseRequest(citycode=citycode, crossids=crossids, date_list=date_list, tp=tp)
|
||||
request_params = phase_server_pb2.CrossRunningPhaseRequest(citycode=citycode, crossids=crossids,
|
||||
date_list=date_list, tp=tp)
|
||||
return stub.CrossRunningPhase(request_params, timeout=30), None
|
||||
except Exception as e:
|
||||
return None, e
|
||||
finally:
|
||||
channel.close()
|
||||
|
||||
|
||||
def QueryCrossPhaseDiagnosis(citycode: int, crossid: str, date_list: List, tp: str, area_id: int):
|
||||
"""
|
||||
路口配时方案诊断
|
||||
返回dict: {},None
|
||||
如果报错返回: None, error
|
||||
example:
|
||||
response , error = QueryCrossPhaseDiagnosis(citycode,crossid,[20251010], "07:00-07:20", 350101)
|
||||
if error:
|
||||
print(error)
|
||||
return f"{error}"
|
||||
|
||||
if len(response) > 0:
|
||||
print(response)
|
||||
"""
|
||||
stub, channel = channel_stub()
|
||||
try:
|
||||
request_params = phase_server_pb2.CrossPhaseDiagnosisRequest(citycode=citycode, crossid=crossid,
|
||||
date_list=date_list, tp=tp, area_id=area_id)
|
||||
response = stub.CrossPhaseDiagnosis(request_params, timeout=30)
|
||||
if response.code != 0:
|
||||
raise Exception(response.msg)
|
||||
return MessageToDict(response.data), None
|
||||
except Exception as e:
|
||||
return None, e
|
||||
finally:
|
||||
channel.close()
|
||||
|
|
|
|||
Loading…
Reference in New Issue