|
|
@ -618,6 +618,46 @@ void MainControlService::processFrontEndMessage_processFormulaCmd(weak_ptr<WebSo |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (cmdstr == "updateFormula2") { |
|
|
|
int id = jsonGet<int>(cmd["id"]); |
|
|
|
string formula_id = cmd["formula_id"]; |
|
|
|
int loglevel = jsonGet<int>(cmd["loglevel"]); |
|
|
|
int stoped_gs = jsonGet<int>(cmd["stoped_gs"]); |
|
|
|
int continued_gs = jsonGet<int>(cmd["continued_gs"]); |
|
|
|
int stoped_satur = jsonGet<int>(cmd["stoped_satur"]); |
|
|
|
int continued_satur = jsonGet<int>(cmd["continued_satur"]); |
|
|
|
int stoped_humi = jsonGet<int>(cmd["stoped_humi"]); |
|
|
|
int continued_humi = jsonGet<int>(cmd["continued_humi"]); |
|
|
|
int injection_pump_speed = jsonGet<int>(cmd["injection_pump_speed"]); |
|
|
|
|
|
|
|
shared_ptr<Formula> formula = m_dbService->getFormula(id); |
|
|
|
|
|
|
|
string oldname = formula->formula_id; |
|
|
|
formula->formula_id = formula_id; |
|
|
|
formula->loglevel = std::to_string(loglevel); |
|
|
|
formula->stoped_gs = std::to_string(stoped_gs); |
|
|
|
formula->continued_gs = std::to_string(continued_gs); |
|
|
|
formula->stoped_satur = std::to_string(stoped_satur); |
|
|
|
formula->continued_satur = std::to_string(continued_satur); |
|
|
|
formula->stoped_humi = std::to_string(stoped_humi); |
|
|
|
formula->continued_humi = std::to_string(continued_humi); |
|
|
|
formula->injection_pump_speed = std::to_string(injection_pump_speed); |
|
|
|
|
|
|
|
if (!formula) { |
|
|
|
logger->error("formula id {} not exist", id); |
|
|
|
receipt["ackcode"] = err::zecode(err::kdb_operate_error); |
|
|
|
receipt["ackcodeInfo"] = err::zecode2str(err::kdb_operate_error); |
|
|
|
return; |
|
|
|
} |
|
|
|
m_dbService->updateFormula(formula); |
|
|
|
if (oldname != formula_id) { |
|
|
|
m_dbService->addUserBehaviorRecord(m_deviceStateService->getLoginUid(), kbehavior_update_formula_name, |
|
|
|
fmt::format("({}->{})", oldname, formula->formula_id)); |
|
|
|
} |
|
|
|
m_dbService->addUserBehaviorRecord(m_deviceStateService->getLoginUid(), kbehavior_update_formula, fmt::format("({})", formula->formula_id)); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
void MainControlService::processFrontEndMessage_processBehaviorRecordCmd(weak_ptr<WebSocket> webSocket, json& cmd, json& receipt) { |
|
|
|
string cmdstr = cmd["command"]; |
|
|
|