|
@@ -20,6 +20,7 @@ from PySide6.QtWidgets import QMessageBox
|
20
|
20
|
|
21
|
21
|
from main import *
|
22
|
22
|
import importlib
|
|
23
|
+import sqlite3
|
23
|
24
|
|
24
|
25
|
from select import select
|
25
|
26
|
|
|
@@ -377,4 +378,89 @@ class UIFunctions(MainWindow):
|
377
|
378
|
elif current_text == "平面控制网稳定性计算":
|
378
|
379
|
selectModel = WDshow.search_show_function(self.ui, file_path, utf_en)
|
379
|
380
|
return selectModel
|
|
381
|
+
|
|
382
|
+ # 删除行数据
|
|
383
|
+ def del_row_from_db(self, row, methodName, tableName_utf8, dbPath):
|
|
384
|
+ db1 = sqlite3.connect(dbPath)
|
|
385
|
+ cursor1 = db1.cursor()
|
|
386
|
+ # 通过行锁定对应的字段
|
|
387
|
+ if methodName == '水准测段高差稳定计算':
|
|
388
|
+ sqlstr1 = """SELECT * FROM GC_Input_Point WHERE TableName = ? LIMIT 1 OFFSET ?"""
|
|
389
|
+ cursor1.execute(sqlstr1, (tableName_utf8, row,))
|
|
390
|
+ result1 = cursor1.fetchall()
|
|
391
|
+ list1 = result1[0]
|
|
392
|
+ # 100%准确查询
|
|
393
|
+ # sqlstr3 = """SELECT * FROM GC_Input_Point WHERE TableName = ? and New_SPName = ? and New_EPName = ? and New_HDiff = ? and New_RLen = ?"""
|
|
394
|
+ # cursor1.execute(sqlstr3, (tableName_utf8, list1[7], list1[8], list1[11], list1[12],))
|
|
395
|
+ # result3 = cursor1.fetchall()
|
|
396
|
+ sqlstr2 = """DELETE FROM GC_Input_Point WHERE TableName = ? and New_SPName = ? and New_EPName = ? and New_HDiff = ? and New_RLen = ?"""
|
|
397
|
+ cursor1.execute(sqlstr2, (tableName_utf8, list1[7], list1[8], list1[11], list1[12],))
|
|
398
|
+ # # 获取删除的记录数量
|
|
399
|
+ # deleted_count = cursor1.rowcount
|
|
400
|
+ # 直接使用计算方式
|
|
401
|
+ tableName = tableName_utf8.decode('utf-8')
|
|
402
|
+ # 先把结果相关的点数据删一下
|
|
403
|
+ sqlstr3 = """DELETE FROM GC_Output_Point WHERE TableName = ?"""
|
|
404
|
+ cursor1.execute(sqlstr3, (tableName_utf8,))
|
|
405
|
+ # 提交事务
|
|
406
|
+ db1.commit()
|
|
407
|
+ # 关闭db
|
|
408
|
+ db1.close()
|
|
409
|
+ GCcompute.main_function(tableName, dbPath)
|
|
410
|
+ GCshow.main_function(self.ui, dbPath, tableName_utf8)
|
|
411
|
+ elif methodName == '控制网复测平面基准计算':
|
|
412
|
+ sqlstr1 = """SELECT * FROM GS_Input_Point WHERE TableName = ? LIMIT 1 OFFSET ?"""
|
|
413
|
+ cursor1.execute(sqlstr1, (tableName_utf8, row,))
|
|
414
|
+ result1 = cursor1.fetchall()
|
|
415
|
+ list1 = result1[0]
|
|
416
|
+ # 100%准确查询
|
|
417
|
+ # sqlstr3 = """SELECT * FROM GC_Input_Point WHERE TableName = ? and New_SPName = ? and New_EPName = ? and New_HDiff = ? and New_RLen = ?"""
|
|
418
|
+ # cursor1.execute(sqlstr3, (tableName_utf8, list1[7], list1[8], list1[11], list1[12],))
|
|
419
|
+ # result3 = cursor1.fetchall()
|
|
420
|
+ sqlstr2 = """DELETE FROM GS_Input_Point WHERE TableName = ? and PointName = ? and New_X = ? and New_Y = ?"""
|
|
421
|
+ cursor1.execute(sqlstr2, (tableName_utf8, list1[7], list1[5], list1[6],))
|
|
422
|
+ # # 获取删除的记录数量
|
|
423
|
+ # deleted_count = cursor1.rowcount
|
|
424
|
+ # 直接使用计算方式
|
|
425
|
+ tableName = tableName_utf8.decode('utf-8')
|
|
426
|
+ # 先把结果相关的点和参数删一下
|
|
427
|
+ sqlstr3 = """DELETE FROM GS_Result_Point WHERE TableName = ?"""
|
|
428
|
+ cursor1.execute(sqlstr3, (tableName_utf8,))
|
|
429
|
+ sqlstr4 = """DELETE FROM GS_Trans_Point WHERE TableName = ?"""
|
|
430
|
+ cursor1.execute(sqlstr4, (tableName_utf8,))
|
|
431
|
+ sqlstr5 = """DELETE FROM GS_Trans_Param WHERE TableName = ?"""
|
|
432
|
+ cursor1.execute(sqlstr5, (tableName_utf8,))
|
|
433
|
+ # 提交事务
|
|
434
|
+ db1.commit()
|
|
435
|
+ # 关闭db
|
|
436
|
+ db1.close()
|
|
437
|
+ GScompute.main_function(tableName, dbPath)
|
|
438
|
+ GSshow.main_function(self.ui, dbPath, tableName_utf8)
|
|
439
|
+ else:
|
|
440
|
+ # 平面控制网稳定性计算
|
|
441
|
+ sqlstr1 = """SELECT * FROM WD_Input_Point WHERE TableName = ? LIMIT 1 OFFSET ?"""
|
|
442
|
+ cursor1.execute(sqlstr1, (tableName_utf8, row,))
|
|
443
|
+ result1 = cursor1.fetchall()
|
|
444
|
+ list1 = result1[0]
|
|
445
|
+ # 100%准确查询
|
|
446
|
+ # sqlstr3 = """SELECT * FROM GC_Input_Point WHERE TableName = ? and New_SPName = ? and New_EPName = ? and New_HDiff = ? and New_RLen = ?"""
|
|
447
|
+ # cursor1.execute(sqlstr3, (tableName_utf8, list1[7], list1[8], list1[11], list1[12],))
|
|
448
|
+ # result3 = cursor1.fetchall()
|
|
449
|
+ sqlstr2 = """DELETE FROM WD_Input_Point WHERE TableName = ? and PointName = ? and New_X = ? and New_Y = ?"""
|
|
450
|
+ cursor1.execute(sqlstr2, (tableName_utf8, list1[11], list1[8], list1[9],))
|
|
451
|
+ # # 获取删除的记录数量
|
|
452
|
+ # deleted_count = cursor1.rowcount
|
|
453
|
+ # 直接使用计算方式
|
|
454
|
+ tableName = tableName_utf8.decode('utf-8')
|
|
455
|
+ # 先把结果相关的点和参数删一下
|
|
456
|
+ sqlstr3 = """DELETE FROM WD_Result_Point WHERE TableName = ?"""
|
|
457
|
+ cursor1.execute(sqlstr3, (tableName_utf8,))
|
|
458
|
+ sqlstr4 = """DELETE FROM WD_Result_Param WHERE TableName = ?"""
|
|
459
|
+ cursor1.execute(sqlstr4, (tableName_utf8,))
|
|
460
|
+ # 提交事务
|
|
461
|
+ db1.commit()
|
|
462
|
+ # 关闭db
|
|
463
|
+ db1.close()
|
|
464
|
+ WDcompute.main_function(tableName, dbPath)
|
|
465
|
+ WDshow.main_function(self.ui, dbPath, tableName_utf8)
|
380
|
466
|
# END - GUI DEFINITIONS
|