亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

QT如何實現將兩個時間相加

發布時間:2022-09-05 17:34:46 來源:億速云 閱讀:254 作者:iii 欄目:開發技術

本篇內容介紹了“QT如何實現將兩個時間相加”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!

標志位

首先介紹實現的這兩個函數:
void setTreatmentEndtime();//系統時間+我設定的時間=總的需要時間
void setRinseTimeStartAndEnd(QString Val);//將分鐘轉換為標準時分格式,在相加

需要設置的標志位:

//mainwindow.h
private://======================【SJY新增】
    uint8_t endtime_buttonflag;//剩余時間和結束時間切換標志位 【記得在構造函數初始化=0】
    QString Sys_time;//記錄系統時間  【只要一次,所以需要設置標志位】
    QString MandatoryRinse;//記錄強制沖洗時間 【只要一次需要設置標志位】

系統時間+設定的時間【源碼附上】

QT如何實現將兩個時間相加

請看上圖,在ui設計中往往需要顯示系統時間和日期,而日期不可能禁止不動,需要實時刷新,這就不得不提出QT當中的定時器

第一步創建定時器并且開啟

【1】在頭文件添加日期時間頭QDateTime
【2】toString的意思是將當前的日期時間轉換為字符串,參數是時間格式
【3】在ui界面隨便設置兩個標簽,將獲取的字符串時間設置顯示即可

//刷新時間【由定時器開啟】 1s跑一次
void MainWindow::refresh_time()
{
    ui->label_date->setText(QDateTime::currentDateTime().toString("yyyy/MM/dd"));
    ui->label_time->setText(QDateTime::currentDateTime().toString("hh:mm:ss"));
}

上面的函數是由定時器開啟的,具體如下:
【1】在mainwindow.h添加定時器的頭文件QTime和對象 private: QTimer timer;
【2】將定時器對象通過connect函數形成信號與槽,信號發送函數timeout(); 槽接收函數refresh_time();
【3】&timer:對象地址【棧對象需要添加取址符&, 指針對象直接寫名字,不需要&,本身就是地址】信號的發送者
【4】 timer.start(1000) :開啟定時器,1s,也就是超過1s后會觸發timeout()信號,start(參數是整形毫秒)
【5】timeout(): 信號發射函數,由定時器對象發射
【6】this:信號的接收者,this代碼接收的是本類對象
【7】refresh_time(): 槽函數,由信號timeout觸發,是本類對象的信心接收函數

//時間顯示
    connect(&timer, SIGNAL(timeout()), this, SLOT(refresh_time()));
    timer.start(1000);//1s開啟

第二步兩個時間相加函數【已實現附上代碼】

在多個MCU工作時,以下圖片
第一個剩余時間:代表治療某個病人,還需要多久
第二個結束時間:剩余結束時間+系統時間=醫生幾點可以下班【目的是為了直觀顯示】
系統時間已經在上面顯示在ui了,對于label標簽通過text()即可獲取ui上的文本,系統時間獲取;
剩余時間保存在一個數組,比如初始值=4:59

QT如何實現將兩個時間相加

//治療剩余時間和結束時間的切換  【SJY新增】
void MainWindow::setTreatmentEndtime()
{
    if(endtime_buttonflag == 0){
        bool ok;
        uint32_t mm,hh;
        QStringList m1; QStringList m2;
        QString m3; QString m4;  QString m5; QString m6;  QString h3; QString h2;
        //QString time1_hm = data_lib->Get_Value(279);//保存在數組里
        QString time1_hm = ui->label_timeleft->text();//獲取ui上的剩余時間
        QString time2_hm=ui->label_time->text();//獲取ui上的系統時間
        m1 = time1_hm.split(":");//9:59
        m2 = time2_hm.split(":");//例如:23:59
        m3 = m1.at(0);//9
        m4 = m1.at(1);//59
        m5 = m2.at(0);//23
        m6 = m2.at(1);//59
        mm =m4.toInt(&ok,10)+m6.toInt(&ok,10);//分鐘
        hh =m3.toInt(&ok,10)+m5.toInt(&ok,10);//小時
        qDebug()<<m3<<m4<<m5<<m6<<hh<<mm<<endl;
        if((mm >=60)&&(mm <100))//分鐘不能大于60   大于增加一個小時
        {
            if(mm == 60)//小時加1
            {
                m4 = QString("0");
                m3 = QString("0");
            }
            else//>60
            {
                    //小時加1  并且拼接出分鐘數值
                if(( mm>=61) &&(mm<=69))//01-09
                {
                    m4 = QString("%1").arg(mm%60).at(0);//余數時5
                    m3 = QString("0");
                }
                else
                {
                    m4 = QString("%1").arg(mm%60).at(1);
                    m3 = QString("%1").arg(mm%60).at(0);
                }
            }
            //小時計算和求值
            if(hh >23)//半夜三更
            {
                h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+1);
                h2 = QString("0");
            }
            else if(hh == 23)//晚上:00.00
            {
                h2 = QString("%1").arg(QString("0").toInt()+1);
                h3 = QString("0");
            }
            else if(hh>=10&&hh<=22)//10-22
           {

              QString temp  = QString("%1").arg(hh%24);//19
              uint8_t  ret = temp.toInt()+1;//20  //11-23
              h3 = QString("%1").arg(ret).at(1);
               if(ret >= 20)
               {
                   h2 = QString("%1").arg(ret).at(0);
               }
               else
               {
                   h2 = QString("%1").arg(hh%24).at(0);
               }
           }
            else //<10
            {

                QString temp  = QString("%1").arg(hh%24);//=9
                uint8_t  ret = temp.toInt()+1;
                if(ret ==10)//10:00
                {
                         h2 = QString("1");
                         h3 = QString("0");
                }
                else {
                    h2 = QString("0");
                    h3 = QString("%1").arg(ret);
                }
            }
        }
        else if(mm >= 100)//大于等于100   mm最大時59+59=118
        {
            m4 = QString("%1").arg(mm%60).at(1);
            m3 = QString("%1").arg(mm%60).at(0);
            uint8_t rethh = mm/60;//轉化為小時
             //小時計算和求值
             if(hh >23)//半夜三更
             {
                 h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+rethh);
                 h2 = QString("0");
             }
             else if(hh == 23)//晚上:00.00
             {
                 h2 = QString("%1").arg(QString("0").toInt()+rethh);
                 h3 = QString("0");
             }
             else if(hh>=10&&hh<=22)
            {

               QString temp  = QString("%1").arg(hh%24);//=10
               uint8_t  ret = temp.toInt()+rethh;
               h3 = QString("%1").arg(ret).at(1);
                h2 = QString("%1").arg(hh%24).at(0);
            }
             else //<10
             {

                 QString temp  = QString("%1").arg(hh%24);//=9
                 uint8_t  ret = temp.toInt()+rethh;
                 if(ret ==10)//10:00
                 {
                          h2 = QString("1");
                          h3 = QString("0");
                 }
                 else {
                     h2 = QString("0");
                     h3 = QString("%1").arg(ret);
                 }
             }
        }
       else  if(mm<10 )
        {
            m4 = QString("%1").arg(mm%60);
            m3 = QString("%1").arg(0);
            //小時計算和求值
            if(hh >23)//半夜三更
            {
                h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                h2 = QString("0");
            }
            else if(hh == 23)//晚上:00.00
            {
                h2 = QString("%1").arg(QString("0").toInt());
                h3 = QString("0");
            }
            else if(hh>=10&&hh<=22)
           {
                QString temp  = QString("%1").arg(hh%24);//=10
                uint8_t  ret = temp.toInt();
                h3 = QString("%1").arg(ret).at(1);
                h2 = QString("%1").arg(hh%24).at(0);
           }
            else //hh<10
            {
                uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                h2 = QString("0");
                h3 = QString("%1").arg(temp);
            }
        }
        else//     10<=mm>=59
        {
                m4 = QString(QString("%1").arg(mm%60).at(1));
                m3 = QString(QString("%1").arg(mm%60).at(0));

                //小時計算和求值
                if(hh >23)//半夜三更
                {
                    h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                    h2 = QString("0");
                }
                else if(hh == 23)//晚上:00.00
                {
                    h2 = QString("%1").arg(QString("0").toInt());
                    h3 = QString("0");
                }
                else if(hh>=10&&hh<=22)
               {
                    QString temp  = QString("%1").arg(hh%24);//=10
                    uint8_t  ret = temp.toInt();
                    h3 = QString("%1").arg(ret).at(1);
                    h2 = QString("%1").arg(hh%24).at(0);
               }
                else //hh<10
                {
                    uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                    h2 = QString("0");
                    h3 = QString("%1").arg(temp);
                }
        }
            ui->label_endtime->setText(QString("%1%2:%3%4").arg(h2).arg(h3).arg(m3).arg(m4));//總治療剩余時間
            ui->label_26->hide();
            ui->label_timeleft->hide();
            ui->label_endtime->show();
            ui->label_timeend->show();
            endtime_buttonflag =1;
    }
    else if(endtime_buttonflag ==1){
            ui->label_26->show();
            ui->label_timeleft->show();
            ui->label_endtime->hide();
            ui->label_timeend->hide();
            endtime_buttonflag =0;
    }
}

