GBData.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. using System.Collections.Generic;
  2. using System.Data;
  3. using OTSIncAReportApp.ReportTemplate;
  4. using OTSIncAReportApp.OTSSampleReportInfo;
  5. using System.Collections;
  6. namespace OTSIncAReportApp.OTSTemplateDesigner
  7. {
  8. public class GBData
  9. {
  10. #region 全局变量
  11. public OTSReport_Export m_otsreport_export;
  12. #endregion
  13. #region 构造函数
  14. public GBData(OTSReport_Export in_export)
  15. {
  16. m_otsreport_export = in_export;
  17. }
  18. #endregion
  19. /// <summary>
  20. /// 国标一
  21. /// </summary>
  22. /// <returns></returns>
  23. public List<DataTable> InsertReportTemplateTable_ChineseStandardABCDDS(OTSCLRINTERFACE.CPropParamClr cPropParamClr, List<string> datasourcelist , int DataSourceId ,int GB_index)
  24. {
  25. //得到国标一的DataTable表格
  26. cPropParamClr.SetDataSourceList(datasourcelist);
  27. cPropParamClr.SetDataSourceId(DataSourceId);//
  28. cPropParamClr.SetType((int)OTSSampleReportInfo.DisplayPicutureType.AnalyzeDataTable);//table
  29. cPropParamClr.SetCalTableType(GB_index);//国标1
  30. if (GB_index == (int)OTSSampleReportInfo.CALCULATE_TABLE_TYPE.GB_Method1)
  31. {
  32. List<OTSCLRINTERFACE.CGridDataClr> listGriddataclr = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr.GridDataTransfer(cPropParamClr);
  33. m_otsreport_export.m_ReportApp.im_ChineseStandardABCDDS = new OTSIncAReportGB.ChineseStandardABCDDS(m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr, listGriddataclr);
  34. m_otsreport_export.m_ReportApp.m_TablesWindow.Controls.Clear();
  35. return m_otsreport_export.m_ReportApp.im_ChineseStandardABCDDS.ChineseStandardABCD_GetDataTable(); ;
  36. }
  37. else
  38. {
  39. List<OTSCLRINTERFACE.CGridDataClr> listGriddataclr2 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr.GridDataTransfer(cPropParamClr);//
  40. m_otsreport_export.m_ReportApp.m_TablesWindow.Controls.Clear();
  41. m_otsreport_export.m_ReportApp.im_NationalStandardMethodTwo = new OTSIncAReportGB.NationalStandardMethodTwo(m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr, listGriddataclr2);
  42. return m_otsreport_export.m_ReportApp.im_NationalStandardMethodTwo.ChineseStandardABCD_GetDataTable();
  43. }
  44. }
  45. public void criterion_out(GBReport GB_Report, OTSReport_Export in_export,int Index, Hashtable table, bool gb_1,bool gb_2,bool AmericanStandard,bool GermanStandard)
  46. {
  47. //首页信息
  48. GB_Report = new GBReport(in_export, table);
  49. GB_Report.International_language();
  50. for (int i = 0; i < m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList.Count; i++)
  51. {
  52. string anothername = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[i].anotherFileName.ToString();
  53. string resultfile = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[i].FilePath.ToString() + "\\" + m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[i].FileName_real.ToString();
  54. m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr.AddASmplMsrResultMgr(resultfile, anothername);
  55. }
  56. List<string> datasourcelist = m_otsreport_export.m_ReportApp.m_conditionChoose.m_conditionData.GetComboDownListByItemName(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE);
  57. OTSCLRINTERFACE.CPropParamClr clr_prop = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr.GetPropertyParamTable();
  58. clr_prop.SetDataSourceList(datasourcelist);
  59. clr_prop.SetDataSourceId(Index);//
  60. clr_prop.SetCalTableType((int)CALCULATE_TABLE_TYPE.GB_Method1);
  61. clr_prop.SetType((int)DisplayPicutureType.AnalyzeDataTable);//table
  62. var tbl = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr.GetAllGBFields(clr_prop);
  63. GB_Report.setResultGrid(m_otsreport_export.m_mbszclass, tbl);
  64. if (gb_1)
  65. {
  66. List<DataTable> GB1 = InsertReportTemplateTable_ChineseStandardABCDDS(clr_prop, datasourcelist, Index, (int)CALCULATE_TABLE_TYPE.GB_Method1);
  67. DataView dv_gb1 = GB1[4].DefaultView;
  68. dv_gb1.Sort = "Grade desc";
  69. DataTable dt_gb1 = dv_gb1.ToTable();
  70. for (int i=0; i < GB1[4].Rows.Count;i++)
  71. {
  72. for(int a=0;a< GB1[4].Columns.Count;a++)
  73. {
  74. GB1[4].Rows[i][a] = dt_gb1.Rows[i][a];
  75. }
  76. }
  77. List<string> GB1NameList = new List<string>();
  78. GB1NameList.Add("A类");
  79. GB1NameList.Add("B类");
  80. GB1NameList.Add("C类");
  81. GB1NameList.Add("D类");
  82. GB1NameList.Add("DS类");
  83. GB_Report.set_GB_Method(GB1, GB1NameList, "方法一");
  84. }
  85. if (gb_2)
  86. {
  87. List<DataTable> GB2 = InsertReportTemplateTable_ChineseStandardABCDDS(clr_prop, datasourcelist, Index, (int)CALCULATE_TABLE_TYPE.GB_Method2);
  88. DataView dv_gb1 = GB2[5].DefaultView;
  89. dv_gb1.Sort = "Grade desc";
  90. DataTable dt_gb1 = dv_gb1.ToTable();
  91. for (int i = 0; i < GB2[5].Rows.Count; i++)
  92. {
  93. for (int a = 0; a < GB2[5].Columns.Count; a++)
  94. {
  95. GB2[5].Rows[i][a] = dt_gb1.Rows[i][a];
  96. }
  97. }
  98. List<string> GB2NameList = new List<string>();
  99. GB2NameList.Add("A类");
  100. GB2NameList.Add("B类");
  101. GB2NameList.Add("C类");
  102. GB2NameList.Add("D类");
  103. GB2NameList.Add("D硫化物类");
  104. GB2NameList.Add("DS类");
  105. GB_Report.set_GB_Method(GB2, GB2NameList, "方法二");
  106. }
  107. DevExpress.XtraReports.UI.ReportPrintTool tool = new DevExpress.XtraReports.UI.ReportPrintTool(GB_Report);
  108. tool.ShowPreview();
  109. }
  110. }
  111. }