rmy 2 个月前
父节点
当前提交
66c656b1c4

+ 2
- 2
Front/back/GC/GC.py 查看文件

@@ -115,7 +115,7 @@ def insert_into_database(file_name, cell_values, ms_station, last_station_count,
115 115
                  new_station_count, last_sum_hdiff, new_sum_hdiff, last_sum_rlen, new_sum_rlen, file_name_utf8)
116 116
             )
117 117
             QMessageBox.information(None, "提示",
118
-                                    f"文件 '{file_name}' 已成功更新到本地数据库中,点击'OK'以关闭此对话框。对话框关闭后,请点击“计算”以重新计算数据")
118
+                                    f"文件 '{file_name}' 已成功更新到本地数据库中,点击'OK'以关闭此对话框。")
119 119
         else:
120 120
             # 插入新记录
121 121
             cursor.execute(
@@ -131,7 +131,7 @@ def insert_into_database(file_name, cell_values, ms_station, last_station_count,
131 131
                     new_station_count, last_sum_hdiff, new_sum_hdiff, last_sum_rlen, new_sum_rlen)
132 132
             )
133 133
             QMessageBox.information(None, "提示",
134
-                                    f"文件 '{file_name}' 已成功添加到本地数据库中,点击'OK'以关闭此对话框。对话框关闭后,请点击“计算”以计算数据")
134
+                                    f"文件 '{file_name}' 已成功添加到本地数据库中,点击'OK'以关闭此对话框。")
135 135
 
136 136
         conn.commit()
137 137
     except sqlite3.Error as e:

+ 5
- 1
Front/back/GC/GCcompute.py 查看文件

@@ -362,7 +362,11 @@ def main_function(file_path, db_path):
362 362
                                        correction_numbers, period_differences)
363 363
 
364 364
         QMessageBox.information(None, "提示", f"文件 '{file_name}' 计算成功!")
365
+        return 1
365 366
 
366 367
     except Exception as e:
367
-        QMessageBox.critical(None, "错误", f"文件 '{file_name}' 计算失败!错误信息: {str(e)}")
368
+
369
+        # QMessageBox.critical(None, "错误", f"文件 '{file_name}' 计算失败!错误信息: {str(e)}")
370
+        QMessageBox.critical(None, "错误", f"文件 '{file_name}' 计算失败!请检查表格是否规范。")
368 371
         print(f"文件 '{file_name}' 计算失败!错误信息: {str(e)}")
372
+        return -1

+ 2
- 2
Front/back/GS/GS.py 查看文件

@@ -89,7 +89,7 @@ def insert_into_database(database, pastname, newname, excelname, listname1, list
89 89
                 )
90 90
                 rr = rr + 1
91 91
             QMessageBox.information(None, "提示",
92
-                                    f"文件 '{excelname}' 已成功更新到本地数据库中,点击'OK'以关闭此对话框。对话框关闭后,请点击“计算”以重新计算数据")
92
+                                    f"文件 '{excelname}' 已成功更新到本地数据库中,点击'OK'以关闭此对话框。")
93 93
         else:
94 94
             # 插入新记录GS_Input_Param 
95 95
             cursor.execute(
@@ -117,7 +117,7 @@ def insert_into_database(database, pastname, newname, excelname, listname1, list
117 117
                 )
118 118
                 rr = rr + 1
119 119
             QMessageBox.information(None, "提示",
120
-                                    f"文件 '{excelname}' 已成功添加到本地数据库中,点击'OK'以关闭此对话框。对话框关闭后,请点击“计算”以计算数据")
120
+                                    f"文件 '{excelname}' 已成功添加到本地数据库中,点击'OK'以关闭此对话框。")
121 121
 
122 122
         db.commit()
123 123
     except sqlite3.Error as e:

+ 4
- 1
Front/back/GS/GScompute.py 查看文件

@@ -594,5 +594,8 @@ def main_function(file_name, dbpath):
594 594
         bhjs(dbpath, listcgcs1, listname1, listpastx1, listpasty1, wypd0, listname, listnewx, listnewy, listpastx,
595 595
              listpasty, points, listcgcs, sf, newname, pastname, js, listnewx1, listnewy1, file_name)
596 596
         QMessageBox.information(None, "提示", f"文件 '{file_name}' 计算成功!")
597
+        return 1
597 598
     except Exception as e:
598
-        QMessageBox.critical(None, "错误", f"文件 '{file_name}' 计算失败!错误信息: {str(e)}")
599
+        # QMessageBox.critical(None, "错误", f"文件 '{file_name}' 计算失败!错误信息: {str(e)}")
600
+        QMessageBox.critical(None, "错误", f"文件 '{file_name}' 计算失败!请检查表格是否规范。")
601
+        return -1

+ 2
- 2
Front/back/WD/WD.py 查看文件

@@ -93,7 +93,7 @@ def insert_into_database(database, pastname, newname, beforename, excelname, lis
93 93
                 )
94 94
                 rr = rr + 1
95 95
             QMessageBox.information(None, "提示",
96
-                                    f"文件 '{excelname}' 已成功更新到本地数据库中,点击'OK'以关闭此对话框。对话框关闭后,请点击“计算”以重新计算数据")
96
+                                    f"文件 '{excelname}' 已成功更新到本地数据库中,点击'OK'以关闭此对话框。")
97 97
         else:
98 98
             # 插入新记录WD_Input_Param 
99 99
             cursor.execute(
@@ -123,7 +123,7 @@ def insert_into_database(database, pastname, newname, beforename, excelname, lis
123 123
                 )
124 124
                 rr = rr + 1
125 125
             QMessageBox.information(None, "提示",
126
-                                    f"文件 '{excelname}' 已成功添加到本地数据库中,点击'OK'以关闭此对话框。对话框关闭后,请点击“计算”以计算数据")
126
+                                    f"文件 '{excelname}' 已成功添加到本地数据库中,点击'OK'以关闭此对话框。")
127 127
 
128 128
         db.commit()
129 129
     except sqlite3.Error as e:

+ 3
- 1
Front/back/WD/WDcompute.py 查看文件

