diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs index 5bb970e..b0192a7 100644 --- a/Service/Execute/Step/StationReadyState.cs +++ b/Service/Execute/Step/StationReadyState.cs @@ -129,7 +129,7 @@ public class StationReadyState : IState }, () => { - SoundClient = AppInfo.Container.Resolve(); + SoundClient = AppInfo.Container.Resolve(); //SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address25")); if (a == 0) { diff --git a/Service/Padar/Client/PadarMgr.cs b/Service/Padar/Client/PadarMgr.cs index 11b5518..2a2736e 100644 --- a/Service/Padar/Client/PadarMgr.cs +++ b/Service/Padar/Client/PadarMgr.cs @@ -22,7 +22,7 @@ public class PadarMgr PadarClient client = AppInfo.Container.Resolve(); 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(); diff --git a/Service/Plc/Client/ClientMgr.cs b/Service/Plc/Client/ClientMgr.cs index f7836d1..8216017 100644 --- a/Service/Plc/Client/ClientMgr.cs +++ b/Service/Plc/Client/ClientMgr.cs @@ -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); diff --git a/Service/Plc/Client/PlcClient.cs b/Service/Plc/Client/PlcClient.cs index 3911482..0a2fa9f 100644 --- a/Service/Plc/Client/PlcClient.cs +++ b/Service/Plc/Client/PlcClient.cs @@ -523,7 +523,7 @@ public class PlcClient : TcpClient /// 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); diff --git a/Service/Plc/Client/PlcConst.cs b/Service/Plc/Client/PlcConst.cs index c1b6e1d..439e8a4 100644 --- a/Service/Plc/Client/PlcConst.cs +++ b/Service/Plc/Client/PlcConst.cs @@ -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 ChargerSn = AttributeKey.ValueOf("charger_sn"); + public static readonly AttributeKey PlcSn = AttributeKey.ValueOf("plc_sn"); public static readonly AttributeKey EqmTypeNo = AttributeKey.ValueOf("eqm_type_no"); public static readonly AttributeKey EqmCode = AttributeKey.ValueOf("eqm_code"); public static readonly AttributeKey DestAddr = AttributeKey.ValueOf("dest_addr"); diff --git a/Service/Plc/Codec/Decoder.cs b/Service/Plc/Codec/Decoder.cs index 094314f..977db66 100644 --- a/Service/Plc/Codec/Decoder.cs +++ b/Service/Plc/Codec/Decoder.cs @@ -42,7 +42,7 @@ public class Decoder : ByteToMessageDecoder protected override void Decode(IChannelHandlerContext context, IByteBuffer buffer, List output) { - string? chargerSn = ChannelUtils.GetAttr(context.Channel, PlcConst.ChargerSn); + string? chargerSn = ChannelUtils.GetAttr(context.Channel, PlcConst.PlcSn); IByteBuffer? delimiter = FindDelimiter(buffer); if (delimiter != null) { diff --git a/Service/Plc/Server/PlcServer.cs b/Service/Plc/Server/PlcServer.cs index 7285e39..feb2f51 100644 --- a/Service/Plc/Server/PlcServer.cs +++ b/Service/Plc/Server/PlcServer.cs @@ -14,7 +14,7 @@ public class PlcServer : TcpServer { #region send - private string sn = PlcConst.ChargeEqpCode; + private string sn = PlcConst.PlcEqpCode; /// /// 发送初始化命令 /// diff --git a/WebStarter/Controllers/Test/GenController.cs b/WebStarter/Controllers/Test/GenController.cs index d520c7e..f1c099e 100644 --- a/WebStarter/Controllers/Test/GenController.cs +++ b/WebStarter/Controllers/Test/GenController.cs @@ -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() { 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().SoundPlay(SoundEnum.music100); Console.WriteLine("测试完毕"); }