CreateNewTableZZJH.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Linq;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using DevExpress.XtraEditors;
  11. using System.IO;
  12. using Uninpho.Tools.components.MTLFF;
  13. using Uninpho.DBOperation.Model;
  14. namespace Uninpho.Tools.components.ZZJH
  15. {
  16. public partial class CreateNewTableZZJH : DevExpress.XtraEditors.XtraForm
  17. {
  18. public CreateNewTableZZJH()
  19. {
  20. InitializeComponent();
  21. }
  22. List<T_daocha_account> daochaData = new List<T_daocha_account>();
  23. private void newCreateBtnSon_Click(object sender, EventArgs e)
  24. {
  25. ZZJHListFrom frm = new ZZJHListFrom();
  26. frm.StartPosition = FormStartPosition.CenterParent;
  27. ExcelTools.chezhan = zhanmingText.Text;
  28. ExcelTools.daocha = daochahaoText.Text;
  29. ExcelTools.zhecha = zhechahaoText.Text;
  30. ExcelTools.shejituhao = shejituhaoText.Text;
  31. ExcelTools.jianceren = jiancharenText.Text;
  32. ExcelTools.jianceshijian = jianchashijianText.DateTime.ToShortDateString();
  33. ExcelTools.xianluming = xianlumingText.Text;
  34. ExcelTools.zhenhaoqs = qujianQText.Text;
  35. ExcelTools.zhenhaozz = qujianZText.Text;
  36. ExcelTools.filenameall = Application.StartupPath + "\\zzjh_temp\\新建道岔几何尺寸检查记录表.xlsx";
  37. frm.ShowDialog();
  38. this.Close();
  39. }
  40. private void NewcancelBtn_Click(object sender, EventArgs e)
  41. {
  42. this.Close();
  43. }
  44. /// <summary>
  45. /// 加载模糊查询的数据
  46. /// </summary>
  47. private void CreateNewTableZZJH_Load(object sender, EventArgs e)
  48. {
  49. daochaData = DBOperation.Operation.DataAnalysisToPG.QueryDCTZALL();
  50. //整理线路名集合
  51. var listtgXLMALL = daochaData.GroupBy(c => c.Xlm).Select(c => c.First()).ToList();
  52. foreach (var item in listtgXLMALL)
  53. {
  54. xianlumingText.Properties.Items.Add(item.Xlm);
  55. }
  56. }
  57. private void xianlumingText_EditValueChanged(object sender, EventArgs e)
  58. {
  59. zhanmingText.Properties.Items.Clear();
  60. var isInputTrueXLM = daochaData.FindAll(delegate (T_daocha_account dc)
  61. {
  62. return dc.Xlm == xianlumingText.Text;
  63. });
  64. //线路名
  65. if (isInputTrueXLM.Count != 0)
  66. {
  67. var listtg = isInputTrueXLM.GroupBy(c => c.Czm).Select(c => c.First()).ToList();
  68. foreach (var item in listtg)
  69. {
  70. zhanmingText.Properties.Items.Add(item.Czm);
  71. }
  72. zhanmingText.Enabled = true;
  73. }
  74. else
  75. {
  76. zhanmingText.Enabled = false;
  77. }
  78. zhanmingText.Text = "";
  79. daochahaoText.Text = "";
  80. zhechahaoText.Text = "";
  81. shejituhaoText.Text = "";
  82. }
  83. private void zhanmingText_EditValueChanged(object sender, EventArgs e)
  84. {
  85. daochahaoText.Properties.Items.Clear();
  86. var isInputTrueZM = daochaData.FindAll(delegate (T_daocha_account dc)
  87. {
  88. return dc.Xlm == xianlumingText.Text && dc.Czm == zhanmingText.Text;
  89. });
  90. //线路名
  91. if (isInputTrueZM.Count != 0)
  92. {
  93. var listtg = isInputTrueZM.GroupBy(c => c.Dcbh).Select(c => c.First()).ToList();
  94. foreach (var item in listtg)
  95. {
  96. daochahaoText.Properties.Items.Add(item.Dcbh);
  97. }
  98. daochahaoText.Enabled = true;
  99. }
  100. else
  101. {
  102. daochahaoText.Enabled = false;
  103. }
  104. daochahaoText.Text = "";
  105. zhechahaoText.Text = "";
  106. shejituhaoText.Text = "";
  107. }
  108. private void daochahaoText_EditValueChanged(object sender, EventArgs e)
  109. {
  110. var isInputTrueDC = daochaData.FindAll(delegate (T_daocha_account dc)
  111. {
  112. return dc.Xlm == xianlumingText.Text && dc.Czm == zhanmingText.Text && dc.Dcbh == daochahaoText.Text;
  113. });
  114. zhechahaoText.Text = "";
  115. shejituhaoText.Text = "";
  116. //线路名
  117. if (isInputTrueDC.Count != 0)
  118. {
  119. var listtg = isInputTrueDC.GroupBy(c => c.Zch).Select(c => c.First()).ToList();
  120. zhechahaoText.Text = listtg[0].Zch.ToString();
  121. shejituhaoText.Text = listtg[0].Dcth.ToString();
  122. }
  123. }
  124. #region keyup事件
  125. private void xianlumingText_KeyUp(object sender, KeyEventArgs e)
  126. {
  127. canelMH(e, xianlumingText);
  128. }
  129. private void zhanmingText_KeyUp(object sender, KeyEventArgs e)
  130. {
  131. canelMH(e, zhanmingText);
  132. }
  133. private void daochahaoText_KeyUp(object sender, KeyEventArgs e)
  134. {
  135. canelMH(e, daochahaoText);
  136. }
  137. private void canelMH(KeyEventArgs e, ComboBoxEdit CB)
  138. {
  139. var asa = e.KeyValue;
  140. var asaaa = e.KeyCode;
  141. if (asa == 13)
  142. {
  143. CB.ClosePopup();
  144. }
  145. else
  146. {
  147. CB.ShowPopup();
  148. }
  149. }
  150. #endregion
  151. }
  152. }