@@ -618,5 +618,7 @@ def main_function(file_name, dbpath):
618 618
         bhjs(listcgcs1, listname1, listpastx1, listpasty1, wypd0, listname, listnewx, listnewy, listpastx, listpasty,
619 619
              points, listcgcs, listbex, listbey, sf, dbpath, befname, finalname, lastname, js, file_name)
620 620
         QMessageBox.information(None, "提示", f"文件 '{file_name}' 计算成功!")
621
+        return 1
621 622
     except Exception as e:
622
-        QMessageBox.critical(None, "错误", f"文件 '{file_name}' 计算失败!错误信息: {str(e)}")
623
+        QMessageBox.critical(None, "错误", f"文件 '{file_name}' 计算失败!请检查表格是否规范。")
624
+        return -1

+ 21
- 12
Front/main.py 查看文件

@@ -772,8 +772,8 @@ class MainWindow(QMainWindow):
772 772
 
773 773
         # APP名称
774 774
         # ///////////////////////////////////////////////////////////////
775
-        title = "控制网复测平面基准归算程序"
776
-        description = "控制网复测平面基准归算程序"
775
+        title = "监测控制网稳定性已知系统分析程序"
776
+        description = "监测控制网稳定性已知系统分析程序"
777 777
         # APPLY TEXTS
778 778
         self.setWindowTitle(title)
779 779
         widgets.titleRightInfo.setText(description)
@@ -964,10 +964,13 @@ class MainWindow(QMainWindow):
964 964
         if btnName == "compute":
965 965
             if self.file_path:  # 确保有文件路径后再进行处理
966 966
                 # 计算与展示的业务代码
967
-                UIFunctions.compute_show_process_excel_file(self, self.file_path)
968
-                self.refresh_tree()
969
-                # 1秒后自动跳转
970
-                QTimer.singleShot(1000, lambda: self.simulateButtonClick("btn_new"))
967
+                bool_1 = UIFunctions.compute_show_process_excel_file(self, self.file_path)
968
+                if bool_1 == 1:
969
+                    # 1秒后自动跳转
970
+                    QTimer.singleShot(1000, lambda: self.simulateButtonClick("btn_new"))
971
+                else:
972
+                    self.refresh_tree()
973
+
971 974
             else:
972 975
                 QMessageBox.warning(self, '警告', '请先选择项目并上传文件')
973 976
 
@@ -1341,9 +1344,12 @@ class MainWindow(QMainWindow):
1341 1344
         dbname = parent_item.parent().text(0)
1342 1345
         dbpath = resource_path(os.path.join('SQL', f"{dbname}.db"))  # 使用 resource_path 获取数据库路径
1343 1346
         # 重新组织表的内容,方便重新计算
1344
-        UIFunctions.update_to_db(self, list1, parent_name, tablename_utf8, dbpath)
1345
-        # 1秒后自动跳转
1346
-        QTimer.singleShot(1000, lambda: self.simulateButtonClick("btn_new"))
1347
+        bool_1 = UIFunctions.update_to_db(self, list1, parent_name, tablename_utf8, dbpath)
1348
+        if bool_1 == 1:
1349
+            # 1秒后自动跳转
1350
+            QTimer.singleShot(1000, lambda: self.simulateButtonClick("btn_new"))
1351
+        else:
1352
+            self.refresh_tree()
1347 1353
 
1348 1354
         # 数据库路径,哪种方法,表名
1349 1355
         self.selectModel = UIFunctions.search_data_to_show(self, dbpath, parent_name, tablename)
@@ -1377,9 +1383,12 @@ class MainWindow(QMainWindow):
1377 1383
 
1378 1384
         if event.type() == QEvent.MouseButtonPress:
1379 1385
             # 检查是否为空
1380
-            if self.item_index is not None and len(self.ui.resultTableView1.model().itemData(self.item_index)[0]) == 0:
1381
-                # 自动填充原来的内容
1382
-                self.ui.resultTableView1.model().setData(self.item_index, self.oritext)
1386
+            try:
1387
+                if self.item_index is not None and len(self.ui.resultTableView1.model().itemData(self.item_index)[0]) == 0:
1388
+                    # 自动填充原来的内容
1389
+                    self.ui.resultTableView1.model().setData(self.item_index, self.oritext)
1390
+            except:
1391
+                pass
1383 1392
 
1384 1393
         return super().eventFilter(source, event)
1385 1394
 

+ 250
- 151
Front/modules/ui_functions.py 查看文件

@@ -69,8 +69,8 @@ class UIFunctions(MainWindow):
69 69
             self.showNormal()
70 70
             self.resize(self.width() + 1, self.height() + 1)
71 71
             self.ui.appMargins.setContentsMargins(10, 10, 10, 10)
72
-            # self.ui.maximizeRestoreAppBtn.setToolTip("Maximize")
73
-            # self.ui.maximizeRestoreAppBtn.setIcon(QIcon(u":/icons/images/icons/icon_maximize.png"))
72
+            self.ui.maximizeRestoreAppBtn.setToolTip("Maximize")
73
+            self.ui.maximizeRestoreAppBtn.setIcon(QIcon(u":/icons/images/icons/icon_maximize.png"))
74 74
             self.ui.frame_size_grip.show()
75 75
             self.left_grip.show()
76 76
             self.right_grip.show()
@@ -292,7 +292,7 @@ class UIFunctions(MainWindow):
292 292
         self.ui.minimizeAppBtn.clicked.connect(lambda: self.showMinimized())
293 293
 
294 294
         # # MAXIMIZE/RESTORE
295
-        # self.ui.maximizeRestoreAppBtn.clicked.connect(lambda: UIFunctions.maximize_restore(self))
295
+        self.ui.maximizeRestoreAppBtn.clicked.connect(lambda: UIFunctions.maximize_restore(self))
296 296
 
297 297
         # CLOSE APPLICATION
298 298
         self.ui.closeAppBtn.clicked.connect(lambda: self.close())
@@ -344,25 +344,45 @@ class UIFunctions(MainWindow):
344 344
         # 转换为utf-8
345 345
         excelname = os.path.basename(file_path)  # 文件名
346 346
         utf_en = excelname.encode('utf-8')  # 转换文件名为utf-8编码形式
347
+        #返回一个值,不跳转结果界面
347 348
         if current_text == "水准测段高差稳定计算":
348 349
             try:
