控制网复测平面基准归算程序(包含控制网复测平面基准计算,平面控制网稳定性计算,水准测段高差稳定计算三个程序功能)
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

GSshow.py 5.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import sqlite3
  2. from PySide6.QtGui import QStandardItemModel
  3. from Back.Program_Run.data_show import *
  4. def main_function(ui, db_path, utf_en):
  5. # 就用已有的选项卡
  6. ui.tabWidget.setTabVisible(0, True)
  7. ui.tabWidget.setTabVisible(1, True)
  8. ui.tabWidget.setTabVisible(2, True)
  9. # 重新设置文字名称
  10. ui.tabWidget.setTabText(0, '复测成果表')
  11. ui.tabWidget.setTabText(1, '基准归算模型')
  12. ui.tabWidget.setTabText(2, '复测基准归算表')
  13. # 连接到数据库
  14. db1 = sqlite3.connect(db_path)
  15. db1.text_factory = lambda x: str(x, 'utf-8')
  16. cursor1 = db1.cursor()
  17. # 查询表内符合的所有数据(分成两个结果分别显示)
  18. # 注意查询中的tablename,数据库中如果没有相同的表名,会报错,所以需要先判断一下
  19. # 复测成果表
  20. sqlstr1 = 'select PointName,Last_X,Last_Y,Result_X,Result_Y,Last_ResultX,Last_ResultY,Last_ResultP,Dis_Ass from GS_Result_Point WHERE TableName = ?'
  21. cursor1.execute(sqlstr1, (utf_en,))
  22. result1 = cursor1.fetchall()
  23. # 基准归算表
  24. sqlstr11 = 'select PointName,Cal_X,Cal_Y,Last_CalX,Last_CalY,Last_CalP,Dis_Ass from GS_Result_Point WHERE TableName = ?'
  25. cursor1.execute(sqlstr11, (utf_en,))
  26. result2 = cursor1.fetchall()
  27. # 对结果集进行处理,把汉字转换过来, 添加表头部分
  28. nlist1, plist1 = Arrange_Data1(result1)
  29. nlist2, plist2 = Arrange_Data2(result2)
  30. # 创建一个数据模型(复测成果表)
  31. model1 = QStandardItemModel()
  32. model1 = Data_in_Cell1(plist1)
  33. model1.setHorizontalHeaderLabels(
  34. ['点名', '前期X', '前期Y', '本期X', '本期Y', '前期-本期X', '前期-本期Y', '前期-本期P', '位移判定'])
  35. model1.setVerticalHeaderLabels(nlist1)
  36. # 展示表格
  37. ui.resultTableView.setModel(model1)
  38. ui.resultTableView.show()
  39. # 隐藏 QLabel
  40. ui.default_remind.hide()
  41. # 创建一个数据模型(基准归算表)
  42. model2 = QStandardItemModel()
  43. model2 = Data_in_Cell2(plist2)
  44. model2.setHorizontalHeaderLabels(
  45. ['点名', '基准归算X', '基准归算Y', '前期-归算X', '前期-归算Y', '前期-归算P', '位移判定'])
  46. model2.setVerticalHeaderLabels(nlist2)
  47. # 展示表格
  48. ui.reconTableView.setModel(model2)
  49. ui.reconTableView.show()
  50. # 富文本的html
  51. sqlstr2 = 'select Last_ResultName, New_ResultName, Formula_X1, Formula_X2, Formula_X3, Formula_Y1, Formula_Y2, Formula_Y3 from GS_Trans_Param WHERE TableName = ?'
  52. cursor1.execute(sqlstr2, (utf_en,))
  53. result3 = cursor1.fetchone()
  54. # 检查 result3 是否为 None
  55. if result3 is None:
  56. str0 = "<p>未找到相关数据。</p>"
  57. else:
  58. str1 = result3[0].decode('utf-8') if isinstance(result3[0], bytes) else result3[0]
  59. str2 = result3[1].decode('utf-8') if isinstance(result3[1], bytes) else result3[1]
  60. n1, n2, n3, n4, n5, n6 = result3[2], result3[3], result3[4], result3[5], result3[6], result3[7]
  61. str0 = f"""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
  62. <html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
  63. p, li {{ white-space: pre-wrap; }}
  64. hr {{ height: 1px; border-width: 0; }}
  65. li.unchecked::marker {{ content: "\\2610"; }}
  66. li.checked::marker {{ content: "\\2612"; }}
  67. </style></head><body style=" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;">
  68. <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; color:#000000;">{str2}--{str1}</span><span style=" font-size:14pt;">已知系统转换公式:</span></p>
  69. <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:700;">X</span><span style=" font-size:14pt;">=({n1})</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+({n2})</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+({n3})</span></p>
  70. <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:700;">Y</span><span style=" font-size:14pt;">=({n4})</span><span style=" font-size:14pt; font-weight:700;">x</span><span style=" font-size:14pt;">+({n5})</span><span style=" font-size:14pt; font-weight:700;">y</span><span style=" font-size:14pt;">+({n6})</span></p>
  71. <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">式中:</span><span style=" font-size:14pt; font-weight:700; color:#000000;">x、y</span><span style=" font-size:14pt;">为{str2}坐标;</span></p>
  72. <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;"> </span><span style=" font-size:14pt; font-weight:700;">X、Y</span><span style=" font-size:14pt;">为{str1}已知系统的{str2}归算坐标。</span></p></body></html>"""
  73. ui.printTableView.setHtml(str0)