Commit 1fe2b99730a943facd5b3769149f867587bb83f7

Authored by 고영탁
1 parent 7fa4fdb0e3
Exists in master and in 2 other branches fhd, fhd-demo

시스템 관리 기능 버그 수정

- 인포데이터 다운로드 버그 수정
- 서비스데이터 다운로드 버그 수정
- 기본 설정 다운로드 버그 수정
- 기본 설정 업로드 버그 수정
Showing 1 changed file with 124 additions and 10 deletions   Show diff stats
app/gui/oven_control/fileprocessdlg.cpp
1 1 #include <QTimer>
  2 +#include <unistd.h>
2 3 #include "fileprocessdlg.h"
3 4 #include "ui_fileprocessdlg.h"
4 5 #include "fileprocessor.h"
... ... @@ -7,10 +8,11 @@
7 8 #include <QDebug>
8 9  
9 10  
10   -#define ERROR_LOG_FILE_TOP "/GasErrorHistoryTop.log"
11   -#define ERROR_LOG_FILE_STEAM "/GasErrorHistorySteam.log"
12   -#define ERROR_LOG_FILE_BOTTOM "/GasErrorHistoryBottom.log"
13   -#define ERROR_LOG_FILE_TOTAL "/TotalError.log"
  11 +#define ERROR_LOG_FILE_TOP "/GasErrorHistoryTop.csv"
  12 +#define ERROR_LOG_FILE_STEAM "/GasErrorHistorySteam.csv"
  13 +#define ERROR_LOG_FILE_BOTTOM "/GasErrorHistoryBottom.csv"
  14 +#define ERROR_LOG_FILE_TOTAL "/TotalError.csv"
  15 +#define SERVICE_DATA_FILE "/ServiceData.csv"
14 16  
15 17 FileProcessDlg::FileProcessDlg(QWidget *parent, ConfigType type, bool isDown) :
16 18 QDialog(parent),
... ... @@ -254,6 +256,7 @@ void FileProcessDlg::infodataDownload(){
254 256 saveHistoryLineData(out, erridx,firecntbuf,firsttimebuf,lasttimebuf);erridx++;
255 257 file.close();
256 258 }
  259 + sync();
