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

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