印尼音频播报更改

master
CZ 21 hours ago
parent 0dd96219a9
commit fadb74bc50

@ -70,5 +70,7 @@ public class SwapVehicleResp
/// 换电用时
/// </summary>
public string? SwapDuration { get; set; }
public byte? Soc { get; set; }
}

@ -138,37 +138,37 @@ namespace Entity.DbModel.Station
[SugarColumn(ColumnName = "ac_elec_count")]
public decimal? AcElecCount { get; set; }
/*/// <summary>
/// <summary>
/// Desc:充电开始交流表电量
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "start_ac_elec")]
public decimal? StartAcElec { get; set; }*/
public decimal? StartAcElec { get; set; }
/*/// <summary>
/// <summary>
/// Desc:充电结束交流表电量
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "stop_ac_elec")]
public decimal? StopAcElec { get; set; }*/
public decimal? StopAcElec { get; set; }
/*/// <summary>
/// <summary>
/// Desc:充电开始直流表电量
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "start_dc_elec")]
public decimal? StartDcElec { get; set; }*/
public decimal? StartDcElec { get; set; }
/*/// <summary>
/// <summary>
/// Desc:充电结束直流表电量
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "stop_dc_elec")]
public decimal? StopDcElec { get; set; }*/
public decimal? StopDcElec { get; set; }
/// <summary>
/// Desc:停止原因;0满电自动停止1-人工停止
@ -178,7 +178,7 @@ namespace Entity.DbModel.Station
[SugarColumn(ColumnName = "stop_reason")]
public int? StopReason { get; set; }
/*/// <summary>
/// <summary>
/// Desc:尖时段电量
/// Default:
/// Nullable:True
@ -240,15 +240,15 @@ namespace Entity.DbModel.Station
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "ac_valley_elec_count")]
public decimal? ACValleyElecCount { get; set; }*/
public decimal? ACValleyElecCount { get; set; }
/*/// <summary>
/// <summary>
/// Desc:电价版本号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "elec_price_model_version")]
public string ElecPriceModelVersion { get; set; }*/
public string ElecPriceModelVersion { get; set; }
/// <summary>
/// Desc:换电订单编号
@ -289,81 +289,10 @@ namespace Entity.DbModel.Station
[SugarColumn(ColumnName = "start_type")]
public int StartType { get; set; }
/*/// <summary>
/// <summary>
/// 上报次数
/// </summary>
[SugarColumn(ColumnName = "reporting_times")]
public int ReportingTimes { get; set; }*/
/// <summary>
/// Desc:充电开始交流表电量
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "start_ac_elec1")]
public decimal? StartAcElec1 { get; set; }
[SugarColumn(ColumnName = "start_ac_elec2")]
public decimal? StartAcElec2 { get; set; }
/// <summary>
/// Desc:充电结束交流表电量
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "stop_ac_elec1")]
public decimal? StopAcElec1 { get; set; }
[SugarColumn(ColumnName = "stop_ac_elec2")]
public decimal? StopAcElec2 { get; set; }
/// <summary>
/// Desc:充电开始直流表电量
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "start_dc_elec1")]
public decimal? StartDcElec1 { get; set; }
[SugarColumn(ColumnName = "start_dc_elec2")]
public decimal? StartDcElec2 { get; set; }
/// <summary>
/// Desc:充电结束直流表电量
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "stop_dc_elec1")]
public decimal? StopDcElec1 { get; set; }
[SugarColumn(ColumnName = "stop_dc_elec2")]
public decimal? StopDcElec2 { get; set; }
/// <summary>
/// 充电金额
/// </summary>
[SugarColumn(ColumnName = "charge_amount")]
public decimal? ChargeAmount { get; set; }
/// <summary>
/// 充电前卡余额
/// </summary>
[SugarColumn(ColumnName = "card_balance_before")]
public decimal? CardBalanceBefore { get; set; }
/// <summary>
/// 充电后卡余额
/// </summary>
[SugarColumn(ColumnName = "card_balance_behind")]
public decimal? CardBalanceBehind { get; set; }
/// <summary>
/// 交易流水号
/// </summary>
[SugarColumn(ColumnName = "transaction_serial_num")]
public string TransactionSerialNum { get; set; }
public int ReportingTimes { get; set; }
}
}
}

