服务角色职能
角色 | 车道代理 | 车道监控 | 浏览器 |
---|---|---|---|
作业 | 接收或修改服务缓存 | 修改发送至指定车道 | <= |
车道 | 接收或修改服务缓存 | 修改发送至指定车道 | <= |
指令 | 接收 | 发送至指定车道 | <= |
车道列表缓存 | / | 接收 | <= |
流程逻辑
Paste_Image.png车道代理接入
接收部分
监听获取lane
hub.On("reciveLane",data)
data数据格式
#js
data:
{
lane_code:string,
send_time:string,
lane:object
}
#csharp
public class Pf_Message_lane_Object
{
public string lane_code { get; set; }
public string send_time { get; set; }
public object lane { get; set; }
}
监听获取directive
hub.On("reciveDirective",data)
data数据格式
#js
data
{
directive_id:string,
lane_code:string,
lane_name:string,
directive_code:string,
parameters : string [],
send_time: string
}
#csharp
public class pf_Message_Directive
{
public string directive_id { get; set; }
public string lane_code { get; set; }
public string lane_name { get; set; }
public string directive_code { get; set; }
public string[] parameters { get; set; }
public string send_time { get; set; }
}
监听获取queue
hub.On("reciveQueue",data)
data数据格式
#js
data
{
lane_code:string,
lane_name:string,
action: string ,
create_time: string,
send_time : string,
queue: object
}
#csharp
public class Pf_Messge_Queue_Object
{
public string lane_code { get; set; }
public string queue_id { get; set; }
public string action { get; set; }
public string create_time { get; set; }
public string send_time { get; set; }
public object queue { get; set; }
}
发送部分
修改消息服务中的缓存
hub.Invoke("Change",lane_code,message)
message数据格式
#js
message
{
message_type:string
message_content: object
}
#csharp
public class Pf_Message_Obj<T> where T :new()
{
/// <summary>
/// 消息类型 指令或状态或作业
/// </summary>
public string message_type { get; set; }
/// <summary>
/// 消息内容
/// </summary>
public object message_content { get; set; }
public Pf_Message_Obj(string type, T content)
{
message_type = type;
message_content = content;
}
}
车道监控接入
接收部分
获取车道缓存列表
Csharp
Hub.On("GetLaneList",data)
JS
proxy.client.GetLaneList=function(data){ //处理data }
#js
data:[
object,
object,
object
]
#cahsrp
List<Lane> lanes = new List<Lane>()
public class Lane
{
public string lane_code { get; set; }
public string lane_name { get; set; }
public string country_code { get; set; }
public string city_code { get; set; }
public string terminal_code { get; set; }
public string direction { get; set; }
public bool has_truck { get; set; }
public string lane_type { get; set; }
public string led_display { get; set; }
public string barrier { get; set; }
public string update_time { get; set; }
}
获取会话列表
Csharp
hub.On("GetSessionList",data)
JS
proxy.client.GetSessionList=function(data){//处理data}
数据定义
#js
data
[
{
ConnectionID:string,
IPAddress:string,
Port:string,
ClientType:string,
ClientName:string,
ConnectionTime:string
},
{
ConnectionID:string,
IPAddress:string,
Port:string,
ClientType:string,
ClientName:string,
ConnectionTime:string
},
{
ConnectionID:string,
IPAddress:string,
Port:string,
ClientType:string,
ClientName:string,
ConnectionTime:string
},
]
#csharp
public class SessionObj
{
/// <summary>
/// 连接ID
/// </summary>
public string ConnectionID { get; set; }
/// <summary>
/// IP地址
/// </summary>
public string IPAddress { get; set; }
/// <summary>
/// 端口
/// </summary>
public string Port { get; set; }
/// <summary>
/// 会话对象类型
/// </summary>
public string ClientType { get; set; }
/// <summary>
/// 会话对象
/// </summary>
public string ClientName { get; set; }
/// <summary>
/// 首次连接时间。
/// </summary>
public string ConnectionTime { get; set; }
}
获取作业列表
Csharp
hub.on("GetQueueList",data)
JS
proxy.client.GetQueueList=function(data){//data}
数据定义
#js
data
[
{
lane_code:string,
lane_name:string,
queue_id:string,
is_lock:bool,
lock_time:string,
user:string,
start_time:string,
end_time:string,
truck_no:string,
ocr_truck_no:string,
rfid_card_no:string,
total_weight:string,
ic_card_no:string,
container_amount:int,
damage_check_amount:int,
damage_part_amount:int,
submit_amount:int,
truck_pic_url:string,
truck_crop_pic_url :string,
front_top_pic_url :string,
back_top_pic_url:string,
left_front_pic_url:string,
left_back_pic_url :string,
right_front_pic_url:string,
right_back_pic_url :string,
left_damage_pic_url:string,
right_damage_pic_url :string,
top_damage_pic_url :string,
processes:object[],
containers :object[],
update_time:string
},
{
lane_code:string,
lane_name:string,
queue_id:string,
is_lock:bool,
lock_time:string,
user:string,
start_time:string,
end_time:string,
truck_no:string,
ocr_truck_no:string,
rfid_card_no:string,
total_weight:string,
ic_card_no:string,
container_amount:int,
damage_check_amount:int,
damage_part_amount:int,
submit_amount:int,
truck_pic_url:string,
truck_crop_pic_url :string,
front_top_pic_url :string,
back_top_pic_url:string,
left_front_pic_url:string,
left_back_pic_url :string,
right_front_pic_url:string,
right_back_pic_url :string,
left_damage_pic_url:string,
right_damage_pic_url :string,
top_damage_pic_url :string,
processes:object[],
containers :object[],
update_time:string
}
................
]
#csharp
List<Queue> queues = new List<Queue>();
public class Queue
{
public string lane_code { get; set; }
public string lane_name { get; set; }
public string queue_id { get; set; }
public bool is_lock { get; set; }
public string lock_time { get; set; }
public string user { get; set; }
public string start_time { get; set; }
public string end_time { get; set; }
public string truck_no { get; set; }
public string orc_truck_no { get; set; }
public string rfid_truck_no { get; set; }
public string total_weight { get; set; }
public string ic_card_no { get; set; }
public int container_amount { get; set; }
public int damage_check_amount { get; set; }
public int damage_part_amount { get; set; }
public int submit_amount { get; set; }
public string truck_pic_url { get; set; }
public string truck_crop_pic_url { get; set; }
public string front_top_pic_url { get; set; }
public string back_top_pic_url { get; set; }
public string left_front_pic_url { get; set; }
public string left_back_pic_url { get; set; }
public string right_front_pic_url { get; set; }
public string right_back_pic_url { get; set; }
public string left_damage_pic_url { get; set; }
public string right_damage_pic_url { get; set; }
public string top_damage_pic_url { get; set; }
public Queue_Progress[] processes { get; set; }
public Queue_Container[] containers { get; set; }
public string update_time { get; set; }
}
发送部分
Csharp
hub.Invoke("SendMessage",lane_code,message)
JS
hub.server.SendMessage(lane_code,message)
数据定义
#js
message
{
message_type:string,
message_content:object
}
#补充:message_content 的三种类型
public class Pf_Message_lane_Object
{
public string lane_code { get; set; }
public string send_time { get; set; }
public object lane { get; set; }
}
public class Pf_Messge_Queue_Object
{
public string lane_code { get; set; }
public string queue_id { get; set; }
public string action { get; set; }
public string create_time { get; set; }
public string send_time { get; set; }
public object queue { get; set; }
}
public class pf_Message_Directive
{
public string directive_id { get; set; }
public string lane_code { get; set; }
public string lane_name { get; set; }
public string directive_code { get; set; }
public string[] parameters { get; set; }
public string send_time { get; set; }
}
#csharp
public class Pf_Message_Obj<T> where T :new()
{
/// <summary>
/// 消息类型 指令或状态或作业
/// </summary>
public string message_type { get; set; }
/// <summary>
/// 消息内容
/// </summary>
public object message_content { get; set; }
public Pf_Message_Obj(string type, T content)
{
message_type = type;
message_content = content;
}
}
网友评论