Parcourir la source

12月29日晚更新:注释关于,涉及到了土壤质地(判断)

张世豪 il y a 1 mois
Parent
commit
a7e1d24d68
3 fichiers modifiés avec 51 ajouts et 50 suppressions
  1. 23 22
      index.py
  2. 24 24
      partReport.py
  3. 4 4
      report.py

+ 23 - 22
index.py

@@ -829,8 +829,8 @@ def getReport(originData,data,changeFileUrl, saveFileUrl, check_1_data,
     # del middData['原样品编号']
     # check_1_data = pd.merge(check_1_data,middData, how='left', on='编号')
     check_1_data = check_1_data.replace(np.nan,'')
-    typeNotSame = check_1_data[check_1_data['土壤质地'] != check_1_data['土壤质地(判断)']]
-    table_6_data = typeNotSame[['编号','样品编号', '土壤质地', '土壤质地(判断)']]
+    #typeNotSame = check_1_data[check_1_data['土壤质地'] != check_1_data['土壤质地(判断)']]
+    #table_6_data = typeNotSame[['编号','样品编号', '土壤质地', '土壤质地(判断)']]
 
     allNeedData = pd.DataFrame({})
     allNeedData['原样品编号'] = check_1_data['编号']
@@ -977,28 +977,28 @@ def getReport(originData,data,changeFileUrl, saveFileUrl, check_1_data,
     doc.add_heading('为避免数据量过多无法显示,请至数据保存文件夹中查看数据表:数据填报项审核结果.xlsx', level=4)
     doc.add_heading('4、土壤质地填报规范性审核', level=2)
     # 插入表6
-    paragraph_6 = doc.add_paragraph()
-    paragraph_6.add_run(f'表6:{areaName}土壤质地填报审核结果表').bold = True
-    table_6 = doc.add_table(rows=len(table_6_data)+1, cols=4, style='Light Shading Accent 1')
-    paragraph_6.alignment = WD_ALIGN_PARAGRAPH.CENTER
-    table_6.alignment = WD_TABLE_ALIGNMENT.CENTER
+    # paragraph_6 = doc.add_paragraph()
+    # paragraph_6.add_run(f'表6:{areaName}土壤质地填报审核结果表').bold = True
+    # table_6 = doc.add_table(rows=len(table_6_data)+1, cols=4, style='Light Shading Accent 1')
+    # paragraph_6.alignment = WD_ALIGN_PARAGRAPH.CENTER
+    # table_6.alignment = WD_TABLE_ALIGNMENT.CENTER
     # 提取结果表中数据
     # 写入数据 土壤质地类型不一致的数据提取出来
-    for i, row in enumerate(table_6.rows):
-        for j, cell in enumerate(row.cells):
-            # 获取单元格中的段落对象
-            paragraph = cell.paragraphs[0]
-            if i == 0:
-                r = paragraph.add_run(str(table_6_data.columns[j]))
-                r.font.bold = True
-            else:
-                r=paragraph.add_run(str(table_6_data.iloc[i-1, j]))
-            paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
-            paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
-            paragraph.paragraph_format.line_spacing = 1 # 段落行间距
-            r.font.size = Pt(10.5)
-            r.font.name = 'Times New Roman'
-            r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
+    # for i, row in enumerate(table_6.rows):
+    #     for j, cell in enumerate(row.cells):
+    #         # 获取单元格中的段落对象
+    #         paragraph = cell.paragraphs[0]
+    #         if i == 0:
+    #             r = paragraph.add_run(str(table_6_data.columns[j]))
+    #             r.font.bold = True
+    #         else:
+    #             r=paragraph.add_run(str(table_6_data.iloc[i-1, j]))
+    #         paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
+    #         paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
+    #         paragraph.paragraph_format.line_spacing = 1 # 段落行间距
+    #         r.font.size = Pt(10.5)
+    #         r.font.name = 'Times New Roman'
+    #         r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
     print(6)
     doc.add_heading('三、数据合理性审核', level=1)
     doc.add_heading('1、阈值法审核', level=2)
@@ -1997,6 +1997,7 @@ def saveFile():
             partReport.getConventionalNutrientIndicators(originData,dealDataRes,'常规养分指标', changeFileUrl, saveFileUrl, table_1_data, table_3_data, table_5_data,table_8_data,table_10_data,table_12_data,table_14_data)
             partReport.getChemicalIndicators(originData,dealDataRes,'一般化学性指标', changeFileUrl, saveFileUrl, table_1_data, table_3_data, table_5_data,table_8_data,table_10_data,table_12_data,table_14_data)
             partReport.getHeavyMetalIndicators(originData,dealDataRes,'重金属指标', changeFileUrl, saveFileUrl, table_1_data, table_3_data, table_5_data,table_8_data,table_10_data,table_12_data,table_14_data)
+            print("审核报告已生成!")
             show_info('审核报告已生成!')
     except Exception as err:
         print('err', err)

+ 24 - 24
partReport.py

@@ -368,8 +368,8 @@ def  getphysicsReport(originData, data,type, changeFileUrl, saveFileUrl, check_1
     #
     # check_1_data = pd.merge(check_1_data, middData, how='left', on='编号')
     check_1_data = check_1_data.replace(np.nan, '')
-    typeNotSame = check_1_data[check_1_data['土壤质地'] != check_1_data['土壤质地(判断)']]
-    table_6_data = typeNotSame[['编号', '样品编号', '土壤质地', '土壤质地(判断)']]
+    #typeNotSame = check_1_data[check_1_data['土壤质地'] != check_1_data['土壤质地(判断)']]
+    #table_6_data = typeNotSame[['编号', '样品编号', '土壤质地', '土壤质地(判断)']]
     allNeedData = pd.DataFrame({})
     allNeedData['原样品编号'] = check_1_data['编号']
     getSimpleDataNumber = pd.merge(allNeedData, physicsData[['原样品编号', '样品编号']], how='left', on="原样品编号")
@@ -558,28 +558,28 @@ def  getphysicsReport(originData, data,type, changeFileUrl, saveFileUrl, check_1
     doc.add_heading('为避免数据量过多无法显示,请至数据保存文件夹中查看数据表:数据填报项审核结果.xlsx', level=4)
     doc.add_heading('4、土壤质地填报规范性审核', level=2)
     # 插入表6
-    paragraph_6 = doc.add_paragraph()
-    paragraph_6.add_run(f'表6:{areaName}土壤质地填报审核结果表').bold = True
-    table_6 = doc.add_table(rows=len(table_6_data) + 1, cols=4, style='Light Shading Accent 1')
-    paragraph_6.alignment = WD_ALIGN_PARAGRAPH.CENTER
-    table_6.alignment = WD_TABLE_ALIGNMENT.CENTER
+    # paragraph_6 = doc.add_paragraph()
+    # paragraph_6.add_run(f'表6:{areaName}土壤质地填报审核结果表').bold = True
+    # table_6 = doc.add_table(rows=len(table_6_data) + 1, cols=4, style='Light Shading Accent 1')
+    # paragraph_6.alignment = WD_ALIGN_PARAGRAPH.CENTER
+    # table_6.alignment = WD_TABLE_ALIGNMENT.CENTER
     # 提取结果表中数据
     # 写入数据 土壤质地类型不一致的数据提取出来
-    for i, row in enumerate(table_6.rows):
-        for j, cell in enumerate(row.cells):
-            # 获取单元格中的段落对象
-            paragraph = cell.paragraphs[0]
-            if i == 0:
-                r = paragraph.add_run(str(table_6_data.columns[j]))
-                r.font.bold = True
-            else:
-                r = paragraph.add_run(str(table_6_data.iloc[i - 1, j]))
-            paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
-            paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
-            paragraph.paragraph_format.line_spacing = 1  # 段落行间距
-            r.font.size = Pt(10.5)
-            r.font.name = 'Times New Roman'
-            r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
+    # for i, row in enumerate(table_6.rows):
+    #     for j, cell in enumerate(row.cells):
+    #         # 获取单元格中的段落对象
+    #         paragraph = cell.paragraphs[0]
+    #         if i == 0:
+    #             r = paragraph.add_run(str(table_6_data.columns[j]))
+    #             r.font.bold = True
+    #         else:
+    #             r = paragraph.add_run(str(table_6_data.iloc[i - 1, j]))
+    #         paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
+    #         paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
+    #         paragraph.paragraph_format.line_spacing = 1  # 段落行间距
+    #         r.font.size = Pt(10.5)
+    #         r.font.name = 'Times New Roman'
+    #         r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
 
     doc.add_heading('三、数据合理性审核', level=1)
     long_text4 = """
@@ -1822,9 +1822,9 @@ def getChemicalIndicators(originData, data,type, changeFileUrl, saveFileUrl, che
     paragraph_t_12.alignment = WD_ALIGN_PARAGRAPH.CENTER
 
     if os.path.isfile(f'{mkdir_path}/离子总量与全盐量关系图.png'):
-        doc.add_picture(f'{mkdir_path}/离子总量与全盐量关系图.png', width=Inches(6.0))
+        doc.add_picture(f'{mkdir_path}/离子总量与全盐量关系图.png', width=Inches(6.0))
     paragraph_t_13 = doc.add_paragraph()
-    paragraph_t_13.add_run(f'图13:全盐量量与离子总量关系分析图').bold = True
+    paragraph_t_13.add_run(f'图13:离子总量与全盐量关系图').bold = True
     paragraph_t_13.alignment = WD_ALIGN_PARAGRAPH.CENTER
 
     # 这里添加新增的剖面数据指标 添加异常数据表和折线图

+ 4 - 4
report.py

@@ -104,14 +104,14 @@ def getInteractiveImg(x,y,label,x1,y1,label1,x2,y2,label2,url,name,xLabel,YLabel
     if len(x1) > 0 and len(y1) > 0:
         fig.add_trace(go.Scatter(x=x1, y=y1, mode='markers', name=label1, text=numArr.to_numpy(),
                                  marker=dict(
-                                    size=10,        # 点的大小
+                                    size=4,        # 点的大小
                                     color='red',    # 点的颜色
                                     symbol='hourglass'
                                 )))
     if len(x2) > 0 and len(y2) > 0:
         fig.add_trace(go.Scatter(x=x2, y=y2, mode='markers', name=label2, text=numArr.to_numpy(),
                                 marker=dict(
-                                    size=10,        # 点的大小
+                                    size=4,        # 点的大小
                                     color='green',    # 点的颜色
                                     symbol='triangle-up'  # 点的形状,这里设置为正方形
                                 )))
@@ -774,7 +774,7 @@ def getNAndC(data, url):
         text=data['原样品编号'].to_numpy(),
         mode='markers', name='有机质与全氮',
         marker=dict(
-            size=10,  # 点的大小
+            size=4,  # 点的大小
             color='blue',  # 点的颜色
         ))
     )
@@ -993,7 +993,7 @@ def manyTypes(data,url):
         text=data['原样品编号'].to_numpy(),
         mode='markers', name='全盐量与电导率相关关系',
         marker=dict(
-            size=10,  # 点的大小
+            size=4,  # 点的大小
             color='blue',  # 点的颜色
         ))
     )