修改流程

master
zby 2 months ago
parent 365f7a9bf1
commit 9ce8c69738

@ -58,7 +58,7 @@ public class InfoEnum
[Info("前进","前进")] advance,//34
[Info("后退", "后退")] Backoff,
[Info("停好了", "停好了")] Itparked,
[Info("退出重新停车", "退出重新停车")] upcar,
}

@ -58,13 +58,13 @@ public class CarCtrlState : IState
return Invoker.Invoke("UnLockCar", 500, 100, machine.IsCanceled,
() => machine.VelUnlockFlag, () =>
{
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelVin);
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelNo);
bool unLock = result.Result;
if (unLock)
{
//查询车辆锁止状态
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelNo);
var resultHeartBeatMsg = carInfo.Result.CarStatus;
if (resultHeartBeatMsg?.LockStatus == 1 || machine.ManualConfirmCarUnlockFlag)
{
@ -92,7 +92,10 @@ public class CarCtrlState : IState
LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrUnLockCar.GetLed());
SoundClient = AppInfo.Container.Resolve<SoundClient>();
if (b == 0) {
SoundClient.SoundPlay(SoundEnum.music48);
SoundClient.SoundPlay(SoundEnum.music104);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music105);
Thread.Sleep(3000);
b = 1;
}

@ -7,6 +7,7 @@ using Entity.Dto;
using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Configuration;
using log4net;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Repository.Station;
using Service.Execute.Api;
using Service.Execute.Model;
@ -161,27 +162,40 @@ public class CarPrepareState : IState
/// <returns></returns>
public InvokeStatus CheckTBoxConnectFlag(SwappingStateMachine machine)
{
int t = 0;
return Invoker.Invoke("check TBox connect", 1000, 10, machine.IsCanceled,
() => machine.BoxConnectFlag, () =>
{
Task<bool> result = TBoxApi.IsConnected(machine.RfidReadModel.VelVin);
Task<bool> result = TBoxApi.IsConnected(machine.RfidReadModel.VelNo);
// result.Wait();
bool isConnect = result.Result;
if (isConnect)
{
machine.BoxConnectFlag = true;
}
}, () =>
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music43);
if (t == 0)
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music102);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music103);
Thread.Sleep(3000);
}
//machine.ExceptionReason = ExceptionReason.ConnTBoxError;
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn);
}, false, () =>
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address03"));
SoundClient.SoundPlay(SoundEnum.music43);
//machine.ExceptionReason = ExceptionReason.ConnTBoxError;
if (t == 0)
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music102);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music103);
Thread.Sleep(3000);
}
LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrorTBoxConn.GetLed());
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorTBoxConn.GetLed());
@ -199,12 +213,12 @@ public class CarPrepareState : IState
return Invoker.Invoke("TBox connect", 1000, 10, machine.IsCanceled,
() => machine.BoxConnectFlag, () =>
{
Task<bool> result = TBoxApi.Connect(machine.RfidReadModel.VelVin);
Task<bool> result = TBoxApi.Connect(machine.RfidReadModel.VelNo);
bool isConnect = result.Result;
if (isConnect)
{
//读取车辆carNo=carVin
Task<TboxCarInfoModel> carInfoResult = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
Task<TboxCarInfoModel> carInfoResult = TBoxApi.GetCarInfo(machine.RfidReadModel.VelNo);
var tboxCarInfoModel = carInfoResult.Result;
var carInfo = tboxCarInfoModel?.CarInfo;
if (carInfo != null)
@ -239,6 +253,7 @@ public class CarPrepareState : IState
/// <returns></returns>
public InvokeStatus CheckTBoxVelLocalFlag(SwappingStateMachine machine)
{
int q = 0;
return Invoker.Invoke("check TBox VelLocal", 1000, 20, machine.IsCanceled,
() => machine.BoxLocalCheckFlag, () =>
{
@ -253,6 +268,15 @@ public class CarPrepareState : IState
}, () => { machine.ExceptionReason = ExceptionReason.LocalCheckVarError; }, true, () =>
{
machine.ExceptionReason = ExceptionReason.LocalCheckVarError;
if (q == 0)
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music108);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music109);
Thread.Sleep(3000);
q = 1;
}
}
, 3, InvokeStatus.TimeOut);
}
@ -304,6 +328,7 @@ public class CarPrepareState : IState
/// <param name="machine"></param>
public InvokeStatus SelectPack(SwappingStateMachine machine)
{
int e = 0;
SwapAmtOrder? swapAmtOrder = _CommonMgr.QueryAmtOrder(machine);
@ -326,12 +351,22 @@ public class CarPrepareState : IState
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorSelectPack.GetLed());
LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrorSelectPack.GetLed());
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music49);
// SoundClient = AppInfo.Container.Resolve<SoundClient>();
//SoundClient.SoundPlay(SoundEnum.music49);
if (e == 0)
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music106);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music107);
Thread.Sleep(3000);
e = 1;
}
// _log.Info($"SelectPack error CanSwap={machine.SwapOrderBatteryInfo.CanSwap}");
}
else
{

@ -38,69 +38,6 @@ public class DoSwappingState : IState
// _log.Info($"BusinessSwappingForCloudState={machine.BusinessSwappingForCloudState}");
// CloudApi.SendStateLog(machine.SwapOrder, InfoEnum.BusinessSwappingForCloudState.BeginSwap);
//while (true)
//{
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Idel,
// machine);
// Thread.Sleep(1000);
// //_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
// //machine);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarInFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RfidReadFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudCarCanStartFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelUnlockFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.DistributeSelectPackFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StartSwappingFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StorageOldBatteryFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.OutNewBatteryFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
// machine);
// Thread.Sleep(1000);
// //_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarOutFlag,
// // machine);
// Thread.Sleep(10000);
// machine.Reset();
//}
//下发启动换电
InvokeStatus startSwapping = StartSwapping(machine);
@ -131,11 +68,11 @@ public class DoSwappingState : IState
}
//车辆上锁
InvokeStatus lockCar = LockCar(machine);
if (lockCar != InvokeStatus.Done)
{
return SwappingStateMachine.ReturnWithInvokeErr(lockCar, ExceptionReason.None);
}
//InvokeStatus lockCar = LockCar(machine);
//if (lockCar != InvokeStatus.Done)
//{
// return SwappingStateMachine.ReturnWithInvokeErr(lockCar, ExceptionReason.None);
//}
//开启雷达
var beginRadar = ControlRadar(machine, 1);
@ -145,12 +82,12 @@ public class DoSwappingState : IState
}
//车辆离开
var adjustCarByRadar = AdjustCarByRadar(machine);
machine.Reset();
if (InvokeStatus.Done != adjustCarByRadar)
{
return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
}
//var adjustCarByRadar = AdjustCarByRadar(machine);
//machine.Reset();
//if (InvokeStatus.Done != adjustCarByRadar)
//{
// return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
//}
@ -238,11 +175,11 @@ public class DoSwappingState : IState
return Invoker.Invoke("StartSwapping", 1000, 5, machine.IsCanceled,
() => machine.StartSwappingFlag, () =>
{
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelVin);
bool unLock = result.Result;
if (unLock)
{
var startSwapping = PlcApi.StartSwapping(machine.SwapOrderBatteryInfo.InBinInfo.No,
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelNo);
bool unLock = result.Result;
if (unLock)
{
var startSwapping = PlcApi.StartSwapping(machine.SwapOrderBatteryInfo.InBinInfo.No,
machine.SwapOrderBatteryInfo.UpBinInfo.No);
if (c==0)
{
@ -266,7 +203,7 @@ public class DoSwappingState : IState
}
}
}
}, () =>
{
//SoundClient = AppInfo.Container.Resolve<SoundClient>();

@ -202,7 +202,7 @@ public class StationReadyState : IState
public InvokeStatus AdjustCarByRadar(SwappingStateMachine machine)
{
int che = 0;
return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled,
() =>
{
@ -227,6 +227,14 @@ public class StationReadyState : IState
break;
case 3:
_log.Info("radar 角度偏移过大");
if (che == 0)
{
LedClient.SendMsgByKey(InfoEnum.SwapInfo.upcar.GetLed());
SoundClient.SoundPlay(SoundEnum.music100);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music101);
che = 1;
}
break;
case 4:
_log.Info("radar 车辆靠后");

@ -29,13 +29,14 @@ public class SwapDoneState : IState
public StateResult Handle(SwappingStateMachine machine)
{
//更新换电订单
machine.SwapOrder!.SwapResult = machine.SwapStatus;
machine.SwapOrder.SwapEndTime = DateTime.Now;
machine.SwapOrder.FailReason = machine.SwapFailReason;
_CommonMgr.UpdateSwapOrder(machine);
//修改预约单
////修改预约单
if (machine.SwapOrderBatteryInfo!.swapAmtOrder != null)
{
machine.SwapOrderBatteryInfo.swapAmtOrder.Status =
@ -48,7 +49,7 @@ public class SwapDoneState : IState
Task.Run(() =>
{
//新增换电成功上报云平台数据
// _CommonMgr.InsertCloudReportForSwapSuccess(machine);
// _CommonMgr.InsertCloudReportForSwapSuccess(machine);
//换电成功关于bininfo表的更新
_CommonMgr.UpdateBinInfoForSwapSuccess(machine);
@ -66,27 +67,33 @@ public class SwapDoneState : IState
////云平台没有匹配的失败状态
////车辆上锁 ,提示请驶离
//InvokeStatus lockCar = LockCar(machine);
InvokeStatus lockCar = LockCar(machine);
//if (lockCar != InvokeStatus.Done)
//{
// return SwappingStateMachine.ReturnWithInvokeErr(lockCar, ExceptionReason.None);
//}
if (lockCar != InvokeStatus.Done)
{
return SwappingStateMachine.ReturnWithInvokeErr(lockCar, ExceptionReason.None);
}
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoCarLeave.GetLed());
var adjustCarByRadar = AdjustCarByRadar(machine);
machine.Reset();
if (InvokeStatus.Done != adjustCarByRadar)
{
return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, 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);
//}
// 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);
//}
@ -146,25 +153,89 @@ public class SwapDoneState : IState
});
}
/// <summary>
/// 车辆上锁
/// </summary>
/// <returns></returns>
//public InvokeStatus LockCar(SwappingStateMachine machine)
//{
// return Invoker.Invoke("LockCar", 500, 100, machine.IsCanceled, machine.IsManualSwapSucc,
// () => machine.VelLockFlag, () =>
// {
// Task<bool> result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelVin);
// bool unLock = result.Result;
// if (unLock)
// {
// //查询车辆锁止状态
// Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
// if (carInfo.Result?.CarStatus?.LockStatus == 2)
// {
// machine.BoxCarInfoModel = carInfo.Result;
// SoundApi.PlayOneSound(machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
// ? (int)InfoEnum.SwapInfo.InfoCarLeave
// : (int)InfoEnum.SwapInfo.ErrInfoCarLeave);
// LedClient.SendMsgByKey(machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
// ? InfoEnum.SwapInfo.InfoCarLeave.GetLed()
// : InfoEnum.SwapInfo.ErrInfoCarLeave.GetLed());
// machine.VelLockFlag = true;
// //断连Tbox
// if (StaticStationInfo.TboxStateDisConnect)
// {
// TBoxApi.DisConnect(machine.BoxCarInfoModel.CarNo);
// }
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
// machine);
// }
// }
// }, () =>
// {
// // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrLockCar.GetLed());
// // SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrLockCar);
// var SoundClient = AppInfo.Container.Resolve<SoundClient>();
// //SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address19"));
// SoundClient.SoundPlay(SoundEnum.music59);
// LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrLockCar.GetLed());
// }, false, () => { machine.ExceptionReason = ExceptionReason.LockCarError; }
// , 10, InvokeStatus.None);
//}
/// <summary>
/// 车辆上锁
/// </summary>
/// <returns></returns>
public InvokeStatus LockCar(SwappingStateMachine machine)
{
int v = 0;
return Invoker.Invoke("LockCar", 500, 100, machine.IsCanceled, machine.IsManualSwapSucc,
() => machine.VelLockFlag, () =>
{
Task<bool> result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelVin);
Task<bool> result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelNo);
bool unLock = result.Result;
if (unLock)
{
//查询车辆锁止状态
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelNo);
if (carInfo.Result?.CarStatus?.LockStatus == 2)
{
machine.BoxCarInfoModel = carInfo.Result;
if (v == 0)
{
var SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music77);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music76);
Thread.Sleep(3000);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarOutFlag,
machine);
v = 1;
}
machine.BoxCarInfoModel = carInfo.Result;
SoundApi.PlayOneSound(machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
? (int)InfoEnum.SwapInfo.InfoCarLeave
: (int)InfoEnum.SwapInfo.ErrInfoCarLeave);
@ -173,29 +244,56 @@ public class SwapDoneState : IState
? InfoEnum.SwapInfo.InfoCarLeave.GetLed()
: InfoEnum.SwapInfo.ErrInfoCarLeave.GetLed());
machine.VelLockFlag = true;
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address19"));
//断连Tbox
if (StaticStationInfo.TboxStateDisConnect)
{
TBoxApi.DisConnect(machine.BoxCarInfoModel.CarNo);
}
//新增小步
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
machine);
}
}
}, () =>
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrLockCar.GetLed());
// SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrLockCar);
var SoundClient = AppInfo.Container.Resolve<SoundClient>();
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address19"));
SoundClient.SoundPlay(SoundEnum.music59);
LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrLockCar.GetLed());
}, false, () => { machine.ExceptionReason = ExceptionReason.LockCarError; }
, 10, InvokeStatus.None);
}
public InvokeStatus AdjustCarByRadar(SwappingStateMachine machine)
{
return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled,
() =>
{
//新增小步
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarOutFlag,
machine);
var carState = PadarMgr._PadarClient?.CarState;
return carState.HasValue && (carState.Value == 1 || carState.Value == 2 || carState.Value == 3 || carState.Value == 4 || carState.Value == 5);
},
() =>
{
switch (PadarMgr._PadarClient?.CarState)
{
case 6:
_log.Info("车辆未驶离");
break;
}
});
}
public InvokeStatus ExistRadar(SwappingStateMachine machine)
{
return Invoker.Invoke("wait exist radar", 1000, 5, machine.IsCanceled, machine.IsManualSwapSucc,
@ -215,8 +313,8 @@ public class SwapDoneState : IState
//出口写红灯
//更新车辆离场时间,上报云平台
machine.BusinessSwappingForCloudState =
InfoEnum.BusinessSwappingForCloudState.SwapDoneWithoutVel;
//machine.BusinessSwappingForCloudState =
// InfoEnum.BusinessSwappingForCloudState.SwapDoneWithoutVel;
machine.SwapOrder!.VehicleLeaveTime = DateTime.Now;
_CommonMgr.UpdateSwapOrder(machine);

@ -91,7 +91,7 @@ public class LedClient
{"前进",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x0C,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3B,0x3A,0x4D,0x75,0x6B,0x61,0x00,0x00,0x0D,0x0A, }},
{"后退",new byte[]{ 0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x0E,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3B,0x3A,0x4D,0x75,0x6E,0x64,0x75,0x72,0x00,0x00,0x0D,0x0A, }},
{"停好了",new byte[]{ 0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x14,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3B,0x3A,0x49,0x74,0x75,0x20,0x64,0x69,0x70,0x61,0x72,0x6B,0x69,0x72,0x00,0x00,0x0D,0x0A,}},
{"退出重新停车",new byte[]{ 0x55, 0xAA, 0x00, 0x00, 0x01, 0x01, 0x00, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x21, 0x00, 0x25, 0x64, 0x69, 0x73, 0x70, 0x30, 0x3B, 0x3A, 0x4B, 0x65, 0x6C, 0x75, 0x61, 0x72, 0x20, 0x64, 0x61, 0x6E, 0x20, 0x70, 0x61, 0x72, 0x6B, 0x69, 0x72, 0x20, 0x6B, 0x65, 0x6D, 0x62, 0x61, 0x6C, 0x69, 0x00, 0x00, 0x0D, 0x0A, }},
};
#endregion
@ -105,7 +105,7 @@ public class LedClient
{
_ip = ip;
_port = port;
Connect();
// Connect();
return _socket.Connected;
}
@ -120,7 +120,7 @@ public class LedClient
public static bool InnerSend(byte[] bytes)
{
Connect();
// Connect();
if (_socket?.Connected ?? true)
{
_socket?.Send(bytes);

@ -43,6 +43,7 @@ public class BatteryStatusReportedReqHandler : SimpleChannelInboundHandler<Batte
new BinInfo(){
Exists = 0,
ChargeStatus=2,
BatteryNo = "-1",
Soc = (decimal)-1,
Soe = (decimal)-1,

@ -139,7 +139,7 @@ public enum SoundEnum
music38,//车辆高压异常,请熄火车辆
music39,//车站通讯故障,请联系站务
music41,//[Info("欢迎光临换电站!(正在营业)","欢迎光临换电站!,本站正在营业中")]WelcomeInfo=1,
music41=41,//[Info("欢迎光临换电站!(正在营业)","欢迎光临换电站!,本站正在营业中")]WelcomeInfo=1,
music42,//[Info("标签读写失败", "标签读写失败")] ErrorReadRfid ,
music43,//[Info("车辆连接失败", "车辆连接失败,请联系站务人员")] ErrorTBoxConn ,
music44,//[Info("云端校验失败", "云端校验失败,请联系站务人员")] ErrorCloudCheck ,
@ -175,8 +175,8 @@ public enum SoundEnum
music73,//消防移仓中
music74,//开始读取标签失败
music75,
music76,//[Info(" 换电完成,请驶离印尼")] ErrStartSwap,
music77,//[Info(" 换电完成,请驶离")] ErrStartSwap,
music76=76,//[Info(" 换电完成,请驶离印尼")] ErrStartSwap,
music77=77,//[Info(" 换电完成,请驶离")] ErrStartSwap,
music78,
music79,
music80,
@ -193,6 +193,16 @@ public enum SoundEnum
music91,//[Info("换电开始印尼")] ErrStartSwap,
music92,//[Info(" 解锁成功中")] ErrStartSwap,
music93,//[Info(" 解锁成功印尼")] ErrStartSwap,
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,
/*

@ -105,43 +105,72 @@ public class MonitorService
plcSwapModel.ModelState = ClientMgr.PlcClient.Auto ? 1010 : 1000;
plcSwapModel.ControlModel = ClientMgr.PlcClient.Remote ? 1010 : 1000;
}
SwapMonitorScreenResp monitorScreenResp = new()
{
PlcSwapModel = plcSwapModel,
StateInfo = stateInfoList,
VehicleInfo = new SwapVehicleResp()
{
OrderNo = StationSoftMgr.SwappingStateMachine.SwapOrder != null
SwapMonitorScreenResp monitorScreenResp = new SwapMonitorScreenResp();
monitorScreenResp.PlcSwapModel = plcSwapModel;
monitorScreenResp.StateInfo = stateInfoList;
monitorScreenResp.VehicleInfo = new SwapVehicleResp();
monitorScreenResp.VehicleInfo.OrderNo = StationSoftMgr.SwappingStateMachine.SwapOrder != null
? StationSoftMgr.SwappingStateMachine.SwapOrder.Sn
: null,
VelMac = StationSoftMgr.SwappingStateMachine.RfidReadModel != null
? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelMac
: null,
LockStatus = tboxCarInfoModel != null ? tboxCarInfoModel.CarStatus.LockStatus : null,
KeyStatus = tboxCarInfoModel != null ? tboxCarInfoModel.CarStatus.Keys : null,
VelNo = StationSoftMgr.SwappingStateMachine.RfidReadModel != null
? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelNo
: null,
VelVin = StationSoftMgr.SwappingStateMachine.RfidReadModel != null
? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelVin
: null,
Break = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Break,
Gear = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Gear,
},
BatteryInfo = new()
{
BatteryTotalCount = binInfos.Count,
UsingSwapBatteryCount = binInfos.Select(i => i.ChargeStatus == 2 &&
i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock &&
i.Soc > StaticStationInfo.SwapSoc &&
new TimeSpan(DateTime.Now.Ticks -
i.LastChargeFinishTime.ToDateTime().Ticks)
.TotalMinutes >
StaticStationInfo.SwapFinishChargeTime).Count()
}
};
: null;
monitorScreenResp.VehicleInfo.VelMac = StationSoftMgr.SwappingStateMachine.RfidReadModel != null
? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelMac
: null;
monitorScreenResp.VehicleInfo.LockStatus = tboxCarInfoModel != null ? tboxCarInfoModel.CarStatus?.LockStatus : null;
monitorScreenResp.VehicleInfo.KeyStatus = tboxCarInfoModel != null ? tboxCarInfoModel.CarStatus?.Keys : null;
monitorScreenResp.VehicleInfo.VelNo = StationSoftMgr.SwappingStateMachine.RfidReadModel != null
? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelNo
: null;
monitorScreenResp.VehicleInfo.VelVin = StationSoftMgr.SwappingStateMachine.RfidReadModel != null
? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelVin
: null;
monitorScreenResp.VehicleInfo.Break = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Break;
monitorScreenResp.VehicleInfo.Gear = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Gear;
monitorScreenResp.BatteryInfo = new();
monitorScreenResp.BatteryInfo.BatteryTotalCount = binInfos.Count;
monitorScreenResp.BatteryInfo.UsingSwapBatteryCount = binInfos.Select(i => i.ChargeStatus == 2 &&
i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock &&
i.Soc > StaticStationInfo.SwapSoc &&
new TimeSpan(DateTime.Now.Ticks -
i.LastChargeFinishTime.ToDateTime().Ticks)
.TotalMinutes >
StaticStationInfo.SwapFinishChargeTime).Count();
//SwapMonitorScreenResp monitorScreenResp = new()
//{
// PlcSwapModel = plcSwapModel,
// StateInfo = stateInfoList,
// VehicleInfo = new SwapVehicleResp()
// {
// OrderNo = StationSoftMgr.SwappingStateMachine.SwapOrder != null
// ? StationSoftMgr.SwappingStateMachine.SwapOrder.Sn
// : null,
// VelMac = StationSoftMgr.SwappingStateMachine.RfidReadModel != null
// ? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelMac
// : null,
// LockStatus = tboxCarInfoModel != null ? tboxCarInfoModel.CarStatus.LockStatus : null,
// KeyStatus = tboxCarInfoModel != null ? tboxCarInfoModel.CarStatus.Keys : null,
// VelNo = StationSoftMgr.SwappingStateMachine.RfidReadModel != null
// ? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelNo
// : null,
// VelVin = StationSoftMgr.SwappingStateMachine.RfidReadModel != null
// ? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelVin
// : null,
// Break = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Break,
// Gear = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Gear,
// },
// BatteryInfo = new()
// {
// BatteryTotalCount = binInfos.Count,
// UsingSwapBatteryCount = binInfos.Select(i => i.ChargeStatus == 2 &&
// i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock &&
// i.Soc > StaticStationInfo.SwapSoc &&
// new TimeSpan(DateTime.Now.Ticks -
// i.LastChargeFinishTime.ToDateTime().Ticks)
// .TotalMinutes >
// StaticStationInfo.SwapFinishChargeTime).Count()
// }
//};
return Result<SwapMonitorScreenResp>.Success(monitorScreenResp);

@ -186,10 +186,10 @@ if (AppSettingsHelper.GetBool("padar", "enable"))
}
if (AppSettingsHelper.GetBool("led", "enable"))
{
LedClient.Init(AppSettingsHelper.GetContent("led", "ip"), Convert.ToInt32(AppSettingsHelper.GetContent("led", "port")));
}
//if (AppSettingsHelper.GetBool("led", "enable"))
//{
// LedClient.Init(AppSettingsHelper.GetContent("led", "ip"), Convert.ToInt32(AppSettingsHelper.GetContent("led", "port")));
//}
////启动换电流程
if (AppSettingsHelper.GetBool("swap", "enable"))

@ -17,7 +17,7 @@
"applicationUrl": "http://localhost:5034",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"profiles_active": "dev"
"profiles_active": "prod"
}
},
"IIS Express": {
@ -27,7 +27,7 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"applicationUrl": "http://0.0.0.0:5034",
"profiles_active": "dev"
"profiles_active": "prod"
}
}
}

Loading…
Cancel
Save