rifd 音柱调试

master
lxw 1 week ago
parent df071df52f
commit 1c03c42753

@ -22,7 +22,7 @@ public class PadarMgr
PadarClient client = AppInfo.Container.Resolve<PadarClient>();
client.AutoReconnect = true;
//client.InitBootstrap("192.168.3.55", int.Parse("2048"));
client.InitBootstrap("127.0.0.1", int.Parse("2048"), 10,0, 0);
client.InitBootstrap("192.168.3.52", int.Parse("2048"), 10,0, 0);
Task.Run(() =>
{
client.Connect();

@ -34,7 +34,7 @@ public static class ClientMgr
NetAddr = "192.168.3.20",
NetPort = "2000",
//NetPort = "10000",
Code = PlcConst.ChargeEqpCode,
Code = PlcConst.PlcEqpCode,
DestAddr = "132,208,208,224"
};
Log.Info($"begin to connect {netInfo.Code} {netInfo.NetAddr}:{netInfo.NetPort}");
@ -43,7 +43,7 @@ public static class ClientMgr
Log.Info($"plc client Id={PlcClient.GetHashCode()}");
PlcClient.AutoReconnect = true;
PlcClient.Sn = PlcConst.ChargeEqpCode;
PlcClient.Sn = PlcConst.PlcEqpCode;
PlcClient.ConnectedEventHandler += (sender, b) =>
{
PlcClient.SessionAttr(netInfo.Code, netInfo.DestAddr);

@ -523,7 +523,7 @@ public class PlcClient : TcpClient<IBaseHandler, Decoder, Encoder>
/// <param name="destAddr"></param>
public void SessionAttr(string sn, string destAddr)
{
ChannelUtils.AddAttr(Channel, PlcConst.ChargerSn, sn);
ChannelUtils.AddAttr(Channel, PlcConst.PlcSn, sn);
ChannelUtils.AddAttr(Channel, PlcConst.EqmTypeNo, sn);
ChannelUtils.AddAttr(Channel, PlcConst.EqmCode, sn);
ChannelUtils.AddAttr(Channel, PlcConst.DestAddr, destAddr);

@ -5,11 +5,11 @@ namespace Service.Charger.Client;
public class PlcConst
{
public static string ChargeEqpCode = "565002033910Q6F00001";
public static string PlcEqpCode = "565002033910Q6F00001";
public static byte[] StartChar =new byte[] { 0x68 };
// public static string ChargerSn = "";
public static readonly AttributeKey<string> ChargerSn = AttributeKey<string>.ValueOf("charger_sn");
public static readonly AttributeKey<string> PlcSn = AttributeKey<string>.ValueOf("plc_sn");
public static readonly AttributeKey<string> EqmTypeNo = AttributeKey<string>.ValueOf("eqm_type_no");
public static readonly AttributeKey<string> EqmCode = AttributeKey<string>.ValueOf("eqm_code");
public static readonly AttributeKey<string> DestAddr = AttributeKey<string>.ValueOf("dest_addr");

@ -42,7 +42,7 @@ public class Decoder : ByteToMessageDecoder
protected override void Decode(IChannelHandlerContext context, IByteBuffer buffer, List<object> output)
{
string? chargerSn = ChannelUtils.GetAttr(context.Channel, PlcConst.ChargerSn);
string? chargerSn = ChannelUtils.GetAttr(context.Channel, PlcConst.PlcSn);
IByteBuffer? delimiter = FindDelimiter(buffer);
if (delimiter != null)
{

@ -14,7 +14,7 @@ public class PlcServer : TcpServer<IBaseHandler, Decoder,Encoder>
{
#region send
private string sn = PlcConst.ChargeEqpCode;
private string sn = PlcConst.PlcEqpCode;
/// <summary>
/// 发送初始化命令
/// </summary>

@ -1,6 +1,9 @@
using Autofac;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac;
using Microsoft.AspNetCore.Mvc;
using Repository.Station;
using Service.Sound.SoundClient;
using SqlSugar;
namespace WebStarter.Controllers.Test;
@ -46,35 +49,7 @@ public class GenController : ControllerBase
[HttpGet("test115")]
public void Test115()
{
var group = new BatteryGroup()
{
BatteryNo = "1",
Group = 1,
};
var batteryGroup = new BatteryGroup()
{
BatteryNo = "2",
Group = 2,
};
var groups = new List<BatteryGroup>() { group, batteryGroup };
_batteryGroupRepository.Insert(groups);
BatteryGroup batteryGroups = _batteryGroupRepository.QueryByClause(i => i.Group == 1);
/*
/*BatteryGroup batteryGroup = batteryGroups[0];
_batteryGroupRepository.Delete(batteryGroup);
BatteryGroup batteryGroup1 = batteryGroups[1];
batteryGroup1.Group = 3;
_batteryGroupRepository.Update(batteryGroup1);#1#
if (batteryGroups == null)
{
Console.WriteLine();
}
else
{
Console.WriteLine();
}
*/
AppInfo.Container.Resolve<SoundClient>().SoundPlay(SoundEnum.music100);
Console.WriteLine("测试完毕");
}

Loading…
Cancel
Save