349
-                GCcompute.main_function(file_path, db_path)
350
-                GCshow.main_function(self.ui, db_path, utf_en)
350
+                bool_2 = GCcompute.main_function(file_path, db_path)
351
+                if bool_2 == 1:
352
+                    GCshow.main_function(self.ui, db_path, utf_en)
353
+                    return 1
354
+                else:
355
+                    # 清除所有与之相关的数据库
356
+                    UIFunctions.clear_db_data(self, current_text, utf_en, db_path)
357
+                    return -1
351 358
             except:
352 359
                 #清除所有与之相关的数据库
353 360
                 UIFunctions.clear_db_data(self,current_text,utf_en, db_path)
361
+                return -1
354 362
         elif current_text == "控制网复测平面基准计算":
355 363
             try:
356
-                GScompute.main_function(excelname, db_path)
357
-                GSshow.main_function(self.ui, db_path, utf_en)
364
+                bool_3 = GScompute.main_function(excelname, db_path)
365
+                if bool_3 == 1:
366
+                    GSshow.main_function(self.ui, db_path, utf_en)
367
+                    return 1
368
+                else:
369
+                    UIFunctions.clear_db_data(self, current_text, utf_en, db_path)
370
+                    return -1
358 371
             except:
359 372
                 UIFunctions.clear_db_data(self,current_text,utf_en, db_path)
373
+                return -1
360 374
         elif current_text == "平面控制网稳定性计算":
361 375
             try:
362
-                WDcompute.main_function(excelname, db_path)
363
-                WDshow.main_function(self.ui, db_path, utf_en)
376
+                bool_4 = WDcompute.main_function(excelname, db_path)
377
+                if bool_4 == 1:
378
+                    WDshow.main_function(self.ui, db_path, utf_en)
379
+                    return 1
380
+                else:
381
+                    UIFunctions.clear_db_data(self, current_text, utf_en, db_path)
382
+                    return -1
364 383
             except:
365 384
                 UIFunctions.clear_db_data(self,current_text,utf_en, db_path)
385
+                return -1
366 386
 
367 387
     #统一删除数据库内的错误信息
368 388
     def clear_db_data(self,methodName,tableName_utf8, dbPath):
@@ -579,151 +599,230 @@ class UIFunctions(MainWindow):
579 599
         print(dbPath)
580 600
         db1 = sqlite3.connect(dbPath)
581 601
         cursor1 = db1.cursor()
602
+        #副本名
603
+        copyname = tableName_utf8 + 'copy'.encode('utf-8')
604
+        #初始化三个布尔值
605
+        bool_1 = 1
606
+        bool_2 = 1
607
+        bool_3 = 1
582 608
         # 通过行锁定对应的字段
583 609
         if methodName == '水准测段高差稳定计算':
584
-            #读取有用的数据,按格式录入
585
-            data = GC.get_data_from_excel1(model1)
586
-            cell_values = GC.read_cells_from_excel1(model1)
587
-            ms_station = float(model1[0][12])
588
-            last_station_count = GC.get_last_numeric_cell_value1(model1, 2)
589
-            new_station_count = GC.get_last_numeric_cell_value1(model1, 7)
590
-            last_sum_hdiff = GC.calculate_column_sum1(model1, 4)
591
-            last_sum_rlen = GC.calculate_column_sum1(model1, 5)
592
-            new_sum_hdiff = GC.calculate_column_sum1(model1, 9)
593
-            new_sum_rlen = GC.calculate_column_sum1(model1, 10)
594
-            # 把所有相关的表都删除
595
-            sqlstr1 = """DELETE FROM GC_Input_Point WHERE TableName = ? """
596
-            cursor1.execute(sqlstr1, (tableName_utf8,))
597
-            sqlstr2 = """DELETE FROM GC_Input_Param WHERE TableName = ? """
598
-            cursor1.execute(sqlstr2, (tableName_utf8,))
610
+            try:
611
+                #读取有用的数据,按格式录入
612
+                data = GC.get_data_from_excel1(model1)
613
+                cell_values = GC.read_cells_from_excel1(model1)
614
+                ms_station = float(model1[0][12])
615
+                last_station_count = GC.get_last_numeric_cell_value1(model1, 2)
616
+                new_station_count = GC.get_last_numeric_cell_value1(model1, 7)
617
+                last_sum_hdiff = GC.calculate_column_sum1(model1, 4)
618
+                last_sum_rlen = GC.calculate_column_sum1(model1, 5)
619
+                new_sum_hdiff = GC.calculate_column_sum1(model1, 9)
620
+                new_sum_rlen = GC.calculate_column_sum1(model1, 10)
621
+
622
+                #存个副本,如果有错还能回退
623
+                sqlnew1 = """UPDATE GC_Input_Point SET TableName = ? WHERE TableName = ? """
624
+                cursor1.execute(sqlnew1, (copyname,tableName_utf8,))
625
+                sqlnew2 = """UPDATE GC_Input_Param SET TableName = ? WHERE TableName = ? """
626
+                cursor1.execute(sqlnew2, (copyname, tableName_utf8,))
627
+                sqlnew3 = """UPDATE GC_Output_Point SET TableName = ? WHERE TableName = ? """
628
+                cursor1.execute(sqlnew3, (copyname, tableName_utf8,))
629
+                # 提交事务
630
+                db1.commit()
631
+                # 关闭db
632
+                db1.close()
633
+                # 直接使用计算方式
634
+                tableName = tableName_utf8.decode('utf-8')
635
+                # 重新更新数据库
636
+                GC.insert_into_database(tableName, cell_values, ms_station, last_station_count, new_station_count,
637
+                                     last_sum_hdiff,
638
+                                     new_sum_hdiff, last_sum_rlen, new_sum_rlen, dbPath, tableName_utf8)
639
+                GC.insert_data_into_database(data, tableName, cell_values, dbPath, tableName_utf8)
640
+                bool_1 = GCcompute.main_function(tableName, dbPath)
641
+            except:
642
+                bool_1 = -1
599 643
 
