From 20ffcfb5507daf34f81346ca3dfa4c031e7b2fe3 Mon Sep 17 00:00:00 2001
From: wumu <mayi@mayi.com>
Date: 星期日, 27 四月 2025 22:13:53 +0800
Subject: [PATCH] 0427

---
 internal_system_v1/converinfo2.cpp |  772 ++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 632 insertions(+), 140 deletions(-)

diff --git a/internal_system_v1/converinfo2.cpp b/internal_system_v1/converinfo2.cpp
index 0ed41dc..b9e8c48 100644
--- a/internal_system_v1/converinfo2.cpp
+++ b/internal_system_v1/converinfo2.cpp
@@ -17,6 +17,7 @@
     //initUi();
     //readInfo(); // 鍔犺浇琛ㄦ牸
     addMenu(); // 澧炲姞鑿滃崟
+    disableWheelEvent(); // 绂佺敤涓嬫媺妗嗙殑婊氳疆浜嬩欢
 
     // 鑷�傚簲澶勭悊
     ui->treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
@@ -63,12 +64,14 @@
     m_menu = new QMenu(this);
     m_menu->addAction("鍒犻櫎");
     m_menu->addAction("澧炲姞");
+    m_menu->addAction("淇濆瓨瀵煎嚭");
 
     ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
     connect(ui->treeWidget,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(showMenu(QPoint)));
 
     connect(m_menu->actions().at(0),SIGNAL(triggered(bool)),this,SLOT(deleteInfo()));
     connect(m_menu->actions().at(1),SIGNAL(triggered(bool)),this,SLOT(addInfo()));
+    connect(m_menu->actions().at(2),SIGNAL(triggered(bool)),this,SLOT(saveInfo()));
             // 鍗曚綅鍐呭淇敼
 
     // 鍙宠竟鍙紪杈戝唴瀹�
