|
@@ -43,38 +43,7 @@ int RecipeContext::Moniter()
|
|
|
// i.清除recipeExecuteCommand
|
|
|
// ii.执行下一步骤RecipeContext.executeNextStep();
|
|
|
//2.返回
|
|
|
- // 2.如果当前状态recipeExecuteStatus == TimeWait
|
|
|
- // 1.刷新计时updateTime(FALSE)
|
|
|
- // 2.依次执行RecipeChecker列表中每个检查器的check函数
|
|
|
- // i.如果有AlarmRecipeChecker被触发,则进行alarm condition相关处理并返回
|
|
|
- // 3.检查如果收到了abort指令(recipeExecuteCommand = Abort)
|
|
|
- // i.清除recipeExecuteCommand指令
|
|
|
- // ii.如果没有设置abort recipe,设置recipeExecuteStatus = StepCompleted,返回
|
|
|
- // iii.如果设置了abort recipe,更改执行索引到abort recipe(也是先设置步骤号为 - 1,保证next逻辑一致性)
|
|
|
- // iv.执行下一步骤RecipeContext.executeNextStep();
|
|
|
- //v.返回
|
|
|
- // 4.如果所有StableRecipeChecker都满足条件且elapsedStepTime到达或超过了step.time设置的时间
|
|
|
- // 1.设置设置recipeExecuteStatus = StepCompleted
|
|
|
- // 2.检查如果收到了skip或jump、Hold指令
|
|
|
- // a)如果是skip指令
|
|
|
- // i.清除recipeExecuteCommand
|
|
|
- // ii.执行RecipeContext.next()
|
|
|
- // iii.执行RecipeContext.executeNextStep()
|
|
|
- // iv.返回
|
|
|
- // b)如果是jump指令
|
|
|
- // i.清除recipeExecuteCommand
|
|
|
- // ii.执行jumpTo函数设置执行索引
|
|
|
- // iii.把执行step编号 / 子step编号减1(保证next的正确性)
|
|
|
- // iv.执行RecipeContext.executeNextStep()
|
|
|
- // v.返回
|
|
|
- // c)如果是Hold指令
|
|
|
- // i.清除recipeExecuteCommand
|
|
|
- // ii.执行RecipeContext.next()
|
|
|
- // iii.执行pause函数
|
|
|
- // iv.返回
|
|
|
- // 3.如果未收到改变recipe执行顺序的指令
|
|
|
- // a)执行下一步骤RecipeContext.executeNextStep();
|
|
|
- //b)返回
|
|
|
+
|
|
|
//3.如果当前状态recipeExecuteStatus == Paused
|
|
|
// 1.刷新计时updateTime(FALSE)
|
|
|
// 2.检查如果收到了skip或jump、Release指令
|
|
@@ -129,6 +98,7 @@ int RecipeContext::Moniter()
|
|
|
//TODO:命令执行过程中
|
|
|
}
|
|
|
}
|
|
|
+// 2.如果当前状态recipeExecuteStatus == TimeWait
|
|
|
|
|
|
if (recipeExecuteStatus == recipeExecuteStatusValue::TimeWait)
|
|
|
{
|
|
@@ -169,6 +139,61 @@ int RecipeContext::Moniter()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 4.如果所有StableRecipeChecker都满足条件且elapsedStepTime到达或超过了step.time设置的时间
|
|
|
+ if (elapsedStepTime >= getStepTime())
|
|
|
+ {
|
|
|
+ // 1.设置设置recipeExecuteStatus = StepCompleted
|
|
|
+ recipeExecuteStatus = recipeExecuteStatusValue::StepCompleted;
|
|
|
+ // 2.检查如果收到了skip或jump、Hold指令
|
|
|
+ if (recipeExecuteCommand == recipeExecuteCommandValue::Skip || recipeExecuteCommand == recipeExecuteCommandValue::Jump || recipeExecuteCommand == recipeExecuteCommandValue::Hold)
|
|
|
+ {
|
|
|
+ if (recipeExecuteCommand == recipeExecuteCommandValue::Skip)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ // a)如果是skip指令
|
|
|
+ // i.清除recipeExecuteCommand
|
|
|
+ recipeExecuteCommand = recipeExecuteCommandValue::Clear;
|
|
|
+
|
|
|
+ // ii.执行RecipeContext.next()
|
|
|
+ next();
|
|
|
+ // iii.执行RecipeContext.executeNextStep()
|
|
|
+ executeNextStep();
|
|
|
+ // iv.返回
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ // b)如果是jump指令
|
|
|
+ if (recipeExecuteCommand == recipeExecuteCommandValue::Jump)
|
|
|
+ {
|
|
|
+ // i.清除recipeExecuteCommand
|
|
|
+
|
|
|
+ // ii.执行jumpTo函数设置执行索引
|
|
|
+ // iii.把执行step编号 / 子step编号减1(保证next的正确性)
|
|
|
+ // iv.执行RecipeContext.executeNextStep()
|
|
|
+ // v.返回
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ // c)如果是Hold指令
|
|
|
+ if (recipeExecuteCommand == recipeExecuteCommandValue::Hold)
|
|
|
+ {
|
|
|
+ // i.清除recipeExecuteCommand
|
|
|
+ recipeExecuteCommand == recipeExecuteCommandValue::Clear;
|
|
|
+ // ii.执行RecipeContext.next()
|
|
|
+ next();
|
|
|
+ // iii.执行pause函数
|
|
|
+ pause();
|
|
|
+ // iv.返回
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3.如果未收到改变recipe执行顺序的指令
|
|
|
+ // a)执行下一步骤RecipeContext.executeNextStep();
|
|
|
+ executeNextStep();
|
|
|
+ // b)返回
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
//return 0;
|
|
|
}
|
|
|
if (recipeExecuteStatus == recipeExecuteStatusValue::TimeWait)
|
|
@@ -404,7 +429,11 @@ BOOL RecipeContext::judgeStep()
|
|
|
{
|
|
|
//1.currentRecipeType == NormalRecipe(主recipe)
|
|
|
// a)currentStepNo指定的当前步骤非法,直接返回FALSE
|
|
|
- if (currentStepNo < 0 || currentStepNo > mainStepList.size())
|
|
|
+ if (currentStepNo < 0 || currentStepNo >= mainStepList.size())
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (mainStepList.get(currentStepNo) == NULL)
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
@@ -412,7 +441,7 @@ BOOL RecipeContext::judgeStep()
|
|
|
// i.根据jumpStepName(在主recipe中)找到jumpStepNo
|
|
|
// ii.找到了设置currentStepNo = jumpStepNo,否则函数返回FALSE
|
|
|
// iii.返回(1)继续循环判断
|
|
|
- if (mainStepList.get(currentStepNo)->isJumpStep == TRUE)
|
|
|
+ if ( mainStepList.get(currentStepNo)->isJumpStep == TRUE)
|
|
|
{
|
|
|
string jumpStepName = mainStepList.get(currentStepNo)->jumpStepName;
|
|
|
for (size_t i = 0; i < mainStepList.size(); i++)
|
|
@@ -432,7 +461,7 @@ BOOL RecipeContext::judgeStep()
|
|
|
// 1.currentStepNo++
|
|
|
// 2.elapsedLoopCount = 0
|
|
|
// 3.返回(1)继续循环判断
|
|
|
- if (mainStepList.get(currentStepNo)->isLoopEndStep)
|
|
|
+ if ( mainStepList.get(currentStepNo)->isLoopEndStep)
|
|
|
{
|
|
|
mainStepList.get(currentStepNo)->elapsedLoopCount++;
|
|
|
if (mainStepList.get(currentStepNo)->elapsedLoopCount < mainStepList.get(currentStepNo)->loopCount)
|
|
@@ -485,6 +514,10 @@ BOOL RecipeContext::judgeStep()
|
|
|
// 1.currentRecipeType = NormalRecipe
|
|
|
// 2.返回(1)继续循环(进入normal recipe的调用步骤)
|
|
|
char* cork = CovertIntToChar(currentOtherRecipeKey);
|
|
|
+ if (subStepListMap.get(cork) == NULL)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
if (currentOtherStepNo > (*subStepListMap.get(cork)).size())
|
|
|
{
|
|
|
currentRecipeType = currentRecipeTypeValue::NormalRecipe;
|
|
@@ -554,6 +587,10 @@ BOOL RecipeContext::judgeStep()
|
|
|
|
|
|
// b)如果currentOtherStepNo达到abort recipe最大条数或非法(即已经执行完),返回FALSE
|
|
|
char* cork = CovertIntToChar(currentOtherRecipeKey);
|
|
|
+ if (abortStepListMap.get(cork) == NULL)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
if (currentOtherStepNo < 0 || currentOtherStepNo >= (*abortStepListMap.get(cork)).size())
|
|
|
{
|
|
|
return false;
|
|
@@ -608,6 +645,10 @@ BOOL RecipeContext::judgeStep()
|
|
|
if (currentRecipeType == currentRecipeTypeValue::AlarmRecipe)
|
|
|
{
|
|
|
char* cork = CovertIntToChar(currentOtherRecipeKey);
|
|
|
+ if (alarmStepListMap.get(cork) == NULL)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
if (currentOtherStepNo < 0 || currentOtherStepNo >= (*alarmStepListMap.get(CovertIntToChar(currentOtherRecipeKey))).size())
|
|
|
{
|
|
|
return false;
|
|
@@ -662,24 +703,25 @@ BOOL RecipeContext::next()
|
|
|
// a)如果currentRecipeType == NormalRecipe,currentStepNo++
|
|
|
// b)否则currentOtherStepNo++
|
|
|
// 3.返回 judgeStep()
|
|
|
- if (currentStepNo<0)
|
|
|
+ if (currentStepNo < 0)
|
|
|
{
|
|
|
if (!isJobRecipe)
|
|
|
{
|
|
|
currentStepNo += 1;
|
|
|
}
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (currentRecipeType == currentRecipeTypeValue::NormalRecipe)
|
|
|
+ {
|
|
|
+ currentStepNo++;
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
- if (currentRecipeType == currentRecipeTypeValue::NormalRecipe)
|
|
|
- {
|
|
|
- currentStepNo++;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- currentOtherStepNo++;
|
|
|
- }
|
|
|
+ currentOtherStepNo++;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return judgeStep();
|
|
@@ -1233,33 +1275,38 @@ void RecipeContext::ParseDataWithRawData()
|
|
|
{
|
|
|
|
|
|
RecipeStepMsgContext* rsmc = BytesToStruct<RecipeStepMsgContext>::FromBytes((uint8_t*)(buffer+2), popCount-2);
|
|
|
-
|
|
|
- mainStepList.add(rsmc->RecipeStep);
|
|
|
- LOG->Log(tlInfo, "mainStepList.size() = %d", mainStepList.size());
|
|
|
+ if (rsmc->RecipeStep.name[0] != '\0') //判断是否空值,空值不计入
|
|
|
+ {
|
|
|
+ mainStepList.add(rsmc->RecipeStep);
|
|
|
+ LOG->Log(tlInfo, "mainStepList.size() = %d", mainStepList.size());
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
if (tagid == 2)//subStepListMap
|
|
|
{
|
|
|
RecipeStepMsgContext* rsmc = BytesToStruct<RecipeStepMsgContext>::FromBytes((uint8_t*)(buffer + 2), popCount - 2);
|
|
|
+ if (rsmc->RecipeStep.name[0] != '\0') //判断是否空值,空值不计入
|
|
|
+ {
|
|
|
+ static char key[20] = "";
|
|
|
+ sprintf(key, "%d", rsmc->currentRecipeKey);
|
|
|
|
|
|
- static char key[20] = "";
|
|
|
- sprintf(key, "%d", rsmc->currentRecipeKey);
|
|
|
-
|
|
|
- auto sub = subStepListMap.getOrCreate(key);
|
|
|
- sub->add(rsmc->RecipeStep);
|
|
|
-
|
|
|
+ auto sub = subStepListMap.getOrCreate(key);
|
|
|
+ sub->add(rsmc->RecipeStep);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (tagid == 3)//alarmStepListMap
|
|
|
{
|
|
|
|
|
|
RecipeStepMsgContext* rsmc = BytesToStruct<RecipeStepMsgContext>::FromBytes((uint8_t*)(buffer + 2), popCount - 2);
|
|
|
+ if (rsmc->RecipeStep.name[0] != '\0') //判断是否空值,空值不计入
|
|
|
+ {
|
|
|
+ static char key[20] = "";
|
|
|
+ sprintf(key, "%d", rsmc->currentRecipeKey);
|
|
|
|
|
|
- static char key[20] = "";
|
|
|
- sprintf(key, "%d", rsmc->currentRecipeKey);
|
|
|
-
|
|
|
- auto sub = alarmStepListMap.getOrCreate(key);
|
|
|
- sub->add(rsmc->RecipeStep);
|
|
|
+ auto sub = alarmStepListMap.getOrCreate(key);
|
|
|
+ sub->add(rsmc->RecipeStep);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1267,74 +1314,93 @@ void RecipeContext::ParseDataWithRawData()
|
|
|
{
|
|
|
|
|
|
RecipeStepMsgContext* rsmc = BytesToStruct<RecipeStepMsgContext>::FromBytes((uint8_t*)(buffer + 2), popCount - 2);
|
|
|
- static char key[20] = "";
|
|
|
- sprintf(key, "%d", rsmc->currentRecipeKey);
|
|
|
- auto sub = abortStepListMap.getOrCreate(key);
|
|
|
- sub->add(rsmc->RecipeStep);
|
|
|
+ if (rsmc->RecipeStep.name[0] != '\0') //判断是否空值,空值不计入
|
|
|
+ {
|
|
|
+ static char key[20] = "";
|
|
|
+ sprintf(key, "%d", rsmc->currentRecipeKey);
|
|
|
+ auto sub = abortStepListMap.getOrCreate(key);
|
|
|
+ sub->add(rsmc->RecipeStep);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
if (tagid == 5)
|
|
|
{
|
|
|
RecipeCheckerMsgContext* rc = BytesToStruct<RecipeCheckerMsgContext>::FromBytes((uint8_t*)(buffer + 2), popCount - 2);
|
|
|
-
|
|
|
+
|
|
|
checkerList.add(rc->RecipeChk);
|
|
|
}
|
|
|
if (tagid == 6)
|
|
|
{
|
|
|
AlarmConditionMsgContext* ac = BytesToStruct<AlarmConditionMsgContext>::FromBytes((uint8_t*)(buffer + 2), popCount - 2);
|
|
|
-
|
|
|
- auto sub = alarmConditionDic.getOrCreate(CovertIntToChar(ac->currentAlarmConditionKey1));
|
|
|
- sub->set(ac->currentAlarmConditionKey2, ac->AlarmCdt);
|
|
|
+ if (ac->currentAlarmConditionKey2[0] != '\0')
|
|
|
+ {
|
|
|
+ auto sub = alarmConditionDic.getOrCreate(CovertIntToChar(ac->currentAlarmConditionKey1));
|
|
|
+ sub->set(ac->currentAlarmConditionKey2, ac->AlarmCdt);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (tagid == 7)
|
|
|
{
|
|
|
TempProfileMsgContext* tp = BytesToStruct<TempProfileMsgContext>::FromBytes((uint8_t*)(buffer + 2), popCount - 2);
|
|
|
-
|
|
|
- auto sub = tempProfileDic.getOrCreate(CovertIntToChar(tp->currentTempProfileKey1));
|
|
|
- sub->set(tp->currentTempProfileKey2, tp->TempPrf);
|
|
|
+ if (tp->currentTempProfileKey2[0] != '\0')
|
|
|
+ {
|
|
|
+ auto sub = tempProfileDic.getOrCreate(CovertIntToChar(tp->currentTempProfileKey1));
|
|
|
+ sub->set(tp->currentTempProfileKey2, tp->TempPrf);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
if (tagid == 8)
|
|
|
{
|
|
|
TempPIDMsgContext* tp = BytesToStruct<TempPIDMsgContext>::FromBytes((uint8_t*)(buffer + 2), popCount - 2);
|
|
|
- auto sub = tempPIDDic.getOrCreate(CovertIntToChar(tp->currentTempPIDKey1));
|
|
|
- sub->set(tp->currentTempPIDKey2, tp->TmpPID);
|
|
|
+ if (tp->currentTempPIDKey2[0] != '\0')
|
|
|
+ {
|
|
|
+ auto sub = tempPIDDic.getOrCreate(CovertIntToChar(tp->currentTempPIDKey1));
|
|
|
+ sub->set(tp->currentTempPIDKey2, tp->TmpPID);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (tagid == 9)
|
|
|
{
|
|
|
TempCorrectionMsgContext* tp = BytesToStruct<TempCorrectionMsgContext>::FromBytes((uint8_t*)(buffer + 2), popCount - 2);
|
|
|
+ if (tp->currentTempCorrectionKey2[0] != '\0')
|
|
|
+ {
|
|
|
+ auto sub = tempCorrectionDic.getOrCreate(CovertIntToChar(tp->currentTempCorrectionKey1));
|
|
|
+ sub->set(tp->currentTempCorrectionKey2, tp->TmpCorrection);
|
|
|
|
|
|
- auto sub = tempCorrectionDic.getOrCreate(CovertIntToChar(tp->currentTempCorrectionKey1));
|
|
|
- sub->set(tp->currentTempCorrectionKey2, tp->TmpCorrection);
|
|
|
-
|
|
|
- int len = tempCorrectionDic.length;
|
|
|
+ int len = tempCorrectionDic.length;
|
|
|
|
|
|
- LOG->Log(tlInfo, "tempCorrectionDic.length = %d", len);
|
|
|
+ LOG->Log(tlInfo, "tempCorrectionDic.length = %d", len);
|
|
|
+ }
|
|
|
}
|
|
|
if (tagid == 10)
|
|
|
{
|
|
|
APCPIDMsgContext* tp = BytesToStruct<APCPIDMsgContext>::FromBytes((uint8_t*)(buffer + 2), popCount - 2);
|
|
|
- auto sub = apcPIDDic.getOrCreate(CovertIntToChar(tp->currentAPCPIDKey1));
|
|
|
- sub->set(tp->currentAPCPIDKey2, tp->_apcpid);
|
|
|
+ if (tp->currentAPCPIDKey2[0] != '\0')
|
|
|
+ {
|
|
|
+ auto sub = apcPIDDic.getOrCreate(CovertIntToChar(tp->currentAPCPIDKey1));
|
|
|
+ sub->set(tp->currentAPCPIDKey2, tp->_apcpid);
|
|
|
|
|
|
- int len = apcPIDDic.length;
|
|
|
+ int len = apcPIDDic.length;
|
|
|
|
|
|
- LOG->Log(tlInfo, "apcPIDDic.length = %d", len);
|
|
|
+ LOG->Log(tlInfo, "apcPIDDic.length = %d", len);
|
|
|
+ }
|
|
|
}
|
|
|
if (tagid == 11)
|
|
|
{
|
|
|
LeakCheckMsgContext* tp = BytesToStruct<LeakCheckMsgContext>::FromBytes((uint8_t*)(buffer + 2), popCount - 2);
|
|
|
- auto sub = leakCheckDic.getOrCreate(CovertIntToChar(tp->currentLeakCheckKey1));
|
|
|
- sub->set(tp->currentLeakCheckKey2, tp->Lkc);
|
|
|
+ if (tp->currentLeakCheckKey2[0] != '\0')
|
|
|
+ {
|
|
|
+ auto sub = leakCheckDic.getOrCreate(CovertIntToChar(tp->currentLeakCheckKey1));
|
|
|
+ sub->set(tp->currentLeakCheckKey2, tp->Lkc);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (tagid == 21)
|
|
|
{
|
|
|
CommandkeySt* cks = BytesToStruct<CommandkeySt>::FromBytes((uint8_t*)(buffer + 2), popCount - 2);
|
|
|
+
|
|
|
if (cks->CKey == (int)CommandKey::Execute)
|
|
|
{
|
|
|
//先判断是否可以执行
|
|
@@ -1481,6 +1547,16 @@ void RecipeContext::ClearDicAndLisrData()
|
|
|
tempCorrectionDic.clear();
|
|
|
apcPIDDic.clear();
|
|
|
leakCheckDic.clear();
|
|
|
+ currentRecipeType = currentRecipeTypeValue::NormalRecipe;
|
|
|
+ currentStepNo = -1;
|
|
|
+ elapsedTotalTime = 0;
|
|
|
+ elapsedStepTime = 0;
|
|
|
+ remainTotalTime = 0;
|
|
|
+ remainStepTime = 0;
|
|
|
+ holdTotalTime = 0;
|
|
|
+ holdStepTime = 0;
|
|
|
+ startTime = 0;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
char* RecipeContext::getRawData(char* buffer, int bufferSize)
|