600
-            # 先把结果相关的点和参数删一下
601
-            sqlstr3 = """DELETE FROM GC_Output_Point  WHERE TableName = ?"""
602
-            cursor1.execute(sqlstr3, (tableName_utf8,))
603
-            # 提交事务
604
-            db1.commit()
605
-            # 关闭db
606
-            db1.close()
607
-            # 直接使用计算方式
608
-            tableName = tableName_utf8.decode('utf-8')
609
-            # 重新更新数据库
610
-            GC.insert_into_database(tableName, cell_values, ms_station, last_station_count, new_station_count,
611
-                                 last_sum_hdiff,
612
-                                 new_sum_hdiff, last_sum_rlen, new_sum_rlen, dbPath, tableName_utf8)
613
-            GC.insert_data_into_database(data, tableName, cell_values, dbPath, tableName_utf8)
614
-            GCcompute.main_function(tableName, dbPath)
615
-            GCshow.main_function(self.ui, dbPath, tableName_utf8)
644
+            if bool_1 == 1:
645
+                GCshow.main_function(self.ui, dbPath, tableName_utf8)
646
+                # 把所有相关的表都删除
647
+                UIFunctions.clear_db_data(self, methodName, copyname, dbPath)
648
+            else:
649
+                # 把所有相关的表都删除
650
+                UIFunctions.clear_db_data(self,methodName,tableName_utf8, dbPath)
651
+                #把副本改回来
652
+                db1 = sqlite3.connect(dbPath)
653
+                cursor1 = db1.cursor()
654
+                # 存个副本,如果有错还能回退
655
+                sqlnew1 = """UPDATE GC_Input_Point SET TableName = ? WHERE TableName = ? """
656
+                cursor1.execute(sqlnew1, (tableName_utf8,copyname,))
657
+                sqlnew2 = """UPDATE GC_Input_Param SET TableName = ? WHERE TableName = ? """
658
+                cursor1.execute(sqlnew2, (tableName_utf8,copyname, ))
659
+                sqlnew3 = """UPDATE GC_Output_Point SET TableName = ? WHERE TableName = ? """
660
+                cursor1.execute(sqlnew3, (tableName_utf8,copyname, ))
661
+                # 提交事务
662
+                db1.commit()
663
+                # 关闭db
664
+                db1.close()
616 665
         elif methodName == '控制网复测平面基准计算':
617
-            #读取模型
618
-            ii = 0
619
-            pastname = model1[0][6]
620
-            newname = model1[0][7]
621
-            pjbc = float(model1[0][8])
622
-            fxzwc = float(model1[0][9])
623
-            zrbzwc = float(model1[0][10])
624
-            points = len(model1)
625
-            zbs = float(model1[0][11])
626
-            zfxs = float(model1[0][12])
627
-            sf = float(model1[0][13])
628
-            pjbcs = zbs / points
629
-            pjfxs = zfxs / points
630
-            listname1 = []
631
-            listpastx1 = []
632
-            listpasty1 = []
633
-            listcgcs1 = []
634
-            listnewx1 = []
635
-            listnewy1 = []
636
-            while ii < len(model1):
637
-                if model1[ii][0] == '' or model1[ii][0] == None:
638
-                    ii = ii + 1
639
-                else:
640
-                    listname1.append(model1[ii][0])
641
-                    listpastx1.append(model1[ii][1])
642
-                    listpasty1.append(model1[ii][2])
643
-                    listnewx1.append(model1[ii][3])
644
-                    listnewy1.append(model1[ii][4])
645
-                    listcgcs1.append(model1[ii][5])
646
-                    ii = ii + 1
647
-
648
-            #把所有相关的表都删除
649
-            sqlstr1 = """DELETE FROM GS_Input_Point WHERE TableName = ? """
650
-            cursor1.execute(sqlstr1, (tableName_utf8, ))
651
-            sqlstr2 = """DELETE FROM GS_Input_Param WHERE TableName = ? """
652
-            cursor1.execute(sqlstr2, (tableName_utf8,))
653
-
654
-            # 先把结果相关的点和参数删一下
655
-            sqlstr3 = """DELETE FROM GS_Result_Point  WHERE TableName = ?"""
656
-            cursor1.execute(sqlstr3, (tableName_utf8,))
657
-            sqlstr4 = """DELETE FROM GS_Trans_Point  WHERE TableName = ?"""
658
-            cursor1.execute(sqlstr4, (tableName_utf8,))
659
-            sqlstr5 = """DELETE FROM GS_Trans_Param  WHERE TableName = ?"""
660
-            cursor1.execute(sqlstr5, (tableName_utf8,))
661
-            # 提交事务
662
-            db1.commit()
663
-            # 关闭db
664
-            db1.close()
665
-            # 直接使用计算方式
666
-            tableName = tableName_utf8.decode('utf-8')
667
-            #重新更新数据库
668
-            GS.insert_into_database(dbPath, pastname, newname, tableName, listname1, listpastx1, listpasty1, listcgcs1, listnewx1,
669
-                         listnewy1, pjbc, fxzwc, zrbzwc, points, zbs, zfxs, sf, pjbcs, pjfxs)
670
-            GScompute.main_function(tableName, dbPath)
671
-            GSshow.main_function(self.ui, dbPath, tableName_utf8)
666
+            try:
667
+                #读取模型
668
+                ii = 0
669
+                pastname = model1[0][6]
670
+                newname = model1[0][7]
671
+                pjbc = float(model1[0][8])
672
+                fxzwc = float(model1[0][9])
673
+                zrbzwc = float(model1[0][10])
674
+                points = len(model1)
675
+                zbs = float(model1[0][11])
676
+                zfxs = float(model1[0][12])
677
+                sf = float(model1[0][13])
678
+                pjbcs = zbs / points
679
+                pjfxs = zfxs / points
680
+                listname1 = []
681
+                listpastx1 = []
682
+                listpasty1 = []
683
+                listcgcs1 = []
684
+                listnewx1 = []
685
+                listnewy1 = []
686
+                while ii < len(model1):
687
+                    if model1[ii][0] == '' or model1[ii][0] == None:
688
+                        ii = ii + 1
689
+                    else:
690
+                        listname1.append(model1[ii][0])
691
+                        listpastx1.append(model1[ii][1])
692
+                        listpasty1.append(model1[ii][2])
693
+                        listnewx1.append(model1[ii][3])
694
+                        listnewy1.append(model1[ii][4])
695
+                        listcgcs1.append(model1[ii][5])
696
+                        ii = ii + 1
697
+                sqlnew1 = """UPDATE GS_Input_Point SET TableName = ? WHERE TableName = ? """
698
+                cursor1.execute(sqlnew1, (copyname, tableName_utf8,))
699
+                sqlnew2 = """UPDATE GS_Input_Param SET TableName = ? WHERE TableName = ? """
700
+                cursor1.execute(sqlnew2, (copyname, tableName_utf8,))
701
+                sqlnew3 = """UPDATE GS_Result_Point SET TableName = ? WHERE TableName = ? """
702
+                cursor1.execute(sqlnew3, (copyname, tableName_utf8,))
703
+                sqlnew4 = """UPDATE GS_Trans_Point SET TableName = ? WHERE TableName = ? """
704
+                cursor1.execute(sqlnew4, (copyname, tableName_utf8,))
705
+                sqlnew5 = """UPDATE GS_Trans_Param SET TableName = ? WHERE TableName = ? """
706
+                cursor1.execute(sqlnew5, (copyname, tableName_utf8,))
707
+
708
+                # 提交事务
709
+                db1.commit()
710
+                # 关闭db
711
+                db1.close()
712
+                # 直接使用计算方式
713
+                tableName = tableName_utf8.decode('utf-8')
714
+                #重新更新数据库
715
+                GS.insert_into_database(dbPath, pastname, newname, tableName, listname1, listpastx1, listpasty1, listcgcs1, listnewx1,
716
+                             listnewy1, pjbc, fxzwc, zrbzwc, points, zbs, zfxs, sf, pjbcs, pjfxs)
717
+                bool_2 = GScompute.main_function(tableName, dbPath)
718
+            except:
719
+                bool_2 = -1
720
+            if bool_2 == 1:
721
+                GSshow.main_function(self.ui, dbPath, tableName_utf8)
722
+                # 把所有相关的表都删除
723
+                UIFunctions.clear_db_data(self, methodName, copyname, dbPath)
724
+            else:
725
+                # 把所有相关的表都删除
726
+                UIFunctions.clear_db_data(self, methodName, tableName_utf8, dbPath)
727
+                # 把副本改回来
728
+                db1 = sqlite3.connect(dbPath)
729
+                cursor1 = db1.cursor()
730
+                # 存个副本,如果有错还能回退
731
+                sqlnew1 = """UPDATE GS_Input_Point SET TableName = ? WHERE TableName = ? """
732
+                cursor1.execute(sqlnew1, (tableName_utf8,copyname, ))
733
+                sqlnew2 = """UPDATE GS_Input_Param SET TableName = ? WHERE TableName = ? """
734
+                cursor1.execute(sqlnew2, (tableName_utf8,copyname, ))
735
+                sqlnew3 = """UPDATE GS_Result_Point SET TableName = ? WHERE TableName = ? """
736
+                cursor1.execute(sqlnew3, (tableName_utf8,copyname, ))
737
+                sqlnew4 = """UPDATE GS_Trans_Point SET TableName = ? WHERE TableName = ? """
738
+                cursor1.execute(sqlnew4, (tableName_utf8,copyname, ))
739
+                sqlnew5 = """UPDATE GS_Trans_Param SET TableName = ? WHERE TableName = ? """
740
+                cursor1.execute(sqlnew5, (tableName_utf8,copyname, ))
741
+                # 提交事务
742
+                db1.commit()
743
+                # 关闭db
744
+                db1.close()
672 745
         else:
