diff --git a/appsrc/baseservice/db/db_constant.cpp b/appsrc/baseservice/db/db_constant.cpp index 7ae8809..7ec6176 100644 --- a/appsrc/baseservice/db/db_constant.cpp +++ b/appsrc/baseservice/db/db_constant.cpp @@ -1,15 +1 @@ #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"; diff --git a/appsrc/baseservice/db/setting_db_dao.cpp b/appsrc/baseservice/db/setting_db_dao.cpp index ba94ce2..37e2437 100644 --- a/appsrc/baseservice/db/setting_db_dao.cpp +++ b/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 } 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::kcontinued_satur, "消毒继续过氧化氢相对饱和度", "60", "0", "100", true, true, true, true), INT_SETTING(SettingId::kmax_humidity, "允许消毒最大湿度", "90", "0", "100", true, true, true, true), diff --git a/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp b/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp index 81f3646..e8ca5f2 100644 --- a/appsrc/service/app/disinfection_ctrl/disinfection_ctrl_service.cpp +++ b/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("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("log:{}->{} ", s_nlog, m_tlog); + tracecontent += fmt::format("log:{:.2f}->{:.2f} ", s_nlog, m_tlog); 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()); logger->info(tracecontent); @@ -575,13 +581,14 @@ void DisinfectionCtrlService::processStateEmpytLiquidFromTheLine(DisinfectionEve if (event->event == kevent_enter_state) { tryLogState(true); dics->SprayPump_startInRPM(-PORT.getSprayLiquidPumpMaxRPM()); - s_remaintime = -1; + s_remaintime = EMTPTY_LINE_WHEN_DISINFECTION; } else if (event->event == kevent_exit_state) { tryLogState(true); dics->SprayPump_stop(); } else if (event->event == kevent_tmr_1s) { - if (sm.getStateHasPassedTimeMs() > EMTPTY_LINE_WHEN_DISINFECTION * 1000) { + s_remaintime--; + if (s_remaintime <= 0) { changeToNextState(); } } diff --git a/appsrc/service/disinfection_logs_service.cpp b/appsrc/service/disinfection_logs_service.cpp index 6ef487d..8143432 100644 --- a/appsrc/service/disinfection_logs_service.cpp +++ b/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); struct tm tm = {0}; 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& sv) { @@ -347,6 +347,7 @@ void DisinfectionLogsService::dumpDisinfectionToPrinterLog(string sessionId, lis 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", format_zsystem_tp(m_statistics->start_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) { content += fmt::format("{}\n", format_zsystem_tp(snapshot->time)); 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; for (int i = 0; i < h2o2data->getSensorDataNum(); i++) { if (i == 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])); } if (i == 1 && !h2o2data->isExpired[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])); } if (i == 2 && !h2o2data->isExpired[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])); } } @@ -570,9 +576,7 @@ void DisinfectionLogsService::getRecord(shared_ptr cxt, strin } } -void DisinfectionLogsService::deleteReport(shared_ptr cxt, string logName) { - deleteRecordFile(logName); -} +void DisinfectionLogsService::deleteReport(shared_ptr cxt, string logName) { deleteRecordFile(logName); } void DisinfectionLogsService::exportRecord(shared_ptr cxt, vector logNames) { vector files; @@ -585,7 +589,7 @@ void DisinfectionLogsService::exportRecord(shared_ptr cxt, ve return; } } -void DisinfectionLogsService::printRecord(shared_ptr cxt,string logName) { +void DisinfectionLogsService::printRecord(shared_ptr cxt, string logName) { // printRecordFile(logName); } diff --git a/appsrc/service/hardware/base/h2o2_sensor_data_mgr.cpp b/appsrc/service/hardware/base/h2o2_sensor_data_mgr.cpp index 873b8c0..d768608 100644 --- a/appsrc/service/hardware/base/h2o2_sensor_data_mgr.cpp +++ b/appsrc/service/hardware/base/h2o2_sensor_data_mgr.cpp @@ -138,5 +138,5 @@ void H2O2SensorDataMgr::statisticsSensorData() { 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); }