1.初版差异提交

This commit is contained in:
龚记林
2026-08-19 17:02:08 +08:00
parent 6f8dae2d02
commit 92c0d2e8d5
24 changed files with 507 additions and 27 deletions
@@ -67,6 +67,9 @@ namespace AGVSystem
lab.Tag = Assembly_ID + "-" + id;
lab.DoubleClick += new System.EventHandler(Cls.Path_Reset.label12_DoubleClick);
lab.MouseClick += new MouseEventHandler(label_MouseClick);
lab.MouseUp += new MouseEventHandler(label_UpClick);
lab.MouseDown += new MouseEventHandler(label_DownClick);
lab.MouseMove += new MouseEventHandler(label_MoveClick);
}
else if (Cls.Param.Display_CrossID == false)
{
@@ -117,6 +120,85 @@ namespace AGVSystem
}
}
private static bool moveFlag = false;
private static int xPos;
private static int yPos;
/// <summary>
/// 松开鼠标:按住Ctrl且已登录管理员时,确认后更新地标坐标
/// </summary>
private static void label_UpClick(object sender, MouseEventArgs e)
{
moveFlag = false;
try
{
if ((Control.ModifierKeys & Keys.Control) != Keys.Control)
{
return;
}
if (Cls.Param.UserName_temp == "")
{
MessageBox.Show("请登录管理员权限!", "AGV调度管理系统", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
return;
}
Label label = (Label)sender;
int num = Convert.ToInt16(label.Text);
if (MessageBox.Show($"是否移动该{num}地标?", "消息", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) != DialogResult.No && label.Parent.GetType() == typeof(Panel))
{
Panel panel = label.Parent as Panel;
int y = panel.Top + Cls.Param.Icon_Size / 2;
int left = panel.Left;
Console.WriteLine(num + "up === X:" + left + "Y:" + y);
UpLocation(num, left, y);
}
}
catch (Exception)
{
}
}
private static void label_DownClick(object sender, MouseEventArgs e)
{
moveFlag = true;
xPos = e.X;
yPos = e.Y;
}
/// <summary>
/// 拖动地标所在Panel
/// </summary>
private static void label_MoveClick(object sender, MouseEventArgs e)
{
if (moveFlag)
{
Label label = (Label)sender;
int num = Convert.ToInt16(label.Text);
if (label.Parent.GetType() == typeof(Panel))
{
Panel panel = label.Parent as Panel;
panel.Top += e.Y - yPos;
panel.Left += e.X - xPos;
}
}
}
/// <summary>
/// 更新地标坐标到数据库
/// </summary>
private static void UpLocation(int rfid, int x, int y)
{
try
{
string text = db_conn.Command($"UPDATE [LandMarkInfo] SET [Loc_X] = {x},[Loc_Y] = {y} WHERE [Loc_ID] = {rfid}");
if (text == "1")
{
Console.WriteLine($"{rfid} 更新成功!x:{x},y:{y} ");
}
}
catch (Exception)
{
}
}
private static object obj_dgvupdate = new object();
public static void DgvUpdate(DataGridView dgv, int row, string columnname, bool value)