|
@@ -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
|