673
-            # 读取模型
674
-            ii = 0
675
-            bename = model1[0][8]
676
-            pastname = model1[0][9]
677
-            newname = model1[0][10]
678
-            pjbc = float(model1[0][11])
679
-            fxzwc = float(model1[0][12])
680
-            points = len(model1)
681
-            zbs = float(model1[0][13])
682
-            zfxs = float(model1[0][14])
683
-            sf = float(model1[0][15])
684
-            pjbcs = zbs / points
685
-            pjfxs = zfxs / points
686
-            listbex1 = []
687
-            listbey1 = []
688
-            listname1 = []
689
-            listpastx1 = []
690
-            listpasty1 = []
691
-            listcgcs1 = []
692
-            listnewx1 = []
693
-            listnewy1 = []
694
-            while ii < len(model1):
695
-                if model1[ii][0] == '' or model1[ii][0] == None:
696
-                    ii = ii + 1
697
-                else:
698
-                    listname1.append(model1[ii][0])
699
-                    listbex1.append(model1[ii][1])
700
-                    listbey1.append(model1[ii][2])
701
-                    listpastx1.append(model1[ii][3])
702
-                    listpasty1.append(model1[ii][4])
703
-                    listcgcs1.append(model1[ii][5])
704
-                    listnewx1.append(model1[ii][6])
705
-                    listnewy1.append(model1[ii][7])
706
-                    ii = ii + 1
707
-            # 平面控制网稳定性计算
708
-            sqlstr1 = """DELETE FROM WD_Input_Point WHERE TableName = ?"""
709
-            cursor1.execute(sqlstr1, (tableName_utf8, ))
710
-            sqlstr2 = """DELETE FROM WD_Input_Param  WHERE TableName = ?"""
711
-            cursor1.execute(sqlstr2, (tableName_utf8,))
712
-
713
-            # 先把结果相关的点和参数删一下
714
-            sqlstr3 = """DELETE FROM WD_Result_Point  WHERE TableName = ?"""
715
-            cursor1.execute(sqlstr3, (tableName_utf8,))
716
-            sqlstr4 = """DELETE FROM WD_Result_Param  WHERE TableName = ?"""
717
-            cursor1.execute(sqlstr4, (tableName_utf8,))
718
-            # 提交事务
719
-            db1.commit()
720
-            # 关闭db
721
-            db1.close()
722
-            # 直接使用计算方式
723
-            tableName = tableName_utf8.decode('utf-8')
724
-            WD.insert_into_database(dbPath, pastname, newname, bename, tableName, listname1, listpastx1, listpasty1,
725
-                                    listcgcs1, pjbc, fxzwc, points, zbs, zfxs, sf, pjbcs, pjfxs, listbex1, listbey1,
726
-                                    listnewx1, listnewy1)
727
-            WDcompute.main_function(tableName, dbPath)
728
-            WDshow.main_function(self.ui, dbPath, tableName_utf8)
746
+            try:
747
+                # 读取模型
748
+                ii = 0
749
+                bename = model1[0][8]
750
+                pastname = model1[0][9]
751
+                newname = model1[0][10]
752
+                pjbc = float(model1[0][11])
753
+                fxzwc = float(model1[0][12])
754
+                points = len(model1)
755
+                zbs = float(model1[0][13])
756
+                zfxs = float(model1[0][14])
757
+                sf = float(model1[0][15])
758
+                pjbcs = zbs / points
759
+                pjfxs = zfxs / points
760
+                listbex1 = []
761
+                listbey1 = []
762
+                listname1 = []
763
+                listpastx1 = []
764
+                listpasty1 = []
765
+                listcgcs1 = []
766
+                listnewx1 = []
767
+                listnewy1 = []
768
+                while ii < len(model1):
769
+                    if model1[ii][0] == '' or model1[ii][0] == None:
770
+                        ii = ii + 1
771
+                    else:
772
+                        listname1.append(model1[ii][0])
773
+                        listbex1.append(model1[ii][1])
774
+                        listbey1.append(model1[ii][2])
775
+                        listpastx1.append(model1[ii][3])
776
+                        listpasty1.append(model1[ii][4])
777
+                        listcgcs1.append(model1[ii][5])
778
+                        listnewx1.append(model1[ii][6])
779
+                        listnewy1.append(model1[ii][7])
780
+                        ii = ii + 1
781
+                sqlnew1 = """UPDATE WD_Input_Point SET TableName = ? WHERE TableName = ? """
782
+                cursor1.execute(sqlnew1, (copyname, tableName_utf8,))
783
+                sqlnew2 = """UPDATE WD_Input_Param SET TableName = ? WHERE TableName = ? """
784
+                cursor1.execute(sqlnew2, (copyname, tableName_utf8,))
785
+                sqlnew3 = """UPDATE WD_Result_Point SET TableName = ? WHERE TableName = ? """
786
+                cursor1.execute(sqlnew3, (copyname, tableName_utf8,))
787
+                sqlnew5 = """UPDATE WD_Result_Param SET TableName = ? WHERE TableName = ? """
788
+                cursor1.execute(sqlnew5, (copyname, tableName_utf8,))
789
+                # 提交事务
790
+                db1.commit()
791
+                # 关闭db
792
+                db1.close()
793
+                # 直接使用计算方式
794
+                tableName = tableName_utf8.decode('utf-8')
795
+                WD.insert_into_database(dbPath, pastname, newname, bename, tableName, listname1, listpastx1, listpasty1,
796
+                                        listcgcs1, pjbc, fxzwc, points, zbs, zfxs, sf, pjbcs, pjfxs, listbex1, listbey1,
797
+                                        listnewx1, listnewy1)
798
+                bool_3 = WDcompute.main_function(tableName, dbPath)
799
+            except:
800
+                bool_3 = -1
801
+            if bool_3 == 1:
802
+                WDshow.main_function(self.ui, dbPath, tableName_utf8)
803
+                # 把所有相关的表都删除
804
+                UIFunctions.clear_db_data(self, methodName, copyname, dbPath)
805
+            else:
806
+                # 把所有相关的表都删除
807
+                UIFunctions.clear_db_data(self, methodName, tableName_utf8, dbPath)
808
+                # 把副本改回来
809
+                db1 = sqlite3.connect(dbPath)
810
+                cursor1 = db1.cursor()
811
+                # 存个副本,如果有错还能回退
812
+                sqlnew1 = """UPDATE WD_Input_Point SET TableName = ? WHERE TableName = ? """
813
+                cursor1.execute(sqlnew1, (tableName_utf8, copyname,))
814
+                sqlnew2 = """UPDATE WD_Input_Param SET TableName = ? WHERE TableName = ? """
815
+                cursor1.execute(sqlnew2, (tableName_utf8, copyname,))
816
+                sqlnew3 = """UPDATE WD_Result_Point SET TableName = ? WHERE TableName = ? """
817
+                cursor1.execute(sqlnew3, (tableName_utf8, copyname,))
818
+                sqlnew5 = """UPDATE WD_Result_Param SET TableName = ? WHERE TableName = ? """
819
+                cursor1.execute(sqlnew5, (tableName_utf8, copyname,))
820
+                # 提交事务
821
+                db1.commit()
822
+                # 关闭db
823
+                db1.close()
824
+        if bool_1 == -1 or bool_2 == -1 or bool_3 == -1:
825
+            return -1
826
+        else:
827
+            return 1
729 828
     # END - GUI DEFINITIONS

