1.初始化项目。保险起见bin目录完整提交 2.基于现场代码为调整过的初始项目(此次提交还未解决代码差异问题)
This commit is contained in:
@@ -0,0 +1,404 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using AGVSystem.Cls;
|
||||
|
||||
namespace AGVSystem
|
||||
{
|
||||
// Token: 0x02000005 RID: 5
|
||||
public partial class AGVManage : Form
|
||||
{
|
||||
// Token: 0x06000050 RID: 80 RVA: 0x00009548 File Offset: 0x00007748
|
||||
public AGVManage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.ds = this.db.connDt("select CONVERT( VARCHAR(10),id) +' . '+ line_name as info from Assembly_Line order by id");
|
||||
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_linelist.Items.Add(dataRow[0].ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
this.ds.Tables.Clear();
|
||||
this.ds = this.db.connDt("select id from ipaddress where id not in (select ipaddress from agvinfo) 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_iplist.Items.Add(dataRow2[0].ToString());
|
||||
this.cmb_switchip.Items.Add(dataRow2[0].ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
this.ds.Tables.Clear();
|
||||
this.ds = this.db.connDt("SELECT [ID] FROM [Agv_Type]");
|
||||
bool flag5 = this.ds.Tables.Count > 0;
|
||||
if (flag5)
|
||||
{
|
||||
bool flag6 = this.ds.Tables[0].Rows.Count > 0;
|
||||
if (flag6)
|
||||
{
|
||||
foreach (object obj3 in this.ds.Tables[0].Rows)
|
||||
{
|
||||
DataRow dataRow3 = (DataRow)obj3;
|
||||
this.cmb_type.Items.Add(dataRow3[0].ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
this.ds.Tables.Clear();
|
||||
this.ds = this.db.connDt("SELECT [Name] FROM [WorkLocationInfo]");
|
||||
bool flag7 = this.ds.Tables.Count > 0;
|
||||
if (flag7)
|
||||
{
|
||||
bool flag8 = this.ds.Tables[0].Rows.Count > 0;
|
||||
if (flag8)
|
||||
{
|
||||
this.cmb_worktype.Items.Add("");
|
||||
foreach (object obj4 in this.ds.Tables[0].Rows)
|
||||
{
|
||||
DataRow dataRow4 = (DataRow)obj4;
|
||||
this.cmb_worktype.Items.Add(dataRow4[0].ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000051 RID: 81 RVA: 0x00009944 File Offset: 0x00007B44
|
||||
private void AGVManage_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.ds.Tables.Clear();
|
||||
this.ds = this.db.connDt("SELECT AgvInfo.ID as 编号, AgvInfo.IPAddress as IP地址,SwitchIP as 交换机IP, port as 通讯端口, AgvInfo.WorkType as 物料名称 , AgvInfo.Internal_ID as 序号 ,[Status] as 设备状态,[Type] as 设备型号, AgvInfo.Assembly_Line as 线体编号 , assembly_line.line_name as 线体名称 ,agvinfo.Mileage as 行驶里程 FROM AgvInfo ,assembly_line where AgvInfo.Assembly_Line = assembly_line.id order by AgvInfo.ID");
|
||||
this.dataGridView1.DataSource = this.ds.Tables[0];
|
||||
this.groupBox2.Enabled = false;
|
||||
base.WindowState = FormWindowState.Maximized;
|
||||
}
|
||||
|
||||
// Token: 0x06000052 RID: 82 RVA: 0x000099AC File Offset: 0x00007BAC
|
||||
private void btn_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.num_id.Value = 0m;
|
||||
this.num_seq.Value = 0m;
|
||||
this.cmb_iplist.Text = "";
|
||||
this.cmb_linelist.Text = "";
|
||||
this.lab_km.Text = "0";
|
||||
}
|
||||
|
||||
// Token: 0x06000053 RID: 83 RVA: 0x00009A10 File Offset: 0x00007C10
|
||||
private int add_agv(string id, string seq, string ip, string line_id, int port, int type, string switchip, int WorkType)
|
||||
{
|
||||
return (int)Convert.ToInt16(this.db.Command(string.Concat(new string[]
|
||||
{
|
||||
"insert into agvinfo (id , ipaddress , internal_id , assembly_line, port,type,switchip,WorkType) values (",
|
||||
id,
|
||||
",'",
|
||||
ip,
|
||||
"',",
|
||||
seq,
|
||||
",",
|
||||
line_id,
|
||||
",",
|
||||
port.ToString(),
|
||||
",",
|
||||
type.ToString(),
|
||||
",'",
|
||||
switchip,
|
||||
"',",
|
||||
WorkType.ToString(),
|
||||
")"
|
||||
})));
|
||||
}
|
||||
|
||||
// Token: 0x06000054 RID: 84 RVA: 0x00009AC8 File Offset: 0x00007CC8
|
||||
private int delete_agv(string id)
|
||||
{
|
||||
return (int)Convert.ToInt16(this.db.Command("delete from agvinfo where id =" + id));
|
||||
}
|
||||
|
||||
// Token: 0x06000055 RID: 85 RVA: 0x00009AFC File Offset: 0x00007CFC
|
||||
private int update_agv()
|
||||
{
|
||||
string sqlstr = string.Concat(new string[]
|
||||
{
|
||||
"UPDATE [AgvInfo] SET [IPAddress] = '",
|
||||
this.cmb_iplist.Text,
|
||||
"' ,[Status] = ",
|
||||
this.cmb_status.SelectedIndex.ToString(),
|
||||
" ,[Internal_ID] = ",
|
||||
this.num_seq.Value.ToString(),
|
||||
" ,[Assembly_Line] = ",
|
||||
this.cmb_linelist.Text.Split(new char[]
|
||||
{
|
||||
'.'
|
||||
})[0],
|
||||
" ,[Type] = ",
|
||||
this.cmb_type.Text,
|
||||
" ,[Mileage] = ",
|
||||
this.lab_km.Text,
|
||||
" ,port = ",
|
||||
this.numPort.Value.ToString(),
|
||||
" ,switchip = '",
|
||||
this.cmb_switchip.Text,
|
||||
"' ,[WorkType] = ",
|
||||
this.cmb_worktype.SelectedIndex.ToString(),
|
||||
" WHERE [ID] = ",
|
||||
this.lab_id.Text
|
||||
});
|
||||
return (int)Convert.ToInt16(this.db.Command(sqlstr));
|
||||
}
|
||||
|
||||
// Token: 0x06000056 RID: 86 RVA: 0x00009C4C File Offset: 0x00007E4C
|
||||
private void select_agv(string id, string line_id)
|
||||
{
|
||||
this.ds.Tables.Clear();
|
||||
bool flag = id != "0";
|
||||
if (flag)
|
||||
{
|
||||
this.ds = this.db.connDt("SELECT AgvInfo.ID as 编号, AgvInfo.IPAddress as IP地址, port as 通讯端口, AgvInfo.WorkType as 物料名称, AgvInfo.Internal_ID as 序号 ,[Status] as 设备状态,[Type] as 设备型号, AgvInfo.Assembly_Line as 线体编号 , assembly_line.line_name as 线体名称 ,agvinfo.Mileage as 行驶里程 FROM AgvInfo ,assembly_line where AgvInfo.Assembly_Line = assembly_line.id and AgvInfo.ID= " + id + " order by AgvInfo.ID");
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag2 = line_id.Trim() != "";
|
||||
if (flag2)
|
||||
{
|
||||
this.ds = this.db.connDt("SELECT AgvInfo.ID as 编号, AgvInfo.IPAddress as IP地址, port as 通讯端口, AgvInfo.WorkType as 物料名称, AgvInfo.Internal_ID as 序号 ,[Status] as 设备状态,[Type] as 设备型号, AgvInfo.Assembly_Line as 线体编号 , assembly_line.line_name as 线体名称 ,agvinfo.Mileage as 行驶里程 FROM AgvInfo ,assembly_line where AgvInfo.Assembly_Line = assembly_line.id and AgvInfo.Assembly_Line= " + line_id + " order by AgvInfo.ID");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ds = this.db.connDt("SELECT AgvInfo.ID as 编号, AgvInfo.IPAddress as IP地址, port as 通讯端口, AgvInfo.WorkType as 物料名称, AgvInfo.Internal_ID as 序号 ,[Status] as 设备状态,[Type] as 设备型号, AgvInfo.Assembly_Line as 线体编号 , assembly_line.line_name as 线体名称 ,agvinfo.Mileage as 行驶里程 FROM AgvInfo ,assembly_line where AgvInfo.Assembly_Line = assembly_line.id order by AgvInfo.ID");
|
||||
}
|
||||
}
|
||||
this.dataGridView1.DataSource = this.ds.Tables[0];
|
||||
}
|
||||
|
||||
// Token: 0x06000057 RID: 87 RVA: 0x00009D10 File Offset: 0x00007F10
|
||||
private void dataGridView1_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
bool flag = this.dataGridView1.RowCount > 0;
|
||||
if (flag)
|
||||
{
|
||||
this.flag = 0;
|
||||
this.num_id.Value = Convert.ToDecimal(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["编号"].Value);
|
||||
this.lab_id.Text = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["编号"].Value.ToString();
|
||||
this.num_seq.Value = Convert.ToDecimal(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["序号"].Value);
|
||||
this.cmb_iplist.Text = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["IP地址"].Value.ToString();
|
||||
this.cmb_switchip.Text = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["交换机IP"].Value.ToString();
|
||||
this.cmb_linelist.Text = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["线体编号"].Value.ToString() + " . " + this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["线体名称"].Value.ToString();
|
||||
this.lab_km.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") ? "启用" : "禁用");
|
||||
this.cmb_type.Text = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["设备型号"].Value.ToString();
|
||||
this.numPort.Value = Convert.ToDecimal(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["通讯端口"].Value.ToString());
|
||||
this.cmb_worktype.SelectedIndex = (int)Convert.ToInt16(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["物料名称"].Value);
|
||||
this.groupBox2.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000058 RID: 88 RVA: 0x0000A0A0 File Offset: 0x000082A0
|
||||
private void button5_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.lab_km.Text = "0";
|
||||
}
|
||||
|
||||
// Token: 0x06000059 RID: 89 RVA: 0x0000A0B4 File Offset: 0x000082B4
|
||||
private void dataGridView1_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e)
|
||||
{
|
||||
e.Row.HeaderCell.Value = string.Format("{0}", e.Row.Index + 1);
|
||||
}
|
||||
|
||||
// Token: 0x0600005A RID: 90 RVA: 0x0000A0E4 File Offset: 0x000082E4
|
||||
private void toolStripButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.flag = 1;
|
||||
this.num_seq.Value = 0m;
|
||||
this.cmb_iplist.Text = "";
|
||||
this.cmb_switchip.Text = "";
|
||||
this.cmb_linelist.SelectedIndex = 0;
|
||||
this.lab_km.Text = "0";
|
||||
this.lab_id.Text = "";
|
||||
this.groupBox2.Enabled = true;
|
||||
DataSet dataSet = this.db.connDt("SELECT max([ID])+1 FROM [AgvInfo]");
|
||||
bool flag = dataSet.Tables[0].Rows[0][0].ToString() != "";
|
||||
if (flag)
|
||||
{
|
||||
this.num_id.Value = Convert.ToDecimal(dataSet.Tables[0].Rows[0][0].ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.num_id.Value = 1m;
|
||||
}
|
||||
this.cmb_type.SelectedIndex = 0;
|
||||
this.numPort.Value = 0m;
|
||||
}
|
||||
|
||||
// Token: 0x0600005B RID: 91 RVA: 0x0000A214 File Offset: 0x00008414
|
||||
private void toolStripButton3_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.flag = 0;
|
||||
bool flag = Param.UserName_temp == "";
|
||||
if (flag)
|
||||
{
|
||||
MessageBox.Show("请登录管理员权限!", "AGV调度管理系统", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag2 = this.num_id.Value == 0m || this.num_seq.Value == 0m || this.cmb_iplist.Text == "" || this.cmb_linelist.Text.Trim() == "";
|
||||
if (!flag2)
|
||||
{
|
||||
bool flag3 = this.add_agv(this.num_id.Value.ToString(), this.num_seq.Value.ToString(), this.cmb_iplist.Text, this.cmb_linelist.Text.Split(new char[]
|
||||
{
|
||||
'.'
|
||||
})[0], (int)Convert.ToInt16(this.numPort.Value), (int)Convert.ToInt16(this.cmb_type.Text), this.cmb_switchip.Text, this.cmb_worktype.SelectedIndex) > 0;
|
||||
if (flag3)
|
||||
{
|
||||
this.cmb_iplist.Items.Remove(this.cmb_iplist.Text);
|
||||
MessageBox.Show("添加成功!");
|
||||
this.AGVManage_Load(null, null);
|
||||
this.toolStripButton1_Click(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600005C RID: 92 RVA: 0x0000A394 File Offset: 0x00008594
|
||||
private void toolStripButton4_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.flag = 0;
|
||||
bool flag = Param.UserName_temp == "";
|
||||
if (flag)
|
||||
{
|
||||
MessageBox.Show("请登录管理员权限!", "AGV调度管理系统", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag2 = this.num_id.Value == 0m || this.num_seq.Value == 0m || this.cmb_iplist.Text == "" || this.cmb_linelist.Text == "";
|
||||
if (!flag2)
|
||||
{
|
||||
bool flag3 = this.delete_agv(this.num_id.Value.ToString()) > 0;
|
||||
if (flag3)
|
||||
{
|
||||
this.cmb_iplist.Items.Add(this.cmb_iplist.Text);
|
||||
MessageBox.Show("删除成功!");
|
||||
this.AGVManage_Load(null, null);
|
||||
this.toolStripButton1_Click(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600005D RID: 93 RVA: 0x0000A49C File Offset: 0x0000869C
|
||||
private void toolStripButton6_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.flag = 0;
|
||||
bool flag = Param.UserName_temp == "";
|
||||
if (flag)
|
||||
{
|
||||
MessageBox.Show("请登录管理员权限!", "AGV调度管理系统", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag2 = this.num_id.Value == 0m || this.num_seq.Value == 0m || this.cmb_iplist.Text == "" || this.cmb_linelist.Text == "";
|
||||
if (!flag2)
|
||||
{
|
||||
bool flag3 = this.update_agv() > 0;
|
||||
if (flag3)
|
||||
{
|
||||
this.AGVManage_Load(null, null);
|
||||
MessageBox.Show("修改成功!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600005E RID: 94 RVA: 0x0000A56C File Offset: 0x0000876C
|
||||
private void toolStripButton2_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.flag = 0;
|
||||
this.select_agv(this.num_id.Value.ToString(), this.cmb_linelist.Text.Split(new char[]
|
||||
{
|
||||
'.'
|
||||
})[0]);
|
||||
}
|
||||
|
||||
// Token: 0x0600005F RID: 95 RVA: 0x0000A5BA File Offset: 0x000087BA
|
||||
private void toolStripButton5_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.flag = 0;
|
||||
this.groupBox2.Enabled = true;
|
||||
}
|
||||
|
||||
// Token: 0x06000060 RID: 96 RVA: 0x0000A5D4 File Offset: 0x000087D4
|
||||
private void cmb_type_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
bool flag = this.cmb_type.SelectedIndex == 0;
|
||||
if (flag)
|
||||
{
|
||||
this.pictureBox1.BackgroundImage = null;
|
||||
this.label9.Text = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag2 = this.cmb_type.SelectedIndex > 0;
|
||||
if (flag2)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataSet dataSet = this.db.connDt("SELECT [Remark] FROM [Agv_Type] where id =" + this.cmb_type.Text);
|
||||
bool flag3 = dataSet.Tables[0].Rows.Count > 0;
|
||||
if (flag3)
|
||||
{
|
||||
this.label9.Text = dataSet.Tables[0].Rows[0][0].ToString();
|
||||
}
|
||||
this.pictureBox1.BackgroundImage = Image.FromFile(Application.StartupPath + "\\picture\\" + this.cmb_type.Text + ".JPG");
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000061 RID: 97 RVA: 0x0000A6E8 File Offset: 0x000088E8
|
||||
private void cmb_linelist_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
bool flag = this.flag == 1 && this.cmb_linelist.Text.Trim() != "";
|
||||
if (flag)
|
||||
{
|
||||
DataSet dataSet = this.db.connDt("SELECT max([Internal_ID])+1 FROM [AgvInfo] where Assembly_Line=" + this.cmb_linelist.Text.Split(new char[]
|
||||
{
|
||||
'.'
|
||||
})[0]);
|
||||
bool flag2 = dataSet.Tables[0].Rows[0][0].ToString() != "";
|
||||
if (flag2)
|
||||
{
|
||||
this.num_seq.Value = Convert.ToDecimal(dataSet.Tables[0].Rows[0][0].ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.num_seq.Value = 1m;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400007E RID: 126
|
||||
private int flag = 0;
|
||||
|
||||
// Token: 0x0400007F RID: 127
|
||||
private ClsDBConn_sql db = new ClsDBConn_sql();
|
||||
|
||||
// Token: 0x04000080 RID: 128
|
||||
private DataSet ds = new DataSet();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user