469 lines
16 KiB
C#
469 lines
16 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Text;
|
|||
|
using System.Windows.Forms;
|
|||
|
using DBFactory;
|
|||
|
using Microsoft.VisualBasic;
|
|||
|
using System.Resources;
|
|||
|
using System.Collections;
|
|||
|
|
|||
|
namespace ControlSystem
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Creator:Richard.liu
|
|||
|
/// <20>豸״̬ά<CCAC><CEAC>
|
|||
|
/// </summary>
|
|||
|
public partial class FrmDeviceInfoEdit : Form
|
|||
|
{
|
|||
|
string Commsql = "SELECT T_Base_Device.F_DeviceIndex AS <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>, " +
|
|||
|
" T_Base_Device.F_DeviceName AS <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>, " +
|
|||
|
" T_Base_Device.F_DeviceKindIndex AS <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, " +
|
|||
|
" T_Base_Device_Kind.F_DeviceKindName AS <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, " +
|
|||
|
" F_LockedState AS ִ<><D6B4>״̬,F_errorcode as <20>豸״̬, " +
|
|||
|
" F_ManTaskReserve as <20><><EFBFBD><EFBFBD>ԤԼ<D4A4><D4BC>,F_HaveGoods as <20>Ƿ<EFBFBD><C7B7><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD>" +
|
|||
|
" FROM T_Base_Device,T_Base_Device_Kind";
|
|||
|
private bool _laneIndex = false;
|
|||
|
|
|||
|
public bool LaneIndex
|
|||
|
{
|
|||
|
get { return _laneIndex; }
|
|||
|
set { _laneIndex = value; }
|
|||
|
}
|
|||
|
private bool _laneGateDeviceIndex = false;
|
|||
|
|
|||
|
public bool LaneGateDeviceIndex
|
|||
|
{
|
|||
|
get { return _laneGateDeviceIndex; }
|
|||
|
set { _laneGateDeviceIndex = value; }
|
|||
|
}
|
|||
|
private bool _isSelected = false;
|
|||
|
|
|||
|
public bool IsSelected
|
|||
|
{
|
|||
|
get { return _isSelected; }
|
|||
|
set { _isSelected = value; }
|
|||
|
}
|
|||
|
private static FrmDeviceInfoEdit _formInstance;
|
|||
|
|
|||
|
public static FrmDeviceInfoEdit FormInstance
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_formInstance == null)
|
|||
|
{
|
|||
|
_formInstance = new FrmDeviceInfoEdit();
|
|||
|
|
|||
|
}
|
|||
|
return _formInstance;
|
|||
|
}
|
|||
|
set { FrmDeviceInfoEdit._formInstance = value; }
|
|||
|
}
|
|||
|
DBOperator dbo = CStaticClass.dbo;
|
|||
|
Model.MDevice mdev;
|
|||
|
public FrmDeviceInfoEdit()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
_formInstance = this;
|
|||
|
dbo.Open();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private void btQuery_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (tbContent.Text.Trim() == "") return;
|
|||
|
int index = 0;
|
|||
|
bool isint = int.TryParse(this.tbContent.Text.Trim(), out index);
|
|||
|
bool ifcheck = false;
|
|||
|
try
|
|||
|
{
|
|||
|
string df = "";
|
|||
|
|
|||
|
switch (this.cbField.Text)
|
|||
|
{
|
|||
|
case "<22>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>":
|
|||
|
df = "F_DeviceIndex";
|
|||
|
ifcheck=true;
|
|||
|
break;
|
|||
|
case "<22>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>":
|
|||
|
df = "F_DeviceName";
|
|||
|
break;
|
|||
|
case "<22>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>":
|
|||
|
df = "T_Base_Device.F_DeviceKindIndex";
|
|||
|
ifcheck=true;
|
|||
|
break;
|
|||
|
case "<22>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>":
|
|||
|
df = "F_DeviceKindName";
|
|||
|
break;
|
|||
|
|
|||
|
default:
|
|||
|
return;
|
|||
|
}
|
|||
|
if(ifcheck==true&&isint==false)
|
|||
|
{
|
|||
|
this.tbContent.Text = string.Empty;
|
|||
|
//return;
|
|||
|
}
|
|||
|
//20100208
|
|||
|
string sql = Commsql+" WHERE " +
|
|||
|
" T_Base_Device.F_DeviceKindIndex = T_Base_Device_Kind.F_DeviceKindIndex " +
|
|||
|
" and " + df + "= '" + this.tbContent.Text + "' ";
|
|||
|
DataSet ds = dbo.ExceSQL(sql);
|
|||
|
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw ex;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void btNullQuery_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.cbField.Text = "";
|
|||
|
this.tbContent.Text = "";
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private void btBack_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.Close();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private void tsmEdit_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (dataGridView1.RowCount <= 0)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
this.tabControl1.SelectTab("tabPage1");
|
|||
|
this.tbDeviceIndex.Text = this.dataGridView1.CurrentRow.Cells[0].Value.ToString()+ "";
|
|||
|
this.tbDeviceName.Text = this.dataGridView1.CurrentRow.Cells[1].Value.ToString() + "";
|
|||
|
this.tbDeviceKindIndex.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString() + "";
|
|||
|
|
|||
|
if(this.dataGridView1.CurrentRow.Cells[4].Value.ToString() + ""=="0")
|
|||
|
{
|
|||
|
this.cbLockedState.Text = "0:<3A><><EFBFBD><EFBFBD>";
|
|||
|
}
|
|||
|
else if (this.dataGridView1.CurrentRow.Cells[4].Value.ToString() + "" == "-1")
|
|||
|
{
|
|||
|
this.cbLockedState.Text = "-1:ͣ<><CDA3>";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.cbLockedState.Text = this.dataGridView1.CurrentRow.Cells[4].Value.ToString() + "";
|
|||
|
}
|
|||
|
if (this.dataGridView1.CurrentRow.Cells[5].Value.ToString() + "" == "0")
|
|||
|
{
|
|||
|
this.cbErrorCode.Text = "0:<3A><><EFBFBD><EFBFBD>";
|
|||
|
}
|
|||
|
|
|||
|
else
|
|||
|
{
|
|||
|
this.cbErrorCode.Text = this.dataGridView1.CurrentRow.Cells[5].Value.ToString() + "";
|
|||
|
}
|
|||
|
if (this.dataGridView1.CurrentRow.Cells[6].Value.ToString() + "" == "0")
|
|||
|
{
|
|||
|
this.cbManTaskReserve.Text = "0:<3A><><EFBFBD><EFBFBD>";
|
|||
|
}
|
|||
|
|
|||
|
else
|
|||
|
{
|
|||
|
this.cbManTaskReserve.Text = this.dataGridView1.CurrentRow.Cells[6].Value.ToString() + "";
|
|||
|
}
|
|||
|
if (this.dataGridView1.CurrentRow.Cells[7].Value.ToString() + "" == "1")
|
|||
|
{
|
|||
|
this.cbHaveGoods.Text = "<22><>";
|
|||
|
}
|
|||
|
|
|||
|
else
|
|||
|
{
|
|||
|
this.cbHaveGoods.Text = "<22><>";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private void button2_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
//20100208
|
|||
|
string sql = Commsql + " WHERE " +
|
|||
|
" T_Base_Device.F_DeviceKindIndex = T_Base_Device_Kind.F_DeviceKindIndex " ;
|
|||
|
DataSet ds = dbo.ExceSQL(sql);
|
|||
|
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void btSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
|
|||
|
if (MessageBox.Show("<22><>ȷ<EFBFBD><C8B7>Ҫ<EFBFBD><EFBFBD><DEB8>豸״̬<D7B4><CCAC><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
int lockstate = 0;
|
|||
|
int errorcode = 0;//20100208
|
|||
|
int haveGoods = 0;
|
|||
|
int manTaskReserve = 0;
|
|||
|
string devicename =this.tbDeviceName.Text.Trim() ;
|
|||
|
if (this.tbDeviceIndex.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
MessageBox.Show("<22>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbDeviceIndex.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.cbLockedState.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
MessageBox.Show("ִ<><D6B4>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.cbLockedState.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.cbErrorCode.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
MessageBox.Show("<22>豸״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.cbErrorCode.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.cbHaveGoods.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
MessageBox.Show("<22>豸<EFBFBD><EFBFBD><DFBC><EFBFBD><EFBFBD>ﲻ<EFBFBD><EFB2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.cbHaveGoods.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.cbManTaskReserve.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
MessageBox.Show("<22><><EFBFBD><EFBFBD>ԤԼ<D4A4><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.cbManTaskReserve.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.tbDeviceName.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
MessageBox.Show("<22>豸<EFBFBD><E8B1B8><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbDeviceName.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.tbDeviceName.Text.Trim().Length > 30)
|
|||
|
{
|
|||
|
MessageBox.Show("<22>豸<EFBFBD><E8B1B8><EFBFBD>Ƴ<EFBFBD><C6B3>ȹ<EFBFBD><C8B9><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbDeviceName.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
if (this.cbLockedState.Text == "0:<3A><><EFBFBD><EFBFBD>")
|
|||
|
{
|
|||
|
lockstate=0;
|
|||
|
errorcode = 0;//20100208
|
|||
|
}
|
|||
|
else if (this.cbLockedState.Text == "-1:ͣ<><CDA3>")
|
|||
|
{
|
|||
|
lockstate =-1 ;
|
|||
|
errorcode = 98;//20100208
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (Information.IsNumeric(this.cbLockedState.Text) == true)
|
|||
|
{
|
|||
|
lockstate = Convert.ToInt32(this.cbLockedState.Text);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
MessageBox.Show("ִ<><D6B4>״ֻ̬<CCAC><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>롰0:<3A><><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD>-1:ͣ<>á<EFBFBD><C3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸ָ<E8B1B8><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.cbLockedState.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
errorcode = 0;//20100208
|
|||
|
}
|
|||
|
if (this.cbErrorCode.Text == "0:<3A><><EFBFBD><EFBFBD>")
|
|||
|
{
|
|||
|
errorcode = 0;//20100208
|
|||
|
}
|
|||
|
|
|||
|
else
|
|||
|
{
|
|||
|
if (Information.IsNumeric(this.cbErrorCode.Text) == true)
|
|||
|
{
|
|||
|
errorcode = Convert.ToInt32(this.cbErrorCode.Text);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
MessageBox.Show("<22>豸״ֻ̬<CCAC><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>롰0:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB9>ϱ<EFBFBD><CFB1>룡", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.cbErrorCode.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (this.cbManTaskReserve.Text == "0:<3A><><EFBFBD><EFBFBD>")
|
|||
|
{
|
|||
|
manTaskReserve = 0;
|
|||
|
}
|
|||
|
|
|||
|
else
|
|||
|
{
|
|||
|
if (Information.IsNumeric(this.cbManTaskReserve.Text) == true)
|
|||
|
{
|
|||
|
manTaskReserve = Convert.ToInt32(this.cbManTaskReserve.Text);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
MessageBox.Show("<22>豸״ֻ̬<CCAC><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>롰0:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB9>ϱ<EFBFBD><CFB1>룡", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.cbManTaskReserve.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
if (this.cbHaveGoods.Text == "<22><>")
|
|||
|
{
|
|||
|
haveGoods = 1;
|
|||
|
}
|
|||
|
else if (this.cbHaveGoods.Text == "<22><>")
|
|||
|
{
|
|||
|
haveGoods = 0;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
MessageBox.Show("ֻ<><D6BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.cbHaveGoods.Focus();
|
|||
|
return;
|
|||
|
|
|||
|
}
|
|||
|
try
|
|||
|
{
|
|||
|
string sql;
|
|||
|
DataSet ds;
|
|||
|
//20100208
|
|||
|
sql = "UPDATE T_Base_Device SET F_LockedState =" + lockstate + ",f_errorcode=" + errorcode + ",F_ManTaskReserve =" + manTaskReserve + ",F_HaveGoods=" + haveGoods + " ,F_DeviceName ='"+devicename+"' where F_DeviceIndex= " + Convert.ToInt32(this.tbDeviceIndex.Text.Trim());
|
|||
|
dbo.ExceSQL(sql);
|
|||
|
MessageBox.Show("<22>豸<EFBFBD><E8B1B8>Ϣ<EFBFBD>ijɹ<C4B3><C9B9><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|||
|
sql = Commsql + " WHERE " +
|
|||
|
" T_Base_Device.F_DeviceKindIndex = T_Base_Device_Kind.F_DeviceKindIndex " +
|
|||
|
" and F_DeviceIndex= " + Convert.ToInt32(this.tbDeviceIndex.Text.Trim());
|
|||
|
ds = dbo.ExceSQL(sql);
|
|||
|
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
|
|||
|
mdev = Model.CGetInfo.GetDeviceInfo(Convert.ToInt32(this.tbDeviceIndex.Text.Trim()));
|
|||
|
if (lockstate == -1)
|
|||
|
{
|
|||
|
mdev.RunState = 4;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
mdev.RunState = lockstate;
|
|||
|
}
|
|||
|
Model.CGetInfo.SetDeviceInfo(mdev);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw ex;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void button1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
//20100208
|
|||
|
string sql = Commsql + " WHERE F_LockedState=-1 AND " +
|
|||
|
" T_Base_Device.F_DeviceKindIndex = T_Base_Device_Kind.F_DeviceKindIndex ";
|
|||
|
DataSet ds = dbo.ExceSQL(sql);
|
|||
|
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
|
|||
|
}
|
|||
|
|
|||
|
private void button3_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
string sql = Commsql + " WHERE F_errorcode>0 AND " +
|
|||
|
" T_Base_Device.F_DeviceKindIndex = T_Base_Device_Kind.F_DeviceKindIndex ";
|
|||
|
DataSet ds = dbo.ExceSQL(sql);
|
|||
|
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
|
|||
|
}
|
|||
|
|
|||
|
private void button4_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
string sql = Commsql + " WHERE F_ManTaskReserve>0 AND " +
|
|||
|
" T_Base_Device.F_DeviceKindIndex = T_Base_Device_Kind.F_DeviceKindIndex ";
|
|||
|
DataSet ds = dbo.ExceSQL(sql);
|
|||
|
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
|
|||
|
}
|
|||
|
|
|||
|
private void cbLockedState_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (this.cbLockedState.Text == "0:<3A><><EFBFBD><EFBFBD>")
|
|||
|
{
|
|||
|
this.cbErrorCode.Text = "0:<3A><><EFBFBD><EFBFBD>";
|
|||
|
}
|
|||
|
else if (this.cbLockedState.Text == "-1:ͣ<><CDA3>")
|
|||
|
{
|
|||
|
this.cbErrorCode.Text = "98";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void cbField_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
string df = "";
|
|||
|
|
|||
|
switch (this.cbField.Text)
|
|||
|
{
|
|||
|
case "<22>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>":
|
|||
|
df = "F_DeviceIndex";
|
|||
|
break;
|
|||
|
case "<22>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>":
|
|||
|
df = "F_DeviceName";
|
|||
|
break;
|
|||
|
case "<22>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>":
|
|||
|
df = "F_DeviceKindIndex";
|
|||
|
break;
|
|||
|
case "<22>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>":
|
|||
|
df = "F_DeviceKindName";
|
|||
|
break;
|
|||
|
|
|||
|
default:
|
|||
|
return;
|
|||
|
}
|
|||
|
//20100208
|
|||
|
string sql = "select distinct " + df + " from T_Base_Device ";
|
|||
|
DataView dv = dbo.ExceSQL(sql).Tables[0].DefaultView;
|
|||
|
if (dv.Count > 0)
|
|||
|
{
|
|||
|
this.tbContent.DataSource = null;
|
|||
|
this.tbContent.DisplayMember = df;
|
|||
|
this.tbContent.ValueMember= df;
|
|||
|
this.tbContent.DataSource = dv;
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw ex;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
|
|||
|
{
|
|||
|
if ((e.RowIndex >= 0) && (e.Button == MouseButtons.Right))
|
|||
|
{
|
|||
|
dataGridView1.ClearSelection();
|
|||
|
dataGridView1.Rows[e.RowIndex].Selected = true;
|
|||
|
dataGridView1.CurrentCell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|