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.
153 lines
4.1 KiB
153 lines
4.1 KiB
using HybirdFrameworkCore.Autofac.Attribute;
|
|
using HybirdFrameworkCore.Entity;
|
|
using HybirdFrameworkDriver.TcpServer;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Service.Charger.Client;
|
|
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
|
|
|
|
private string sn = PlcConst.ChargeEqpCode;
|
|
/// <summary>
|
|
/// 发送初始化命令
|
|
/// </summary>
|
|
/// <param name="sn">Plc编号</param>
|
|
/// <param name="msg">消息</param>
|
|
public void SendInitializeCommandReq(Msg.Host.Req.InitializeCommandReq msg)
|
|
{
|
|
SessionMgr.GetSession(sn)?.Send(msg);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 发送出库命令
|
|
/// </summary>
|
|
/// <param name="sn">Plc编号</param>
|
|
/// <param name="msg">消息</param>
|
|
public void SendOutboundCommandReq(Msg.Host.Req.OutboundCommandReq msg)
|
|
{
|
|
SessionMgr.GetSession(sn)?.Send(msg);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 发送开始换电命令
|
|
/// </summary>
|
|
/// <param name="sn">Plc编号</param>
|
|
/// <param name="msg">消息</param>
|
|
public void SendStartBatterySwapReq(Msg.Host.Req.StartBatterySwapReq msg)
|
|
{
|
|
SessionMgr.GetSession(sn)?.Send(msg);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 发送开始搬电命令
|
|
/// </summary>
|
|
/// <param name="sn">Plc编号</param>
|
|
/// <param name="msg">消息</param>
|
|
public void SendStartMovElectricityReq(Msg.Host.Req.StartMovElectricityReq msg)
|
|
{
|
|
SessionMgr.GetSession(sn)?.Send(msg);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 发送车辆型号
|
|
/// </summary>
|
|
/// <param name="sn">Plc编号</param>
|
|
/// <param name="msg">消息</param>
|
|
public void SendVehicleModelReq(Msg.Host.Req.VehicleModelReq msg)
|
|
{
|
|
SessionMgr.GetSession(sn)?.Send(msg);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 发送移库命令
|
|
/// </summary>
|
|
/// <param name="sn">Plc编号</param>
|
|
/// <param name="msg">消息</param>
|
|
public void SendMoveCommandReq(Msg.Host.Req.MoveCommandReq msg)
|
|
{
|
|
SessionMgr.GetSession(sn)?.Send(msg);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 发送继续命令
|
|
/// </summary>
|
|
/// <param name="sn">Plc编号</param>
|
|
/// <param name="msg">消息</param>
|
|
public void SendContinueCommandReq(Msg.Host.Req.ContinueCommandReq msg)
|
|
{
|
|
SessionMgr.GetSession(sn)?.Send(msg);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 发送暂停命令
|
|
/// </summary>
|
|
/// <param name="sn">Plc编号</param>
|
|
/// <param name="msg">消息</param>
|
|
public void SendPauseCommandReq(Msg.Host.Req.PauseCommandReq msg)
|
|
{
|
|
SessionMgr.GetSession(sn)?.Send(msg);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 发送入库命令
|
|
/// </summary>
|
|
/// <param name="sn">Plc编号</param>
|
|
/// <param name="msg">消息</param>
|
|
public void SendInboundCommandsReq(Msg.Host.Req.InboundCommandsReq msg)
|
|
{
|
|
|
|
SessionMgr.GetSession(sn)?.Send(msg);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 发送终止命令
|
|
/// </summary>
|
|
/// <param name="sn">Plc编号</param>
|
|
/// <param name="msg">消息</param>
|
|
public void SendTerminationOrderReq(Msg.Host.Req.TerminationOrderReq msg)
|
|
{
|
|
SessionMgr.GetSession(sn)?.Send(msg);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 发送故障复位命令
|
|
/// </summary>
|
|
/// <param name="sn">Plc编号</param>
|
|
/// <param name="msg">消息</param>
|
|
public void SendFaultResetReq(Msg.Host.Req.FaultResetReq msg)
|
|
{
|
|
SessionMgr.GetSession(sn)?.Send(msg);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 发送参数设置
|
|
/// </summary>
|
|
/// <param name="sn">Plc编号</param>
|
|
/// <param name="msg">消息</param>
|
|
public void SendParameterSettingsReq(Msg.Host.Req.ParameterSettingsReq msg)
|
|
{
|
|
SessionMgr.GetSession(sn)?.Send(msg);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 发送准备电池开启
|
|
/// </summary>
|
|
/// <param name="sn">Plc编号</param>
|
|
/// <param name="msg">消息</param>
|
|
public void SendPrepareBatteryOnReq(Msg.Host.Req.PrepareBatteryOnReq msg)
|
|
{
|
|
SessionMgr.GetSession(sn)?.Send(msg);
|
|
}
|
|
|
|
|
|
#endregion
|
|
}
|