唉,今天头问起我的程序,竟然说关门时间在明天去现场之前!其实我现在已经做完了阿!感觉头对我的能力还是不很信任的样子,我怎么可能因为一段三千多行的程序就干了好几个月呢?一点也不像我的风格!不过算啦,头是很忙的!每天有处理不完的事情,怎么会注意这些七七八八的事情呢?做好自己的再说吧!闲来无事,把代码贴上来,白白,帮我看看阿!
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
using System.Threading;
using System.Data.SqlClient;
using System.Data.OleDb;
namespace new_search
{
/**//// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
/**//// <summary>
/// 必需的设计器变量。
/// </summary>
win form announce#region win form announce
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem menuItem6;
public System.Windows.Forms.MenuItem menuItem7;
public System.Windows.Forms.MenuItem menuItem8;
public System.Windows.Forms.MenuItem menuItem9;
public System.Windows.Forms.MenuItem menuItem10;
public System.Windows.Forms.MenuItem menuItem11;
public System.Windows.Forms.MenuItem menuItem12;
public System.Windows.Forms.MenuItem menuItem13;
public System.Windows.Forms.MenuItem menuItem14;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.MenuItem menuItem15;
private System.Windows.Forms.StatusBarPanel statusBarPanel1;
private System.Windows.Forms.StatusBarPanel statusBarPanel2;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
public System.Windows.Forms.CheckBox checkBox1;
public System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.CheckBox checkBox3;
public System.Windows.Forms.CheckBox checkBox4;
public System.Windows.Forms.CheckBox checkBox5;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
public System.Windows.Forms.CheckBox checkBox6;
public System.Windows.Forms.CheckBox checkBox7;
public System.Windows.Forms.CheckBox checkBox8;
public System.Windows.Forms.CheckBox checkBox9;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.TextBox textBox8;
private System.Windows.Forms.TextBox textBox9;
private System.Windows.Forms.TextBox textBox10;
private System.Windows.Forms.TextBox textBox11;
private System.Windows.Forms.TextBox textBox12;
private System.Windows.Forms.TextBox textBox13;
public System.Windows.Forms.CheckBox checkBox10;
public System.Windows.Forms.CheckBox checkBox11;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem18;
private System.Windows.Forms.MenuItem menuItem19;
private System.Windows.Forms.MenuItem menuItem20;
private System.Windows.Forms.MenuItem menuItem21;
private System.Windows.Forms.MenuItem menuItem22;
private System.Windows.Forms.MenuItem menuItem16;
private System.Windows.Forms.MenuItem menuItem17;
private System.Windows.Forms.MenuItem menuItem23;
#endregion
/**//// <summary>
/// 数据库声明
/// </summary>
public System.ComponentModel.Container components = null;
public System.Data.OleDb.OleDbDataAdapter oAde;
public System.Data.OleDb.OleDbConnection oConn;
public System.Data.OleDb.OleDbCommand oCmd=null;
public System.Data.OleDb.OleDbDataReader thisReader;
public System.Data.DataSet myDataSet;
private System.Data.SqlClient.SqlConnection mySqlConnection;
private string ErrCode="";
private string sort="";
public string sql;//查詢語句
// public int langth=0;
public int x=0;
/**//// <summary>
/// 声明调用文件
/// </summary>
public Form2 Form2;
public help help=new help();
public result result;
public Class Class;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
Form2 =new Form2();
Form2.Show();
this.statusBarPanel1.Text ="时间:"+System.DateTime.Now;
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/**//// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
Windows 窗体设计器生成的代码#region Windows 窗体设计器生成的代码
/**//// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.menuItem7 = new System.Windows.Forms.MenuItem();
this.menuItem11 = new System.Windows.Forms.MenuItem();
this.menuItem12 = new System.Windows.Forms.MenuItem();
this.menuItem13 = new System.Windows.Forms.MenuItem();
this.menuItem14 = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.menuItem8 = new System.Windows.Forms.MenuItem();
this.menuItem9 = new System.Windows.Forms.MenuItem();
this.menuItem10 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem22 = new System.Windows.Forms.MenuItem();
this.menuItem21 = new System.Windows.Forms.MenuItem();
this.menuItem20 = new System.Windows.Forms.MenuItem();
this.menuItem19 = new System.Windows.Forms.MenuItem();
this.menuItem18 = new System.Windows.Forms.MenuItem();
this.menuItem16 = new System.Windows.Forms.MenuItem();
this.menuItem17 = new System.Windows.Forms.MenuItem();
this.menuItem23 = new System.Windows.Forms.MenuItem();
this.menuItem15 = new System.Windows.Forms.MenuItem();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.checkBox5 = new System.Windows.Forms.CheckBox();
this.checkBox4 = new System.Windows.Forms.CheckBox();
this.checkBox3 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.textBox6 = new System.Windows.Forms.TextBox();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.checkBox11 = new System.Windows.Forms.CheckBox();
this.checkBox10 = new System.Windows.Forms.CheckBox();
this.textBox12 = new System.Windows.Forms.TextBox();
this.textBox13 = new System.Windows.Forms.TextBox();
this.textBox11 = new System.Windows.Forms.TextBox();
this.textBox9 = new System.Windows.Forms.TextBox();
this.textBox8 = new System.Windows.Forms.TextBox();
this.textBox10 = new System.Windows.Forms.TextBox();
this.checkBox6 = new System.Windows.Forms.CheckBox();
this.checkBox7 = new System.Windows.Forms.CheckBox();
this.checkBox9 = new System.Windows.Forms.CheckBox();
this.checkBox8 = new System.Windows.Forms.CheckBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.textBox7 = new System.Windows.Forms.TextBox();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
this.tabControl1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem4,
this.menuItem2,
this.menuItem15});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem3});
this.menuItem1.Shortcut = System.Windows.Forms.Shortcut.CtrlF;
this.menuItem1.Text = "文件(F)";
//
// menuItem3
//
this.menuItem3.Index = 0;
this.menuItem3.Text = "退出";
this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
//
// menuItem4
//
this.menuItem4.Index = 1;
this.menuItem4.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem5,
this.menuItem6});
this.menuItem4.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
this.menuItem4.Text = "选择查询表单(S)";
//
// menuItem5
//
this.menuItem5.Index = 0;
this.menuItem5.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem7,
this.menuItem11,
this.menuItem12,
this.menuItem13,
this.menuItem14});
this.menuItem5.Text = "轨道电路";
//
// menuItem7
//
this.menuItem7.Index = 0;
this.menuItem7.Text = "进路命令表";
this.menuItem7.Click += new System.EventHandler(this.menuItem7_Click);
//
// menuItem11
//
this.menuItem11.Index = 1;
this.menuItem11.Text = "调车单";
this.menuItem11.Click += new System.EventHandler(this.menuItem11_Click);
//
// menuItem12
//
this.menuItem12.Index = 2;
this.menuItem12.Text = "机车回视数据表";
this.menuItem12.Click += new System.EventHandler(this.menuItem12_Click);
//
// menuItem13
//
this.menuItem13.Index = 3;
this.menuItem13.Text = "全站段状态表";
this.menuItem13.Click += new System.EventHandler(this.menuItem13_Click);
//
// menuItem14
//
this.menuItem14.Index = 4;
this.menuItem14.Text = "全段信号状态表";
this.menuItem14.Click += new System.EventHandler(this.menuItem14_Click);
//
// menuItem6
//
this.menuItem6.Index = 1;
this.menuItem6.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem8,
this.menuItem9,
this.menuItem10});
this.menuItem6.Text = "点式应答器";
//
// menuItem8
//
this.menuItem8.Index = 0;
this.menuItem8.Text = "驼峰C";
this.menuItem8.Click += new System.EventHandler(this.menuItem8_Click);
//
// menuItem9
//
this.menuItem9.Index = 1;
this.menuItem9.Text = "驼峰S";
this.menuItem9.Click += new System.EventHandler(this.menuItem9_Click);
//
// menuItem10
//
this.menuItem10.Index = 2;
this.menuItem10.Text = "驼峰B";
this.menuItem10.Click += new System.EventHandler(this.menuItem10_Click);
//
// menuItem2
//
this.menuItem2.Index = 2;
this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem22,
this.menuItem21,
this.menuItem20,
this.menuItem19,
this.menuItem18,
this.menuItem16,
this.menuItem17,
this.menuItem23});
this.menuItem2.Text = "查询单表";
//
// menuItem22
//
this.menuItem22.Index = 0;
this.menuItem22.Text = "全段信号状态表";
this.menuItem22.Click += new System.EventHandler(this.menuItem22_Click);
//
// menuItem21
//
this.menuItem21.Index = 1;
this.menuItem21.Text = "全站段状态表";
this.menuItem21.Click += new System.EventHandler(this.menuItem21_Click);
//
// menuItem20
//
this.menuItem20.Index = 2;
this.menuItem20.Text = "机车回视数据表";
this.menuItem20.Click += new System.EventHandler(this.menuItem20_Click);
//
// menuItem19
//
this.menuItem19.Index = 3;
this.menuItem19.Text = "调车单";
this.menuItem19.Click += new System.EventHandler(this.menuItem19_Click);
//
// menuItem18
//
this.menuItem18.Index = 4;
this.menuItem18.Text = "进路命令表";
this.menuItem18.Click += new System.EventHandler(this.menuItem18_Click);
//
// menuItem16
//
this.menuItem16.Index = 5;
this.menuItem16.Text = "TW-C";
this.menuItem16.Click += new System.EventHandler(this.menuItem16_Click_1);
//
// menuItem17
//
this.menuItem17.Index = 6;
this.menuItem17.Text = "TW-S";
this.menuItem17.Click += new System.EventHandler(this.menuItem17_Click);
//
// menuItem23
//
this.menuItem23.Index = 7;
this.menuItem23.Text = "TW-B";
this.menuItem23.Click += new System.EventHandler(this.menuItem23_Click);
//
// menuItem15
//
this.menuItem15.Index = 3;
this.menuItem15.Shortcut = System.Windows.Forms.Shortcut.F1;
this.menuItem15.Text = "帮助(H)";
this.menuItem15.Click += new System.EventHandler(this.menuItem15_Click);
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(0, 400);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
this.statusBarPanel2,
this.statusBarPanel1});
this.statusBar1.ShowPanels = true;
this.statusBar1.Size = new System.Drawing.Size(632, 25);
this.statusBar1.TabIndex = 2;
this.statusBar1.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar1_PanelClick);
//
// statusBarPanel2
//
this.statusBarPanel2.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
this.statusBarPanel2.Text = " 欢迎使用本查询软件";
this.statusBarPanel2.Width = 564;
//
// statusBarPanel1
//
this.statusBarPanel1.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
this.statusBarPanel1.Text = "时间:";
this.statusBarPanel1.Width = 52;
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(632, 400);
this.tabControl1.TabIndex = 20;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.button2);
this.tabPage2.Controls.Add(this.button1);
this.tabPage2.Controls.Add(this.groupBox1);
this.tabPage2.Controls.Add(this.label2);
this.tabPage2.Controls.Add(this.label1);
this.tabPage2.Controls.Add(this.textBox6);
this.tabPage2.Location = new System.Drawing.Point(4, 21);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(624, 375);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "轨道电路";
//
// button2
//
this.button2.Location = new System.Drawing.Point(376, 320);
this.button2.Name = "button2";
this.button2.TabIndex = 16;
this.button2.Text = "退出";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(160, 320);
this.button1.Name = "button1";
this.button1.TabIndex = 15;
this.button1.Text = "确定";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.textBox2);
this.groupBox1.Controls.Add(this.textBox5);
this.groupBox1.Controls.Add(this.textBox1);
this.groupBox1.Controls.Add(this.textBox3);
this.groupBox1.Controls.Add(this.textBox4);
this.groupBox1.Controls.Add(this.checkBox5);
this.groupBox1.Controls.Add(this.checkBox4);
this.groupBox1.Controls.Add(this.checkBox3);
this.groupBox1.Controls.Add(this.checkBox2);
this.groupBox1.Controls.Add(this.checkBox1);
this.groupBox1.Location = new System.Drawing.Point(32, 128);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(568, 168);
this.groupBox1.TabIndex = 14;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "查询方向";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(168, 72);
this.textBox2.Name = "textBox2";
this.textBox2.TabIndex = 9;
this.textBox2.Text = "";
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(424, 72);
this.textBox5.Name = "textBox5";
this.textBox5.TabIndex = 12;
this.textBox5.Text = "";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(168, 32);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 8;
this.textBox1.Text = "";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(168, 112);
this.textBox3.Name = "textBox3";
this.textBox3.TabIndex = 10;
this.textBox3.Text = "";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(424, 32);
this.textBox4.Name = "textBox4";
this.textBox4.TabIndex = 11;
this.textBox4.Text = "";
//
// checkBox5
//
this.checkBox5.Location = new System.Drawing.Point(304, 72);
this.checkBox5.Name = "checkBox5";
this.checkBox5.TabIndex = 6;
this.checkBox5.Text = "计划号/车次号";
this.checkBox5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// checkBox4
//
this.checkBox4.Location = new System.Drawing.Point(304, 32);
this.checkBox4.Name = "checkBox4";
this.checkBox4.TabIndex = 5;
this.checkBox4.Text = "进路流水号";
this.checkBox4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// checkBox3
//
this.checkBox3.Location = new System.Drawing.Point(48, 112);
this.checkBox3.Name = "checkBox3";
this.checkBox3.TabIndex = 4;
this.checkBox3.Text = "钩ID";
this.checkBox3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// checkBox2
//
this.checkBox2.Location = new System.Drawing.Point(48, 72);
this.checkBox2.Name = "checkBox2";
this.checkBox2.TabIndex = 3;
this.checkBox2.Text = "段ID";
this.checkBox2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// checkBox1
//
this.checkBox1.Location = new System.Drawing.Point(48, 32);
this.checkBox1.Name = "checkBox1";
this.checkBox1.TabIndex = 2;
this.checkBox1.Text = "机车ID";
this.checkBox1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// label2
//
this.label2.Location = new System.Drawing.Point(160, 88);
this.label2.Name = "label2";
this.label2.TabIndex = 1;
this.label2.Text = "查询时间:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label1
//
this.label1.Font = new System.Drawing.Font("华文新魏", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label1.Location = new System.Drawing.Point(144, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(312, 56);
this.label1.TabIndex = 0;
this.label1.Text = "选择查询类别,填充关键字";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(320, 88);
this.textBox6.Name = "textBox6";
this.textBox6.TabIndex = 13;
this.textBox6.Text = "";
//
// tabPage1
//
this.tabPage1.Controls.Add(this.groupBox2);
this.tabPage1.Controls.Add(this.label4);
this.tabPage1.Controls.Add(this.label3);
this.tabPage1.Controls.Add(this.textBox7);
this.tabPage1.Controls.Add(this.button3);
this.tabPage1.Controls.Add(this.button4);
this.tabPage1.Location = new System.Drawing.Point(4, 21);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(624, 375);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "点式应答器";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.checkBox11);
this.groupBox2.Controls.Add(this.checkBox10);
this.groupBox2.Controls.Add(this.textBox12);
this.groupBox2.Controls.Add(this.textBox13);
this.groupBox2.Controls.Add(this.textBox11);
this.groupBox2.Controls.Add(this.textBox9);
this.groupBox2.Controls.Add(this.textBox8);
this.groupBox2.Controls.Add(this.textBox10);
this.groupBox2.Controls.Add(this.checkBox6);
this.groupBox2.Controls.Add(this.checkBox7);
this.groupBox2.Controls.Add(this.checkBox9);
this.groupBox2.Controls.Add(this.checkBox8);
this.groupBox2.Location = new System.Drawing.Point(32, 128);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(568, 168);
this.groupBox2.TabIndex = 6;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "查询方向";
//
// checkBox11
//
this.checkBox11.Location = new System.Drawing.Point(304, 112);
this.checkBox11.Name = "checkBox11";
this.checkBox11.TabIndex = 10;
this.checkBox11.Text = "机车速度";
//
// checkBox10
//
this.checkBox10.Location = new System.Drawing.Point(304, 72);
this.checkBox10.Name = "checkBox10";
this.checkBox10.TabIndex = 9;
this.checkBox10.Text = "股道位置";
//
// textBox12
//
this.textBox12.Location = new System.Drawing.Point(424, 72);
this.textBox12.Name = "textBox12";
this.textBox12.TabIndex = 7;
this.textBox12.Text = "";
//
// textBox13
//
this.textBox13.Location = new System.Drawing.Point(424, 112);
this.textBox13.Name = "textBox13";
this.textBox13.TabIndex = 8;
this.textBox13.Text = "";
//
// textBox11
//
this.textBox11.Location = new System.Drawing.Point(424, 32);
this.textBox11.Name = "textBox11";
this.textBox11.TabIndex = 6;
this.textBox11.Text = "";
//
// textBox9
//
this.textBox9.Location = new System.Drawing.Point(168, 72);
this.textBox9.Name = "textBox9";
this.textBox9.TabIndex = 4;
this.textBox9.Text = "";
//
// textBox8
//
this.textBox8.Location = new System.Drawing.Point(168, 32);
this.textBox8.Name = "textBox8";
this.textBox8.TabIndex = 3;
this.textBox8.Text = "";
//
// textBox10
//
this.textBox10.Location = new System.Drawing.Point(168, 112);
this.textBox10.Name = "textBox10";
this.textBox10.TabIndex = 5;
this.textBox10.Text = "";
//
// checkBox6
//
this.checkBox6.Location = new System.Drawing.Point(48, 32);
this.checkBox6.Name = "checkBox6";
this.checkBox6.TabIndex = 2;
this.checkBox6.Text = "溜放状态";
this.checkBox6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// checkBox7
//
this.checkBox7.Location = new System.Drawing.Point(48, 72);
this.checkBox7.Name = "checkBox7";
this.checkBox7.TabIndex = 3;
this.checkBox7.Text = "T1/T2";
this.checkBox7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// checkBox9
//
this.checkBox9.Location = new System.Drawing.Point(304, 32);
this.checkBox9.Name = "checkBox9";
this.checkBox9.TabIndex = 5;
this.checkBox9.Text = "调机编号";
//
// checkBox8
//
this.checkBox8.Location = new System.Drawing.Point(48, 112);
this.checkBox8.Name = "checkBox8";
this.checkBox8.TabIndex = 4;
this.checkBox8.Text = "作业车次号";
this.checkBox8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label4
//
this.label4.Location = new System.Drawing.Point(160, 88);
this.label4.Name = "label4";
this.label4.TabIndex = 1;
this.label4.Text = "查询时间:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label3
//
this.label3.Font = new System.Drawing.Font("华文新魏", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label3.Location = new System.Drawing.Point(128, 16);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(344, 56);
this.label3.TabIndex = 0;
this.label3.Text = "选择查询类别,填充关键字";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(320, 88);
this.textBox7.Name = "textBox7";
this.textBox7.TabIndex = 2;
this.textBox7.Text = "";
//
// button3
//
this.button3.Location = new System.Drawing.Point(160, 320);
this.button3.Name = "button3";
this.button3.TabIndex = 0;
this.button3.Text = "确定";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(376, 320);
this.button4.Name = "button4";
this.button4.TabIndex = 1;
this.button4.Text = "退出";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// Form1
//
this.AllowDrop = true;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(632, 425);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.statusBar1);
this.HelpButton = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "分类查询";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
this.tabControl1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/**//// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
main#region main
// search(x,0,54,0,Class.data.LocomData,"LOCOM_DATA");
/**/////
// group(x,30,31,3,Class.data.RcData,"RC_DATA",false);
/**/////
// group(x,12,13,1,Class.data.SData,"S_DATA",false);
/**/////
// group(x,12,14,1,Class.data.LData,"L_DATA",false);
/**///// group(x,8,9,5,Class.data.B_Data,"tw_b",false);
////
//// group(x,0,23,0,Class.data.C_Data,"tw_c",false);
////
//// group(x,0,31,0,Class.data.S_Data,"tw_s",false);
#endregion
menu#region menu
/**//// <summary>
/// menu
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <param name="c"></param>
public void re(string a)
{
string b=textBox6.Text;
switch(a)
{
case "LOCOM_DATA":
x=getcheck("LOCOM_DATA",textBox6.Text,"LOCOM_DATA");//mySqlDataAdapter.Fill()
Class.langth.langth_locom=0;
Class.data.LocomData=new byte[x];
Table(Class.data.LocomData,"LOCOM_DATA",x);//提取当前数据,写入标本数组
group(x,0,54,0,Class.data.LocomData,"LOCOM_DATA",Class.langth.langth_locom);
break;
case "tw_b":
Class.langth.langth_tw_b=0;
x=getcheck("tw_b",textBox6.Text,"tw_b");
Class.data.B_Data=new byte[x];
Table(Class.data.B_Data,"tw_b",x);
group(x,8,9,5,Class.data.B_Data,"tw_b",Class.langth.langth_tw_b);
break;
case "RC_DATA":
Class.langth.langth_rc=0;
x=getcheck("RC_DATA",textBox6.Text,"RC_DATA");
Class.data.RcData=new byte[x];
Table(Class.data.RcData,"RC_DATA",x);
group(x,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
break;
case "B_DATA":
Class.langth.langth_b=0;
x=getcheck("B_DATA",textBox6.Text,"B_DATA");
Class.data.BData=new byte[x];
Table(Class.data.BData,"B_DATA",x);
group(x,23,24,35,Class.data.BData,"B_DATA",Class.langth.langth_b);
break;
case "S_DATA":
Class.langth.langth_s=0;
x=getcheck("S_DATA",textBox6.Text,"S_DATA");
Class.data.SData=new byte[x];
Table(Class.data.SData,"S_DATA",x);
group(x,12,13,1,Class.data.SData,"S_DATA",Class.langth.langth_s);
break;
case "L_DATA":
Class.langth.langth_l=0;
x=getcheck("L_DATA",textBox6.Text,"L_DATA");
Class.data.LData=new byte[x];
Table(Class.data.LData,"L_DATA",x);
group(x,12,14,1,Class.data.LData,"L_DATA",Class.langth.langth_l);
break;
case "tw_c":
Class.langth.langth_tw_c=0;
x=getcheck("tw_c",textBox6.Text,"tw_c");
Class.data.C_Data=new byte[x];
Table(Class.data.C_Data,"tw_c",x);
group(x,0,23,0,Class.data.C_Data,"tw_c",Class.langth.langth_tw_c);
break;
case "tw_s":
Class.langth.langth_tw_s=0;
x=getcheck("tw_s",textBox6.Text,"tw_s");
Class.data.S_Data=new byte[x];
Table(Class.data.S_Data,"tw_s",x);
group(x,0,31,0,Class.data.S_Data,"tw_s",Class.langth.langth_tw_s);
break;
default:
MessageBox.Show("error!");
break;
/**/////////////////////////////trans.langth
}
}
#endregion
查找项目#region 查找项目
private void search(string locom)
{
string id="";
int count=0;
int duan=0;
/**////是否有考虑不周全的地方???
///
if(locom=="locom")
{
if(checkBox3.Checked==true)
{
钩ID#region 钩ID
count=Class.data.BData[23];/**///////////////////////////数据包长度
for(int i=0;i<count;i++)
{
if(Convert.ToString(Class.data.BData[24+7*i])==textBox3.Text)//钩ID
{
if(checkBox1.Checked==true)//机车ID
{
if(Convert.ToString(Class.data.BData[11])==textBox1.Text)
{
instantiation(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA");
group(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA",Class.langth.langth_b);
}
}
else
{
instantiation(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA");
group(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA",Class.langth.langth_b);
}
}
}
#endregion
}
if(checkBox1.Checked==true)//机车ID
{
机车ID#region 机车ID
if((Convert.ToString(Class.data.BData[11])==textBox1.Text)||
(Convert.ToString(Class.data.LData[11])==textBox1.Text)||
(Convert.ToString(Class.data.LocomData[11])==textBox1.Text)||
(Convert.ToString(Class.data.RcData[11])==textBox1.Text)||
(Convert.ToString(Class.data.SData[11])==textBox1.Text))
{
if(checkBox5.Checked==true)//计划号/车次号
{
计划号/车次号#region 计划号/车次号
if(Convert.ToString(Class.data.RcData[13])==textBox5.Text)
{
if(checkBox4.Checked==true)//进路流水号
{
进路流水号#region 进路流水号
if(Convert.ToString(Class.data.RcData[12])==textBox4.Text)
{
if(checkBox2.Checked==true)//段ID
{
段ID#region 段ID
count=Class.data.RcData[30];
for(int i=0;i<count;i++)
{
id=Convert.ToString((Class.data.RcData[31+4*i]<<8)+Class.data.RcData[31+4*i+1]);
if(id==textBox2.Text)
{
duan=1;
}
}
if(duan==1)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
#endregion
}
else
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
}
#endregion
}
else
{
if(checkBox2.Checked==true)//段ID
{
段ID#region 段ID
count=Class.data.RcData[30];
for(int i=0;i<count;i++)
{
id=Convert.ToString((Class.data.RcData[31+4*i]<<8)+Class.data.RcData[31+4*i+1]);
if(id==textBox2.Text)
{
duan=1;
}
}
if(duan==1)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
#endregion
}
else
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
}
}
if((Convert.ToString(Class.data.BData[12])==textBox5.Text)&&
(checkBox2.Checked!=true)&&(checkBox4.Checked!=true))
{
instantiation(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA");
group(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA",Class.langth.langth_b);
}
if((Convert.ToString(Class.data.LocomData[12])==textBox5.Text)&&
(checkBox2.Checked!=true)&&(checkBox4.Checked!=true))
{
instantiation(Class.data.LocomData.Length,0,54,0,Class.data.LocomData,"LOCOM_DATA");
group(Class.data.LocomData.Length,0,54,0,Class.data.LocomData,"LOCOM_DATA",Class.langth.langth_locom);
}
#endregion
}
else
{
if(Convert.ToString(Class.data.RcData[11])==textBox1.Text)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
if(Convert.ToString(Class.data.BData[11])==textBox1.Text)
{
instantiation(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA");
group(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA",Class.langth.langth_b);
}
if(Convert.ToString(Class.data.LData[11])==textBox1.Text)
{
instantiation(Class.data.LData.Length,12,14,1,Class.data.LData,"L_DATA");
group(Class.data.LData.Length,12,14,1,Class.data.LData,"L_DATA",Class.langth.langth_l);
}
if(Convert.ToString(Class.data.LocomData[11])==textBox1.Text)
{
instantiation(Class.data.LocomData.Length,0,54,0,Class.data.LocomData,"LOCOM_DATA");
group(Class.data.LocomData.Length,0,54,0,Class.data.LocomData,"LOCOM_DATA",Class.langth.langth_locom);
}
if(Convert.ToString(Class.data.SData[11])==textBox1.Text)
{
instantiation(Class.data.SData.Length,12,13,1,Class.data.SData,"S_DATA");
group(Class.data.SData.Length,12,13,1,Class.data.SData,"S_DATA",Class.langth.langth_s);
}
}
}
else
{
if(checkBox2.Checked==true)//段ID
{
段ID#region 段ID
count=Class.data.RcData[30];
for(int i=0;i<count;i++)
{
id=Convert.ToString((Class.data.RcData[31+4*i]<<8)+Class.data.RcData[31+4*i+1]);
if(id==textBox2.Text)
{
if(checkBox4.Checked==true)//进路流水号
{
进路流水号#region 进路流水号
if(Convert.ToString(Class.data.RcData[12])==textBox4.Text)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
break;
}
break;
#endregion
}
else
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
break;
}
}
}
#endregion
}
else
{
if(checkBox4.Checked==true)//进路流水号
{
进路流水号#region 进路流水号
if(Convert.ToString(Class.data.RcData[12])==textBox4.Text)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
#endregion
}
}
}
#endregion
}
}
else
{
if(checkBox5.Checked==true)//计划号/车次号
{
计划号/车次号#region 计划号/车次号
if(Convert.ToString(Class.data.RcData[13])==textBox5.Text)
{
if(checkBox4.Checked==true)//进路流水号
{
进路流水号#region 进路流水号
if(Convert.ToString(Class.data.RcData[12])==textBox4.Text)
{
if(checkBox2.Checked==true)//段ID
{
段ID#region 段ID
count=Class.data.RcData[30];
for(int i=0;i<count;i++)
{
id=Convert.ToString((Class.data.RcData[31+4*i]<<8)+Class.data.RcData[31+4*i+1]);
if(id==textBox2.Text)
{
duan=1;
}
}
if(duan==1)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
#endregion
}
else
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
}
#endregion
}
else
{
if(checkBox2.Checked==true)//段ID
{
段ID#region 段ID
count=Class.data.RcData[30];
for(int i=0;i<count;i++)
{
id=Convert.ToString((Class.data.RcData[31+4*i]<<8)+Class.data.RcData[31+4*i+1]);
if(id==textBox2.Text)
{
duan=1;
}
}
if(duan==1)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
#endregion
}
else
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
}
}
if((Convert.ToString(Class.data.BData[12])==textBox5.Text)&&
(checkBox2.Checked!=true)&&(checkBox4.Checked!=true))
{
instantiation(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA");
group(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA",Class.langth.langth_b);
}
if((Convert.ToString(Class.data.LocomData[12])==textBox5.Text)&&
(checkBox2.Checked!=true)&&(checkBox4.Checked!=true))
{
instantiation(Class.data.LocomData.Length,0,54,0,Class.data.LocomData,"LOCOM_DATA");
group(Class.data.LocomData.Length,0,54,0,Class.data.LocomData,"LOCOM_DATA",Class.langth.langth_locom);
}
#endregion
}
else
{
if(checkBox2.Checked==true)//段ID
{
段ID#region 段ID
count=Class.data.RcData[30];
for(int i=0;i<count;i++)
{
id=Convert.ToString((Class.data.RcData[31+4*i]<<8)+Class.data.RcData[31+4*i+1]);
if(id==textBox2.Text)
{
if(checkBox4.Checked==true)//进路流水号
{
进路流水号#region 进路流水号
if(Convert.ToString(Class.data.RcData[12])==textBox4.Text)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
break;
}
break;
#endregion
}
else
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
break;
}
}
}
#endregion
}
else
{
if(checkBox4.Checked==true)//进路流水号
{
进路流水号#region 进路流水号
if(Convert.ToString(Class.data.RcData[12])==textBox4.Text)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
#endregion
}
}
}
}
}
#endregion
读数据#region 读数据
private void readin(string locom)
{
switch(locom)
{
case "locom":
x=getcheck("RC_DATA",textBox6.Text,"RC_DATA");
Class.data.RcData=new byte[x];
Table(Class.data.RcData,"RC_DATA",x);
x=getcheck("S_DATA",textBox6.Text,"S_DATA");
Class.data.SData=new byte[x];
Table(Class.data.SData,"S_DATA",x);
x=getcheck("LOCOM_DATA",textBox6.Text,"LOCOM_DATA");//mySqlDataAdapter.Fill()
Class.data.LocomData=new byte[x];
Table(Class.data.LocomData,"LOCOM_DATA",x);//提取当前数据,写入标本数组
x=getcheck("L_DATA",textBox6.Text,"L_DATA");
Class.data.LData=new byte[x];
Table(Class.data.LData,"L_DATA",x);
x=getcheck("B_DATA",textBox6.Text,"B_DATA");
Class.data.BData=new byte[x];
Table(Class.data.BData,"B_DATA",x);
break;
case "tw":
x=getcheck("tw_b",textBox6.Text,"tw_b");
Class.data.B_Data=new byte[x];
Table(Class.data.B_Data,"tw_b",x);
x=getcheck("tw_c",textBox6.Text,"tw_c");
Class.data.C_Data=new byte[x];
Table(Class.data.C_Data,"tw_c",x);
x=getcheck("tw_s",textBox6.Text,"tw_s");
Class.data.S_Data=new byte[x];
Table(Class.data.S_Data,"tw_s",x);
break;
}
}
#endregion
写数据#region 写数据
public void Table(byte[] c,string b,int x)
{
DataTable myDataTable=myDataSet.Tables[b];
int i=0;
/**////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(x>0)
{
switch(b)
{
case "RC_DATA":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.RcData[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
case "B_DATA":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.BData[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
case "LOCOM_DATA":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.LocomData[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
case "S_DATA":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.SData[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
case "L_DATA":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.LData[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
case "tw_c":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.C_Data[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
case "tw_s":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.S_Data[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
case "tw_b":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.B_Data[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
}
}
mySqlConnection.Close();
}
#endregion
分组#region 分组
public void group(int x,int n,int m,int o,byte[] a,string b,int langth)
{
int y=0,j=0,z=0;
if((n!=0)&&(a.Length!=0))
{
try
{
y=a[n];//记录单组数量
}
catch (Exception ex)
{
ErrCode=ex.Message.ToString();
MessageBox.Show(ErrCode);
}
}
else
{
y=0;
}
z=m+y*o;
byte[] singel=new byte[z];
if(a.Length!=0)
{
int i=0;
int group=(x/z);
if(group>0)
{
do
{
for(i=0;i<(z-1);i++)
{
singel[i]=a[j+i];
}
Fillin(singel,b,y,langth);
langth++;
j=j+z;
}while(j<x);
}
}
}
#endregion
trans实例化#region trans实例化
public void instantiation(int x,int n,int m,int o,byte[] a,string b)
{
int y=0,z=0;
if((n!=0)&&(a.Length!=0))
{
try
{
y=a[n];//记录单组数量
}
catch (Exception ex)
{
ErrCode=ex.Message.ToString();
MessageBox.Show(ErrCode);
}
}
else
{
y=0;
}
z=m+y*o;
byte[] singel=new byte[z];
if(a.Length!=0)
{
int c=0,d=0;
int group=(x/z);
if(group>0)
{
switch(b)
{
case "LOCOM_DATA":
c=16;
Class.TRANS.LocomData=new string[group*(c+1)];
break;
case "RC_DATA":
c=Class.data.RcData[30];
d=17+4*c;
Class.TRANS.RcData=new string[group*(d+1)];
break;
case "tw_b":
c=Class.data.B_Data[9];
d=3+5*c+1;
Class.TRANS.B_Data=new string[group*(d+1)];
break;
case "B_DATA":
c=Class.data.BData[23];
d=6+7*c+1;
Class.TRANS.BData=new string[group*(d+1)];
break;
case "S_DATA":
c=(Class.data.SData[13]<<8+Class.data.SData[12]);/**////////////////////////////////////////////2
d=3+c+1;
Class.TRANS.SData=new string[group*d];
break;
case "L_DATA":
c=(Class.data.LData[13]<<8+Class.data.LData[12]);
//int sign=(int)(Class.data.LData[13]<<8+Class.data.LData[12]);/////////////////////////////2
d=c+3;
Class.TRANS.LData=new string[group*(d+1)];
break;
case "tw_c":
c=16;
Class.TRANS.C_Data=new string[group*(c+1)];
break;
case "tw_s":
c=22;
Class.TRANS.S_Data=new string[group*(c+1)];
break;
default:
MessageBox.Show("数据出错!");
this.statusBarPanel2.Text ="数据出错!";
break;
}
}
}
}
#endregion
Fillin#region Fillin
private void Fillin(byte[] singel,string b,int y,int l)
{
switch(b)
{/**//////////////////////////////////////////////////////////////////////////
case "RC_DATA":
check_RCData(singel,l,0,Class.data.RcData[30]);
break;
case "B_DATA":
check_BData(singel,l,0,Class.data.BData[23]);
break;
case "LOCOM_DATA":
check_LocomData(singel,l,0,0);
break;
case "S_DATA":
check_SData(singel,l,0,Class.data.SData[12]);
break;
case "L_DATA":
check_LData(singel,l,0,Class.data.LData[12]);
break;
case "tw_c":
check_C_Data(singel,l,0,0);
break;
case "tw_s":
check_S_Data(singel,l,0,0);
break;
case "tw_b":
check_B_Data(singel,l,0,Class.data.B_Data[9]);
break;
default:
MessageBox.Show("数据出错!");
this.statusBarPanel2.Text ="数据出错!";
break;
}
}
#endregion
數據庫查詢#region 數據庫查詢
public int getcheck(string a,string time,string b)
{
//a->项目名称,time->查询时间,b-〉数据库名称
//查询
int x=0;
mySqlConnection=new SqlConnection("server=(local);database=GroundDB;uid=sa;pwd=sa");
SqlCommand mySqlCommand=mySqlConnection.CreateCommand();
if(time!="")
{
mySqlCommand.CommandText=string.Format("SELECT {0} FROM {1} WHERE TIME={2} ",a,b,time);
}
else
{
mySqlCommand.CommandText=string.Format("SELECT {0} FROM {1} ",a,b);
}
SqlDataAdapter mySqlDataAdapter=new SqlDataAdapter();
mySqlDataAdapter.SelectCommand=mySqlCommand;
myDataSet=new DataSet();
try
{
mySqlConnection.Open();
}
catch (Exception ex)
{
ErrCode=ex.Message.ToString();
MessageBox.Show(ErrCode);
}
try
{
x=mySqlDataAdapter.Fill(myDataSet,b);
}
catch(Exception ex)
{
ErrCode=ex.Message.ToString();
MessageBox.Show(ErrCode);
}
return x;
}
#endregion
输出表单#region 输出表单
/**//// <summary>
/// 输出表单
/// </summary>
// public void checkdata(byte[] singel,string b,int l,int m,int ll)
// {
// switch(b)
// {
// case "RC_DATA":check_RCData(singel,l,m,ll);
// break;
// case "B_DATA":check_BData(singel,l,m,ll);
// break;
// case "LOCOM_DATA":check_LocomData(singel,l,m,ll);
// break;
// case "S_DATA":check_SData(singel,l,m,ll);
// break;
// case "L_DATA":check_LData(singel,l,m,ll);
// break;
// case "tw_c":check_C_Data(singel,l,m,ll);
// break;
// case "tw_s":check_S_Data(singel,l,m,ll);
// break;
// case "tw_b":check_B_Data(singel,l,m,ll);
// break;
// }
// }
#endregion
定义标题,填充数据#region 定义标题,填充数据
RCData#region RCData
public void check_RCData(byte[] a,int l,int m,int x)
{
string plan="";
string signalstate;
if(a.Length!=0)
{
plan=PlanProperty(a,24);
int y=17+4*x+1;
int RouteNum=a[y*m+12];
byte[] code=new byte[10];
if(RouteNum==0)
{
Class.TRANS.RcData[l*y+2]="未办理有效进路";//进路流水号
}
else
{
Class.TRANS.RcData[l*y+2]=Convert.ToString(a[y*m+12]);
}
for(int c=0;c<=9;c++)
{
code[c]=Convert.ToByte(a[y*m+13+c]);
}
RouteProperty(a,Class.TRANS.RcData,l,y,m);//进路属性
HumpCmd(a,Class.TRANS.RcData,l,y,m);//推峰命令
DataID(a,Class.TRANS.RcData,l,y,m);//请求ID
Class.TRANS.RcData[l*y]=a[y*m+2]+"年"+a[y*m+3]+"月"+a[y*m+4]+"日 "+a[y*m+5]+":"+a[y*m+6]+":"+a[y*m+7]+":"+a[y*m+8]+":";//时间
Class.TRANS.RcData[l*y+1]=Convert.ToString(a[y*m+11]);//机车ID
Class.TRANS.RcData[l*y+3]=Conversion(code,10);//计划号
Class.TRANS.RcData[l*y+10]=plan;//计划属性
Class.TRANS.RcData[l*y+11]=Convert.ToString(a[y*m+25]);//当前计划地执行钩序
Class.TRANS.RcData[l*y+12]=Convert.ToString((a[y*m+27]<<8)+a[y*m+26]);//驼峰高柱ID
Class.TRANS.RcData[l*y+16]=Convert.ToString(a[y*m+30]);//总段数
/**/////////////////////////////////////////核对一下item 与数组定义是否一致
for(int j=0;j<x;j++)
{
Class.TRANS.RcData[l*y+16+j*x+1]=Convert.ToString((a[y*m+31+j*x]<<8)+a[y*m+31+j*x+1]);//段ID
Class.TRANS.RcData[l*y+16+j*x+2]=duan(a[y*m+32+j*x]);//段状态
// signalstate=SignalState(Class.TRANS.RcData[l*y+16+j*x],"up");
// Class.TRANS.RcData[l*y+16+j*x+3]="防护下行方向信号"+signal((a[y*m+33+j*x]&0xF0),signalstate);//信号机状态
// signalstate=SignalState(Class.TRANS.RcData[l*y+16+j*x],"down");
// Class.TRANS.RcData[l*y+16+j*x+4]="防护上行方向信号"+signal((a[y*m+33+j*x]&0x0F),signalstate);//信号机状态
}
Class.TRANS.RcData[l*y+16+4*x+1]="xxxx";
}
else
{
MessageBox.Show("数据未找到!");
}
}
#endregion
BData#region BData
public void check_BData(byte[] a,int l,int m,int x)
{
string plan="";
if(a.Length!=0)
{
plan=PlanProperty(a,22);
int y=6+7*x+1;
byte[] code=new byte[10];
for(int c=0;c<=9;c++)
{
code[c]=Convert.ToByte(a[m*y+12+c]);
}
Class.TRANS.BData[l*y+0]=a[m*y+2]+"年"+a[m*y+3]+"月"+a[m*y+4]+"日 "+a[m*y+5]+":"+a[m*y+6]+":"+a[m*y+7]+":"+a[m*y+8]+":";//时间
Class.TRANS.BData[l*y+1]=Convert.ToString(a[m*y+11]);//机车ID
Class.TRANS.BData[l*y+2]=Conversion(code,10);//计划号
Class.TRANS.BData[l*y+3]=plan;//计划属性
Class.TRANS.BData[l*y+4]=Convert.ToString(a[m*y+23]);//总钩数
Class.TRANS.BData[l*y+5]=Convert.ToString(a[m*y+25]<<8+a[m*y+24]);//总辆数
for(int j=0;j<x;j++)
{
钩状态#region 钩状态
byte g=a[m*y+26+j*35+1];
string state="",count="";
string State="";
if((g>>7)==0)
{
state="挂";
}
else state="摘";
count=Convert.ToString(g&(0x127));
State=state+count+"辆";
#endregion
for(int c=0;c<=7;c++)
{
code[c]=Convert.ToByte(a[m*y+30+j*x]);
}
Class.TRANS.BData[l*y+6+j*7]=Convert.ToString(a[m*y+26+j*35]);//ID
Class.TRANS.BData[l*y+6+j*7+1]=State;//辆数
Class.TRANS.BData[l*y+6+j*7+2]=Convert.ToString(a[m*y+26+j*35+2]*60);//标准车重
Class.TRANS.BData[l*y+6+j*7+3]=Convert.ToString(a[m*y+26+j*35+3]*11);//标准车长
Class.TRANS.BData[l*y+6+j*7+4]=Convert.ToString(a[m*y+26+j*35+4]);//目标速度
Class.TRANS.BData[l*y+6+j*7+5]=Conversion(code,10);//目标地
byte[] CODE=new byte[20];
for(int c=0;c<=19;c++)
{
CODE[c]=Convert.ToByte(a[m*y+31+j*x]);
}
Class.TRANS.BData[l*y+6+j*7+6]=Conversion(CODE,20);//记事
}
Class.TRANS.BData[l*y+6+7*x+1]="xxxx";
}
else
{
MessageBox.Show("数据未找到!");
}
}
#endregion
SData#region SData
public void check_SData(byte[] a,int l,int m,int x)
{
if(a.Length!=0)
{
int y=3+x+1;
int v=(int)(Class.data.SData[13]<<8+Class.data.SData[12]);
Class.TRANS.SData[l*y+0]=a[m*y+2]+"年"+a[m*y+3]+"月"+a[m*y+4]+"日 "+a[m*y+5]+":"+a[m*y+6]+":"+a[m*y+7]+":"+a[m*y+8]+":";//时间
Class.TRANS.SData[l*y+1]=Convert.ToString(a[m*y+11]);//机车ID
Class.TRANS.SData[l*y+2]=Convert.ToString(a[m*y+12]);//总段数
for(int j=0;j<x;j++)
{
Class.TRANS.SData[l*y+3+j]=duan(a[m*y+13+j]);
}
Class.TRANS.SData[l*y+3+x]="xxxx";
}
else
{
MessageBox.Show("数据未找到!");
}
}
#endregion
LData#region LData
public void check_LData(byte[] a,int l,int m,int sign)
{
if(a.Length!=0)
{
int y=3+sign+1;
int v=(int)(Class.data.LData[13]<<8+Class.data.LData[12]);
Class.TRANS.LData[l*y+0]=a[m*y+2]+"年"+a[m*y+3]+"月"+a[m*y+4]+"日 "+a[m*y+5]+":"+a[m*y+6]+":"+a[m*y+7]+":"+a[m*y+8]+":";//时间
Class.TRANS.LData[l*y+1]=Convert.ToString(a[m*y+11]);//机车ID
Class.TRANS.LData[l*y+2]=Convert.ToString(v);//总信号机数
for(int j=1;j<=sign;j++)
{
string J=Convert.ToString(j);
// string s=SignalType(J);
// Class.TRANS.LData[l*y+3+j]=signal(a[m*y+13+j],s);//信号机状态
}
Class.TRANS.LData[l*y+3+sign]="xxxx";
}
else
{
MessageBox.Show("数据未找到!");
}
}
#endregion
LocomData#region LocomData
public void check_LocomData(byte[] a,int l,int m,int ll)
{
string[] state=new string[14];
string State1="";
string State2="";
if(a.Length!=0)
{
int y=16;
机车状态1#region 机车状态1
if((a[m*54+24]&0x01)==1)
{
state[0]="速度防护禁止";
}
else
{
state[0]="速度防护允许";
}
if((a[m*54+24]&0x04)==1)
{
state[1]="速度防护投入";
}
else
{
state[1]="速度防护退出";
}
if((a[m*54+24]&0x04)==1)
{
state[2]="速度防护告警";
}
else
{
state[2]="";
}
if((a[m*54+24]&0x08)==1)
{
state[3]="速度防护动作";
}
else
{
state[3]="";
}
if((a[m*54+24]&0x10)==1)
{
state[4]="距离防护禁止";
}
else
{
state[4]="距离防护允许";
}
if((a[m*54+24]&0x20)==1)
{
state[5]="距离防护投入";
}
else
{
state[5]="距离防护退出";
}
if((a[m*54+24]&0x40)==1)
{
state[6]="距离防护告警";
}
else
{
state[6]="";
}
if((a[m*54+24]&0x80)==1)
{
state[7]="距离防护动作";
}
else
{
state[7]="";
}
for(int ii=0;ii<=7;ii++)
{
if(State1=="")
{
State1=state[ii];
}
if(state[ii]!="")
{
State1=State1+","+state[ii];
}
}
#endregion
机车状态2#region 机车状态2
if((a[m*54+24]&0x01)==1)
{
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
using System.Threading;
using System.Data.SqlClient;
using System.Data.OleDb;
namespace new_search
{
/**//// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
/**//// <summary>
/// 必需的设计器变量。
/// </summary>
win form announce#region win form announce
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem menuItem6;
public System.Windows.Forms.MenuItem menuItem7;
public System.Windows.Forms.MenuItem menuItem8;
public System.Windows.Forms.MenuItem menuItem9;
public System.Windows.Forms.MenuItem menuItem10;
public System.Windows.Forms.MenuItem menuItem11;
public System.Windows.Forms.MenuItem menuItem12;
public System.Windows.Forms.MenuItem menuItem13;
public System.Windows.Forms.MenuItem menuItem14;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.MenuItem menuItem15;
private System.Windows.Forms.StatusBarPanel statusBarPanel1;
private System.Windows.Forms.StatusBarPanel statusBarPanel2;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
public System.Windows.Forms.CheckBox checkBox1;
public System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.CheckBox checkBox3;
public System.Windows.Forms.CheckBox checkBox4;
public System.Windows.Forms.CheckBox checkBox5;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
public System.Windows.Forms.CheckBox checkBox6;
public System.Windows.Forms.CheckBox checkBox7;
public System.Windows.Forms.CheckBox checkBox8;
public System.Windows.Forms.CheckBox checkBox9;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.TextBox textBox8;
private System.Windows.Forms.TextBox textBox9;
private System.Windows.Forms.TextBox textBox10;
private System.Windows.Forms.TextBox textBox11;
private System.Windows.Forms.TextBox textBox12;
private System.Windows.Forms.TextBox textBox13;
public System.Windows.Forms.CheckBox checkBox10;
public System.Windows.Forms.CheckBox checkBox11;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem18;
private System.Windows.Forms.MenuItem menuItem19;
private System.Windows.Forms.MenuItem menuItem20;
private System.Windows.Forms.MenuItem menuItem21;
private System.Windows.Forms.MenuItem menuItem22;
private System.Windows.Forms.MenuItem menuItem16;
private System.Windows.Forms.MenuItem menuItem17;
private System.Windows.Forms.MenuItem menuItem23;
#endregion
/**//// <summary>
/// 数据库声明
/// </summary>
public System.ComponentModel.Container components = null;
public System.Data.OleDb.OleDbDataAdapter oAde;
public System.Data.OleDb.OleDbConnection oConn;
public System.Data.OleDb.OleDbCommand oCmd=null;
public System.Data.OleDb.OleDbDataReader thisReader;
public System.Data.DataSet myDataSet;
private System.Data.SqlClient.SqlConnection mySqlConnection;
private string ErrCode="";
private string sort="";
public string sql;//查詢語句
// public int langth=0;
public int x=0;
/**//// <summary>
/// 声明调用文件
/// </summary>
public Form2 Form2;
public help help=new help();
public result result;
public Class Class;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
Form2 =new Form2();
Form2.Show();
this.statusBarPanel1.Text ="时间:"+System.DateTime.Now;
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/**//// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
Windows 窗体设计器生成的代码#region Windows 窗体设计器生成的代码
/**//// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.menuItem7 = new System.Windows.Forms.MenuItem();
this.menuItem11 = new System.Windows.Forms.MenuItem();
this.menuItem12 = new System.Windows.Forms.MenuItem();
this.menuItem13 = new System.Windows.Forms.MenuItem();
this.menuItem14 = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.menuItem8 = new System.Windows.Forms.MenuItem();
this.menuItem9 = new System.Windows.Forms.MenuItem();
this.menuItem10 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem22 = new System.Windows.Forms.MenuItem();
this.menuItem21 = new System.Windows.Forms.MenuItem();
this.menuItem20 = new System.Windows.Forms.MenuItem();
this.menuItem19 = new System.Windows.Forms.MenuItem();
this.menuItem18 = new System.Windows.Forms.MenuItem();
this.menuItem16 = new System.Windows.Forms.MenuItem();
this.menuItem17 = new System.Windows.Forms.MenuItem();
this.menuItem23 = new System.Windows.Forms.MenuItem();
this.menuItem15 = new System.Windows.Forms.MenuItem();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.checkBox5 = new System.Windows.Forms.CheckBox();
this.checkBox4 = new System.Windows.Forms.CheckBox();
this.checkBox3 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.textBox6 = new System.Windows.Forms.TextBox();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.checkBox11 = new System.Windows.Forms.CheckBox();
this.checkBox10 = new System.Windows.Forms.CheckBox();
this.textBox12 = new System.Windows.Forms.TextBox();
this.textBox13 = new System.Windows.Forms.TextBox();
this.textBox11 = new System.Windows.Forms.TextBox();
this.textBox9 = new System.Windows.Forms.TextBox();
this.textBox8 = new System.Windows.Forms.TextBox();
this.textBox10 = new System.Windows.Forms.TextBox();
this.checkBox6 = new System.Windows.Forms.CheckBox();
this.checkBox7 = new System.Windows.Forms.CheckBox();
this.checkBox9 = new System.Windows.Forms.CheckBox();
this.checkBox8 = new System.Windows.Forms.CheckBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.textBox7 = new System.Windows.Forms.TextBox();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
this.tabControl1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem4,
this.menuItem2,
this.menuItem15});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem3});
this.menuItem1.Shortcut = System.Windows.Forms.Shortcut.CtrlF;
this.menuItem1.Text = "文件(F)";
//
// menuItem3
//
this.menuItem3.Index = 0;
this.menuItem3.Text = "退出";
this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
//
// menuItem4
//
this.menuItem4.Index = 1;
this.menuItem4.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem5,
this.menuItem6});
this.menuItem4.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
this.menuItem4.Text = "选择查询表单(S)";
//
// menuItem5
//
this.menuItem5.Index = 0;
this.menuItem5.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem7,
this.menuItem11,
this.menuItem12,
this.menuItem13,
this.menuItem14});
this.menuItem5.Text = "轨道电路";
//
// menuItem7
//
this.menuItem7.Index = 0;
this.menuItem7.Text = "进路命令表";
this.menuItem7.Click += new System.EventHandler(this.menuItem7_Click);
//
// menuItem11
//
this.menuItem11.Index = 1;
this.menuItem11.Text = "调车单";
this.menuItem11.Click += new System.EventHandler(this.menuItem11_Click);
//
// menuItem12
//
this.menuItem12.Index = 2;
this.menuItem12.Text = "机车回视数据表";
this.menuItem12.Click += new System.EventHandler(this.menuItem12_Click);
//
// menuItem13
//
this.menuItem13.Index = 3;
this.menuItem13.Text = "全站段状态表";
this.menuItem13.Click += new System.EventHandler(this.menuItem13_Click);
//
// menuItem14
//
this.menuItem14.Index = 4;
this.menuItem14.Text = "全段信号状态表";
this.menuItem14.Click += new System.EventHandler(this.menuItem14_Click);
//
// menuItem6
//
this.menuItem6.Index = 1;
this.menuItem6.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem8,
this.menuItem9,
this.menuItem10});
this.menuItem6.Text = "点式应答器";
//
// menuItem8
//
this.menuItem8.Index = 0;
this.menuItem8.Text = "驼峰C";
this.menuItem8.Click += new System.EventHandler(this.menuItem8_Click);
//
// menuItem9
//
this.menuItem9.Index = 1;
this.menuItem9.Text = "驼峰S";
this.menuItem9.Click += new System.EventHandler(this.menuItem9_Click);
//
// menuItem10
//
this.menuItem10.Index = 2;
this.menuItem10.Text = "驼峰B";
this.menuItem10.Click += new System.EventHandler(this.menuItem10_Click);
//
// menuItem2
//
this.menuItem2.Index = 2;
this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem22,
this.menuItem21,
this.menuItem20,
this.menuItem19,
this.menuItem18,
this.menuItem16,
this.menuItem17,
this.menuItem23});
this.menuItem2.Text = "查询单表";
//
// menuItem22
//
this.menuItem22.Index = 0;
this.menuItem22.Text = "全段信号状态表";
this.menuItem22.Click += new System.EventHandler(this.menuItem22_Click);
//
// menuItem21
//
this.menuItem21.Index = 1;
this.menuItem21.Text = "全站段状态表";
this.menuItem21.Click += new System.EventHandler(this.menuItem21_Click);
//
// menuItem20
//
this.menuItem20.Index = 2;
this.menuItem20.Text = "机车回视数据表";
this.menuItem20.Click += new System.EventHandler(this.menuItem20_Click);
//
// menuItem19
//
this.menuItem19.Index = 3;
this.menuItem19.Text = "调车单";
this.menuItem19.Click += new System.EventHandler(this.menuItem19_Click);
//
// menuItem18
//
this.menuItem18.Index = 4;
this.menuItem18.Text = "进路命令表";
this.menuItem18.Click += new System.EventHandler(this.menuItem18_Click);
//
// menuItem16
//
this.menuItem16.Index = 5;
this.menuItem16.Text = "TW-C";
this.menuItem16.Click += new System.EventHandler(this.menuItem16_Click_1);
//
// menuItem17
//
this.menuItem17.Index = 6;
this.menuItem17.Text = "TW-S";
this.menuItem17.Click += new System.EventHandler(this.menuItem17_Click);
//
// menuItem23
//
this.menuItem23.Index = 7;
this.menuItem23.Text = "TW-B";
this.menuItem23.Click += new System.EventHandler(this.menuItem23_Click);
//
// menuItem15
//
this.menuItem15.Index = 3;
this.menuItem15.Shortcut = System.Windows.Forms.Shortcut.F1;
this.menuItem15.Text = "帮助(H)";
this.menuItem15.Click += new System.EventHandler(this.menuItem15_Click);
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(0, 400);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
this.statusBarPanel2,
this.statusBarPanel1});
this.statusBar1.ShowPanels = true;
this.statusBar1.Size = new System.Drawing.Size(632, 25);
this.statusBar1.TabIndex = 2;
this.statusBar1.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar1_PanelClick);
//
// statusBarPanel2
//
this.statusBarPanel2.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
this.statusBarPanel2.Text = " 欢迎使用本查询软件";
this.statusBarPanel2.Width = 564;
//
// statusBarPanel1
//
this.statusBarPanel1.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
this.statusBarPanel1.Text = "时间:";
this.statusBarPanel1.Width = 52;
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(632, 400);
this.tabControl1.TabIndex = 20;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.button2);
this.tabPage2.Controls.Add(this.button1);
this.tabPage2.Controls.Add(this.groupBox1);
this.tabPage2.Controls.Add(this.label2);
this.tabPage2.Controls.Add(this.label1);
this.tabPage2.Controls.Add(this.textBox6);
this.tabPage2.Location = new System.Drawing.Point(4, 21);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(624, 375);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "轨道电路";
//
// button2
//
this.button2.Location = new System.Drawing.Point(376, 320);
this.button2.Name = "button2";
this.button2.TabIndex = 16;
this.button2.Text = "退出";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(160, 320);
this.button1.Name = "button1";
this.button1.TabIndex = 15;
this.button1.Text = "确定";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.textBox2);
this.groupBox1.Controls.Add(this.textBox5);
this.groupBox1.Controls.Add(this.textBox1);
this.groupBox1.Controls.Add(this.textBox3);
this.groupBox1.Controls.Add(this.textBox4);
this.groupBox1.Controls.Add(this.checkBox5);
this.groupBox1.Controls.Add(this.checkBox4);
this.groupBox1.Controls.Add(this.checkBox3);
this.groupBox1.Controls.Add(this.checkBox2);
this.groupBox1.Controls.Add(this.checkBox1);
this.groupBox1.Location = new System.Drawing.Point(32, 128);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(568, 168);
this.groupBox1.TabIndex = 14;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "查询方向";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(168, 72);
this.textBox2.Name = "textBox2";
this.textBox2.TabIndex = 9;
this.textBox2.Text = "";
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(424, 72);
this.textBox5.Name = "textBox5";
this.textBox5.TabIndex = 12;
this.textBox5.Text = "";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(168, 32);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 8;
this.textBox1.Text = "";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(168, 112);
this.textBox3.Name = "textBox3";
this.textBox3.TabIndex = 10;
this.textBox3.Text = "";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(424, 32);
this.textBox4.Name = "textBox4";
this.textBox4.TabIndex = 11;
this.textBox4.Text = "";
//
// checkBox5
//
this.checkBox5.Location = new System.Drawing.Point(304, 72);
this.checkBox5.Name = "checkBox5";
this.checkBox5.TabIndex = 6;
this.checkBox5.Text = "计划号/车次号";
this.checkBox5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// checkBox4
//
this.checkBox4.Location = new System.Drawing.Point(304, 32);
this.checkBox4.Name = "checkBox4";
this.checkBox4.TabIndex = 5;
this.checkBox4.Text = "进路流水号";
this.checkBox4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// checkBox3
//
this.checkBox3.Location = new System.Drawing.Point(48, 112);
this.checkBox3.Name = "checkBox3";
this.checkBox3.TabIndex = 4;
this.checkBox3.Text = "钩ID";
this.checkBox3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// checkBox2
//
this.checkBox2.Location = new System.Drawing.Point(48, 72);
this.checkBox2.Name = "checkBox2";
this.checkBox2.TabIndex = 3;
this.checkBox2.Text = "段ID";
this.checkBox2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// checkBox1
//
this.checkBox1.Location = new System.Drawing.Point(48, 32);
this.checkBox1.Name = "checkBox1";
this.checkBox1.TabIndex = 2;
this.checkBox1.Text = "机车ID";
this.checkBox1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// label2
//
this.label2.Location = new System.Drawing.Point(160, 88);
this.label2.Name = "label2";
this.label2.TabIndex = 1;
this.label2.Text = "查询时间:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label1
//
this.label1.Font = new System.Drawing.Font("华文新魏", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label1.Location = new System.Drawing.Point(144, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(312, 56);
this.label1.TabIndex = 0;
this.label1.Text = "选择查询类别,填充关键字";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(320, 88);
this.textBox6.Name = "textBox6";
this.textBox6.TabIndex = 13;
this.textBox6.Text = "";
//
// tabPage1
//
this.tabPage1.Controls.Add(this.groupBox2);
this.tabPage1.Controls.Add(this.label4);
this.tabPage1.Controls.Add(this.label3);
this.tabPage1.Controls.Add(this.textBox7);
this.tabPage1.Controls.Add(this.button3);
this.tabPage1.Controls.Add(this.button4);
this.tabPage1.Location = new System.Drawing.Point(4, 21);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(624, 375);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "点式应答器";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.checkBox11);
this.groupBox2.Controls.Add(this.checkBox10);
this.groupBox2.Controls.Add(this.textBox12);
this.groupBox2.Controls.Add(this.textBox13);
this.groupBox2.Controls.Add(this.textBox11);
this.groupBox2.Controls.Add(this.textBox9);
this.groupBox2.Controls.Add(this.textBox8);
this.groupBox2.Controls.Add(this.textBox10);
this.groupBox2.Controls.Add(this.checkBox6);
this.groupBox2.Controls.Add(this.checkBox7);
this.groupBox2.Controls.Add(this.checkBox9);
this.groupBox2.Controls.Add(this.checkBox8);
this.groupBox2.Location = new System.Drawing.Point(32, 128);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(568, 168);
this.groupBox2.TabIndex = 6;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "查询方向";
//
// checkBox11
//
this.checkBox11.Location = new System.Drawing.Point(304, 112);
this.checkBox11.Name = "checkBox11";
this.checkBox11.TabIndex = 10;
this.checkBox11.Text = "机车速度";
//
// checkBox10
//
this.checkBox10.Location = new System.Drawing.Point(304, 72);
this.checkBox10.Name = "checkBox10";
this.checkBox10.TabIndex = 9;
this.checkBox10.Text = "股道位置";
//
// textBox12
//
this.textBox12.Location = new System.Drawing.Point(424, 72);
this.textBox12.Name = "textBox12";
this.textBox12.TabIndex = 7;
this.textBox12.Text = "";
//
// textBox13
//
this.textBox13.Location = new System.Drawing.Point(424, 112);
this.textBox13.Name = "textBox13";
this.textBox13.TabIndex = 8;
this.textBox13.Text = "";
//
// textBox11
//
this.textBox11.Location = new System.Drawing.Point(424, 32);
this.textBox11.Name = "textBox11";
this.textBox11.TabIndex = 6;
this.textBox11.Text = "";
//
// textBox9
//
this.textBox9.Location = new System.Drawing.Point(168, 72);
this.textBox9.Name = "textBox9";
this.textBox9.TabIndex = 4;
this.textBox9.Text = "";
//
// textBox8
//
this.textBox8.Location = new System.Drawing.Point(168, 32);
this.textBox8.Name = "textBox8";
this.textBox8.TabIndex = 3;
this.textBox8.Text = "";
//
// textBox10
//
this.textBox10.Location = new System.Drawing.Point(168, 112);
this.textBox10.Name = "textBox10";
this.textBox10.TabIndex = 5;
this.textBox10.Text = "";
//
// checkBox6
//
this.checkBox6.Location = new System.Drawing.Point(48, 32);
this.checkBox6.Name = "checkBox6";
this.checkBox6.TabIndex = 2;
this.checkBox6.Text = "溜放状态";
this.checkBox6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// checkBox7
//
this.checkBox7.Location = new System.Drawing.Point(48, 72);
this.checkBox7.Name = "checkBox7";
this.checkBox7.TabIndex = 3;
this.checkBox7.Text = "T1/T2";
this.checkBox7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// checkBox9
//
this.checkBox9.Location = new System.Drawing.Point(304, 32);
this.checkBox9.Name = "checkBox9";
this.checkBox9.TabIndex = 5;
this.checkBox9.Text = "调机编号";
//
// checkBox8
//
this.checkBox8.Location = new System.Drawing.Point(48, 112);
this.checkBox8.Name = "checkBox8";
this.checkBox8.TabIndex = 4;
this.checkBox8.Text = "作业车次号";
this.checkBox8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label4
//
this.label4.Location = new System.Drawing.Point(160, 88);
this.label4.Name = "label4";
this.label4.TabIndex = 1;
this.label4.Text = "查询时间:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label3
//
this.label3.Font = new System.Drawing.Font("华文新魏", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label3.Location = new System.Drawing.Point(128, 16);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(344, 56);
this.label3.TabIndex = 0;
this.label3.Text = "选择查询类别,填充关键字";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(320, 88);
this.textBox7.Name = "textBox7";
this.textBox7.TabIndex = 2;
this.textBox7.Text = "";
//
// button3
//
this.button3.Location = new System.Drawing.Point(160, 320);
this.button3.Name = "button3";
this.button3.TabIndex = 0;
this.button3.Text = "确定";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(376, 320);
this.button4.Name = "button4";
this.button4.TabIndex = 1;
this.button4.Text = "退出";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// Form1
//
this.AllowDrop = true;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(632, 425);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.statusBar1);
this.HelpButton = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "分类查询";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
this.tabControl1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/**//// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
main#region main
// search(x,0,54,0,Class.data.LocomData,"LOCOM_DATA");
/**/////
// group(x,30,31,3,Class.data.RcData,"RC_DATA",false);
/**/////
// group(x,12,13,1,Class.data.SData,"S_DATA",false);
/**/////
// group(x,12,14,1,Class.data.LData,"L_DATA",false);
/**///// group(x,8,9,5,Class.data.B_Data,"tw_b",false);
////
//// group(x,0,23,0,Class.data.C_Data,"tw_c",false);
////
//// group(x,0,31,0,Class.data.S_Data,"tw_s",false);
#endregion
menu#region menu
/**//// <summary>
/// menu
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <param name="c"></param>
public void re(string a)
{
string b=textBox6.Text;
switch(a)
{
case "LOCOM_DATA":
x=getcheck("LOCOM_DATA",textBox6.Text,"LOCOM_DATA");//mySqlDataAdapter.Fill()
Class.langth.langth_locom=0;
Class.data.LocomData=new byte[x];
Table(Class.data.LocomData,"LOCOM_DATA",x);//提取当前数据,写入标本数组
group(x,0,54,0,Class.data.LocomData,"LOCOM_DATA",Class.langth.langth_locom);
break;
case "tw_b":
Class.langth.langth_tw_b=0;
x=getcheck("tw_b",textBox6.Text,"tw_b");
Class.data.B_Data=new byte[x];
Table(Class.data.B_Data,"tw_b",x);
group(x,8,9,5,Class.data.B_Data,"tw_b",Class.langth.langth_tw_b);
break;
case "RC_DATA":
Class.langth.langth_rc=0;
x=getcheck("RC_DATA",textBox6.Text,"RC_DATA");
Class.data.RcData=new byte[x];
Table(Class.data.RcData,"RC_DATA",x);
group(x,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
break;
case "B_DATA":
Class.langth.langth_b=0;
x=getcheck("B_DATA",textBox6.Text,"B_DATA");
Class.data.BData=new byte[x];
Table(Class.data.BData,"B_DATA",x);
group(x,23,24,35,Class.data.BData,"B_DATA",Class.langth.langth_b);
break;
case "S_DATA":
Class.langth.langth_s=0;
x=getcheck("S_DATA",textBox6.Text,"S_DATA");
Class.data.SData=new byte[x];
Table(Class.data.SData,"S_DATA",x);
group(x,12,13,1,Class.data.SData,"S_DATA",Class.langth.langth_s);
break;
case "L_DATA":
Class.langth.langth_l=0;
x=getcheck("L_DATA",textBox6.Text,"L_DATA");
Class.data.LData=new byte[x];
Table(Class.data.LData,"L_DATA",x);
group(x,12,14,1,Class.data.LData,"L_DATA",Class.langth.langth_l);
break;
case "tw_c":
Class.langth.langth_tw_c=0;
x=getcheck("tw_c",textBox6.Text,"tw_c");
Class.data.C_Data=new byte[x];
Table(Class.data.C_Data,"tw_c",x);
group(x,0,23,0,Class.data.C_Data,"tw_c",Class.langth.langth_tw_c);
break;
case "tw_s":
Class.langth.langth_tw_s=0;
x=getcheck("tw_s",textBox6.Text,"tw_s");
Class.data.S_Data=new byte[x];
Table(Class.data.S_Data,"tw_s",x);
group(x,0,31,0,Class.data.S_Data,"tw_s",Class.langth.langth_tw_s);
break;
default:
MessageBox.Show("error!");
break;
/**/////////////////////////////trans.langth
}
}
#endregion
查找项目#region 查找项目
private void search(string locom)
{
string id="";
int count=0;
int duan=0;
/**////是否有考虑不周全的地方???
///
if(locom=="locom")
{
if(checkBox3.Checked==true)
{
钩ID#region 钩ID
count=Class.data.BData[23];/**///////////////////////////数据包长度
for(int i=0;i<count;i++)
{
if(Convert.ToString(Class.data.BData[24+7*i])==textBox3.Text)//钩ID
{
if(checkBox1.Checked==true)//机车ID
{
if(Convert.ToString(Class.data.BData[11])==textBox1.Text)
{
instantiation(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA");
group(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA",Class.langth.langth_b);
}
}
else
{
instantiation(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA");
group(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA",Class.langth.langth_b);
}
}
}
#endregion
}
if(checkBox1.Checked==true)//机车ID
{
机车ID#region 机车ID
if((Convert.ToString(Class.data.BData[11])==textBox1.Text)||
(Convert.ToString(Class.data.LData[11])==textBox1.Text)||
(Convert.ToString(Class.data.LocomData[11])==textBox1.Text)||
(Convert.ToString(Class.data.RcData[11])==textBox1.Text)||
(Convert.ToString(Class.data.SData[11])==textBox1.Text))
{
if(checkBox5.Checked==true)//计划号/车次号
{
计划号/车次号#region 计划号/车次号
if(Convert.ToString(Class.data.RcData[13])==textBox5.Text)
{
if(checkBox4.Checked==true)//进路流水号
{
进路流水号#region 进路流水号
if(Convert.ToString(Class.data.RcData[12])==textBox4.Text)
{
if(checkBox2.Checked==true)//段ID
{
段ID#region 段ID
count=Class.data.RcData[30];
for(int i=0;i<count;i++)
{
id=Convert.ToString((Class.data.RcData[31+4*i]<<8)+Class.data.RcData[31+4*i+1]);
if(id==textBox2.Text)
{
duan=1;
}
}
if(duan==1)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
#endregion
}
else
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
}
#endregion
}
else
{
if(checkBox2.Checked==true)//段ID
{
段ID#region 段ID
count=Class.data.RcData[30];
for(int i=0;i<count;i++)
{
id=Convert.ToString((Class.data.RcData[31+4*i]<<8)+Class.data.RcData[31+4*i+1]);
if(id==textBox2.Text)
{
duan=1;
}
}
if(duan==1)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
#endregion
}
else
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
}
}
if((Convert.ToString(Class.data.BData[12])==textBox5.Text)&&
(checkBox2.Checked!=true)&&(checkBox4.Checked!=true))
{
instantiation(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA");
group(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA",Class.langth.langth_b);
}
if((Convert.ToString(Class.data.LocomData[12])==textBox5.Text)&&
(checkBox2.Checked!=true)&&(checkBox4.Checked!=true))
{
instantiation(Class.data.LocomData.Length,0,54,0,Class.data.LocomData,"LOCOM_DATA");
group(Class.data.LocomData.Length,0,54,0,Class.data.LocomData,"LOCOM_DATA",Class.langth.langth_locom);
}
#endregion
}
else
{
if(Convert.ToString(Class.data.RcData[11])==textBox1.Text)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
if(Convert.ToString(Class.data.BData[11])==textBox1.Text)
{
instantiation(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA");
group(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA",Class.langth.langth_b);
}
if(Convert.ToString(Class.data.LData[11])==textBox1.Text)
{
instantiation(Class.data.LData.Length,12,14,1,Class.data.LData,"L_DATA");
group(Class.data.LData.Length,12,14,1,Class.data.LData,"L_DATA",Class.langth.langth_l);
}
if(Convert.ToString(Class.data.LocomData[11])==textBox1.Text)
{
instantiation(Class.data.LocomData.Length,0,54,0,Class.data.LocomData,"LOCOM_DATA");
group(Class.data.LocomData.Length,0,54,0,Class.data.LocomData,"LOCOM_DATA",Class.langth.langth_locom);
}
if(Convert.ToString(Class.data.SData[11])==textBox1.Text)
{
instantiation(Class.data.SData.Length,12,13,1,Class.data.SData,"S_DATA");
group(Class.data.SData.Length,12,13,1,Class.data.SData,"S_DATA",Class.langth.langth_s);
}
}
}
else
{
if(checkBox2.Checked==true)//段ID
{
段ID#region 段ID
count=Class.data.RcData[30];
for(int i=0;i<count;i++)
{
id=Convert.ToString((Class.data.RcData[31+4*i]<<8)+Class.data.RcData[31+4*i+1]);
if(id==textBox2.Text)
{
if(checkBox4.Checked==true)//进路流水号
{
进路流水号#region 进路流水号
if(Convert.ToString(Class.data.RcData[12])==textBox4.Text)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
break;
}
break;
#endregion
}
else
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
break;
}
}
}
#endregion
}
else
{
if(checkBox4.Checked==true)//进路流水号
{
进路流水号#region 进路流水号
if(Convert.ToString(Class.data.RcData[12])==textBox4.Text)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
#endregion
}
}
}
#endregion
}
}
else
{
if(checkBox5.Checked==true)//计划号/车次号
{
计划号/车次号#region 计划号/车次号
if(Convert.ToString(Class.data.RcData[13])==textBox5.Text)
{
if(checkBox4.Checked==true)//进路流水号
{
进路流水号#region 进路流水号
if(Convert.ToString(Class.data.RcData[12])==textBox4.Text)
{
if(checkBox2.Checked==true)//段ID
{
段ID#region 段ID
count=Class.data.RcData[30];
for(int i=0;i<count;i++)
{
id=Convert.ToString((Class.data.RcData[31+4*i]<<8)+Class.data.RcData[31+4*i+1]);
if(id==textBox2.Text)
{
duan=1;
}
}
if(duan==1)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
#endregion
}
else
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
}
#endregion
}
else
{
if(checkBox2.Checked==true)//段ID
{
段ID#region 段ID
count=Class.data.RcData[30];
for(int i=0;i<count;i++)
{
id=Convert.ToString((Class.data.RcData[31+4*i]<<8)+Class.data.RcData[31+4*i+1]);
if(id==textBox2.Text)
{
duan=1;
}
}
if(duan==1)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
#endregion
}
else
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
}
}
if((Convert.ToString(Class.data.BData[12])==textBox5.Text)&&
(checkBox2.Checked!=true)&&(checkBox4.Checked!=true))
{
instantiation(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA");
group(Class.data.BData.Length,23,24,35,Class.data.BData,"B_DATA",Class.langth.langth_b);
}
if((Convert.ToString(Class.data.LocomData[12])==textBox5.Text)&&
(checkBox2.Checked!=true)&&(checkBox4.Checked!=true))
{
instantiation(Class.data.LocomData.Length,0,54,0,Class.data.LocomData,"LOCOM_DATA");
group(Class.data.LocomData.Length,0,54,0,Class.data.LocomData,"LOCOM_DATA",Class.langth.langth_locom);
}
#endregion
}
else
{
if(checkBox2.Checked==true)//段ID
{
段ID#region 段ID
count=Class.data.RcData[30];
for(int i=0;i<count;i++)
{
id=Convert.ToString((Class.data.RcData[31+4*i]<<8)+Class.data.RcData[31+4*i+1]);
if(id==textBox2.Text)
{
if(checkBox4.Checked==true)//进路流水号
{
进路流水号#region 进路流水号
if(Convert.ToString(Class.data.RcData[12])==textBox4.Text)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
break;
}
break;
#endregion
}
else
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
break;
}
}
}
#endregion
}
else
{
if(checkBox4.Checked==true)//进路流水号
{
进路流水号#region 进路流水号
if(Convert.ToString(Class.data.RcData[12])==textBox4.Text)
{
instantiation(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA");
group(Class.data.RcData.Length,30,31,3,Class.data.RcData,"RC_DATA",Class.langth.langth_rc);
}
#endregion
}
}
}
}
}
#endregion
读数据#region 读数据
private void readin(string locom)
{
switch(locom)
{
case "locom":
x=getcheck("RC_DATA",textBox6.Text,"RC_DATA");
Class.data.RcData=new byte[x];
Table(Class.data.RcData,"RC_DATA",x);
x=getcheck("S_DATA",textBox6.Text,"S_DATA");
Class.data.SData=new byte[x];
Table(Class.data.SData,"S_DATA",x);
x=getcheck("LOCOM_DATA",textBox6.Text,"LOCOM_DATA");//mySqlDataAdapter.Fill()
Class.data.LocomData=new byte[x];
Table(Class.data.LocomData,"LOCOM_DATA",x);//提取当前数据,写入标本数组
x=getcheck("L_DATA",textBox6.Text,"L_DATA");
Class.data.LData=new byte[x];
Table(Class.data.LData,"L_DATA",x);
x=getcheck("B_DATA",textBox6.Text,"B_DATA");
Class.data.BData=new byte[x];
Table(Class.data.BData,"B_DATA",x);
break;
case "tw":
x=getcheck("tw_b",textBox6.Text,"tw_b");
Class.data.B_Data=new byte[x];
Table(Class.data.B_Data,"tw_b",x);
x=getcheck("tw_c",textBox6.Text,"tw_c");
Class.data.C_Data=new byte[x];
Table(Class.data.C_Data,"tw_c",x);
x=getcheck("tw_s",textBox6.Text,"tw_s");
Class.data.S_Data=new byte[x];
Table(Class.data.S_Data,"tw_s",x);
break;
}
}
#endregion
写数据#region 写数据
public void Table(byte[] c,string b,int x)
{
DataTable myDataTable=myDataSet.Tables[b];
int i=0;
/**////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(x>0)
{
switch(b)
{
case "RC_DATA":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.RcData[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
case "B_DATA":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.BData[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
case "LOCOM_DATA":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.LocomData[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
case "S_DATA":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.SData[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
case "L_DATA":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.LData[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
case "tw_c":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.C_Data[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
case "tw_s":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.S_Data[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
case "tw_b":
foreach(DataRow myDataRow in myDataTable.Rows)
{
Class.data.B_Data[i]=Convert.ToByte(myDataRow[b].ToString());
i++;
}
break;
}
}
mySqlConnection.Close();
}
#endregion
分组#region 分组
public void group(int x,int n,int m,int o,byte[] a,string b,int langth)
{
int y=0,j=0,z=0;
if((n!=0)&&(a.Length!=0))
{
try
{
y=a[n];//记录单组数量
}
catch (Exception ex)
{
ErrCode=ex.Message.ToString();
MessageBox.Show(ErrCode);
}
}
else
{
y=0;
}
z=m+y*o;
byte[] singel=new byte[z];
if(a.Length!=0)
{
int i=0;
int group=(x/z);
if(group>0)
{
do
{
for(i=0;i<(z-1);i++)
{
singel[i]=a[j+i];
}
Fillin(singel,b,y,langth);
langth++;
j=j+z;
}while(j<x);
}
}
}
#endregion
trans实例化#region trans实例化
public void instantiation(int x,int n,int m,int o,byte[] a,string b)
{
int y=0,z=0;
if((n!=0)&&(a.Length!=0))
{
try
{
y=a[n];//记录单组数量
}
catch (Exception ex)
{
ErrCode=ex.Message.ToString();
MessageBox.Show(ErrCode);
}
}
else
{
y=0;
}
z=m+y*o;
byte[] singel=new byte[z];
if(a.Length!=0)
{
int c=0,d=0;
int group=(x/z);
if(group>0)
{
switch(b)
{
case "LOCOM_DATA":
c=16;
Class.TRANS.LocomData=new string[group*(c+1)];
break;
case "RC_DATA":
c=Class.data.RcData[30];
d=17+4*c;
Class.TRANS.RcData=new string[group*(d+1)];
break;
case "tw_b":
c=Class.data.B_Data[9];
d=3+5*c+1;
Class.TRANS.B_Data=new string[group*(d+1)];
break;
case "B_DATA":
c=Class.data.BData[23];
d=6+7*c+1;
Class.TRANS.BData=new string[group*(d+1)];
break;
case "S_DATA":
c=(Class.data.SData[13]<<8+Class.data.SData[12]);/**////////////////////////////////////////////2
d=3+c+1;
Class.TRANS.SData=new string[group*d];
break;
case "L_DATA":
c=(Class.data.LData[13]<<8+Class.data.LData[12]);
//int sign=(int)(Class.data.LData[13]<<8+Class.data.LData[12]);/////////////////////////////2
d=c+3;
Class.TRANS.LData=new string[group*(d+1)];
break;
case "tw_c":
c=16;
Class.TRANS.C_Data=new string[group*(c+1)];
break;
case "tw_s":
c=22;
Class.TRANS.S_Data=new string[group*(c+1)];
break;
default:
MessageBox.Show("数据出错!");
this.statusBarPanel2.Text ="数据出错!";
break;
}
}
}
}
#endregion
Fillin#region Fillin
private void Fillin(byte[] singel,string b,int y,int l)
{
switch(b)
{/**//////////////////////////////////////////////////////////////////////////
case "RC_DATA":
check_RCData(singel,l,0,Class.data.RcData[30]);
break;
case "B_DATA":
check_BData(singel,l,0,Class.data.BData[23]);
break;
case "LOCOM_DATA":
check_LocomData(singel,l,0,0);
break;
case "S_DATA":
check_SData(singel,l,0,Class.data.SData[12]);
break;
case "L_DATA":
check_LData(singel,l,0,Class.data.LData[12]);
break;
case "tw_c":
check_C_Data(singel,l,0,0);
break;
case "tw_s":
check_S_Data(singel,l,0,0);
break;
case "tw_b":
check_B_Data(singel,l,0,Class.data.B_Data[9]);
break;
default:
MessageBox.Show("数据出错!");
this.statusBarPanel2.Text ="数据出错!";
break;
}
}
#endregion
數據庫查詢#region 數據庫查詢
public int getcheck(string a,string time,string b)
{
//a->项目名称,time->查询时间,b-〉数据库名称
//查询
int x=0;
mySqlConnection=new SqlConnection("server=(local);database=GroundDB;uid=sa;pwd=sa");
SqlCommand mySqlCommand=mySqlConnection.CreateCommand();
if(time!="")
{
mySqlCommand.CommandText=string.Format("SELECT {0} FROM {1} WHERE TIME={2} ",a,b,time);
}
else
{
mySqlCommand.CommandText=string.Format("SELECT {0} FROM {1} ",a,b);
}
SqlDataAdapter mySqlDataAdapter=new SqlDataAdapter();
mySqlDataAdapter.SelectCommand=mySqlCommand;
myDataSet=new DataSet();
try
{
mySqlConnection.Open();
}
catch (Exception ex)
{
ErrCode=ex.Message.ToString();
MessageBox.Show(ErrCode);
}
try
{
x=mySqlDataAdapter.Fill(myDataSet,b);
}
catch(Exception ex)
{
ErrCode=ex.Message.ToString();
MessageBox.Show(ErrCode);
}
return x;
}
#endregion
输出表单#region 输出表单
/**//// <summary>
/// 输出表单
/// </summary>
// public void checkdata(byte[] singel,string b,int l,int m,int ll)
// {
// switch(b)
// {
// case "RC_DATA":check_RCData(singel,l,m,ll);
// break;
// case "B_DATA":check_BData(singel,l,m,ll);
// break;
// case "LOCOM_DATA":check_LocomData(singel,l,m,ll);
// break;
// case "S_DATA":check_SData(singel,l,m,ll);
// break;
// case "L_DATA":check_LData(singel,l,m,ll);
// break;
// case "tw_c":check_C_Data(singel,l,m,ll);
// break;
// case "tw_s":check_S_Data(singel,l,m,ll);
// break;
// case "tw_b":check_B_Data(singel,l,m,ll);
// break;
// }
// }
#endregion
定义标题,填充数据#region 定义标题,填充数据
RCData#region RCData
public void check_RCData(byte[] a,int l,int m,int x)
{
string plan="";
string signalstate;
if(a.Length!=0)
{
plan=PlanProperty(a,24);
int y=17+4*x+1;
int RouteNum=a[y*m+12];
byte[] code=new byte[10];
if(RouteNum==0)
{
Class.TRANS.RcData[l*y+2]="未办理有效进路";//进路流水号
}
else
{
Class.TRANS.RcData[l*y+2]=Convert.ToString(a[y*m+12]);
}
for(int c=0;c<=9;c++)
{
code[c]=Convert.ToByte(a[y*m+13+c]);
}
RouteProperty(a,Class.TRANS.RcData,l,y,m);//进路属性
HumpCmd(a,Class.TRANS.RcData,l,y,m);//推峰命令
DataID(a,Class.TRANS.RcData,l,y,m);//请求ID
Class.TRANS.RcData[l*y]=a[y*m+2]+"年"+a[y*m+3]+"月"+a[y*m+4]+"日 "+a[y*m+5]+":"+a[y*m+6]+":"+a[y*m+7]+":"+a[y*m+8]+":";//时间
Class.TRANS.RcData[l*y+1]=Convert.ToString(a[y*m+11]);//机车ID
Class.TRANS.RcData[l*y+3]=Conversion(code,10);//计划号
Class.TRANS.RcData[l*y+10]=plan;//计划属性
Class.TRANS.RcData[l*y+11]=Convert.ToString(a[y*m+25]);//当前计划地执行钩序
Class.TRANS.RcData[l*y+12]=Convert.ToString((a[y*m+27]<<8)+a[y*m+26]);//驼峰高柱ID
Class.TRANS.RcData[l*y+16]=Convert.ToString(a[y*m+30]);//总段数
/**/////////////////////////////////////////核对一下item 与数组定义是否一致
for(int j=0;j<x;j++)
{
Class.TRANS.RcData[l*y+16+j*x+1]=Convert.ToString((a[y*m+31+j*x]<<8)+a[y*m+31+j*x+1]);//段ID
Class.TRANS.RcData[l*y+16+j*x+2]=duan(a[y*m+32+j*x]);//段状态
// signalstate=SignalState(Class.TRANS.RcData[l*y+16+j*x],"up");
// Class.TRANS.RcData[l*y+16+j*x+3]="防护下行方向信号"+signal((a[y*m+33+j*x]&0xF0),signalstate);//信号机状态
// signalstate=SignalState(Class.TRANS.RcData[l*y+16+j*x],"down");
// Class.TRANS.RcData[l*y+16+j*x+4]="防护上行方向信号"+signal((a[y*m+33+j*x]&0x0F),signalstate);//信号机状态
}
Class.TRANS.RcData[l*y+16+4*x+1]="xxxx";
}
else
{
MessageBox.Show("数据未找到!");
}
}
#endregion
BData#region BData
public void check_BData(byte[] a,int l,int m,int x)
{
string plan="";
if(a.Length!=0)
{
plan=PlanProperty(a,22);
int y=6+7*x+1;
byte[] code=new byte[10];
for(int c=0;c<=9;c++)
{
code[c]=Convert.ToByte(a[m*y+12+c]);
}
Class.TRANS.BData[l*y+0]=a[m*y+2]+"年"+a[m*y+3]+"月"+a[m*y+4]+"日 "+a[m*y+5]+":"+a[m*y+6]+":"+a[m*y+7]+":"+a[m*y+8]+":";//时间
Class.TRANS.BData[l*y+1]=Convert.ToString(a[m*y+11]);//机车ID
Class.TRANS.BData[l*y+2]=Conversion(code,10);//计划号
Class.TRANS.BData[l*y+3]=plan;//计划属性
Class.TRANS.BData[l*y+4]=Convert.ToString(a[m*y+23]);//总钩数
Class.TRANS.BData[l*y+5]=Convert.ToString(a[m*y+25]<<8+a[m*y+24]);//总辆数
for(int j=0;j<x;j++)
{
钩状态#region 钩状态
byte g=a[m*y+26+j*35+1];
string state="",count="";
string State="";
if((g>>7)==0)
{
state="挂";
}
else state="摘";
count=Convert.ToString(g&(0x127));
State=state+count+"辆";
#endregion
for(int c=0;c<=7;c++)
{
code[c]=Convert.ToByte(a[m*y+30+j*x]);
}
Class.TRANS.BData[l*y+6+j*7]=Convert.ToString(a[m*y+26+j*35]);//ID
Class.TRANS.BData[l*y+6+j*7+1]=State;//辆数
Class.TRANS.BData[l*y+6+j*7+2]=Convert.ToString(a[m*y+26+j*35+2]*60);//标准车重
Class.TRANS.BData[l*y+6+j*7+3]=Convert.ToString(a[m*y+26+j*35+3]*11);//标准车长
Class.TRANS.BData[l*y+6+j*7+4]=Convert.ToString(a[m*y+26+j*35+4]);//目标速度
Class.TRANS.BData[l*y+6+j*7+5]=Conversion(code,10);//目标地
byte[] CODE=new byte[20];
for(int c=0;c<=19;c++)
{
CODE[c]=Convert.ToByte(a[m*y+31+j*x]);
}
Class.TRANS.BData[l*y+6+j*7+6]=Conversion(CODE,20);//记事
}
Class.TRANS.BData[l*y+6+7*x+1]="xxxx";
}
else
{
MessageBox.Show("数据未找到!");
}
}
#endregion
SData#region SData
public void check_SData(byte[] a,int l,int m,int x)
{
if(a.Length!=0)
{
int y=3+x+1;
int v=(int)(Class.data.SData[13]<<8+Class.data.SData[12]);
Class.TRANS.SData[l*y+0]=a[m*y+2]+"年"+a[m*y+3]+"月"+a[m*y+4]+"日 "+a[m*y+5]+":"+a[m*y+6]+":"+a[m*y+7]+":"+a[m*y+8]+":";//时间
Class.TRANS.SData[l*y+1]=Convert.ToString(a[m*y+11]);//机车ID
Class.TRANS.SData[l*y+2]=Convert.ToString(a[m*y+12]);//总段数
for(int j=0;j<x;j++)
{
Class.TRANS.SData[l*y+3+j]=duan(a[m*y+13+j]);
}
Class.TRANS.SData[l*y+3+x]="xxxx";
}
else
{
MessageBox.Show("数据未找到!");
}
}
#endregion
LData#region LData
public void check_LData(byte[] a,int l,int m,int sign)
{
if(a.Length!=0)
{
int y=3+sign+1;
int v=(int)(Class.data.LData[13]<<8+Class.data.LData[12]);
Class.TRANS.LData[l*y+0]=a[m*y+2]+"年"+a[m*y+3]+"月"+a[m*y+4]+"日 "+a[m*y+5]+":"+a[m*y+6]+":"+a[m*y+7]+":"+a[m*y+8]+":";//时间
Class.TRANS.LData[l*y+1]=Convert.ToString(a[m*y+11]);//机车ID
Class.TRANS.LData[l*y+2]=Convert.ToString(v);//总信号机数
for(int j=1;j<=sign;j++)
{
string J=Convert.ToString(j);
// string s=SignalType(J);
// Class.TRANS.LData[l*y+3+j]=signal(a[m*y+13+j],s);//信号机状态
}
Class.TRANS.LData[l*y+3+sign]="xxxx";
}
else
{
MessageBox.Show("数据未找到!");
}
}
#endregion
LocomData#region LocomData
public void check_LocomData(byte[] a,int l,int m,int ll)
{
string[] state=new string[14];
string State1="";
string State2="";
if(a.Length!=0)
{
int y=16;
机车状态1#region 机车状态1
if((a[m*54+24]&0x01)==1)
{
state[0]="速度防护禁止";
}
else
{
state[0]="速度防护允许";
}
if((a[m*54+24]&0x04)==1)
{
state[1]="速度防护投入";
}
else
{
state[1]="速度防护退出";
}
if((a[m*54+24]&0x04)==1)
{
state[2]="速度防护告警";
}
else
{
state[2]="";
}
if((a[m*54+24]&0x08)==1)
{
state[3]="速度防护动作";
}
else
{
state[3]="";
}
if((a[m*54+24]&0x10)==1)
{
state[4]="距离防护禁止";
}
else
{
state[4]="距离防护允许";
}
if((a[m*54+24]&0x20)==1)
{
state[5]="距离防护投入";
}
else
{
state[5]="距离防护退出";
}
if((a[m*54+24]&0x40)==1)
{
state[6]="距离防护告警";
}
else
{
state[6]="";
}
if((a[m*54+24]&0x80)==1)
{
state[7]="距离防护动作";
}
else
{
state[7]="";
}
for(int ii=0;ii<=7;ii++)
{
if(State1=="")
{
State1=state[ii];
}
if(state[ii]!="")
{
State1=State1+","+state[ii];
}
}
#endregion
机车状态2#region 机车状态2
if((a[m*54+24]&0x01)==1)
{