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