257 260 ui->ctrWjProcess->setValue(100);
258 261 ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료"));
259 262 QTimer::singleShot(1000,this,SLOT(close()));
... ... @@ -261,8 +264,85 @@ void FileProcessDlg::infodataDownload(){
261 264 }
262 265  
263 266 void FileProcessDlg::servicedataDownload(){
  267 + QString strUsbPath;
  268 + QString strHeader = "no,name,time\n";
  269 + QString strFile;
  270 + QFile file;
  271 + error_item *item;
  272 + uint32_t timetemp, totaltime=0;
  273 + int i = 1;
  274 + OvenStatistics *ovs = OvenStatistics::getInstance();
  275 + if(FileProcessor::detectUSB(strUsbPath)){
  276 + strFile = strUsbPath + SERVICE_DATA_FILE;
  277 + file.setFileName(strFile);
  278 + if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)){
  279 + QTextStream out(&file);
  280 + out.setCodec("UTF-8");
  281 + out<< strHeader;
  282 + timetemp = ovs->srvdata->use_log.items.steam_heat/3600;
  283 + out << i++ << tr(",Steam Heating Time,") << timetemp << "h\n";
  284 + timetemp = ovs->srvdata->use_log.items.dry_heat/3600;
  285 + out << i++ << tr(",Hot Air Heating Time,") << timetemp << "h\n";
264 286  
  287 + i=1;out<< strHeader;
  288 + timetemp = ovs->srvdata->use_log.items.cook_dry_mode/3600;
  289 + totaltime+= ovs->srvdata->use_log.items.cook_dry_mode;
  290 + out << i++ << tr(",Hot Air Mode,") << timetemp << "h\n";
  291 + timetemp = ovs->srvdata->use_log.items.cook_steam_mode/3600;
  292 + totaltime += ovs->srvdata->use_log.items.cook_steam_mode;
  293 + out << i++ << tr(",Steam Mode,") << timetemp << "h\n";
  294 + timetemp = ovs->srvdata->use_log.items.cook_combi_mode/3600;
  295 + totaltime += ovs->srvdata->use_log.items.cook_combi_mode;
  296 + out << i++ << tr(",Combi Mode,") << timetemp << "h\n";
  297 + timetemp = ovs->srvdata->use_log.items.wash_mode_nocleanser/3600;
  298 + totaltime += ovs->srvdata->use_log.items.wash_mode_nocleanser;
  299 + out << i++ << tr(",세제없이 헹굼,").toUtf8() << timetemp << "h\n";
  300 + timetemp = ovs->srvdata->use_log.items.wash_mode_simple/3600;
  301 + totaltime += ovs->srvdata->use_log.items.wash_mode_simple;
  302 + out << i++ << tr(",간이세척,").toUtf8() << timetemp << "h\n";
  303 + timetemp = ovs->srvdata->use_log.items.wash_mode_standard/3600;
  304 + totaltime += ovs->srvdata->use_log.items.wash_mode_standard;
  305 + out << i++ << tr(",표준세척,").toUtf8() << timetemp << "h\n";
  306 + timetemp = ovs->srvdata->use_log.items.wash_mode_strong/3600;
  307 + totaltime += ovs->srvdata->use_log.items.wash_mode_strong;
  308 + out << i++ << tr(",강세척").toUtf8() << timetemp << "h\n";
  309 + timetemp = ovs->srvdata->use_log.items.wash_mode_speed/3600;
  310 + totaltime +=ovs->srvdata->use_log.items.wash_mode_speed;
  311 + out << i++ << tr(",고속세척,").toUtf8() << timetemp << "h\n";
  312 + timetemp = ovs->srvdata->use_log.items.cooldown_mode/3600;
  313 + totaltime += ovs->srvdata->use_log.items.cooldown_mode;
  314 + out << i++ << tr(",쿨다운,").toUtf8() << timetemp << "h\n";
  315 + timetemp = totaltime/3600;
  316 + out << i++ << tr(",전체작동시간,").toUtf8() << timetemp << "h\n";
265 317  
  318 + i=1;out<< strHeader;
  319 + timetemp = ovs->srvdata->use_log.items.door_open/60;
  320 + out << i++ << tr(",도어 Open,").toUtf8() << timetemp << "min\n";
  321 + timetemp = ovs->srvdata->use_log.items.dv_open/60;
  322 + out << i++ << tr(",볼밸브 Open,").toUtf8() << timetemp << "min\n";
  323 + timetemp = ovs->srvdata->use_log.items.ssv_open/60;
  324 + out << i++ << tr(",S/G 급수 솔레노이드,").toUtf8() << timetemp << "min\n";
  325 + timetemp = ovs->srvdata->use_log.items.qnv_open/60;
  326 + out << i++ << tr(",퀀칭 솔레노이드,").toUtf8() << timetemp << "min\n";
  327 + timetemp = ovs->srvdata->use_log.items.snv_open/60;
  328 + out << i++ << tr(",고내살수 노즐 솔레노이드 ,").toUtf8() << timetemp << "min\n";
  329 + timetemp = 0;
  330 + out << i++ << tr(",호스릴 솔레노이드,").toUtf8() << timetemp << "min\n";
  331 + timetemp = ovs->srvdata->use_log.items.ssp_open/60;
  332 + out << i++ << tr(",세제공급장치,").toUtf8() << timetemp << "min\n";
  333 + timetemp = ovs->srvdata->use_log.items.hdm_open/60;
  334 + out << i++ << tr(",배습댐퍼,").toUtf8() << timetemp << "min\n";
  335 + timetemp = ovs->srvdata->use_log.items.dp_open/60;
  336 + out << i++ << tr(",소형펌프모터,").toUtf8() << timetemp << "min\n";
  337 + timetemp = ovs->srvdata->use_log.items.unp_open/60;
  338 + out << i++ << tr(",중형펌프모터,").toUtf8() << timetemp << "min\n";
  339 + ui->ctrWjProcess->setValue(100);
  340 + ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료"));
  341 + file.close();
  342 + sync();
  343 + QTimer::singleShot(1000,this,SLOT(close()));
  344 + }
  345 + }
