From 20a43d0e0ff9e9f6ee5349373fd810c6597abf00 Mon Sep 17 00:00:00 2001
From: wumu <mayi@mayi.com>
Date: 星期一, 29 四月 2024 22:33:13 +0800
Subject: [PATCH] 0429
---
internal_system_v1/threemergeproblemlist.cpp | 188 +++++++++++++++++++++++++++++++++++++
internal_system_v1/threemergeproblemlist.ui | 6
internal_system_v1/problemrectstandingbook.h.autosave | 30 ++++++
internal_system_v1/problemrectstandingbook.cpp | 12 ++
internal_system_v1/problemlist.cpp | 4
internal_system_v1/problemrectificationresult.cpp | 4
internal_system_v1/threemergeproblemlist.h | 20 +++
7 files changed, 254 insertions(+), 10 deletions(-)
diff --git a/internal_system_v1/problemlist.cpp b/internal_system_v1/problemlist.cpp
index d51cbe9..ae8eec1 100644
--- a/internal_system_v1/problemlist.cpp
+++ b/internal_system_v1/problemlist.cpp
@@ -157,9 +157,9 @@
for(int k=0;k<labels.size()-1;++k){
sql += QString("'%1',").arg(labels[k]);
}
- sql += QString("'%1')").arg(labels.back());
+ sql += QString("'%1'),").arg(labels.back());
}
-
+ sql = sql.left(sql.size()-1); // 鍘绘帀鏈�鍚庝竴涓�楀彿
qDebug()<<"sql="<<sql;
QSqlQuery query;
if(query.exec(sql))
diff --git a/internal_system_v1/problemrectificationresult.cpp b/internal_system_v1/problemrectificationresult.cpp
index 2bc7c9f..104dc93 100644
--- a/internal_system_v1/problemrectificationresult.cpp
+++ b/internal_system_v1/problemrectificationresult.cpp
@@ -133,9 +133,9 @@
for(int k=0;k<labels.size()-1;++k){
sql += QString("'%1',").arg(labels[k]);
}
- sql += QString("'%1')").arg(labels.back());
+ sql += QString("'%1'),").arg(labels.back());
}
-
+ sql = sql.left(sql.size()-1); // 鍘绘帀鏈�鍚庝竴涓�楀彿
qDebug()<<"sql="<<sql;
QSqlQuery query;
if(query.exec(sql))
diff --git a/internal_system_v1/problemrectstandingbook.cpp b/internal_system_v1/problemrectstandingbook.cpp
index 8e20e2b..b235efe 100644
--- a/internal_system_v1/problemrectstandingbook.cpp
+++ b/internal_system_v1/problemrectstandingbook.cpp
@@ -34,3 +34,15 @@
}
}
}
+
+void ProblemRectStandingBook::on_pushButton_4_clicked()
+{
+ // 娣诲姞鍒拌〃鏍间腑
+ qDebug()<<"娣诲姞鏁版嵁";
+}
+
+void ProblemRectStandingBook::on_pushButton_5_clicked()
+{
+ // 鍐欏埌鏁版嵁搴�
+ qDebug()<<"淇濆瓨鏁版嵁";
+}
diff --git a/internal_system_v1/problemrectstandingbook.h.autosave b/internal_system_v1/problemrectstandingbook.h.autosave
new file mode 100644
index 0000000..6eaf8f4
--- /dev/null
+++ b/internal_system_v1/problemrectstandingbook.h.autosave
@@ -0,0 +1,30 @@
+锘�#ifndef PROBLEMRECTSTANDINGBOOK_H
+#define PROBLEMRECTSTANDINGBOOK_H
+
+#include <QMainWindow>
+#include <QMap>
+
+namespace Ui {
+class ProblemRectStandingBook;
+}
+
+class ProblemRectStandingBook : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ explicit ProblemRectStandingBook(QWidget *parent = 0);
+ ~ProblemRectStandingBook();
+
+ void searchComName();
+private slots:
+ void on_pushButton_4_clicked();
+
+ void on_pushButton_5_clicked();
+
+private:
+ Ui::ProblemRectStandingBook *ui;
+ QMap<QString,int> m_comInfo;
+};
+
+#endif // PROBLEMRECTSTANDINGBOOK_H
diff --git a/internal_system_v1/threemergeproblemlist.cpp b/internal_system_v1/threemergeproblemlist.cpp
index 8cc2e65..1fbe13f 100644
--- a/internal_system_v1/threemergeproblemlist.cpp
+++ b/internal_system_v1/threemergeproblemlist.cpp
@@ -23,9 +23,13 @@
void ThreeMergeProblemList::initUi()
{
+ initProblemRectBookUi(); // 鍒濆鍖栨暣鏀瑰彴璐�
initProblemListUi(); // 鍒濆鍖栭棶棰樻竻鍗曠晫闈�
initProblemResultUi(); // 鍒濆鍖栭棶棰樺鐞嗙粨鏋滅晫闈�
+ ui->tableWidget->setMinimumHeight(500); // 鏁存敼鍙拌处
+ ui->tableWidget_2->setMinimumHeight(500); // 鏁存敼缁撴灉
+ ui->tableWidget_3->setMinimumHeight(500); // 闂娓呭崟
// 鍔犺浇鍏徃鍚�
readCompanyFromSQL();
}
@@ -135,6 +139,7 @@
ui->tableWidget_2->setItemDelegateForRow(i,new TableItemDelegate());
}
+
// 鍙抽敭鑿滃崟
m_menuResult = new QMenu(this);
m_menuResult->addAction("鍒犻櫎褰撳墠琛�");
@@ -144,6 +149,17 @@
// 鍔犺浇涓嬫媺妗嗙殑鍏徃鍚�
//readCompanyFromSQL();
+}
+
+void ThreeMergeProblemList::initProblemRectBookUi()
+{
+ // 鍙抽敭鑿滃崟
+ m_menuRectBook = new QMenu(this);
+ m_menuRectBook->addAction("鍒犻櫎褰撳墠琛�");
+ ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
+ connect(ui->tableWidget,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(showMenuSlotRectBook(QPoint)));
+ connect(m_menuRectBook->actions().at(0),SIGNAL(triggered(bool)),this,SLOT(deleteActionRectBook()));
+
}
void ThreeMergeProblemList::readCompanyFromSQL()
@@ -164,6 +180,66 @@
qDebug()<<QString("select all_company_info fail...")<<query.lastError().text();
}
+}
+
+void ThreeMergeProblemList::loadDataFromSQL(const QString &arg1)
+{
+ // 闂鍙拌处
+
+
+ // 闂娓呭崟
+ // 瑕佹竻闄や笂涓�瀹跺叕鍙哥殑鏁版嵁
+ ui->tableWidget_3->setRowCount(4);
+ ui->tableWidget_3->setRowCount(7);
+ // 鍔犺浇琛ㄦ牸淇℃伅
+ qDebug()<<"current :"<<arg1;
+
+ QString sql = QString("select * from problem_list_info where name='%1'").arg(arg1);
+ QSqlQuery query;
+ if(query.exec(sql)){
+ qDebug()<<QString("select problem_list_info ok");
+ int row=0;
+ while(query.next()){ // 娣诲姞琛屾暟鎹�
+ for(int i=0;i<14;++i){
+ ui->tableWidget_3->setItem(row+4,i,new QTableWidgetItem(query.value(2+i).toString()));
+ }
+ row++;
+ ui->tableWidget_3->setRowCount(ui->tableWidget_3->rowCount()+1); // 澧炲姞涓�涓柊鐨勮
+ }
+ qDebug()<<"row:"<<row;
+
+ }else{
+ qDebug()<<QString("select problem_list_info fail...")<<query.lastError().text();
+
+ }
+
+ // 闂鏁存敼缁撴灉
+ // 瑕佹竻闄や笂涓�瀹跺叕鍙哥殑鏁版嵁
+ ui->tableWidget_2->setRowCount(3);
+ ui->tableWidget_2->setRowCount(6);
+ // 鍔犺浇琛ㄦ牸淇℃伅
+ //qDebug()<<"current :"<<arg1;
+
+ sql = QString("select * from rectify_result_info where name='%1'").arg(arg1);
+ //QString sql = QString("select * from rectify_result_info where name='%1'").arg(arg1);
+ //QSqlQuery query;
+ if(query.exec(sql)){
+ qDebug()<<QString("select rectify_result_info ok");
+ int row=0;
+ while(query.next()){ // 娣诲姞琛屾暟鎹�
+ for(int i=0;i<10;++i){
+ ui->tableWidget_2->setItem(row+3,i,new QTableWidgetItem(query.value(2+i).toString()));
+ }
+ row++;
+ ui->tableWidget_2->setRowCount(ui->tableWidget_2->rowCount()+1); // 澧炲姞涓�涓柊鐨勮
+ }
+ qDebug()<<"row:"<<row;
+
+ }else{
+ qDebug()<<QString("select rectify_result_info fail...")<<query.lastError().text();
+
+ }
+
}
void ThreeMergeProblemList::showMenuSlot(QPoint)
@@ -198,6 +274,22 @@
}
}
+void ThreeMergeProblemList::showMenuSlotRectBook(QPoint)
+{
+ m_menuRectBook->exec(QCursor::pos());
+}
+
+void ThreeMergeProblemList::deleteActionRectBook()
+{
+ int row = ui->tableWidget->currentRow();
+ if(row>=0){
+ qDebug()<<"ok";
+ ui->tableWidget->removeRow(row);
+ }else{
+ qDebug()<<"fail";
+ }
+}
+
// 澧炲姞鍒扮涓�涓〃鏍肩殑琛�
void ThreeMergeProblemList::on_pushButton_addRow_3_clicked()
{
@@ -213,3 +305,99 @@
{
ui->tableWidget_2->insertRow(ui->tableWidget_2->rowCount());
}
+
+void ThreeMergeProblemList::on_comboBox_company_currentIndexChanged(const QString &arg1)
+{
+ loadDataFromSQL(arg1);
+}
+
+void ThreeMergeProblemList::on_pushButton_save_2_clicked()
+{
+ // 闂娓呭崟淇濆瓨
+
+ QString sql = QString("insert into problem_list_info (name,搴忓彿,鎽樿,妫�鏌ユ椂闂�,妫�鏌ユ柟寮�,绾犳闂,瀹屽杽鍒跺害\
+,瀹屾垚鏃堕棿,涓昏鍘熷洜,瀹屾垚鏃堕檺,涓昏鍘熷洜1,璐d换閮ㄩ棬鎴栬矗浠讳汉,瀹屾垚鏃堕檺1,鏄惁閿�鍙�,閿�鍙锋椂闂�) values ");
+ QString name = ui->comboBox_company->currentText();
+
+ for(int i=4;i<ui->tableWidget_3->rowCount();++i){
+ QStringList labels;
+
+ for(int j=0;j<ui->tableWidget_3->columnCount();++j){
+ QTableWidgetItem *item = ui->tableWidget_3->item(i,j);;
+ qDebug() <<i<<j <<item;
+ if(item){
+ qDebug()<<"OK";
+ labels<<item->data(Qt::EditRole).toString();
+ }else{
+ labels<<" ";
+ }
+ }
+ qDebug()<<labels;
+ if(labels.at(0)==" ")continue;
+ if(name.size()==0){
+ QMessageBox::information(this,"鍗曚綅淇℃伅涓虹┖ ","璇疯緭鍏ュ崟浣嶅悕绉�");
+ continue;
+ }
+ sql += QString("('%1',").arg(name);
+ for(int k=0;k<labels.size()-1;++k){
+ sql += QString("'%1',").arg(labels[k]);
+ }
+ sql += QString("'%1'),").arg(labels.back());
+ }
+ sql = sql.left(sql.size()-1); // 鍘绘帀鏈�鍚庝竴涓�楀彿
+ qDebug()<<"sql="<<sql;
+ QSqlQuery query;
+ if(query.exec(sql))
+ {
+ qDebug()<<QString("insert problem_list_info ok...");
+ QMessageBox::information(this,"OK","娣诲姞鎴愬姛");
+ }else{
+ qDebug()<<QString("insert problem_list_info fail...")<<query.lastError().text();
+ QMessageBox::information(this,"娣诲姞澶辫触","鍙兘娣诲姞鐨勬暟鎹笉鍏ㄥ鑷寸殑锛屽緱纭姣忚鐨勯椤规湁鏁版嵁");
+ }
+}
+
+void ThreeMergeProblemList::on_pushButton_save_clicked()
+{
+ // 闂鏁存敼淇濆瓨
+
+ QString sql = QString("insert into rectify_result_info (name,淇鍒跺害,鏂板鍒跺害,鎸藉洖鎹熷け,鍓旈櫎,瀹″噺,澶勭悊浜�,瀹h疮鍩硅,鍏朵粬,瀹℃牳缁撴灉,娉ㄩ攢) values ");
+ QString name = ui->comboBox_company->currentText();
+
+ for(int i=3;i<ui->tableWidget_2->rowCount();++i){
+ QStringList labels;
+
+ for(int j=0;j<ui->tableWidget_2->columnCount();++j){
+ QTableWidgetItem *item = ui->tableWidget_2->item(i,j);;
+ qDebug() <<i<<j <<item;
+ if(item){
+ qDebug()<<"OK";
+ labels<<item->data(Qt::EditRole).toString();
+ }else{
+ labels<<" ";
+ }
+ }
+ qDebug()<<labels;
+ if(labels.at(0)==" ")continue;
+ if(name.size()==0){
+ QMessageBox::information(this,"鍗曚綅淇℃伅涓虹┖ ","璇疯緭鍏ュ崟浣嶅悕绉�");
+ continue;
+ }
+ sql += QString("('%1',").arg(name);
+ for(int k=0;k<labels.size()-1;++k){
+ sql += QString("'%1',").arg(labels[k]);
+ }
+ sql += QString("'%1'),").arg(labels.back());
+ }
+ sql = sql.left(sql.size()-1); // 鍘绘帀鏈�鍚庝竴涓�楀彿
+ qDebug()<<"sql="<<sql;
+ QSqlQuery query;
+ if(query.exec(sql))
+ {
+ qDebug()<<QString("insert rectify_result_info ok...");
+ QMessageBox::information(this,"OK","娣诲姞鎴愬姛");
+ }else{
+ qDebug()<<QString("insert rectify_result_info fail...")<<query.lastError().text();
+ QMessageBox::information(this,"娣诲姞澶辫触","鍙兘娣诲姞鐨勬暟鎹笉鍏ㄥ鑷寸殑锛屽緱纭姣忚鐨勯椤规湁鏁版嵁");
+ }
+}
diff --git a/internal_system_v1/threemergeproblemlist.h b/internal_system_v1/threemergeproblemlist.h
index 0c694f6..3a5fbf5 100644
--- a/internal_system_v1/threemergeproblemlist.h
+++ b/internal_system_v1/threemergeproblemlist.h
@@ -21,9 +21,13 @@
void initUi();
void initProblemListUi();
void initProblemResultUi();
+ void initProblemRectBookUi();
void readCompanyFromSQL();
+
+ void loadDataFromSQL(const QString &arg1);
private slots:
+ // 闂娓呭崟
void showMenuSlot(QPoint);
void deleteAction();
@@ -31,17 +35,27 @@
void showMenuSlotResult(QPoint);
void deleteActionResult();
+ // 鏁存敼鍙拌处
+ void showMenuSlotRectBook(QPoint);
+ void deleteActionRectBook();
+
void on_pushButton_addRow_3_clicked();
void on_pushButton_addRow_2_clicked();
void on_pushButton_addRow_clicked();
+ void on_comboBox_company_currentIndexChanged(const QString &arg1);
+
+ void on_pushButton_save_2_clicked();
+
+ void on_pushButton_save_clicked();
+
private:
Ui::ThreeMergeProblemList *ui;
- QMenu *m_menu;
- QMenu *m_menuResult;
- QMenu *m_menuResult_;
+ QMenu *m_menu; // 闂娓呭崟鑿滃崟
+ QMenu *m_menuResult; // 鏁存敼鎴愭灉
+ QMenu *m_menuRectBook; // 鏁存敼鍙拌处
};
#endif // THREEMERGEPROBLEMLIST_H
diff --git a/internal_system_v1/threemergeproblemlist.ui b/internal_system_v1/threemergeproblemlist.ui
index e06253e..133228a 100644
--- a/internal_system_v1/threemergeproblemlist.ui
+++ b/internal_system_v1/threemergeproblemlist.ui
@@ -18,15 +18,15 @@
<item row="0" column="0">
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
- <bool>false</bool>
+ <bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>1500</width>
- <height>944</height>
+ <width>1459</width>
+ <height>956</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_5">
--
Gitblit v1.8.0