@@ -90,25 +93,149 @@
 {
     if(m_curItem==nullptr)return;
     qDebug()<<"娣诲姞鍏徃淇℃伅,鍦ㄨ妭鐐癸細"<<m_curItem->text(0);
+    on_pushButton_laodFile_clicked();
 }
 
 void ConverInfo2::deleteInfo()
 {
     if(m_curItem==nullptr)return;
     qDebug()<<"鍒犻櫎鍏徃淇℃伅,鑺傜偣锛�"<<m_curItem->text(0);
+    //auto resList = m_curItem->takeChildren();
+
+    //qDebug()<<"鍒犻櫎鏁伴噺:"<<resList.size();
+
+    // 鍒犻櫎鏁版嵁搴撹〃閲岄潰瀵瑰簲鐨勫叕鍙镐俊鎭紝骞朵笖鍐嶆鍒锋柊涓嬫媺妗嗗拰鏍戠姸鍥�
+
+        // 鏁版嵁搴撹〃鏈夛細灏侀潰淇℃伅琛� all_company_info      缁煎悎淇℃伅琛� comprehensive_entry_info    涓夊悎涓�鐨勮〃 standing_book_info
+    QString name = m_curItem->text(0);
+    QStringList sp = name.split("(鏈骇)");
+    QStringList sp2 = name.split("涓嬬骇鏁�");
+    qDebug()<<"鎷嗗紑:"<<sp<<"姹囨��:"<<sp2;
+    if(sp.size() == 2){
+        name = sp.at(0);
+    }
+    if(sp2.size() == 2){ // 寰楅�掑綊鍒犻櫎搴曚笅鐨勬墍鏈夊崟浣�
+        name = sp2.at(0);
+    }
+    // 鍒犻櫎鎵�鏈夎〃涓繖涓悕瀛�
+    deleteAllByName(name);
+
+    // 鍒犻櫎瀹屼簡锛岃繕寰楀幓鍒锋柊涓嬫媺妗�
+    for(auto it=m_nameAndComInfos.begin();it!=m_nameAndComInfos.end();){
+        if(it.key() == name){
+            m_nameAndComInfos.erase(it++);
+            break;
+        }else{
+            it++;
+        }
+    }
+
+
+    // 鍘诲埛鏂版爲褰㈠浘
+    for(auto it=m_treeNodes.begin();it!=m_treeNodes.end();){
+        // 濡傛灉绛変簬閿紝閭d箞瑕佸垹闄ゅ搴旂殑鎵�鏈夌殑鍊�
+        if(it.key() == name){
+            // 鎶婃墍鏈夌殑鍊煎搴旂殑鍗曚綅淇℃伅閮藉垹鎺�
+            for(auto str:it.value()){
+                auto p = m_nameAndComInfos.find(str);
+                if(p != m_nameAndComInfos.end()){
+                    deleteAllByName(str); // 杩樺緱鍐嶅垹鎺夋暟鎹簱涓殑鍐呭
+                    m_nameAndComInfos.erase(p);
+                }
+            }
+            m_treeNodes.erase(it++);
+            break;
+        }
+        // 鍙槸鏌愪釜鍊硷紝鍙垹闄や竴涓嵆鍙�,閬嶅巻鍊奸噷闈㈢殑杩唬鍣紝鎵惧埌鍒犻櫎鍗冲彲
+        else{
+            auto p = it.value().find(name);
+            if(p != it.value().end()){
+                it.value().erase(p);
+            }
+            it++;
+        }
+    }
+
+    emit updateComboListSignal(m_nameAndComInfos);
+    createTreeNode();
+
+
+}
+
+void ConverInfo2::saveInfo()
+{
+    if(m_curItem==nullptr)return;
+    qDebug()<<"淇濆瓨鍏徃淇℃伅,鑺傜偣锛�"<<m_curItem->text(0);
+    QString name = m_curItem->text(0);
+    if(name.contains("(鏈骇)")){
+        name = name.split("(鏈骇)").at(0);
+    }else if(name.contains("(姹囨��)")){
+        name = name.split("(姹囨��)").at(0);
+        name = name + "(姹囨��)";
+    }
+    qDebug()<<"淇濆瓨鍏徃鍚�:"<<name;
+    ComInfo cif = m_nameAndComInfos[name];
+    ExportToFile etf(this);
+    etf.saveToExcelFromComInfo(cif);
+
 }
 
 void ConverInfo2::on_treeWidget_doubleClicked(const QModelIndex &index)
 {
     QString name = index.model()->data(index).toString();
     qDebug()<<"鍙屽嚮"<<index<<name;
+
+    ComInfo curCominfo; // 涓嶈鐩存帴缁欏�硷紝鍙兘浼氬鑷村娣诲姞鏂扮殑鍚嶅瓧杩涙潵
     if(name.contains("(鏈骇)")){
         QStringList sps = name.split("(鏈骇)");
         name = sps.at(0);
+        curCominfo = m_nameAndComInfos[name];
     }else if(name.contains("(姹囨��)")){
         name = name.split("(姹囨��)").at(0);
+        qDebug()<<"姹囨�诲鐞�:";
+        // 鍋氫竴涓眹鎬荤殑澶勭悊锛屾妸鎵�鏈変笅绾х殑閮界疮鍔犺捣鏉�
+        ComInfo allCominfo = m_nameAndComInfos[name];
+        for(QString cur:m_treeNodes[name]){
+            if(name != cur){
+                ComInfo &tmp = m_nameAndComInfos[cur];
+                allCominfo.organazationNum += tmp.organazationNum;
+                allCominfo.realNum += tmp.realNum;
+                allCominfo.professionalNum += tmp.professionalNum;
+                allCominfo.CIANum += tmp.CIANum;
+                allCominfo.masterNum += tmp.masterNum;
+                allCominfo.undergraduatesNum += tmp.undergraduatesNum;
+                allCominfo.juniorNum += tmp.juniorNum;
+                allCominfo.seniorNum += tmp.seniorNum;
+                allCominfo.intermediateNum += tmp.intermediateNum;
+                allCominfo.primaryNum += tmp.primaryNum;
+                allCominfo.noTitleNum += tmp.noTitleNum;
+                allCominfo.upFiftyOldNum += tmp.upFiftyOldNum;
+                allCominfo.upThirtyOldNum += tmp.upThirtyOldNum;
+                allCominfo.downThirtyOldNum += tmp.downThirtyOldNum;
+                allCominfo.auditNum += tmp.auditNum;
+                allCominfo.accountingNum += tmp.accountingNum;
+                allCominfo.economyNum += tmp.economyNum;
+                allCominfo.lawNum += tmp.lawNum;
+                allCominfo.managerNum += tmp.managerNum;
+                allCominfo.itNum += tmp.itNum;
+                allCominfo.engineeringNum += tmp.engineeringNum;
+                allCominfo.otherNum += tmp.otherNum;
+            }
+
+        }
+        curCominfo = allCominfo;
+        // 澶勭悊瀹屼簡涔嬪悗锛岃繕闇�瑕佸崟鐙捣涓�涓眹鎬荤殑鍚嶅瓧
+        name = name + "(姹囨��)";
+        strcpy(curCominfo.name,name.toLocal8Bit().data());
+        m_nameAndComInfos[name] = curCominfo;
+
+        // 鍒锋柊缁勫悎涓嬫媺妗嗙殑鍒楄〃
+        emit updateComboListSignal(m_nameAndComInfos);
+
+    }else{
+        curCominfo = m_nameAndComInfos[name];
     }
-    ComInfo curCominfo = m_nameAndComInfos[name];
+    //ComInfo curCominfo = m_nameAndComInfos[name];
     // 涓�銆佸崟浣嶅熀鏈儏鍐�
     ui->lineEdit_creditCode->setText(curCominfo.creditCode);
     ui->lineEdit_name->setText(QString::fromLocal8Bit( curCominfo.name));
@@ -530,136 +657,137 @@
 
                 // 鍥涖�佸唴瀹′汉鍛橀厤澶囧熀鏈儏鍐�
                 // 缂栧埗鏁�
-                QVariant organazationNum = valRows[56].toList().at(4);
+                //QVariant organazationNum = valRows[56].toList().at(4);
+                QVariant organazationNum = valRows[60].toList().at(4);
                 if(organazationNum.isValid()){
                     curComInfo.organazationNum = organazationNum.toInt();
                     qDebug()<<"organazationNum"<<organazationNum;
                 }
                 // 瀹炴湁浜哄憳鏁�
-                QVariant realNum = valRows[56].toList().at(4);
+                QVariant realNum = valRows[60].toList().at(6);
                 if(realNum.isValid()){
                     curComInfo.realNum = realNum.toInt();
                     qDebug()<<"realNum"<<realNum;
                 }
                 // 涓撹亴浜哄憳鏁�
-                QVariant professionalNum = valRows[56].toList().at(4);
+                QVariant professionalNum = valRows[60].toList().at(8);
                 if(professionalNum.isValid()){
                     curComInfo.professionalNum = professionalNum.toInt();
                     qDebug()<<"professionalNum"<<professionalNum;
                 }
                 // 鎷ユ湁CIA浜哄憳鏁�
-                QVariant CIANum = valRows[56].toList().at(4);
+                QVariant CIANum = valRows[61].toList().at(6);
                 if(CIANum.isValid()){
                     curComInfo.CIANum = CIANum.toInt();
                     qDebug()<<"CIANum"<<CIANum;
                 }
                 // 瀛﹀巻锛氱澹強浠ヤ笂 浜哄憳鏁�
-                QVariant masterNum = valRows[56].toList().at(4);
+                QVariant masterNum = valRows[62].toList().at(6);
                 if(masterNum.isValid()){
                     curComInfo.masterNum = masterNum.toInt();
                     qDebug()<<"masterNum"<<masterNum;
                 }
                 // 澶у鏈
-                QVariant undergraduatesNum = valRows[56].toList().at(4);
+                QVariant undergraduatesNum = valRows[63].toList().at(6);
                 if(undergraduatesNum.isValid()){
                     curComInfo.undergraduatesNum = undergraduatesNum.toInt();
                     qDebug()<<"undergraduatesNum"<<undergraduatesNum;
                 }
                 // 涓撶鍙婁互涓�
-                QVariant juniorNum = valRows[56].toList().at(4);
+                QVariant juniorNum = valRows[64].toList().at(6);
                 if(juniorNum.isValid()){
                     curComInfo.juniorNum = juniorNum.toInt();
                     qDebug()<<"juniorNum"<<juniorNum;
                 }
 
                 // 鑱岀О 楂樼骇鑱岀О
-                QVariant seniorNum = valRows[56].toList().at(4);
+                QVariant seniorNum = valRows[65].toList().at(6);
                 if(seniorNum.isValid()){
                     curComInfo.seniorNum = seniorNum.toInt();
                     qDebug()<<"seniorNum"<<seniorNum;
                 }
                 // 涓骇鑱岀О
-                QVariant intermediateNum = valRows[56].toList().at(4);
+                QVariant intermediateNum = valRows[66].toList().at(6);
                 if(intermediateNum.isValid()){
                     curComInfo.intermediateNum = intermediateNum.toInt();
                     qDebug()<<"intermediateNum"<<intermediateNum;
                 }
                 // 鍒濈骇鑱岀О
-                QVariant primaryNum = valRows[56].toList().at(4);
+                QVariant primaryNum = valRows[67].toList().at(6);
                 if(primaryNum.isValid()){
                     curComInfo.primaryNum = primaryNum.toInt();
                     qDebug()<<"primaryNum"<<primaryNum;
                 }
                 // 鏃犺亴绉�
-                QVariant noTitleNum = valRows[56].toList().at(4);
+                QVariant noTitleNum = valRows[68].toList().at(6);
                 if(noTitleNum.isValid()){
                     curComInfo.noTitleNum = noTitleNum.toInt();
                     qDebug()<<"noTitleNum"<<noTitleNum;
                 }
 
                 // 骞撮緞缁撴瀯 50宀佷互涓�
-                QVariant upFiftyOldNum = valRows[56].toList().at(4);
+                QVariant upFiftyOldNum = valRows[69].toList().at(6);
                 if(upFiftyOldNum.isValid()){
                     curComInfo.upFiftyOldNum = upFiftyOldNum.toInt();
                     qDebug()<<"upFiftyOldNum"<<upFiftyOldNum;
                 }
                 // 30-50宀�
-                QVariant upThirtyOldNum = valRows[56].toList().at(4);
+                QVariant upThirtyOldNum = valRows[70].toList().at(6);
                 if(upThirtyOldNum.isValid()){
                     curComInfo.upThirtyOldNum = upThirtyOldNum.toInt();
                     qDebug()<<"upThirtyOldNum"<<upThirtyOldNum;
                 }
                 // 30宀佷互涓�
-                QVariant downThirtyOldNum = valRows[56].toList().at(4);
+                QVariant downThirtyOldNum = valRows[71].toList().at(6);
                 if(downThirtyOldNum.isValid()){
                     curComInfo.downThirtyOldNum = downThirtyOldNum.toInt();
                     qDebug()<<"downThirtyOldNum"<<downThirtyOldNum;
                 }
 
                 // 鐭ヨ瘑缁撴瀯 瀹¤
-                QVariant auditNum = valRows[56].toList().at(4);
+                QVariant auditNum = valRows[72].toList().at(6);
                 if(auditNum.isValid()){
                     curComInfo.auditNum = auditNum.toInt();
                     qDebug()<<"auditNum"<<auditNum;
                 }
                 // 浼氳
-                QVariant accountingNum = valRows[56].toList().at(4);
+                QVariant accountingNum = valRows[73].toList().at(6);
                 if(accountingNum.isValid()){
                     curComInfo.accountingNum = accountingNum.toInt();
                     qDebug()<<"accountingNum"<<accountingNum;
                 }
                 // 缁忔祹
-                QVariant economyNum = valRows[56].toList().at(4);
+                QVariant economyNum = valRows[74].toList().at(6);
                 if(economyNum.isValid()){
                     curComInfo.economyNum = economyNum.toInt();
                     qDebug()<<"economyNum"<<economyNum;
                 }
                 // 娉曞緥
-                QVariant lawNum = valRows[56].toList().at(4);
+                QVariant lawNum = valRows[75].toList().at(6);
                 if(lawNum.isValid()){
                     curComInfo.lawNum = lawNum.toInt();
                     qDebug()<<"lawNum"<<lawNum;
                 }
                 // 绠$悊
-                QVariant managerNum = valRows[56].toList().at(4);
+                QVariant managerNum = valRows[76].toList().at(6);
                 if(managerNum.isValid()){
                     curComInfo.managerNum = managerNum.toInt();
                     qDebug()<<"managerNum"<<managerNum;
                 }
                 // 淇℃伅鎶�鏈�
-                QVariant itNum = valRows[56].toList().at(4);
+                QVariant itNum = valRows[77].toList().at(6);
                 if(itNum.isValid()){
                     curComInfo.itNum = itNum.toInt();
                     qDebug()<<"itNum"<<itNum;
                 }
                 // 宸ョ▼
-                QVariant engineeringNum = valRows[56].toList().at(4);
+                QVariant engineeringNum = valRows[78].toList().at(6);
                 if(engineeringNum.isValid()){
                     curComInfo.engineeringNum = engineeringNum.toInt();
                     qDebug()<<"engineeringNum"<<engineeringNum;
                 }
                 // 鍏朵粬
-                QVariant otherNum = valRows[56].toList().at(4);
+                QVariant otherNum = valRows[79].toList().at(6);
                 if(otherNum.isValid()){
                     curComInfo.otherNum = otherNum.toInt();
                     qDebug()<<"otherNum"<<otherNum;
@@ -696,16 +824,23 @@
                 // 鏈�鍚庡瓨鍒癿ap涓�
                 m_nameAndComInfos[name.toString()]=curComInfo;
 
+                // 鏇存柊鍒版暟鎹簱涓�
+                saveToSQL(curComInfo);
+                qDebug()<<"load Excel save to SQL ok:"<<name;
+
+
                 // 娣诲姞鏍戝舰鍒楄〃鑺傜偣
                 //addTreeWidgetNode(upName,name);
 
                 if(upName.isValid()){
                     if(name.isValid()){
-                        m_treeNodes[upName.toString()].push_back(name.toString());
+                        //m_treeNodes[upName.toString()].push_back(name.toString());
+                        m_treeNodes[upName.toString()].insert(name.toString());
                     }
                 }else{
                     if(name.isValid()){
-                        m_treeNodes[name.toString()].push_back(name.toString());
+                        //m_treeNodes[name.toString()].push_back(name.toString());
+                        m_treeNodes[name.toString()].insert(name.toString());
                     }
                 }
 
@@ -723,10 +858,16 @@
         cntIdx++;
     }
 
+    // 鍐嶆鏌ヨ鏁版嵁搴撲腑鎵�鏈夌殑淇℃伅
+    readAllSQLData();
+
     createTreeNode(); // 鏋勫缓鏍戝舰鑺傜偣
 
     // 鍙戝皠 鍔犺浇瀹屾垚鐨勪俊鍙�
     emit loadFinished();
+
+    // 鏇存柊鍏朵粬鐣岄潰鐨勫叕鍙镐俊鎭笅鎷夋
+    emit updateComboListSignal(m_nameAndComInfos);
 
 //    QAxObject excel("./debug/Data/闄勪欢2_鍐呭缁�01琛╛鍗曚綅鍙婂唴閮ㄥ璁℃満鏋勫熀鏈儏鍐佃〃-1.301鐗�(1).xls");
 //    excel.setProperty("Visible",true);
@@ -744,12 +885,14 @@
 
     m_menu->addAction("鍒犻櫎");
     m_menu->addAction("澧炲姞");
+    m_menu->addAction("淇濆瓨瀵煎嚭");
 
     ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
     connect(ui->treeWidget,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(showMenu(QPoint)));
 
     connect(m_menu->actions().at(0),SIGNAL(triggered(bool)),this,SLOT(deleteInfo()));
     connect(m_menu->actions().at(1),SIGNAL(triggered(bool)),this,SLOT(addInfo()));
+    connect(m_menu->actions().at(2),SIGNAL(triggered(bool)),this,SLOT(saveInfo()));
 }
 
 void ConverInfo2::on_pushButton_commit_clicked()
