現場測試主流程修改

zw
lxw 6 months ago
parent 55ef020fcf
commit 612c2ee9b1

@ -31,8 +31,8 @@ public class InfoEnum
[Info("航车已回归安全位置", "航车已回归安全位置")] InfoToSafePosition , [Info("航车已回归安全位置", "航车已回归安全位置")] InfoToSafePosition ,
[Info("换电已完成,请驶离", "换电已完成,请驶离")] InfoCarLeave , [Info("换电已完成,请驶离", "换电已完成,请驶离")] InfoCarLeave ,
[Info("换电失败,请驶离", "换电失败,请驶离")] ErrInfoCarLeave , [Info("换电失败,请驶离", "换电失败,请驶离")] ErrInfoCarLeave ,
[Info("旧电池搬运中,请稍后", "旧电池搬运中,请稍后")] InfoOldBatteryCarryIn , [Info("电池入仓中,请稍后", "电池入仓中,请稍后")] InfoOldBatteryCarryIn ,
[Info("新电池搬运中,请稍后", "新电池搬运中,请稍后")] InfoNewBatteryCarryOut , [Info("电池出仓中,请稍后", "电池出仓中,请稍后")] InfoNewBatteryCarryOut ,
[Info("车辆上锁失败", "车辆上锁失败")] ErrLockCar , [Info("车辆上锁失败", "车辆上锁失败")] ErrLockCar ,
[Info("通道的电池仓无可用换电电池","通道的电池仓无可用换电电池")] NoBatteryErr, [Info("通道的电池仓无可用换电电池","通道的电池仓无可用换电电池")] NoBatteryErr,
[Info("结束充电电池数量不足","通道的电池仓无可用换电电池")] LessOfFinishChargingErr, [Info("结束充电电池数量不足","通道的电池仓无可用换电电池")] LessOfFinishChargingErr,

@ -184,7 +184,7 @@ public class CarPrepareState : IState
/// <returns></returns> /// <returns></returns>
public InvokeStatus CheckTBoxConnectFlag(SwappingStateMachine machine) public InvokeStatus CheckTBoxConnectFlag(SwappingStateMachine machine)
{ {
return Invoker.Invoke("check TBox connect", 1000, 100, machine.IsCanceled, return Invoker.Invoke("check TBox connect", 1000, 10, machine.IsCanceled,
() => machine.BoxConnectFlag, () => () => machine.BoxConnectFlag, () =>
{ {
Task<bool> result = TBoxApi.IsConnected(); Task<bool> result = TBoxApi.IsConnected();
@ -200,7 +200,7 @@ public class CarPrepareState : IState
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorTBoxConn.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorTBoxConn.GetLed());
} }
, 30, InvokeStatus.None); , 20, InvokeStatus.None);
} }

@ -340,13 +340,15 @@ public class DoSwappingState : IState
while (!machine.ChannelStatusOkFlag) while (!machine.ChannelStatusOkFlag)
{ {
_log.Info("begin plc CheckChannelStatus"); _log.Info("begin plc CheckChannelStatus");
Thread.Sleep(1000); Thread.Sleep(2000);
var channelStatus = PlcApi.ChannelStatus(); var channelStatus = PlcApi.ChannelStatus();
if (count % 10 == 0) if (count % 10 == 0)
{ {
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.CarTakePhotoInfo); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.CarTakePhotoInfo);
} }
count++;
if (channelStatus == 1000) if (channelStatus == 1000)
{ {
machine.ChannelStatusOkFlag = true; machine.ChannelStatusOkFlag = true;
@ -360,8 +362,8 @@ public class DoSwappingState : IState
{ {
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrChannelStatus.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrChannelStatus.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrChannelStatus); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrChannelStatus);
//等待3分钟 //等待2分钟
Thread.Sleep(3000); Thread.Sleep(60000);
machine.VehiclesInPlace2Flag = false; machine.VehiclesInPlace2Flag = false;
machine.StartSwappingFlag = false; machine.StartSwappingFlag = false;
machine.PlcHoldFlag = false; machine.PlcHoldFlag = false;

@ -41,45 +41,26 @@ public class PlcClient : ModbusTcpMaster
{ {
PlcMgr.DataValidityTime = DateTime.Now; PlcMgr.DataValidityTime = DateTime.Now;
ModbusDecoder.Decode<PlcToHost>(bytes02, PlcMgr.PlcToHostData); ModbusDecoder.Decode<PlcToHost>(bytes02, PlcMgr.PlcToHostData);
if (PlcMgr.PlcToHostData.MaterialDetec01.Value == 1)
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec01.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "1");
else
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec01.Value, it => it.No == "1"); _binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec01.Value, it => it.No == "1");
if (PlcMgr.PlcToHostData.MaterialDetec02.Value == 1)
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec02.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "2");
else
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec02.Value, it => it.No == "2"); _binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec02.Value, it => it.No == "2");
if (PlcMgr.PlcToHostData.MaterialDetec03.Value == 1)
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec03.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "3");
else
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec03.Value, it => it.No == "3"); _binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec03.Value, it => it.No == "3");
if (PlcMgr.PlcToHostData.MaterialDetec04.Value == 1)
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec04.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "4");
else
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec04.Value, it => it.No == "4"); _binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec04.Value, it => it.No == "4");
if (PlcMgr.PlcToHostData.MaterialDetec05.Value == 1)
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec05.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "5");
else
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec05.Value, it => it.No == "5"); _binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec05.Value, it => it.No == "5");
if (PlcMgr.PlcToHostData.MaterialDetec06.Value == 1)
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec06.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "6");
else
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec06.Value, it => it.No == "6"); _binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec06.Value, it => it.No == "6");
if (PlcMgr.PlcToHostData.MaterialDetec07.Value == 1)
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec07.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "7");
else
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec07.Value, it => it.No == "7"); _binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec07.Value, it => it.No == "7");
if (PlcMgr.PlcToHostData.MaterialDetec08.Value == 1)
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec08.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "8");
else
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec08.Value, it => it.No == "8"); _binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec08.Value, it => it.No == "8");
} }

@ -82,7 +82,7 @@ public class SwapOrderStepService : BaseServices<SwapOrderStep>
{ {
SwapOrderStep swapOrderStep = new () SwapOrderStep swapOrderStep = new ()
{ {
StepName = BaseEnumExtensions.GetNameByEnum<InfoEnum.BusinessSwappingStep>(step), StepName = BaseEnumExtensions.GetDescription(step),
Step = (int)step, Step = (int)step,
Sort = sort, Sort = sort,
SwapOrderSn = swapOrderSn, SwapOrderSn = swapOrderSn,

@ -156,6 +156,6 @@ CloudClientMgr.Init();
//PLC //PLC
PlcMgr.Init(); PlcMgr.Init();
//启动换电流程 //启动换电流程
StationSoftMgr.SwappingStateMachineStart(); //StationSoftMgr.SwappingStateMachineStart();
//StationSoftMgr.StartTasks(); //StationSoftMgr.StartTasks();
app.Run(); app.Run();
Loading…
Cancel
Save