第三步實現的效果截圖
系統時間

QT如何實現將兩個時間相加

剩余時間

QT如何實現將兩個時間相加

【1】剛開始顯示的是剩余時間,默認值,可通過按鈕設置
【2】在這個時間背后我添加了一個原型按鈕
【3】點擊原型按鈕可以切換剩余時間和結束時間【方便醫護人員及時及時下班】

結束時間=剩余時間+系統時間

QT如何實現將兩個時間相加

【4】系統時間+清洗時間【附上源碼】

【1】效果跟上面時一個道理,只是這里的清洗時間是分鐘,范圍是3-999,需要將清洗時間分鐘轉化為時分:hh:mm
【2】系統時間算法跟上面的一樣 hh:mm
【3】想要的效果:
開始時間:hh:mm不變
結束時間=系統時間+清洗時間 hh:mm 跟隨清洗時間的變化而變化
【4】清洗時間由控制MCU->發送通信給-》監控MCU->UI顯示【實時變化】

第一步直接附上代碼

//計算各個清洗按鈕界面的開始時間和結束時間【SJY新增】
void MainWindow::setRinseTimeStartAndEnd(QString Val)
{
    if(Val == "水洗"){//3-999
            static uint8_t flag =0;
            if(flag == 0)//第一次進入
            {
                  Sys_time.clear();
                  Sys_time = ui->label_time->text();//獲取系統時間
                  //qDebug()<<"Sys_time--------------------"<<Sys_time;
                  ui->label_Rinsestarttime->setText(tr(QString("開始時間 %1:%2").arg(Sys_time.split(":").at(0)).arg(Sys_time.split(":").at(1)).toUtf8().data()));
                  flag =1;//一直保留這個值
            }
             //QString Water_time = QString("0:%1").arg(ui->stage1_time_1->text().split(" ").at(0));//水洗時間分鐘
            QString Water_time = QString("%1").arg(data_lib->Get_Value(71));//水洗時間分鐘
            uint8_t hmus,min;
            uint32_t Total_time=Water_time.toInt();
            if(Total_time >59)
            {
                    Water_time.clear();
                    hmus = Total_time/60;//小時
                    min= Total_time%60;//分
                    Water_time = QString("%1:%2").arg(hmus).arg(min);
            }
            else
            {
                     Water_time.clear();
                     Water_time = QString("0:%1").arg(Total_time);
            }
             bool ok;
             uint32_t mm,hh;
             QStringList m1; QStringList m2;
             QString m3; QString m4;  QString m5; QString m6;  QString h3; QString h2;
             m1 = Water_time.split(":");//9:59
             m2 = Sys_time.split(":");//例如:23:59
             m3 = m1.at(0);//9
             m4 = m1.at(1);//59
             m5 = m2.at(0);//23
             m6 = m2.at(1);//59
             mm =m4.toInt(&ok,10)+m6.toInt(&ok,10);//分鐘
             hh =m3.toInt(&ok,10)+m5.toInt(&ok,10);//小時
             qDebug()<<m3<<m4<<"\n"<<m5<<m6<<"\n"<<hh<<mm<<endl;
            if((mm >=60)&&(mm <100))//分鐘不能大于60   大于增加一個小時
            {
                 if(mm == 60)//小時加1
                 {
                     m4 = QString("0");
                     m3 = QString("0");
                 }
                 else//>60
                 {
                         //小時加1  并且拼接出分鐘數值
                     if(( mm>=61) &&(mm<=69))//01-09
                     {
                         m4 = QString("%1").arg(mm%60).at(0);//余數時5
                         m3 = QString("0");
                     }
                     else
                     {
                         m4 = QString("%1").arg(mm%60).at(1);
                         m3 = QString("%1").arg(mm%60).at(0);
                     }
                 }
                 //小時計算和求值
                 if(hh >23)//半夜三更
                 {
                     h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+1);
                     h2 = QString("0");
                 }
                 else if(hh == 23)//晚上:00.00
                 {
                     h2 = QString("%1").arg(QString("0").toInt()+1);
                     h3 = QString("0");
                 }
                 else if(hh>=10&&hh<=22)
                {
                   QString temp  = QString("%1").arg(hh%24);//19
                   uint8_t  ret = temp.toInt()+1;//20  //11-23
                   h3 = QString("%1").arg(ret).at(1);
                    if(ret >= 20)
                    {
                        h2 = QString("%1").arg(ret).at(0);
                    }
                    else
                    {
                        h2 = QString("%1").arg(hh%24).at(0);
                    }
                }
                 else //hh<10
             {

                 QString temp  = QString("%1").arg(hh%24);//=9
                 uint8_t  ret = temp.toInt()+1;
                 if(ret ==10)//10:00
                 {
                          h2 = QString("1");
                          h3 = QString("0");
                 }
                 else {
                     h2 = QString("0");
                     h3 = QString("%1").arg(ret);
                 }
             }
            }
            else if(mm >= 100)//大于等于100   mm最大時59+59=118
            {
                 m4 = QString("%1").arg(mm%60).at(1);
                 m3 = QString("%1").arg(mm%60).at(0);
                 uint8_t rethh = mm/60;//轉化為小時
                  //小時計算和求值
                  if(hh >23)//半夜三更
                  {
                      h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+rethh);
                      h2 = QString("0");
                  }
                  else if(hh == 23)//晚上:00.00
                  {
                      h2 = QString("%1").arg(QString("0").toInt()+rethh);
                      h3 = QString("0");
                  }
                  else if(hh>=10&&hh<=22)
                 {

                    QString temp  = QString("%1").arg(hh%24);//=10
                    uint8_t  ret = temp.toInt()+rethh;
                    h3 = QString("%1").arg(ret).at(1);
                     h2 = QString("%1").arg(hh%24).at(0);
                 }
                  else //<10
                  {

                      QString temp  = QString("%1").arg(hh%24);//=9
                      uint8_t  ret = temp.toInt()+rethh;
                      if(ret ==10)//10:00
                      {
                               h2 = QString("1");
                               h3 = QString("0");
                      }
                      else {
                          h2 = QString("0");
                          h3 = QString("%1").arg(ret);
                      }
                  }
            }
            else  if(mm<10 )
            {
                 m4 = QString("%1").arg(mm%60);
                 m3 = QString("%1").arg(0);
                 //小時計算和求值
                 if(hh >23)//半夜三更
                 {
                     h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                     h2 = QString("0");
                 }
                 else if(hh == 23)//晚上:00.00
                 {
                     h2 = QString("%1").arg(QString("0").toInt());
                     h3 = QString("0");
                 }
                 else if(hh>=10&&hh<=22)
                {

                   QString temp  = QString("%1").arg(hh%24);//=10
                   uint8_t  ret = temp.toInt();
                   h3 = QString("%1").arg(ret).at(1);
                    h2 = QString("%1").arg(hh%24).at(0);
                }
                 else //<10
                 {
                     uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                     h2 = QString("0");
                     h3 = QString("%1").arg(temp);
                 }
            }
            else//     10<=mm>=59
             {
                     m4 = QString(QString("%1").arg(mm%60).at(1));
                     m3 = QString(QString("%1").arg(mm%60).at(0));
                     //小時計算和求值
                     if(hh >23)//半夜三更
                     {
                         h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                         h2 = QString("0");
                     }
                     else if(hh == 23)//晚上:00.00
                     {
                         h2 = QString("%1").arg(QString("0").toInt());
                         h3 = QString("0");
                     }
                     else if(hh>=10&&hh<=22)
                    {
                         QString temp  = QString("%1").arg(hh%24);//=10
                         uint8_t  ret = temp.toInt();
                         h3 = QString("%1").arg(ret).at(1);
                         h2 = QString("%1").arg(hh%24).at(0);
                    }
                     else //hh<10
                     {
                         uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                         h2 = QString("0");
                         h3 = QString("%1").arg(temp);
                     }
             }
             ui->label_Rinseendime->setText(QString("%1%2%3:%4%5").arg("結束時間 ").arg(h2).arg(h3).arg(m3).arg(m4));//總治療剩余時間
             ui->label_Rinsestarttime->show();
             ui->label_Rinseendime->show();
    }
    else if(Val == "酸洗")//15-999
    {
        static uint8_t flag =0;
        if(flag == 0)//第一次進入
        {
              Sys_time.clear();
              Sys_time = ui->label_time->text();//獲取系統時間
              ui->label_Rinsestarttime->setText(tr(QString("開始時間 %1:%2").arg(Sys_time.split(":").at(0)).arg(Sys_time.split(":").at(1)).toUtf8().data()));
              flag =1;
        }
//        QString stage1_time_3 = QString("%1").arg(ui->stage1_time_3->text().split(" ").at(0));//酸洗前水洗
//        QString stage2_time_3 = QString("%1").arg(ui->stage2_time_3->text().split(" ").at(0));//酸洗
//        QString stage3_time_3 = QString("%1").arg(ui->stage3_time_3->text().split(" ").at(0));//酸洗浸泡
//        QString stage4_time_3 = QString("%1").arg(ui->stage4_time_3->text().split(" ").at(0));//酸洗后水洗
        QString stage1_time_3 = QString("%1").arg(data_lib->Get_Value(72).split(" ").at(0));//酸洗前水洗15
        QString stage2_time_3 = QString("%1").arg(data_lib->Get_Value(73).split(" ").at(0));//酸洗20
        QString stage3_time_3 = QString("%1").arg(data_lib->Get_Value(74).split(" ").at(0));//酸洗浸泡60
        QString stage4_time_3 = QString("%1").arg(data_lib->Get_Value(75).split(" ").at(0));//酸洗后水洗20
        uint8_t hmus,min;
        QString stage_time;
        uint32_t  Total_time = stage1_time_3.toInt()+stage2_time_3.toInt()+stage3_time_3.toInt()+stage4_time_3.toInt();
        if(Total_time >59)
        {
                hmus = Total_time/60;//小時
                min= Total_time%60;//分
                stage_time = QString("%1:%2").arg(hmus).arg(min);
        }
        else
        {
                 stage_time = QString("0:%1").arg(Total_time);
        }
        bool ok;
        uint32_t mm,hh;
        QStringList m1; QStringList m2;
        QString m3; QString m4;  QString m5; QString m6;  QString h3; QString h2;
        m1 = stage_time.split(":");//9:59
        m2 = Sys_time.split(":");//例如:23:59
        m3 = m1.at(0);//9
        m4 = m1.at(1);//59
        m5 = m2.at(0);//23
        m6 = m2.at(1);//59
        mm =m4.toInt(&ok,10)+m6.toInt(&ok,10);//分鐘
        hh =m3.toInt(&ok,10)+m5.toInt(&ok,10);//小時
        if((mm >=60)&&(mm <100))//分鐘不能大于60   大于增加一個小時
        {
            if(mm == 60)//小時加1
            {
                m4 = QString("0");
                m3 = QString("0");
            }
            else//>60
            {
                    //小時加1  并且拼接出分鐘數值
                if(( mm>=61) &&(mm<=69))//01-09
                {
                    m4 = QString("%1").arg(mm%60).at(0);//余數時5
                    m3 = QString("0");
                }
                else
                {
                    m4 = QString("%1").arg(mm%60).at(1);
                    m3 = QString("%1").arg(mm%60).at(0);
                }

            }
            //小時計算和求值
            if(hh >23)//半夜三更
            {
                h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+1);
                h2 = QString("0");
            }
            else if(hh == 23)//晚上:00.00
            {
                h2 = QString("%1").arg(QString("0").toInt()+1);
                h3 = QString("0");
            }
            else if(hh>=10&&hh<=22)
           {

                QString temp  = QString("%1").arg(hh%24);//19
                uint8_t  ret = temp.toInt()+1;//20  //11-23
                h3 = QString("%1").arg(ret).at(1);
                 if(ret >= 20)
                 {
                     h2 = QString("%1").arg(ret).at(0);
                 }
                 else
                 {
                     h2 = QString("%1").arg(hh%24).at(0);
                 }
           }
            else //<10
            {

                QString temp  = QString("%1").arg(hh%24);//=9
                uint8_t  ret = temp.toInt()+1;
                if(ret ==10)//10:00
                {
                         h2 = QString("1");
                         h3 = QString("0");
                }
                else {
                    h2 = QString("0");
                    h3 = QString("%1").arg(ret);
                }
            }
        }
        else if(mm >= 100)//大于等于100   mm最大時59+59=118
        {
            m4 = QString("%1").arg(mm%60).at(1);
            m3 = QString("%1").arg(mm%60).at(0);
            uint8_t rethh = mm/60;//轉化為小時
             //小時計算和求值
             if(hh >23)//半夜三更
             {
                 h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+rethh);
                 h2 = QString("0");
             }
             else if(hh == 23)//晚上:00.00
             {
                 h2 = QString("%1").arg(QString("0").toInt()+rethh);
                 h3 = QString("0");
             }
             else if(hh>=10&&hh<=22)
            {

               QString temp  = QString("%1").arg(hh%24);//=10
               uint8_t  ret = temp.toInt()+rethh;
               h3 = QString("%1").arg(ret).at(1);
                h2 = QString("%1").arg(hh%24).at(0);
            }
             else //<10
             {

                 QString temp  = QString("%1").arg(hh%24);//=9
                 uint8_t  ret = temp.toInt()+rethh;
                 if(ret ==10)//10:00
                 {
                          h2 = QString("1");
                          h3 = QString("0");
                 }
                 else {
                     h2 = QString("0");
                     h3 = QString("%1").arg(ret);
                 }
             }
        }
       else  if(mm<10 )
        {
            m4 = QString("%1").arg(mm%60);
            m3 = QString("%1").arg(0);
            //小時計算和求值
            if(hh >23)//半夜三更
            {
                h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                h2 = QString("0");
            }
            else if(hh == 23)//晚上:00.00
            {
                h2 = QString("%1").arg(QString("0").toInt());
                h3 = QString("0");
            }
            else if(hh>=10&&hh<=22)
           {

              QString temp  = QString("%1").arg(hh%24);//=10
              uint8_t  ret = temp.toInt();
              h3 = QString("%1").arg(ret).at(1);
               h2 = QString("%1").arg(hh%24).at(0);
           }
            else //<10
            {
                uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                h2 = QString("0");
                h3 = QString("%1").arg(temp);
            }
        }
        else//     10<=mm>=59
        {
                m4 = QString(QString("%1").arg(mm%60).at(1));
                m3 = QString(QString("%1").arg(mm%60).at(0));
                //小時計算和求值
                if(hh >23)//半夜三更
                {
                    h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                    h2 = QString("0");
                }
                else if(hh == 23)//晚上:00.00
                {
                    h2 = QString("%1").arg(QString("0").toInt());
                    h3 = QString("0");
                }
                else if(hh>=10&&hh<=22)
               {
                    QString temp  = QString("%1").arg(hh%24);//=10
                    uint8_t  ret = temp.toInt();
                    h3 = QString("%1").arg(ret).at(1);
                    h2 = QString("%1").arg(hh%24).at(0);
               }
                else //<10
                {
                    uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                    h2 = QString("0");
                    h3 = QString("%1").arg(temp);
                }
        }
            ui->label_Rinseendime->setText(QString("%1%2%3:%4%5").arg("結束時間 ").arg(h2).arg(h3).arg(m3).arg(m4));//總治療剩余時間
            ui->label_Rinsestarttime->show();
            ui->label_Rinseendime->show();
    }
    else if(Val == "過氧乙酸清洗")
    {
        static uint8_t flag =0;
        if(flag == 0)//第一次進入
        {
             Sys_time.clear();
              Sys_time = ui->label_time->text();//獲取系統時間
              ui->label_Rinsestarttime->setText(tr(QString("開始時間 %1:%2").arg(Sys_time.split(":").at(0)).arg(Sys_time.split(":").at(1)).toUtf8().data()));
              flag =1;
        }
//        QString stage1_time_2 = QString("%1").arg(ui->stage1_time_1->text().split(" ").at(0));//清洗前水洗
//        QString stage2_time_2 = QString("%1").arg(ui->stage2_time_2->text().split(" ").at(0));//過氧乙酸清洗
//        QString stage3_time_2 = QString("%1").arg(ui->stage3_time_2->text().split(" ").at(0));//過氧乙酸浸泡
//        QString stage4_time_2 = QString("%1").arg(ui->stage4_time_2->text().split(" ").at(0));//清洗后水洗
        QString stage1_time_2 = QString("%1").arg(data_lib->Get_Value(92).split(" ").at(0));//清洗前水洗
        QString stage2_time_2 = QString("%1").arg(data_lib->Get_Value(93).split(" ").at(0));//過氧乙酸清洗
        QString stage3_time_2 = QString("%1").arg(data_lib->Get_Value(94).split(" ").at(0));//過氧乙酸浸泡
        QString stage4_time_2 = QString("%1").arg(data_lib->Get_Value(95).split(" ").at(0));//清洗后水洗
        uint8_t hmus,min;
        QString stage_time;
        uint32_t  Total_time = stage1_time_2.toInt()+stage2_time_2.toInt()+stage3_time_2.toInt()+stage4_time_2.toInt();
        if(Total_time >59)
        {
                hmus = Total_time/60;//小時
                min= Total_time%60;//分
                stage_time = QString("%1:%2").arg(hmus).arg(min);
        }
        else
        {
                 stage_time = QString("0:%1").arg(Total_time);
        }
        bool ok;
        uint32_t mm,hh;
        QStringList m1; QStringList m2;
        QString m3; QString m4;  QString m5; QString m6;  QString h3; QString h2;
        m1 = stage_time.split(":");//9:59
        m2 = Sys_time.split(":");//例如:23:59
        m3 = m1.at(0);//9
        m4 = m1.at(1);//59
        m5 = m2.at(0);//23
        m6 = m2.at(1);//59
        mm =m4.toInt(&ok,10)+m6.toInt(&ok,10);//分鐘
        hh =m3.toInt(&ok,10)+m5.toInt(&ok,10);//小時
        qDebug()<<m3<<m4<<"\n"<<m5<<m6<<"\n"<<hh<<mm<<endl;
        if((mm >=60)&&(mm <100))//分鐘不能大于60   大于增加一個小時
        {
            if(mm == 60)//小時加1
            {
                m4 = QString("0");
                m3 = QString("0");
            }
            else//>60
            {
                    //小時加1  并且拼接出分鐘數值
                if(( mm>=61) &&(mm<=69))//01-09
                {
                    m4 = QString("%1").arg(mm%60).at(0);//余數時5
                    m3 = QString("0");
                }
                else
                {
                    m4 = QString("%1").arg(mm%60).at(1);
                    m3 = QString("%1").arg(mm%60).at(0);
                }
            }
            //小時計算和求值
            if(hh >23)//半夜三更
            {
                h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+1);
                h2 = QString("0");
            }
            else if(hh == 23)//晚上:00.00
            {
                h2 = QString("%1").arg(QString("0").toInt()+1);
                h3 = QString("0");
            }
            else if(hh>=10&&hh<=22)
           {

                QString temp  = QString("%1").arg(hh%24);//19
                uint8_t  ret = temp.toInt()+1;//20  //11-23
                h3 = QString("%1").arg(ret).at(1);
                 if(ret >= 20)
                 {
                     h2 = QString("%1").arg(ret).at(0);
                 }
                 else
                 {
                     h2 = QString("%1").arg(hh%24).at(0);
                 }
           }
            else //<10
            {

                QString temp  = QString("%1").arg(hh%24);//=9
                uint8_t  ret = temp.toInt()+1;
                if(ret ==10)//10:00
                {
                         h2 = QString("1");
                         h3 = QString("0");
                }
                else {
                    h2 = QString("0");
                    h3 = QString("%1").arg(ret);
                }
            }
        }
        else if(mm >= 100)//大于等于100   mm最大時59+59=118
        {
            m4 = QString("%1").arg(mm%60).at(1);
            m3 = QString("%1").arg(mm%60).at(0);
            uint8_t rethh = mm/60;//轉化為小時
             //小時計算和求值
             if(hh >23)//半夜三更
             {
                 h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+rethh);
                 h2 = QString("0");
             }
             else if(hh == 23)//晚上:00.00
             {
                 h2 = QString("%1").arg(QString("0").toInt()+rethh);
                 h3 = QString("0");
             }
             else if(hh>=10&&hh<=22)
            {

               QString temp  = QString("%1").arg(hh%24);//=10
               uint8_t  ret = temp.toInt()+rethh;
               h3 = QString("%1").arg(ret).at(1);
                h2 = QString("%1").arg(hh%24).at(0);
            }
             else //<10
             {

                 QString temp  = QString("%1").arg(hh%24);//=9
                 uint8_t  ret = temp.toInt()+rethh;
                 if(ret ==10)//10:00
                 {
                          h2 = QString("1");
                          h3 = QString("0");
                 }
                 else {
                     h2 = QString("0");
                     h3 = QString("%1").arg(ret);
                 }
             }
        }
       else  if(mm<10 )
        {
            m4 = QString("%1").arg(mm%60);
            m3 = QString("%1").arg(0);
            //小時計算和求值
            if(hh >23)//半夜三更
            {
                h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                h2 = QString("0");
            }
            else if(hh == 23)//晚上:00.00
            {
                h2 = QString("%1").arg(QString("0").toInt());
                h3 = QString("0");
            }
            else if(hh>=10&&hh<=22)
           {

              QString temp  = QString("%1").arg(hh%24);//=10
              uint8_t  ret = temp.toInt();
              h3 = QString("%1").arg(ret).at(1);
               h2 = QString("%1").arg(hh%24).at(0);
           }
            else //<10
            {
                uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                h2 = QString("0");
                h3 = QString("%1").arg(temp);
            }
        }
        else//     10<=mm>=59
        {
                m4 = QString(QString("%1").arg(mm%60).at(1));
                m3 = QString(QString("%1").arg(mm%60).at(0));
                //小時計算和求值
                if(hh >23)//半夜三更
                {
                    h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                    h2 = QString("0");
                }
                else if(hh == 23)//晚上:00.00
                {
                    h2 = QString("%1").arg(QString("0").toInt());
                    h3 = QString("0");
                }
                else if(hh>=10&&hh<=22)
               {
                    QString temp  = QString("%1").arg(hh%24);//=10
                    uint8_t  ret = temp.toInt();
                    h3 = QString("%1").arg(ret).at(1);
                    h2 = QString("%1").arg(hh%24).at(0);
               }
                else //<10
                {
                    uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                    h2 = QString("0");
                    h3 = QString("%1").arg(temp);
                }
        }
            ui->label_Rinseendime->setText(QString("%1%2%3:%4%5").arg("結束時間 ").arg(h2).arg(h3).arg(m3).arg(m4));//總治療剩余時間
            ui->label_Rinsestarttime->show();
            ui->label_Rinseendime->show();
    }
    else if(Val == "消毒")
    {

        static uint8_t flag =0;
        if(flag == 0)//第一次進入
        {
              Sys_time.clear();
              Sys_time = ui->label_time->text();//獲取系統時間
              ui->label_Rinsestarttime->setText(tr(QString("開始時間 %1:%2").arg(Sys_time.split(":").at(0)).arg(Sys_time.split(":").at(1)).toUtf8().data()));
              flag =1;
        }
//        QString stage1_time_4 = QString("%1").arg(ui->stage1_time_4->text().split(" ").at(0));//消毒前水洗
//        QString stage2_time_4 = QString("%1").arg(ui->stage2_time_4->text().split(" ").at(0));//消毒
//        QString stage3_time_4 = QString("%1").arg(ui->stage3_time_4->text().split(" ").at(0));//消毒靜置
//        QString stage4_time_4 = QString("%1").arg(ui->stage4_time_4->text().split(" ").at(0));//消毒后水洗
        QString stage1_time_4 = QString("%1").arg(data_lib->Get_Value(77).split(" ").at(0));//消毒前水洗
        QString stage2_time_4 = QString("%1").arg(data_lib->Get_Value(78).split(" ").at(0));//消毒
        QString stage3_time_4 = QString("%1").arg(data_lib->Get_Value(79).split(" ").at(0));//消毒靜置
        QString stage4_time_4 = QString("%1").arg(data_lib->Get_Value(80).split(" ").at(0));//消毒后水洗
        uint8_t hmus,min;
        QString stage_time;
        uint32_t  Total_time = stage1_time_4.toInt()+stage2_time_4.toInt()+stage3_time_4.toInt()+stage4_time_4.toInt();
        if(Total_time >59)
        {
                hmus = Total_time/60;//小時
                min= Total_time%60;//分
                stage_time = QString("%1:%2").arg(hmus).arg(min);
        }
        else
        {
                 stage_time = QString("0:%1").arg(Total_time);
        }
        bool ok;
        uint32_t mm,hh;
        QStringList m1; QStringList m2;
        QString m3; QString m4;  QString m5; QString m6;  QString h3; QString h2;
        m1 = stage_time.split(":");//9:59
        m2 = Sys_time.split(":");//例如:23:59
        m3 = m1.at(0);//9
        m4 = m1.at(1);//59
        m5 = m2.at(0);//23
        m6 = m2.at(1);//59
        mm =m4.toInt(&ok,10)+m6.toInt(&ok,10);//分鐘
        hh =m3.toInt(&ok,10)+m5.toInt(&ok,10);//小時
        qDebug()<<m3<<m4<<"\n"<<m5<<m6<<"\n"<<hh<<mm<<endl;
        if((mm >=60)&&(mm <100))//分鐘不能大于60   大于增加一個小時
        {
            if(mm == 60)//小時加1
            {
                m4 = QString("0");
                m3 = QString("0");
            }
            else//>60
            {
                    //小時加1  并且拼接出分鐘數值
                if(( mm>=61) &&(mm<=69))//01-09
                {
                    m4 = QString("%1").arg(mm%60).at(0);//余數時5
                    m3 = QString("0");
                }
                else
                {
                    m4 = QString("%1").arg(mm%60).at(1);
                    m3 = QString("%1").arg(mm%60).at(0);
                }
            }
            //小時計算和求值
            if(hh >23)//半夜三更
            {
                h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+1);
                h2 = QString("0");
            }
            else if(hh == 23)//晚上:00.00
            {
                h2 = QString("%1").arg(QString("0").toInt()+1);
                h3 = QString("0");
            }
            else if(hh>=10&&hh<=22)
           {

                QString temp  = QString("%1").arg(hh%24);//19
                uint8_t  ret = temp.toInt()+1;//20  //11-23
                h3 = QString("%1").arg(ret).at(1);
                 if(ret >= 20)
                 {
                     h2 = QString("%1").arg(ret).at(0);
                 }
                 else
                 {
                     h2 = QString("%1").arg(hh%24).at(0);
                 }
           }
            else //<10
            {

                QString temp  = QString("%1").arg(hh%24);//=9
                uint8_t  ret = temp.toInt()+1;
                if(ret ==10)//10:00
                {
                         h2 = QString("1");
                         h3 = QString("0");
                }
                else {
                    h2 = QString("0");
                    h3 = QString("%1").arg(ret);
                }
            }
        }
        else if(mm >= 100)//大于等于100   mm最大時59+59=118
        {
            m4 = QString("%1").arg(mm%60).at(1);
            m3 = QString("%1").arg(mm%60).at(0);
            uint8_t rethh = mm/60;//轉化為小時
             //小時計算和求值
             if(hh >23)//半夜三更
             {
                 h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+rethh);
                 h2 = QString("0");
             }
             else if(hh == 23)//晚上:00.00
             {
                 h2 = QString("%1").arg(QString("0").toInt()+rethh);
                 h3 = QString("0");
             }
             else if(hh>=10&&hh<=22)
            {

               QString temp  = QString("%1").arg(hh%24);//=10
               uint8_t  ret = temp.toInt()+rethh;
               h3 = QString("%1").arg(ret).at(1);
                h2 = QString("%1").arg(hh%24).at(0);
            }
             else //<10
             {

                 QString temp  = QString("%1").arg(hh%24);//=9
                 uint8_t  ret = temp.toInt()+rethh;
                 if(ret ==10)//10:00
                 {
                          h2 = QString("1");
                          h3 = QString("0");
                 }
                 else {
                     h2 = QString("0");
                     h3 = QString("%1").arg(ret);
                 }
             }
        }
       else  if(mm<10 )
        {
            m4 = QString("%1").arg(mm%60);
            m3 = QString("%1").arg(0);
            //小時計算和求值
            if(hh >23)//半夜三更
            {
                h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                h2 = QString("0");
            }
            else if(hh == 23)//晚上:00.00
            {
                h2 = QString("%1").arg(QString("0").toInt());
                h3 = QString("0");
            }
            else if(hh>=10&&hh<=22)
           {

              QString temp  = QString("%1").arg(hh%24);//=10
              uint8_t  ret = temp.toInt();
              h3 = QString("%1").arg(ret).at(1);
               h2 = QString("%1").arg(hh%24).at(0);
           }
            else //<10
            {
                uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                h2 = QString("0");
                h3 = QString("%1").arg(temp);
            }
        }
        else//     10<=mm>=59
        {
                m4 = QString(QString("%1").arg(mm%60).at(1));
                m3 = QString(QString("%1").arg(mm%60).at(0));
                //小時計算和求值
                if(hh >23)//半夜三更
                {
                    h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                    h2 = QString("0");
                }
                else if(hh == 23)//晚上:00.00
                {
                    h2 = QString("%1").arg(QString("0").toInt());
                    h3 = QString("0");
                }
                else if(hh>=10&&hh<=22)
               {
                    QString temp  = QString("%1").arg(hh%24);//=10
                    uint8_t  ret = temp.toInt();
                    h3 = QString("%1").arg(ret).at(1);
                    h2 = QString("%1").arg(hh%24).at(0);
               }
                else //<10
                {
                    uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                    h2 = QString("0");
                    h3 = QString("%1").arg(temp);
                }
        }
            ui->label_Rinseendime->setText(QString("%1%2%3:%4%5").arg("結束時間 ").arg(h2).arg(h3).arg(m3).arg(m4));//總治療剩余時間
            ui->label_Rinsestarttime->show();
            ui->label_Rinseendime->show();
    }
    else if(Val == "熱水沖洗")
    {
        static uint8_t flag =0;
        if(flag == 0)//第一次進入
        {
              Sys_time.clear();
              Sys_time = ui->label_time->text();//獲取系統時間
              ui->label_Rinsestarttime->setText(tr(QString("開始時間 %1:%2").arg(Sys_time.split(":").at(0)).arg(Sys_time.split(":").at(1)).toUtf8().data()));
              flag =1;
        }
//        QString stage1_time_5 = QString("%1").arg(ui->stage1_time_5->text().split(" ").at(0));//熱沖洗前水洗
//        QString stage2_time_5 = QString("%1").arg(5);//加熱
//        QString stage3_time_5 = QString("%1").arg(ui->stage3_time_5->text().split(" ").at(0));//熱水沖洗
//        QString stage4_time_5 = QString("%1").arg(5);//冷卻
//        QString stage5_time_5 = QString("%1").arg(ui->stage5_time_5->text().split(" ").at(0));//熱沖洗后水洗
        QString stage1_time_5 = QString("%1").arg(data_lib->Get_Value(83).split(" ").at(0));//熱沖洗前水洗
        QString stage2_time_5 = QString("%1").arg(5);//加熱
        QString stage3_time_5 = QString("%1").arg(data_lib->Get_Value(84).split(" ").at(0));//熱水沖洗
        QString stage4_time_5 = QString("%1").arg(5);//冷卻
        QString stage5_time_5 = QString("%1").arg(data_lib->Get_Value(85).split(" ").at(0));//熱沖洗后水洗
        uint8_t hmus,min;
        QString stage_time;
        uint32_t  Total_time = stage1_time_5.toInt()+stage2_time_5.toInt()+stage3_time_5.toInt()+stage5_time_5.toInt()+stage4_time_5.toInt();
        if(Total_time >59)
        {
                hmus = Total_time/60;//小時
                min= Total_time%60;//分
                stage_time = QString("%1:%2").arg(hmus).arg(min);
        }
        else
        {
                 stage_time = QString("0:%1").arg(Total_time);
        }
        bool ok;
        uint32_t mm,hh;
        QStringList m1; QStringList m2;
        QString m3; QString m4;  QString m5; QString m6;  QString h3; QString h2;
        m1 = stage_time.split(":");//9:59
        m2 = Sys_time.split(":");//例如:23:59
        m3 = m1.at(0);//9
        m4 = m1.at(1);//59
        m5 = m2.at(0);//23
        m6 = m2.at(1);//59
        mm =m4.toInt(&ok,10)+m6.toInt(&ok,10);//分鐘
        hh =m3.toInt(&ok,10)+m5.toInt(&ok,10);//小時
        qDebug()<<m3<<m4<<"\n"<<m5<<m6<<"\n"<<hh<<mm<<endl;
        if((mm >=60)&&(mm <100))//分鐘不能大于60   大于增加一個小時
        {
            if(mm == 60)//小時加1
            {
                m4 = QString("0");
                m3 = QString("0");
            }
            else//>60
            {
                    //小時加1  并且拼接出分鐘數值
                if(( mm>=61) &&(mm<=69))//01-09
                {
                    m4 = QString("%1").arg(mm%60).at(0);//余數時5
                    m3 = QString("0");
                }
                else
                {
                    m4 = QString("%1").arg(mm%60).at(1);
                    m3 = QString("%1").arg(mm%60).at(0);
                }
            }
            //小時計算和求值
            if(hh >23)//半夜三更
            {
                h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+1);
                h2 = QString("0");
            }
            else if(hh == 23)//晚上:00.00
            {
                h2 = QString("%1").arg(QString("0").toInt()+1);
                h3 = QString("0");
            }
            else if(hh>=10&&hh<=22)
           {

                QString temp  = QString("%1").arg(hh%24);//19
                uint8_t  ret = temp.toInt()+1;//20  //11-23
                h3 = QString("%1").arg(ret).at(1);
                 if(ret >= 20)
                 {
                     h2 = QString("%1").arg(ret).at(0);
                 }
                 else
                 {
                     h2 = QString("%1").arg(hh%24).at(0);
                 }
           }
            else //<10
            {

                QString temp  = QString("%1").arg(hh%24);//=9
                uint8_t  ret = temp.toInt()+1;
                if(ret ==10)//10:00
                {
                         h2 = QString("1");
                         h3 = QString("0");
                }
                else {
                    h2 = QString("0");
                    h3 = QString("%1").arg(ret);
                }
            }
        }
        else if(mm >= 100)//大于等于100   mm最大時59+59=118
        {
            m4 = QString("%1").arg(mm%60).at(1);
            m3 = QString("%1").arg(mm%60).at(0);
            uint8_t rethh = mm/60;//轉化為小時
             //小時計算和求值
             if(hh >23)//半夜三更
             {
                 h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+rethh);
                 h2 = QString("0");
             }
             else if(hh == 23)//晚上:00.00
             {
                 h2 = QString("%1").arg(QString("0").toInt()+rethh);
                 h3 = QString("0");
             }
             else if(hh>=10&&hh<=22)
            {

               QString temp  = QString("%1").arg(hh%24);//=10
               uint8_t  ret = temp.toInt()+rethh;
               h3 = QString("%1").arg(ret).at(1);
                h2 = QString("%1").arg(hh%24).at(0);
            }
             else //<10
             {

                 QString temp  = QString("%1").arg(hh%24);//=9
                 uint8_t  ret = temp.toInt()+rethh;
                 if(ret ==10)//10:00
                 {
                          h2 = QString("1");
                          h3 = QString("0");
                 }
                 else {
                     h2 = QString("0");
                     h3 = QString("%1").arg(ret);
                 }
             }
        }
       else  if(mm<10 )
        {
            m4 = QString("%1").arg(mm%60);
            m3 = QString("%1").arg(0);
            //小時計算和求值
            if(hh >23)//半夜三更
            {
                h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                h2 = QString("0");
            }
            else if(hh == 23)//晚上:00.00
            {
                h2 = QString("%1").arg(QString("0").toInt());
                h3 = QString("0");
            }
            else if(hh>=10&&hh<=22)
           {

              QString temp  = QString("%1").arg(hh%24);//=10
              uint8_t  ret = temp.toInt();
              h3 = QString("%1").arg(ret).at(1);
               h2 = QString("%1").arg(hh%24).at(0);
           }
            else //<10
            {
                uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                h2 = QString("0");
                h3 = QString("%1").arg(temp);
            }
        }
        else//     10<=mm>=59
        {
                m4 = QString(QString("%1").arg(mm%60).at(1));
                m3 = QString(QString("%1").arg(mm%60).at(0));
                //小時計算和求值
                if(hh >23)//半夜三更
                {
                    h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                    h2 = QString("0");
                }
                else if(hh == 23)//晚上:00.00
                {
                    h2 = QString("%1").arg(QString("0").toInt());
                    h3 = QString("0");
                }
                else if(hh>=10&&hh<=22)
               {
                    QString temp  = QString("%1").arg(hh%24);//=10
                    uint8_t  ret = temp.toInt();
                    h3 = QString("%1").arg(ret).at(1);
                    h2 = QString("%1").arg(hh%24).at(0);
               }
                else //<10
                {
                    uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                    h2 = QString("0");
                    h3 = QString("%1").arg(temp);
                }
        }
            ui->label_Rinseendime->setText(QString("%1%2%3:%4%5").arg("結束時間 ").arg(h2).arg(h3).arg(m3).arg(m4));//總治療剩余時間
            ui->label_Rinsestarttime->show();
            ui->label_Rinseendime->show();
    }
    else if(Val == "熱水檸檬酸洗")
    {
        static uint8_t flag =0;
        if(flag == 0)//第一次進入
        {
              Sys_time.clear();
              Sys_time = ui->label_time->text();//獲取系統時間
              ui->label_Rinsestarttime->setText(tr(QString("開始時間 %1:%2").arg(Sys_time.split(":").at(0)).arg(Sys_time.split(":").at(1)).toUtf8().data()));
              flag =1;
        }
//        QString stage1_time_6 = QString("%1").arg(ui->stage1_time_6->text().split(" ").at(0));//清洗前水洗
//        QString stage2_time_6 = QString("%1").arg(5);//加熱
//        QString stage3_time_6 = QString("%1").arg(ui->stage3_time_6->text().split(" ").at(0));//熱水檸檬酸洗
//        QString stage4_time_6 = QString("%1").arg(5);//冷卻
//        QString stage5_time_6 = QString("%1").arg(ui->stage5_time_6->text().split(" ").at(0));//熱沖洗后水洗
        QString stage1_time_6 = QString("%1").arg(data_lib->Get_Value(87).split(" ").at(0));//清洗前水洗
        QString stage2_time_6 = QString("%1").arg(5);//加熱
        QString stage3_time_6 = QString("%1").arg(data_lib->Get_Value(88).split(" ").at(0));//熱水檸檬酸洗
        QString stage4_time_6 = QString("%1").arg(5);//冷卻
        QString stage5_time_6 = QString("%1").arg(data_lib->Get_Value(89).split(" ").at(0));//熱沖洗后水洗
        uint8_t hmus,min;
        QString stage_time;
        uint32_t  Total_time = stage1_time_6.toInt()+stage2_time_6.toInt()+stage3_time_6.toInt()+stage5_time_6.toInt()+stage4_time_6.toInt();
        if(Total_time >59)
        {
                hmus = Total_time/60;//小時
                min= Total_time%60;//分
                stage_time = QString("%1:%2").arg(hmus).arg(min);
        }
        else
        {
                 stage_time = QString("0:%1").arg(Total_time);
        }
        bool ok;
        uint32_t mm,hh;
        QStringList m1; QStringList m2;
        QString m3; QString m4;  QString m5; QString m6;  QString h3; QString h2;
        m1 = stage_time.split(":");//9:59
        m2 = Sys_time.split(":");//例如:23:59
        m3 = m1.at(0);//9
        m4 = m1.at(1);//59
        m5 = m2.at(0);//23
        m6 = m2.at(1);//59
        mm =m4.toInt(&ok,10)+m6.toInt(&ok,10);//分鐘
        hh =m3.toInt(&ok,10)+m5.toInt(&ok,10);//小時
        qDebug()<<m3<<m4<<"\n"<<m5<<m6<<"\n"<<hh<<mm<<endl;
        if((mm >=60)&&(mm <100))//分鐘不能大于60   大于增加一個小時
        {
            if(mm == 60)//小時加1
            {
                m4 = QString("0");
                m3 = QString("0");
            }
            else//>60
            {
                    //小時加1  并且拼接出分鐘數值
                if(( mm>=61) &&(mm<=69))//01-09
                {
                    m4 = QString("%1").arg(mm%60).at(0);//余數時5
                    m3 = QString("0");
                }
                else
                {
                    m4 = QString("%1").arg(mm%60).at(1);
                    m3 = QString("%1").arg(mm%60).at(0);
                }
            }
            //小時計算和求值
            if(hh >23)//半夜三更
            {
                h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+1);
                h2 = QString("0");
            }
            else if(hh == 23)//晚上:00.00
            {
                h2 = QString("%1").arg(QString("0").toInt()+1);
                h3 = QString("0");
            }
            else if(hh>=10&&hh<=22)
           {

                QString temp  = QString("%1").arg(hh%24);//19
                uint8_t  ret = temp.toInt()+1;//20  //11-23
                h3 = QString("%1").arg(ret).at(1);
                 if(ret >= 20)
                 {
                     h2 = QString("%1").arg(ret).at(0);
                 }
                 else
                 {
                     h2 = QString("%1").arg(hh%24).at(0);
                 }
           }
            else //<10
            {

                QString temp  = QString("%1").arg(hh%24);//=9
                uint8_t  ret = temp.toInt()+1;
                if(ret ==10)//10:00
                {
                         h2 = QString("1");
                         h3 = QString("0");
                }
                else {
                    h2 = QString("0");
                    h3 = QString("%1").arg(ret);
                }
            }
        }
        else if(mm >= 100)//大于等于100   mm最大時59+59=118
        {
            m4 = QString("%1").arg(mm%60).at(1);
            m3 = QString("%1").arg(mm%60).at(0);
            uint8_t rethh = mm/60;//轉化為小時
             //小時計算和求值
             if(hh >23)//半夜三更
             {
                 h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+rethh);
                 h2 = QString("0");
             }
             else if(hh == 23)//晚上:00.00
             {
                 h2 = QString("%1").arg(QString("0").toInt()+rethh);
                 h3 = QString("0");
             }
             else if(hh>=10&&hh<=22)
            {

               QString temp  = QString("%1").arg(hh%24);//=10
               uint8_t  ret = temp.toInt()+rethh;
               h3 = QString("%1").arg(ret).at(1);
                h2 = QString("%1").arg(hh%24).at(0);
            }
             else //<10
             {

                 QString temp  = QString("%1").arg(hh%24);//=9
                 uint8_t  ret = temp.toInt()+rethh;
                 if(ret ==10)//10:00
                 {
                          h2 = QString("1");
                          h3 = QString("0");
                 }
                 else {
                     h2 = QString("0");
                     h3 = QString("%1").arg(ret);
                 }
             }
        }
       else  if(mm<10 )
        {
            m4 = QString("%1").arg(mm%60);
            m3 = QString("%1").arg(0);
            //小時計算和求值
            if(hh >23)//半夜三更
            {
                h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                h2 = QString("0");
            }
            else if(hh == 23)//晚上:00.00
            {
                h2 = QString("%1").arg(QString("0").toInt());
                h3 = QString("0");
            }
            else if(hh>=10&&hh<=22)
           {

              QString temp  = QString("%1").arg(hh%24);//=10
              uint8_t  ret = temp.toInt();
              h3 = QString("%1").arg(ret).at(1);
               h2 = QString("%1").arg(hh%24).at(0);
           }
            else //<10
            {
                uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                h2 = QString("0");
                h3 = QString("%1").arg(temp);
            }
        }
        else//     10<=mm>=59
        {
                m4 = QString(QString("%1").arg(mm%60).at(1));
                m3 = QString(QString("%1").arg(mm%60).at(0));
                //小時計算和求值
                if(hh >23)//半夜三更
                {
                    h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                    h2 = QString("0");
                }
                else if(hh == 23)//晚上:00.00
                {
                    h2 = QString("%1").arg(QString("0").toInt());
                    h3 = QString("0");
                }
                else if(hh>=10&&hh<=22)
               {
                    QString temp  = QString("%1").arg(hh%24);//=10
                    uint8_t  ret = temp.toInt();
                    h3 = QString("%1").arg(ret).at(1);
                    h2 = QString("%1").arg(hh%24).at(0);
               }
                else //<10
                {
                    uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                    h2 = QString("0");
                    h3 = QString("%1").arg(temp);
                }
        }
            ui->label_Rinseendime->setText(QString("%1%2%3:%4%5").arg("結束時間 ").arg(h2).arg(h3).arg(m3).arg(m4));//總治療剩余時間
            ui->label_Rinsestarttime->show();
            ui->label_Rinseendime->show();
    }
    else if(Val == "強制沖洗")
    {
        static uint8_t flag =0;
        if(flag == 0)//第一次進入
        {
              Sys_time.clear();
              MandatoryRinse.clear();
              Sys_time = ui->label_time->text();//獲取系統時間
              ui->label_Rinsestarttime->setText(tr(QString("開始時間 %1:%2").arg(Sys_time.split(":").at(0)).arg(Sys_time.split(":").at(1)).toUtf8().data()));
              MandatoryRinse = QString("0:%1").arg(ui->label_rinseleft->text().split(" ").at(0));//強制沖洗分鐘
              flag =1;//一直保留這個值
        }
        //QString Water_time = QString("%1").arg(data_lib->Get_Value(71));//水洗時間分鐘
        uint32_t hmus,min;
        uint32_t Total_time=MandatoryRinse.toInt();
        if(Total_time >59)
        {
                MandatoryRinse.clear();
                hmus = Total_time/60;//小時
                min= Total_time%60;//分
                MandatoryRinse = QString("%1:%2").arg(hmus).arg(min);
        }
        else
        {
                 MandatoryRinse.clear();
                 MandatoryRinse = QString("0:%1").arg(Total_time);
        }
         bool ok;
         uint32_t mm,hh;
         QStringList m1; QStringList m2;
         QString m3; QString m4;  QString m5; QString m6;  QString h3; QString h2;
         m1 = MandatoryRinse.split(":");//9:59
         m2 = Sys_time.split(":");//例如:23:59
         m3 = m1.at(0);//9
         m4 = m1.at(1);//59
         m5 = m2.at(0);//23
         m6 = m2.at(1);//59
         mm =m4.toInt(&ok,10)+m6.toInt(&ok,10);//分鐘
         hh =m3.toInt(&ok,10)+m5.toInt(&ok,10);//小時
         qDebug()<<m3<<m4<<"\n"<<m5<<m6<<"\n"<<hh<<mm<<endl;
        if((mm >=60)&&(mm <100))//分鐘不能大于60   大于增加一個小時
        {
             if(mm == 60)//小時加1
             {
                 m4 = QString("0");
                 m3 = QString("0");
             }
             else//>60
             {
                     //小時加1  并且拼接出分鐘數值
                 if(( mm>=61) &&(mm<=69))//01-09
                 {
                     m4 = QString("%1").arg(mm%60).at(0);//余數時5
                     m3 = QString("0");
                 }
                 else
                 {
                     m4 = QString("%1").arg(mm%60).at(1);
                     m3 = QString("%1").arg(mm%60).at(0);
                 }
             }
             //小時計算和求值
             if(hh >23)//半夜三更
             {
                 h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+1);
                 h2 = QString("0");
             }
             else if(hh == 23)//晚上:00.00
             {
                 h2 = QString("%1").arg(QString("0").toInt()+1);
                 h3 = QString("0");
             }
             else if(hh>=10&&hh<=22)
            {
               QString temp  = QString("%1").arg(hh%24);//19
               uint8_t  ret = temp.toInt()+1;//20  //11-23
               h3 = QString("%1").arg(ret).at(1);
                if(ret >= 20)
                {
                    h2 = QString("%1").arg(ret).at(0);
                }
                else
                {
                    h2 = QString("%1").arg(hh%24).at(0);
                }
            }
             else //<10
         {

             QString temp  = QString("%1").arg(hh%24);//=9
             uint8_t  ret = temp.toInt()+1;
             if(ret ==10)//10:00
             {
                      h2 = QString("1");
                      h3 = QString("0");
             }
             else {
                 h2 = QString("0");
                 h3 = QString("%1").arg(ret);
             }
         }
        }
        else if(mm >= 100)//大于等于100   mm最大時59+59=118
        {
             m4 = QString("%1").arg(mm%60).at(1);
             m3 = QString("%1").arg(mm%60).at(0);
             uint8_t rethh = mm/60;//轉化為小時
              //小時計算和求值
              if(hh >23)//半夜三更
              {
                  h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt()+rethh);
                  h2 = QString("0");
              }
              else if(hh == 23)//晚上:00.00
              {
                  h2 = QString("%1").arg(QString("0").toInt()+rethh);
                  h3 = QString("0");
              }
              else if(hh>=10&&hh<=22)
             {

                QString temp  = QString("%1").arg(hh%24);//=10
                uint8_t  ret = temp.toInt()+rethh;
                h3 = QString("%1").arg(ret).at(1);
                 h2 = QString("%1").arg(hh%24).at(0);
             }
              else //<10
              {

                  QString temp  = QString("%1").arg(hh%24);//=9
                  uint8_t  ret = temp.toInt()+rethh;
                  if(ret ==10)//10:00
                  {
                           h2 = QString("1");
                           h3 = QString("0");
                  }
                  else {
                      h2 = QString("0");
                      h3 = QString("%1").arg(ret);
                  }
              }
        }
        else  if(mm<10 )
        {
             m4 = QString("%1").arg(mm%60);
             m3 = QString("%1").arg(0);
             //小時計算和求值
             if(hh >23)//半夜三更
             {
                 h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                 h2 = QString("0");
             }
             else if(hh == 23)//晚上:00.00
             {
                 h2 = QString("%1").arg(QString("0").toInt());
                 h3 = QString("0");
             }
             else if(hh>=10&&hh<=22)
            {

               QString temp  = QString("%1").arg(hh%24);//=10
               uint8_t  ret = temp.toInt();
               h3 = QString("%1").arg(ret).at(1);
                h2 = QString("%1").arg(hh%24).at(0);
            }
             else //<10
             {
                 uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                 h2 = QString("0");
                 h3 = QString("%1").arg(temp);
             }
        }
        else//     10<=mm>=59
         {
                m4 = QString(QString("%1").arg(mm%60).at(1));
                m3 = QString(QString("%1").arg(mm%60).at(0));
                //小時計算和求值
                if(hh >23)//半夜三更
                {
                    h3 = QString("%1").arg(QString("%1").arg(hh%24).toInt());
                    h2 = QString("0");
                }
                else if(hh == 23)//晚上:00.00
                {
                    h2 = QString("%1").arg(QString("0").toInt());
                    h3 = QString("0");
                }
                else if(hh>=10&&hh<=22)
               {
                    QString temp  = QString("%1").arg(hh%24);//=10
                    uint8_t  ret = temp.toInt();
                    h3 = QString("%1").arg(ret).at(1);
                    h2 = QString("%1").arg(hh%24).at(0);
               }
                else //<10
                {
                    uint8_t temp  = QString("%1").arg(hh%24).toInt();//=9
                    h2 = QString("0");
                    h3 = QString("%1").arg(temp);
                }
         }
         ui->label_Rinseendime->setText(QString("%1%2%3:%4%5").arg("結束時間 ").arg(h2).arg(h3).arg(m3).arg(m4));//總治療剩余時間
         ui->label_Rinsestarttime->show();
         ui->label_Rinseendime->show();
    }
    else
    {
        //擴展
    }
}

實現的效果

QT如何實現將兩個時間相加

QT如何實現將兩個時間相加

“QT如何實現將兩個時間相加”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

qt
AI

依安县| 蒲城县| 福鼎市| 浮梁县| 正镶白旗| 大庆市| 手机| 滨州市| 东海县| 彝良县| 龙山县| 镇宁| 安仁县| 阿合奇县| 海盐县| 长寿区| 伊宁市| 襄汾县| 古田县| 霞浦县| 福安市| 宿州市| 长宁区| 沁阳市| 兰溪市| 大石桥市| 福鼎市| 文水县| 邢台县| 伽师县| 天峻县| 西畴县| 松桃| 商水县| 松原市| 象州县| 铁力市| 吉首市| 马关县| 葵青区| 青岛市|