@@ -910,125 +1053,128 @@
 
 
     // 鏇存柊鍒版暟鎹簱
+    saveToSQL(curComInfo);
 
-    // 鍏堝垽鏂槸涓嶆槸宸茬粡瀛樺湪鍏徃鍚嶄簡锛岃嫢宸插瓨鍦紝鍒欐洿鏂帮紝涓嶅瓨鍦ㄥ垯鎻掑叆
-    QString sql = QString("select id,name from all_company_info where name='%1'").arg(name);
-    qDebug()<<"sql:"<<sql;
-    QSqlQuery query;
-    int rowCnt = 0;
-    if(query.exec(sql)){
-        qDebug()<<"size:"<<query.size();
+//    // 鍏堝垽鏂槸涓嶆槸宸茬粡瀛樺湪鍏徃鍚嶄簡锛岃嫢宸插瓨鍦紝鍒欐洿鏂帮紝涓嶅瓨鍦ㄥ垯鎻掑叆
+//    QString sql = QString("select id,name from all_company_info where name='%1'").arg(name);
+//    qDebug()<<"sql:"<<sql;
+//    QSqlQuery query;
+//    int rowCnt = 0;
+//    if(query.exec(sql)){
+//        qDebug()<<"size:"<<query.size();
 
-        while (query.next()) {
-            rowCnt++;
-        }
-    }
-    if(rowCnt == 0){
-        // 涓嶅瓨鍦紝鍒欐彃鍏ヤ竴鏉℃柊鏁版嵁
-        qDebug()<<"涓嶅瓨鍦�:"<<name;
-        sql = QString("insert into all_company_info (name,\
-code,\
-鏈烘瀯绫诲瀷,\
-涓昏涓氬姟娲诲姩,\
-琛屼笟浠g爜,\
-鍗曚綅娉ㄥ唽鍦板強鍖哄煙,\
-鍖哄煙浠g爜,\
-鍩庝埂浠g爜,\
-鍗曚綅瑙勬ā,\
-浠庝笟鏈熸湯浜烘暟,\
-娉曞畾浠h〃浜�,\
-鎵ц浼氳鏍囧噯绫诲埆,\
-闀块�斿尯鍙�,\
-鍥哄畾鐢佃瘽,\
-閭斂缂栫爜,\
-鐢靛瓙閭,\
-缃戝潃,\
-鏄惁鏈変笂涓�绾ф硶浜�,\
-涓婁竴绾х粺淇′唬鐮�,\
-鍘熺粍缁囦唬鐮�,\
-涓婄骇鍗曚綅鍚嶇О,\
-鏄惁璁剧疆鎬诲璁″笀,\
-鎬诲璁″笀鑱屼綅灞傜骇,\
-鎬诲浠昏亴鏂瑰紡,\
-鏄惁璁剧疆鍐呭鏈烘瀯,\
-鍐呭鏈烘瀯鍚嶇О,\
-棰嗗鏈烘瀯,\
-鏄惁鐙珛璁剧疆鍐呭鏈烘瀯,\
-璐㈠姟閮ㄩ棬,\
-娉曞姟閮ㄩ棬,\
-鍐呴儴鎺у埗閮ㄩ棬,\
-绾閮ㄩ棬,\
-鍏朵粬閮ㄩ棬,\
-鍐呭灞傜骇,\
-缂栧埗鏁伴噺,\
-瀹炴湁浜烘暟閲�,\
-涓撹亴浜哄憳鏁伴噺,\
-鎷ユ湁CIA浜烘暟,\
-纭曞+瀛﹀巻浠ヤ笂浜烘暟,\
-鏈浜烘暟,\
-涓撶鍙婁互涓嬩汉鏁�,\
-楂樼骇鑱岀О浜烘暟,\
-涓骇鑱岀О浜烘暟,\
-鍒濈骇鑱岀О浜烘暟,\
-鏃犺亴绉颁汉鏁�,\
-浜斿崄宀佷互涓婁汉鏁�,\
-涓夊崄鑷充簲鍗佸瞾宀佷汉鏁�,\
-涓夊崄宀佷互涓嬩汉鏁�,\
-瀹¤鏁伴噺,\
-浼氳鏁伴噺,\
-缁忔祹鏁伴噺,\
-娉曞緥鏁伴噺,\
-绠$悊鏁伴噺,\
-淇℃伅鎶�鏈暟閲�,\
-宸ョ▼鏁伴噺,\
-鍏朵粬鏁伴噺,\
-缁熻璐熻矗浜�,\
-濉〃浜�,\
-鑱旂郴鐢佃瘽,\
-濉姤鏃ユ湡) values ('%1','%2','%3','%4','%5','%6','%7','%8','%9',%10,\
-'%11','%12','%13','%14','%15','%16','%17','%18','%19','%20',\
-'%21','%22','%23','%24','%25','%26','%27','%28',%29,%30,\
-%31,%32,%33,'%34',%35,%36,%37,%38,%39,%40,\
-%41,%42,%43,%44,%45,%46,%47,%48,%49,%50,\
-%51,%52,%53,%54,%55,%56,'%57','%58','%59','%60'\
-)").arg(name).arg(creditCode).arg(comType).arg(business).arg(businessCode).arg(addr).arg(areaCode).arg(townCode).arg(scale).arg(people).
-                arg(representative).arg(standardType).arg(trunkCode).arg(fixedTel).arg(postCode).arg(email).arg(webSite).arg(hasUpLegal).arg(upCreditCode).arg(oldCreditCode).
-                arg(upName).arg(hasChiefDesigner).arg(ChiefDesignerLevel).arg(employmentMode).arg(hasSetIntervalAudit).arg(internalName).arg(leadingOrganization).arg(hasSetSeparateIA).arg(financeDepartment).arg(legalDepartment).
-                arg(internalConDepart).arg(disceplineInDepart).arg(otherDepart).arg(intavalAuditLeval).arg(organazationNum).arg(realNum).arg(professionalNum).arg(CIANum).arg(masterNum).arg(undergraduatesNum).
-                arg(juniorNum).arg(seniorNum).arg(intermediateNum).arg(primaryNum).arg(noTitleNum).arg(upFiftyOldNum).arg(upThirtyOldNum).arg(downThirtyOldNum).arg(auditNum).arg(accountingNum).
-                arg(economyNum).arg(lawNum).arg(managerNum).arg(itNum).arg(engineeringNum).arg(otherNum).arg(statisticalConOfficer).arg(personFilling).arg(officerTel).arg(fillingDateTime);
+//        while (query.next()) {
+//            rowCnt++;
+//        }
+//    }
+//    if(rowCnt == 0){
+//        // 涓嶅瓨鍦紝鍒欐彃鍏ヤ竴鏉℃柊鏁版嵁
+//        qDebug()<<"涓嶅瓨鍦�:"<<name;
+//        sql = QString("insert into all_company_info (name,\
+//code,\
+//鏈烘瀯绫诲瀷,\
+//涓昏涓氬姟娲诲姩,\
+//琛屼笟浠g爜,\
+//鍗曚綅娉ㄥ唽鍦板強鍖哄煙,\
+//鍖哄煙浠g爜,\
+//鍩庝埂浠g爜,\
+//鍗曚綅瑙勬ā,\
+//浠庝笟鏈熸湯浜烘暟,\
+//娉曞畾浠h〃浜�,\
+//鎵ц浼氳鏍囧噯绫诲埆,\
+//闀块�斿尯鍙�,\
+//鍥哄畾鐢佃瘽,\
+//閭斂缂栫爜,\
+//鐢靛瓙閭,\
+//缃戝潃,\
+//鏄惁鏈変笂涓�绾ф硶浜�,\
+//涓婁竴绾х粺淇′唬鐮�,\
+//鍘熺粍缁囦唬鐮�,\
+//涓婄骇鍗曚綅鍚嶇О,\
+//鏄惁璁剧疆鎬诲璁″笀,\
+//鎬诲璁″笀鑱屼綅灞傜骇,\
+//鎬诲浠昏亴鏂瑰紡,\
+//鏄惁璁剧疆鍐呭鏈烘瀯,\
+//鍐呭鏈烘瀯鍚嶇О,\
+//棰嗗鏈烘瀯,\
+//鏄惁鐙珛璁剧疆鍐呭鏈烘瀯,\
+//璐㈠姟閮ㄩ棬,\
+//娉曞姟閮ㄩ棬,\
+//鍐呴儴鎺у埗閮ㄩ棬,\
+//绾閮ㄩ棬,\
+//鍏朵粬閮ㄩ棬,\
+//鍐呭灞傜骇,\
+//缂栧埗鏁伴噺,\
+//瀹炴湁浜烘暟閲�,\
+//涓撹亴浜哄憳鏁伴噺,\
+//鎷ユ湁CIA浜烘暟,\
+//纭曞+瀛﹀巻浠ヤ笂浜烘暟,\
+//鏈浜烘暟,\
+//涓撶鍙婁互涓嬩汉鏁�,\
+//楂樼骇鑱岀О浜烘暟,\
+//涓骇鑱岀О浜烘暟,\
+//鍒濈骇鑱岀О浜烘暟,\
+//鏃犺亴绉颁汉鏁�,\
+//浜斿崄宀佷互涓婁汉鏁�,\
+//涓夊崄鑷充簲鍗佸瞾宀佷汉鏁�,\
+//涓夊崄宀佷互涓嬩汉鏁�,\
+//瀹¤鏁伴噺,\
+//浼氳鏁伴噺,\
+//缁忔祹鏁伴噺,\
+//娉曞緥鏁伴噺,\
+//绠$悊鏁伴噺,\
+//淇℃伅鎶�鏈暟閲�,\
+//宸ョ▼鏁伴噺,\
+//鍏朵粬鏁伴噺,\
+//缁熻璐熻矗浜�,\
+//濉〃浜�,\
+//鑱旂郴鐢佃瘽,\
+//濉姤鏃ユ湡) values ('%1','%2','%3','%4','%5','%6','%7','%8','%9',%10,\
+//'%11','%12','%13','%14','%15','%16','%17','%18','%19','%20',\
+//'%21','%22','%23','%24','%25','%26','%27','%28',%29,%30,\
+//%31,%32,%33,'%34',%35,%36,%37,%38,%39,%40,\
+//%41,%42,%43,%44,%45,%46,%47,%48,%49,%50,\
+//%51,%52,%53,%54,%55,%56,'%57','%58','%59','%60'\
+//)").arg(name).arg(creditCode).arg(comType).arg(business).arg(businessCode).arg(addr).arg(areaCode).arg(townCode).arg(scale).arg(people).
+//                arg(representative).arg(standardType).arg(trunkCode).arg(fixedTel).arg(postCode).arg(email).arg(webSite).arg(hasUpLegal).arg(upCreditCode).arg(oldCreditCode).
+//                arg(upName).arg(hasChiefDesigner).arg(ChiefDesignerLevel).arg(employmentMode).arg(hasSetIntervalAudit).arg(internalName).arg(leadingOrganization).arg(hasSetSeparateIA).arg(financeDepartment).arg(legalDepartment).
+//                arg(internalConDepart).arg(disceplineInDepart).arg(otherDepart).arg(intavalAuditLeval).arg(organazationNum).arg(realNum).arg(professionalNum).arg(CIANum).arg(masterNum).arg(undergraduatesNum).
+//                arg(juniorNum).arg(seniorNum).arg(intermediateNum).arg(primaryNum).arg(noTitleNum).arg(upFiftyOldNum).arg(upThirtyOldNum).arg(downThirtyOldNum).arg(auditNum).arg(accountingNum).
+//                arg(economyNum).arg(lawNum).arg(managerNum).arg(itNum).arg(engineeringNum).arg(otherNum).arg(statisticalConOfficer).arg(personFilling).arg(officerTel).arg(fillingDateTime);
 
 
-        qDebug()<<"sql insert:"<<sql;
-        if(query.exec(sql)){
-            qDebug()<<"insert ok";
-        }else{
-            qDebug()<<"insert fail:"<<query.lastError().text();
-        }
+//        qDebug()<<"sql insert:"<<sql;
+//        if(query.exec(sql)){
+//            qDebug()<<"insert ok";
+//        }else{
+//            qDebug()<<"insert fail:"<<query.lastError().text();
+//        }
 
-    }else{
-        // 鏇存柊
-        qDebug()<<"瀛樺湪:"<<name;
-        sql = QString("update all_company_info set name='%1',code='%2',鏈烘瀯绫诲瀷='%3',涓昏涓氬姟娲诲姩='%4',琛屼笟浠g爜='%5',鍗曚綅娉ㄥ唽鍦板強鍖哄煙='%6',鍖哄煙浠g爜='%7',鍩庝埂浠g爜='%8',鍗曚綅瑙勬ā='%9',浠庝笟鏈熸湯浜烘暟=%10\
-,娉曞畾浠h〃浜�='%11',鎵ц浼氳鏍囧噯绫诲埆='%12',闀块�斿尯鍙�='%13',鍥哄畾鐢佃瘽='%14',閭斂缂栫爜='%15',鐢靛瓙閭='%16',缃戝潃='%17',鏄惁鏈変笂涓�绾ф硶浜�='%18',涓婁竴绾х粺淇′唬鐮�='%19',鍘熺粍缁囦唬鐮�='%20'\
-,涓婄骇鍗曚綅鍚嶇О='%21',鏄惁璁剧疆鎬诲璁″笀='%22',鎬诲璁″笀鑱屼綅灞傜骇='%23',鎬诲浠昏亴鏂瑰紡='%24',鏄惁璁剧疆鍐呭鏈烘瀯='%25',鍐呭鏈烘瀯鍚嶇О='%26',棰嗗鏈烘瀯='%27',鏄惁鐙珛璁剧疆鍐呭鏈烘瀯='%28',璐㈠姟閮ㄩ棬=%29,娉曞姟閮ㄩ棬=%30\
-,鍐呴儴鎺у埗閮ㄩ棬=%31,绾閮ㄩ棬=%32,鍏朵粬閮ㄩ棬=%33,鍐呭灞傜骇='%34',缂栧埗鏁伴噺=%35,瀹炴湁浜烘暟閲�=%36,涓撹亴浜哄憳鏁伴噺=%37,鎷ユ湁CIA浜烘暟=%38,纭曞+瀛﹀巻浠ヤ笂浜烘暟=%39,鏈浜烘暟=%40\
-,涓撶鍙婁互涓嬩汉鏁�=%41,楂樼骇鑱岀О浜烘暟=%42,涓骇鑱岀О浜烘暟=%43,鍒濈骇鑱岀О浜烘暟=%44,鏃犺亴绉颁汉鏁�=%45,浜斿崄宀佷互涓婁汉鏁�=%46,涓夊崄鑷充簲鍗佸瞾宀佷汉鏁�=%47,涓夊崄宀佷互涓嬩汉鏁�=%48,瀹¤鏁伴噺=%49,浼氳鏁伴噺=%50\
-,缁忔祹鏁伴噺=%51,娉曞緥鏁伴噺=%52,绠$悊鏁伴噺=%53,淇℃伅鎶�鏈暟閲�=%54,宸ョ▼鏁伴噺=%55,鍏朵粬鏁伴噺=%56,缁熻璐熻矗浜�='%57',濉〃浜�='%58',鑱旂郴鐢佃瘽='%59',濉姤鏃ユ湡='%60'").
-                arg(name).arg(creditCode).arg(comType).arg(business).arg(businessCode).arg(addr).arg(areaCode).arg(townCode).arg(scale).arg(people).
-                arg(representative).arg(standardType).arg(trunkCode).arg(fixedTel).arg(postCode).arg(email).arg(webSite).arg(hasUpLegal).arg(upCreditCode).arg(oldCreditCode).
-                arg(upName).arg(hasChiefDesigner).arg(ChiefDesignerLevel).arg(employmentMode).arg(hasSetIntervalAudit).arg(internalName).arg(leadingOrganization).arg(hasSetSeparateIA).arg(financeDepartment).arg(legalDepartment).
-                arg(internalConDepart).arg(disceplineInDepart).arg(otherDepart).arg(intavalAuditLeval).arg(organazationNum).arg(realNum).arg(professionalNum).arg(CIANum).arg(masterNum).arg(undergraduatesNum).
-                arg(juniorNum).arg(seniorNum).arg(intermediateNum).arg(primaryNum).arg(noTitleNum).arg(upFiftyOldNum).arg(upThirtyOldNum).arg(downThirtyOldNum).arg(auditNum).arg(accountingNum).
-                arg(economyNum).arg(lawNum).arg(managerNum).arg(itNum).arg(engineeringNum).arg(otherNum).arg(statisticalConOfficer).arg(personFilling).arg(officerTel).arg(fillingDateTime);
+//    }else{
+//        // 鏇存柊
+//        qDebug()<<"瀛樺湪:"<<name;
+//        sql = QString("update all_company_info set name='%1',code='%2',鏈烘瀯绫诲瀷='%3',涓昏涓氬姟娲诲姩='%4',琛屼笟浠g爜='%5',鍗曚綅娉ㄥ唽鍦板強鍖哄煙='%6',鍖哄煙浠g爜='%7',鍩庝埂浠g爜='%8',鍗曚綅瑙勬ā='%9',浠庝笟鏈熸湯浜烘暟=%10\
+//,娉曞畾浠h〃浜�='%11',鎵ц浼氳鏍囧噯绫诲埆='%12',闀块�斿尯鍙�='%13',鍥哄畾鐢佃瘽='%14',閭斂缂栫爜='%15',鐢靛瓙閭='%16',缃戝潃='%17',鏄惁鏈変笂涓�绾ф硶浜�='%18',涓婁竴绾х粺淇′唬鐮�='%19',鍘熺粍缁囦唬鐮�='%20'\
+//,涓婄骇鍗曚綅鍚嶇О='%21',鏄惁璁剧疆鎬诲璁″笀='%22',鎬诲璁″笀鑱屼綅灞傜骇='%23',鎬诲浠昏亴鏂瑰紡='%24',鏄惁璁剧疆鍐呭鏈烘瀯='%25',鍐呭鏈烘瀯鍚嶇О='%26',棰嗗鏈烘瀯='%27',鏄惁鐙珛璁剧疆鍐呭鏈烘瀯='%28',璐㈠姟閮ㄩ棬=%29,娉曞姟閮ㄩ棬=%30\
+//,鍐呴儴鎺у埗閮ㄩ棬=%31,绾閮ㄩ棬=%32,鍏朵粬閮ㄩ棬=%33,鍐呭灞傜骇='%34',缂栧埗鏁伴噺=%35,瀹炴湁浜烘暟閲�=%36,涓撹亴浜哄憳鏁伴噺=%37,鎷ユ湁CIA浜烘暟=%38,纭曞+瀛﹀巻浠ヤ笂浜烘暟=%39,鏈浜烘暟=%40\
+//,涓撶鍙婁互涓嬩汉鏁�=%41,楂樼骇鑱岀О浜烘暟=%42,涓骇鑱岀О浜烘暟=%43,鍒濈骇鑱岀О浜烘暟=%44,鏃犺亴绉颁汉鏁�=%45,浜斿崄宀佷互涓婁汉鏁�=%46,涓夊崄鑷充簲鍗佸瞾宀佷汉鏁�=%47,涓夊崄宀佷互涓嬩汉鏁�=%48,瀹¤鏁伴噺=%49,浼氳鏁伴噺=%50\
+//,缁忔祹鏁伴噺=%51,娉曞緥鏁伴噺=%52,绠$悊鏁伴噺=%53,淇℃伅鎶�鏈暟閲�=%54,宸ョ▼鏁伴噺=%55,鍏朵粬鏁伴噺=%56,缁熻璐熻矗浜�='%57',濉〃浜�='%58',鑱旂郴鐢佃瘽='%59',濉姤鏃ユ湡='%60'").
+//                arg(name).arg(creditCode).arg(comType).arg(business).arg(businessCode).arg(addr).arg(areaCode).arg(townCode).arg(scale).arg(people).
+//                arg(representative).arg(standardType).arg(trunkCode).arg(fixedTel).arg(postCode).arg(email).arg(webSite).arg(hasUpLegal).arg(upCreditCode).arg(oldCreditCode).
+//                arg(upName).arg(hasChiefDesigner).arg(ChiefDesignerLevel).arg(employmentMode).arg(hasSetIntervalAudit).arg(internalName).arg(leadingOrganization).arg(hasSetSeparateIA).arg(financeDepartment).arg(legalDepartment).
+//                arg(internalConDepart).arg(disceplineInDepart).arg(otherDepart).arg(intavalAuditLeval).arg(organazationNum).arg(realNum).arg(professionalNum).arg(CIANum).arg(masterNum).arg(undergraduatesNum).
+//                arg(juniorNum).arg(seniorNum).arg(intermediateNum).arg(primaryNum).arg(noTitleNum).arg(upFiftyOldNum).arg(upThirtyOldNum).arg(downThirtyOldNum).arg(auditNum).arg(accountingNum).
+//                arg(economyNum).arg(lawNum).arg(managerNum).arg(itNum).arg(engineeringNum).arg(otherNum).arg(statisticalConOfficer).arg(personFilling).arg(officerTel).arg(fillingDateTime);
 
-        qDebug()<<"update sql:"<<sql;
-        if(query.exec(sql)){
-            qDebug()<<"update ok";
-        }else{
-            qDebug()<<"update fail:"<<query.lastError().text();
-        }
-    }
+//        qDebug()<<"update sql:"<<sql;
+//        if(query.exec(sql)){
+//            qDebug()<<"update ok";
+//        }else{
+//            qDebug()<<"update fail:"<<query.lastError().text();
+//        }
+//    }
+
+    // 鐙珛鍑烘潵涓�涓嚱鏁帮紝浼犱竴涓粨鏋勪綋灏眔k
 }
 
 void ConverInfo2::readExcelFromPath(QString path)
