Files
FG2608061/反编译CODE/华晓AGV管理系统/Control_Point.cs
T

402 lines
17 KiB
C#

using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using AGVSystem.Cls;
namespace AGVSystem
{
// Token: 0x0200000E RID: 14
public partial class Control_Point : Form
{
// Token: 0x060000C1 RID: 193 RVA: 0x00013128 File Offset: 0x00011328
public Control_Point(int w, int h)
{
this.InitializeComponent();
base.Width = w;
base.Height = h;
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());
}
}
}
}
// Token: 0x060000C2 RID: 194 RVA: 0x0001324C File Offset: 0x0001144C
private void Control_Point_Load(object sender, EventArgs e)
{
this.ds.Tables.Clear();
this.str_sql = "SELECT CONVERT( VARCHAR(10),Assembly_Line.ID)+' . '+Line_name as 线体,[Assembly_Line] as 线体编号,[Loc_ID] as 位置编号,[Flag_Value] as 标记值,[Loc_X] as 坐标x,[Loc_Y] as 坐标y,CONVERT( VARCHAR(10),Loc_X)+','+CONVERT( VARCHAR(10),Loc_Y) as 位置坐标,[Binding] as 绑定方式,LandMarkInfo.[Area] as 地图编号,(Case when LandMarkInfo.Assembly_ID >0 THEN '管控停止点' ELSE '管控复位点' END) as 位置类型,[Bank] as 障碍物模式,[Speed] as 速度,[Next_Station1] as 下一站点1,[Drict1] as 运动模式1,[LongTime1] as 运动时间1,[Next_Station2] as 下一站点2,[Drict2] as 运动模式2,[LongTime2] as 运动时间2,[Next_Station3] as 下一站点3,[Drict3] as 运动模式3,[LongTime3] as 运动时间3 FROM LandMarkInfo ,Assembly_Line WHERE LandMarkInfo.Assembly_Line = Assembly_Line.ID";
this.ds = this.db.connDt(this.str_sql);
bool flag = this.ds.Tables.Count > 0;
if (flag)
{
this.dataGridView1.DataSource = this.ds.Tables[0];
}
this.groupBox1.Enabled = false;
this.groupBox2.Enabled = false;
this.groupBox3.Enabled = false;
}
// Token: 0x060000C3 RID: 195 RVA: 0x000132E8 File Offset: 0x000114E8
private void dataGridView1_DoubleClick(object sender, EventArgs e)
{
bool flag = this.dataGridView1.RowCount > 0;
if (flag)
{
this.groupBox1.Enabled = false;
this.groupBox2.Enabled = false;
this.groupBox3.Enabled = false;
this.cmb_linelist.Text = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["线体"].Value.ToString();
this.num_id.Value = Convert.ToDecimal(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["位置编号"].Value);
this.num_plcvalue.Value = Convert.ToDecimal(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["标记值"].Value);
this.cmb_map.SelectedIndex = (int)Convert.ToInt16(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["地图编号"].Value.ToString());
this.cmb_bd.SelectedIndex = (int)Convert.ToInt16(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["绑定方式"].Value.ToString());
this.txt_zb.Text = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["位置坐标"].Value.ToString();
this.cmb_type.Text = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["位置类型"].Value.ToString();
this.cmb_zhangaiwu.SelectedIndex = (int)Convert.ToInt16(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["障碍物模式"].Value.ToString());
this.num_speed.Value = Convert.ToDecimal(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["速度"].Value);
this.next_loc1.Value = Convert.ToDecimal(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["下一站点1"].Value);
this.next_loc2.Value = Convert.ToDecimal(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["下一站点2"].Value);
this.next_longtime1.Value = Convert.ToDecimal(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["运动时间1"].Value);
this.next_longtime2.Value = Convert.ToDecimal(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["运动时间2"].Value);
this.cmb_run1.SelectedIndex = (int)Convert.ToInt16(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["运动模式1"].Value);
this.cmb_run2.SelectedIndex = (int)Convert.ToInt16(this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["运动模式2"].Value);
}
}
// Token: 0x060000C4 RID: 196 RVA: 0x00002460 File Offset: 0x00000660
private void btn_Click(object sender, EventArgs e)
{
}
// Token: 0x060000C5 RID: 197 RVA: 0x00013750 File Offset: 0x00011950
private string delete_point(string line_id, string point_id)
{
DataSet dataSet = new DataSet();
return this.db.Command("delete from LandMarkInfo where Assembly_Line = " + line_id + " and Loc_ID = " + point_id);
}
// Token: 0x060000C6 RID: 198 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: 0x060000C7 RID: 199 RVA: 0x0001378C File Offset: 0x0001198C
private void toolStripButton1_Click(object sender, EventArgs e)
{
this.groupBox1.Enabled = true;
this.groupBox2.Enabled = true;
this.groupBox3.Enabled = true;
this.num_plcvalue.Value = 0m;
this.cmb_map.SelectedIndex = 0;
this.cmb_bd.SelectedIndex = 0;
this.cmb_type.SelectedIndex = 0;
this.cmb_zhangaiwu.SelectedIndex = 0;
this.num_speed.Value = 0m;
this.next_loc1.Value = 0m;
this.next_loc2.Value = 0m;
this.next_longtime1.Value = 0m;
this.next_longtime2.Value = 0m;
this.cmb_run1.SelectedIndex = 0;
this.cmb_run2.SelectedIndex = 0;
this.txt_zb.Text = "0,0";
DataSet dataSet = this.db.connDt("Select max(loc_id)+1 from LandMarkInfo ");
bool flag = dataSet.Tables[0].Rows[0][0].ToString() != "";
if (flag)
{
this.num_id.Value = Convert.ToInt16(dataSet.Tables[0].Rows[0][0].ToString());
}
else
{
this.num_id.Value = 1m;
}
}
// Token: 0x060000C8 RID: 200 RVA: 0x00013914 File Offset: 0x00011B14
private string add_point(int Assembly_Line, int Loc_ID, int Flag_Value, int Binding, int Area, int Assembly_ID, int Bank, int Speed, int Next_Station1, int Drict1, int LongTime1, int Next_Station2, int Drict2, int LongTime2, int loc_x, int loc_y)
{
string sqlstr = string.Concat(new string[]
{
"INSERT INTO [LandMarkInfo]([Assembly_Line] ,[Loc_ID] ,[Flag_Value] ,[Binding],[Area] ,[Assembly_ID] ,[Bank] ,[Speed] ,[Next_Station1],[Drict1] ,[LongTime1] ,[Next_Station2],[Drict2] ,[LongTime2] ,loc_x ,loc_y ) VALUES (",
Assembly_Line.ToString(),
" ,",
Loc_ID.ToString(),
" ,",
Flag_Value.ToString(),
" ,",
Binding.ToString(),
",",
Area.ToString(),
" ,",
Assembly_ID.ToString(),
" ,",
Bank.ToString(),
" ,",
Speed.ToString(),
",",
Next_Station1.ToString(),
",",
Drict1.ToString(),
" ,",
LongTime1.ToString(),
" ,",
Next_Station2.ToString(),
",",
Drict2.ToString(),
" ,",
LongTime2.ToString(),
",",
loc_x.ToString(),
",",
loc_y.ToString(),
")"
});
return this.db.Command(sqlstr);
}
// Token: 0x060000C9 RID: 201 RVA: 0x00013A88 File Offset: 0x00011C88
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_linelist.Text == "";
if (!flag2)
{
bool flag3 = this.add_point((int)Convert.ToInt16(this.cmb_linelist.Text.Split(new char[]
{
'.'
})[0]), (int)Convert.ToInt16(this.num_id.Value), (int)Convert.ToInt16(this.num_plcvalue.Value), this.cmb_bd.SelectedIndex, this.cmb_map.SelectedIndex, (int)Convert.ToInt16((this.cmb_type.SelectedIndex == 1) ? this.cmb_linelist.Text.Split(new char[]
{
'.'
})[0] : "0"), this.cmb_zhangaiwu.SelectedIndex, (int)Convert.ToInt16(this.num_speed.Value), (int)Convert.ToInt16(this.next_loc1.Value), this.cmb_run1.SelectedIndex, (int)Convert.ToInt16(this.next_longtime1.Value), (int)Convert.ToInt16(this.next_loc2.Value), this.cmb_run2.SelectedIndex, (int)Convert.ToInt16(this.next_longtime2.Value), (int)Convert.ToInt16(this.txt_zb.Text.Split(new char[]
{
','
})[0]), (int)Convert.ToInt16(this.txt_zb.Text.Split(new char[]
{
','
})[1])) == "1";
if (flag3)
{
MessageBox.Show("添加成功!");
this.Control_Point_Load(null, null);
}
}
}
}
// Token: 0x060000CA RID: 202 RVA: 0x00013C70 File Offset: 0x00011E70
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.delete_point(this.cmb_linelist.Text.Split(new char[]
{
'.'
})[0], this.num_id.Value.ToString()) == "1";
if (flag2)
{
MessageBox.Show("删除成功!");
this.Control_Point_Load(null, null);
}
}
}
// Token: 0x060000CB RID: 203 RVA: 0x00013D05 File Offset: 0x00011F05
private void toolStripButton5_Click(object sender, EventArgs e)
{
this.groupBox1.Enabled = true;
this.groupBox2.Enabled = true;
this.groupBox3.Enabled = true;
}
// Token: 0x060000CC RID: 204 RVA: 0x00013D30 File Offset: 0x00011F30
private void toolStripButton2_Click(object sender, EventArgs e)
{
bool flag = this.cmb_linelist.Text != "" || this.num_id.Value != 0m || this.num_plcvalue.Value != 0m;
if (flag)
{
this.ds.Tables.Clear();
this.str_sql = "SELECT CONVERT( VARCHAR(10),Assembly_Line.ID)+' . '+Line_name as 线体,[Assembly_Line] as 线体编号,[Loc_ID] as 位置编号,[Flag_Value] as 标记值,[Loc_X] as 坐标x,[Loc_Y] as 坐标y,CONVERT( VARCHAR(10),Loc_X)+','+CONVERT( VARCHAR(10),Loc_Y) as 位置坐标,[Binding] as 绑定方式,LandMarkInfo.[Area] as 地图编号,(Case when LandMarkInfo.Assembly_ID >0 THEN '管控停止点' ELSE '管控复位点' END) as 位置类型,[Bank] as 障碍物模式,[Speed] as 速度,[Next_Station1] as 下一站点1,[Drict1] as 运动模式1,[LongTime1] as 运动时间1,[Next_Station2] as 下一站点2,[Drict2] as 运动模式2,[LongTime2] as 运动时间2,[Next_Station3] as 下一站点3,[Drict3] as 运动模式3,[LongTime3] as 运动时间3 FROM LandMarkInfo ,Assembly_Line WHERE LandMarkInfo.Assembly_Line = Assembly_Line.ID";
this.ds = this.db.connDt(this.str_sql);
bool flag2 = this.cmb_linelist.Text != "" && this.cmb_linelist.Text != "所有线体";
if (flag2)
{
this.str_sql = this.str_sql + " and LandMarkInfo.Assembly_Line = " + this.cmb_linelist.Text.Split(new char[]
{
'.'
})[0];
}
bool flag3 = this.num_id.Value != 0m;
if (flag3)
{
this.str_sql = this.str_sql + " and Landmarkinfo.Loc_id = " + this.num_id.Value.ToString();
}
bool flag4 = this.num_plcvalue.Value != 0m;
if (flag4)
{
this.str_sql = this.str_sql + " and Landmarkinfo.flag_value = " + this.num_plcvalue.Value.ToString();
}
this.ds = this.db.connDt(this.str_sql);
bool flag5 = this.ds.Tables.Count > 0;
if (flag5)
{
this.dataGridView1.DataSource = this.ds.Tables[0];
}
}
}
// Token: 0x060000CD RID: 205 RVA: 0x00013EFC File Offset: 0x000120FC
private void num_id_ValueChanged(object sender, EventArgs e)
{
bool flag = this.groupBox1.Enabled && this.num_id.Value != 0m;
if (flag)
{
string str = "SELECT top 1 [Flag_Value] ,[Loc_X] ,[Loc_Y] ,[Binding] ,[Area] ,[Assembly_ID] ,[Bank] ,[Speed] ,[Next_Station1] ,[Drict1] ,[LongTime1] ,[Next_Station2] ,[Drict2] ,[LongTime2] FROM [LandMarkInfo] where loc_id =" + this.num_id.Value.ToString();
this.ds1 = this.db.connDt(str);
bool flag2 = this.ds1.Tables[0].Rows.Count == 1;
if (flag2)
{
this.button1.Visible = true;
}
else
{
this.button1.Visible = false;
}
}
bool flag3 = !this.groupBox1.Enabled;
if (flag3)
{
this.button1.Visible = false;
}
}
// Token: 0x060000CE RID: 206 RVA: 0x00013FC4 File Offset: 0x000121C4
private void button1_Click(object sender, EventArgs e)
{
bool flag = this.ds1.Tables[0].Rows.Count == 1;
if (flag)
{
this.num_plcvalue.Value = Convert.ToInt16(this.ds1.Tables[0].Rows[0]["Flag_Value"].ToString());
this.cmb_map.SelectedIndex = (int)Convert.ToInt16(this.ds1.Tables[0].Rows[0]["Area"].ToString());
this.cmb_bd.SelectedIndex = (int)Convert.ToInt16(this.ds1.Tables[0].Rows[0]["Binding"].ToString());
this.txt_zb.Text = this.ds1.Tables[0].Rows[0]["Loc_X"].ToString() + "," + this.ds1.Tables[0].Rows[0]["Loc_Y"].ToString();
this.cmb_type.SelectedIndex = ((this.ds1.Tables[0].Rows[0]["Assembly_ID"].ToString() == "0") ? 0 : 1);
this.cmb_zhangaiwu.SelectedIndex = (int)Convert.ToInt16(this.ds1.Tables[0].Rows[0]["Bank"].ToString());
this.num_speed.Value = Convert.ToDecimal(this.ds1.Tables[0].Rows[0]["Speed"].ToString());
this.next_loc1.Value = Convert.ToDecimal(this.ds1.Tables[0].Rows[0]["Next_Station1"].ToString());
this.next_loc2.Value = Convert.ToDecimal(this.ds1.Tables[0].Rows[0]["Next_Station2"].ToString());
this.next_longtime1.Value = Convert.ToDecimal(this.ds1.Tables[0].Rows[0]["LongTime1"].ToString());
this.next_longtime2.Value = Convert.ToDecimal(this.ds1.Tables[0].Rows[0]["LongTime2"].ToString());
this.cmb_run1.SelectedIndex = (int)Convert.ToInt16(this.ds1.Tables[0].Rows[0]["Drict1"].ToString());
this.cmb_run2.SelectedIndex = (int)Convert.ToInt16(this.ds1.Tables[0].Rows[0]["Drict2"].ToString());
}
}
// Token: 0x060000CF RID: 207 RVA: 0x00014348 File Offset: 0x00012548
private string update_point(int Assembly_Line, int Loc_ID, int Flag_Value, int Binding, int Area, int Assembly_ID, int Bank, int Speed, int Next_Station1, int Drict1, int LongTime1, int Next_Station2, int Drict2, int LongTime2, int Loc_X, int Loc_Y)
{
string sqlstr = string.Concat(new string[]
{
"UPDATE [LandMarkInfo] SET [Flag_Value] = ",
Flag_Value.ToString(),
" ,[Loc_X] = ",
Loc_X.ToString(),
" ,[Loc_Y] = ",
Loc_Y.ToString(),
" ,[Binding] = ",
Binding.ToString(),
" ,[Area] = ",
Area.ToString(),
" ,[Assembly_ID] = ",
Assembly_ID.ToString(),
" ,[Bank] = ",
Bank.ToString(),
" ,[Speed] = ",
Speed.ToString(),
" ,[Next_Station1] = ",
Next_Station1.ToString(),
" ,[Drict1] = ",
Drict1.ToString(),
" ,[LongTime1] = ",
LongTime1.ToString(),
" ,[Next_Station2] = ",
Next_Station2.ToString(),
" ,[Drict2] = ",
Drict2.ToString(),
" ,[LongTime2] = ",
LongTime2.ToString(),
" WHERE [Assembly_Line] = ",
Assembly_Line.ToString(),
" and [Loc_ID] =",
Loc_ID.ToString()
});
return this.db.Command(sqlstr);
}
// Token: 0x060000D0 RID: 208 RVA: 0x000144B4 File Offset: 0x000126B4
private void toolStripButton6_Click(object sender, EventArgs e)
{
bool flag = Param.UserName_temp == "";
if (flag)
{
MessageBox.Show("请登录管理员权限!", "AGV调度管理系统", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
else
{
bool flag2 = this.update_point((int)Convert.ToInt16(this.cmb_linelist.Text.Split(new char[]
{
'.'
})[0]), (int)Convert.ToInt16(this.num_id.Value), (int)Convert.ToInt16(this.num_plcvalue.Value), this.cmb_bd.SelectedIndex, this.cmb_map.SelectedIndex, (int)Convert.ToInt16((this.cmb_type.SelectedIndex == 1) ? this.cmb_linelist.Text.Split(new char[]
{
'.'
})[0] : "0"), this.cmb_zhangaiwu.SelectedIndex, (int)Convert.ToInt16(this.num_speed.Value), (int)Convert.ToInt16(this.next_loc1.Value), this.cmb_run1.SelectedIndex, (int)Convert.ToInt16(this.next_longtime1.Value), (int)Convert.ToInt16(this.next_loc2.Value), this.cmb_run2.SelectedIndex, (int)Convert.ToInt16(this.next_longtime2.Value), (int)Convert.ToInt16(this.txt_zb.Text.Split(new char[]
{
','
})[0]), (int)Convert.ToInt16(this.txt_zb.Text.Split(new char[]
{
','
})[1])) == "1";
if (flag2)
{
MessageBox.Show("更新成功!");
this.Control_Point_Load(null, null);
}
}
}
// Token: 0x04000127 RID: 295
private ClsDBConn_sql db = new ClsDBConn_sql();
// Token: 0x04000128 RID: 296
private DataSet ds = new DataSet();
// Token: 0x04000129 RID: 297
private string str_sql = "";
// Token: 0x0400012A RID: 298
private DataSet ds1;
}
}