Browse Source

添加部分日志

storage-in-realtime
zhaohe 12 months ago
parent
commit
f1b6fd24cd
  1. 14
      appsrc/baseservice/db/db_constant.cpp
  2. 4
      appsrc/baseservice/db/setting_db_dao.cpp
  3. 21
      appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp
  4. 30
      appsrc/service/disinfection_logs_service.cpp
  5. 2
      appsrc/service/hardware/base/h2o2_sensor_data_mgr.cpp

14
appsrc/baseservice/db/db_constant.cpp

@ -1,15 +1 @@
#include "db_service.hpp" #include "db_service.hpp"
const char* ksetting_stoped_gs = "stoped_gs";
const char* ksetting_continued_gs = "continued_gs";
const char* ksetting_stoped_satur = "stoped_satur";
const char* ksetting_continued_satur = "continued_satur";
const char* ksetting_max_humidity = "max_humidity";
const char* ksetting_drainage_pump_speed = "drainage_pump_speed";
const char* ksetting_injection_pump_speed = "injection_pump_speed";
const char* ksetting_pre_heat_time_s = "pre_heat_time_s";
const char* ksetting_stoped_humi = "stoped_humi";
const char* ksetting_continued_humi = "continued_humi";
const char* ksetting_proportional_valve_default_value = "proportional_valve_default_value";
const char* ksetting_record_period_min = "record_period_min";
const char* ksetting_record_printer_period_min = "record_printer_period_min";

4
appsrc/baseservice/db/setting_db_dao.cpp

