瀏覽代碼

修改getCommandParameter函数

gyj 1 周之前
父節點
當前提交
be829c1c14

+ 19 - 11
TIN001-PLC/Jet_Furance_PMC/Jet_Furance_PMC/Jet_Furance_PMC/FurancePMC/RecipeContext.cpp

@@ -991,10 +991,10 @@ void RecipeContext::updateTime(BOOL newStep)
 
 
 
-string* RecipeContext::getCommandParam(string command)
+char * RecipeContext::getCommandParam(string command)
 {
 	EV->postInfoLog("RecipeContext::getCommandParam(string command)");
-	string ret = "";
+
 	//根据命令名称获取(当前step)的参数列表(不包含命令本身)
 	//	流程:
 	//	1.如果当前步骤非法,则返回NULL
@@ -1002,28 +1002,36 @@ string* RecipeContext::getCommandParam(string command)
 	//	3.返回command指定关键字的参数列表
 	//	4.注意C++中数组(指针)没有长度,所以要以NULL空指针结尾
 
+	static CommandMapST* retcommand;
 	if (currentRecipeType == currentRecipeTypeValue::NormalRecipe)
 	{
-		//ret = mainStepList[currentStepNo].commandMap[command];
+		retcommand = mainStepList.get(currentStepNo)->commandMaps;
 	}
 	if (currentRecipeType == currentRecipeTypeValue::SubRecipe)
 	{
-
-		//ret = subStepListMap[currentOtherRecipeKey][currentOtherStepNo].commandMap[command];
-			
+		retcommand = subStepListMap.get(CovertIntToChar(currentOtherRecipeKey))->get(currentOtherStepNo)->commandMaps;
+	}
+	if (currentRecipeType == currentRecipeTypeValue::AlarmRecipe)
+	{
+		retcommand = alarmStepListMap.get(CovertIntToChar(currentOtherRecipeKey))->get(currentOtherStepNo)->commandMaps;
 	}
-
 	if (currentRecipeType == currentRecipeTypeValue::AbortRecipe)
 	{
-		//ret = abortStepListMap[currentOtherRecipeKey][currentOtherStepNo].commandMap[command];
+		retcommand = abortStepListMap.get(CovertIntToChar(currentOtherRecipeKey))->get(currentOtherStepNo)->commandMaps;
 	}
 
-	if (currentRecipeType == currentRecipeTypeValue::AlarmRecipe)
+	for (int i = 0; i < 200; i++)
 	{
-		//ret = alarmStepListMap[currentOtherRecipeKey][currentOtherStepNo].commandMap[command];
+		if (retcommand == NULL) break;  // 先判断数组指针有效性
+		if (retcommand[i].Command[0] == '\0') continue;  // 跳过空元素
+		if (retcommand[i].Param[0] == '\0') continue;  // 跳过空元素
+		if (retcommand[i].Command== command.c_str())
+		{
+			return (retcommand[i].Param);
+		}
 	}
 
-	return &ret;
+	return NULL;
 }
 
 

+ 1 - 1
TIN001-PLC/Jet_Furance_PMC/Jet_Furance_PMC/Jet_Furance_PMC/FurancePMC/RecipeContext.h

@@ -261,7 +261,7 @@ public:
 
 	void pause();
 	void updateTime(BOOL newStep);
-	string* getCommandParam(string command);
+	char* getCommandParam(string command);
 	string getCurrentStepName();	//step名称,自动识别主recipe还是其他recipe
 	int getCurrentRecipeType();	//当前步骤所在recipe的类型
 	int getCurrentStepNo();		//0开始,主recipe的步骤号

二進制
TIN001-PLC/TIN001/FurancePMC.pdb


二進制
TIN001-PLC/TIN001/FurancePMC.sys


+ 1 - 1
TIN001-PLC/TIN001/_Boot/TwinCAT RT (x64)/CurrentConfig.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<TcBootProject CreateTime="2025-06-26T14:23:15">
+<TcBootProject CreateTime="2025-06-26T18:09:02">
 	<System>
 		<LockedMemSize>33554432</LockedMemSize>
 		<AffinityMask>#x1</AffinityMask>

二進制
TIN001-PLC/TIN001/_Boot/TwinCAT RT (x64)/CurrentConfig/FurancePMC.tczip


二進制
TIN001-PLC/TIN001/_Boot/TwinCAT RT (x64)/Plc/Port_851_boot.tizip


二進制
TIN001-PLC/TIN001/_Deployment/TwinCAT RT (x64)/FurancePMC.pdb


二進制
TIN001-PLC/TIN001/_Deployment/TwinCAT RT (x64)/FurancePMC.sys