266 346 }
267 347  
268 348 void FileProcessDlg::programDownload(){
... ... @@ -278,44 +358,78 @@ void FileProcessDlg::configDownload(){
278 358 if(FileProcessor::detectUSB(strUsbPath)){
279 359 strUsbPath.append("/config.ini");
280 360 qDebug() << strUsbPath;
  361 + QFile file;
  362 + file.setFileName(strUsbPath);
  363 + if(file.exists()) file.remove();
281 364 if(QFile::copy("/prime/config/config.ini", strUsbPath)){
  365 + sync();
  366 + ui->ctrWjProcess->setValue(50);
  367 + ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 1초"));
  368 + }
  369 + else{
  370 + ui->ctrLbRemainTime->setText(tr("설정 다운로드에 실패하였습니다."));
  371 + QTimer::singleShot(1000,this,SLOT(close()));
  372 + return;
  373 + }
  374 + strUsbPath.replace("/config.ini","/favorite.ini");
  375 + file.setFileName(strUsbPath);
  376 + if(file.exists()) file.remove();
  377 + if(QFile::copy("/prime/config/favorite.ini", strUsbPath)){
  378 + sync();
282 379 ui->ctrWjProcess->setValue(100);
283 380 ui->ctrLbRemainTime->setText("남은 예상 시간 : 0초");
284 381 ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료"));
285 382 QTimer::singleShot(1000,this,SLOT(close()));
286 383 }
287 384 else{
288   - ui->ctrLbRemainTime->setText(tr("다운로드에 실패하였습니다."));
  385 + ui->ctrLbRemainTime->setText(tr("즐겨찾기 다운로드에 실패하였습니다."));
289 386 QTimer::singleShot(1000,this,SLOT(close()));
290 387 }
291 388 }
292 389 else{
293   - ui->ctrLbRemainTime->setText(tr("다운로드에 실패하였습니다."));
  390 + ui->ctrLbRemainTime->setText(tr("USB 인식을 실패하였습니다."));
294 391 QTimer::singleShot(1000,this,SLOT(close()));
295 392 }
296 393 }
297 394  
298 395 void FileProcessDlg::configUpload(){
299 396 QString strUsbPath;
  397 + Config *cfg = Config::getInstance();
300 398 if(FileProcessor::detectUSB(strUsbPath)){
301 399 strUsbPath.append("/config.ini");
302 400 qDebug() << strUsbPath;
303 401 QFile file("/prime/config/config.ini");
304 402 file.remove();
305 403 if(QFile::copy( strUsbPath , "/prime/config/config.ini")){
306   - OvenStatistics* ovs = OvenStatistics::getInstance();
307   - ovs->srvdata->loadServiceData();
  404 + sync();
  405 + cfg->loadConfig();
  406 + cfg->applyConfig();
  407 + ui->ctrWjProcess->setValue(50);
  408 + ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 1초"));
  409 + }
  410 + else{
  411 + ui->ctrLbRemainTime->setText(tr("설정 업로드에 실패하였습니다."));
  412 + QTimer::singleShot(1000,this,SLOT(close()));
  413 + return;
  414 + }
  415 + QFile file2("/prime/config/favorite.ini");
  416 + file2.remove();
  417 + strUsbPath.replace("/config.ini", "/favorite.ini");
  418 + qDebug() << strUsbPath;
  419 + if(QFile::copy( strUsbPath , "/prime/config/favorite.ini")){
  420 + sync();
  421 + cfg->loadFavorite();
308 422 ui->ctrWjProcess->setValue(100);
309 423 ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료"));
310 424 QTimer::singleShot(1000,this,SLOT(close()));
311 425 }
312 426 else{
313   - ui->ctrLbRemainTime->setText(tr("업로드에 실패하였습니다."));
  427 + ui->ctrLbRemainTime->setText(tr("즐겨찾기 업로드에 실패하였습니다."));
314 428 QTimer::singleShot(1000,this,SLOT(close()));
315 429 }
316 430 }
317 431 else{
318   - ui->ctrLbRemainTime->setText(tr("업로드에 실패하였습니다."));
  432 + ui->ctrLbRemainTime->setText(tr("USB 인식을 실패하였습니다."));
319 433 QTimer::singleShot(1000,this,SLOT(close()));
320 434 }
321 435 }
... ...