@ -64,8 +64,8 @@ using namespace db;
Setting { setting_id, name_ch, "float", default_val, default_val, val_lower_limit, val_upper_limit, {}, {}, is_editable, is_visible_in_setting_page, is_visible_in_formula_page, is_visible_in_rt_page } Setting { setting_id, name_ch, "float", default_val, default_val, val_lower_limit, val_upper_limit, {}, {}, is_editable, is_visible_in_setting_page, is_visible_in_formula_page, is_visible_in_rt_page }
static Setting settingInitTable[] = { static Setting settingInitTable[] = {
INT_SETTING(SettingId::kstoped_gs, "消毒停止过氧化氢溶度", "300", "0", "2000", true, true, true, true),
INT_SETTING(SettingId::kcontinued_gs, "消毒继续过氧化氢溶度", "200", "0", "2000", true, true, true, true),
INT_SETTING(SettingId::kstoped_gs, "消毒停止过氧化氢溶度", "300", "0", "800", true, true, true, true),
INT_SETTING(SettingId::kcontinued_gs, "消毒继续过氧化氢溶度", "200", "0", "800", true, true, true, true),
INT_SETTING(SettingId::kstoped_satur, "消毒停止过氧化氢相对饱和度", "85", "0", "100", true, true, true, true), INT_SETTING(SettingId::kstoped_satur, "消毒停止过氧化氢相对饱和度", "85", "0", "100", true, true, true, true),
INT_SETTING(SettingId::kcontinued_satur, "消毒继续过氧化氢相对饱和度", "60", "0", "100", true, true, true, true), INT_SETTING(SettingId::kcontinued_satur, "消毒继续过氧化氢相对饱和度", "60", "0", "100", true, true, true, true),
INT_SETTING(SettingId::kmax_humidity, "允许消毒最大湿度", "90", "0", "100", true, true, true, true), INT_SETTING(SettingId::kmax_humidity, "允许消毒最大湿度", "90", "0", "100", true, true, true, true),

21
appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp

@ -279,14 +279,20 @@ void DisinfectionCtrlService::traceState() {
tracecontent += fmt::format("TRACE [{}] ", string(sm.getState())); tracecontent += fmt::format("TRACE [{}] ", string(sm.getState()));
tracecontent += fmt::format("e:{} ", s_error); tracecontent += fmt::format("e:{} ", s_error);
if (s_h2o2Snapshot->getSensorDataNum() == 1) tracecontent += fmt::format("s0:[ho2o2 {:>3} rs {:>3} rh {:>3}]", s_h2o2Snapshot->h2o2[0], s_h2o2Snapshot->rs[0], s_h2o2Snapshot->rh[0]);
if (s_h2o2Snapshot->getSensorDataNum() == 2) tracecontent += fmt::format("s1:[ho2o2 {:>3} {:>3} rs {:>3} {:>3} rh {:>3} {:>3}]", s_h2o2Snapshot->h2o2[0], s_h2o2Snapshot->h2o2[1], s_h2o2Snapshot->rs[0], s_h2o2Snapshot->rs[1], s_h2o2Snapshot->rh[0], s_h2o2Snapshot->rh[1]);
if (s_h2o2Snapshot->getSensorDataNum() == 3) tracecontent += fmt::format("s2:[ho2o2 {:>3} {:>3} {:>3} rs {:>3} {:>3} {:>3} rh {:>3} {:>3} {:>3}]", s_h2o2Snapshot->h2o2[0], s_h2o2Snapshot->h2o2[1], s_h2o2Snapshot->h2o2[2], s_h2o2Snapshot->rs[0], s_h2o2Snapshot->rs[1], s_h2o2Snapshot->rs[2], s_h2o2Snapshot->rh[0], s_h2o2Snapshot->rh[1], s_h2o2Snapshot->rh[2]);
if (s_h2o2Snapshot->getSensorDataNum() == 1)
tracecontent += fmt::format("s0:[ho2o2 {:>3} rs {:>3} rh {:>3}]", //
s_h2o2Snapshot->h2o2[0], s_h2o2Snapshot->rs[0], s_h2o2Snapshot->rh[0]);
if (s_h2o2Snapshot->getSensorDataNum() == 2)
tracecontent += fmt::format("s1:[ho2o2 ({:>3} {:>3}) rs ({:>3} {:>3}) rh ({:>3} {:>3})]", //
s_h2o2Snapshot->h2o2[0], s_h2o2Snapshot->h2o2[1], s_h2o2Snapshot->rs[0], s_h2o2Snapshot->rs[1], s_h2o2Snapshot->rh[0], s_h2o2Snapshot->rh[1]);
if (s_h2o2Snapshot->getSensorDataNum() == 3)
tracecontent += fmt::format("s2:[ho2o2 ({:>3} {:>3} {:>3}) rs ({:>3} {:>3} {:>3}) rh ({:>3} {:>3} {:>3})]", s_h2o2Snapshot->h2o2[0], s_h2o2Snapshot->h2o2[1], s_h2o2Snapshot->h2o2[2], s_h2o2Snapshot->rs[0],
s_h2o2Snapshot->rs[1], s_h2o2Snapshot->rs[2], s_h2o2Snapshot->rh[0], s_h2o2Snapshot->rh[1], s_h2o2Snapshot->rh[2]);
tracecontent += fmt::format("dvalue:{} ", s_dvalue); tracecontent += fmt::format("dvalue:{} ", s_dvalue);
tracecontent += fmt::format("log:{}->{} ", s_nlog, m_tlog);
tracecontent += fmt::format("log:{:.2f}->{:.2f} ", s_nlog, m_tlog);
tracecontent += fmt::format("break:{} ", s_isDisinfectionTakeBreak); tracecontent += fmt::format("break:{} ", s_isDisinfectionTakeBreak);
tracecontent += fmt::format("rtime:{} ", s_remaintime);
tracecontent += fmt::format("rtime:({}h:{}m:{}s) ", s_remaintime / 3600, (s_remaintime % 3600) / 60, s_remaintime % 60);
tracecontent += fmt::format("hTemp:{:.2f} ", dics->Heater_readTemperature()); tracecontent += fmt::format("hTemp:{:.2f} ", dics->Heater_readTemperature());
logger->info(tracecontent); logger->info(tracecontent);
@ -575,13 +581,14 @@ void DisinfectionCtrlService::processStateEmpytLiquidFromTheLine(DisinfectionEve
if (event->event == kevent_enter_state) { if (event->event == kevent_enter_state) {
tryLogState(true); tryLogState(true);
dics->SprayPump_startInRPM(-PORT.getSprayLiquidPumpMaxRPM()); dics->SprayPump_startInRPM(-PORT.getSprayLiquidPumpMaxRPM());
s_remaintime = -1;
s_remaintime = EMTPTY_LINE_WHEN_DISINFECTION;
} else if (event->event == kevent_exit_state) { } else if (event->event == kevent_exit_state) {
tryLogState(true); tryLogState(true);
dics->SprayPump_stop(); dics->SprayPump_stop();
} else if (event->event == kevent_tmr_1s) { } else if (event->event == kevent_tmr_1s) {
if (sm.getStateHasPassedTimeMs() > EMTPTY_LINE_WHEN_DISINFECTION * 1000) {
s_remaintime--;
if (s_remaintime <= 0) {
changeToNextState(); changeToNextState();
} }
} }

30
appsrc/service/disinfection_logs_service.cpp

@ -59,11 +59,11 @@ static string format_zsystem_tp(zsystem_tp tp) {
time_t time = system_clock().to_time_t(tp); time_t time = system_clock().to_time_t(tp);
struct tm tm = {0}; struct tm tm = {0};
localtime_r(&time, &tm); localtime_r(&time, &tm);
return fmt::format("{:0>4}-{:0>2}-{:0>2} {:0>2}:{:0>2}:{:0>2}", tm.tm_year + 1900, //
tm.tm_mon + 1, //
tm.tm_mday, //
tm.tm_hour, //
tm.tm_min, tm.tm_sec);
return fmt::format("{:0>4}-{:0>2}-{:0>2} {:0>2}:{:0>2}", tm.tm_year + 1900, //
tm.tm_mon + 1, //
tm.tm_mday, //
tm.tm_hour, //
tm.tm_min);
} }
static void listDirCSVFile(string path, vector<string>& sv) { static void listDirCSVFile(string path, vector<string>& sv) {
@ -347,6 +347,7 @@ void DisinfectionLogsService::dumpDisinfectionToPrinterLog(string sessionId, lis
content += fmt::format("= = = = = = = = = = = = = = = \n"); content += fmt::format("= = = = = = = = = = = = = = = \n");
content += fmt::format(" 全思美特 \n"); content += fmt::format(" 全思美特 \n");
content += fmt::format("消毒ID: {}\n", sessionId);
content += fmt::format("操作人员: {}\n", GET_SERVICE(DeviceStateService)->getLoginUid()); content += fmt::format("操作人员: {}\n", GET_SERVICE(DeviceStateService)->getLoginUid());
content += fmt::format("开始时间: {}\n", format_zsystem_tp(m_statistics->start_tp)); content += fmt::format("开始时间: {}\n", format_zsystem_tp(m_statistics->start_tp));
content += fmt::format("结束时间: {}\n", format_zsystem_tp(m_statistics->complete_tp)); content += fmt::format("结束时间: {}\n", format_zsystem_tp(m_statistics->complete_tp));
@ -382,23 +383,28 @@ void DisinfectionLogsService::dumpDisinfectionToPrinterLog(string sessionId, lis
if (state == DisinfectionState::disinfection) { if (state == DisinfectionState::disinfection) {
content += fmt::format("{}\n", format_zsystem_tp(snapshot->time)); content += fmt::format("{}\n", format_zsystem_tp(snapshot->time));
if (stateChanged) content += fmt::format("{}\n", m_dmStateDict.getChName(snapshot->state)); if (stateChanged) content += fmt::format("{}\n", m_dmStateDict.getChName(snapshot->state));
content += fmt::format("LOG: {}\n", snapshot->nlog);
if (snapshot->nlog > snapshot->tlog) {
content += fmt::format("LOG: {:.2f}\n", snapshot->tlog);
} else {
content += fmt::format("LOG: {:.2f}\n", snapshot->nlog);
}
auto h2o2data = snapshot->h2o2Snapshot; auto h2o2data = snapshot->h2o2Snapshot;
for (int i = 0; i < h2o2data->getSensorDataNum(); i++) { for (int i = 0; i < h2o2data->getSensorDataNum(); i++) {
if (i == 0) { if (i == 0) {
content += fmt::format(" [S0] {}(ppm) {}(%RS) {}(%RH) \n", h2o2data->isExpired[0] ? "N/A" : formatSensorVal(h2o2data->h2o2[0]), // content += fmt::format(" [S0] {}(ppm) {}(%RS) {}(%RH) \n", h2o2data->isExpired[0] ? "N/A" : formatSensorVal(h2o2data->h2o2[0]), //
h2o2data->isExpired[0] ? "N/A" : formatSensorVal(h2o2data->rs[0]), //
h2o2data->isExpired[0] ? "N/A" : formatSensorVal(h2o2data->rs[0]), //
h2o2data->isExpired[0] ? "N/A" : formatSensorVal(h2o2data->rh[0])); h2o2data->isExpired[0] ? "N/A" : formatSensorVal(h2o2data->rh[0]));
} }
if (i == 1 && !h2o2data->isExpired[1]) { if (i == 1 && !h2o2data->isExpired[1]) {
content += fmt::format(" [S1] {}(ppm) {}(%RS) {}(%RH) \n", formatSensorVal(h2o2data->h2o2[1]), // content += fmt::format(" [S1] {}(ppm) {}(%RS) {}(%RH) \n", formatSensorVal(h2o2data->h2o2[1]), //
formatSensorVal(h2o2data->rs[1]), //
formatSensorVal(h2o2data->rs[1]), //
formatSensorVal(h2o2data->rh[1])); formatSensorVal(h2o2data->rh[1]));
} }
if (i == 2 && !h2o2data->isExpired[2]) { if (i == 2 && !h2o2data->isExpired[2]) {
content += fmt::format(" [S2] {}(ppm) {}(%RS) {}(%RH) \n", formatSensorVal(h2o2data->h2o2[2]), // content += fmt::format(" [S2] {}(ppm) {}(%RS) {}(%RH) \n", formatSensorVal(h2o2data->h2o2[2]), //
formatSensorVal(h2o2data->rs[2]), //
formatSensorVal(h2o2data->rs[2]), //
formatSensorVal(h2o2data->rh[2])); formatSensorVal(h2o2data->rh[2]));
} }
} }
@ -570,9 +576,7 @@ void DisinfectionLogsService::getRecord(shared_ptr<MsgProcessContext> cxt, strin
} }
} }
void DisinfectionLogsService::deleteReport(shared_ptr<MsgProcessContext> cxt, string logName) {
deleteRecordFile(logName);
}
void DisinfectionLogsService::deleteReport(shared_ptr<MsgProcessContext> cxt, string logName) { deleteRecordFile(logName); }
void DisinfectionLogsService::exportRecord(shared_ptr<MsgProcessContext> cxt, vector<string> logNames) { void DisinfectionLogsService::exportRecord(shared_ptr<MsgProcessContext> cxt, vector<string> logNames) {
vector<string> files; vector<string> files;
@ -585,7 +589,7 @@ void DisinfectionLogsService::exportRecord(shared_ptr<MsgProcessContext> cxt, ve
return; return;
} }
} }
void DisinfectionLogsService::printRecord(shared_ptr<MsgProcessContext> cxt,string logName) {
void DisinfectionLogsService::printRecord(shared_ptr<MsgProcessContext> cxt, string logName) {
// //
printRecordFile(logName); printRecordFile(logName);
} }

2
appsrc/service/hardware/base/h2o2_sensor_data_mgr.cpp

@ -138,5 +138,5 @@ void H2O2SensorDataMgr::statisticsSensorData() {
m_maxSaturation = sensor_data->rs; m_maxSaturation = sensor_data->rs;
} }
} }
logger->info("statisticsSensorData: minH2O2 = {}, maxH2O2 = {}, maxHumid = {}, maxSaturation = {}", m_minH2O2, m_maxH2O2, m_maxHumid, m_maxSaturation);
// logger->info("statisticsSensorData: minH2O2 = {}, maxH2O2 = {}, maxHumid = {}, maxSaturation = {}", m_minH2O2, m_maxH2O2, m_maxHumid, m_maxSaturation);
} }
Loading…
Cancel
Save