MainForm.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using OTSINTERFACE;
  11. using OTSSysMgrTools;
  12. namespace OTSIncAReportGB
  13. {
  14. public partial class MainForm : Form
  15. {
  16. #region 全局变量
  17. public OTSINTERFACE.COTSReportProjFileMgrClr m_ReportProjFileMgr = new OTSINTERFACE.COTSReportProjFileMgrClr();
  18. string m_arg1 = "";
  19. string m_arg2 = "";
  20. #endregion
  21. public MainForm()
  22. {
  23. InitializeComponent();
  24. }
  25. public MainForm(string[] args)
  26. {
  27. InitializeComponent();
  28. if (args.Length == 0)
  29. {
  30. MessageBox.Show("请使用报告程序打开国标程序!");
  31. Application.Exit();
  32. return;
  33. }
  34. if (args.Length != 2)
  35. {
  36. string str = "";
  37. for (int i = 0; i < args.Length; i++)
  38. {
  39. str = str + "参数" + (i + 1).ToString() + ":" + args[i].ToString() + Environment.NewLine;
  40. }
  41. MessageBox.Show("传入的参数数量不正确,应为2个参数:" + Environment.NewLine + str);
  42. Application.Exit();
  43. return;
  44. }
  45. m_arg1 = args[0].Replace("^", " ");
  46. m_arg2 = args[1].Replace("^", " ");
  47. }
  48. private void Main_Load(object sender, EventArgs e)
  49. {
  50. //接收到测量结果路径,然后加载
  51. //测试相关代码
  52. bool bDebug = false;
  53. if (bDebug != false)
  54. {
  55. m_arg1 = "E:\\ResultFile\\test1\\Sample1\\Sample1.rst";
  56. m_arg2 = "DIN";
  57. }
  58. if (m_arg1 != "")
  59. {
  60. m_ReportProjFileMgr.AddASmplMsrResultMgr(m_arg1);
  61. m_ReportProjFileMgr.SetSelectedPicture(1);
  62. }
  63. if (m_arg2 == "GB1")
  64. {
  65. //国标一
  66. OTSINTERFACE.CPropParamClr clr_prop = m_ReportProjFileMgr.GetCurrentPropParam();
  67. clr_prop.SetDataSourceId(0);//
  68. clr_prop.SetType(1);//table
  69. clr_prop.SetCalTableType(6);//国标1
  70. List<OTSINTERFACE.CGridDataClr> listGriddataclr = m_ReportProjFileMgr.GridDataTransfer();
  71. ChineseStandardABCDDS m_ChineseStandardABCDDS = new ChineseStandardABCDDS(m_ReportProjFileMgr, listGriddataclr);
  72. this.panel1.Controls.Add(m_ChineseStandardABCDDS);
  73. this.Text = "国标一";
  74. }
  75. else if (m_arg2 == "GB2")
  76. {
  77. //国标二
  78. OTSINTERFACE.CPropParamClr clr_prop2 = m_ReportProjFileMgr.GetCurrentPropParam();
  79. clr_prop2.SetDataSourceId(0);//
  80. clr_prop2.SetType(1);//table
  81. clr_prop2.SetCalTableType(7);
  82. List<OTSINTERFACE.CGridDataClr> listGriddataclr2 = m_ReportProjFileMgr.GridDataTransfer();
  83. NationalStandardMethodTwo m_NationalStandardMethodTwo = new NationalStandardMethodTwo(m_ReportProjFileMgr, listGriddataclr2);
  84. this.panel1.Controls.Add(m_NationalStandardMethodTwo);
  85. this.Text = "国标二";
  86. }
  87. else if (m_arg2 == "ASTM")
  88. {
  89. //美标
  90. OTSINTERFACE.CPropParamClr clr_prop3 = m_ReportProjFileMgr.GetCurrentPropParam();
  91. clr_prop3.SetDataSourceId(0);//
  92. clr_prop3.SetType(1);//table
  93. clr_prop3.SetCalTableType(8);
  94. List<OTSINTERFACE.CGridDataClr> listGriddataclr3 = m_ReportProjFileMgr.GridDataTransfer();
  95. ASTMStandardABCDDS m_ASTMStandardABCDDS = new ASTMStandardABCDDS(m_ReportProjFileMgr, listGriddataclr3);
  96. this.panel1.Controls.Add(m_ASTMStandardABCDDS);
  97. this.Text = "美标";
  98. }
  99. else if (m_arg2 == "DIN")
  100. {
  101. //德标
  102. OTSINTERFACE.CPropParamClr clr_prop4 = m_ReportProjFileMgr.GetCurrentPropParam();
  103. clr_prop4.SetDataSourceId(0);//
  104. clr_prop4.SetType(1);//table
  105. clr_prop4.SetCalTableType(9);
  106. List<OTSINTERFACE.CGridDataClr> listGriddataclr4 = m_ReportProjFileMgr.GridDataTransfer();
  107. DINStandardABCDDS m_DINStandardABCDDS = new DINStandardABCDDS(m_ReportProjFileMgr, listGriddataclr4);
  108. this.panel1.Controls.Add(m_DINStandardABCDDS);
  109. this.Text = "德标";
  110. }
  111. }
  112. }
  113. }