Files
FG2608061/CODE/20230901/SA17168/AGVSystem Ver2.0/Cls/Path_Reset.cs
T
2026-08-19 17:02:08 +08:00

68 lines
2.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AGVSystem.A17168;
namespace AGVSystem.Cls
{
class Path_Reset
{
public static void label12_DoubleClick(object sender, EventArgs e)
{
if (((System.Windows.Forms.Label)sender).Tag.ToString() == "")
return;
if (MessageBox.Show("是否复位该路口?", "消息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) return;
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();
string a = mainfrm.ds_CrossInfo.Tables[0].Rows[i]["AGV编号"].ToString();
if (mainfrm.ds_CrossInfo.Tables[0].Rows[i]["当前产线编号"].ToString() == num[0].ToString() &&
mainfrm.ds_CrossInfo.Tables[0].Rows[i]["当前地标编号"].ToString() == num[1].ToString() &&
mainfrm.ds_CrossInfo.Tables[0].Rows[i]["AGV编号"].ToString() != "0")
{
MessageBox.Show("AGV-" + mainfrm.ds_CrossInfo.Tables[0].Rows[i]["AGV编号"].ToString() + "占用路口信息被清除!");
mainfrm.ds_CrossInfo.Tables[0].Rows[i]["AGV编号"] = 0;
}
}
}
/// <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)
{
}
}
}
}