@ -13,6 +13,7 @@ using Repository.Station;
using Service.Execute.Api;
using Service.Execute.Model;
using Service.Init;
using Service.PlcAfrica.Client;
using Service.Station;
using SqlSugar;
@ -36,6 +37,139 @@ public class CommonMgr
public SwapOrderStepRepository SwapOrderStepRepository { get; set; }
public BinInfo BinInfo1 = new BinInfo()
{
Id = 1, //
No = "1", //
Code = "1", //
Name = "1",
Exists = 1, //
BatteryNo = "124243510021", //
ChargerNo = "EAXF000100000001",
ChargerGunNo = "1",
WaterCoolNo = "1",
ElecPluginFlag = 1,
ElecPluginStatus = "",
WaterPluginFlag = "",
AmtLock = 0,
Soc = 100,
Soe = 100,
Soh = 100,
BatteryEnterSeq = 1,
ChargeStatus = 4,
Status = 1,
CreatedBy = "",
CreatedTime = DateTime.Now,
UpdatedBy = "",
LastChargeFinishTime = DateTime.Now,
UpdatedTime = DateTime.Now,
CacheBinFlag = 0,
CanSwapFlag = 1,
CanChargeFlag = 1,
InTime = DateTime.Now,
NominalEnergy = (Decimal)373.2,
};
public BinInfo BinInfo2 = new BinInfo()
{
Id = 2, //
No = "2", //
Code = "2", //
Name = "2",
Exists = 1,
BatteryNo = "124243510022", //
ChargerNo = "EAXF000100000001",
ChargerGunNo = "1",
WaterCoolNo = "1",
ElecPluginFlag = 1,
ElecPluginStatus = "",
WaterPluginFlag = "",
AmtLock = 0,
Soc = 100,
Soe = 100,
Soh = 100,
BatteryEnterSeq = 1,
ChargeStatus = 4,
Status = 1,
CreatedBy = "",
CreatedTime = DateTime.Now,
UpdatedBy = "",
LastChargeFinishTime = DateTime.Now,
UpdatedTime = DateTime.Now,
CacheBinFlag = 0,
CanSwapFlag = 1,
CanChargeFlag = 1,
InTime = DateTime.Now,
NominalEnergy = (Decimal)373.2,
};
public BinInfo BinInfo3 = new BinInfo()
{
Id = 3, //
No = "3", //
Code = "3", //
Name = "3",
Exists = 1,
BatteryNo = "124243510023", //
ChargerNo = "EAXF000100000003",
ChargerGunNo = "1",
WaterCoolNo = "1",
ElecPluginFlag = 1,
ElecPluginStatus = "",
WaterPluginFlag = "",
AmtLock = 0,
Soc = 100,
Soe = 100,
Soh = 100,
BatteryEnterSeq = 1,
ChargeStatus = 4,
Status = 1,
CreatedBy = "",
CreatedTime = DateTime.Now,
UpdatedBy = "",
LastChargeFinishTime = DateTime.Now,
UpdatedTime = DateTime.Now,
CacheBinFlag = 0,
CanSwapFlag = 1,
CanChargeFlag = 1,
InTime = DateTime.Now,
NominalEnergy = (Decimal)373.2,
};
public BinInfo BinInfo4 = new BinInfo()
{
Id = 4, //
No = "4", //
Code = "4", //
Name = "4",
Exists = 1,
BatteryNo = "124243510024", //
ChargerNo = "EAXF000100000001",
ChargerGunNo = "1",
WaterCoolNo = "1",
ElecPluginFlag = 1,
ElecPluginStatus = "",
WaterPluginFlag = "",
AmtLock = 0,
Soc = 100,
Soe = 100,
Soh = 100,
BatteryEnterSeq = 1,
ChargeStatus = 4,
Status = 1,
CreatedBy = "",
CreatedTime = DateTime.Now,
UpdatedBy = "",
LastChargeFinishTime = DateTime.Now,
UpdatedTime = DateTime.Now,
CacheBinFlag = 0,
CanSwapFlag = 1,
CanChargeFlag = 1,
InTime = DateTime.Now,
NominalEnergy = (Decimal)373.2,
};
/// <summary>
/// 新增小步状态
/// </summary>
@ -182,14 +316,14 @@ public class CommonMgr
public SwapOrderBatteryInfo SelectPackNotArm(SwappingStateMachine machine)
{
SwapOrderBatteryInfo orderBatteryInfo = new SwapOrderBatteryInfo();
UpBin(machine, orderBatteryInfo);
UpBinOnly(machine, orderBatteryInfo);
_log.Info($"UpBin orderBatteryInfo={JsonConvert.SerializeObject(orderBatteryInfo)}");
if (orderBatteryInfo.CanSwap != InfoEnum.SelectBinStatusInfo.Success)
{
return orderBatteryInfo;
}
InBin(orderBatteryInfo, machine);
InBinOnly(orderBatteryInfo, machine);
_log.Info($"InBin orderBatteryInfo={JsonConvert.SerializeObject(orderBatteryInfo)}");
if (orderBatteryInfo.CanSwap != InfoEnum.SelectBinStatusInfo.Success)
@ -257,6 +391,55 @@ public class CommonMgr
orderBatteryInfo.UpBinInfo = selectPack.BinInfo;
orderBatteryInfo.CanSwap = selectPack.Info;
}
public void UpBinOnly(SwappingStateMachine machine, SwapOrderBatteryInfo orderBatteryInfo)
{
if (PlcAfricaMgr.PlcAfricaMsg.Loader1SeatSensor1.Value)
{
List<BinInfo> CanUpBin = new();
CanUpBin.Add(BinInfo1);
CanUpBin.Add(BinInfo2);
CanUpBin.Add(BinInfo3);
CanUpBin.Add(BinInfo4);
orderBatteryInfo.CanUpBin = CanUpBin;
orderBatteryInfo.UpBinInfo = BinInfo1;
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.Success;
}
else if (PlcAfricaMgr.PlcAfricaMsg.Loader2SeatSensor1.Value)
{
List<BinInfo> CanUpBin = new();
CanUpBin.Add(BinInfo1);
CanUpBin.Add(BinInfo2);
CanUpBin.Add(BinInfo3);
CanUpBin.Add(BinInfo4);
orderBatteryInfo.CanUpBin = CanUpBin;
orderBatteryInfo.UpBinInfo = BinInfo2;
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.Success;
}
else if (PlcAfricaMgr.PlcAfricaMsg.Loader3SeatSensor1.Value)
{
List<BinInfo> CanUpBin = new();
CanUpBin.Add(BinInfo1);
CanUpBin.Add(BinInfo2);
CanUpBin.Add(BinInfo3);
CanUpBin.Add(BinInfo4);
orderBatteryInfo.CanUpBin = CanUpBin;
orderBatteryInfo.UpBinInfo = BinInfo3;
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.Success;
}
/*else if (PlcAfricaMgr.PlcAfricaMsg.Loader4SeatSensor1.Value)
{
List<BinInfo> CanUpBin = new();
CanUpBin.Add(BinInfo1);
CanUpBin.Add(BinInfo2);
CanUpBin.Add(BinInfo3);
CanUpBin.Add(BinInfo4);
orderBatteryInfo.CanUpBin = CanUpBin;
orderBatteryInfo.UpBinInfo = BinInfo4;
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.Success;
}*/
}
private List<string> QueryMoveBinNo()
{
@ -301,6 +484,17 @@ public class CommonMgr
orderBatteryInfo.InBinInfo = selectPackDto.BinInfo;
orderBatteryInfo.CanSwap = selectPackDto.Info;
}
public void InBinOnly(SwapOrderBatteryInfo orderBatteryInfo, SwappingStateMachine machine)
{
List<BinInfo> CanDownBin = new List<BinInfo>();
CanDownBin.Add(BinInfo1);
CanDownBin.Add(BinInfo2);
CanDownBin.Add(BinInfo3);
CanDownBin.Add(BinInfo4);
orderBatteryInfo.CanDownBin = CanDownBin;
orderBatteryInfo.InBinInfo = orderBatteryInfo.UpBinInfo;
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.Success;
}
//手动选包

