Files

162 lines
5.5 KiB
C#

using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using AGVSystem.Cls;
namespace AGVSystem
{
// Token: 0x02000011 RID: 17
public partial class Location_Set : Form
{
// Token: 0x060000EA RID: 234 RVA: 0x0001A01C File Offset: 0x0001821C
public Location_Set(int id, int x, int y, int map)
{
this.InitializeComponent();
this.txt_zb_x.Text = x.ToString();
this.txt_zb_y.Text = y.ToString();
this.cmb_map.SelectedIndex = map;
this.num_id.Value = id;
}
// Token: 0x060000EB RID: 235 RVA: 0x0001A0B0 File Offset: 0x000182B0
private void button1_Click(object sender, EventArgs e)
{
bool flag = Param.UserName_temp == "";
if (flag)
{
MessageBox.Show("请登录管理员权限!", "AGV调度管理系统", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
else
{
this.strsql = string.Concat(new string[]
{
"UPDATE [LandMarkInfo] SET [Flag_Value] = ",
this.num_plcvalue.Value.ToString(),
",[Loc_X] = ",
this.txt_zb_x.Text,
",[Loc_Y] = ",
this.txt_zb_y.Text,
",[Binding] = ",
this.cmb_bd.SelectedIndex.ToString(),
",[Area] = ",
this.cmb_map.SelectedIndex.ToString(),
",[Bank] = ",
this.cmb_zhangaiwu.SelectedIndex.ToString(),
",[Speed] = ",
this.num_speed.Value.ToString(),
",[Next_Station1] = ",
this.next_loc1.Value.ToString(),
",[Drict1] = ",
this.cmb_run1.SelectedIndex.ToString(),
",[LongTime1] = ",
this.next_longtime1.Value.ToString(),
",[Next_Station2] = ",
this.next_loc2.Value.ToString(),
",[Drict2] = ",
this.cmb_run2.SelectedIndex.ToString(),
",[LongTime2] = ",
this.next_longtime2.Value.ToString(),
" WHERE [Loc_ID] = ",
this.num_id.Value.ToString()
});
string a = this.db.Command(this.strsql);
bool flag2 = a == "1";
if (flag2)
{
MessageBox.Show("更新成功!");
base.Close();
}
}
}
// Token: 0x060000EC RID: 236 RVA: 0x0001A2E0 File Offset: 0x000184E0
private void num_id_ValueChanged(object sender, EventArgs e)
{
this.value = -100;
this.strsql = "SELECT [Loc_ID] ,[Flag_Value],[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.ds.Tables.Clear();
this.ds = this.db.connDt(this.strsql);
bool flag = this.ds.Tables[0].Rows.Count == 1;
if (flag)
{
this.num_plcvalue.Value = Convert.ToDecimal(this.ds.Tables[0].Rows[0][0].ToString());
}
else
{
bool flag2 = this.ds.Tables[0].Rows.Count > 1;
if (flag2)
{
foreach (object obj in this.ds.Tables[0].Rows)
{
DataRow dataRow = (DataRow)obj;
bool flag3 = this.value == -100;
if (flag3)
{
this.value = (int)Convert.ToInt16(dataRow[0].ToString());
}
else
{
bool flag4 = this.value != (int)Convert.ToInt16(dataRow[0].ToString());
if (flag4)
{
MessageBox.Show(this.num_id.Value.ToString() + "对应的标记值有误!");
this.button1.Enabled = false;
return;
}
}
}
}
}
bool flag5 = this.ds.Tables[0].Rows.Count >= 1;
if (flag5)
{
this.num_plcvalue.Value = Convert.ToDecimal(this.ds.Tables[0].Rows[0][1].ToString());
this.cmb_map.SelectedIndex = (int)Convert.ToInt16(this.ds.Tables[0].Rows[0][3].ToString());
this.cmb_bd.SelectedIndex = (int)Convert.ToInt16(this.ds.Tables[0].Rows[0][2].ToString());
this.cmb_type.SelectedIndex = ((this.ds.Tables[0].Rows[0][4].ToString() == "0") ? 0 : 1);
this.cmb_zhangaiwu.SelectedIndex = (int)Convert.ToInt16(this.ds.Tables[0].Rows[0][5].ToString());
this.num_speed.Value = Convert.ToDecimal(this.ds.Tables[0].Rows[0][6].ToString());
this.next_loc1.Value = Convert.ToDecimal(this.ds.Tables[0].Rows[0][7].ToString());
this.next_loc2.Value = Convert.ToDecimal(this.ds.Tables[0].Rows[0][10].ToString());
this.next_longtime1.Value = Convert.ToDecimal(this.ds.Tables[0].Rows[0][9].ToString());
this.next_longtime2.Value = Convert.ToDecimal(this.ds.Tables[0].Rows[0][12].ToString());
this.cmb_run1.SelectedIndex = (int)Convert.ToInt16(this.ds.Tables[0].Rows[0][8].ToString());
this.cmb_run2.SelectedIndex = (int)Convert.ToInt16(this.ds.Tables[0].Rows[0][11].ToString());
}
}
// Token: 0x060000ED RID: 237 RVA: 0x0001A790 File Offset: 0x00018990
private void next_loc1_ValueChanged(object sender, EventArgs e)
{
this.strsql = "SELECT [Loc_X] ,[Loc_Y] FROM LandMarkInfo WHERE Loc_ID =" + this.next_loc1.Value.ToString();
this.ds.Tables.Clear();
this.ds = this.db.connDt(this.strsql);
bool flag = this.ds.Tables[0].Rows.Count == 1;
if (flag)
{
this.next_longtime1.Value = Math.Abs((int)(Convert.ToInt16(this.ds.Tables[0].Rows[0][0].ToString()) - Convert.ToInt16(this.txt_zb_x.Text))) + Math.Abs((int)(Convert.ToInt16(this.ds.Tables[0].Rows[0][1].ToString()) - Convert.ToInt16(this.txt_zb_y.Text)));
}
}
// Token: 0x060000EE RID: 238 RVA: 0x0001A8A6 File Offset: 0x00018AA6
private void Location_Set_Load(object sender, EventArgs e)
{
this.next_loc1.ValueChanged += this.next_loc1_ValueChanged;
}
// Token: 0x040001AF RID: 431
private string strsql = "";
// Token: 0x040001B0 RID: 432
private ClsDBConn_sql db = new ClsDBConn_sql();
// Token: 0x040001B1 RID: 433
private DataSet ds = new DataSet();
// Token: 0x040001B2 RID: 434
private int value = -100;
}
}