CreateNewTableXXXW.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 Uninpho.Tools.components.MTLFF;
  12. using Uninpho.DBOperation.Model;
  13. namespace Uninpho.Tools.components.XXXW
  14. {
  15. public partial class CreateNewTableXXXW : DevExpress.XtraEditors.XtraForm
  16. {
  17. public CreateNewTableXXXW()
  18. {
  19. InitializeComponent();
  20. }
  21. List<T_daocha_account> daochaData = new List<T_daocha_account>();
  22. /// <summary>
  23. /// 新建
  24. /// </summary>
  25. private void newCreateBtnSon_Click(object sender, EventArgs e)
  26. {
  27. XXXWListFrom frm = new XXXWListFrom();
  28. frm.StartPosition = FormStartPosition.CenterParent;
  29. ExcelTools.chezhan = zhanmingText.Text;
  30. ExcelTools.daocha = daochahaoText.Text;
  31. ExcelTools.zhecha = zhechahaoText.Text;
  32. ExcelTools.shejituhao = shejituhaoText.Text;
  33. ExcelTools.jianceren = jiancharenText.Text;
  34. ExcelTools.jianceshijian = jianchashijianText.DateTime.ToShortDateString();
  35. ExcelTools.xianluming = xianlumingText.Text;
  36. ExcelTools.filenameall = Application.StartupPath + "\\xxxw_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 CreateNewTableMTLF_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. /// <summary>
  58. /// 线路名查询
  59. /// </summary>
  60. private void xianlumingText_TextChanged(object sender, EventArgs e)
  61. {
  62. zhanmingText.Properties.Items.Clear();
  63. var isInputTrueXLM = daochaData.FindAll(delegate (T_daocha_account dc)
  64. {
  65. return dc.Xlm == xianlumingText.Text;
  66. });
  67. //线路名
  68. if (isInputTrueXLM.Count != 0)
  69. {
  70. var listtg = isInputTrueXLM.GroupBy(c => c.Czm).Select(c => c.First()).ToList();
  71. foreach (var item in listtg)
  72. {
  73. zhanmingText.Properties.Items.Add(item.Czm);
  74. }
  75. zhanmingText.Enabled = true;
  76. }
  77. else
  78. {
  79. zhanmingText.Enabled = false;
  80. }
  81. zhanmingText.Text = "";
  82. daochahaoText.Text = "";
  83. zhechahaoText.Text = "";
  84. shejituhaoText.Text = "";
  85. }
  86. private void zhanmingText_EditValueChanged(object sender, EventArgs e)
  87. {
  88. daochahaoText.Properties.Items.Clear();
  89. var isInputTrueZM = daochaData.FindAll(delegate (T_daocha_account dc)
  90. {
  91. return dc.Xlm == xianlumingText.Text && dc.Czm == zhanmingText.Text;
  92. });
  93. //线路名
  94. if (isInputTrueZM.Count != 0)
  95. {
  96. var listtg = isInputTrueZM.GroupBy(c => c.Dcbh).Select(c => c.First()).ToList();
  97. foreach (var item in listtg)
  98. {
  99. daochahaoText.Properties.Items.Add(item.Dcbh);
  100. }
  101. daochahaoText.Enabled = true;
  102. }
  103. else
  104. {
  105. daochahaoText.Enabled = false;
  106. }
  107. daochahaoText.Text = "";
  108. zhechahaoText.Text = "";
  109. shejituhaoText.Text = "";
  110. }
  111. private void daochahaoText_EditValueChanged(object sender, EventArgs e)
  112. {
  113. var isInputTrueDC = daochaData.FindAll(delegate (T_daocha_account dc)
  114. {
  115. return dc.Xlm == xianlumingText.Text && dc.Czm == zhanmingText.Text && dc.Dcbh == daochahaoText.Text;
  116. });
  117. zhechahaoText.Text = "";
  118. shejituhaoText.Text = "";
  119. //线路名
  120. if (isInputTrueDC.Count != 0)
  121. {
  122. var listtg = isInputTrueDC.GroupBy(c => c.Zch).Select(c => c.First()).ToList();
  123. zhechahaoText.Text = listtg[0].Zch.ToString();
  124. shejituhaoText.Text = listtg[0].Dcth.ToString();
  125. }
  126. }
  127. #region keyup事件
  128. private void xianlumingText_KeyUp(object sender, KeyEventArgs e)
  129. {
  130. canelMH(e, xianlumingText);
  131. }
  132. private void zhanmingText_KeyUp(object sender, KeyEventArgs e)
  133. {
  134. canelMH(e, zhanmingText);
  135. }
  136. private void daochahaoText_KeyUp(object sender, KeyEventArgs e)
  137. {
  138. canelMH(e, daochahaoText);
  139. }
  140. private void canelMH(KeyEventArgs e, ComboBoxEdit CB)
  141. {
  142. var asa = e.KeyValue;
  143. var asaaa = e.KeyCode;
  144. if (asa == 13)
  145. {
  146. CB.ClosePopup();
  147. }
  148. else
  149. {
  150. CB.ShowPopup();
  151. }
  152. }
  153. #endregion
  154. }
  155. }