@ -25,4 +25,6 @@ public class CarStatus
/// 3无效数据
/// </summary>
public byte? LockStatus { get; set; }
public byte? Soc { get; set; }
}

@ -58,6 +58,7 @@ public class CarCtrlState : IState
//查询车辆锁止状态
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
carInfo.Wait();
StationSoftMgr.SwappingStateMachine.BoxCarInfoModel.CarStatus=carInfo.Result.CarStatus;
var resultHeartBeatMsg = carInfo.Result.CarStatus;
if (resultHeartBeatMsg?.LockStatus == 1 || machine.ManualConfirmCarUnlockFlag)
{
@ -71,8 +72,6 @@ public class CarCtrlState : IState
(int)SwapConstant.StepType.AUTO);
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music93);
Thread.Sleep(6000);
SoundClient.SoundPlay(SoundEnum.music92);
Thread.Sleep(4000);
}
@ -87,8 +86,6 @@ public class CarCtrlState : IState
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music104);
Thread.Sleep(7000);
SoundClient.SoundPlay(SoundEnum.music105);
Thread.Sleep(5000);
}

@ -208,8 +208,6 @@ public class CarPrepareState : IState
{
LedClient.SendMsgByKey(InfoEnum.SwapInfo.upcar.GetLed());
SoundClient.SoundPlay(SoundEnum.music100);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music101);
che = 1;
}
@ -220,8 +218,6 @@ public class CarPrepareState : IState
i++;
if (i==10)
{
SoundClient.SoundPlay(SoundEnum.music100);
Thread.Sleep(6000);
SoundClient.SoundPlay(SoundEnum.music101);
i = 1;
}
@ -233,8 +229,6 @@ public class CarPrepareState : IState
a++;
if (a == 10)
{
SoundClient.SoundPlay(SoundEnum.music100);
Thread.Sleep(6000);
SoundClient.SoundPlay(SoundEnum.music101);
a = 1;
}
@ -273,8 +267,6 @@ public class CarPrepareState : IState
}, () =>
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music102);
Thread.Sleep(6000);
SoundClient.SoundPlay(SoundEnum.music103);
@ -314,17 +306,10 @@ public class CarPrepareState : IState
}, () =>
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music102);
Thread.Sleep(6000);
SoundClient.SoundPlay(SoundEnum.music103);
//machine.ExceptionReason = ExceptionReason.ConnTBoxError;
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn);
}, false, () =>
{
machine.ExceptionReason = ExceptionReason.ConnTBoxError;
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorTBoxConn.GetLed());
// LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrorTBoxConn.GetLed());
}
, 5, InvokeStatus.None);
}
@ -352,8 +337,6 @@ public class CarPrepareState : IState
{
machine.ExceptionReason = ExceptionReason.LocalCheckVarError;
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music108);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music109);
Thread.Sleep(3000);
@ -443,8 +426,6 @@ public class CarPrepareState : IState
// LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrorSelectPack.GetLed());
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music106);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music107);
machine.ExceptionReason = ExceptionReason.SelectPackError;

@ -92,35 +92,8 @@ public class DoSwappingState : IState
{
return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, () => PadarMgr._PadarClient?.CarState > 0,
() => { PadarMgr._PadarClient?.PadarControl(flag); });
}
//public void leida ()
//{
// 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;
// ;
// }
//}
}
/// <summary>
/// 下发plc启动换电
@ -157,8 +130,6 @@ public class DoSwappingState : IState
machine.SwapStatus = 0;
machine.StartSwappingFlag = true;
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music91);
Thread.Sleep(5000);
SoundClient.SoundPlay(SoundEnum.music90);
}

