NationalStandardMethodTwo.cs 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using OTSCLRINTERFACE;
  11. using System.Collections;
  12. using OTSCommon;
  13. namespace OTSIncAReportGB
  14. {
  15. public partial class NationalStandardMethodTwo : UserControl
  16. {
  17. #region 全局变量
  18. //设置数据表
  19. public DataTable m_dt_A = new DataTable();
  20. public DataTable m_dt_B = new DataTable();
  21. public DataTable m_dt_C = new DataTable();
  22. public DataTable m_dt_D = new DataTable();
  23. public DataTable m_dt_sulfide = new DataTable();
  24. public DataTable m_dt_DS = new DataTable();
  25. //底层相关,项目操作管理类
  26. CReportMgrClr m_ReportMgrClr = null;
  27. //获取从框架得到的底层计算结果,国标表A
  28. List<CGridDataClr> m_list_cgriddataclr_A = null;
  29. //获取从框架得到的底层计算结果,国标表B
  30. List<CGridDataClr> m_list_cgriddataclr_B = null;
  31. //获取从框架得到的底层计算结果,国标表C
  32. List<CGridDataClr> m_list_cgriddataclr_C = null;
  33. //获取从框架得到的底层计算结果,国标表D
  34. List<CGridDataClr> m_list_cgriddataclr_D = null;
  35. //获取从框架得到的底层计算结果,国标表D硫化物表
  36. List<CGridDataClr> m_list_cgriddataclr_sulfide = null;
  37. //获取从框架得到的底层计算结果,国标表DS
  38. List<CGridDataClr> m_list_cgriddataclr_DS = null;
  39. //定义一个组List
  40. List<CGridDataClr> m_list_ALLTwo = null;
  41. //接收底层数据
  42. public List<CGridDataClr> DataAll;
  43. //一个数据源包含几个列数的记录数
  44. private int m_oneresult_columnscount_A = 3;
  45. private int m_oneresult_columnscount_B = 3;
  46. private int m_oneresult_columnscount_C = 3;
  47. private int m_oneresult_columnscount_D = 3;
  48. private int m_oneresult_columnscount_sulfide = 3;
  49. private int m_oneresult_columnscount_DS = 3;
  50. string str_result = "";
  51. #endregion
  52. #region 自定义方法
  53. private void SetDataGridViewStyleAll()
  54. {
  55. //用户不能调整标题的高度
  56. Gview_gzA.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
  57. //用户不能调整 行高
  58. Gview_gzA.AllowUserToResizeRows = false;
  59. //改变行的高度;
  60. //Gview_gz.RowTemplate.Height = 20;
  61. //点击选择整行
  62. Gview_gzA.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
  63. //居中显示
  64. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
  65. dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  66. Gview_gzA.DefaultCellStyle = dataGridViewCellStyle1;
  67. Gview_gzA.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  68. //再次重覆禁用拖动表头高度,居然有效果了
  69. Gview_gzA.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
  70. //设置grid可以复制
  71. Gview_gzA.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
  72. }
  73. /// <summary>
  74. /// 设置DataGridView样式,B类表
  75. /// </summary>
  76. private void SetDataGridViewStyleB()
  77. {
  78. //用户不能调整标题的高度
  79. Gview_gzB.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
  80. //用户不能调整 行高
  81. Gview_gzB.AllowUserToResizeRows = false;
  82. //改变行的高度;
  83. //Gview_gz.RowTemplate.Height = 20;
  84. //点击选择整行
  85. Gview_gzB.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
  86. //居中显示
  87. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
  88. dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  89. Gview_gzB.DefaultCellStyle = dataGridViewCellStyle1;
  90. Gview_gzB.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  91. //再次重覆禁用拖动表头高度,居然有效果了
  92. Gview_gzB.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
  93. //设置grid可以复制
  94. Gview_gzB.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
  95. //设置每列的宽度
  96. Gview_gzB.Columns[0].Width = 40;//第一列序号的宽度设置一下吧,要不太丑
  97. //设置序号列不排序
  98. Gview_gzB.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
  99. //设置序号列不可以设置宽度
  100. Gview_gzB.Columns[0].Resizable = DataGridViewTriState.False;
  101. }
  102. /// <summary>
  103. /// 设置DataGridView样式,C类表
  104. /// </summary>
  105. private void SetDataGridViewStyleC()
  106. {
  107. //用户不能调整标题的高度
  108. Gview_gzC.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
  109. //用户不能调整 行高
  110. Gview_gzC.AllowUserToResizeRows = false;
  111. //改变行的高度;
  112. //Gview_gz.RowTemplate.Height = 20;
  113. //点击选择整行
  114. Gview_gzC.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
  115. //居中显示
  116. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
  117. dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  118. Gview_gzC.DefaultCellStyle = dataGridViewCellStyle1;
  119. Gview_gzC.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  120. //再次重覆禁用拖动表头高度,居然有效果了
  121. Gview_gzC.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
  122. //设置grid可以复制
  123. Gview_gzC.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
  124. //设置每列的宽度
  125. Gview_gzC.Columns[0].Width = 40;//第一列序号的宽度设置一下吧,要不太丑
  126. //设置序号列不排序
  127. Gview_gzC.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
  128. //设置序号列不可以设置宽度
  129. Gview_gzC.Columns[0].Resizable = DataGridViewTriState.False;
  130. }
  131. /// <summary>
  132. /// 设置DataGridView样式,D类表
  133. /// </summary>
  134. private void SetDataGridViewStyleD()
  135. {
  136. //用户不能调整标题的高度
  137. Gview_gzD.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
  138. //用户不能调整 行高
  139. Gview_gzD.AllowUserToResizeRows = false;
  140. //改变行的高度;
  141. //Gview_gz.RowTemplate.Height = 20;
  142. //点击选择整行
  143. Gview_gzD.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
  144. //居中显示
  145. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
  146. dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  147. Gview_gzD.DefaultCellStyle = dataGridViewCellStyle1;
  148. Gview_gzD.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  149. //再次重覆禁用拖动表头高度,居然有效果了
  150. Gview_gzD.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
  151. //设置grid可以复制
  152. Gview_gzD.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
  153. //设置每列的宽度
  154. Gview_gzD.Columns[0].Width = 40;//第一列序号的宽度设置一下吧,要不太丑
  155. //设置序号列不排序
  156. Gview_gzD.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
  157. //设置序号列不可以设置宽度
  158. Gview_gzD.Columns[0].Resizable = DataGridViewTriState.False;
  159. }
  160. /// <summary>
  161. /// 设置DataGridView样式,DS类表
  162. /// </summary>
  163. private void SetDataGridViewStyleDS()
  164. {
  165. //用户不能调整标题的高度
  166. Gview_gzDS.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
  167. //用户不能调整 行高
  168. Gview_gzDS.AllowUserToResizeRows = false;
  169. //改变行的高度;
  170. //Gview_gz.RowTemplate.Height = 20;
  171. //点击选择整行
  172. Gview_gzDS.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
  173. //居中显示
  174. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
  175. dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  176. Gview_gzDS.DefaultCellStyle = dataGridViewCellStyle1;
  177. Gview_gzDS.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  178. //再次重覆禁用拖动表头高度,居然有效果了
  179. Gview_gzDS.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
  180. //设置grid可以复制
  181. Gview_gzDS.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
  182. //设置每列的宽度
  183. Gview_gzDS.Columns[0].Width = 40;//第一列序号的宽度设置一下吧,要不太丑
  184. //设置序号列不排序
  185. Gview_gzDS.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
  186. //设置序号列不可以设置宽度
  187. Gview_gzDS.Columns[0].Resizable = DataGridViewTriState.False;
  188. }
  189. #endregion
  190. #region 窗体加载及初始化
  191. public NationalStandardMethodTwo()
  192. {
  193. InitializeComponent();
  194. }
  195. /// <summary>
  196. /// 国标报表,构造函数,接收A,B,C,D,DS五种结果,并进行显示
  197. /// </summary>
  198. /// <param name="in_sec"></param>
  199. /// <param name="in_Cotsreportprojfilemgrclr"></param>
  200. /// <param name="in_list_CGridDataClrAll"></param> //all 代表A、B、C、D、DS按顺序得表
  201. public string ColumnName;
  202. public string RowName;
  203. #region 国际化语言
  204. Language lan;
  205. Hashtable table;
  206. #endregion
  207. public NationalStandardMethodTwo(CReportMgrClr in_Cotsreportprojfilemgrclr, List<CGridDataClr> in_list_CGridDataClrAll)
  208. {
  209. DataAll = in_list_CGridDataClrAll;
  210. //获取报告项目类对象
  211. m_ReportMgrClr = in_Cotsreportprojfilemgrclr;
  212. m_list_cgriddataclr_A = in_list_CGridDataClrAll.GetRange(0, 1);
  213. m_list_cgriddataclr_B = in_list_CGridDataClrAll.GetRange(1, 1);
  214. m_list_cgriddataclr_C = in_list_CGridDataClrAll.GetRange(2, 1);
  215. m_list_cgriddataclr_D = in_list_CGridDataClrAll.GetRange(3, 1);
  216. m_list_cgriddataclr_sulfide = in_list_CGridDataClrAll.GetRange(4, 1);
  217. m_list_cgriddataclr_DS = in_list_CGridDataClrAll.GetRange(5, 1);
  218. m_list_ALLTwo = in_list_CGridDataClrAll;
  219. InitializeComponent();
  220. #region 国际化语言
  221. lan = new Language(this);
  222. table = lan.GetNameTable(this.Name);
  223. #endregion
  224. log_1.Text = "";
  225. log_2.Text = "";
  226. log_3.Text = "";
  227. log_4.Text = "";
  228. log_5.Text = "";
  229. //log_6.Text = "";
  230. log_1_1.Text = "";
  231. log_2_1.Text = "";
  232. log_3_1.Text = "";
  233. log_4_1.Text = "";
  234. log_5_1.Text = "";
  235. //log_6_1.Text = "";
  236. }
  237. private void NationalStandardMethodTwo_Load(object sender, EventArgs e)
  238. {
  239. //从底层结果类对象中,分解出数据保存到datatable中
  240. if (m_list_ALLTwo.Count > 7)
  241. {
  242. int SouseData = (m_ReportMgrClr.GetSmplMsrResultMgrs().Count) * 7;
  243. for (int g = 0; g < m_ReportMgrClr.GetSmplMsrResultMgrs().Count; g++)
  244. {
  245. for (int i = 0; i < 6; i++)
  246. {
  247. DataTable dt = new DataTable();
  248. DataColumn cc = new DataColumn();
  249. int q = g * 7 + i;
  250. dt = ChineseStandardABCD_GetDataTable_Total(DataAll.GetRange(q, 1), out m_oneresult_columnscount_A);
  251. DataGridView aa = new DataGridView();
  252. int start = 68;
  253. int end = 0;
  254. end = 150 * q;
  255. aa.Location = new Point(start, end);
  256. aa.Width = panel1.Width;
  257. aa.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
  258. aa.BackgroundColor = Color.White;
  259. panel1.Controls.Add(aa);
  260. aa.DataSource = dt;
  261. aa.Name = i.ToString();
  262. Label bb = new Label();
  263. int startLabel = 0;
  264. int endLabel = 0;
  265. endLabel = 150 * q;
  266. bb.Location = new Point(startLabel, endLabel);
  267. bb.Width = 75;
  268. for (int t = 0; t < SouseData; t++)
  269. {
  270. if (i == t * 6)
  271. {
  272. bb.Text = table["label1"].ToString();
  273. break;
  274. }
  275. if (i == t * 6 + 1)
  276. {
  277. bb.Text = table["label2"].ToString();
  278. }
  279. if (i == t * 6 + 2)
  280. {
  281. bb.Text = table["label3"].ToString();
  282. }
  283. if (i == t * 6 + 3)
  284. {
  285. bb.Text = table["label4"].ToString();
  286. }
  287. if (i == t * 6 + 4)
  288. {
  289. bb.Text = table["label5"].ToString();
  290. }
  291. if (i == t * 6 + 5)
  292. {
  293. bb.Text = table["label6"].ToString();
  294. }
  295. }
  296. bb.Font = new Font(bb.Font.Name, 12, FontStyle.Bold | FontStyle.Underline);
  297. panel1.Controls.Add(bb);
  298. }
  299. }
  300. Gview_gzA.Visible = false;
  301. Gview_gzB.Visible = false;
  302. Gview_gzC.Visible = false;
  303. Gview_gzD.Visible = false;
  304. sulfide.Visible = false;
  305. Gview_gzDS.Visible = false;
  306. label1.Visible = false;
  307. label2.Visible = false;
  308. label3.Visible = false;
  309. label4.Visible = false;
  310. label5.Visible = false;
  311. label6.Visible = false;
  312. Invalidate();
  313. }
  314. else
  315. {
  316. m_dt_A = ChineseStandardABCD_GetDataTable_Total(m_list_cgriddataclr_A, out m_oneresult_columnscount_A);
  317. m_dt_B = ChineseStandardABCD_GetDataTable_Total(m_list_cgriddataclr_B, out m_oneresult_columnscount_B);
  318. m_dt_C = ChineseStandardABCD_GetDataTable_Total(m_list_cgriddataclr_C, out m_oneresult_columnscount_C);
  319. m_dt_D = ChineseStandardABCD_GetDataTable_Total(m_list_cgriddataclr_D, out m_oneresult_columnscount_D);
  320. m_dt_sulfide = ChineseStandardABCD_GetDataTable_Total(m_list_cgriddataclr_sulfide, out m_oneresult_columnscount_sulfide);
  321. m_dt_DS = ChineseStandardABCD_GetDataTable_Total(m_list_cgriddataclr_DS, out m_oneresult_columnscount_DS);
  322. DataView dv = m_dt_DS.DefaultView;
  323. dv.Sort = "Grade desc";
  324. DataTable dt_DS_data = dv.ToTable();
  325. Gview_gzA.DataSource = m_dt_A;
  326. for (int i = 0; i < 13; i++)
  327. {
  328. Gview_gzA.Columns[i].Width = 68;
  329. }
  330. Gview_gzB.DataSource = m_dt_B;
  331. for (int i = 0; i < 13; i++)
  332. {
  333. Gview_gzB.Columns[i].Width = 68;
  334. }
  335. Gview_gzC.DataSource = m_dt_C;
  336. for (int i = 0; i < 13; i++)
  337. {
  338. Gview_gzC.Columns[i].Width = 68;
  339. }
  340. Gview_gzD.DataSource = m_dt_D;
  341. for (int i = 0; i < 13; i++)
  342. {
  343. Gview_gzD.Columns[i].Width = 68;
  344. }
  345. sulfide.DataSource = m_dt_sulfide;
  346. for (int i = 0; i < 13; i++)
  347. {
  348. sulfide.Columns[i].Width = 68;
  349. }
  350. Gview_gzDS.DataSource = dt_DS_data;
  351. Gview_gzA.Width = panel1.Width;
  352. Gview_gzB.Width = panel1.Width;
  353. Gview_gzC.Width = panel1.Width;
  354. Gview_gzD.Width = panel1.Width;
  355. sulfide.Width = panel1.Width;
  356. Gview_gzDS.Width = panel1.Width;
  357. int it = 0;
  358. if(DetermineWhetherImprovementIsNeeded("A类", m_dt_A))
  359. {
  360. str_result = str_result + "夹杂物评级达到2.0:表明钢中的MnS或硫化物夹杂物控制不够理想。" +
  361. "针对这一问题,我们建议您在相关工艺上进行优化和改进。";
  362. LabelAssignment(it);
  363. it++;
  364. str_result = "";
  365. }
  366. if(DetermineWhetherImprovementIsNeeded("B类", m_dt_B))
  367. {
  368. str_result = str_result + "夹杂物评级达到2.0:表明钢中的铝酸盐或其他不变形氧化物夹杂物控制不够理想。" +
  369. "针对这一问题,我们建议您在相关工艺上进行优化和改进。";
  370. LabelAssignment(it);
  371. it++;
  372. str_result = "";
  373. }
  374. if(DetermineWhetherImprovementIsNeeded("C类", m_dt_C))
  375. {
  376. str_result = str_result + "夹杂物评级达到2.0:表明钢中的硅酸盐过其他可变性氧化物夹杂物控制不够理想。" +
  377. "针对这一问题,我们建议您在相关工艺上进行优化和改进。";
  378. LabelAssignment(it);
  379. it++;
  380. str_result = "";
  381. }
  382. if (DetermineWhetherImprovementIsNeeded("D类", m_dt_D))
  383. {
  384. str_result = str_result + "夹杂物评级达到2.0:表明钢中的单颗粒球状氧化物夹杂物控制不够理想。" +
  385. "针对这一问题,我们建议您在相关工艺上进行优化和改进。";
  386. LabelAssignment(it);
  387. it++;
  388. str_result = "";
  389. }
  390. if (DetermineWhetherImprovementIsNeeded("D硫化物类", m_dt_sulfide))
  391. {
  392. str_result = str_result + "夹杂物评级达到2.0:表明钢中的球状硫化物夹杂物控制不够理想。" +
  393. "针对这一问题,我们建议您在相关工艺上进行优化和改进。";
  394. LabelAssignment(it);
  395. it++;
  396. str_result = "";
  397. }
  398. }
  399. Invalidate();
  400. }
  401. private void LabelAssignment(int it)
  402. {
  403. if (it == 0)
  404. {
  405. log_1.Text = str_result;
  406. log_1_1.Text = "为了获取更具体的改进措施,您可以随时联系我们公司的软件售后服务团队," +
  407. "我们的炼钢工艺专家将为您提供专业的建议和支持。";
  408. }
  409. else if (it == 1)
  410. {
  411. log_2.Text = str_result;
  412. log_2_1.Text = "为了获取更具体的改进措施,您可以随时联系我们公司的软件售后服务团队," +
  413. "我们的炼钢工艺专家将为您提供专业的建议和支持。";
  414. }
  415. else if (it == 2)
  416. {
  417. log_3.Text = str_result;
  418. log_3_1.Text = "为了获取更具体的改进措施,您可以随时联系我们公司的软件售后服务团队," +
  419. "我们的炼钢工艺专家将为您提供专业的建议和支持。";
  420. }
  421. else if (it == 3)
  422. {
  423. log_4.Text = str_result;
  424. log_4_1.Text = "为了获取更具体的改进措施,您可以随时联系我们公司的软件售后服务团队," +
  425. "我们的炼钢工艺专家将为您提供专业的建议和支持。";
  426. }
  427. else if (it == 4)
  428. {
  429. log_5.Text = str_result;
  430. log_5_1.Text = "为了获取更具体的改进措施,您可以随时联系我们公司的软件售后服务团队," +
  431. "我们的炼钢工艺专家将为您提供专业的建议和支持。";
  432. }
  433. }
  434. private bool DetermineWhetherImprovementIsNeeded(string str, DataTable data)
  435. {
  436. string Thin = ""; string Thick = ""; string OverSize = "";
  437. for (int i = 6; i < data.Columns.Count; i++)
  438. {
  439. if (Convert.ToInt32(data.Rows[0][i]) > 0)
  440. {
  441. Thin = "细系";
  442. }
  443. if (Convert.ToInt32(data.Rows[1][i]) > 0)
  444. {
  445. Thick = "粗系";
  446. }
  447. if (Convert.ToInt32(data.Rows[2][i]) > 0)
  448. {
  449. OverSize = "超尺寸";
  450. }
  451. }
  452. if (Thin != "" || Thick != "" || OverSize != "")
  453. {
  454. str_result = str + "的" + Thin + Thick + OverSize;
  455. return true;
  456. }
  457. return false;
  458. }
  459. #endregion
  460. #region 相关事件
  461. /// <summary>
  462. /// 复制选择区域,A
  463. /// </summary>
  464. public void CopySelected_A()
  465. {
  466. //复制选择区域
  467. object oo = Gview_gzA.GetClipboardContent();
  468. Clipboard.SetDataObject(Gview_gzA.GetClipboardContent());
  469. }
  470. /// <summary>
  471. /// 复制选择区域,B
  472. /// </summary>
  473. public void CopySelected_B()
  474. {
  475. //复制选择区域
  476. object oo = Gview_gzB.GetClipboardContent();
  477. Clipboard.SetDataObject(Gview_gzA.GetClipboardContent());
  478. }
  479. /// <summary>
  480. /// 复制选择区域,C
  481. /// </summary>
  482. public void CopySelected_C()
  483. {
  484. //复制选择区域
  485. object oo = Gview_gzC.GetClipboardContent();
  486. Clipboard.SetDataObject(Gview_gzA.GetClipboardContent());
  487. }
  488. /// <summary>
  489. /// 复制选择区域,D
  490. /// </summary>
  491. public void CopySelected_D()
  492. {
  493. //复制选择区域
  494. object oo = Gview_gzD.GetClipboardContent();
  495. Clipboard.SetDataObject(Gview_gzA.GetClipboardContent());
  496. }
  497. /// <summary>
  498. /// 复制选择区域,DS
  499. /// </summary>
  500. public void CopySelected_DS()
  501. {
  502. //复制选择区域
  503. object oo = Gview_gzDS.GetClipboardContent();
  504. Clipboard.SetDataObject(Gview_gzA.GetClipboardContent());
  505. }
  506. /// <summary>
  507. /// 复制所有,A
  508. /// </summary>
  509. public void CopyAll_A()
  510. {
  511. Gview_gzA.SelectAll();
  512. Clipboard.SetDataObject(Gview_gzA.GetClipboardContent());
  513. }
  514. /// <summary>
  515. /// 复制所有,B
  516. /// </summary>
  517. public void CopyAll_B()
  518. {
  519. Gview_gzB.SelectAll();
  520. Clipboard.SetDataObject(Gview_gzB.GetClipboardContent());
  521. }
  522. /// <summary>
  523. /// 复制所有,C
  524. /// </summary>
  525. public void CopyAll_C()
  526. {
  527. Gview_gzC.SelectAll();
  528. Clipboard.SetDataObject(Gview_gzC.GetClipboardContent());
  529. }
  530. /// <summary>
  531. /// 复制所有,D
  532. /// </summary>
  533. public void CopyAll_D()
  534. {
  535. Gview_gzD.SelectAll();
  536. Clipboard.SetDataObject(Gview_gzD.GetClipboardContent());
  537. }
  538. /// <summary>
  539. /// 复制所有,DS
  540. /// </summary>
  541. public void CopyAll_DS()
  542. {
  543. Gview_gzDS.SelectAll();
  544. Clipboard.SetDataObject(Gview_gzDS.GetClipboardContent());
  545. }
  546. private void Gview_gzA_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
  547. {
  548. //排序中
  549. if (this.Gview_gzA.Rows[e.RowIndex1].Tag != null && this.Gview_gzA.Rows[e.RowIndex1].Tag.ToString() == "统计行")
  550. {
  551. //ROW1>ROW2
  552. e.SortResult = 1;
  553. if (this.Gview_gzA.SortOrder == SortOrder.Descending)
  554. e.SortResult = -1;
  555. e.Handled = true;
  556. return;
  557. }
  558. if (this.Gview_gzA.Rows[e.RowIndex2].Tag != null && this.Gview_gzA.Rows[e.RowIndex2].Tag.ToString() == "统计行")
  559. {
  560. //ROW1<ROW2
  561. e.SortResult = -1;
  562. if (this.Gview_gzA.SortOrder == SortOrder.Descending)
  563. e.SortResult = 1;
  564. e.Handled = true;
  565. return;
  566. }
  567. }
  568. private void Gview_gzA_Sorted(object sender, EventArgs e)
  569. {
  570. //排序完成,重新设置序号
  571. for (int i = 0; i < Gview_gzA.Rows.Count; i++)
  572. {
  573. if (Gview_gzA.Rows[i].Tag != null && this.Gview_gzA.Rows[i].Tag.ToString() == "统计行")
  574. { }
  575. else
  576. {
  577. Gview_gzA.Rows[i].Cells[0].Value = i.ToString();
  578. }
  579. }
  580. }
  581. private void Gview_gzB_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
  582. {
  583. //排序中
  584. if (this.Gview_gzB.Rows[e.RowIndex1].Tag != null && this.Gview_gzB.Rows[e.RowIndex1].Tag.ToString() == "统计行")
  585. {
  586. //ROW1>ROW2
  587. e.SortResult = 1;
  588. if (this.Gview_gzB.SortOrder == SortOrder.Descending)
  589. e.SortResult = -1;
  590. e.Handled = true;
  591. return;
  592. }
  593. if (this.Gview_gzB.Rows[e.RowIndex2].Tag != null && this.Gview_gzB.Rows[e.RowIndex2].Tag.ToString() == "统计行")
  594. {
  595. //ROW1<ROW2
  596. e.SortResult = -1;
  597. if (this.Gview_gzB.SortOrder == SortOrder.Descending)
  598. e.SortResult = 1;
  599. e.Handled = true;
  600. return;
  601. }
  602. }
  603. private void Gview_gzB_Sorted(object sender, EventArgs e)
  604. {
  605. //排序完成,重新设置序号
  606. for (int i = 0; i < Gview_gzB.Rows.Count; i++)
  607. {
  608. if (Gview_gzB.Rows[i].Tag != null && this.Gview_gzB.Rows[i].Tag.ToString() == "统计行")
  609. { }
  610. else
  611. {
  612. Gview_gzB.Rows[i].Cells[0].Value = i.ToString();
  613. }
  614. }
  615. }
  616. private void Gview_gzC_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
  617. {
  618. //排序中
  619. if (this.Gview_gzC.Rows[e.RowIndex1].Tag != null && this.Gview_gzC.Rows[e.RowIndex1].Tag.ToString() == "统计行")
  620. {
  621. //ROW1>ROW2
  622. e.SortResult = 1;
  623. if (this.Gview_gzC.SortOrder == SortOrder.Descending)
  624. e.SortResult = -1;
  625. e.Handled = true;
  626. return;
  627. }
  628. if (this.Gview_gzC.Rows[e.RowIndex2].Tag != null && this.Gview_gzC.Rows[e.RowIndex2].Tag.ToString() == "统计行")
  629. {
  630. //ROW1<ROW2
  631. e.SortResult = -1;
  632. if (this.Gview_gzC.SortOrder == SortOrder.Descending)
  633. e.SortResult = 1;
  634. e.Handled = true;
  635. return;
  636. }
  637. }
  638. private void Gview_gzC_Sorted(object sender, EventArgs e)
  639. {
  640. //排序完成,重新设置序号
  641. for (int i = 0; i < Gview_gzC.Rows.Count; i++)
  642. {
  643. if (Gview_gzC.Rows[i].Tag != null && this.Gview_gzC.Rows[i].Tag.ToString() == "统计行")
  644. { }
  645. else
  646. {
  647. Gview_gzC.Rows[i].Cells[0].Value = i.ToString();
  648. }
  649. }
  650. }
  651. private void Gview_gzD_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
  652. {
  653. //排序中
  654. if (this.Gview_gzD.Rows[e.RowIndex1].Tag != null && this.Gview_gzD.Rows[e.RowIndex1].Tag.ToString() == "统计行")
  655. {
  656. //ROW1>ROW2
  657. e.SortResult = 1;
  658. if (this.Gview_gzD.SortOrder == SortOrder.Descending)
  659. e.SortResult = -1;
  660. e.Handled = true;
  661. return;
  662. }
  663. if (this.Gview_gzD.Rows[e.RowIndex2].Tag != null && this.Gview_gzD.Rows[e.RowIndex2].Tag.ToString() == "统计行")
  664. {
  665. //ROW1<ROW2
  666. e.SortResult = -1;
  667. if (this.Gview_gzD.SortOrder == SortOrder.Descending)
  668. e.SortResult = 1;
  669. e.Handled = true;
  670. return;
  671. }
  672. }
  673. private void Gview_gzD_Sorted(object sender, EventArgs e)
  674. {
  675. //排序完成,重新设置序号
  676. for (int i = 0; i < Gview_gzD.Rows.Count; i++)
  677. {
  678. if (Gview_gzD.Rows[i].Tag != null && this.Gview_gzD.Rows[i].Tag.ToString() == "统计行")
  679. { }
  680. else
  681. {
  682. Gview_gzD.Rows[i].Cells[0].Value = i.ToString();
  683. }
  684. }
  685. }
  686. private void Gview_gzDS_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
  687. {
  688. //排序中
  689. if (this.Gview_gzDS.Rows[e.RowIndex1].Tag != null && this.Gview_gzDS.Rows[e.RowIndex1].Tag.ToString() == "统计行")
  690. {
  691. //ROW1>ROW2
  692. e.SortResult = 1;
  693. if (this.Gview_gzDS.SortOrder == SortOrder.Descending)
  694. e.SortResult = -1;
  695. e.Handled = true;
  696. return;
  697. }
  698. if (this.Gview_gzDS.Rows[e.RowIndex2].Tag != null && this.Gview_gzDS.Rows[e.RowIndex2].Tag.ToString() == "统计行")
  699. {
  700. //ROW1<ROW2
  701. e.SortResult = -1;
  702. if (this.Gview_gzDS.SortOrder == SortOrder.Descending)
  703. e.SortResult = 1;
  704. e.Handled = true;
  705. return;
  706. }
  707. }
  708. private void Gview_gzDS_Sorted(object sender, EventArgs e)
  709. {
  710. //排序完成,重新设置序号
  711. for (int i = 0; i < Gview_gzDS.Rows.Count; i++)
  712. {
  713. if (Gview_gzDS.Rows[i].Tag != null && this.Gview_gzDS.Rows[i].Tag.ToString() == "统计行")
  714. { }
  715. else
  716. {
  717. Gview_gzDS.Rows[i].Cells[0].Value = i.ToString();
  718. }
  719. }
  720. }
  721. private void ToolStripMenuItem1_Click(object sender, EventArgs e)
  722. {
  723. //A,复制整个表
  724. CopyAll_A();
  725. }
  726. private void ToolStripMenuItem2_Click(object sender, EventArgs e)
  727. {
  728. //A,复制选择区域
  729. CopySelected_A();
  730. }
  731. private void toolStripMenuItem4_Click(object sender, EventArgs e)
  732. {
  733. //B,复制整个表
  734. CopyAll_B();
  735. }
  736. private void toolStripMenuItem5_Click(object sender, EventArgs e)
  737. {
  738. //B,复制选择区域
  739. CopySelected_B();
  740. }
  741. private void toolStripMenuItem7_Click(object sender, EventArgs e)
  742. {
  743. //C,复制整个表
  744. CopyAll_C();
  745. }
  746. private void toolStripMenuItem8_Click(object sender, EventArgs e)
  747. {
  748. //C,复制选择区域
  749. CopySelected_C();
  750. }
  751. private void toolStripMenuItem10_Click(object sender, EventArgs e)
  752. {
  753. //D,复制整个表
  754. CopyAll_D();
  755. }
  756. private void toolStripMenuItem11_Click(object sender, EventArgs e)
  757. {
  758. //D,复制选择区域
  759. CopySelected_D();
  760. }
  761. private void toolStripMenuItem13_Click(object sender, EventArgs e)
  762. {
  763. //DS,复制整个表
  764. CopyAll_DS();
  765. }
  766. private void toolStripMenuItem14_Click(object sender, EventArgs e)
  767. {
  768. //DS,复制选择区域
  769. CopySelected_DS();
  770. }
  771. #endregion
  772. #region 获取向导出模块提供的DataTable和GridView对象
  773. /// <summary>
  774. /// 获取到该模块输出后形成的DataTable,和GridView
  775. /// </summary>
  776. /// <param name="out_dt"></param>
  777. /// <param name="out_dg"></param>
  778. public void GetDataTableAndGridView(out DataTable out_dtA, out DataTable out_dtB, out DataTable out_dtC, out DataTable out_dtD, out DataTable out_dt_sulfide, out DataTable out_dtDS,
  779. out DataGridView out_dgA, out DataGridView out_dgB, out DataGridView out_dgC, out DataGridView out_dgD, out DataGridView out_dgsulfide, out DataGridView out_dgDS)
  780. {
  781. //从panel中找出前5个datagridview,然后进行输出
  782. foreach (Control ctl in this.panel1.Controls)
  783. {
  784. if (ctl.Name == "0")
  785. {
  786. this.Gview_gzA = (DataGridView)ctl;
  787. }
  788. if (ctl.Name == "1")
  789. {
  790. this.Gview_gzB = (DataGridView)ctl;
  791. }
  792. if (ctl.Name == "2")
  793. {
  794. this.Gview_gzC = (DataGridView)ctl;
  795. }
  796. if (ctl.Name == "3")
  797. {
  798. this.Gview_gzD = (DataGridView)ctl;
  799. }
  800. if (ctl.Name == "4")
  801. {
  802. this.sulfide = (DataGridView)ctl;
  803. }
  804. if (ctl.Name == "5")
  805. {
  806. this.Gview_gzDS = (DataGridView)ctl;
  807. }
  808. }
  809. out_dtA = m_dt_A;
  810. out_dgA = this.Gview_gzA;
  811. out_dtB = m_dt_B;
  812. out_dgB = this.Gview_gzB;
  813. out_dtC = m_dt_C;
  814. out_dgC = this.Gview_gzC;
  815. out_dtD = m_dt_D;
  816. out_dgD = this.Gview_gzD;
  817. out_dt_sulfide = m_dt_sulfide;
  818. out_dgsulfide = this.sulfide;
  819. out_dtDS = m_dt_DS;
  820. out_dgDS = this.Gview_gzDS;
  821. }
  822. #endregion
  823. #region clr加载数据部分
  824. public DataTable ChineseStandardABCD_GetDataTable_Total(List<CGridDataClr> in_list_cgriddataclr, out int oneresult_columncount)
  825. {
  826. oneresult_columncount = 1;//一个数据源的跨度,计算出一个数据源包含几个列
  827. //创建一个临时表
  828. DataTable ret_dt = new DataTable();
  829. //判断传入的数据对象是否为空
  830. if (in_list_cgriddataclr == null)
  831. {
  832. string str1 = "传入分解表格数据的CGridDataClr对象为空!";
  833. str1 = table["str1"].ToString();
  834. //log.Error("(OTSIncAReportGridsFun.ChineseStandardABCD_GetDataTable_Total)" + str1);
  835. return ret_dt;
  836. }
  837. #region 根据返回的结构创建DataTable的结构---------------------------------------------
  838. for (int i = 0; i < in_list_cgriddataclr.Count(); i++)
  839. {
  840. //分解结果内容
  841. List<CGridColumnClr> list_cgridcolumnclrs = new List<CGridColumnClr>();
  842. list_cgridcolumnclrs = in_list_cgriddataclr[i].GetGridColumnList(); //获取各列
  843. //单个数据源包含几个列的跨度
  844. if (oneresult_columncount < list_cgridcolumnclrs.Count())
  845. oneresult_columncount = list_cgridcolumnclrs.Count();
  846. if (in_list_cgriddataclr.Count > 1)
  847. {
  848. //创建DT的列,多个数据源,为每个字段带上索引号
  849. foreach (CGridColumnClr ls_cgridcolumnclr in list_cgridcolumnclrs)
  850. {
  851. string ls_fl_strName = ls_cgridcolumnclr.GetName();
  852. //通过获取到的列,创建表的列
  853. ret_dt.Columns.Add(ls_fl_strName + "(" + (i + 1).ToString() + ")");
  854. }
  855. }
  856. else
  857. {
  858. //创建DT的列,单个数据源,不带索引号
  859. foreach (CGridColumnClr ls_cgridcolumnclr in list_cgridcolumnclrs)
  860. {
  861. string ls_fl_strName = ls_cgridcolumnclr.GetName();
  862. //通过获取到的列,创建表的列
  863. ret_dt.Columns.Add(ls_fl_strName);
  864. }
  865. }
  866. }
  867. #endregion
  868. #region 再创建表的行------------------------------------------------------------------
  869. //取最大的rowlistcount,要不然,不知道这底层返回的数据居然还有2,2,3这样的行数据
  870. int maxrownumber = 0;
  871. for (int i = 0; i < in_list_cgriddataclr.Count(); i++)
  872. {
  873. //分解结果内容
  874. List<CGridColumnClr> list_cgridcolumnclrs = new List<CGridColumnClr>();
  875. list_cgridcolumnclrs = in_list_cgriddataclr[i].GetGridColumnList(); //获取各列
  876. //创建DT的行
  877. if (list_cgridcolumnclrs != null)
  878. {
  879. foreach (CGridColumnClr ls_cgridcolumnclr in list_cgridcolumnclrs)
  880. {
  881. if (maxrownumber < ls_cgridcolumnclr.GetRowList().Count())
  882. {
  883. maxrownumber = ls_cgridcolumnclr.GetRowList().Count();
  884. }
  885. }
  886. }
  887. }
  888. for (int k = 0; k < maxrownumber; k++)
  889. {
  890. DataRow dr = ret_dt.NewRow();
  891. ret_dt.Rows.Add(dr);
  892. }
  893. #endregion
  894. #region //再次重新分解,先分解列,然后将获取到的各行各列的数据,填充到相应的位置上---
  895. for (int i = 0; i < in_list_cgriddataclr.Count(); i++)
  896. {
  897. //分解结果内容
  898. List<CGridColumnClr> list_cgridcolumnclrs = new List<CGridColumnClr>();
  899. list_cgridcolumnclrs = in_list_cgriddataclr[i].GetGridColumnList(); //获取各列
  900. //再次重新分解,先分解列,然后将获取到的
  901. for (int k = 0; k < list_cgridcolumnclrs.Count(); k++)
  902. {
  903. string ls_fl_strName = list_cgridcolumnclrs[k].GetName();
  904. List<CGridRowClr> ls_list_cgridrowclr = new List<CGridRowClr>();
  905. ls_list_cgridrowclr = list_cgridcolumnclrs[k].GetRowList();
  906. for (int j = 0; j < ls_list_cgridrowclr.Count(); j++)
  907. {
  908. //先判断该行该单元格的数据类型
  909. string str_value = "";//因为显示只需要对字符串进行操作就可以了,所以将底层获取到的数据,除了颗粒类型外的都转成string
  910. switch (ls_list_cgridrowclr[j].GetDataType())
  911. {
  912. case 0:
  913. //string
  914. str_value = ls_list_cgridrowclr[j].GetStringValue();
  915. ret_dt.Rows[j][k + i * oneresult_columncount] = str_value;
  916. break;
  917. case 1:
  918. //该元素含量表没有需要显示的颗粒图像
  919. //ret_dt.Rows[j][k+i*oneresult_columncount] = GetBitmapByParticleList(ls_list_cgridrowclr[k].GetParticle());
  920. break;
  921. case 2:
  922. //int
  923. str_value = ls_list_cgridrowclr[j].GetIntValue().ToString();
  924. ret_dt.Rows[j][k + i * oneresult_columncount] = str_value;
  925. break;
  926. case 3:
  927. //float
  928. str_value = ls_list_cgridrowclr[j].GetDoubleValue().ToString("0.00");
  929. ret_dt.Rows[j][k + i * oneresult_columncount] = str_value;
  930. break;
  931. default:
  932. str_value = "";
  933. ret_dt.Rows[j][k + i * oneresult_columncount] = str_value;
  934. break;
  935. }
  936. }
  937. }
  938. }
  939. #endregion
  940. return ret_dt;
  941. }
  942. #endregion
  943. #region 读取加载clr中的国标数据信息
  944. public List<DataTable> ChineseStandardABCD_GetDataTable()
  945. {
  946. List<DataTable> dataTables = new List<DataTable>();
  947. dataTables.Add(ChineseStandardABCD_GetDataTable_Total(m_list_cgriddataclr_A, out m_oneresult_columnscount_A));
  948. dataTables.Add( ChineseStandardABCD_GetDataTable_Total(m_list_cgriddataclr_B, out m_oneresult_columnscount_B));
  949. dataTables.Add( ChineseStandardABCD_GetDataTable_Total(m_list_cgriddataclr_C, out m_oneresult_columnscount_C));
  950. dataTables.Add( ChineseStandardABCD_GetDataTable_Total(m_list_cgriddataclr_D, out m_oneresult_columnscount_D));
  951. dataTables.Add( ChineseStandardABCD_GetDataTable_Total(m_list_cgriddataclr_sulfide, out m_oneresult_columnscount_sulfide));
  952. dataTables.Add( ChineseStandardABCD_GetDataTable_Total(m_list_cgriddataclr_DS, out m_oneresult_columnscount_DS));
  953. return dataTables;
  954. }
  955. #endregion
  956. }
  957. }