|
|
@ -11,6 +11,7 @@ void TestPageMgrService::stopReportState(shared_ptr<MsgProcessContext> cxt) { m_ |
|
|
|
void TestPageMgrService::initialize() { |
|
|
|
GET_TO_SERVICE(m_db); |
|
|
|
GET_TO_SERVICE(m_ds); |
|
|
|
GET_TO_SERVICE(dcs); |
|
|
|
|
|
|
|
REGFN(TestPageMgrService, getTestPageCfgInfo); |
|
|
|
REGFN(TestPageMgrService, onButton); |
|
|
@ -20,83 +21,139 @@ void TestPageMgrService::initialize() { |
|
|
|
REGFN(TestPageMgrService, stopReportState); |
|
|
|
|
|
|
|
m_dict = make_shared<ZDictionary>(); |
|
|
|
m_dict->insert("pumpVel", "速度"); |
|
|
|
m_dict->insert("pumpDir", "方向"); |
|
|
|
m_dict->insert("sprayPumpCtrl", "喷液泵控制"); |
|
|
|
m_dict->insert("addDischargePumpCtrl", "加液泵控制"); |
|
|
|
m_dict->insert("airCompressorCtrl", "空压机控制"); |
|
|
|
m_dict->insert("blowerCtrl", "风机控制"); |
|
|
|
m_dict->insert("heatingCtrl", "加热片控制"); |
|
|
|
m_dict->insert("addingLiquid", "加液"); |
|
|
|
m_dict->insert("drainLiquid", "排液"); |
|
|
|
m_dict->insert("on", "打开"); |
|
|
|
m_dict->insert("off", "关闭"); |
|
|
|
m_dict->insert("AcCurrent", "空压机电流"); |
|
|
|
m_dict->insert("temperature", "温度"); |
|
|
|
m_dict->insert("current", "电流"); |
|
|
|
m_dict->insert("voltage", "电压"); |
|
|
|
m_dict->insert("heatingState", "加热片状态"); |
|
|
|
m_dict->insert("heatingTemperature", "加热片温度"); |
|
|
|
m_dict->insert("heatingCurrent", "加热片电流"); |
|
|
|
m_dict->insert("forward", "正转"); |
|
|
|
m_dict->insert("backward", "反转"); |
|
|
|
m_dict->insert("stop", "停止"); |
|
|
|
|
|
|
|
m_testPageItemMgr.installDict(m_dict); |
|
|
|
|
|
|
|
// 喷液泵
|
|
|
|
m_testPageItemMgr.installParamType("pumpVel", "g/min", {"5", "10", "15"}); |
|
|
|
m_testPageItemMgr.insertButtons("sprayPumpCtrl", {"pumpVel"}, {"forward", "backward", "stop"}, [this](string buttonName, vector<string> param) { //
|
|
|
|
m_dict->insert("pumpVel", "速度"); |
|
|
|
m_dict->insert("sprayPumpCtrl", "喷液泵控制"); |
|
|
|
m_dict->insert("sprayPumpCtrl.forward", "正转"); |
|
|
|
m_dict->insert("sprayPumpCtrl.backward", "反转"); |
|
|
|
m_dict->insert("sprayPumpCtrl.stop", "停止"); |
|
|
|
m_testPageItemMgr.installParamType("sprayPumpCtrl.pumpVel", "g/min", {"5", "10", "15"}); |
|
|
|
m_testPageItemMgr.insertButtons("sprayPumpCtrl", {"sprayPumpCtrl.pumpVel"}, {"forward", "backward", "stop"}, [this](string buttonName, vector<string> param) { //
|
|
|
|
logger->info("sprayPumpCtrl on button.{} ({})", buttonName, param[0]); |
|
|
|
|
|
|
|
if (buttonName == "forward") { |
|
|
|
dcs->SprayPump_startInRPM(atoi(param[0].c_str())); |
|
|
|
} else if (buttonName == "backward") { |
|
|
|
dcs->SprayPump_startInRPM(-atoi(param[0].c_str())); |
|
|
|
} else if (buttonName == "stop") { |
|
|
|
dcs->SprayPump_stop(); |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
// 加液泵
|
|
|
|
m_dict->insert("addDischargePumpCtrl", "加液泵控制"); |
|
|
|
m_dict->insert("addDischargePumpCtrl.addingLiquid", "加液"); |
|
|
|
m_dict->insert("addDischargePumpCtrl.drainLiquid", "排液"); |
|
|
|
m_testPageItemMgr.insertButtons("addDischargePumpCtrl", {}, {"addingLiquid", "drainLiquid"}, [this](string buttonName, vector<string> param) { //
|
|
|
|
logger->info("on addDischargePumpCtrl.{}", buttonName); |
|
|
|
if (buttonName == "addingLiquid") { |
|
|
|
dcs->AddLiquidPump_addLiquid(); |
|
|
|
} else if (buttonName == "drainLiquid") { |
|
|
|
dcs->AddLiquidPump_drainLiquid(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
// 空压机
|
|
|
|
m_dict->insert("airCompressorCtrl", "空压机控制"); |
|
|
|
m_dict->insert("airCompressorCtrl.on", "打开"); |
|
|
|
m_dict->insert("airCompressorCtrl.off", "关闭"); |
|
|
|
m_testPageItemMgr.insertButtons("airCompressorCtrl", {}, {"on", "off"}, [this](string buttonName, vector<string> param) { //
|
|
|
|
if (buttonName == "on") { |
|
|
|
dcs->AC_ctrl(1); |
|
|
|
} else if (buttonName == "off") { |
|
|
|
dcs->AC_close(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
// 空压机电流
|
|
|
|
m_testPageItemMgr.insertState("AcCurrent", [this](string stateName) { //
|
|
|
|
return "1.2"; |
|
|
|
m_dict->insert("acCurrent", "空压机电流"); |
|
|
|
m_testPageItemMgr.insertState("acCurrent", [this](string stateName) { //
|
|
|
|
return fmt::format("{:.2f}A", dcs->AC_readEI()); |
|
|
|
}); |
|
|
|
|
|
|
|
// 风机
|
|
|
|
m_dict->insert("blowerCtrl", "风机控制"); |
|
|
|
m_testPageItemMgr.insertButtons("blowerCtrl", {}, {"on", "off"}, [this](string buttonName, vector<string> param) { //
|
|
|
|
if (buttonName == "on") { |
|
|
|
dcs->Blower_ctrl(90); |
|
|
|
} else if (buttonName == "off") { |
|
|
|
dcs->Blower_close(); |
|
|
|
} |
|
|
|
return "error"; |
|
|
|
}); |
|
|
|
|
|
|
|
m_dict->insert("blowerCurrent", "风机电流"); |
|
|
|
m_testPageItemMgr.insertState("blowerCurrent", [this](string stateName) { //
|
|
|
|
return "1.2"; |
|
|
|
return fmt::format("{:.2f}A", dcs->Blower_readEI()); |
|
|
|
}); |
|
|
|
|
|
|
|
// 加热片
|
|
|
|
m_dict->insert("heatingCtrl", "加热片控制"); |
|
|
|
m_dict->insert("heatingCtrl.on", "打开"); |
|
|
|
m_dict->insert("heatingCtrl.off", "关闭"); |
|
|
|
m_testPageItemMgr.insertButtons("heatingCtrl", {}, {"on", "off"}, [this](string buttonName, vector<string> param) { //
|
|
|
|
if (buttonName == "on") { |
|
|
|
dcs->Heater_ctrl(1); |
|
|
|
} else if (buttonName == "off") { |
|
|
|
dcs->Heater_close(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
m_testPageItemMgr.insertStates("heatingState", {"heatingTemperature", "heatingCurrent"}, [this](string stateName) { //
|
|
|
|
if (stateName == "heatingTemperature") { |
|
|
|
return "25"; |
|
|
|
} else if (stateName == "heatingCurrent") { |
|
|
|
return "1.2"; |
|
|
|
m_dict->insert("heatingState", "加热片状态"); |
|
|
|
m_dict->insert("heatingState.temperature", "温度"); |
|
|
|
m_dict->insert("heatingState.current", "电流"); |
|
|
|
m_testPageItemMgr.insertStates("heatingState", {"temperature", "current"}, [this](string stateName) { //
|
|
|
|
if (stateName == "temperature") { |
|
|
|
return fmt::format("{:.2f}℃", dcs->Heater_readTemperature()); |
|
|
|
} else if (stateName == "current") { |
|
|
|
return fmt::format("{:.2f}A", dcs->Heater_readEI()); |
|
|
|
} |
|
|
|
return "error"; |
|
|
|
return string("error"); |
|
|
|
}); |
|
|
|
|
|
|
|
if (PORT.isPipeDM()) { |
|
|
|
m_dict->insert("AirLeakDetectTestModeCtrl", ""); |
|
|
|
m_dict->insert("AirLeakDetectTestModeCtrl.normal", "正常模式"); |
|
|
|
m_dict->insert("AirLeakDetectTestModeCtrl.airTight", "密封模式"); |
|
|
|
m_testPageItemMgr.insertButtons("AirLeakDetectTestModeCtrl", {}, {"normal", "airTight"}, [this](string buttonName, vector<string> param) { //
|
|
|
|
if (buttonName == "normal") { |
|
|
|
dcs->AirLeakDetectTestModeCtrl_setMode(0); |
|
|
|
} else if (buttonName == "airTight") { |
|
|
|
dcs->AirLeakDetectTestModeCtrl_setMode(1); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
// 比例阀控制
|
|
|
|
m_dict->insert("PosiPressurePropCtrl", "正压比例阀控制"); |
|
|
|
m_dict->insert("PosiPressurePropCtrl.set", "设置"); |
|
|
|
m_dict->insert("PosiPressurePropCtrl.close", "关闭"); |
|
|
|
m_dict->insert("NegaPressurePropCtrl", "负压比例阀控制"); |
|
|
|
m_dict->insert("NegaPressurePropCtrl.set", "设置"); |
|
|
|
m_dict->insert("NegaPressurePropCtrl.close", "关闭"); |
|
|
|
m_dict->insert("proportionalOpenPercent", "数值"); |
|
|
|
|
|
|
|
m_testPageItemMgr.installParamType("proportionalOpenPercent", "%", {"0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100"}); |
|
|
|
|
|
|
|
m_testPageItemMgr.insertButtons("PosiPressurePropCtrl", {"proportionalOpenPercent"}, {"set", "close"}, [this](string buttonName, vector<string> param) { //
|
|
|
|
if (buttonName == "set") { |
|
|
|
dcs->PosiPressureProp_setValve(atoi(param[0].c_str())); |
|
|
|
} else if (buttonName == "close") { |
|
|
|
dcs->PosiPressureProp_setValve(0); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
m_testPageItemMgr.insertButtons("NegaPressurePropCtrl", {"proportionalOpenPercent"}, {"set", "close"}, [this](string buttonName, vector<string> param) { //
|
|
|
|
if (buttonName == "set") { |
|
|
|
dcs->NegaPressureProp_setValve(atoi(param[0].c_str())); |
|
|
|
} else if (buttonName == "close") { |
|
|
|
dcs->NegaPressureProp_setValve(0); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
m_testPageItemMgr.onState.connect([this](json state) { //
|
|
|
|
GET_SERVICE(IflytopFrontEndService)->sendClassReport(thisClass.className, "onState", state); |
|
|
|
}); |
|
|
|