@ -176,9 +176,11 @@ public class StationReadyState : IState
{
return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, () =>
PadarMgr._PadarClient?.CarState > 0
|| machine.ManualSkipRadar,
() => { PadarMgr._PadarClient?.PadarControl(flag); });
PadarMgr._PadarClient?.CarState > 0 || machine.ManualSkipRadar,
() =>
{
PadarMgr._PadarClient?.PadarControl(flag);
});
}
@ -190,12 +192,12 @@ public class StationReadyState : IState
return Invoker.Invoke("adjust Radar", 1000, 20, machine.IsCanceled,
() =>
{
// LedClient.SendMsgByKey(InfoEnum.SwapInfo.Itparked.GetLed());
//LedClient.SendMsgByKey(InfoEnum.SwapInfo.Itparked.GetLed());
StationSoftMgr.PutDeviceLog((int)StationConstant.DeviceCode.Radar,SwapConstant.RadarProtocol.CarStatus,
StationSoftMgr.PutDeviceLog((int)StationConstant.DeviceCode.Radar,SwapConstant.RadarProtocol.CarStatus,
PadarMgr._PadarClient?.CarState.ToString(),(int)SwapConstant.CommunicationType.Receive);
PadarMgr._PadarClient?.CarState.ToString(),(int)SwapConstant.CommunicationType.Receive);
if (PadarMgr._PadarClient?.CarState == 6 || machine.ManualSkipRadar)
{
@ -225,9 +227,7 @@ public class StationReadyState : IState
if (che == 10)
{
LedClient.SendMsgByKey(InfoEnum.SwapInfo.upcar.GetLed());
SoundClient.SoundPlay(SoundEnum.music100);
Thread.Sleep(6000);
SoundClient.SoundPlay(SoundEnum.music101);
SoundClient.SoundPlay(SoundEnum.music113);
che = 1;
}
break;
@ -236,9 +236,7 @@ public class StationReadyState : IState
i++;
if (i==10)
{
SoundClient.SoundPlay(SoundEnum.music100);
Thread.Sleep(6000);
SoundClient.SoundPlay(SoundEnum.music101);
SoundClient.SoundPlay(SoundEnum.music112);
i = 1;
}
LedClient.SendMsgByKey(InfoEnum.SwapInfo.Muka.GetLed());
@ -249,9 +247,7 @@ public class StationReadyState : IState
a++;
if (a==10)
{
SoundClient.SoundPlay(SoundEnum.music100);
Thread.Sleep(6000);
SoundClient.SoundPlay(SoundEnum.music101);
SoundClient.SoundPlay(SoundEnum.music111);
a = 0;
}

@ -212,17 +212,10 @@ public class SwapDoneState : IState
machine.ManualConfirmCarLockFlag? (int)SwapConstant.StepType.MANUAL :
(int)SwapConstant.StepType.AUTO);
machine.ManualConfirmCarLockFlag = false;
//_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
// machine);
var SoundClient = AppInfo.Container.Resolve<SoundClient>();
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoCarLeaveflushed.GetLed());
Thread.Sleep(1000);
SoundClient.SoundPlay(SoundEnum.music76);
Thread.Sleep(7000);
SoundClient.SoundPlay(SoundEnum.music77);
// SoundClient.SoundPlay(SoundEnum.music77);
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoCarLeaveflushed.GetLed());
SoundClient.SoundPlay(SoundEnum.music77);
machine.BoxCarInfoModel = carInfo.Result;
machine.VelLockFlag = true;

@ -8,10 +8,10 @@ public class FaultMsg
/// <summary>
/// 主电故障
/// </summary>
public ModbusProperty<bool> MainPowerFault { get; set; } = new(32768, start: 1, length: 1);
public ModbusProperty<bool> MainPowerFault { get; set; } = new(32768, start: 1, length: 1,type:ModbusDataType.Bit);
/// <summary>
/// 备电故障
/// </summary>
public ModbusProperty<bool> BackupFault { get; set; } = new(32768, start: 2, length: 2);
public ModbusProperty<bool> BackupFault { get; set; } = new(32768, start: 2, length: 2,type:ModbusDataType.Bit);
}

@ -178,7 +178,7 @@ public class LedClient
private static readonly ILog Log = LogManager.GetLogger(typeof(LedClient));
private static Socket? _socket;
private static string _ip = "192.168.3.212";
// private static string _ip = "127.0.0.1";
//private static string _ip = "127.0.0.1";
private static int _port = 10000;