@@ -1046,7 +1192,7 @@
     qDebug()<<"excel:"<<excel.className();
     QAxObject * wbs = excel.querySubObject("WorkBooks");
     qDebug()<<"wbs:"<<wbs->className();
-    QAxObject * wb = wbs->querySubObject("Open(QString&)",path);
+    QAxObject * wb = wbs->querySubObject("Open(QString&)",path); // 鍝釜瀵硅薄鏄疧pen鐨勮繑鍥炲�硷紝鍝釜灏卞彲浠ヤ繚瀛�
     //QAxObject* pWorkBook = excel.querySubObject("ActiveWorkBook");
     //QAxObject* pWorkSheets = pWorkBook->querySubObject("Sheets");//鑾峰彇宸ヤ綔琛�
     //QAxObject * shs = wb->querySubObject("Sheets"); // WorkSheets 涔熷彲浠�
@@ -1338,6 +1484,30 @@
             qDebug()<<"financeDepartment"<<financeDepartment;
         }
         // 娉曞姟閮ㄩ棬銆佸唴閮ㄦ帶鍒堕儴闂ㄣ�佺邯妫�閮ㄩ棬銆佸叾浠栭儴闂�
+        // 闇�瑕佺壒娈婅幏鍙�
+        QAxObject *checkBox = sheet->querySubObject("CheckBoxes(const QString&)", QString::fromLocal8Bit("璐㈠姟閮ㄩ棬"));
+        if(checkBox){
+            qDebug()<<"鍙栧埌璐㈠姟閮ㄩ棬"<<checkBox->property("Value2").toInt()<<checkBox->property("Value").toInt()<<checkBox->property("Value2").toBool();
+            if(checkBox->property("Value").toBool()){
+                qDebug()<<"璐㈠姟閮ㄩ棬鍕鹃��";
+            }else{
+                qDebug()<<"璐㈠姟閮ㄩ棬鏈嬀閫�";
+            }
+        }else{
+            qDebug()<<"鏈彇鍒拌储鍔¢儴闂�";
+        }
+
+        QAxObject *checkBox1 = sheet->querySubObject("CheckBoxes(const QString&)", QString::fromLocal8Bit("娉曞姟閮ㄩ棬"));
+        if(checkBox1){
+            qDebug()<<"鍙栧埌娉曞姟閮ㄩ棬"<<checkBox1->property("Value").toInt();
+            if(checkBox1->property("Value").toBool()){
+                qDebug()<<"娉曞姟閮ㄩ棬鍕鹃��";
+            }else{
+                qDebug()<<"娉曞姟閮ㄩ棬鏈嬀閫�";
+            }
+        }else{
+            qDebug()<<"鏈彇鍒版硶鍔¢儴闂�";
+        }
 
         // 鍐呭鏈烘瀯灞傜骇
         QVariant intavalAuditLeval = valRows[56].toList().at(4);
