| | |
| | | int index = str.indexOf("内审统01表"); |
| | | qDebug()<<"index:"<<index; |
| | | if(index > 0){ |
| | | QAxObject excel("Excel.Application"); |
| | | QAxObject excel("ket.Application"); |
| | | if(!excel.setControl("ket" |
| | | ".Application")){ // windows内核 |
| | | excel.setControl("Excel.Application"); // wps内核 |
| | | } |
| | | excel.setProperty("Visible",false); |
| | | excel.setProperty("DisplayAlerts",false); |
| | | |
| | | qDebug()<<"open:"<<str; |
| | | qDebug()<<"excel:"<<excel.className(); |
| | | QAxObject * wbs = excel.querySubObject("WorkBooks"); |
| | | qDebug()<<"wbs:"<<wbs->className(); |
| | | QAxObject * wb = wbs->querySubObject("Open(QString&)",str); |
| | | //QAxObject* pWorkBook = excel.querySubObject("ActiveWorkBook"); |
| | | //QAxObject* pWorkSheets = pWorkBook->querySubObject("Sheets");//获取工作表 |
| | |
| | | QVariant val = usedRange->dynamicCall("Value"); // 拿到二维表格 |
| | | QVariantList valRows = val.toList(); |
| | | // 遍历每一项 |
| | | for(int i=0;i<rows;++i){ |
| | | QVariantList valrow = valRows[i].toList(); |
| | | for(int j=0;j<columns;++j){ |
| | | QVariant valData = valrow[j]; |
| | | if(valData.isValid()){ |
| | | qDebug()<<"val:"<< i<< j << valData; |
| | | } |
| | | // for(int i=0;i<rows;++i){ |
| | | // QVariantList valrow = valRows[i].toList(); |
| | | // for(int j=0;j<columns;++j){ |
| | | // QVariant valData = valrow[j]; |
| | | // if(valData.isValid()){ |
| | | // qDebug()<<"val:"<< i<< j << valData; |
| | | // } |
| | | |
| | | } |
| | | } |
| | | // } |
| | | // } |
| | | |
| | | // 实例化结构体,然后挨个赋值 |
| | | ComInfo curComInfo; |
| | |
| | | qDebug()<<"统计负责人"<<statisticalConOfficer; |
| | | |
| | | // 更新到map中 |
| | | if(m_nameAndComInfos.count(name)==0){ |
| | | // 添加到map中 |
| | | m_nameAndComInfos[name]=ComInfo(); |
| | | // 添加到右边树部件中 |
| | | QTreeWidgetItem *top1 = new QTreeWidgetItem(ui->treeWidget); |
| | | top1->setText(0,name); |
| | | } |
| | | auto &curComInfo = m_nameAndComInfos[name]; |
| | | |
| | | |
| | | |
| | | strcpy(curComInfo.creditCode,creditCode.toLocal8Bit().data()); |
| | | strcpy(curComInfo.name,name.toLocal8Bit().data()); |
| | | strcpy(curComInfo.comType,comType.toLocal8Bit().data()); |
| | |
| | | strcpy(curComInfo.areaCode,areaCode.toLocal8Bit().data()); |
| | | strcpy(curComInfo.townCode,townCode.toLocal8Bit().data()); |
| | | strcpy(curComInfo.scale,scale.toLocal8Bit().data()); |
| | | curComInfo.people = people.toInt(); |
| | | curComInfo.people = people.toInt(); // index 10 |
| | | strcpy(curComInfo.representative,representative.toLocal8Bit().data()); |
| | | strcpy(curComInfo.standardType,standardType.toLocal8Bit().data()); |
| | | strcpy(curComInfo.trunkCode,trunkCode.toLocal8Bit().data()); |
| | | strcpy(curComInfo.fixedTel,fixedTel.toLocal8Bit().data()); |
| | | strcpy(curComInfo.postCode,postCode.toLocal8Bit().data()); |
| | | strcpy(curComInfo.email,email.toLocal8Bit().data()); |
| | | strcpy(curComInfo.webSite,webSite.toLocal8Bit().data()); |
| | | strcpy(curComInfo.webSite,webSite.toLocal8Bit().data()); // index 17 |
| | | |
| | | // 二 |
| | | strcpy(curComInfo.hasUpLegal,hasUpLegal.toLocal8Bit().data()); |
| | | strcpy(curComInfo.upCreditCode,upCreditCode.toLocal8Bit().data()); |
| | | strcpy(curComInfo.oldCreditCode,oldCreditCode.toLocal8Bit().data()); |
| | | strcpy(curComInfo.upName,upName.toLocal8Bit().data()); |
| | | strcpy(curComInfo.upName,upName.toLocal8Bit().data()); // index 21 |
| | | |
| | | // 三 |
| | | strcpy(curComInfo.hasChiefDesigner,hasChiefDesigner.toLocal8Bit().data()); |
| | |
| | | strcpy(curComInfo.internalName,internalName.toLocal8Bit().data()); |
| | | strcpy(curComInfo.leadingOrganization,leadingOrganization.toLocal8Bit().data()); |
| | | strcpy(curComInfo.hasSetSeparateIA,hasSetSeparateIA.toLocal8Bit().data()); |
| | | curComInfo.financeDepartment = financeDepartment; |
| | | curComInfo.financeDepartment = financeDepartment; // index 29 |
| | | curComInfo.legalDepartment = legalDepartment; |
| | | curComInfo.internalConDepart = internalConDepart; |
| | | curComInfo.disceplineInDepart = disceplineInDepart; |
| | | curComInfo.otherDepart = otherDepart; |
| | | strcpy(curComInfo.intavalAuditLeval,intavalAuditLeval.toLocal8Bit().data()); |
| | | strcpy(curComInfo.intavalAuditLeval,intavalAuditLeval.toLocal8Bit().data()); // index 34 |
| | | |
| | | // 四 |
| | | curComInfo.organazationNum = organazationNum; |
| | | curComInfo.organazationNum = organazationNum; // index 35 |
| | | curComInfo.realNum = realNum; |
| | | curComInfo.professionalNum = professionalNum; |
| | | curComInfo.CIANum = CIANum; |
| | |
| | | curComInfo.managerNum = managerNum; |
| | | curComInfo.itNum = itNum; |
| | | curComInfo.engineeringNum = engineeringNum; |
| | | curComInfo.otherNum = otherNum; |
| | | curComInfo.otherNum = otherNum; // index 56 |
| | | |
| | | // 后4个信息 |
| | | strcpy(curComInfo.statisticalConOfficer,statisticalConOfficer.toLocal8Bit().data()); |
| | | strcpy(curComInfo.personFilling,personFilling.toLocal8Bit().data()); |
| | | strcpy(curComInfo.officerTel,officerTel.toLocal8Bit().data()); |
| | | strcpy(curComInfo.fillingDateTime,fillingDateTime.toLocal8Bit().data()); |
| | | strcpy(curComInfo.fillingDateTime,fillingDateTime.toLocal8Bit().data()); // index 60 |
| | | |
| | | |
| | | // 更新到数据库 |
| | | |
| | | // 先判断是不是已经存在公司名了,若已存在,则更新,不存在则插入 |
| | | 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)){ |
| | |
| | | } |
| | | if(rowCnt == 0){ |
| | | // 不存在,则插入一条新数据 |
| | | qDebug()<<"不存在:"<<name; |
| | | sql = QString("insert into all_company_info (name,\ |
| | | code,\ |
| | | 机构类型,\ |
| | | 主要业务活动,\ |
| | | 行业代码,\ |
| | | 单位注册地及区域,\ |
| | | 区域代码,\ |
| | | 城乡代码,\ |
| | | 单位规模,\ |
| | | 从业期末人数,\ |
| | | 法定代表人,\ |
| | | 执行会记标准类别,\ |
| | | 长途区号,\ |
| | | 固定电话,\ |
| | | 邮政编码,\ |
| | | 电子邮箱,\ |
| | | 网址,\ |
| | | 是否有上一级法人,\ |
| | | 上一级统信代码,\ |
| | | 原组织代码,\ |
| | | 上级单位名称,\ |
| | | 是否设置总审计师,\ |
| | | 总审计师职位层级,\ |
| | | 总审任职方式,\ |
| | | 是否设置内审机构,\ |
| | | 内审机构名称,\ |
| | | 领导机构,\ |
| | | 是否独立设置内审机构,\ |
| | | 财务部门,\ |
| | | 法务部门,\ |
| | | 内部控制部门,\ |
| | | 纪检部门,\ |
| | | 其他部门,\ |
| | | 内审层级,\ |
| | | 编制数量,\ |
| | | 实有人数量,\ |
| | | 专职人员数量,\ |
| | | 拥有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(); |
| | | } |
| | | |
| | | }else{ |
| | | // 更新 |
| | | qDebug()<<"存在:"<<name; |
| | | sql = QString("update all_company_info set name='%1',code='%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,拥有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(); |
| | | } |
| | | } |
| | | } |