+ 50
- 36
Front/modules/ui_main.py 查看文件

@@ -57,7 +57,7 @@ class Ui_MainWindow(object):
57 57
             MainWindow.setObjectName(u"MainWindow")
58 58
         MainWindow.resize(1000, 680)
59 59
         MainWindow.setMinimumSize(QSize(940, 620))
60
-        MainWindow.setMaximumSize(QSize(1080, 720))
60
+        # MainWindow.setMaximumSize(QSize(1080, 720))
61 61
         # # 移除最大化按钮
62 62
         # MainWindow.setWindowFlags(MainWindow.windowFlags() & ~Qt.WindowMaximizeButtonHint)
63 63
         # 固定窗口大小
@@ -978,24 +978,24 @@ class Ui_MainWindow(object):
978 978
 
979 979
         self.horizontalLayout_2.addWidget(self.minimizeAppBtn)
980 980
 
981
-        # self.maximizeRestoreAppBtn = QPushButton(self.rightButtons)
982
-        # self.maximizeRestoreAppBtn.setObjectName(u"maximizeRestoreAppBtn")
983
-        # self.maximizeRestoreAppBtn.setMinimumSize(QSize(28, 28))
984
-        # self.maximizeRestoreAppBtn.setMaximumSize(QSize(28, 28))
985
-        # font3 = QFont()
986
-        # font3.setFamilies([u"Segoe UI"])
987
-        # font3.setPointSize(10)
988
-        # font3.setBold(False)
989
-        # font3.setItalic(False)
990
-        # font3.setStyleStrategy(QFont.PreferDefault)
991
-        # self.maximizeRestoreAppBtn.setFont(font3)
992
-        # self.maximizeRestoreAppBtn.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
993
-        # icon3 = QIcon()
994
-        # icon3.addFile(u":/icons/images/icons/icon_maximize.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
995
-        # self.maximizeRestoreAppBtn.setIcon(icon3)
996
-        # self.maximizeRestoreAppBtn.setIconSize(QSize(20, 20))
997
-        #
998
-        # self.horizontalLayout_2.addWidget(self.maximizeRestoreAppBtn)
981
+        self.maximizeRestoreAppBtn = QPushButton(self.rightButtons)
982
+        self.maximizeRestoreAppBtn.setObjectName(u"maximizeRestoreAppBtn")
983
+        self.maximizeRestoreAppBtn.setMinimumSize(QSize(28, 28))
984
+        self.maximizeRestoreAppBtn.setMaximumSize(QSize(28, 28))
985
+        font3 = QFont()
986
+        font3.setFamilies([u"Segoe UI"])
987
+        font3.setPointSize(10)
988
+        font3.setBold(False)
989
+        font3.setItalic(False)
990
+        font3.setStyleStrategy(QFont.PreferDefault)
991
+        self.maximizeRestoreAppBtn.setFont(font3)
992
+        self.maximizeRestoreAppBtn.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
993
+        icon3 = QIcon()
994
+        icon3.addFile(u":/icons/images/icons/icon_maximize.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
995
+        self.maximizeRestoreAppBtn.setIcon(icon3)
996
+        self.maximizeRestoreAppBtn.setIconSize(QSize(20, 20))
997
+
998
+        self.horizontalLayout_2.addWidget(self.maximizeRestoreAppBtn)
999 999
 
1000 1000
         self.closeAppBtn = QPushButton(self.rightButtons)
1001 1001
         self.closeAppBtn.setObjectName(u"closeAppBtn")
@@ -1320,16 +1320,25 @@ class Ui_MainWindow(object):
1320 1320
         self.label_notice_2.setMaximumSize(QSize(16777215, 16777215))
1321 1321
         self.gridLayout.addWidget(self.label_notice_2, 0, 4, 1, 1)
1322 1322
 
1323
-        self.label_0 = QLabel(self.frame_content_wid_1)
1324
-        self.label_0.setObjectName(u"label")
1325
-        self.label_0.setMaximumSize(QSize(16777215, 16777215))
1326
-        self.gridLayout.addWidget(self.label_0, 0, 3, 1, 1)
1323
+        self.label_00 = QLabel(self.frame_content_wid_1)
1324
+        self.label_00.setObjectName(u"label")
1325
+        self.label_00.setMaximumSize(QSize(16777215, 16777215))
1326
+        self.gridLayout.addWidget(self.label_00, 0, 0, 1, 1)
1327
+
1328
+        self.label_01 = QLabel(self.frame_content_wid_1)
1329
+        self.label_01.setObjectName(u"label")
1330
+        self.label_01.setMaximumSize(QSize(16777215, 16777215))
1331
+        self.gridLayout.addWidget(self.label_01, 0, 3, 1, 1)
1327 1332
 
1333
+        self.label_02 = QLabel(self.frame_content_wid_1)
1334
+        self.label_02.setObjectName(u"label")
1335
+        self.label_02.setMaximumSize(QSize(16777215, 16777215))
1336
+        self.gridLayout.addWidget(self.label_02, 0, 5, 1, 1)
1328 1337
 
1329 1338
         self.label = QLabel(self.frame_content_wid_1)
1330 1339
         self.label.setObjectName(u"label")
1331 1340
         self.label.setMaximumSize(QSize(60, 16777215))
1332
-        self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
1341
+        self.gridLayout.addWidget(self.label, 1, 1, 1, 1)
1333 1342
 
1334 1343
         self.comboBox = QComboBox(self.frame_content_wid_1)
1335 1344
         self.comboBox.setObjectName(u"comboBox")
@@ -1366,7 +1375,7 @@ class Ui_MainWindow(object):
1366 1375
         # 更新 comboBox 的初始内容
1367 1376
         self.updater.update_combo_box()
1368 1377
 
1369
-        self.gridLayout.addWidget(self.comboBox, 1, 1, 1, 2)
1378
+        self.gridLayout.addWidget(self.comboBox, 1, 2, 1, 1)
1370 1379
 
1371 1380
         self.lineEdit = CustomLineEdit(self.frame_content_wid_1)
1372 1381
         self.lineEdit.setObjectName(u"lineEdit")
@@ -1394,7 +1403,7 @@ class Ui_MainWindow(object):
1394 1403
         self.label_4 = QLabel(self.frame_content_wid_1)
1395 1404
         self.label_4.setObjectName(u"label_4")
1396 1405
 
1397
-        self.gridLayout.addWidget(self.label_4, 2, 0, 1, 1)
1406
+        self.gridLayout.addWidget(self.label_4, 2, 1, 1, 1)
1398 1407
 
1399 1408
         # self.label_0 = QLabel(self.frame_content_wid_1)
1400 1409
         # self.label_0.setObjectName(u"label_0")
@@ -1416,7 +1425,8 @@ class Ui_MainWindow(object):
1416 1425
                                       "    min-width: 9em;   \n"
1417 1426
                                       "}")
