306 lines
8.8 KiB
C#
306 lines
8.8 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using AGVSystem.Cls;
|
|
|
|
namespace AGVSystem
|
|
{
|
|
// Token: 0x02000007 RID: 7
|
|
public partial class APInfo : Form
|
|
{
|
|
// Token: 0x0600006C RID: 108 RVA: 0x0000DE48 File Offset: 0x0000C048
|
|
public APInfo()
|
|
{
|
|
this.InitializeComponent();
|
|
this.ds.Tables.Clear();
|
|
this.ds = this.db.connDt("SELECT [Name] FROM [AP_Type]");
|
|
bool flag = this.ds.Tables.Count > 0;
|
|
if (flag)
|
|
{
|
|
bool flag2 = this.ds.Tables[0].Rows.Count > 0;
|
|
if (flag2)
|
|
{
|
|
foreach (object obj in this.ds.Tables[0].Rows)
|
|
{
|
|
DataRow dataRow = (DataRow)obj;
|
|
this.cmb_type.Items.Add(dataRow[0].ToString());
|
|
}
|
|
}
|
|
}
|
|
this.ds = this.db.connDt("select id from ipaddress where id not in (select ipaddress from agvinfo) and id not in (select ipaddress from ap_site) order by seq");
|
|
bool flag3 = this.ds.Tables.Count > 0;
|
|
if (flag3)
|
|
{
|
|
bool flag4 = this.ds.Tables[0].Rows.Count > 0;
|
|
if (flag4)
|
|
{
|
|
foreach (object obj2 in this.ds.Tables[0].Rows)
|
|
{
|
|
DataRow dataRow2 = (DataRow)obj2;
|
|
this.cmb_ip.Items.Add(dataRow2[0].ToString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600006D RID: 109 RVA: 0x0000E038 File Offset: 0x0000C238
|
|
private void APInfo_Load(object sender, EventArgs e)
|
|
{
|
|
this.ds.Tables.Clear();
|
|
this.ds = this.db.connDt("select id as 编号, type as 型号,ipaddress as ip地址,[信道] , ssid ,[位置] ,[Status] ,[Remark] from AP_Site");
|
|
bool flag = this.ds.Tables.Count > 0;
|
|
if (flag)
|
|
{
|
|
this.dataGridView1.DataSource = this.ds.Tables[0];
|
|
}
|
|
this.groupBox2.Enabled = false;
|
|
base.WindowState = FormWindowState.Maximized;
|
|
}
|
|
|
|
// Token: 0x0600006E RID: 110 RVA: 0x0000E0B8 File Offset: 0x0000C2B8
|
|
private void dataGridView1_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
bool flag = this.dataGridView1.RowCount > 0;
|
|
if (flag)
|
|
{
|
|
try
|
|
{
|
|
this.groupBox2.Enabled = false;
|
|
this.num_id.Value = Convert.ToDecimal(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["编号"].Value);
|
|
this.cmb_ip.Text = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["IP地址"].Value.ToString();
|
|
this.txt_ssid.Text = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["SSID"].Value.ToString();
|
|
this.num_xd.Value = Convert.ToDecimal(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["xd"].Value);
|
|
this.txt_location.Text = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["location"].Value.ToString();
|
|
this.txt_remark.Text = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["remark"].Value.ToString();
|
|
this.cmb_type.Text = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["型号"].Value.ToString();
|
|
this.cmb_status.Text = ((this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["设备状态"].Value.ToString() == "True") ? "启用" : "禁用");
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600006F RID: 111 RVA: 0x00002460 File Offset: 0x00000660
|
|
private void btn_Click(object sender, EventArgs e)
|
|
{
|
|
}
|
|
|
|
// Token: 0x06000070 RID: 112 RVA: 0x0000E354 File Offset: 0x0000C554
|
|
private int add_ap(string id, string ip, string ssid, string xd, string location, string remark, string type)
|
|
{
|
|
int result = 0;
|
|
try
|
|
{
|
|
result = (int)Convert.ToInt16(this.db.Command(string.Concat(new string[]
|
|
{
|
|
"insert into ap_site (id , ipaddress , ssid,[信道] ,[位置] ,[Remark],type) values (",
|
|
id,
|
|
",'",
|
|
ip,
|
|
"','",
|
|
ssid,
|
|
"','",
|
|
xd,
|
|
"','",
|
|
location,
|
|
"','",
|
|
remark,
|
|
"','",
|
|
type,
|
|
"')"
|
|
})));
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000071 RID: 113 RVA: 0x0000E408 File Offset: 0x0000C608
|
|
private int update_ap(string id, string ip, string ssid, string xd, string location, string remark, string type)
|
|
{
|
|
int result = 0;
|
|
try
|
|
{
|
|
result = (int)Convert.ToInt16(this.db.Command(string.Concat(new string[]
|
|
{
|
|
"update ap_site set ipaddress='",
|
|
ip,
|
|
"',ssid='",
|
|
ssid,
|
|
"',信道='",
|
|
xd,
|
|
"',位置='",
|
|
location,
|
|
"',remark='",
|
|
remark,
|
|
"',type='",
|
|
type,
|
|
"' where id=",
|
|
id
|
|
})));
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000072 RID: 114 RVA: 0x0000E4B0 File Offset: 0x0000C6B0
|
|
private int delete_ap(string id, string ip, string ssid)
|
|
{
|
|
int result = 0;
|
|
try
|
|
{
|
|
result = (int)Convert.ToInt16(this.db.Command("delete from ap_site where id=" + id));
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06000073 RID: 115 RVA: 0x0000E4FC File Offset: 0x0000C6FC
|
|
private void toolStripButton1_Click(object sender, EventArgs e)
|
|
{
|
|
this.num_id.Value = 0m;
|
|
this.num_xd.Value = 0m;
|
|
this.txt_location.Text = "";
|
|
this.txt_remark.Text = "";
|
|
this.txt_ssid.Text = "";
|
|
this.cmb_ip.Text = "";
|
|
this.groupBox2.Enabled = true;
|
|
}
|
|
|
|
// Token: 0x06000074 RID: 116 RVA: 0x0000E580 File Offset: 0x0000C780
|
|
private void toolStripButton3_Click(object sender, EventArgs e)
|
|
{
|
|
bool flag = Param.UserName_temp == "";
|
|
if (flag)
|
|
{
|
|
MessageBox.Show("请登录管理员权限!", "AGV调度管理系统", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
|
}
|
|
else
|
|
{
|
|
bool flag2 = this.num_id.Value == 0m || this.cmb_ip.Text == "";
|
|
if (!flag2)
|
|
{
|
|
bool flag3 = this.add_ap(this.num_id.Value.ToString(), this.cmb_ip.Text, this.txt_ssid.Text, this.num_xd.Value.ToString(), this.txt_location.Text.Trim(), this.txt_remark.Text.Trim(), this.cmb_type.Text) > 0;
|
|
if (flag3)
|
|
{
|
|
MessageBox.Show("添加成功!");
|
|
this.ds.Tables.Clear();
|
|
this.ds = this.db.connDt("select id as 编号, ipaddress as ip地址,[信道] , ssid ,[位置] ,[Status] ,[Remark] from AP_Site");
|
|
bool flag4 = this.ds.Tables.Count > 0;
|
|
if (flag4)
|
|
{
|
|
this.dataGridView1.DataSource = this.ds.Tables[0];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000075 RID: 117 RVA: 0x0000E6D8 File Offset: 0x0000C8D8
|
|
private void toolStripButton4_Click(object sender, EventArgs e)
|
|
{
|
|
bool flag = Param.UserName_temp == "";
|
|
if (flag)
|
|
{
|
|
MessageBox.Show("请登录管理员权限!", "AGV调度管理系统", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
|
}
|
|
else
|
|
{
|
|
bool flag2 = this.num_id.Value == 0m || this.cmb_ip.Text == "";
|
|
if (!flag2)
|
|
{
|
|
bool flag3 = this.delete_ap(this.num_id.Value.ToString(), this.cmb_ip.Text, this.txt_ssid.Text) > 0;
|
|
if (flag3)
|
|
{
|
|
MessageBox.Show("删除成功!");
|
|
this.ds.Tables.Clear();
|
|
this.ds = this.db.connDt("select id as 编号, ipaddress as ip地址,[信道] , ssid ,[位置] ,[Status] ,[Remark] from AP_Site");
|
|
bool flag4 = this.ds.Tables.Count > 0;
|
|
if (flag4)
|
|
{
|
|
this.dataGridView1.DataSource = this.ds.Tables[0];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000076 RID: 118 RVA: 0x0000E7F4 File Offset: 0x0000C9F4
|
|
private void toolStripButton6_Click(object sender, EventArgs e)
|
|
{
|
|
bool enabled = this.groupBox2.Enabled;
|
|
if (enabled)
|
|
{
|
|
bool flag = Param.UserName_temp == "";
|
|
if (flag)
|
|
{
|
|
MessageBox.Show("请登录管理员权限!", "AGV调度管理系统", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
|
}
|
|
else
|
|
{
|
|
bool flag2 = this.num_id.Value == 0m || this.cmb_ip.Text == "";
|
|
if (!flag2)
|
|
{
|
|
bool flag3 = this.update_ap(this.num_id.Value.ToString(), this.cmb_ip.Text, this.txt_ssid.Text.Trim(), this.num_xd.Value.ToString(), this.txt_location.Text.Trim(), this.txt_remark.Text.Trim(), this.cmb_type.Text) > 0;
|
|
if (flag3)
|
|
{
|
|
MessageBox.Show("修改成功!");
|
|
this.APInfo_Load(null, null);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000077 RID: 119 RVA: 0x0000E910 File Offset: 0x0000CB10
|
|
private void textBox1_TextChanged(object sender, EventArgs e)
|
|
{
|
|
bool flag = this.textBox1.Text == "";
|
|
if (flag)
|
|
{
|
|
this.textBox1.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
this.textBox1.Visible = true;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000078 RID: 120 RVA: 0x0000E954 File Offset: 0x0000CB54
|
|
private void cmb_type_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
this.ds.Tables.Clear();
|
|
this.ds = this.db.connDt("SELECT description FROM [AP_Type] where name ='" + this.cmb_type.Text + "'");
|
|
bool flag = this.ds.Tables.Count > 0;
|
|
if (flag)
|
|
{
|
|
bool flag2 = this.ds.Tables[0].Rows.Count > 0;
|
|
if (flag2)
|
|
{
|
|
this.textBox1.Text = this.ds.Tables[0].Rows[0][0].ToString();
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000079 RID: 121 RVA: 0x0000EA0E File Offset: 0x0000CC0E
|
|
private void toolStripButton5_Click(object sender, EventArgs e)
|
|
{
|
|
this.groupBox2.Enabled = true;
|
|
}
|
|
|
|
// Token: 0x040000CF RID: 207
|
|
private ClsDBConn_sql db = new ClsDBConn_sql();
|
|
|
|
// Token: 0x040000D0 RID: 208
|
|
private DataSet ds = new DataSet();
|
|
}
|
|
}
|