|
|
|
@ -11,6 +11,7 @@ using Service.Execute.StaticTools;
|
|
|
|
|
using Service.Execute.SwapException;
|
|
|
|
|
using Service.Execute.Utils;
|
|
|
|
|
using Service.Init;
|
|
|
|
|
using Service.Plc.Client;
|
|
|
|
|
using Service.Station;
|
|
|
|
|
|
|
|
|
|
namespace Service.Execute.Step;
|
|
|
|
@ -100,6 +101,7 @@ public class DoSwappingState : IState
|
|
|
|
|
{
|
|
|
|
|
return SwappingStateMachine.ReturnWithInvokeErr(toInvokeStatus, ExceptionReason.None);
|
|
|
|
|
}
|
|
|
|
|
//查询换电任务是否结束
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new StateResult()
|
|
|
|
@ -121,6 +123,12 @@ public class DoSwappingState : IState
|
|
|
|
|
bool unLock = result.Result;
|
|
|
|
|
if (unLock)
|
|
|
|
|
{
|
|
|
|
|
//查询当前是否有任务执行
|
|
|
|
|
|
|
|
|
|
var readTaskNo = PlcMgr.PlcClient?.ReadTaskNo();
|
|
|
|
|
if (readTaskNo == 0 || readTaskNo==1)
|
|
|
|
|
{
|
|
|
|
|
PlcMgr.PlcClient?.ExChangeTaskNo(1);
|
|
|
|
|
//查询车辆锁止状态
|
|
|
|
|
var startSwapping = PlcApi.StartSwapping(machine.SwapOrderBatteryInfo.InBinInfo.No,
|
|
|
|
|
machine.SwapOrderBatteryInfo.UpBinInfo.No);
|
|
|
|
@ -129,6 +137,7 @@ public class DoSwappingState : IState
|
|
|
|
|
var readPlcTaskStatus = PlcApi.ReadTaskStatus(1);
|
|
|
|
|
if (startSwapping && readPlcTaskStatus)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
machine.SwapOrder.SwapBeginTime = DateTime.Now;
|
|
|
|
|
_CommonMgr.UpdateSwapOrder(machine);
|
|
|
|
|
machine.SwapStatus = 0;
|
|
|
|
@ -137,10 +146,13 @@ public class DoSwappingState : IState
|
|
|
|
|
machine);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, () =>
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrStartSwap);
|
|
|
|
|
},false, () => { },10,InvokeStatus.None);
|
|
|
|
|
_log.Info("当前有任务在执行");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, () => { SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrStartSwap); }, false, () => { }, 10,
|
|
|
|
|
InvokeStatus.None);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -240,7 +252,6 @@ public class DoSwappingState : IState
|
|
|
|
|
|
|
|
|
|
if (PlcApi.ReadPlcTaskStatus() == 1004)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -252,7 +263,7 @@ public class DoSwappingState : IState
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.OutNewBatteryFlag,
|
|
|
|
|
machine);
|
|
|
|
|
}
|
|
|
|
|
}, () => { SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoNewBatteryCarryOut);}, false, () => { }, 10,
|
|
|
|
|
}, () => { SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoNewBatteryCarryOut); }, false, () => { }, 10,
|
|
|
|
|
InvokeStatus.None);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -265,7 +276,6 @@ public class DoSwappingState : IState
|
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPack.GetLed());
|
|
|
|
|
if (PlcApi.ReadPlcTaskStatus() == 1005)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -277,11 +287,8 @@ public class DoSwappingState : IState
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag,
|
|
|
|
|
machine);
|
|
|
|
|
}
|
|
|
|
|
}, () =>
|
|
|
|
|
{
|
|
|
|
|
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoPack);
|
|
|
|
|
},false, () => { },
|
|
|
|
|
10,InvokeStatus.None);
|
|
|
|
|
}, () => { SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoPack); }, false, () => { },
|
|
|
|
|
10, InvokeStatus.None);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public InvokeStatus PackFinish(SwappingStateMachine machine)
|
|
|
|
@ -303,8 +310,8 @@ public class DoSwappingState : IState
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag,
|
|
|
|
|
machine);
|
|
|
|
|
}
|
|
|
|
|
}, () => { },false, () => { },
|
|
|
|
|
10,InvokeStatus.None);
|
|
|
|
|
}, () => { }, false, () => { },
|
|
|
|
|
10, InvokeStatus.None);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -321,12 +328,16 @@ public class DoSwappingState : IState
|
|
|
|
|
|
|
|
|
|
if (PlcApi.ReadPlcTaskStatus() == 1007)
|
|
|
|
|
{
|
|
|
|
|
if (PlcApi.ReadTaskStatusReset())
|
|
|
|
|
{
|
|
|
|
|
PlcMgr.PlcClient?.ResetTaskNo();
|
|
|
|
|
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition);
|
|
|
|
|
machine.ToSafePositionFlag = true;
|
|
|
|
|
machine.BusinessSwappingStateUpdateTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
machine.SwapStatus = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, () => { });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -344,7 +355,6 @@ public class DoSwappingState : IState
|
|
|
|
|
int count = 0;
|
|
|
|
|
while (!machine.ChannelStatusOkFlag)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (machine.CancelFlag)
|
|
|
|
|
{
|
|
|
|
|
_log.Info($" CheckChannelStatus canceled");
|
|
|
|
@ -375,7 +385,7 @@ public class DoSwappingState : IState
|
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrChannelStatus.GetLed());
|
|
|
|
|
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrChannelStatus);
|
|
|
|
|
//等待2分钟
|
|
|
|
|
Thread.Sleep(3*60 *1000);
|
|
|
|
|
Thread.Sleep(3 * 60 * 1000);
|
|
|
|
|
machine.VehiclesInPlace2Flag = false;
|
|
|
|
|
machine.StartSwappingFlag = false;
|
|
|
|
|
machine.PlcHoldFlag = false;
|
|
|
|
@ -449,7 +459,7 @@ public class DoSwappingState : IState
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (succCount==successCount)
|
|
|
|
|
if (succCount == successCount)
|
|
|
|
|
{
|
|
|
|
|
machine.VehiclesInPlace2Flag = true;
|
|
|
|
|
}
|
|
|
|
|