1418 1427
 
1419
-        self.gridLayout.addWidget(self.comboBox_2, 2, 1, 1, 2)
1428
+        self.gridLayout.addWidget(self.comboBox_2, 2, 2, 1, 1)
1429
+
1420 1430
 
1421 1431
         self.horizontalLayout_9.addLayout(self.gridLayout)
1422 1432
 
@@ -1934,7 +1944,7 @@ class Ui_MainWindow(object):
1934 1944
     def retranslateUi(self, MainWindow):
1935 1945
         MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None))
1936 1946
         self.titleLeftApp.setText(
1937
-            QCoreApplication.translate("MainWindow", u"\u56db\u5ddd\u4e2d\u6c34\u6210\u52d8\u9662", None))
1947
+            QCoreApplication.translate("MainWindow", u"\u4E2D\u6C34\u6210\u52D8\u9662", None))
1938 1948
         self.titleLeftDescription.setText(QCoreApplication.translate("MainWindow", u"CMC", None))
1939 1949
         self.toggleButton.setText(QCoreApplication.translate("MainWindow", u"\u83dc\u5355", None))
1940 1950
         self.btn_home.setText(QCoreApplication.translate("MainWindow", u"\u9996\u9875", None))
@@ -1969,7 +1979,7 @@ class Ui_MainWindow(object):
1969 1979
                                                          "<p align=\"center\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:9pt; color:#ffffff;\">pyside6-rcc resources.qrc -o resources_rc.py</span></p></body></html>",
