|
|
@ -67,12 +67,6 @@ public class DoSwappingState : IState
|
|
|
|
return SwappingStateMachine.ReturnWithInvokeErr(packFinish, ExceptionReason.None);
|
|
|
|
return SwappingStateMachine.ReturnWithInvokeErr(packFinish, ExceptionReason.None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//车辆上锁
|
|
|
|
|
|
|
|
//InvokeStatus lockCar = LockCar(machine);
|
|
|
|
|
|
|
|
//if (lockCar != InvokeStatus.Done)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// return SwappingStateMachine.ReturnWithInvokeErr(lockCar, ExceptionReason.None);
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//开启雷达
|
|
|
|
//开启雷达
|
|
|
|
var beginRadar = ControlRadar(machine, 1);
|
|
|
|
var beginRadar = ControlRadar(machine, 1);
|
|
|
@ -81,13 +75,6 @@ public class DoSwappingState : IState
|
|
|
|
return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None);
|
|
|
|
return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//车辆离开
|
|
|
|
|
|
|
|
//var adjustCarByRadar = AdjustCarByRadar(machine);
|
|
|
|
|
|
|
|
//machine.Reset();
|
|
|
|
|
|
|
|
//if (InvokeStatus.Done != adjustCarByRadar)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -222,7 +209,7 @@ public class DoSwappingState : IState
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
public InvokeStatus UnPack(SwappingStateMachine machine)
|
|
|
|
public InvokeStatus UnPack(SwappingStateMachine machine)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int s = 0;
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
|
return Invoker.Invoke("plc UnPack", 500, 5, machine.IsCanceled,
|
|
|
|
return Invoker.Invoke("plc UnPack", 500, 5, machine.IsCanceled,
|
|
|
|
() => machine.UnOldBatteryFlag, () =>
|
|
|
|
() => machine.UnOldBatteryFlag, () =>
|
|
|
@ -231,14 +218,7 @@ public class DoSwappingState : IState
|
|
|
|
|
|
|
|
|
|
|
|
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoUnPack.GetLed());
|
|
|
|
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoUnPack.GetLed());
|
|
|
|
SoundClient = AppInfo.Container.Resolve<SoundClient>();
|
|
|
|
SoundClient = AppInfo.Container.Resolve<SoundClient>();
|
|
|
|
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address11"));
|
|
|
|
|
|
|
|
if (s==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag,
|
|
|
|
|
|
|
|
machine);
|
|
|
|
|
|
|
|
//SoundClient.SoundPlay(SoundEnum.music51);
|
|
|
|
|
|
|
|
//s = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
machine.UnOldBatteryFlag = ClientMgr.PlcClient.DisassembleDone;
|
|
|
|
machine.UnOldBatteryFlag = ClientMgr.PlcClient.DisassembleDone;
|
|
|
|
|
|
|
|
|
|
|
@ -251,23 +231,16 @@ public class DoSwappingState : IState
|
|
|
|
},
|
|
|
|
},
|
|
|
|
() =>
|
|
|
|
() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if(i==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SoundClient = AppInfo.Container.Resolve<SoundClient>();
|
|
|
|
SoundClient = AppInfo.Container.Resolve<SoundClient>();
|
|
|
|
SoundClient.SoundPlay(SoundEnum.music51);
|
|
|
|
SoundClient.SoundPlay(SoundEnum.music51);
|
|
|
|
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack);
|
|
|
|
|
|
|
|
i = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, false, () => { }, 30,
|
|
|
|
}, false, () => { }, 10,
|
|
|
|
|
|
|
|
InvokeStatus.None);
|
|
|
|
InvokeStatus.None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public InvokeStatus Pack(SwappingStateMachine machine)
|
|
|
|
public InvokeStatus Pack(SwappingStateMachine machine)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int a = 0;
|
|
|
|
|
|
|
|
return Invoker.Invoke("plc Pack ing", 500, 5, machine.IsCanceled,
|
|
|
|
return Invoker.Invoke("plc Pack ing", 500, 5, machine.IsCanceled,
|
|
|
|
() => machine.InstallNewBatteryFlag, () =>
|
|
|
|
() => machine.InstallNewBatteryFlag, () =>
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -278,9 +251,7 @@ public class DoSwappingState : IState
|
|
|
|
|
|
|
|
|
|
|
|
if (machine.InstallNewBatteryFlag)
|
|
|
|
if (machine.InstallNewBatteryFlag)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag,
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag,
|
|
|
|
machine);
|
|
|
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StorageOldBatteryFlag,
|
|
|
|
|
|
|
|
machine);
|
|
|
|
machine);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, () =>
|
|
|
|
}, () =>
|
|
|
@ -288,16 +259,12 @@ public class DoSwappingState : IState
|
|
|
|
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoPack);
|
|
|
|
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoPack);
|
|
|
|
SoundClient = AppInfo.Container.Resolve<SoundClient>();
|
|
|
|
SoundClient = AppInfo.Container.Resolve<SoundClient>();
|
|
|
|
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address12"));
|
|
|
|
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address12"));
|
|
|
|
if (a == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SoundClient.SoundPlay(SoundEnum.music52);
|
|
|
|
SoundClient.SoundPlay(SoundEnum.music52);
|
|
|
|
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPack.GetLed());
|
|
|
|
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPack.GetLed());
|
|
|
|
a = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},false, () => { },
|
|
|
|
},false, () => { },
|
|
|
|
10,InvokeStatus.None);
|
|
|
|
30,InvokeStatus.None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public InvokeStatus PackFinish(SwappingStateMachine machine)
|
|
|
|
public InvokeStatus PackFinish(SwappingStateMachine machine)
|
|
|
@ -306,28 +273,15 @@ public class DoSwappingState : IState
|
|
|
|
return Invoker.Invoke("plc Pack Finish", 500, 5, machine.IsCanceled,
|
|
|
|
return Invoker.Invoke("plc Pack Finish", 500, 5, machine.IsCanceled,
|
|
|
|
() => machine.FinishNewBatteryFlag, () =>
|
|
|
|
() => machine.FinishNewBatteryFlag, () =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
|
|
|
|
|
|
|
|
if (ClientMgr.PlcClient.SwapDone)
|
|
|
|
if (ClientMgr.PlcClient.SwapDone)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
machine.FinishNewBatteryFlag = true;
|
|
|
|
machine.FinishNewBatteryFlag = true;
|
|
|
|
machine.BusinessSwappingForCloudState =
|
|
|
|
machine.BusinessSwappingForCloudState =
|
|
|
|
InfoEnum.BusinessSwappingForCloudState.SwapFinish;
|
|
|
|
InfoEnum.BusinessSwappingForCloudState.SwapFinish;
|
|
|
|
// CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState);
|
|
|
|
|
|
|
|
machine.BusinessSwappingStateUpdateTime = DateTime.Now;
|
|
|
|
machine.BusinessSwappingStateUpdateTime = DateTime.Now;
|
|
|
|
SoundClient = AppInfo.Container.Resolve<SoundClient>();
|
|
|
|
|
|
|
|
if (b==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// SoundClient.SoundPlay(SoundEnum.music77);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
|
|
|
|
SoundClient = AppInfo.Container.Resolve<SoundClient>();
|
|
|
|
b = 1;
|
|
|
|
SoundClient.SoundPlay(SoundEnum.music53);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.OutNewBatteryFlag,
|
|
|
|
|
|
|
|
machine);
|
|
|
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag,
|
|
|
|
|
|
|
|
machine);
|
|
|
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag,
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag,
|
|
|
|
machine);
|
|
|
|
machine);
|
|
|
|
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition);
|
|
|
|
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition);
|
|
|
@ -336,8 +290,12 @@ public class DoSwappingState : IState
|
|
|
|
|
|
|
|
|
|
|
|
machine.SwapStatus = 1;
|
|
|
|
machine.SwapStatus = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, () => { },false, () => { },
|
|
|
|
}, () =>
|
|
|
|
10,InvokeStatus.None);
|
|
|
|
{
|
|
|
|
|
|
|
|
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},false, () => { },
|
|
|
|
|
|
|
|
30,InvokeStatus.None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|