|
@@ -38,6 +38,7 @@ from docx.enum.table import WD_TABLE_ALIGNMENT, WD_CELL_VERTICAL_ALIGNMENT
|
|
from docx.oxml.ns import qn
|
|
from docx.oxml.ns import qn
|
|
from docx.enum.text import WD_ALIGN_PARAGRAPH
|
|
from docx.enum.text import WD_ALIGN_PARAGRAPH
|
|
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
|
|
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
|
|
|
|
+from docx.enum.section import WD_ORIENTATION
|
|
import uuid
|
|
import uuid
|
|
import hashlib
|
|
import hashlib
|
|
from ttkbootstrap.dialogs import Querybox
|
|
from ttkbootstrap.dialogs import Querybox
|
|
@@ -353,13 +354,18 @@ def checkData(fileUrl):
|
|
table_1_data = resData
|
|
table_1_data = resData
|
|
# 提取异常指标数据
|
|
# 提取异常指标数据
|
|
global table_1_index
|
|
global table_1_index
|
|
- table_1_index = pd.DataFrame({
|
|
|
|
- '原样品编号': simpleData['原样品编号'],
|
|
|
|
- '样品编号': simpleData['样品编号'],
|
|
|
|
- '土地利用类型': resData['土地利用类型'],
|
|
|
|
- '指标': table_1_res['异常指标'],
|
|
|
|
- '原因': table_1_res['审核结果']
|
|
|
|
- })
|
|
|
|
|
|
+ # table_1_index = pd.DataFrame({
|
|
|
|
+ # '原样品编号': simpleData['原样品编号'],
|
|
|
|
+ # '样品编号': simpleData['样品编号'],
|
|
|
|
+ # '土地利用类型': resData['土地利用类型'],
|
|
|
|
+ # '指标': table_1_res['异常指标'],
|
|
|
|
+ # '原因': table_1_res['审核结果']
|
|
|
|
+ # })
|
|
|
|
+ table_1_index['原样品编号'] = simpleData['原样品编号']
|
|
|
|
+ table_1_index['样品编号'] = simpleData['样品编号']
|
|
|
|
+ table_1_index['土地利用类型'] = resData['土地利用类型']
|
|
|
|
+ table_1_index['指标'] = table_1_res['异常指标']
|
|
|
|
+ table_1_index['原因'] = table_1_res['审核结果']
|
|
# 这里数据直接使用即可(土壤质地填报)todo
|
|
# 这里数据直接使用即可(土壤质地填报)todo
|
|
del resData['土壤质地(判断)']
|
|
del resData['土壤质地(判断)']
|
|
resData.insert(loc=6, column='土壤质地(判断)', value=table_1_res['土壤质地(判断)'])
|
|
resData.insert(loc=6, column='土壤质地(判断)', value=table_1_res['土壤质地(判断)'])
|
|
@@ -405,11 +411,14 @@ def checkData(fileUrl):
|
|
table_3_data = resData_3
|
|
table_3_data = resData_3
|
|
# 提取异常数据
|
|
# 提取异常数据
|
|
global table_3_index
|
|
global table_3_index
|
|
- table_3_index = pd.DataFrame({
|
|
|
|
- '样品编号': simpleData['样品编号'],
|
|
|
|
- '指标': res_3_v['异常指标'],
|
|
|
|
- '原因': res_3_v['审核结果']
|
|
|
|
- })
|
|
|
|
|
|
+ # table_3_index = pd.DataFrame({
|
|
|
|
+ # '样品编号': simpleData['样品编号'],
|
|
|
|
+ # '指标': res_3_v['异常指标'],
|
|
|
|
+ # '原因': res_3_v['审核结果']
|
|
|
|
+ # })
|
|
|
|
+ table_3_index['样品编号'] = simpleData['样品编号']
|
|
|
|
+ table_3_index['指标'] = res_3_v['异常指标']
|
|
|
|
+ table_3_index['原因'] = res_3_v['审核结果']
|
|
resData_3_Style = resData_3.style.apply(highlight_condition, axis=1)
|
|
resData_3_Style = resData_3.style.apply(highlight_condition, axis=1)
|
|
# 表4--------------------------表4 水稳性大团聚体频度分析-----------------------
|
|
# 表4--------------------------表4 水稳性大团聚体频度分析-----------------------
|
|
print(3)
|
|
print(3)
|
|
@@ -446,11 +455,14 @@ def checkData(fileUrl):
|
|
# 提取异常数据
|
|
# 提取异常数据
|
|
print(3.5)
|
|
print(3.5)
|
|
global table_5_index
|
|
global table_5_index
|
|
- table_5_index = pd.DataFrame({
|
|
|
|
- '样品编号': simpleData['样品编号'],
|
|
|
|
- '指标': res_5_v['异常指标'],
|
|
|
|
- '原因': res_5_v['审核结果']
|
|
|
|
- })
|
|
|
|
|
|
+ # table_5_index = pd.DataFrame({
|
|
|
|
+ # '样品编号': simpleData['样品编号'],
|
|
|
|
+ # '指标': res_5_v['异常指标'],
|
|
|
|
+ # '原因': res_5_v['审核结果']
|
|
|
|
+ # })
|
|
|
|
+ table_5_index['样品编号'] = simpleData['样品编号']
|
|
|
|
+ table_5_index['指标'] = res_5_v['异常指标']
|
|
|
|
+ table_5_index['原因'] = res_5_v['审核结果']
|
|
resData_5_Style = resData_5.style.apply(highlight_condition, axis=1)
|
|
resData_5_Style = resData_5.style.apply(highlight_condition, axis=1)
|
|
print(4)
|
|
print(4)
|
|
# 表6--------------------------表6----------------------------------------
|
|
# 表6--------------------------表6----------------------------------------
|
|
@@ -509,11 +521,14 @@ def checkData(fileUrl):
|
|
table_8_data = resData_8
|
|
table_8_data = resData_8
|
|
# 提取异常数据
|
|
# 提取异常数据
|
|
global table_8_index
|
|
global table_8_index
|
|
- table_8_index = pd.DataFrame({
|
|
|
|
- '样品编号': simpleData['样品编号'],
|
|
|
|
- '指标': res_value_8['异常指标'],
|
|
|
|
- '原因': res_value_8['审核结果']
|
|
|
|
- })
|
|
|
|
|
|
+ # table_8_index = pd.DataFrame({
|
|
|
|
+ # '样品编号': simpleData['样品编号'],
|
|
|
|
+ # '指标': res_value_8['异常指标'],
|
|
|
|
+ # '原因': res_value_8['审核结果']
|
|
|
|
+ # })
|
|
|
|
+ table_8_index['样品编号'] = simpleData['样品编号']
|
|
|
|
+ table_8_index['指标'] = res_value_8['异常指标']
|
|
|
|
+ table_8_index['原因'] = res_value_8['审核结果']
|
|
resData_8_Style = resData_8.style.apply(highlight_condition, axis=1)
|
|
resData_8_Style = resData_8.style.apply(highlight_condition, axis=1)
|
|
print(5)
|
|
print(5)
|
|
# 表7--------------------------表7 数据频度分析----------------------------------------
|
|
# 表7--------------------------表7 数据频度分析----------------------------------------
|
|
@@ -547,11 +562,14 @@ def checkData(fileUrl):
|
|
table_10_data = resData_10
|
|
table_10_data = resData_10
|
|
# 提取异常数据
|
|
# 提取异常数据
|
|
global table_10_index
|
|
global table_10_index
|
|
- table_10_index = pd.DataFrame({
|
|
|
|
- '样品编号': simpleData['样品编号'],
|
|
|
|
- '指标': res_value_10['异常指标'],
|
|
|
|
- '原因': res_value_10['审核结果']
|
|
|
|
- })
|
|
|
|
|
|
+ # table_10_index = pd.DataFrame({
|
|
|
|
+ # '样品编号': simpleData['样品编号'],
|
|
|
|
+ # '指标': res_value_10['异常指标'],
|
|
|
|
+ # '原因': res_value_10['审核结果']
|
|
|
|
+ # })
|
|
|
|
+ table_10_index['样品编号'] = simpleData['样品编号']
|
|
|
|
+ table_10_index['指标'] = res_value_10['异常指标']
|
|
|
|
+ table_10_index['原因'] = res_value_10['审核结果']
|
|
resData_10_Style = resData_10.style.apply(highlight_condition, axis=1)
|
|
resData_10_Style = resData_10.style.apply(highlight_condition, axis=1)
|
|
# 表9--------------------------表9----------------------------------------
|
|
# 表9--------------------------表9----------------------------------------
|
|
# 计算频度数据
|
|
# 计算频度数据
|
|
@@ -590,11 +608,14 @@ def checkData(fileUrl):
|
|
table_12_data = resData_12
|
|
table_12_data = resData_12
|
|
# 提取异常数据
|
|
# 提取异常数据
|
|
global table_12_index
|
|
global table_12_index
|
|
- table_12_index = pd.DataFrame({
|
|
|
|
- '样品编号': simpleData['样品编号'],
|
|
|
|
- '指标': res_value_12['异常指标'],
|
|
|
|
- '原因': res_value_12['审核结果']
|
|
|
|
- })
|
|
|
|
|
|
+ # table_12_index = pd.DataFrame({
|
|
|
|
+ # '样品编号': simpleData['样品编号'],
|
|
|
|
+ # '指标': res_value_12['异常指标'],
|
|
|
|
+ # '原因': res_value_12['审核结果']
|
|
|
|
+ # })
|
|
|
|
+ table_12_index['样品编号'] = simpleData['样品编号']
|
|
|
|
+ table_12_index['指标'] = res_value_12['异常指标']
|
|
|
|
+ table_12_index['原因'] = res_value_12['审核结果']
|
|
resData_12_Style = resData_12.style.apply(highlight_condition, axis=1)
|
|
resData_12_Style = resData_12.style.apply(highlight_condition, axis=1)
|
|
print(7)
|
|
print(7)
|
|
# 写入表格
|
|
# 写入表格
|
|
@@ -625,11 +646,14 @@ def checkData(fileUrl):
|
|
table_14_data = resData_14
|
|
table_14_data = resData_14
|
|
# 提取异常数据
|
|
# 提取异常数据
|
|
global table_14_index
|
|
global table_14_index
|
|
- table_14_index = pd.DataFrame({
|
|
|
|
- '样品编号': simpleData['样品编号'],
|
|
|
|
- '指标': res_value_14['异常指标'],
|
|
|
|
- '原因': res_value_14['审核结果']
|
|
|
|
- })
|
|
|
|
|
|
+ # table_14_index = pd.DataFrame({
|
|
|
|
+ # '样品编号': simpleData['样品编号'],
|
|
|
|
+ # '指标': res_value_14['异常指标'],
|
|
|
|
+ # '原因': res_value_14['审核结果']
|
|
|
|
+ # })
|
|
|
|
+ table_14_index['样品编号'] = simpleData['样品编号']
|
|
|
|
+ table_14_index['指标'] = res_value_14['异常指标']
|
|
|
|
+ table_14_index['原因'] = res_value_14['审核结果']
|
|
resData_14_Style = resData_14.style.apply(highlight_condition, axis=1)
|
|
resData_14_Style = resData_14.style.apply(highlight_condition, axis=1)
|
|
# 写入表格
|
|
# 写入表格
|
|
# 表13--------------------------表13 土壤重金属频度分析----------------------------------------
|
|
# 表13--------------------------表13 土壤重金属频度分析----------------------------------------
|
|
@@ -663,11 +687,21 @@ def makeNormalWord(url):
|
|
'数据判定': emptyArr
|
|
'数据判定': emptyArr
|
|
})
|
|
})
|
|
newData = newData.replace(np.nan, '')
|
|
newData = newData.replace(np.nan, '')
|
|
|
|
+ print(newData)
|
|
name = os.path.basename(changeFileUrl)
|
|
name = os.path.basename(changeFileUrl)
|
|
n = name.split('.')
|
|
n = name.split('.')
|
|
areaName = n[0].replace('数据', '')
|
|
areaName = n[0].replace('数据', '')
|
|
# 新建文档
|
|
# 新建文档
|
|
doc = Document()
|
|
doc = Document()
|
|
|
|
+
|
|
|
|
+ # 获取文档的第一个节(默认新建文档只有一个节)
|
|
|
|
+ section = doc.sections[0]
|
|
|
|
+ # 设置页面方向为横向
|
|
|
|
+ new_width, new_height = section.page_height, section.page_width
|
|
|
|
+ section.orientation = WD_ORIENTATION.LANDSCAPE
|
|
|
|
+ section.page_width = new_width
|
|
|
|
+ section.page_height = new_height
|
|
|
|
+
|
|
# 添加标题
|
|
# 添加标题
|
|
doc.add_heading(f"{areaName}数据审核过程存疑数据一览表", level=0).bold = True
|
|
doc.add_heading(f"{areaName}数据审核过程存疑数据一览表", level=0).bold = True
|
|
table_1 = doc.add_table(rows=length + 1, cols=7, style='Light Shading Accent 1')
|
|
table_1 = doc.add_table(rows=length + 1, cols=7, style='Light Shading Accent 1')
|