재시작관련 코드 업데이트

This commit is contained in:
backuppc
2026-02-26 11:27:07 +09:00
parent c067a76462
commit 8beaa66516
8 changed files with 234 additions and 34 deletions

View File

@@ -125,6 +125,40 @@ namespace Project
//다음명령처리
PUB.NextWorkCmd = cmd;
PUB.log.AddI($"작업 시작: {nextStep} (Type: {cmd})");
// [Resume Logic]
if (nextStep == ERunStep.BUFFER_IN || nextStep == ERunStep.BUFFER_OUT)
{
int bufIdx = GetBufferIndex(targetNode);
if (bufIdx > 0)
{
var stepVar = (eVarInt32)Enum.Parse(typeof(eVarInt32), $"Buffer{bufIdx}Step");
var cmdVar = (eVarString)Enum.Parse(typeof(eVarString), $"Buffer{bufIdx}LastCmd");
int savedStep = VAR.I32[stepVar];
string savedCmd = VAR.STR[cmdVar];
// Resume Condition: Saved step exists AND command matches AND node matches
if (savedStep > 1 && savedCmd == cmd.ToString() && currNode.Id == targetNode.Id)
{
PUB.log.AddI($"[RESUME] 버퍼 {bufIdx} 작업 재개: Step {savedStep} (Cmd: {cmd})");
VAR.I32[eVarInt32.RetryMove] = 0;
VAR.I32[eVarInt32.RetryLift] = 0;
VAR.I32[eVarInt32.RetryManget] = 0;
VAR.I32[eVarInt32.RetryMarkStop] = 0;
PUB.sm.SetNewRunStep(nextStep);
PUB.sm.SetStepSeq((byte)savedStep);
return; // SetNewRunStep + SetStepSeq 로직으로 바로 시작
}
else if (savedStep > 0)
{
PUB.log.AddI($"[RESET] 버퍼 {bufIdx} 작업 초기화 (SavedStep:{savedStep}, SavedCmd:{savedCmd}, NodeMatch:{currNode.Id == targetNode.Id})");
VAR.I32[stepVar] = 0;
VAR.STR[cmdVar] = "";
}
}
}
PUB.sm.SetNewRunStep(nextStep);
}
break;
@@ -170,7 +204,33 @@ namespace Project
//다음명령처리
PUB.NextWorkCmd = cmd;
PUB.log.AddI($"작업 시작: {nextStep} (Type: {cmd})");
// [Resume Logic]
if (nextStep == ERunStep.BUFFER_IN || nextStep == ERunStep.BUFFER_OUT)
{
int bufIdx = GetBufferIndex(targetNode);
if (bufIdx > 0)
{
var stepVar = (eVarInt32)Enum.Parse(typeof(eVarInt32), $"Buffer{bufIdx}Step");
var cmdVar = (eVarString)Enum.Parse(typeof(eVarString), $"Buffer{bufIdx}LastCmd");
int savedStep = VAR.I32[stepVar];
string savedCmd = cmd.ToString();
// Resume Condition (Exit): Exit commands can resume if the AGV is still at the buffer
if (savedStep > 1 && VAR.STR[cmdVar] == savedCmd && currNode.Id == targetNode.Id)
{
PUB.log.AddI($"[RESUME] 버퍼 {bufIdx} 퇴출 재개: Step {savedStep}");
VAR.I32[eVarInt32.RetryMove] = 0;
VAR.I32[eVarInt32.RetryLift] = 0;
VAR.I32[eVarInt32.RetryManget] = 0;
VAR.I32[eVarInt32.RetryMarkStop] = 0;
PUB.sm.SetNewRunStep(nextStep);
PUB.sm.SetStepSeq((byte)savedStep);
return;
}
}
}
PUB.sm.SetNewRunStep(nextStep);
}
break;
@@ -435,7 +495,6 @@ namespace Project
else PUB.log.Add(e.Message);
}
}
}