You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
147 lines
4.0 KiB
147 lines
4.0 KiB
5 months ago
|
using HybirdFrameworkCore.Autofac.Attribute;
|
||
|
using HybirdFrameworkDriver.TcpServer;
|
||
|
using Service.Charger.Codec;
|
||
|
using Service.Charger.Handler;
|
||
|
using Service.Charger.Msg;
|
||
|
|
||
|
namespace Service.Charger.Server;
|
||
|
|
||
|
[Scope]
|
||
|
public class PlcServer : TcpServer<IBaseHandler, Decoder,Encoder>
|
||
|
{
|
||
|
#region send
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送初始化命令
|
||
|
/// </summary>
|
||
|
/// <param name="sn">Plc编号</param>
|
||
|
/// <param name="msg">消息</param>
|
||
|
public void SendInitializeCommandReq(string sn, Msg.Host.Req.InitializeCommandReq msg)
|
||
|
{
|
||
|
SessionMgr.GetSession(sn).Send(msg);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送出库命令
|
||
|
/// </summary>
|
||
|
/// <param name="sn">Plc编号</param>
|
||
|
/// <param name="msg">消息</param>
|
||
|
public void SendOutboundCommandReq(string sn, Msg.Host.Req.OutboundCommandReq msg)
|
||
|
{
|
||
|
SessionMgr.GetSession(sn).Send(msg);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送开始换电命令
|
||
|
/// </summary>
|
||
|
/// <param name="sn">Plc编号</param>
|
||
|
/// <param name="msg">消息</param>
|
||
|
public void SendStartBatterySwapReq(string sn, Msg.Host.Req.StartBatterySwapReq msg)
|
||
|
{
|
||
|
SessionMgr.GetSession(sn).Send(msg);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送开始搬电命令
|
||
|
/// </summary>
|
||
|
/// <param name="sn">Plc编号</param>
|
||
|
/// <param name="msg">消息</param>
|
||
|
public void SendStartMovElectricityReq(string sn, Msg.Host.Req.StartMovElectricityReq msg)
|
||
|
{
|
||
|
SessionMgr.GetSession(sn).Send(msg);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送车辆型号
|
||
|
/// </summary>
|
||
|
/// <param name="sn">Plc编号</param>
|
||
|
/// <param name="msg">消息</param>
|
||
|
public void SendVehicleModelReq(string sn, Msg.Host.Req.VehicleModelReq msg)
|
||
|
{
|
||
|
SessionMgr.GetSession(sn).Send(msg);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送移库命令
|
||
|
/// </summary>
|
||
|
/// <param name="sn">Plc编号</param>
|
||
|
/// <param name="msg">消息</param>
|
||
|
public void SendMoveCommandReq(string sn, Msg.Host.Req.MoveCommandReq msg)
|
||
|
{
|
||
|
SessionMgr.GetSession(sn).Send(msg);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送继续命令
|
||
|
/// </summary>
|
||
|
/// <param name="sn">Plc编号</param>
|
||
|
/// <param name="msg">消息</param>
|
||
|
public void SendContinueCommandReq(string sn, Msg.Host.Req.ContinueCommandReq msg)
|
||
|
{
|
||
|
SessionMgr.GetSession(sn).Send(msg);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送暂停命令
|
||
|
/// </summary>
|
||
|
/// <param name="sn">Plc编号</param>
|
||
|
/// <param name="msg">消息</param>
|
||
|
public void SendPauseCommandReq(string sn, Msg.Host.Req.PauseCommandReq msg)
|
||
|
{
|
||
|
SessionMgr.GetSession(sn).Send(msg);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送入库命令
|
||
|
/// </summary>
|
||
|
/// <param name="sn">Plc编号</param>
|
||
|
/// <param name="msg">消息</param>
|
||
|
public void SendInboundCommandsReq(string sn, Msg.Host.Req.InboundCommandsReq msg)
|
||
|
{
|
||
|
SessionMgr.GetSession(sn).Send(msg);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送终止命令
|
||
|
/// </summary>
|
||
|
/// <param name="sn">Plc编号</param>
|
||
|
/// <param name="msg">消息</param>
|
||
|
public void SendTerminationOrderReq(string sn, Msg.Host.Req.TerminationOrderReq msg)
|
||
|
{
|
||
|
SessionMgr.GetSession(sn).Send(msg);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送故障复位命令
|
||
|
/// </summary>
|
||
|
/// <param name="sn">Plc编号</param>
|
||
|
/// <param name="msg">消息</param>
|
||
|
public void SendFaultResetReq(string sn, Msg.Host.Req.FaultResetReq msg)
|
||
|
{
|
||
|
SessionMgr.GetSession(sn).Send(msg);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送参数设置
|
||
|
/// </summary>
|
||
|
/// <param name="sn">Plc编号</param>
|
||
|
/// <param name="msg">消息</param>
|
||
|
public void SendParameterSettingsReq(string sn, Msg.Host.Req.ParameterSettingsReq msg)
|
||
|
{
|
||
|
SessionMgr.GetSession(sn).Send(msg);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 发送准备电池开启
|
||
|
/// </summary>
|
||
|
/// <param name="sn">Plc编号</param>
|
||
|
/// <param name="msg">消息</param>
|
||
|
public void SendPrepareBatteryOnReq(string sn, Msg.Host.Req.PrepareBatteryOnReq msg)
|
||
|
{
|
||
|
SessionMgr.GetSession(sn).Send(msg);
|
||
|
}
|
||
|
|
||
|
|
||
|
#endregion
|
||
|
}
|