123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using DevExpress.XtraEditors;
- using System.IO;
- using Uninpho.Tools.components.MTLFF;
- using Uninpho.DBOperation.Model;
- namespace Uninpho.Tools.components.ZZJH
- {
- public partial class CreateNewTableZZJH : DevExpress.XtraEditors.XtraForm
- {
- public CreateNewTableZZJH()
- {
- InitializeComponent();
- }
- List<T_daocha_account> daochaData = new List<T_daocha_account>();
- private void newCreateBtnSon_Click(object sender, EventArgs e)
- {
- ZZJHListFrom frm = new ZZJHListFrom();
- frm.StartPosition = FormStartPosition.CenterParent;
- ExcelTools.chezhan = zhanmingText.Text;
- ExcelTools.daocha = daochahaoText.Text;
- ExcelTools.zhecha = zhechahaoText.Text;
- ExcelTools.shejituhao = shejituhaoText.Text;
- ExcelTools.jianceren = jiancharenText.Text;
- ExcelTools.jianceshijian = jianchashijianText.DateTime.ToShortDateString();
- ExcelTools.xianluming = xianlumingText.Text;
- ExcelTools.zhenhaoqs = qujianQText.Text;
- ExcelTools.zhenhaozz = qujianZText.Text;
- ExcelTools.filenameall = Application.StartupPath + "\\zzjh_temp\\新建道岔几何尺寸检查记录表.xlsx";
- frm.ShowDialog();
- this.Close();
- }
- private void NewcancelBtn_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 加载模糊查询的数据
- /// </summary>
- private void CreateNewTableZZJH_Load(object sender, EventArgs e)
- {
- daochaData = DBOperation.Operation.DataAnalysisToPG.QueryDCTZALL();
- //整理线路名集合
- var listtgXLMALL = daochaData.GroupBy(c => c.Xlm).Select(c => c.First()).ToList();
- foreach (var item in listtgXLMALL)
- {
- xianlumingText.Properties.Items.Add(item.Xlm);
- }
- }
- private void xianlumingText_EditValueChanged(object sender, EventArgs e)
- {
- zhanmingText.Properties.Items.Clear();
- var isInputTrueXLM = daochaData.FindAll(delegate (T_daocha_account dc)
- {
- return dc.Xlm == xianlumingText.Text;
- });
- //线路名
- if (isInputTrueXLM.Count != 0)
- {
- var listtg = isInputTrueXLM.GroupBy(c => c.Czm).Select(c => c.First()).ToList();
- foreach (var item in listtg)
- {
- zhanmingText.Properties.Items.Add(item.Czm);
- }
- zhanmingText.Enabled = true;
- }
- else
- {
- zhanmingText.Enabled = false;
- }
- zhanmingText.Text = "";
- daochahaoText.Text = "";
- zhechahaoText.Text = "";
- shejituhaoText.Text = "";
- }
- private void zhanmingText_EditValueChanged(object sender, EventArgs e)
- {
- daochahaoText.Properties.Items.Clear();
- var isInputTrueZM = daochaData.FindAll(delegate (T_daocha_account dc)
- {
- return dc.Xlm == xianlumingText.Text && dc.Czm == zhanmingText.Text;
- });
- //线路名
- if (isInputTrueZM.Count != 0)
- {
- var listtg = isInputTrueZM.GroupBy(c => c.Dcbh).Select(c => c.First()).ToList();
- foreach (var item in listtg)
- {
- daochahaoText.Properties.Items.Add(item.Dcbh);
- }
- daochahaoText.Enabled = true;
- }
- else
- {
- daochahaoText.Enabled = false;
- }
- daochahaoText.Text = "";
- zhechahaoText.Text = "";
- shejituhaoText.Text = "";
- }
- private void daochahaoText_EditValueChanged(object sender, EventArgs e)
- {
- var isInputTrueDC = daochaData.FindAll(delegate (T_daocha_account dc)
- {
- return dc.Xlm == xianlumingText.Text && dc.Czm == zhanmingText.Text && dc.Dcbh == daochahaoText.Text;
- });
- zhechahaoText.Text = "";
- shejituhaoText.Text = "";
- //线路名
- if (isInputTrueDC.Count != 0)
- {
- var listtg = isInputTrueDC.GroupBy(c => c.Zch).Select(c => c.First()).ToList();
- zhechahaoText.Text = listtg[0].Zch.ToString();
- shejituhaoText.Text = listtg[0].Dcth.ToString();
- }
- }
- #region keyup事件
- private void xianlumingText_KeyUp(object sender, KeyEventArgs e)
- {
- canelMH(e, xianlumingText);
- }
- private void zhanmingText_KeyUp(object sender, KeyEventArgs e)
- {
- canelMH(e, zhanmingText);
- }
- private void daochahaoText_KeyUp(object sender, KeyEventArgs e)
- {
- canelMH(e, daochahaoText);
- }
- private void canelMH(KeyEventArgs e, ComboBoxEdit CB)
- {
- var asa = e.KeyValue;
- var asaaa = e.KeyCode;
- if (asa == 13)
- {
- CB.ClosePopup();
- }
- else
- {
- CB.ShowPopup();
- }
- }
- #endregion
- }
- }
|