@ -1,6 +1,8 @@
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.AutoTask;
using log4net;
using Repository.Station;
using Service.Execute;
using Service.Execute.Api;
using Service.PlcAfrica.Client;
@ -16,6 +18,13 @@ public class WritePlcTask : ITask
private PlcAfricaMsg PlcAfricaMsg = new PlcAfricaMsg();
public BinInfoRepository BinInfoRepository { get; set; }
public WritePlcTask(BinInfoRepository binInfoRepository)
{
BinInfoRepository = binInfoRepository;
}
public string Name()
{
return "WritePlcTask";
@ -31,19 +40,29 @@ public class WritePlcTask : ITask
public void Handle()
{
Log.Info("Plc Start write");
PlcAfricaMsg.TboxUnlock.Value = 0;
if (StationSoftMgr.SwappingStateMachine != null)
if (PlcAfricaMgr.PlcAfricaClient.Connected)
{
var swappingStateMachine = StationSoftMgr.SwappingStateMachine;
if (swappingStateMachine.BoxConnectFlag) //TBOX
#region 写车辆解锁状态
if (StationSoftMgr.SwappingStateMachine != null)
{
var carInfo = TBoxApi.GetCarInfo(swappingStateMachine.RfidReadModel.VelVin);
carInfo.Wait();
if (swappingStateMachine.BoxCarInfoModel != null && carInfo != null)
var swappingStateMachine = StationSoftMgr.SwappingStateMachine;
if (swappingStateMachine.BoxConnectFlag) //TBOX
{
PlcAfricaMsg.TboxUnlock.Value = (ushort)carInfo.Result?.CarStatus?.LockStatus;
bool writeCharge = PlcAfricaMgr.PlcAfricaClient.WriteValue(PlcAfricaMsg.TboxUnlock);
Log.Info($"写锁止状态:{PlcAfricaMsg.TboxUnlock.Value}");
var carInfo = TBoxApi.GetCarInfo(swappingStateMachine.RfidReadModel.VelVin);
carInfo.Wait();
if (swappingStateMachine.BoxCarInfoModel != null && carInfo != null)
{
PlcAfricaMsg.TboxUnlock.Value = (ushort)carInfo.Result?.CarStatus?.LockStatus;
bool writeCharge = PlcAfricaMgr.PlcAfricaClient.WriteValue(PlcAfricaMsg.TboxUnlock);
Log.Info($"写锁止状态:{PlcAfricaMsg.TboxUnlock.Value}");
}
else
{
bool writeCharge = PlcAfricaMgr.PlcAfricaClient.WriteValue(PlcAfricaMsg.TboxUnlock);
Log.Info($"写锁止状态:{PlcAfricaMsg.TboxUnlock.Value}");
}
}
else
{
@ -56,12 +75,23 @@ public class WritePlcTask : ITask
bool writeCharge = PlcAfricaMgr.PlcAfricaClient.WriteValue(PlcAfricaMsg.TboxUnlock);
Log.Info($"写锁止状态:{PlcAfricaMsg.TboxUnlock.Value}");
}
#endregion
#region 写电池充电状态
List<BinInfo> lstBinInfo = BinInfoRepository.Query();
ushort[] lstUsort1 = new[]
{
(ushort)(lstBinInfo.Where(i => i.No == "1").ToList().First().ChargeStatus == 1 ? 1 : 2),
(ushort)(lstBinInfo.Where(i => i.No == "2").ToList().First().ChargeStatus == 1 ? 1 : 2),
(ushort)(lstBinInfo.Where(i => i.No == "3").ToList().First().ChargeStatus == 1 ? 1 : 2),
};
PlcAfricaMgr.PlcAfricaClient.Write("x=3;49437", lstUsort1);
#endregion
}
else
{
bool writeCharge = PlcAfricaMgr.PlcAfricaClient.WriteValue(PlcAfricaMsg.TboxUnlock);
Log.Info($"写锁止状态:{PlcAfricaMsg.TboxUnlock.Value}");
}
Log.Info("Plc Finish write");
}
public bool Stoped()

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

@ -8,6 +8,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entity.DbModel.Station;
using log4net;
using Repository.Station;
using static HybirdFrameworkCore.Const.EndingConst;
namespace Service.PlcAfrica.Client
@ -15,6 +18,8 @@ namespace Service.PlcAfrica.Client
[Scope]
public class PlcAfricaClient : ModbusTcpMaster
{
private static readonly ILog Log = LogManager.GetLogger(typeof(PlcAfricaClient));
public BinInfoRepository BinInfoRepository { get; set; }
private long TaskNo = 0;
public PlcAfricaClient()
{
@ -41,11 +46,50 @@ namespace Service.PlcAfrica.Client
EndingConst.ByteSeq.AB,
EndingConst.WordSeq.DC);
Task task01 = Task.Run(async () => await UpdateBinInfo(PlcAfricaMgr.PlcAfricaMsg.Loader1SeatSensor1.Value?1:0, "1"));
Task task02 = Task.Run(async () => await UpdateBinInfo(PlcAfricaMgr.PlcAfricaMsg.Loader2SeatSensor1.Value?1:0, "2"));
Task task03 = Task.Run(async () => await UpdateBinInfo(PlcAfricaMgr.PlcAfricaMsg.Loader3SeatSensor1.Value?1:0, "3"));
Task task04 = Task.Run(async () => await UpdateBinInfo(PlcAfricaMgr.PlcAfricaMsg.Loader4SeatSensor1.Value?1:0, "4"));
}
return resul;
}
private async Task UpdateBinInfo(int exists, string binNo)
{
if (exists == 1)
BinInfoRepository.Update(it => it.Exists == 1,
it => it.No == binNo);
else
BinInfoRepository.Update(
it =>
new BinInfo()
{
Exists = 0,
BatteryNo = "-1",
Soc = (decimal)-1,
Soe = (decimal)-1,
Soh = (decimal)-1,
},
it => it.No == binNo);
Log.Info($"Update exists:{exists},binNo{binNo}");
}
private async Task UpdateBinInfoCache(int exists, string binNo)
{
if (exists == 1)
BinInfoRepository.Update(it => it.Exists == 1,
it => it.No == binNo);
else
BinInfoRepository.Update(
it =>
new BinInfo()
{
Exists = 0,
},
it => it.No == binNo);
}
//修改当前任务
public void ExChangeTaskNo(long taskNo)
{

@ -99,84 +99,84 @@ public class SoundClient
public enum SoundEnum
{
music01=1,//车辆已到位,请停车
music02,//请将车辆行驶到指定位置
music03,//请按屏幕顺序操作车辆;
music04,//请尽快将车辆行驶到指定位置
music05,//认证失败,请联系站务人员
music06,//车站通讯故障,请联系站务
music07,//换电站模式错误,请联系站务
music08,//车辆型号不适配本站,请联系站务了解更多信息
music09,//车辆不符合换电要求,请驶离
music10,//请按屏幕顺序操作车辆;
music11,//无可用电池,请联系站务
music12,//请拉起手刹
music13,//请熄火车辆;
music14,//设备准备中,请勿操作车辆
music15,//请按下启动按钮,开始换电
music16,//开始换电
music17,//请使用手机APP启动换电
music18,//设备不允许换电,请联系站务
music19,//车机不允许换电,请联系站务
music20,//开始换电,请勿操作车辆
music21,//定位电池失败,请联系站务人员
music22,//电池定位不成功,请联系站务确认精度
music23,//车辆角度过大,请将车辆停正
music24,//电池定位结束,请联系站务确认精度
music25,//自动解锁失败,请联系站务手动解锁
music26,//电池解锁中,请稍候
music27,//电池拆卸完成
music28,//电池搬运中,请稍候
music29,//电池安装中,请稍候
music30,//自动上锁失败,请联系站务手动上锁
music31,//电池自动上锁中,请稍候
music32,//换电暂停,请联系站务确认锁状态
music33,//自检失败,请联系站务人员
music34,//换电完成,祝你一路顺风
music35,//突发紧急状况,请尽快撤离
music36,//换电暂停,请联系站务人员
music37,//您已进入危险区域,请尽快离开
music38,//车辆高压异常,请熄火车辆
music39,//车站通讯故障,请联系站务
music41=41,//[Info("欢迎光临换电站!(正在营业)","欢迎光临换电站!,本站正在营业中")]WelcomeInfo=1,
music42,//[Info("标签读写失败", "标签读写失败")] ErrorReadRfid ,
music43,//[Info("车辆连接失败", "车辆连接失败,请联系站务人员")] ErrorTBoxConn ,
music44,//[Info("云端校验失败", "云端校验失败,请联系站务人员")] ErrorCloudCheck ,
music45,//[Info("车辆已到位", "车辆已到位")] InfoCarInPosition ,
music46,//[Info("请熄火挂空挡拉手刹", "请熄火挂空挡拉手刹")] ErrorCarInPositionTimeout,
music47,//[Info("云平台下发换电失败", "云平台下发换电超时")] CloudSendSwapError ,
music48,//[Info("解锁车辆失败", "解锁车辆失败")] ErrUnLockCar ,
music49,//[Info("选包失败,请驶离", "选包失败,请驶离")] ErrorSelectPack ,
music50,//[Info("通道拍照定位失败,请在三分钟内重新调整车辆位置", "通道拍照定位失败,请在三分钟内重新调整车辆位置")]ErrChannelStatus=10,
music51,//[Info("电池拆卸中,请稍后", "电池拆卸中,请稍后")] InfoUnPack ,
music52,//[Info("电池安装中,请稍后", "电池安装中,请稍后")] InfoPack ,
music53,//[Info("电池包已安装完成", "电池包已安装完成")] InfoPackFinish ,
music54,//[Info("航车已回归安全位置", "航车已回归安全位置")] InfoToSafePosition ,
music55,//[Info("换电已完成,请驶离", "换电已完成,请驶离")] InfoCarLeave ,
music56,//[Info("换电失败,请驶离", "换电失败,请驶离")] ErrInfoCarLeave ,
music57,//[Info("电池入仓中,请稍后", "电池入仓中,请稍后")] InfoOldBatteryCarryIn ,
music58,//[Info("电池出仓中,请稍后", "电池出仓中,请稍后")] InfoNewBatteryCarryOut ,
music59,//[Info("车辆上锁失败", "车辆上锁失败")] ErrLockCar ,
music60,//[Info("通道的电池仓无可用换电电池","通道的电池仓无可用换电电池")] NoBatteryErr,
music61,//[Info("结束充电电池数量不足","通道的电池仓无可用换电电池")] LessOfFinishChargingErr,
music62,//[Info("空仓数量不足","通道的电池仓无可用换电电池")] LessOfEmptyBinErr,
music63,//[Info("符合soc限制数量不足","通道的电池仓无可用换电电池")] LessOfSocErr,
music64,//[Info("结束充电大于3分钟的数量不足","通道的电池仓无可用换电电池")] LessOf3MinuteErr,
music65,//[Info("换电站处于手动模式,不能自动换电","换电站处于手动模式,不能自动换电")] InfoStationModel,
music66,//[Info("换电站处于本地模式,不能远程换电","换电站处于本地模式,不能远程换电")] InfoStationModelRemoteErr,
music67,//[Info("车辆驶入","车辆驶入")] CarInInfo,
music68,//[Info("换电任务启动","换电任务启动")] StartSwapInfo,
music69,//[Info("航车拍照中,请稍后","航车拍照中,请稍后")] CarTakePhotoInfo,
music70,//[Info("启动换电失败,请联系站务人员","启动换电失败,请联系站务人员")] ErrStartSwap,
music71,//即将进行消防移仓,请通道车辆驶离
music72,//电池移仓中//
music73,//消防移仓中
music74,//开始读取标签失败
music01 = 1, //车辆已到位,请停车
music02, //请将车辆行驶到指定位置
music03, //请按屏幕顺序操作车辆;
music04, //请尽快将车辆行驶到指定位置
music05, //认证失败,请联系站务人员
music06, //车站通讯故障,请联系站务
music07, //换电站模式错误,请联系站务
music08, //车辆型号不适配本站,请联系站务了解更多信息
music09, //车辆不符合换电要求,请驶离
music10, //请按屏幕顺序操作车辆;
music11, //无可用电池,请联系站务
music12, //请拉起手刹
music13, //请熄火车辆;
music14, //设备准备中,请勿操作车辆
music15, //请按下启动按钮,开始换电
music16, //开始换电
music17, //请使用手机APP启动换电
music18, //设备不允许换电,请联系站务
music19, //车机不允许换电,请联系站务
music20, //开始换电,请勿操作车辆
music21, //定位电池失败,请联系站务人员
music22, //电池定位不成功,请联系站务确认精度
music23, //车辆角度过大,请将车辆停正
music24, //电池定位结束,请联系站务确认精度
music25, //自动解锁失败,请联系站务手动解锁
music26, //电池解锁中,请稍候
music27, //电池拆卸完成
music28, //电池搬运中,请稍候
music29, //电池安装中,请稍候
music30, //自动上锁失败,请联系站务手动上锁
music31, //电池自动上锁中,请稍候
music32, //换电暂停,请联系站务确认锁状态
music33, //自检失败,请联系站务人员
music34, //换电完成,祝你一路顺风
music35, //突发紧急状况,请尽快撤离
music36, //换电暂停,请联系站务人员
music37, //您已进入危险区域,请尽快离开
music38, //车辆高压异常,请熄火车辆
music39, //车站通讯故障,请联系站务
music41 = 41, //[Info("欢迎光临换电站!(正在营业)","欢迎光临换电站!,本站正在营业中")]WelcomeInfo=1,
music42, //[Info("标签读写失败", "标签读写失败")] ErrorReadRfid ,
music43, //[Info("车辆连接失败", "车辆连接失败,请联系站务人员")] ErrorTBoxConn ,
music44, //[Info("云端校验失败", "云端校验失败,请联系站务人员")] ErrorCloudCheck ,
music45, //[Info("车辆已到位", "车辆已到位")] InfoCarInPosition ,
music46, //[Info("请熄火挂空挡拉手刹", "请熄火挂空挡拉手刹")] ErrorCarInPositionTimeout,
music47, //[Info("云平台下发换电失败", "云平台下发换电超时")] CloudSendSwapError ,
music48, //[Info("解锁车辆失败", "解锁车辆失败")] ErrUnLockCar ,
music49, //[Info("选包失败,请驶离", "选包失败,请驶离")] ErrorSelectPack ,
music50, //[Info("通道拍照定位失败,请在三分钟内重新调整车辆位置", "通道拍照定位失败,请在三分钟内重新调整车辆位置")]ErrChannelStatus=10,
music51, //[Info("电池拆卸中,请稍后", "电池拆卸中,请稍后")] InfoUnPack ,
music52, //[Info("电池安装中,请稍后", "电池安装中,请稍后")] InfoPack ,
music53, //[Info("电池包已安装完成", "电池包已安装完成")] InfoPackFinish ,
music54, //[Info("航车已回归安全位置", "航车已回归安全位置")] InfoToSafePosition ,
music55, //[Info("换电已完成,请驶离", "换电已完成,请驶离")] InfoCarLeave ,
music56, //[Info("换电失败,请驶离", "换电失败,请驶离")] ErrInfoCarLeave ,
music57, //[Info("电池入仓中,请稍后", "电池入仓中,请稍后")] InfoOldBatteryCarryIn ,
music58, //[Info("电池出仓中,请稍后", "电池出仓中,请稍后")] InfoNewBatteryCarryOut ,
music59, //[Info("车辆上锁失败", "车辆上锁失败")] ErrLockCar ,
music60, //[Info("通道的电池仓无可用换电电池","通道的电池仓无可用换电电池")] NoBatteryErr,
music61, //[Info("结束充电电池数量不足","通道的电池仓无可用换电电池")] LessOfFinishChargingErr,
music62, //[Info("空仓数量不足","通道的电池仓无可用换电电池")] LessOfEmptyBinErr,
music63, //[Info("符合soc限制数量不足","通道的电池仓无可用换电电池")] LessOfSocErr,
music64, //[Info("结束充电大于3分钟的数量不足","通道的电池仓无可用换电电池")] LessOf3MinuteErr,
music65, //[Info("换电站处于手动模式,不能自动换电","换电站处于手动模式,不能自动换电")] InfoStationModel,
music66, //[Info("换电站处于本地模式,不能远程换电","换电站处于本地模式,不能远程换电")] InfoStationModelRemoteErr,
music67, //[Info("车辆驶入","车辆驶入")] CarInInfo,
music68, //[Info("换电任务启动","换电任务启动")] StartSwapInfo,
music69, //[Info("航车拍照中,请稍后","航车拍照中,请稍后")] CarTakePhotoInfo,
music70, //[Info("启动换电失败,请联系站务人员","启动换电失败,请联系站务人员")] ErrStartSwap,
music71, //即将进行消防移仓,请通道车辆驶离
music72, //电池移仓中//
music73, //消防移仓中
music74, //开始读取标签失败
music75,
music76=76,//[Info(" 换电完成,请驶离印尼")] ErrStartSwap,
music77=77,//[Info(" 换电完成,请驶离")] ErrStartSwap,
music77 = 77, //[Info(" 换电完成,请驶离")] ErrStartSwap,
music78,
music79,
music80,
@ -189,57 +189,24 @@ public enum SoundEnum
music87,
music88,
music89,
music90,//[Info("开始换电中")] ErrStartSwap,
music91,//[Info("换电开始印尼")] ErrStartSwap,
music92,//[Info(" 解锁成功中")] ErrStartSwap,
music93,//[Info(" 解锁成功印尼")] ErrStartSwap,
music99=99,
music100,//[Info(" 车辆停放不到位印尼")] ErrStartSwap,
music101,//[Info(" 车辆停放不到位")] ErrStartSwap,
music102,//[Info(" 正在等待车辆连接印尼")] ErrStartSwap,
music103,//[Info(" 正在等待车辆连接")] ErrStartSwap,
music104,//[Info(" 解锁失败印尼")] ErrStartSwap,
music105,//[Info(" 解锁失败")] ErrStartSwap,
music106,//[Info(" 选包失败印尼")] ErrStartSwap,
music107,//[Info(" 选包失败")] ErrStartSwap,
music108,//[Info(" 车辆验证失败印尼")] ErrStartSwap,
music109,//[Info(" 车辆验证失败")] ErrStartSwap,
music110,// 消防报警,禁止车辆再次进入换电
music111,// 消防报警,禁止车辆再次进入换电 印尼
/*
music90, //[Info("开始换电中")] ErrStartSwap,
music92, //[Info(" 解锁成功中")] ErrStartSwap,
music99 = 99,
music101=101, //[Info(" 车辆停放不到位")] ErrStartSwap,
music103=103, //[Info(" 正在等待车辆连接")] ErrStartSwap,
music105=105, //[Info(" 解锁失败")] ErrStartSwap,
music107=107, //[Info(" 选包失败")] ErrStartSwap,
music109=109, //[Info(" 车辆验证失败")] ErrStartSwap,
music110, // 消防报警,禁止车辆再次进入换电
music111, // 车辆停放靠前,请将车辆后退
music112, // 车辆停放靠后,请将车辆前进
music113, // 角度偏移过大,请车辆重新进站
*/
}

@ -168,6 +168,7 @@ public class MonitorService
: null;
monitorScreenResp.VehicleInfo.Break = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Break;
monitorScreenResp.VehicleInfo.Gear = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Gear;
monitorScreenResp.VehicleInfo.Soc = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Soc;
monitorScreenResp.BatteryInfo = new();
monitorScreenResp.BatteryInfo.BatteryTotalCount = binInfos.Count;
monitorScreenResp.BatteryInfo.UsingSwapBatteryCount = binInfos.Select(i => i.ChargeStatus == 2 &&

@ -239,16 +239,9 @@ public class ChargeMonitorController
//报警提示
var soundClient = AppInfo.Container.Resolve<SoundClient>();
//TODO:: 录入播报素材
soundClient.SoundPlay(SoundEnum.music110);
Thread.Sleep(4000);
soundClient.SoundPlay(SoundEnum.music111);
//判断是否在换电中 通道是否有车
return Result<bool>.Success();
}
}

@ -49,7 +49,7 @@ public class GenController : ControllerBase
[HttpGet("test115")]
public void Test115()
{
AppInfo.Container.Resolve<SoundClient>().SoundPlay(SoundEnum.music100);
AppInfo.Container.Resolve<SoundClient>().SoundPlay(SoundEnum.music101);
Console.WriteLine("测试完毕");
}

@ -18,6 +18,7 @@ using Microsoft.AspNetCore.Localization;
using Microsoft.IdentityModel.Tokens;
using Service.Charger.Client;
using Service.Execute;
using Service.Fire.Client;
using Service.Led;
using Service.Padar.Client;
using Service.PlcAfrica.Client;
@ -182,8 +183,9 @@ AppInfo.Container = app.Services.GetAutofacRoot();
////PLC
if (AppSettingsHelper.GetBool("plc", "enable"))
{
ClientMgr.InitClient();
//ClientMgr.InitClient();
}
FireMgr.UpsInit();
//雷达
if (AppSettingsHelper.GetBool("padar", "enable"))
{
@ -202,7 +204,7 @@ if (AppSettingsHelper.GetBool("swap", "enable"))
StationSoftMgr.SwappingStateMachineStart();
}
//PadarMgr.InitClient();
PadarMgr.InitClient();
////现场调试plc连接

Loading…
Cancel
Save