diff --git a/Repository/Repository.csproj b/Repository/Repository.csproj
index 21979fd..e47b41c 100644
--- a/Repository/Repository.csproj
+++ b/Repository/Repository.csproj
@@ -7,6 +7,7 @@
+
diff --git a/Repository/Station/BinInfoRepository.cs b/Repository/Station/BinInfoRepository.cs
index 14ad7df..adb72e6 100644
--- a/Repository/Station/BinInfoRepository.cs
+++ b/Repository/Station/BinInfoRepository.cs
@@ -2,6 +2,8 @@ using Entity.Constant;
using Entity.DbModel.Station;
using Entity.Dto;
using HybirdFrameworkCore.Autofac.Attribute;
+using log4net;
+using Newtonsoft.Json;
using SqlSugar;
namespace Repository.Station;
@@ -9,6 +11,7 @@ namespace Repository.Station;
[Scope("SingleInstance")]
public class BinInfoRepository : BaseRepository
{
+ private static readonly ILog _log = LogManager.GetLogger(typeof(BinInfoRepository));
public BinInfoRepository(ISqlSugarClient sqlSugar) : base(sqlSugar)
{
}
@@ -19,55 +22,65 @@ public class BinInfoRepository : BaseRepository
/// StaticStationInfo.SwapSoc
/// StaticStationInfo.SwapFinishChargeTime
///
- public SelectPackDto SelectPack(int swapSoc, int swapFinishChargeTime)
+ public SelectPackDto SelectPack(int swapSoc, int swapFinishChargeTime, string upMoveNo=default)
{
+ _log.Info($"BinInfoRepository SelectPack swapSoc={swapSoc}, swapFinishChargeTime={swapFinishChargeTime},upMoveNo={upMoveNo}");
SelectPackDto selectPackDto = new()
{
SuccessFlag = false,
};
List list =
- QueryListByClause(i => i.CacheBinFlag == 0 && i.CanSwapFlag==1 &&
+ QueryListByClause(i => i.CanSwapFlag == 1 &&
i.Exists == 1 && i.Status == 1 && i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock,
"in_time asc");
- BinInfo? cacheBinBattery = ChooseCacheBinBattery();
- if (list.Count <= 0 && cacheBinBattery == null)
+ _log.Info($"BinInfoRepository SelectPack list1={JsonConvert.SerializeObject(list)}");
+
+ // BinInfo? cacheBinBattery = ChooseCacheBinBattery(swapSoc);
+
+ if (list.Count <= 0)
{
+ _log.Info($"list1 return");
selectPackDto.Info = InfoEnum.SelectBinStatusInfo.NoBattery;
return selectPackDto;
}
- list = list.Where(i => i.ChargeStatus == 2 || i.ChargeStatus==4).ToList();
- if (list.Count <= 0 && cacheBinBattery == null)
+ list = list.OrderBy(i => i.CacheBinFlag).ToList();
+
+ _log.Info($"BinInfoRepository SelectPack list2={JsonConvert.SerializeObject(list)}");
+ if (!string.IsNullOrWhiteSpace(upMoveNo))
+ {
+
+ list = list.Where(i => !upMoveNo.Equals(i.No) && i.No != "" && i.No != "-1").ToList();
+ _log.Info($"BinInfoRepository SelectPack list3={JsonConvert.SerializeObject(list)},upMoveNo={upMoveNo}");
+ }
+
+ list = list.Where(i => i.ChargeStatus == 2 || i.ChargeStatus == 4).ToList();
+ if (list.Count <= 0)
{
selectPackDto.Info = InfoEnum.SelectBinStatusInfo.LessOfFinishCharging;
return selectPackDto;
}
- list = list.Where(i => i.Soc != null && i.Soc >= swapSoc).ToList();
- if (list.Count <= 0 && cacheBinBattery == null)
+ list = list.Where(i => i.Soc != null &&i.Soc >= swapSoc).ToList();
+ if (list.Count <= 0)
{
selectPackDto.Info = InfoEnum.SelectBinStatusInfo.LessOfSoc;
return selectPackDto;
}
- list = list.Where(i => i.LastChargeFinishTime != null && new TimeSpan(DateTime.Now.Ticks -
+
+ /*list = list.Where(i => i.LastChargeFinishTime != null || new TimeSpan(DateTime.Now.Ticks -
i.LastChargeFinishTime.ToDateTime().Ticks)
.TotalMinutes > swapFinishChargeTime).ToList();
- if (list.Count <= 0 && cacheBinBattery == null)
- {
- selectPackDto.Info = InfoEnum.SelectBinStatusInfo.LessOf3Minute;
+ if (list.Count <= 0)
+ { selectPackDto.Info = InfoEnum.SelectBinStatusInfo.LessOf3Minute;
return selectPackDto;
- }
+ }*/
+
+
+ selectPackDto.BinInfo = list[0];
- if (list.Count > 0)
- {
- selectPackDto.BinInfo = list[0];
- }
- else
- {
- selectPackDto.BinInfo = cacheBinBattery;
- }
selectPackDto.Info = InfoEnum.SelectBinStatusInfo.Success;
selectPackDto.SuccessFlag = true;
@@ -87,4 +100,4 @@ public class BinInfoRepository : BaseRepository
QueryByClause(i => i.CacheBinFlag == 1 && i.CanSwapFlag==1 &&
i.Exists == 1 && i.Status == 1 && i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock);
}
-}
\ No newline at end of file
+}
diff --git a/Service/Charger/Client/ClientMgr.cs b/Service/Charger/Client/ClientMgr.cs
index b0ecf68..935bd66 100644
--- a/Service/Charger/Client/ClientMgr.cs
+++ b/Service/Charger/Client/ClientMgr.cs
@@ -1,11 +1,7 @@
-using System.Collections.Concurrent;
-using Autofac;
-using Common.Const;
-using DotNetty.Transport.Channels;
+using Autofac;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Autofac.Attribute;
-using HybirdFrameworkDriver.Session;
using log4net;
using Service.Charger.Server;
@@ -19,53 +15,12 @@ public static class ClientMgr
{
private static readonly ILog Log = LogManager.GetLogger(typeof(ClientMgr));
- public static readonly ConcurrentDictionary Dictionary = new();
-
- public static PlcClient? GetBySn(string sn)
- {
- Dictionary.TryGetValue(sn, out var o);
- return o;
- }
-
- ///
- /// 通过channel获取client
- ///
- ///
- ///
- /// 获取不到,client则为空
- ///
- public static bool TryGetClient(IChannel channel, out string sn, out PlcClient? client)
- {
- string? snt = ChannelUtils.GetAttr(channel, PlcConst.ChargerSn);
-
- if (!string.IsNullOrWhiteSpace(snt))
- {
- var chargerClient = GetBySn(snt);
- if (chargerClient != null)
- {
- sn = snt;
- client = chargerClient;
- return true;
- }
- }
-
- sn = string.Empty;
- client = null;
- return false;
- }
-
- public static void AddBySn(string sn, PlcClient client)
- {
- Dictionary[sn] = client;
- }
+ public static PlcClient? PlcClient { get; set; }
//TODO 连接、鉴权,开始充电,结束充电,设置尖峰平谷,读取尖峰平谷,发送功率调节指令,发送辅助源控制指令,下发掉线停止充电,
public static void InitClient()
{
- Task.Run(() =>
- {
- ConnClient();
- });
+ Task.Run(ConnClient);
}
private static void ConnClient()
@@ -79,39 +34,33 @@ public static class ClientMgr
DestAddr = "132,208,208,224"
};
Log.Info($"begin to connect {netInfo.Code} {netInfo.NetAddr}:{netInfo.NetPort}");
- PlcClient client = AppInfo.Container.Resolve();
- client.AutoReconnect = true;
- //Plc编号
- client.Sn = PlcConst.ChargeEqpCode;
- //电池仓编号
- //client.BinNo = binInfo?.No;
- //client.BatteryNo = binInfo?.BatteryNo;
- client.LogName = "Charger" + netInfo.Code;
- client.ConnectedEventHandler += (sender, b) =>
+ PlcClient = AppInfo.Container.Resolve();
+ PlcClient.AutoReconnect = true;
+ PlcClient.Sn = PlcConst.ChargeEqpCode;
+ PlcClient.ConnectedEventHandler += (sender, b) =>
{
- client.SessionAttr(netInfo.Code, netInfo.DestAddr);
+ PlcClient.SessionAttr(netInfo.Code, netInfo.DestAddr);
//鉴权
// client.SendAuth();
};
//ip
- client.InitBootstrap(netInfo.NetAddr, int.Parse(netInfo.NetPort));
+ PlcClient.InitBootstrap(netInfo.NetAddr, int.Parse(netInfo.NetPort));
/*Task.Run(() =>
{*/
try
{
- client.Connect();
- client.SessionAttr(netInfo.Code, netInfo.DestAddr);
+ PlcClient.Connect();
+ PlcClient.SessionAttr(netInfo.Code, netInfo.DestAddr);
Log.Info($"succeed to connect {netInfo.Code} {netInfo.NetAddr}:{netInfo.NetPort}");
}
catch (Exception ex)
{
-
+ Log.Error($"conn plc error ={ex.StackTrace}");
}
//});
- AddBySn(netInfo.Code, client);
Log.Info($"begin to connect {netInfo.Code} {netInfo.NetAddr}:{netInfo.NetPort}");
}
}
diff --git a/Service/Charger/Client/PlcClient.cs b/Service/Charger/Client/PlcClient.cs
index c9b5ee1..1f4fdee 100644
--- a/Service/Charger/Client/PlcClient.cs
+++ b/Service/Charger/Client/PlcClient.cs
@@ -2,12 +2,10 @@ using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Entity;
using HybirdFrameworkDriver.Session;
using HybirdFrameworkDriver.TcpClient;
-using HybirdFrameworkDriver.TcpServer;
using log4net;
using Service.Charger.Client;
using Service.Charger.Codec;
using Service.Charger.Handler;
-using Service.Charger.Msg;
using Service.Charger.Msg.Host.Req;
namespace Service.Charger.Server;
@@ -22,6 +20,11 @@ public class PlcClient : TcpClient
/// Plc编号
///
public string Sn { get; set; }
+
+ public bool SwapDone { get; set; }
+
+ public bool DisassembleDone { get; set; }
+
#endregion
#region send
@@ -38,7 +41,7 @@ public class PlcClient : TcpClient
return Result.Fail($"Plc{Sn}未连接");
}
InitializeCommandReq req = new InitializeCommandReq();
-
+
this.Channel.WriteAndFlushAsync(req);
return Result.Success();
}
@@ -295,6 +298,11 @@ public class PlcClient : TcpClient
+ public void Reset()
+ {
+ SwapDone = false;
+ DisassembleDone = false;
+ }
private ILog Log()
{
var name = "Charger" + this.Sn;
diff --git a/Service/Charger/Handler/BatteryPackDisassembledReqHandler.cs b/Service/Charger/Handler/BatteryPackDisassembledReqHandler.cs
index bbac8bf..ef0ba86 100644
--- a/Service/Charger/Handler/BatteryPackDisassembledReqHandler.cs
+++ b/Service/Charger/Handler/BatteryPackDisassembledReqHandler.cs
@@ -1,11 +1,9 @@
using DotNetty.Transport.Channels;
using HybirdFrameworkCore.Autofac.Attribute;
-using HybirdFrameworkCore.Utils;
using log4net;
-using Newtonsoft.Json;
+using Service.Charger.Client;
using Service.Charger.Msg.Charger.Req;
-using Service.Charger.Msg.Charger.Resp;
-
+using Service.Charger.Msg.Host.Resp;
namespace Service.Charger.Handler;
@@ -20,14 +18,7 @@ public class BatteryPackDisassembledReqHandler : SimpleChannelInboundHandler
///
///
- private static ILog Log(string? sn)
- {
- if (ObjUtils.IsNotNullOrWhiteSpace(sn))
- {
- return LogManager.GetLogger("Charger" + sn);
- }
- return LogManager.GetLogger(typeof(BatteryPackDisassembledReqHandler));
- }
+ private static readonly ILog Log = LogManager.GetLogger(typeof(BatteryPackDisassembledReqHandler));
///
@@ -35,10 +26,7 @@ public class BatteryPackDisassembledReqHandler : SimpleChannelInboundHandler
protected override void ChannelRead0(IChannelHandlerContext ctx, BatteryPackDisassembledReq msg)
{
- if (Client.ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client))
- {
- Log(sn).Info($"process {JsonConvert.SerializeObject(msg)}");
- ctx.Channel.WriteAndFlushAsync(new Msg.Host.Resp.BatteryPackDisassembledResq());
- }
+ ClientMgr.PlcClient.DisassembleDone = true;
+ ctx.Channel.WriteAndFlushAsync(new BatteryPackDisassembledResq());
}
}
diff --git a/Service/Charger/Handler/BatteryStatusReportedReqHandler.cs b/Service/Charger/Handler/BatteryStatusReportedReqHandler.cs
index 6d4d90c..af24c4e 100644
--- a/Service/Charger/Handler/BatteryStatusReportedReqHandler.cs
+++ b/Service/Charger/Handler/BatteryStatusReportedReqHandler.cs
@@ -1,11 +1,9 @@
using DotNetty.Transport.Channels;
+using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac.Attribute;
-using HybirdFrameworkCore.Utils;
using log4net;
-using Newtonsoft.Json;
+using Repository.Station;
using Service.Charger.Msg.Charger.Req;
-using Service.Charger.Msg.Charger.Resp;
-
namespace Service.Charger.Handler;
@@ -17,17 +15,9 @@ namespace Service.Charger.Handler;
public class BatteryStatusReportedReqHandler : SimpleChannelInboundHandler, IBaseHandler
{
- ///
- ///
- ///
- private static ILog Log(string? sn)
- {
- if (ObjUtils.IsNotNullOrWhiteSpace(sn))
- {
- return LogManager.GetLogger("Charger" + sn);
- }
- return LogManager.GetLogger(typeof(BatteryStatusReportedReqHandler));
- }
+ private static readonly ILog Log =LogManager.GetLogger(typeof(BatteryStatusReportedReqHandler));
+
+ public BinInfoRepository BinInfoRepository { get; set; }
///
@@ -35,11 +25,33 @@ public class BatteryStatusReportedReqHandler : SimpleChannelInboundHandler
protected override void ChannelRead0(IChannelHandlerContext ctx, BatteryStatusReportedReq msg)
{
- if (Client.ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client))
- {
- Log(sn).Info($"process {JsonConvert.SerializeObject(msg)}");
- //TODO::
- //ctx.Channel.WriteAndFlushAsync("");
- }
+ UpdateBinInfo(msg.granary01, "1");
+ UpdateBinInfo(msg.granary02, "2");
+ UpdateBinInfo(msg.granary03, "3");
+ UpdateBinInfo(msg.granary04, "4");
+ UpdateBinInfo(msg.granary05, "5");
+ UpdateBinInfo(msg.granary06, "6");
+ UpdateBinInfo(msg.granary07, "7");
+ UpdateBinInfo(msg.granary08, "8");
+ }
+
+ private void UpdateBinInfo(int exists, string binNo)
+ {
+ if (exists == 0)
+ BinInfoRepository.Update(
+ it =>
+ new BinInfo(){
+ Exists = 0,
+ BatteryNo = "-1",
+ Soc = (decimal)-1,
+ Soe = (decimal)-1,
+ Soh = (decimal)-1,
+ },
+ it => it.No == binNo);
+ else
+
+ BinInfoRepository.Update(it => it.Exists == 1,
+ it => it.No == binNo);
+
}
}
diff --git a/Service/Charger/Handler/SwapBatteryFinishReqHandler.cs b/Service/Charger/Handler/SwapBatteryFinishReqHandler.cs
index 1b94a88..e66f183 100644
--- a/Service/Charger/Handler/SwapBatteryFinishReqHandler.cs
+++ b/Service/Charger/Handler/SwapBatteryFinishReqHandler.cs
@@ -1,11 +1,9 @@
using DotNetty.Transport.Channels;
using HybirdFrameworkCore.Autofac.Attribute;
-using HybirdFrameworkCore.Utils;
using log4net;
-using Newtonsoft.Json;
+using Service.Charger.Client;
using Service.Charger.Msg.Charger.Req;
-using Service.Charger.Msg.Charger.Resp;
-
+using Service.Charger.Msg.Host.Resp;
namespace Service.Charger.Handler;
@@ -17,17 +15,7 @@ namespace Service.Charger.Handler;
public class SwapBatteryFinishReqHandler : SimpleChannelInboundHandler, IBaseHandler
{
- ///
- ///
- ///
- private static ILog Log(string? sn)
- {
- if (ObjUtils.IsNotNullOrWhiteSpace(sn))
- {
- return LogManager.GetLogger("Charger" + sn);
- }
- return LogManager.GetLogger(typeof(SwapBatteryFinishReqHandler));
- }
+ private static readonly ILog Log = LogManager.GetLogger(typeof(SwapBatteryFinishReqHandler));
///
@@ -35,10 +23,8 @@ public class SwapBatteryFinishReqHandler : SimpleChannelInboundHandler
protected override void ChannelRead0(IChannelHandlerContext ctx, SwapBatteryFinishReq msg)
{
- if (Client.ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client))
- {
- Log(sn).Info($"process {JsonConvert.SerializeObject(msg)}");
- ctx.Channel.WriteAndFlushAsync(new Msg.Host.Resp.SwapBatteryFinishResq());
- }
+ Log.Info("swap finish");
+ ctx.Channel.WriteAndFlushAsync(new SwapBatteryFinishResq());
+ ClientMgr.PlcClient.SwapDone = true;
}
}
diff --git a/Service/Execute/Api/PlcApi.cs b/Service/Execute/Api/PlcApi.cs
index 9312621..0dfb23b 100644
--- a/Service/Execute/Api/PlcApi.cs
+++ b/Service/Execute/Api/PlcApi.cs
@@ -1,4 +1,5 @@
using log4net;
+using Service.Charger.Client;
using Service.Plc.Client;
namespace Service.Execute.Api;
@@ -110,10 +111,10 @@ public class PlcApi
{
Log.Info($"PlcApi StartSwapping param= inBinNo={inBinNo}, outBinNo={outBinNo}");
- var distributeTask = PlcMgr.DistributeTask(ushort.Parse(inBinNo), ushort.Parse(outBinNo), 1);
+ ClientMgr.PlcClient.SendStartBatterySwapReq(Convert.ToByte(outBinNo), Convert.ToByte(inBinNo));
- Log.Info($"PlcApi StartSwapping resp={distributeTask}");
- return distributeTask;
+ Log.Info($"PlcApi StartSwapping done");
+ return true;
}
diff --git a/Service/Execute/Step/CarPrepareState.cs b/Service/Execute/Step/CarPrepareState.cs
index 379ee8d..8b9b21d 100644
--- a/Service/Execute/Step/CarPrepareState.cs
+++ b/Service/Execute/Step/CarPrepareState.cs
@@ -41,12 +41,12 @@ public class CarPrepareState : IState
};
}
- //云平台车辆认证
- var cloudCheckVel = CloudCheckVel(machine);
- if (cloudCheckVel != InvokeStatus.Done)
- {
- return SwappingStateMachine.ReturnWithInvokeErr(cloudCheckVel, ExceptionReason.None);
- }
+ // 云平台车辆认证
+ // var cloudCheckVel = CloudCheckVel(machine);
+ // if (cloudCheckVel != InvokeStatus.Done)
+ // {
+ // return SwappingStateMachine.ReturnWithInvokeErr(cloudCheckVel, ExceptionReason.None);
+ // }
//TBox连接
if (StaticStationInfo.TboxStateConnect)
@@ -268,7 +268,7 @@ public class CarPrepareState : IState
bool isConnect = result.Result;
if (isConnect)
{
- //读取车辆carNo=carVin
+ //读取车辆carNo=carVin
Task carInfoResult = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
var tboxCarInfoModel = carInfoResult.Result;
var carInfo = tboxCarInfoModel?.CarInfo;
@@ -399,4 +399,4 @@ public class CarPrepareState : IState
}
, false, () => { }, 10, InvokeStatus.None);
}
-}
\ No newline at end of file
+}
diff --git a/Service/Execute/Step/DoSwappingState.cs b/Service/Execute/Step/DoSwappingState.cs
index a41c948..9022117 100644
--- a/Service/Execute/Step/DoSwappingState.cs
+++ b/Service/Execute/Step/DoSwappingState.cs
@@ -1,17 +1,13 @@
using Autofac;
-using Entity.Attr;
using Entity.Constant;
using HybirdFrameworkCore.Autofac;
using log4net;
-using Repository.Station;
+using Service.Charger.Client;
using Service.Execute.Api;
-using Service.Execute.Model;
using Service.Execute.Model.Tbox;
-using Service.Execute.StaticTools;
using Service.Execute.SwapException;
using Service.Execute.Utils;
using Service.Init;
-using Service.Station;
namespace Service.Execute.Step;
@@ -30,11 +26,11 @@ public class DoSwappingState : IState
//再次读锁止状态,防止plc需要挪车
- InvokeStatus carInPosition2 = CarInPosition2(machine);
- if (carInPosition2 != InvokeStatus.Done)
- {
- return SwappingStateMachine.ReturnWithInvokeErr(carInPosition2, ExceptionReason.None);
- }
+ //InvokeStatus carInPosition2 = CarInPosition2(machine);
+ //if (carInPosition2 != InvokeStatus.Done)
+ //{
+ // return SwappingStateMachine.ReturnWithInvokeErr(carInPosition2, ExceptionReason.None);
+ //}
//下发启动换电
@@ -44,19 +40,19 @@ public class DoSwappingState : IState
return SwappingStateMachine.ReturnWithInvokeErr(startSwapping, ExceptionReason.None);
}
- InvokeStatus holdOn = HoldOn(machine);
- if (holdOn != InvokeStatus.Done)
- {
- return SwappingStateMachine.ReturnWithInvokeErr(holdOn, ExceptionReason.None);
- }
+ //InvokeStatus holdOn = HoldOn(machine);
+ //if (holdOn != InvokeStatus.Done)
+ //{
+ // return SwappingStateMachine.ReturnWithInvokeErr(holdOn, ExceptionReason.None);
+ //}
//查看通道状态
- StateResult checkChannelStatus = CheckChannelStatus(machine);
- if (checkChannelStatus != null)
- {
- return checkChannelStatus;
- }
+ // StateResult checkChannelStatus = CheckChannelStatus(machine);
+ // if (checkChannelStatus != null)
+ // {
+ // return checkChannelStatus;
+ // }
//旧电池拆卸
InvokeStatus unPack = UnPack(machine);
@@ -66,18 +62,18 @@ public class DoSwappingState : IState
}
//旧电池搬运
- InvokeStatus oldBatteryCarryIn = OldBatteryCarryIn(machine);
- if (oldBatteryCarryIn != InvokeStatus.Done)
- {
- return SwappingStateMachine.ReturnWithInvokeErr(oldBatteryCarryIn, ExceptionReason.None);
- }
+ // InvokeStatus oldBatteryCarryIn = OldBatteryCarryIn(machine);
+ // if (oldBatteryCarryIn != InvokeStatus.Done)
+ // {
+ // return SwappingStateMachine.ReturnWithInvokeErr(oldBatteryCarryIn, ExceptionReason.None);
+ // }
//新电池搬运
- InvokeStatus newBatteryCarryOut = NewBatteryCarryOut(machine);
- if (newBatteryCarryOut != InvokeStatus.Done)
- {
- return SwappingStateMachine.ReturnWithInvokeErr(newBatteryCarryOut, ExceptionReason.None);
- }
+ // InvokeStatus newBatteryCarryOut = NewBatteryCarryOut(machine);
+ // if (newBatteryCarryOut != InvokeStatus.Done)
+ // {
+ // return SwappingStateMachine.ReturnWithInvokeErr(newBatteryCarryOut, ExceptionReason.None);
+ // }
//安装
InvokeStatus pack = Pack(machine);
@@ -87,19 +83,18 @@ public class DoSwappingState : IState
}
//安装完成
- InvokeStatus packFinish = PackFinish(machine);
- if (packFinish != InvokeStatus.Done)
- {
- return SwappingStateMachine.ReturnWithInvokeErr(packFinish, ExceptionReason.None);
- }
+ //InvokeStatus packFinish = PackFinish(machine);
+ //if (packFinish != InvokeStatus.Done)
+ //{
+ // return SwappingStateMachine.ReturnWithInvokeErr(packFinish, ExceptionReason.None);
+ //}
-
- //航车回归安全位置
- InvokeStatus toInvokeStatus = ToSafePosition(machine);
- if (toInvokeStatus != InvokeStatus.Done)
- {
- return SwappingStateMachine.ReturnWithInvokeErr(toInvokeStatus, ExceptionReason.None);
- }
+ ////航车回归安全位置
+ //InvokeStatus toInvokeStatus = ToSafePosition(machine);
+ //if (toInvokeStatus != InvokeStatus.Done)
+ //{
+ // return SwappingStateMachine.ReturnWithInvokeErr(toInvokeStatus, ExceptionReason.None);
+ //}
return new StateResult()
@@ -121,13 +116,11 @@ public class DoSwappingState : IState
bool unLock = result.Result;
if (unLock)
{
- //查询车辆锁止状态
var startSwapping = PlcApi.StartSwapping(machine.SwapOrderBatteryInfo.InBinInfo.No,
machine.SwapOrderBatteryInfo.UpBinInfo.No);
//查詢當前任務狀態是否被更改
- var readPlcTaskStatus = PlcApi.ReadTaskStatus(1);
- if (startSwapping && readPlcTaskStatus)
+ if (startSwapping)
{
machine.SwapOrder.SwapBeginTime = DateTime.Now;
_CommonMgr.UpdateSwapOrder(machine);
@@ -139,7 +132,7 @@ public class DoSwappingState : IState
}
}, () =>
{
- SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrStartSwap);
+ SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrStartSwap);
},false, () => { },10,InvokeStatus.None);
}
@@ -185,15 +178,7 @@ public class DoSwappingState : IState
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoUnPack.GetLed());
- int status = PlcApi.ReadPlcTaskStatus();
- //处理程序太快,plc还没有初始值的状态
- if (status == 1002 || status != 1003)
- {
- }
- else
- {
- machine.UnOldBatteryFlag = true;
- }
+ machine.UnOldBatteryFlag = ClientMgr.PlcClient.DisassembleDone;
if (machine.UnOldBatteryFlag)
{
@@ -240,7 +225,7 @@ public class DoSwappingState : IState
if (PlcApi.ReadPlcTaskStatus() == 1004)
{
-
+
}
else
{
@@ -263,14 +248,7 @@ public class DoSwappingState : IState
() => machine.InstallNewBatteryFlag, () =>
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPack.GetLed());
- if (PlcApi.ReadPlcTaskStatus() == 1005)
- {
-
- }
- else
- {
- machine.InstallNewBatteryFlag = true;
- }
+ machine.InstallNewBatteryFlag = ClientMgr.PlcClient.SwapDone;
if (machine.InstallNewBatteryFlag)
{
@@ -318,7 +296,7 @@ public class DoSwappingState : IState
() => machine.ToSafePositionFlag, () =>
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
-
+
if (PlcApi.ReadPlcTaskStatus() == 1007)
{
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition);
@@ -344,13 +322,13 @@ public class DoSwappingState : IState
int count = 0;
while (!machine.ChannelStatusOkFlag)
{
-
+
if (machine.CancelFlag)
{
_log.Info($" CheckChannelStatus canceled");
return StateResult.Cancel;
}
-
+
_log.Info("begin plc CheckChannelStatus");
Thread.Sleep(2000);
var channelStatus = PlcApi.ChannelStatus();
@@ -448,7 +426,7 @@ public class DoSwappingState : IState
succCount++;
}
}
-
+
if (succCount==successCount)
{
machine.VehiclesInPlace2Flag = true;
@@ -461,4 +439,4 @@ public class DoSwappingState : IState
}, false, () => { }
, 20, InvokeStatus.None);
}
-}
\ No newline at end of file
+}
diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs
index 580a8a1..70e31e4 100644
--- a/Service/Execute/Step/StationReadyState.cs
+++ b/Service/Execute/Step/StationReadyState.cs
@@ -1,19 +1,15 @@
-using System.Text;
-using Autofac;
-using Entity.Attr;
+using Autofac;
using Entity.Constant;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac;
using log4net;
using Newtonsoft.Json;
-using Repository.Station;
using Service.Execute.Api;
using Service.Execute.Model;
-using Service.Execute.StaticTools;
using Service.Execute.SwapException;
using Service.Execute.Utils;
using Service.Init;
-using Service.Station;
+using Service.Padar.Client;
using Swapping.Business.Common;
namespace Service.Execute.Step;
@@ -54,16 +50,6 @@ public class StationReadyState : IState
return SwappingStateMachine.ReturnWithInvokeErr(plcIsRemote, ExceptionReason.None);
}
-
- //监测雷达
- var entranceRadar = EntranceRadar(machine);
-
- if (InvokeStatus.Done != entranceRadar)
- {
- return SwappingStateMachine.ReturnWithInvokeErr(entranceRadar, ExceptionReason.None);
- }
-
-
//开始读rifd
var beginRfid = BeginRead(machine);
if (InvokeStatus.Done != beginRfid)
@@ -79,6 +65,20 @@ public class StationReadyState : IState
return SwappingStateMachine.ReturnWithInvokeErr(readRfid, ExceptionReason.ReadRfidError);
}
+ //开启雷达
+ var beginRadar = ControlRadar(machine, 1);
+ if (InvokeStatus.Done != beginRadar)
+ {
+ return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None);
+ }
+
+ //调整车辆
+ var adjustCarByRadar = AdjustCarByRadar(machine);
+ if (InvokeStatus.Done != adjustCarByRadar)
+ {
+ return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
+ }
+
return new StateResult()
{
SwappingState = SwappingState.CarPrepare,
@@ -130,6 +130,37 @@ public class StationReadyState : IState
}, true, () => { }, 5, InvokeStatus.None);
}
+ ///
+ /// 控制雷达启停
+ ///
+ ///
+ ///
+ ///
+ public InvokeStatus ControlRadar(SwappingStateMachine machine, byte flag)
+ {
+ return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, () => PadarMgr._PadarClient?.CarState > 0,
+ () =>
+ {
+ PadarMgr._PadarClient?.PadarControl(flag);
+ });
+ }
+
+ public InvokeStatus AdjustCarByRadar(SwappingStateMachine machine)
+ {
+ return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, () => PadarMgr._PadarClient?.CarState == 6,
+ () =>
+ {
+ switch (PadarMgr._PadarClient?.CarState)
+ {
+ case 1: _log.Info("radar 无车"); break;
+ case 2: _log.Info("radar 无电池");break;
+ case 3: _log.Info("radar 角度偏移过大");break;
+ case 4: _log.Info("radar 车辆靠后");break;
+ case 5: _log.Info("radar 车辆靠前");break;
+ }
+ });
+ }
+
public InvokeStatus EntranceRadar(SwappingStateMachine machine)
{
return Invoker.Invoke("wait entrance radar", 1000, 5, machine.IsCanceled,
@@ -211,9 +242,9 @@ public class StationReadyState : IState
Task rfidReadModel = RfidApi.ReadRfid();
rfidReadModel.Wait();
var machineRfidReadModel = rfidReadModel.Result;
-
-
- if ( rfidReadModel.IsCompletedSuccessfully && machineRfidReadModel != null
+
+
+ if ( rfidReadModel.IsCompletedSuccessfully && machineRfidReadModel != null
&& machineRfidReadModel.Result==1
&& !string.IsNullOrEmpty(machineRfidReadModel.VelVin))
{
@@ -260,4 +291,4 @@ public class StationReadyState : IState
return swapOrder;
}
-}
\ No newline at end of file
+}
diff --git a/Service/Execute/Step/SwapDoneState.cs b/Service/Execute/Step/SwapDoneState.cs
index d6081f1..90cf2bf 100644
--- a/Service/Execute/Step/SwapDoneState.cs
+++ b/Service/Execute/Step/SwapDoneState.cs
@@ -1,17 +1,13 @@
using Autofac;
-using Entity.Attr;
using Entity.Constant;
using HybirdFrameworkCore.Autofac;
using log4net;
-using Repository.Station;
using Service.Execute.Api;
-using Service.Execute.Model;
using Service.Execute.Model.Tbox;
-using Service.Execute.StaticTools;
using Service.Execute.SwapException;
using Service.Execute.Utils;
using Service.Init;
-using Service.Station;
+using Service.Padar.Client;
namespace Service.Execute.Step;
@@ -48,7 +44,7 @@ public class SwapDoneState : IState
Task.Run(() =>
{
//新增换电成功上报云平台数据
- _CommonMgr.InsertCloudReportForSwapSuccess(machine);
+ // _CommonMgr.InsertCloudReportForSwapSuccess(machine);
//换电成功关于bininfo表的更新
_CommonMgr.UpdateBinInfoForSwapSuccess(machine);
@@ -74,12 +70,17 @@ public class SwapDoneState : IState
}
//出口雷达监测
- InvokeStatus existRadar = ExistRadar(machine);
- if (existRadar != InvokeStatus.Done)
- {
- return SwappingStateMachine.ReturnWithInvokeErr(existRadar, ExceptionReason.None);
- }
-
+ InvokeStatus existRadar = ExistRadar(machine);
+ if (existRadar != InvokeStatus.Done)
+ {
+ return SwappingStateMachine.ReturnWithInvokeErr(existRadar, ExceptionReason.None);
+ }
+ //关闭雷达
+ var closeRadar = ControlRadar(machine, 0);
+ if (InvokeStatus.Done != closeRadar)
+ {
+ return SwappingStateMachine.ReturnWithInvokeErr(closeRadar, ExceptionReason.None);
+ }
return new StateResult()
{
@@ -87,6 +88,22 @@ public class SwapDoneState : IState
};
}
+
+ ///
+ /// 控制雷达启停
+ ///
+ ///
+ ///
+ ///
+ public InvokeStatus ControlRadar(SwappingStateMachine machine, byte flag)
+ {
+ return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, () => PadarMgr._PadarClient?.CarState > 0,
+ () =>
+ {
+ PadarMgr._PadarClient?.PadarControl(flag);
+ });
+ }
+
///
/// 车辆上锁
///
@@ -106,26 +123,18 @@ public class SwapDoneState : IState
if (carInfo.Result?.CarStatus?.LockStatus == 2)
{
machine.BoxCarInfoModel = carInfo.Result;
- //设置出口的是绿灯
- if (PlcApi.WriteExistLamp(1000))
+ SoundApi.PlayOneSound(machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
+ ? (int)InfoEnum.SwapInfo.InfoCarLeave
+ : (int)InfoEnum.SwapInfo.ErrInfoCarLeave);
+ machine.VelLockFlag = true;
+ //断连Tbox
+ if (StaticStationInfo.TboxStateDisConnect)
{
- /*machine.LedTool?.WriteProgramContent(
- machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
- ? InfoEnum.SwapInfo.InfoCarLeave.GetLed()
- : InfoEnum.SwapInfo.ErrInfoCarLeave.GetLed());*/
- SoundApi.PlayOneSound(machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
- ? (int)InfoEnum.SwapInfo.InfoCarLeave
- : (int)InfoEnum.SwapInfo.ErrInfoCarLeave);
- machine.VelLockFlag = true;
- //断连Tbox
- if (StaticStationInfo.TboxStateDisConnect)
- {
- TBoxApi.DisConnect(machine.BoxCarInfoModel.CarNo);
- }
-
- _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
- machine);
+ TBoxApi.DisConnect(machine.BoxCarInfoModel.CarNo);
}
+
+ _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
+ machine);
}
}
}, () =>
@@ -142,7 +151,9 @@ public class SwapDoneState : IState
return Invoker.Invoke("wait exist radar", 1000, 5, machine.IsCanceled, machine.IsManualSwapSucc,
() => machine.RadarOutFlag, () =>
{
- if (PlcApi.ExitRadar())
+
+
+ if (PadarMgr._PadarClient.CarState != 1)
{
_log.Info("exist radar false");
}
@@ -152,23 +163,20 @@ public class SwapDoneState : IState
_log.Info("exist radar true");
- if (PlcApi.WriteExistLamp(1020))
- {
- //出口写红灯
- //更新车辆离场时间,上报云平台
- machine.BusinessSwappingForCloudState =
- InfoEnum.BusinessSwappingForCloudState.SwapDoneWithoutVel;
- machine.SwapOrder!.VehicleLeaveTime = DateTime.Now;
- _CommonMgr.UpdateSwapOrder(machine);
-
- machine.RadarOutFlag = true;
-
- _CommonMgr.InsertStep(
- machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
- ? InfoEnum.BusinessSwappingStep.RadarOutFlag
- : InfoEnum.BusinessSwappingStep.RadarOutFailFlag,
- machine);
- }
+ //出口写红灯
+ //更新车辆离场时间,上报云平台
+ machine.BusinessSwappingForCloudState =
+ InfoEnum.BusinessSwappingForCloudState.SwapDoneWithoutVel;
+ machine.SwapOrder!.VehicleLeaveTime = DateTime.Now;
+ _CommonMgr.UpdateSwapOrder(machine);
+
+ machine.RadarOutFlag = true;
+
+ _CommonMgr.InsertStep(
+ machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
+ ? InfoEnum.BusinessSwappingStep.RadarOutFlag
+ : InfoEnum.BusinessSwappingStep.RadarOutFailFlag,
+ machine);
}
}, () =>
{
@@ -177,4 +185,4 @@ public class SwapDoneState : IState
: (int)InfoEnum.SwapInfo.ErrInfoCarLeave);
}, false, () => { }, 10, InvokeStatus.None);
}
-}
\ No newline at end of file
+}
diff --git a/Service/Execute/SwappingStateMachine.cs b/Service/Execute/SwappingStateMachine.cs
index f5bf753..932bc7c 100644
--- a/Service/Execute/SwappingStateMachine.cs
+++ b/Service/Execute/SwappingStateMachine.cs
@@ -1,11 +1,10 @@
using Autofac;
-using DotNetty.Common.Utilities;
using Entity.Constant;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac;
using log4net;
-using Newtonsoft.Json;
using Repository.Station;
+using Service.Charger.Client;
using Service.Execute.Api;
using Service.Execute.Model;
using Service.Execute.Model.Tbox;
@@ -252,6 +251,8 @@ public class SwappingStateMachine : IDisposable
TBoxApi.Reset(RfidReadModel.VelVin);
}
+ ClientMgr.PlcClient?.Reset();
+
//重置所有小步状态
ResetStep();
@@ -395,7 +396,7 @@ public class SwappingStateMachine : IDisposable
}
}
- //预约单
+ //预约单
List amtOrderInfos = AmtOrderRepository.QueryListByClause(it =>
it.ExpireTime < DateTime.Now
&& it.Status == (byte)InfoEnum.AmtOrderStatus.Success).ToList();
@@ -432,4 +433,4 @@ public enum SwappingState
Exception,
Canceled,
ManualSucc,
-}
\ No newline at end of file
+}
diff --git a/Service/Padar/Client/PadarMgr.cs b/Service/Padar/Client/PadarMgr.cs
index 7d75f20..dca66b3 100644
--- a/Service/Padar/Client/PadarMgr.cs
+++ b/Service/Padar/Client/PadarMgr.cs
@@ -10,13 +10,13 @@ public class PadarMgr
{
private static readonly ILog Log = LogManager.GetLogger(typeof(PadarMgr));
- public static PadarClient _PadarClient;
+ public static PadarClient? _PadarClient;
public static void InitClient()
{
//TODO::查询 服务器 连接
Task.Run(() => { ConnClient(); });
}
-
+
private static void ConnClient()
{
PadarClient client = AppInfo.Container.Resolve();
@@ -30,6 +30,6 @@ public class PadarMgr
Log.Info($"succeed to connect");
});
}
-
-
-}
\ No newline at end of file
+
+
+}
diff --git a/WebStarter/Controllers/PlcController.cs b/WebStarter/Controllers/PlcController.cs
index c188d37..0ef1b19 100644
--- a/WebStarter/Controllers/PlcController.cs
+++ b/WebStarter/Controllers/PlcController.cs
@@ -27,7 +27,7 @@ public class PlcController : ControllerBase
[Route("SendInitializeCommandReq/{code}")]
public Result SendInitializeCommandReq(string code)
{
- Service.Charger.Server.PlcClient? chargerClient = ClientMgr.GetBySn(code);
+ Service.Charger.Server.PlcClient? chargerClient = ClientMgr.PlcClient;
if (chargerClient != null)
{
return chargerClient.SendInitializeCommandReq();
@@ -44,7 +44,7 @@ public class PlcController : ControllerBase
[Route("SendOutboundCommandReq/{code}/{outboundMode}/{takePositionNumber}")]
public Result SendOutboundCommandReq(string code, byte outboundMode, byte takePositionNumber)
{
- Service.Charger.Server.PlcClient? chargerClient = ClientMgr.GetBySn(code);
+ Service.Charger.Server.PlcClient? chargerClient = ClientMgr.PlcClient;
if (chargerClient != null)
{
return chargerClient.SendOutboundCommandReq(outboundMode, takePositionNumber);
@@ -61,7 +61,7 @@ public class PlcController : ControllerBase
[Route("SendStartBatterySwapReq/{code}/{takePositionNumber}/{positionNumber}")]
public Result SendStartBatterySwapReq(string code, byte takePositionNumber, byte positionNumber)
{
- Service.Charger.Server.PlcClient? chargerClient = ClientMgr.GetBySn(code);
+ Service.Charger.Server.PlcClient? chargerClient = ClientMgr.PlcClient;
if (chargerClient != null)
{
return chargerClient.SendStartBatterySwapReq(takePositionNumber, positionNumber);
@@ -78,7 +78,7 @@ public class PlcController : ControllerBase
[Route("SendStartMovElectricityReq/{code}/{takeBatteryShelfNumber}/{saveBatteryShelfNumber}")]
public Result SendStartMovElectricityReq(string code, byte takeBatteryShelfNumber, byte saveBatteryShelfNumber)
{
- Service.Charger.Server.PlcClient? chargerClient = ClientMgr.GetBySn(code);
+ Service.Charger.Server.PlcClient? chargerClient = ClientMgr.PlcClient;
if (chargerClient != null)
{
return chargerClient.SendStartMovElectricityReq(takeBatteryShelfNumber, saveBatteryShelfNumber);
@@ -95,7 +95,7 @@ public class PlcController : ControllerBase
[Route("SendVehicleModelReq/{code}/{cartNo}")]
public Result SendVehicleModelReq(string code, byte cartNo)
{
- Service.Charger.Server.PlcClient? chargerClient = ClientMgr.GetBySn(code);
+ Service.Charger.Server.PlcClient? chargerClient = ClientMgr.PlcClient;
if (chargerClient != null)
{
return chargerClient.SendVehicleModelReq(cartNo);
@@ -112,7 +112,7 @@ public class PlcController : ControllerBase
[Route("SendMoveCommandReq/{code}/{takePositionNumber}/{positionNumber}")]
public Result SendMoveCommandReq(string code, byte takePositionNumber, byte positionNumber)
{
- Service.Charger.Server.PlcClient? chargerClient = ClientMgr.GetBySn(code);
+ Service.Charger.Server.PlcClient? chargerClient = ClientMgr.PlcClient;
if (chargerClient != null)
{
return chargerClient.SendMoveCommandReq(takePositionNumber, positionNumber);
@@ -129,7 +129,7 @@ public class PlcController : ControllerBase
[Route("SendContinueCommandReq/{code}")]
public Result SendContinueCommandReq(string code)
{
- Service.Charger.Server.PlcClient? chargerClient = ClientMgr.GetBySn(code);
+ Service.Charger.Server.PlcClient? chargerClient = ClientMgr.PlcClient;
if (chargerClient != null)
{
return chargerClient.SendContinueCommandReq();
@@ -146,7 +146,7 @@ public class PlcController : ControllerBase
[Route("SendPauseCommandReq/{code}")]
public Result SendPauseCommandReq(string code)
{
- Service.Charger.Server.PlcClient? chargerClient = ClientMgr.GetBySn(code);
+ Service.Charger.Server.PlcClient? chargerClient = ClientMgr.PlcClient;
if (chargerClient != null)
{
return chargerClient.SendPauseCommandReq();
@@ -163,7 +163,7 @@ public class PlcController : ControllerBase
[Route("SendInboundCommandsReq/{code}/{positionNumber}")]
public Result SendInboundCommandsReq(string code, byte positionNumber)
{
- Service.Charger.Server.PlcClient? chargerClient = ClientMgr.GetBySn(code);
+ Service.Charger.Server.PlcClient? chargerClient = ClientMgr.PlcClient;
if (chargerClient != null)
{
return chargerClient.SendInboundCommandsReq(positionNumber);
@@ -180,7 +180,7 @@ public class PlcController : ControllerBase
[Route("SendTerminationOrderReq/{code}")]
public Result SendTerminationOrderReq(string code)
{
- Service.Charger.Server.PlcClient? chargerClient = ClientMgr.GetBySn(code);
+ Service.Charger.Server.PlcClient? chargerClient = ClientMgr.PlcClient;
if (chargerClient != null)
{
return chargerClient.SendTerminationOrderReq();
@@ -197,7 +197,7 @@ public class PlcController : ControllerBase
[Route("SendFaultResetReq/{code}")]
public Result SendFaultResetReq(string code)
{
- Service.Charger.Server.PlcClient? chargerClient = ClientMgr.GetBySn(code);
+ Service.Charger.Server.PlcClient? chargerClient = ClientMgr.PlcClient;
if (chargerClient != null)
{
return chargerClient.SendFaultResetReq();
@@ -214,7 +214,7 @@ public class PlcController : ControllerBase
//[Route("SendParameterSettingsReq/{code}/{messageBodyAddress}/{parameterType}/{parameter}")]
//public Result SendParameterSettingsReq(string code, byte[] messageBodyAddress, byte parameterType, byte parameter)
//{
- // Service.Charger.Server.PlcClient? chargerClient = ClientMgr.GetBySn(code);
+ // Service.Charger.Server.PlcClient? chargerClient = ClientMgr.PlcClient;
// if (chargerClient != null)
// {
// return chargerClient.SendParameterSettingsReq(messageBodyAddress, parameterType, parameter);
@@ -234,11 +234,11 @@ public class PlcController : ControllerBase
[Route("SendParameterSettingsReq/{code}/{parameterType}/{parameter}")]
public Result SendParameterSettingsReq(string code, byte parameterType, byte parameter)
{
- Service.Charger.Server.PlcClient? chargerClient = ClientMgr.GetBySn(code);
+ Service.Charger.Server.PlcClient? chargerClient = ClientMgr.PlcClient;
if (chargerClient != null)
{
return chargerClient.SendParameterSettingsReq( parameterType, parameter);
- }
+ }
return Result.Fail("充电机未连接");
}
@@ -252,7 +252,7 @@ public class PlcController : ControllerBase
[Route("SendPrepareBatteryOnReq/{code}/{readyBatterySign}/{takePositionNumber}")]
public Result SendPrepareBatteryOnReq(string code, byte readyBatterySign, byte takePositionNumber)
{
- Service.Charger.Server.PlcClient? chargerClient = ClientMgr.GetBySn(code);
+ Service.Charger.Server.PlcClient? chargerClient = ClientMgr.PlcClient;
if (chargerClient != null)
{
return chargerClient.SendPrepareBatteryOnReq(readyBatterySign, takePositionNumber);