1970 1980
                                                          None))
1971 1981
         self.titleRightInfo.setText(QCoreApplication.translate("MainWindow",
1972
-                                                               u"<html><head/><body><p><span style=\" font-size:20pt;\">\u63a7\u5236\u7f51\u590d\u6d4b\u5e73\u9762\u57fa\u51c6\u5f52\u7b97\u7a0b\u5e8f</span></p></body></html>",
1982
+                                                               u"<html><head/><body><p><span style=\" font-size:20pt;\">\u76D1\u6D4B\u63A7\u5236\u7F51\u7A33\u5B9A\u6027\u5DF2\u77E5\u7CFB\u7EDF\u5206\u6790\u7A0B\u5E8F</span></p></body></html>",
1973 1983
                                                                None))
1974 1984
         # if QT_CONFIG(tooltip)
1975 1985
         self.settingsTopBtn.setToolTip(QCoreApplication.translate("MainWindow", u"Settings", None))
@@ -1980,9 +1990,9 @@ class Ui_MainWindow(object):
1980 1990
         # endif // QT_CONFIG(tooltip)
1981 1991
         self.minimizeAppBtn.setText("")
1982 1992
         # if QT_CONFIG(tooltip)
1983
-        # self.maximizeRestoreAppBtn.setToolTip(QCoreApplication.translate("MainWindow", u"Maximize", None))
1993
+        self.maximizeRestoreAppBtn.setToolTip(QCoreApplication.translate("MainWindow", u"Maximize", None))
1984 1994
         # # endif // QT_CONFIG(tooltip)
1985
-        # self.maximizeRestoreAppBtn.setText("")
1995
+        self.maximizeRestoreAppBtn.setText("")
1986 1996
         # if QT_CONFIG(tooltip)
1987 1997
         self.closeAppBtn.setToolTip(QCoreApplication.translate("MainWindow", u"Close", None))
1988 1998
         # endif // QT_CONFIG(tooltip)
@@ -2036,12 +2046,16 @@ class Ui_MainWindow(object):
2036 2046
         self.createFile.setText(QCoreApplication.translate("MainWindow", u"\u65b0\u5efa", None))
2037 2047
         self.label_4.setText(
2038 2048
             QCoreApplication.translate("MainWindow", u"\u8ba1\u7b97\u65b9\u5f0f\uff1a", None))
2039
-        self.label_0.setText(" ")
2049
+        self.label_00.setText(" ")
2040 2050
 
2041
-        self.comboBox_2.setItemText(0, QCoreApplication.translate("MainWindow",
2051
+        self.label_01.setText(" ")
2052
+
2053
+        self.label_02.setText(" ")
2054
+
2055
+        self.comboBox_2.setItemText(1, QCoreApplication.translate("MainWindow",
2042 2056
                                                                   u"\u63a7\u5236\u7f51\u590d\u6d4b\u5e73\u9762\u57fa\u51c6\u8ba1\u7b97",
2043 2057
                                                                   None))
2044
-        self.comboBox_2.setItemText(1, QCoreApplication.translate("MainWindow",
2058
+        self.comboBox_2.setItemText(0, QCoreApplication.translate("MainWindow",
2045 2059
                                                                   u"\u5e73\u9762\u63a7\u5236\u7f51\u7a33\u5b9a\u6027\u8ba1\u7b97",
2046 2060
                                                                   None))
2047 2061
         self.comboBox_2.setItemText(2, QCoreApplication.translate("MainWindow",
@@ -2049,7 +2063,7 @@ class Ui_MainWindow(object):
2049 2063
                                                                   None))
2050 2064
 
2051 2065
         self.comboBox_2.setCurrentText(QCoreApplication.translate("MainWindow",
2052
-                                                                  u"\u63a7\u5236\u7f51\u590d\u6d4b\u5e73\u9762\u57fa\u51c6\u8ba1\u7b97",
2066
+                                                                  u"\u5e73\u9762\u63a7\u5236\u7f51\u7a33\u5b9a\u6027\u8ba1\u7b97",
2053 2067
                                                                   None))
2054 2068
         self.upload.setText(QCoreApplication.translate("MainWindow",
2055 2069
                                                        u"\u9009\u62e9\u8ba1\u7b97\u65b9\u5f0f\u540e\uff0c\u70b9\u51fb\u6b64\u5904\u9009\u62e9\u6587\u4ef6\u8fdb\u884c\u8ba1\u7b97\n"
@@ -2094,5 +2108,5 @@ class Ui_MainWindow(object):
2094 2108
             QCoreApplication.translate("MainWindow", u"\u7b26\u5408\u67e5\u8be2\u8981\u6c42\u7684\u8868", None))
2095 2109
         self.comboBox_4.setPlaceholderText(QCoreApplication.translate("MainWindow", u"\u6240\u6709\u8868", None))
2096 2110
         self.btn_message.setText(QCoreApplication.translate("MainWindow", u"\u5207\u6362\u4e3b\u9898", None))
2097
-        self.creditsLabel.setText(QCoreApplication.translate("MainWindow", u"\u7248\u6743\u4fe1\u606f", None))
2111
+        self.creditsLabel.setText(QCoreApplication.translate("MainWindow", u"\u00A9\u56DB\u5DDD\u4E2D\u6C34\u6210\u52D8\u9662\u6D4B\u7ED8\u5DE5\u7A0B\u6709\u9650\u8D23\u4EFB\u516C\u53F8", None))
2098 2112
         self.version.setText(QCoreApplication.translate("MainWindow", u"v1.0.0", None))

正在加载...
取消
保存