|
|
@ -41,6 +41,7 @@ public class DoSwappingState : IState
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return SwappingStateMachine.ReturnWithInvokeErr(startSwapping, ExceptionReason.None);
|
|
|
|
return SwappingStateMachine.ReturnWithInvokeErr(startSwapping, ExceptionReason.None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
InvokeStatus holdOn = HoldOn(machine);
|
|
|
|
InvokeStatus holdOn = HoldOn(machine);
|
|
|
|
if (holdOn != InvokeStatus.Done)
|
|
|
|
if (holdOn != InvokeStatus.Done)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -155,7 +156,7 @@ public class DoSwappingState : IState
|
|
|
|
bool holdOn = PlcApi.HoldOn();
|
|
|
|
bool holdOn = PlcApi.HoldOn();
|
|
|
|
if (holdOn)
|
|
|
|
if (holdOn)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.StartSwapInfo);
|
|
|
|
machine.PlcHoldFlag = true;
|
|
|
|
machine.PlcHoldFlag = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -177,13 +178,12 @@ public class DoSwappingState : IState
|
|
|
|
() => machine.UnOldBatteryFlag, () =>
|
|
|
|
() => machine.UnOldBatteryFlag, () =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoUnPack.GetLed());
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoUnPack.GetLed());
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int status = PlcApi.ReadPlcTaskStatus();
|
|
|
|
int status = PlcApi.ReadPlcTaskStatus();
|
|
|
|
//处理程序太快,plc还没有初始值的状态
|
|
|
|
//处理程序太快,plc还没有初始值的状态
|
|
|
|
if (status == 1002 || status != 1003)
|
|
|
|
if (status == 1002 || status != 1003)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -195,7 +195,8 @@ public class DoSwappingState : IState
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag,
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag,
|
|
|
|
machine);
|
|
|
|
machine);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, () => { });
|
|
|
|
}, () => { SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack); }, false, () => { }, 10,
|
|
|
|
|
|
|
|
InvokeStatus.None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public InvokeStatus OldBatteryCarryIn(SwappingStateMachine machine)
|
|
|
|
public InvokeStatus OldBatteryCarryIn(SwappingStateMachine machine)
|
|
|
@ -204,25 +205,25 @@ public class DoSwappingState : IState
|
|
|
|
() => machine.StorageOldBatteryFlag, () =>
|
|
|
|
() => machine.StorageOldBatteryFlag, () =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoOldBatteryCarryIn.GetLed());
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoOldBatteryCarryIn.GetLed());
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoOldBatteryCarryIn);
|
|
|
|
var readPlcTaskStatus = PlcApi.ReadPlcTaskStatus();
|
|
|
|
|
|
|
|
|
|
|
|
if (PlcApi.ReadPlcTaskStatus() == 1003)
|
|
|
|
if (readPlcTaskStatus == 1003 || readPlcTaskStatus != 1004)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoOldBatteryCarryIn);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
machine.StorageOldBatteryFlag = true;
|
|
|
|
machine.StorageOldBatteryFlag = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
machine.StorageOldBatteryFlag = PlcApi.ReadPlcTaskStatus() == 1004;
|
|
|
|
machine.StorageOldBatteryFlag = readPlcTaskStatus == 1004;
|
|
|
|
|
|
|
|
|
|
|
|
if (machine.StorageOldBatteryFlag)
|
|
|
|
if (machine.StorageOldBatteryFlag)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StorageOldBatteryFlag,
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StorageOldBatteryFlag,
|
|
|
|
machine);
|
|
|
|
machine);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, () => { });
|
|
|
|
}, () => { SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoOldBatteryCarryIn); }, false, () => { }, 10,
|
|
|
|
|
|
|
|
InvokeStatus.None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public InvokeStatus NewBatteryCarryOut(SwappingStateMachine machine)
|
|
|
|
public InvokeStatus NewBatteryCarryOut(SwappingStateMachine machine)
|
|
|
@ -231,22 +232,23 @@ public class DoSwappingState : IState
|
|
|
|
() => machine.OutNewBatteryFlag, () =>
|
|
|
|
() => machine.OutNewBatteryFlag, () =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoNewBatteryCarryOut.GetLed());
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoNewBatteryCarryOut.GetLed());
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoNewBatteryCarryOut);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (PlcApi.ReadPlcTaskStatus() == 1004)
|
|
|
|
if (PlcApi.ReadPlcTaskStatus() == 1004)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoNewBatteryCarryOut);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
machine.OutNewBatteryFlag = true;
|
|
|
|
machine.OutNewBatteryFlag = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (machine.OutNewBatteryFlag)
|
|
|
|
if (machine.OutNewBatteryFlag)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.OutNewBatteryFlag,
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.OutNewBatteryFlag,
|
|
|
|
machine);
|
|
|
|
machine);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, () => { });
|
|
|
|
}, () => { SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoNewBatteryCarryOut);}, false, () => { }, 10,
|
|
|
|
|
|
|
|
InvokeStatus.None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -256,10 +258,9 @@ public class DoSwappingState : IState
|
|
|
|
() => machine.InstallNewBatteryFlag, () =>
|
|
|
|
() => machine.InstallNewBatteryFlag, () =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPack.GetLed());
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPack.GetLed());
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoPack);
|
|
|
|
|
|
|
|
if (PlcApi.ReadPlcTaskStatus() == 1005)
|
|
|
|
if (PlcApi.ReadPlcTaskStatus() == 1005)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoPack);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -271,7 +272,11 @@ public class DoSwappingState : IState
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag,
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag,
|
|
|
|
machine);
|
|
|
|
machine);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, () => { });
|
|
|
|
}, () =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoPack);
|
|
|
|
|
|
|
|
},false, () => { },
|
|
|
|
|
|
|
|
10,InvokeStatus.None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public InvokeStatus PackFinish(SwappingStateMachine machine)
|
|
|
|
public InvokeStatus PackFinish(SwappingStateMachine machine)
|
|
|
@ -280,7 +285,6 @@ public class DoSwappingState : IState
|
|
|
|
() => machine.FinishNewBatteryFlag, () =>
|
|
|
|
() => machine.FinishNewBatteryFlag, () =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoPackFinish);
|
|
|
|
|
|
|
|
var readPlcTaskStatus = PlcApi.ReadPlcTaskStatus();
|
|
|
|
var readPlcTaskStatus = PlcApi.ReadPlcTaskStatus();
|
|
|
|
if (readPlcTaskStatus == 1006 || readPlcTaskStatus == 1007)
|
|
|
|
if (readPlcTaskStatus == 1006 || readPlcTaskStatus == 1007)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -289,11 +293,13 @@ public class DoSwappingState : IState
|
|
|
|
InfoEnum.BusinessSwappingForCloudState.SwapFinish;
|
|
|
|
InfoEnum.BusinessSwappingForCloudState.SwapFinish;
|
|
|
|
// CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState);
|
|
|
|
// CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState);
|
|
|
|
machine.BusinessSwappingStateUpdateTime = DateTime.Now;
|
|
|
|
machine.BusinessSwappingStateUpdateTime = DateTime.Now;
|
|
|
|
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoPackFinish);
|
|
|
|
|
|
|
|
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag,
|
|
|
|
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag,
|
|
|
|
machine);
|
|
|
|
machine);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, () => { });
|
|
|
|
}, () => { },false, () => { },
|
|
|
|
|
|
|
|
10,InvokeStatus.None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -307,9 +313,10 @@ public class DoSwappingState : IState
|
|
|
|
() => machine.ToSafePositionFlag, () =>
|
|
|
|
() => machine.ToSafePositionFlag, () =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
|
|
|
|
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition);
|
|
|
|
|
|
|
|
if (PlcApi.ReadPlcTaskStatus() == 1007)
|
|
|
|
if (PlcApi.ReadPlcTaskStatus() == 1007)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition);
|
|
|
|
machine.ToSafePositionFlag = true;
|
|
|
|
machine.ToSafePositionFlag = true;
|
|
|
|
machine.BusinessSwappingStateUpdateTime = DateTime.Now;
|
|
|
|
machine.BusinessSwappingStateUpdateTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
@ -319,7 +326,6 @@ public class DoSwappingState : IState
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 查看通道状态
|
|
|
|
/// 查看通道状态
|
|
|
|
/// :0:无效值
|
|
|
|
/// :0:无效值
|
|
|
|