@@ -1535,9 +1705,13 @@
     excel.dynamicCall("Quit(void)");
 
     qDebug()<<"鍗曚綅淇℃伅鏁伴噺锛�"<<m_nameAndComInfos.size();
+    emit updateComboListSignal(m_nameAndComInfos); // 鏇存柊缁勫悎涓嬫媺妗嗙殑鍗曚綅淇℃伅
 }
 
 void ConverInfo2::createTreeNode(){
+    // 鍏堟竻闄ゅ綋鍓嶆爲涓婄殑鎵�鏈夎妭鐐�
+    ui->treeWidget->clear();
+
     qDebug()<<"鏋勫缓鏍戝舰鍒楄〃"<<m_treeNodes.size();
     for(auto iter=m_treeNodes.begin();iter != m_treeNodes.end();iter++)
     {
@@ -1552,6 +1726,308 @@
         }
     }
 }
+
+void ConverInfo2::disableWheelEvent()
+{
+    ui->comboBox_ChiefDesignerLevel->installEventFilter(this);
+    ui->comboBox_comType->installEventFilter(this);
+    ui->comboBox_employmentMode->installEventFilter(this);
+    ui->comboBox_hasChiefDesigner->installEventFilter(this);
+    ui->comboBox_hasSetIntervalAudit->installEventFilter(this);
+    ui->comboBox_hasSetSeparateIA->installEventFilter(this);
+    ui->comboBox_hasUpLegal->installEventFilter(this);
+    ui->comboBox_intavalAuditLeval->installEventFilter(this);
+    ui->comboBox_leadingOrganization->installEventFilter(this);
+    ui->comboBox_scale->installEventFilter(this);
+    ui->comboBox_standardType->installEventFilter(this);
+}
+
+bool ConverInfo2::eventFilter(QObject *watched, QEvent *event)
+{
+    QString cls = watched->metaObject()->className();
+    if(cls == "QComboBox"){
+        //qDebug()<<"鍙戠幇涓嬫媺妗�";
+        if(event->type() == QEvent::Wheel){
+            //qDebug()<<"浣跨敤浜嗘粴杞�";
+            return true;  // 杩斿洖鐪熻〃绀虹鐢紝杩斿洖鍋囧垯鑳界敤
+        }
+    }else{
+        qDebug()<<"鍏朵粬绫诲瀷:"<<cls;
+    }
+
+    return QMainWindow::eventFilter(watched,event);
+
+}
+
+void ConverInfo2::saveToSQL(ComInfo &info)
+{
+    // 鏇存柊鍒版暟鎹簱
+
+    // 鍏堝垽鏂槸涓嶆槸宸茬粡瀛樺湪鍏徃鍚嶄簡锛岃嫢宸插瓨鍦紝鍒欐洿鏂帮紝涓嶅瓨鍦ㄥ垯鎻掑叆
+    QString sql = QString("select id,name from all_company_info where name='%1'").arg(QString::fromLocal8Bit(info.name));
+    qDebug()<<"sql:"<<sql;
+    QSqlQuery query;
+    int rowCnt = 0;
+    if(query.exec(sql)){
+        qDebug()<<"size:"<<query.size();
+
+        while (query.next()) {
+            rowCnt++;
+        }
+        qDebug()<<"rowCnt:"<<rowCnt;
+    }
+    if(rowCnt == 0){
+        // 涓嶅瓨鍦紝鍒欐彃鍏ヤ竴鏉℃柊鏁版嵁
+        qDebug()<<"涓嶅瓨鍦�:"<<QString::fromLocal8Bit(info.name);
+        sql = QString("insert into all_company_info (name,\
+code,\
+鏈烘瀯绫诲瀷,\
+涓昏涓氬姟娲诲姩,\
+琛屼笟浠g爜,\
+鍗曚綅娉ㄥ唽鍦板強鍖哄煙,\
+鍖哄煙浠g爜,\
+鍩庝埂浠g爜,\
+鍗曚綅瑙勬ā,\
+浠庝笟鏈熸湯浜烘暟,\
+娉曞畾浠h〃浜�,\
+鎵ц浼氳鏍囧噯绫诲埆,\
+闀块�斿尯鍙�,\
+鍥哄畾鐢佃瘽,\
+閭斂缂栫爜,\
+鐢靛瓙閭,\
+缃戝潃,\
+鏄惁鏈変笂涓�绾ф硶浜�,\
+涓婁竴绾х粺淇′唬鐮�,\
+鍘熺粍缁囦唬鐮�,\
+涓婄骇鍗曚綅鍚嶇О,\
+鏄惁璁剧疆鎬诲璁″笀,\
+鎬诲璁″笀鑱屼綅灞傜骇,\
+鎬诲浠昏亴鏂瑰紡,\
+鏄惁璁剧疆鍐呭鏈烘瀯,\
+鍐呭鏈烘瀯鍚嶇О,\
+棰嗗鏈烘瀯,\
+鏄惁鐙珛璁剧疆鍐呭鏈烘瀯,\
+璐㈠姟閮ㄩ棬,\
+娉曞姟閮ㄩ棬,\
+鍐呴儴鎺у埗閮ㄩ棬,\
+绾閮ㄩ棬,\
+鍏朵粬閮ㄩ棬,\
+鍐呭灞傜骇,\
+缂栧埗鏁伴噺,\
+瀹炴湁浜烘暟閲�,\
+涓撹亴浜哄憳鏁伴噺,\
+鎷ユ湁CIA浜烘暟,\
+纭曞+瀛﹀巻浠ヤ笂浜烘暟,\
+鏈浜烘暟,\
+涓撶鍙婁互涓嬩汉鏁�,\
+楂樼骇鑱岀О浜烘暟,\
+涓骇鑱岀О浜烘暟,\
+鍒濈骇鑱岀О浜烘暟,\
+鏃犺亴绉颁汉鏁�,\
+浜斿崄宀佷互涓婁汉鏁�,\
+涓夊崄鑷充簲鍗佸瞾宀佷汉鏁�,\
+涓夊崄宀佷互涓嬩汉鏁�,\
+瀹¤鏁伴噺,\
+浼氳鏁伴噺,\
+缁忔祹鏁伴噺,\
+娉曞緥鏁伴噺,\
+绠$悊鏁伴噺,\
+淇℃伅鎶�鏈暟閲�,\
+宸ョ▼鏁伴噺,\
+鍏朵粬鏁伴噺,\
+缁熻璐熻矗浜�,\
+濉〃浜�,\
+鑱旂郴鐢佃瘽,\
+濉姤鏃ユ湡) values ('%1','%2','%3','%4','%5','%6','%7','%8','%9',%10,\
+'%11','%12','%13','%14','%15','%16','%17','%18','%19','%20',\
+'%21','%22','%23','%24','%25','%26','%27','%28',%29,%30,\
+%31,%32,%33,'%34',%35,%36,%37,%38,%39,%40,\
+%41,%42,%43,%44,%45,%46,%47,%48,%49,%50,\
+%51,%52,%53,%54,%55,%56,'%57','%58','%59','%60'\
+)").arg(QString::fromLocal8Bit(info.name)).arg(QString::fromLocal8Bit(info.creditCode)).arg(QString::fromLocal8Bit(info.comType)).arg(QString::fromLocal8Bit(info.business)).arg(QString::fromLocal8Bit(info.businessCode)).arg(QString::fromLocal8Bit(info.addr)).arg(QString::fromLocal8Bit(info.areaCode)).arg(QString::fromLocal8Bit(info.townCode)).arg(QString::fromLocal8Bit(info.scale)).arg(info.people).
+                arg(QString::fromLocal8Bit(info.representative)).arg(QString::fromLocal8Bit(info.standardType)).arg(QString::fromLocal8Bit(info.trunkCode)).arg(QString::fromLocal8Bit(info.fixedTel)).arg(info.postCode).arg(QString::fromLocal8Bit(info.email)).arg(QString::fromLocal8Bit(info.webSite)).arg(QString::fromLocal8Bit(info.hasUpLegal)).arg(QString::fromLocal8Bit(info.upCreditCode)).arg(QString::fromLocal8Bit(info.oldCreditCode)).
+                arg(QString::fromLocal8Bit(info.upName)).arg(QString::fromLocal8Bit(info.hasChiefDesigner)).arg(QString::fromLocal8Bit(info.ChiefDesignerLevel)).arg(QString::fromLocal8Bit(info.employmentMode)).arg(QString::fromLocal8Bit(info.hasSetIntervalAudit)).arg(QString::fromLocal8Bit(info.internalName)).arg(QString::fromLocal8Bit(info.leadingOrganization)).arg(QString::fromLocal8Bit(info.hasSetSeparateIA)).arg(info.financeDepartment).arg(info.legalDepartment).
+                arg(info.internalConDepart).arg(info.disceplineInDepart).arg(info.otherDepart).arg(QString::fromLocal8Bit(info.intavalAuditLeval)).arg(info.organazationNum).arg(info.realNum).arg(info.professionalNum).arg(info.CIANum).arg(info.masterNum).arg(info.undergraduatesNum).
+                arg(info.juniorNum).arg(info.seniorNum).arg(info.intermediateNum).arg(info.primaryNum).arg(info.noTitleNum).arg(info.upFiftyOldNum).arg(info.upThirtyOldNum).arg(info.downThirtyOldNum).arg(info.auditNum).arg(info.accountingNum).
+                arg(info.economyNum).arg(info.lawNum).arg(info.managerNum).arg(info.itNum).arg(info.engineeringNum).arg(info.otherNum).arg(QString::fromLocal8Bit(info.statisticalConOfficer)).arg(QString::fromLocal8Bit(info.personFilling)).arg(QString::fromLocal8Bit(info.officerTel)).arg(QString::fromLocal8Bit(info.fillingDateTime));
+
+
+        qDebug()<<"sql insert:"<<sql;
+        if(query.exec(sql)){
+            qDebug()<<"insert ok";
+        }else{
+            qDebug()<<"insert fail:"<<query.lastError().text();
+        }
+
+    }else{
+        // 鏇存柊
+        qDebug()<<"瀛樺湪:"<<QString::fromLocal8Bit(info.name);
+        sql = QString("update all_company_info set name='%1',code='%2',鏈烘瀯绫诲瀷='%3',涓昏涓氬姟娲诲姩='%4',琛屼笟浠g爜='%5',鍗曚綅娉ㄥ唽鍦板強鍖哄煙='%6',鍖哄煙浠g爜='%7',鍩庝埂浠g爜='%8',鍗曚綅瑙勬ā='%9',浠庝笟鏈熸湯浜烘暟=%10\
+,娉曞畾浠h〃浜�='%11',鎵ц浼氳鏍囧噯绫诲埆='%12',闀块�斿尯鍙�='%13',鍥哄畾鐢佃瘽='%14',閭斂缂栫爜='%15',鐢靛瓙閭='%16',缃戝潃='%17',鏄惁鏈変笂涓�绾ф硶浜�='%18',涓婁竴绾х粺淇′唬鐮�='%19',鍘熺粍缁囦唬鐮�='%20'\
+,涓婄骇鍗曚綅鍚嶇О='%21',鏄惁璁剧疆鎬诲璁″笀='%22',鎬诲璁″笀鑱屼綅灞傜骇='%23',鎬诲浠昏亴鏂瑰紡='%24',鏄惁璁剧疆鍐呭鏈烘瀯='%25',鍐呭鏈烘瀯鍚嶇О='%26',棰嗗鏈烘瀯='%27',鏄惁鐙珛璁剧疆鍐呭鏈烘瀯='%28',璐㈠姟閮ㄩ棬=%29,娉曞姟閮ㄩ棬=%30\
+,鍐呴儴鎺у埗閮ㄩ棬=%31,绾閮ㄩ棬=%32,鍏朵粬閮ㄩ棬=%33,鍐呭灞傜骇='%34',缂栧埗鏁伴噺=%35,瀹炴湁浜烘暟閲�=%36,涓撹亴浜哄憳鏁伴噺=%37,鎷ユ湁CIA浜烘暟=%38,纭曞+瀛﹀巻浠ヤ笂浜烘暟=%39,鏈浜烘暟=%40\
+,涓撶鍙婁互涓嬩汉鏁�=%41,楂樼骇鑱岀О浜烘暟=%42,涓骇鑱岀О浜烘暟=%43,鍒濈骇鑱岀О浜烘暟=%44,鏃犺亴绉颁汉鏁�=%45,浜斿崄宀佷互涓婁汉鏁�=%46,涓夊崄鑷充簲鍗佸瞾宀佷汉鏁�=%47,涓夊崄宀佷互涓嬩汉鏁�=%48,瀹¤鏁伴噺=%49,浼氳鏁伴噺=%50\
+,缁忔祹鏁伴噺=%51,娉曞緥鏁伴噺=%52,绠$悊鏁伴噺=%53,淇℃伅鎶�鏈暟閲�=%54,宸ョ▼鏁伴噺=%55,鍏朵粬鏁伴噺=%56,缁熻璐熻矗浜�='%57',濉〃浜�='%58',鑱旂郴鐢佃瘽='%59',濉姤鏃ユ湡='%60' where name='%1'").arg(QString::fromLocal8Bit(info.name)).arg(QString::fromLocal8Bit(info.creditCode)).arg(QString::fromLocal8Bit(info.comType)).arg(QString::fromLocal8Bit(info.business)).arg(QString::fromLocal8Bit(info.businessCode)).arg(QString::fromLocal8Bit(info.addr)).arg(QString::fromLocal8Bit(info.areaCode)).arg(QString::fromLocal8Bit(info.townCode)).arg(QString::fromLocal8Bit(info.scale)).arg(info.people).
+                arg(QString::fromLocal8Bit(info.representative)).arg(QString::fromLocal8Bit(info.standardType)).arg(QString::fromLocal8Bit(info.trunkCode)).arg(QString::fromLocal8Bit(info.fixedTel)).arg(info.postCode).arg(QString::fromLocal8Bit(info.email)).arg(QString::fromLocal8Bit(info.webSite)).arg(QString::fromLocal8Bit(info.hasUpLegal)).arg(QString::fromLocal8Bit(info.upCreditCode)).arg(QString::fromLocal8Bit(info.oldCreditCode)).
+                arg(QString::fromLocal8Bit(info.upName)).arg(QString::fromLocal8Bit(info.hasChiefDesigner)).arg(QString::fromLocal8Bit(info.ChiefDesignerLevel)).arg(QString::fromLocal8Bit(info.employmentMode)).arg(QString::fromLocal8Bit(info.hasSetIntervalAudit)).arg(QString::fromLocal8Bit(info.internalName)).arg(QString::fromLocal8Bit(info.leadingOrganization)).arg(QString::fromLocal8Bit(info.hasSetSeparateIA)).arg(info.financeDepartment).arg(info.legalDepartment).
+                arg(info.internalConDepart).arg(info.disceplineInDepart).arg(info.otherDepart).arg(QString::fromLocal8Bit(info.intavalAuditLeval)).arg(info.organazationNum).arg(info.realNum).arg(info.professionalNum).arg(info.CIANum).arg(info.masterNum).arg(info.undergraduatesNum).
+                arg(info.juniorNum).arg(info.seniorNum).arg(info.intermediateNum).arg(info.primaryNum).arg(info.noTitleNum).arg(info.upFiftyOldNum).arg(info.upThirtyOldNum).arg(info.downThirtyOldNum).arg(info.auditNum).arg(info.accountingNum).
+                arg(info.economyNum).arg(info.lawNum).arg(info.managerNum).arg(info.itNum).arg(info.engineeringNum).arg(info.otherNum).arg(QString::fromLocal8Bit(info.statisticalConOfficer)).arg(QString::fromLocal8Bit(info.personFilling)).arg(QString::fromLocal8Bit(info.officerTel)).arg(QString::fromLocal8Bit(info.fillingDateTime));
+                /*.
+                arg(QString::fromLocal8Bit(info.name)).arg(QString::fromLocal8Bit(info.creditCode)).arg(info.comType).arg(info.business).arg(info.businessCode).arg(info.addr).arg(info.areaCode).arg(info.townCode).arg(info.scale).arg(info.people).
+                arg(info.representative).arg(info.standardType).arg(info.trunkCode).arg(info.fixedTel).arg(info.postCode).arg(info.email).arg(info.webSite).arg(info.hasUpLegal).arg(info.upCreditCode).arg(info.oldCreditCode).
+                arg(info.upName).arg(info.hasChiefDesigner).arg(info.ChiefDesignerLevel).arg(info.employmentMode).arg(info.hasSetIntervalAudit).arg(info.internalName).arg(info.leadingOrganization).arg(info.hasSetSeparateIA).arg(info.financeDepartment).arg(info.legalDepartment).
+                arg(info.internalConDepart).arg(info.disceplineInDepart).arg(info.otherDepart).arg(info.intavalAuditLeval).arg(info.organazationNum).arg(info.realNum).arg(info.professionalNum).arg(info.CIANum).arg(info.masterNum).arg(info.undergraduatesNum).
+                arg(info.juniorNum).arg(info.seniorNum).arg(info.intermediateNum).arg(info.primaryNum).arg(info.noTitleNum).arg(info.upFiftyOldNum).arg(info.upThirtyOldNum).arg(info.downThirtyOldNum).arg(info.auditNum).arg(info.accountingNum).
+                arg(info.economyNum).arg(info.lawNum).arg(info.managerNum).arg(info.itNum).arg(info.engineeringNum).arg(info.otherNum).arg(info.statisticalConOfficer).arg(info.personFilling).arg(info.officerTel).arg(info.fillingDateTime);*/
+
+        qDebug()<<"update sql:"<<sql;
+        if(query.exec(sql)){
+            qDebug()<<"update ok";
+        }else{
+            qDebug()<<"update fail:"<<query.lastError().text();
+        }
+    }
+}
+
+void ConverInfo2::readAllSQLData()
+{
+    QString sql = QString("select * from all_company_info");
+    qDebug()<<"sql:"<<sql;
+    QSqlQuery query;
+    int rowCnt = 0;
+    if(query.exec(sql)){
+        qDebug()<<"size:"<<query.size();
+
+
+        while (query.next()) {
+            rowCnt++;
+            ComInfo info; // 鍗曚綅淇℃伅缁撴瀯浣�
+            // 鍩烘湰鎯呭喌
+            strcpy(info.name,query.value(1).toString().toLocal8Bit().data());
+            strcpy(info.creditCode,query.value(2).toString().toLocal8Bit().data());
+            strcpy(info.comType,query.value(3).toString().toLocal8Bit().data());
+            strcpy(info.business,query.value(4).toString().toLocal8Bit().data());
+            strcpy(info.businessCode,query.value(5).toString().toLocal8Bit().data());
+            strcpy(info.addr,query.value(6).toString().toLocal8Bit().data());
+            strcpy(info.areaCode,query.value(7).toString().toLocal8Bit().data());
+            strcpy(info.townCode,query.value(8).toString().toLocal8Bit().data());
+            strcpy(info.scale,query.value(9).toString().toLocal8Bit().data());
+            info.people = query.value(10).toInt();
+            strcpy(info.representative,query.value(11).toString().toLocal8Bit().data());
+            strcpy(info.standardType,query.value(12).toString().toLocal8Bit().data());
+            strcpy(info.trunkCode,query.value(13).toString().toLocal8Bit().data());
+            strcpy(info.fixedTel,query.value(14).toString().toLocal8Bit().data());
+            strcpy(info.postCode,query.value(15).toString().toLocal8Bit().data());
+            strcpy(info.email,query.value(16).toString().toLocal8Bit().data());
+            strcpy(info.webSite,query.value(17).toString().toLocal8Bit().data());
+            // 鍗曚綅缁勭粐缁撴瀯鎯呭喌
+            strcpy(info.hasUpLegal,query.value(18).toString().toLocal8Bit().data());
+            strcpy(info.upCreditCode,query.value(19).toString().toLocal8Bit().data());
+            strcpy(info.oldCreditCode,query.value(20).toString().toLocal8Bit().data());
+            strcpy(info.upName,query.value(21).toString().toLocal8Bit().data());
+
+            // 鎬诲璁″笀涓庡唴閮ㄥ璁℃満鏋勫熀鏈儏鍐�
+            strcpy(info.hasChiefDesigner,query.value(22).toString().toLocal8Bit().data());
+            strcpy(info.ChiefDesignerLevel,query.value(23).toString().toLocal8Bit().data());
+            strcpy(info.employmentMode,query.value(24).toString().toLocal8Bit().data());
+            strcpy(info.hasSetIntervalAudit,query.value(25).toString().toLocal8Bit().data());
+            strcpy(info.internalName,query.value(26).toString().toLocal8Bit().data());
+            strcpy(info.leadingOrganization,query.value(27).toString().toLocal8Bit().data());
+            strcpy(info.hasSetSeparateIA,query.value(28).toString().toLocal8Bit().data());
+            info.financeDepartment = query.value(29).toBool();
+            info.legalDepartment = query.value(30).toBool();
+            info.internalConDepart = query.value(31).toBool();
+            info.disceplineInDepart = query.value(32).toBool();
+            info.otherDepart = query.value(33).toBool();
+            strcpy(info.intavalAuditLeval,query.value(34).toString().toLocal8Bit().data());
+
+            // 鍐呴儴瀹¤浜哄憳閰嶅鍩烘湰鎯呭喌
+            info.organazationNum = query.value(35).toInt();
+            info.realNum = query.value(36).toInt();
+            info.professionalNum = query.value(37).toInt();
+            info.CIANum = query.value(38).toInt();
+            info.masterNum = query.value(39).toInt();
+            info.undergraduatesNum = query.value(40).toInt();
+            info.juniorNum = query.value(41).toInt();
+            info.seniorNum = query.value(42).toInt();
+            info.intermediateNum = query.value(43).toInt();
+            info.primaryNum = query.value(44).toInt();
+            info.noTitleNum = query.value(45).toInt();
+            info.upFiftyOldNum = query.value(46).toInt();
+            info.upThirtyOldNum = query.value(47).toInt();
+            info.downThirtyOldNum = query.value(48).toInt();
+            info.auditNum = query.value(49).toInt();
+            info.accountingNum = query.value(50).toInt();
+            info.economyNum = query.value(51).toInt();
+            info.lawNum = query.value(52).toInt();
+            info.managerNum = query.value(53).toInt();
+            info.itNum = query.value(54).toInt();
+            info.engineeringNum = query.value(55).toInt();
+            info.otherNum = query.value(56).toInt();
+
+            // 鍚庨潰鐨�4涓俊鎭�
+            strcpy(info.statisticalConOfficer,query.value(57).toString().toLocal8Bit().data());
+            strcpy(info.personFilling,query.value(58).toString().toLocal8Bit().data());
+            strcpy(info.officerTel,query.value(59).toString().toLocal8Bit().data());
+            strcpy(info.fillingDateTime,query.value(60).toString().toLocal8Bit().data());
+
+            // 瀛樹俊鎭埌map
+            QString name = query.value(1).toString();
+            m_nameAndComInfos[query.value(1).toString()] = info;
+            // 瀛樺悕瀛楀埌鍗曚綅鏍憁ap
+            QString upName = query.value(21).toString();
+            if(!upName.isEmpty()){
+                //m_treeNodes[upName].push_back(name);
+                m_treeNodes[upName].insert(name);
+            }else{
+                //m_treeNodes[name].push_back(name);
+                //m_treeNodes[upName].insert(name);
+                if(!name.isEmpty()){
+                    //m_treeNodes[name.toString()].push_back(name.toString());
+                    m_treeNodes[name].insert(name);
+                }
+            }
+            qDebug()<<"name"<<name<<"upName"<<upName;
+
+        }
+        qDebug()<<"rowCnt:"<<rowCnt;
+    }
+}
+
+void ConverInfo2::deleteAllByName(QString name)
+{
+    // 鏁版嵁搴撹〃鏈夛細灏侀潰淇℃伅琛� all_company_info
+    // 缁煎悎淇℃伅琛� comprehensive_entry_info
+    // 涓夊悎涓�鐨勮〃 standing_book_info
+
+    QString first_sql = QString("delete from all_company_info where name='%1'").arg(name);
+    qDebug()<<"first_sql:"<<first_sql;
+
+    QString second_sql = QString("delete from comprehensive_entry_info where name='%1'").arg(name);
+    qDebug()<<"second_sql:"<<second_sql;
+
+    QString three_sql = QString("delete from standing_book_info where 璐d换涓讳綋鍚嶇О='%1'").arg(name);
+    qDebug()<<"three_sql:"<<three_sql;
+
+
+    QSqlQuery query;
+    if(query.exec(first_sql))
+    {
+        qDebug()<<"first_sql run ok";
+    }
+    if(query.exec(second_sql))
+    {
+        qDebug()<<"second_sql run ok";
+    }
+    if(query.exec(three_sql))
+    {
+        qDebug()<<"three_sql run ok";
+    }
+
+
+
+}
 void ConverInfo2::addTreeWidgetNode(QVariant upName,QVariant name){
     // 娣诲姞宸﹁竟鏍戝舰鍥剧浉鍏�
     // 鑿滃崟鐩稿叧  褰撲笂绾у叕鍙镐负绌轰笂绾ф椂锛岃嚜宸卞綋鑷繁鐨勪笂绾э紝骞朵笖缃楀垪杩涘幓褰� 鏈骇
@@ -1563,7 +2039,8 @@
         for(int k=0;k<ui->treeWidget->topLevelItemCount();++k){
             QTreeWidgetItem *tmp = ui->treeWidget->topLevelItem(k);
             qDebug()<<k<<tmp->text(0)<<upName.toString();
-            if(upName.toString()+"(姹囨��)" == tmp->text(0)){
+            int pos = tmp->text(0).indexOf(upName.toString()+"(姹囨��)");
+            if(upName.toString()+"(姹囨��)" == tmp->text(0) || pos != -1){
                 top = tmp;
                 break;
             }
@@ -1572,11 +2049,13 @@
             if(top){ // 瀛樺湪锛屽垯娣诲姞鍒板瀛愬垪琛ㄤ腑
                 QTreeWidgetItem *top1 = new QTreeWidgetItem(top);
                 top1->setText(0,name.toString());
+                top->setText(0,upName.toString()+"(姹囨��)涓嬬骇鏁�:"+QString::number(top->childCount()-1));
             }else{ // 涓嶅瓨鍦紝鍒欐柊寤轰竴涓垪琛�
                 QTreeWidgetItem *top1 = new QTreeWidgetItem(ui->treeWidget);
                 top1->setText(0,name.toString()+"(姹囨��)");
                 QTreeWidgetItem *top2 = new QTreeWidgetItem(top1);
                 top2->setText(0,name.toString()+"(鏈骇)");
+                top1->setText(0,name.toString()+"(姹囨��)涓嬬骇鏁�:"+QString::number(top1->childCount()-1));
             }
         }
 
@@ -1588,6 +2067,7 @@
             top1->setText(0,name.toString()+"(姹囨��)");
             QTreeWidgetItem *top2 = new QTreeWidgetItem(top1);
             top2->setText(0,name.toString()+"(鏈骇)");
+            top1->setText(0,name.toString()+"(姹囨��)涓嬬骇鏁�:"+QString::number(top1->childCount()-1));
         }
 
     }
@@ -1605,3 +2085,15 @@
 {
     readInfo(); // 鍔犺浇琛ㄦ牸
 }
+
+void ConverInfo2::on_pushButton_save_to_file_clicked()
+{
+    QString name = ui->lineEdit_name->text();
+    if(name.size()== 0){
+        QMessageBox::information(this,"鍗曚綅鍚嶇О涓虹┖,璇峰厛閫変腑涓�瀹跺崟浣�","璇峰厛閫変腑涓�瀹跺崟浣�");
+        return;
+    }
+    ExportToFile etf(this);
+    ComInfo cif = m_nameAndComInfos[name];
+    etf.saveToExcelFromComInfo(cif);
+}

--
Gitblit v1.8.0