1.初版差异提交
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using AGVSystem.A17168;
|
||||
|
||||
namespace AGVSystem.Cls
|
||||
{
|
||||
@@ -16,6 +17,7 @@ namespace AGVSystem.Cls
|
||||
int[] num = new int[2];
|
||||
num[0] = Convert.ToInt16(((System.Windows.Forms.Label)sender).Tag.ToString().Split('-')[0]);
|
||||
num[1] = Convert.ToInt16(((System.Windows.Forms.Label)sender).Tag.ToString().Split('-')[1]);
|
||||
ClearOtherLand(num[1]);
|
||||
for (int i = 0; i < mainfrm.ds_CrossInfo.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
string s = mainfrm.ds_CrossInfo.Tables[0].Rows[i]["当前地标编号"].ToString();
|
||||
@@ -29,5 +31,37 @@ namespace AGVSystem.Cls
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 复位路口时向第三方交管手动归还路权
|
||||
/// </summary>
|
||||
private static void ClearOtherLand(int land)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (TrafficModel item in Frm_A17168.autoLeavedDic)
|
||||
{
|
||||
if (item.agvId == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (item.areaCode != land.ToString())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
bool flag = Frm_A17168.businessCtrl.ByLeaved(item.agvId.ToString(), land.ToString(), item.areaCode.ToString());
|
||||
WriteTxt.SaveLog1(item.areaCode.ToString() + "手动释放,返回的值" + flag, "放行日志" + item.agvId, "插件日志");
|
||||
if (flag)
|
||||
{
|
||||
Frm_A17168.leavedDic[item.agvId] = 0;
|
||||
item.agvId = 0;
|
||||
WriteTxt.SaveLog1(item.areaCode.ToString() + "路口已手动归还", "放行日志" + item.agvId, "插件日志");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user