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

1666 lines
60 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net.NetworkInformation;
using System.Threading;
using AGVSystem.A17168;
using AGVSystem.Cls;
using BllSql;
using Crossing;
using HxBusiness;
using Protocol.Socket_Uart.S7_200_PPI;
namespace AGVSystem
{
// Token: 0x02000002 RID: 2
public class Cls_A17168
{
// Token: 0x17000001 RID: 1
// (get) Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
// (set) Token: 0x06000002 RID: 2 RVA: 0x00002067 File Offset: 0x00000267
public DataSet ds_Mileage
{
get
{
return Cls_A17168.ds_mileage;
}
set
{
Cls_A17168.ds_mileage = value;
}
}
// Token: 0x17000002 RID: 2
// (get) Token: 0x06000003 RID: 3 RVA: 0x00002070 File Offset: 0x00000270
// (set) Token: 0x06000004 RID: 4 RVA: 0x00002087 File Offset: 0x00000287
public string ConnectStr
{
get
{
return Cls_A17168.connectStr;
}
set
{
Cls_A17168.connectStr = value;
}
}
// Token: 0x17000003 RID: 3
// (get) Token: 0x06000005 RID: 5 RVA: 0x00002090 File Offset: 0x00000290
// (set) Token: 0x06000006 RID: 6 RVA: 0x000020A7 File Offset: 0x000002A7
public bool StartFlag
{
get
{
return Cls_A17168.startFlag;
}
set
{
Cls_A17168.startFlag = value;
}
}
// Token: 0x17000004 RID: 4
// (get) Token: 0x06000007 RID: 7 RVA: 0x000020B0 File Offset: 0x000002B0
// (set) Token: 0x06000008 RID: 8 RVA: 0x000020C7 File Offset: 0x000002C7
public int ClosedFlag
{
get
{
return Cls_A17168.closedFlag;
}
set
{
Cls_A17168.closedFlag = value;
}
}
// Token: 0x17000005 RID: 5
// (get) Token: 0x06000009 RID: 9 RVA: 0x000020D0 File Offset: 0x000002D0
// (set) Token: 0x0600000A RID: 10 RVA: 0x000020E7 File Offset: 0x000002E7
public Thread[] th_GetData
{
get
{
return Cls_A17168.th_getData;
}
set
{
Cls_A17168.th_getData = value;
}
}
// Token: 0x0600000B RID: 11 RVA: 0x000020F0 File Offset: 0x000002F0
public void AGV_start(object agvinfo)
{
Cls_A17168.agv @object = new Cls_A17168.agv();
AgvInfo agvInfo = (AgvInfo)agvinfo;
bool flag = agvInfo.Type == 6;
if (flag)
{
this.th_GetData[agvInfo.Agv_ID - 1] = new Thread(new ParameterizedThreadStart(@object.AGV_Data));
}
else
{
this.th_GetData[agvInfo.Agv_ID - 1] = new Thread(new ParameterizedThreadStart(@object.AGV_Data_PLC));
}
this.th_GetData[agvInfo.Agv_ID - 1].IsBackground = true;
this.th_GetData[agvInfo.Agv_ID - 1].Start(agvinfo);
}
// Token: 0x0600000C RID: 12 RVA: 0x0000218C File Offset: 0x0000038C
public static int GetAreaAGVNum(int[] num)
{
int num2 = 0;
for (int i = 0; i < num.Length; i++)
{
num2 += (int)Cls_A17168.Agv_Land_Count(num[i]);
}
return num2;
}
// Token: 0x0600000D RID: 13 RVA: 0x000021C0 File Offset: 0x000003C0
private static void Warn_Deal(AgvInfo temp, string sWarn)
{
bool flag = temp.Warn_ID != sWarn;
if (flag)
{
int num = 0;
string[] array = new string[]
{
"",
"",
"",
"",
"",
"",
"",
""
};
temp.Warn_ID = sWarn;
Cls_A17168.WarnInfo(temp.Warn_ID, out array, out num);
temp.Warn_info = "";
temp.Warn_Level = num;
bool flag2 = num == 1;
if (flag2)
{
temp.Warn_info = "正常";
Func.Agv_Alarm_Insert(temp.Agv_ID, temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, "正常", temp.Agv_ID);
}
else
{
for (byte b = 0; b < 8; b += 1)
{
bool flag3 = array[(int)b] != "";
if (flag3)
{
temp.Warn_info = temp.Warn_info + array[(int)b] + "\r\n";
Func.Agv_Alarm_Insert(0, temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, array[(int)b], temp.Agv_ID);
}
}
}
}
}
// Token: 0x0600000E RID: 14 RVA: 0x00002310 File Offset: 0x00000510
private static void Warn_Deal_Plc(AgvInfo temp, string sWarn)
{
bool flag = temp.Warn_ID != sWarn;
if (flag)
{
int num = 0;
string[] array = new string[]
{
"",
"",
"",
"",
"",
"",
"",
""
};
temp.Warn_ID = sWarn;
Cls_A17168.WarnInfo_PLC(temp.Warn_ID, out array, out num);
temp.Warn_info = "";
temp.Warn_Level = num;
bool flag2 = num == 1;
if (flag2)
{
temp.Warn_info = "正常";
Func.Agv_Alarm_Insert(temp.Agv_ID, temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, "正常", temp.Agv_ID);
}
else
{
for (byte b = 0; b < 8; b += 1)
{
bool flag3 = array[(int)b] != "";
if (flag3)
{
temp.Warn_info = temp.Warn_info + array[(int)b] + "\r\n";
Func.Agv_Alarm_Insert(0, temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, array[(int)b], temp.Agv_ID);
}
}
}
}
}
// Token: 0x0600000F RID: 15 RVA: 0x00002460 File Offset: 0x00000660
private static void Voltage_Deal(AgvInfo temp, string sValue)
{
}
// Token: 0x06000010 RID: 16 RVA: 0x00002460 File Offset: 0x00000660
private static void Speed_Bank_Deal(AgvInfo temp, string sValue)
{
}
// Token: 0x06000011 RID: 17 RVA: 0x00002460 File Offset: 0x00000660
private static void Direction_Run_Deal(AgvInfo temp, string sValue)
{
}
// Token: 0x06000012 RID: 18 RVA: 0x00002460 File Offset: 0x00000660
private static void Move_Forward(AgvInfo temp, string sValue)
{
}
// Token: 0x06000013 RID: 19 RVA: 0x00002464 File Offset: 0x00000664
private static byte Agv_Count_Area(int worktype, int[] landmark)
{
byte b = 0;
byte b2 = 0;
while ((int)b2 < Func.AgvInfo.Length)
{
bool flag = Func.AgvInfo[(int)b2].WorkType == worktype;
if (flag)
{
byte b3 = 0;
while ((int)b3 < landmark.Length)
{
bool flag2 = Func.AgvInfo[(int)b2].Location_Display == landmark[(int)b3];
if (flag2)
{
b += 1;
}
b3 += 1;
}
}
b2 += 1;
}
return b;
}
// Token: 0x06000014 RID: 20 RVA: 0x000024E0 File Offset: 0x000006E0
private static byte Agv_Land_Count(int landmark)
{
byte b = 0;
byte b2 = 0;
while ((int)b2 < Func.AgvInfo.Length)
{
bool flag = Func.AgvInfo[(int)b2].Location_Display == landmark;
if (flag)
{
b += 1;
}
b2 += 1;
}
return b;
}
// Token: 0x06000015 RID: 21 RVA: 0x00002528 File Offset: 0x00000728
private static byte Agv_Go_Count(int landmark)
{
byte b = 0;
byte b2 = 0;
while ((int)b2 < Func.AgvInfo.Length)
{
bool flag = Func.AgvInfo[(int)b2].Cross_Location_Go == landmark;
if (flag)
{
b += 1;
}
b2 += 1;
}
return b;
}
// Token: 0x06000016 RID: 22 RVA: 0x00002570 File Offset: 0x00000770
private static void LostConnect(ref int iStatus)
{
object sem_LOST_CONNECT = Cls_A17168.SEM_LOST_CONNECT;
lock (sem_LOST_CONNECT)
{
bool flag2 = iStatus >= 0;
if (flag2)
{
iStatus = -1;
}
else
{
iStatus--;
}
}
}
// Token: 0x06000017 RID: 23 RVA: 0x000025C8 File Offset: 0x000007C8
private static void WarnInfo(string str, out string[] info, out int level)
{
int num = 0;
info = new string[8];
level = 1;
for (byte b = 0; b < 8; b += 1)
{
info[(int)b] = "";
}
bool flag = str == "0000000000000000000000000000000000000000000000000000000000000000";
if (flag)
{
info[0] = "正常";
}
else
{
for (byte b2 = 0; b2 < 64; b2 += 1)
{
bool flag2 = str.Substring((int)(63 - b2), 1) == "1";
if (flag2)
{
bool flag3 = mainfrm.ds_WarnList.Tables[0].Rows[(int)b2][2].ToString() != "0";
if (flag3)
{
info[num] = mainfrm.ds_WarnList.Tables[0].Rows[(int)b2][1].ToString();
bool flag4 = level < (int)Convert.ToInt16(mainfrm.ds_WarnList.Tables[0].Rows[(int)b2][2].ToString());
if (flag4)
{
level = (int)Convert.ToInt16(mainfrm.ds_WarnList.Tables[0].Rows[(int)b2][2].ToString());
}
num++;
}
bool flag5 = num >= 8;
if (flag5)
{
break;
}
}
}
}
}
// Token: 0x06000018 RID: 24 RVA: 0x00002740 File Offset: 0x00000940
private static void WarnInfo_PLC(string str, out string[] info, out int level)
{
int num = 0;
info = new string[8];
level = 1;
for (byte b = 0; b < 8; b += 1)
{
info[(int)b] = "";
}
bool flag = str == "0000000000000000000000000000000000000000000000000000000000000000";
if (flag)
{
info[0] = "正常";
}
else
{
for (byte b2 = 0; b2 < 64; b2 += 1)
{
bool flag2 = str.Substring((int)(63 - b2), 1) == "1";
if (flag2)
{
bool flag3 = mainfrm.ds_WarnList_Plc.Tables[0].Rows[(int)b2][2].ToString() != "0";
if (flag3)
{
info[num] = mainfrm.ds_WarnList_Plc.Tables[0].Rows[(int)b2][1].ToString();
bool flag4 = level < (int)Convert.ToInt16(mainfrm.ds_WarnList_Plc.Tables[0].Rows[(int)b2][2].ToString());
if (flag4)
{
level = (int)Convert.ToInt16(mainfrm.ds_WarnList_Plc.Tables[0].Rows[(int)b2][2].ToString());
}
num++;
}
bool flag5 = num >= 8;
if (flag5)
{
break;
}
}
}
}
}
// Token: 0x06000019 RID: 25 RVA: 0x000028B8 File Offset: 0x00000AB8
public static float GetMileage(int point1, int point2)
{
object obj = Cls_A17168.obj_GetMileage;
float result;
lock (obj)
{
float num = 0f;
int count = Cls_A17168.ds_mileage.Tables[0].Rows.Count;
DataTable dataTable = new DataView(Cls_A17168.ds_mileage.Tables[0])
{
RowFilter = string.Concat(new string[]
{
"(Start_Point=",
point1.ToString(),
" or Start_Point=",
point2.ToString(),
") and (End_Point= ",
point1.ToString(),
" or End_Point= ",
point2.ToString(),
")"
}),
RowStateFilter = DataViewRowState.OriginalRows
}.ToTable();
int count2 = dataTable.Rows.Count;
try
{
num = Convert.ToSingle(dataTable.Rows[0]["Distance"].ToString());
}
catch
{
}
result = num;
}
return result;
}
// Token: 0x04000001 RID: 1
private static Thread[] th_getData;
// Token: 0x04000002 RID: 2
public static DataSet ds_mileage = new DataSet();
// Token: 0x04000003 RID: 3
private static string connectStr = "";
// Token: 0x04000004 RID: 4
private static bool startFlag = false;
// Token: 0x04000005 RID: 5
private static int closedFlag = -1;
// Token: 0x04000006 RID: 6
public static BllBase bBllBase = new BllBase();
// Token: 0x04000007 RID: 7
private static object SEM_LOST_CONNECT = new object();
// Token: 0x04000008 RID: 8
private static object obj_GetMileage = new object();
// Token: 0x02000037 RID: 55
public class agv
{
// Token: 0x060002C9 RID: 713 RVA: 0x00054170 File Offset: 0x00052370
public void AGV_Data(object agvinfo)
{
AgvInfo temp = (AgvInfo)agvinfo;
int location_temp = 0;
int[] array = new int[24];
byte[] array2 = new byte[24];
int num = 0;
int num2 = 0;
Ping ping = new Ping();
Soc_Client soc_Client = new Soc_Client(temp.IP, temp.Port);
temp.Soc = soc_Client.clientSocket;
string[] array3 = new string[]
{
"",
"",
"",
"",
"",
"",
"",
""
};
Cls_A17168.closedFlag = -1;
Predicate<TrafficModel> <>9__1;
Predicate<TrafficModel> <>9__2;
for (;;)
{
bool flag = !temp.Enable;
if (flag)
{
Thread.Sleep(3000);
bool flag2 = temp.Location_Display != 0;
if (flag2)
{
Crossing.BlockCross(temp.AssemblyLine, 0, temp.Agv_ID, mainfrm.ds_CrossInfo);
}
temp.Location_Display = 0;
temp.Cross_Location_Go = 0;
}
else
{
bool flag3 = !Cls_A17168.startFlag;
if (flag3)
{
Thread.Sleep(500);
}
else
{
try
{
bool flag4 = temp.bPlcLinked || ping.Send(temp.IP, 150).Status == IPStatus.Success;
if (flag4)
{
bool flag5 = !temp.bPlcLinked;
if (flag5)
{
bool flag6 = soc_Client.OpenLinkPLC();
if (flag6)
{
temp.bPlcLinked = true;
}
else
{
temp.bPlcLinked = false;
soc_Client.CloseLinkPLC();
soc_Client = new Soc_Client(temp.IP, temp.Port);
temp.Soc = soc_Client.clientSocket;
num = 0;
}
}
else
{
array[0] = 0;
bool flag7 = temp.Type == 6 && soc_Client.ReadInfo(out array) != 0;
if (flag7)
{
num++;
bool flag8 = num >= 5;
if (flag8)
{
temp.bPlcLinked = false;
num = 0;
soc_Client.CloseLinkPLC();
soc_Client = new Soc_Client(temp.IP, temp.Port);
temp.Soc = soc_Client.clientSocket;
temp.Warn_ID = "0000000000000000000000000000000010000000000000000000000000000000";
temp.Warn_Level = 4;
temp.Warn_info = "网络异常";
string item = string.Concat(new string[]
{
"INSERT INTO[Net_Log] ([dt],[AGV_ID],[Type]) VALUES('",
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
"', '",
temp.Agv_ID.ToString(),
"', 'Read Fail')"
});
UPDateDBList.sqlList.Add(item);
}
}
else
{
num = 0;
int num3 = (temp.Type == 6) ? (array[3] * 256 + array[2]) : array[0];
location_temp = Func.GetLandMarkId(temp.AssemblyLine, num3);
bool flag9 = temp.Location_Display != location_temp && location_temp != 0;
if (flag9)
{
WriteTxt.SaveLog1("AGV经过地标:" + location_temp.ToString(), temp.Agv_ID.ToString() + "#Agv", "地标日志");
temp.Location_Display = location_temp;
temp.Read_dt = DateTime.Now;
UPDateDBList.upDbList.Add(new Location_Log(DateTime.Now, temp.Agv_ID, temp.Location_Display, num3, 0, 0, 0));
}
WriteTxt.SaveLog1("=========》(11):" + location_temp.ToString(), temp.Agv_ID.ToString() + "#Agv", "调试日志");
bool flag10 = temp.Cross_Location_Go != location_temp && num3 > 0 && num3 < 2000;
if (flag10)
{
bool flag11 = temp.AssemblyLine == 1 && temp.Location_Display == 152;
if (flag11)
{
bool flag12 = Cls_A17168.Agv_Land_Count(152) == 1;
if (flag12)
{
int num4 = Crossing.BlockCross(temp.AssemblyLine, location_temp, temp.Agv_ID, mainfrm.ds_CrossInfo);
bool flag13 = num4 >= 0;
if (flag13)
{
bool flag14 = soc_Client.WriteInfo(1, 0, 0) == 0;
if (flag14)
{
num2 = 0;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "已放行", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
}
}
else
{
bool flag15 = num4 != num2;
if (flag15)
{
num2 = num4;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "AGV" + num4.ToString() + "占用路口", temp.Agv_ID, num3);
}
}
}
}
else
{
bool flag16 = temp.AssemblyLine == 3 && temp.Location_Display == 136;
if (flag16)
{
bool flag17 = Cls_A17168.Agv_Land_Count(136) == 1;
if (flag17)
{
int num4 = Crossing.BlockCross(temp.AssemblyLine, location_temp, temp.Agv_ID, mainfrm.ds_CrossInfo);
bool flag18 = num4 >= 0;
if (flag18)
{
bool flag19 = soc_Client.WriteInfo(1, 0, 0) == 0;
if (flag19)
{
num2 = 0;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "已放行", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
}
}
else
{
bool flag20 = num4 != num2;
if (flag20)
{
num2 = num4;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "AGV" + num4.ToString() + "占用路口", temp.Agv_ID, num3);
}
}
}
}
else
{
bool flag21 = temp.AssemblyLine == 5 && Enumerable.Contains<int>(new int[]
{
106,
182,
196
}, location_temp);
if (flag21)
{
bool flag22 = (temp.Location_Display == 106 && Cls_A17168.Agv_Land_Count(106) == 1 && Cls_A17168.Agv_Land_Count(167) == 0) || (temp.Location_Display == 182 && Cls_A17168.Agv_Land_Count(182) == 1 && Cls_A17168.Agv_Land_Count(196) == 0) || (temp.Location_Display == 196 && Cls_A17168.Agv_Land_Count(196) == 1 && Cls_A17168.Agv_Land_Count(195) == 0);
if (flag22)
{
int num4 = Crossing.BlockCross(temp.AssemblyLine, location_temp, temp.Agv_ID, mainfrm.ds_CrossInfo);
bool flag23 = num4 >= 0;
if (flag23)
{
bool flag24 = soc_Client.WriteInfo(1, 0, 0) == 0;
if (flag24)
{
num2 = 0;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "已放行", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
}
}
else
{
bool flag25 = num4 != num2;
if (flag25)
{
num2 = num4;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "AGV" + num4.ToString() + "占用路口", temp.Agv_ID, num3);
}
}
}
}
else
{
bool flag26 = temp.AssemblyLine == 6 && Enumerable.Contains<int>(new int[]
{
180
}, location_temp);
if (flag26)
{
bool flag27 = temp.Location_Display == 180 && Cls_A17168.Agv_Land_Count(180) == 1;
if (flag27)
{
int num4 = Crossing.BlockCross(temp.AssemblyLine, location_temp, temp.Agv_ID, mainfrm.ds_CrossInfo);
bool flag28 = num4 >= 0;
if (flag28)
{
bool flag29 = soc_Client.WriteInfo(1, 0, 0) == 0;
if (flag29)
{
num2 = 0;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "已放行", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
}
}
else
{
bool flag30 = num4 != num2;
if (flag30)
{
num2 = num4;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "AGV" + num4.ToString() + "占用路口", temp.Agv_ID, num3);
}
}
}
}
else
{
bool flag31 = temp.AssemblyLine == 7 && Enumerable.Contains<int>(new int[]
{
500,
174,
156,
154,
216,
504
}, location_temp);
if (flag31)
{
bool flag32 = (temp.Location_Display == 500 && Cls_A17168.Agv_Land_Count(500) == 1) || (temp.Location_Display == 174 && Cls_A17168.Agv_Land_Count(174) == 1) || (temp.Location_Display == 154 && Cls_A17168.Agv_Land_Count(154) == 1 && Cls_A17168.Agv_Land_Count(156) == 0) || (temp.Location_Display == 156 && Cls_A17168.Agv_Land_Count(156) == 1) || (temp.Location_Display == 216 && Cls_A17168.Agv_Land_Count(216) == 1) || (temp.Location_Display == 504 && Cls_A17168.Agv_Land_Count(504) == 1);
if (flag32)
{
int num4 = Crossing.BlockCross(temp.AssemblyLine, location_temp, temp.Agv_ID, mainfrm.ds_CrossInfo);
bool flag33 = num4 >= 0;
if (flag33)
{
bool flag34 = soc_Client.WriteInfo(1, 0, 0) == 0;
if (flag34)
{
num2 = 0;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "已放行", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
}
}
else
{
bool flag35 = num4 != num2;
if (flag35)
{
num2 = num4;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "AGV" + num4.ToString() + "占用路口", temp.Agv_ID, num3);
}
}
}
}
else
{
bool flag36 = Enumerable.Contains<int>(new int[]
{
316,
328,
332,
300,
314,
310,
342
}, location_temp);
if (flag36)
{
bool flag37 = (temp.Location_Display == 316 && Cls_A17168.GetAreaAGVNum(new int[]
{
316,
320,
321
}) == 1) || (temp.Location_Display == 328 && Cls_A17168.GetAreaAGVNum(new int[]
{
328,
332
}) == 1) || (temp.Location_Display == 332 && Cls_A17168.GetAreaAGVNum(new int[]
{
332
}) == 1) || (temp.Location_Display == 300 && Cls_A17168.GetAreaAGVNum(new int[]
{
300
}) == 1) || (temp.Location_Display == 310 && Cls_A17168.GetAreaAGVNum(new int[]
{
310,
312,
313
}) == 1) || (temp.Location_Display == 342 && Cls_A17168.GetAreaAGVNum(new int[]
{
342,
304,
305
}) == 1) || (temp.Location_Display == 314 && Cls_A17168.GetAreaAGVNum(new int[]
{
314
}) == 1);
if (flag37)
{
int num4 = Crossing.BlockCross(temp.AssemblyLine, location_temp, temp.Agv_ID, mainfrm.ds_CrossInfo);
bool flag38 = num4 >= 0;
if (flag38)
{
bool flag39 = soc_Client.WriteInfo(1, 0, 0) == 0;
if (flag39)
{
num2 = 0;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "已放行", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
}
}
else
{
bool flag40 = num4 != num2;
if (flag40)
{
num2 = num4;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "AGV" + num4.ToString() + "占用路口", temp.Agv_ID, num3);
}
}
}
}
else
{
bool flag41 = Enumerable.Contains<string>(Frm_A17168.businessCtrl.apiModel.waitRfidList.Split(new char[]
{
','
}), location_temp.ToString());
if (flag41)
{
WriteTxt.SaveLog1("=========》(12):" + location_temp.ToString(), temp.Agv_ID.ToString() + "#Agv", "调试日志");
bool flag42 = Frm_A17168.businessCtrl == null;
if (flag42)
{
Frm_A17168.businessCtrl = new BusinessManage();
}
bool flag43 = Frm_A17168.leavedDic == null;
if (flag43)
{
Frm_A17168.leavedDic = new Dictionary<int, int>();
}
bool flag44 = !Frm_A17168.leavedDic.ContainsKey(temp.Agv_ID);
if (flag44)
{
Frm_A17168.leavedDic.Add(temp.Agv_ID, 0);
}
bool flag45 = false;
WriteTxt.SaveLog1(location_temp.ToString() + "开始请求放行", "放行日志" + temp.Agv_ID.ToString(), "插件日志");
bool flag46 = Frm_A17168.leavedDic[temp.Agv_ID] % Frm_A17168.businessCtrl.apiModel.requestSecond == 0;
if (flag46)
{
flag45 = Frm_A17168.businessCtrl.RequestLeaved(temp.Agv_ID.ToString(), location_temp.ToString());
WriteTxt.SaveLog1(location_temp.ToString() + "请求离开返回的值" + flag45.ToString(), "放行日志" + temp.Agv_ID.ToString(), "插件日志");
}
bool flag47 = flag45;
if (flag47)
{
WriteTxt.SaveLog1("=========》(13):" + location_temp.ToString(), temp.Agv_ID.ToString() + "#Agv", "调试日志");
List<TrafficModel> autoLeavedDic = Frm_A17168.autoLeavedDic;
Predicate<TrafficModel> match;
if ((match = <>9__1) == null)
{
match = (<>9__1 = ((TrafficModel _) => _.areaCode.Equals(location_temp.ToString())));
}
TrafficModel trafficModel = autoLeavedDic.Find(match);
bool flag48 = trafficModel != null;
if (flag48)
{
trafficModel.agvId = temp.Agv_ID;
trafficModel.InArea = DateTime.Now;
}
WriteTxt.SaveLog1(string.Concat(new string[]
{
location_temp.ToString(),
"路口添加",
(trafficModel != null) ? trafficModel.areaCode : null,
"(",
trafficModel.agvId.ToString(),
")"
}), "放行日志" + temp.Agv_ID.ToString(), "插件日志");
bool flag49 = soc_Client.WriteInfo(1, 0, 0) == 0;
if (flag49)
{
Frm_A17168.leavedDic[temp.Agv_ID] = 0;
WriteTxt.SaveLog1(location_temp.ToString() + "路口已放行", "放行日志" + temp.Agv_ID.ToString(), "插件日志");
num2 = 0;
temp.Cross_Location_Go = location_temp;
int location_temp2 = location_temp;
}
}
Dictionary<int, int> leavedDic = Frm_A17168.leavedDic;
int num5 = temp.Agv_ID;
int num6 = leavedDic[num5];
leavedDic[num5] = num6 + 1;
}
else
{
bool flag50 = Enumerable.Contains<string>(Frm_A17168.businessCtrl.apiModel.leavedRfidList.Split(new char[]
{
','
}), location_temp.ToString());
if (flag50)
{
WriteTxt.SaveLog1("=========》(14):" + location_temp.ToString(), temp.Agv_ID.ToString() + "#Agv", "调试日志");
bool flag51 = Frm_A17168.businessCtrl == null;
if (flag51)
{
Frm_A17168.businessCtrl = new BusinessManage();
}
bool flag52 = Frm_A17168.leavedDic == null;
if (flag52)
{
Frm_A17168.leavedDic = new Dictionary<int, int>();
}
bool flag53 = !Frm_A17168.leavedDic.ContainsKey(temp.Agv_ID);
if (flag53)
{
Frm_A17168.leavedDic.Add(temp.Agv_ID, 0);
}
bool flag54 = false;
WriteTxt.SaveLog1(location_temp.ToString() + "开始请求释放", "放行日志" + temp.Agv_ID.ToString(), "插件日志");
bool flag55 = Frm_A17168.leavedDic[temp.Agv_ID] % Frm_A17168.businessCtrl.apiModel.requestSecond == 0;
if (flag55)
{
flag54 = Frm_A17168.businessCtrl.ByLeaved(temp.Agv_ID.ToString(), location_temp.ToString(), (location_temp - 1).ToString());
WriteTxt.SaveLog1(location_temp.ToString() + "离开释放返回的值" + flag54.ToString(), "放行日志" + temp.Agv_ID.ToString(), "插件日志");
}
bool flag56 = flag54;
if (flag56)
{
WriteTxt.SaveLog1("=========》(15):" + location_temp.ToString(), temp.Agv_ID.ToString() + "#Agv", "调试日志");
Frm_A17168.leavedDic[temp.Agv_ID] = 0;
temp.Cross_Location_Go = location_temp;
int location_temp2 = location_temp;
List<TrafficModel> autoLeavedDic2 = Frm_A17168.autoLeavedDic;
Predicate<TrafficModel> match2;
if ((match2 = <>9__2) == null)
{
match2 = (<>9__2 = ((TrafficModel _) => _.areaCode.Equals(location_temp.ToString())));
}
TrafficModel trafficModel2 = autoLeavedDic2.Find(match2);
bool flag57 = trafficModel2 != null;
if (flag57)
{
trafficModel2.agvId = 0;
}
WriteTxt.SaveLog1(location_temp.ToString() + "路口已归还", "放行日志" + temp.Agv_ID.ToString(), "插件日志");
}
Dictionary<int, int> leavedDic2 = Frm_A17168.leavedDic;
int num6 = temp.Agv_ID;
int num5 = leavedDic2[num6];
leavedDic2[num6] = num5 + 1;
}
else
{
int num4 = Crossing.BlockCross(temp.AssemblyLine, location_temp, temp.Agv_ID, mainfrm.ds_CrossInfo);
bool flag58 = num4 >= 0;
if (flag58)
{
bool flag59 = location_temp % 2 == 0;
if (flag59)
{
WriteTxt.SaveLog1("准备放行" + location_temp.ToString(), temp.Agv_ID.ToString() + "#Agv", "AGV");
bool flag60 = soc_Client.WriteInfo(1, 0, 0) == 0;
if (flag60)
{
num2 = 0;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "已放行", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
}
}
else
{
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "路口已复位", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
num2 = 0;
}
}
else
{
bool flag61 = num4 < 0;
if (flag61)
{
bool flag62 = num4 != num2;
if (flag62)
{
num2 = num4;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "AGV" + num4.ToString() + "占用路口", temp.Agv_ID, num3);
}
}
}
}
}
}
}
}
}
}
}
}
string sWarn = string.Concat(new string[]
{
Convert.ToString(array[11], 2).PadLeft(8, '0'),
Convert.ToString(array[10], 2).PadLeft(8, '0'),
Convert.ToString(array[9], 2).PadLeft(8, '0'),
Convert.ToString(array[8], 2).PadLeft(8, '0'),
Convert.ToString(array[7], 2).PadLeft(8, '0'),
Convert.ToString(array[6], 2).PadLeft(8, '0'),
Convert.ToString(array[5], 2).PadLeft(8, '0'),
Convert.ToString(array[4], 2).PadLeft(8, '0')
});
ThreadPool.QueueUserWorkItem(delegate(object o)
{
Thread.Sleep(100);
Cls_A17168.Warn_Deal(temp, sWarn);
});
}
}
}
else
{
bool bPlcLinked = temp.bPlcLinked;
if (bPlcLinked)
{
num++;
bool flag63 = num > 10;
if (flag63)
{
temp.Warn_ID = "0000000000000000000000000000000010000000000000000000000000000000";
temp.Warn_Level = 4;
temp.Warn_info = "网络异常";
num = 0;
temp.bPlcLinked = false;
soc_Client.CloseLinkPLC();
}
}
}
}
catch (Exception ex)
{
bool flag64 = ex.TargetSite.Name.ToString() == "ConnectAsync";
if (flag64)
{
temp.Warn_ID = "0000000000000000000000000000000010000000000000000000000000000000";
temp.Warn_Level = 4;
temp.Warn_info = "网络异常";
num = 0;
temp.bPlcLinked = false;
soc_Client.CloseLinkPLC();
}
bool bPlcLinked2 = temp.bPlcLinked;
if (bPlcLinked2)
{
num++;
bool flag65 = num > 10;
if (flag65)
{
temp.Warn_ID = "0000000000000000000000000000000010000000000000000000000000000000";
temp.Warn_Level = 4;
temp.Warn_info = "网络异常";
num = 0;
temp.bPlcLinked = false;
soc_Client.CloseLinkPLC();
}
}
Thread.Sleep(5000);
}
Thread.Sleep(1000);
}
}
}
}
// Token: 0x060002CA RID: 714 RVA: 0x000560C8 File Offset: 0x000542C8
public void AGV_Data_PLC(object agvinfo)
{
AgvInfo temp = (AgvInfo)agvinfo;
int location_temp = 0;
int[] array = new int[1];
int[] array2 = new int[1];
int num = 0;
int num2 = 0;
Ping ping = new Ping();
S7_200SocketClient s7_200SocketClient = new S7_200SocketClient(temp.IP, temp.Port);
temp.Soc = s7_200SocketClient.clientSocket;
string[] array3 = new string[]
{
"",
"",
"",
"",
"",
"",
"",
""
};
Cls_A17168.closedFlag = -1;
Predicate<TrafficModel> <>9__1;
Predicate<TrafficModel> <>9__2;
for (;;)
{
bool flag = !temp.Enable;
if (flag)
{
Thread.Sleep(3000);
}
else
{
bool flag2 = !Cls_A17168.startFlag;
if (flag2)
{
Thread.Sleep(500);
}
else
{
try
{
bool flag3 = ping.Send(temp.IP, 150).Status == IPStatus.Success;
if (flag3)
{
bool flag4 = !temp.bPlcLinked;
if (flag4)
{
bool flag5 = s7_200SocketClient.OpenLinkPLC();
if (flag5)
{
temp.bPlcLinked = true;
}
else
{
temp.bPlcLinked = false;
s7_200SocketClient.CloseLinkPLC();
s7_200SocketClient = new S7_200SocketClient(temp.IP, temp.Port);
temp.Soc = s7_200SocketClient.clientSocket;
num = 0;
}
}
else
{
array[0] = 0;
bool flag6 = s7_200SocketClient.ReadVW(2, 1, 104, out array) != 0;
if (flag6)
{
num--;
bool flag7 = Math.Abs(num) >= 5;
if (flag7)
{
temp.bPlcLinked = false;
num = 0;
s7_200SocketClient.CloseLinkPLC();
s7_200SocketClient = new S7_200SocketClient(temp.IP, temp.Port);
temp.Soc = s7_200SocketClient.clientSocket;
temp.Warn_ID = "0000000000000000000000000000000010000000000000000000000000000000";
temp.Warn_Level = 4;
temp.Warn_info = "网络异常";
string sql = string.Concat(new string[]
{
"INSERT INTO[Net_Log] ([dt],[AGV_ID],[Type]) VALUES('",
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
"', '",
temp.Agv_ID.ToString(),
"', 'Read Fail')"
});
Cls_A17168.bBllBase.ExecuteNonQuery(sql);
}
}
else
{
location_temp = Func.GetLandMarkId(temp.AssemblyLine, array[0]);
int num3 = array[0];
bool flag8 = temp.Location_Display != location_temp && location_temp != 0;
if (flag8)
{
WriteTxt.SaveLog1("AGV经过地标:" + location_temp.ToString(), temp.Agv_ID.ToString() + "#Agv", "地标日志");
temp.Location_Display = location_temp;
temp.Read_dt = DateTime.Now;
string item = string.Concat(new string[]
{
"INSERT INTO [Location_Log] ([Dt] ,[Agv_ID] ,[Loc_ID] ,[Value] ,[Loc_ID2] ,[Value2],[Value3]) VALUES ('",
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
"',",
temp.Agv_ID.ToString(),
",",
location_temp.ToString(),
",",
num3.ToString(),
",",
0.ToString(),
",",
0.ToString(),
",",
0.ToString(),
")"
});
UPDateDBList.sqlList.Add(item);
}
bool flag9 = Math.Abs(num) > 0;
if (flag9)
{
num = 0;
}
WriteTxt.SaveLog1("=========》(21):" + location_temp.ToString(), temp.Agv_ID.ToString() + "#Agv", "调试日志");
bool flag10 = temp.Cross_Location_Go != location_temp && num3 > 0 && num3 < 2000;
if (flag10)
{
bool flag11 = temp.AssemblyLine == 1 && temp.Location_Display == 152;
if (flag11)
{
bool flag12 = Cls_A17168.Agv_Land_Count(152) == 1;
if (flag12)
{
int num4 = Crossing.BlockCross(temp.AssemblyLine, location_temp, temp.Agv_ID, mainfrm.ds_CrossInfo);
bool flag13 = num4 >= 0;
if (flag13)
{
bool flag14 = s7_200SocketClient.WriteVW(2, 116, temp.Location_Display) == 0;
if (flag14)
{
num2 = 0;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "已放行", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
}
}
else
{
bool flag15 = num4 != num2;
if (flag15)
{
num2 = num4;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "AGV" + num4.ToString() + "占用路口", temp.Agv_ID, num3);
}
}
}
}
else
{
bool flag16 = temp.AssemblyLine == 3 && temp.Location_Display == 136;
if (flag16)
{
bool flag17 = Cls_A17168.Agv_Land_Count(136) == 1;
if (flag17)
{
int num4 = Crossing.BlockCross(temp.AssemblyLine, location_temp, temp.Agv_ID, mainfrm.ds_CrossInfo);
bool flag18 = num4 >= 0;
if (flag18)
{
bool flag19 = s7_200SocketClient.WriteVW(2, 116, temp.Location_Display) == 0;
if (flag19)
{
num2 = 0;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "已放行", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
}
}
else
{
bool flag20 = num4 != num2;
if (flag20)
{
num2 = num4;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "AGV" + num4.ToString() + "占用路口", temp.Agv_ID, num3);
}
}
}
}
else
{
bool flag21 = temp.AssemblyLine == 5 && Enumerable.Contains<int>(new int[]
{
106,
182,
196
}, location_temp);
if (flag21)
{
bool flag22 = (temp.Location_Display == 106 && Cls_A17168.Agv_Land_Count(106) == 1 && Cls_A17168.Agv_Land_Count(167) == 0) || (temp.Location_Display == 182 && Cls_A17168.Agv_Land_Count(182) == 1 && Cls_A17168.Agv_Land_Count(196) == 0) || (temp.Location_Display == 196 && Cls_A17168.Agv_Land_Count(196) == 1 && Cls_A17168.Agv_Land_Count(195) == 0);
if (flag22)
{
int num4 = Crossing.BlockCross(temp.AssemblyLine, location_temp, temp.Agv_ID, mainfrm.ds_CrossInfo);
bool flag23 = num4 >= 0;
if (flag23)
{
bool flag24 = s7_200SocketClient.WriteVW(2, 116, temp.Location_Display) == 0;
if (flag24)
{
num2 = 0;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "已放行", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
}
}
else
{
bool flag25 = num4 != num2;
if (flag25)
{
num2 = num4;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "AGV" + num4.ToString() + "占用路口", temp.Agv_ID, num3);
}
}
}
}
else
{
bool flag26 = temp.AssemblyLine == 6 && Enumerable.Contains<int>(new int[]
{
180
}, location_temp);
if (flag26)
{
bool flag27 = temp.Location_Display == 180 && Cls_A17168.Agv_Land_Count(180) == 1;
if (flag27)
{
int num4 = Crossing.BlockCross(temp.AssemblyLine, location_temp, temp.Agv_ID, mainfrm.ds_CrossInfo);
bool flag28 = num4 >= 0;
if (flag28)
{
bool flag29 = s7_200SocketClient.WriteVW(2, 116, temp.Location_Display) == 0;
if (flag29)
{
num2 = 0;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "已放行", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
}
}
else
{
bool flag30 = num4 != num2;
if (flag30)
{
num2 = num4;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "AGV" + num4.ToString() + "占用路口", temp.Agv_ID, num3);
}
}
}
}
else
{
bool flag31 = temp.AssemblyLine == 7 && Enumerable.Contains<int>(new int[]
{
500,
174,
156,
154,
216,
504
}, location_temp);
if (flag31)
{
bool flag32 = (temp.Location_Display == 500 && Cls_A17168.Agv_Land_Count(500) == 1) || (temp.Location_Display == 174 && Cls_A17168.Agv_Land_Count(174) == 1) || (temp.Location_Display == 154 && Cls_A17168.Agv_Land_Count(154) == 1 && Cls_A17168.Agv_Land_Count(156) == 0) || (temp.Location_Display == 156 && Cls_A17168.Agv_Land_Count(156) == 1) || (temp.Location_Display == 216 && Cls_A17168.Agv_Land_Count(216) == 1) || (temp.Location_Display == 504 && Cls_A17168.Agv_Land_Count(504) == 1);
if (flag32)
{
int num4 = Crossing.BlockCross(temp.AssemblyLine, location_temp, temp.Agv_ID, mainfrm.ds_CrossInfo);
bool flag33 = num4 >= 0;
if (flag33)
{
bool flag34 = s7_200SocketClient.WriteVW(2, 116, temp.Location_Display) == 0;
if (flag34)
{
num2 = 0;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "已放行", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
}
}
else
{
bool flag35 = num4 != num2;
if (flag35)
{
num2 = num4;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "AGV" + num4.ToString() + "占用路口", temp.Agv_ID, num3);
}
}
}
}
else
{
bool flag36 = Enumerable.Contains<int>(new int[]
{
316,
328,
332,
300,
314
}, location_temp);
if (flag36)
{
bool flag37 = (temp.Location_Display == 316 && Cls_A17168.GetAreaAGVNum(new int[]
{
316,
320
}) == 1) || (temp.Location_Display == 328 && Cls_A17168.GetAreaAGVNum(new int[]
{
328,
332
}) == 1) || (temp.Location_Display == 332 && Cls_A17168.GetAreaAGVNum(new int[]
{
332
}) == 1) || (temp.Location_Display == 300 && Cls_A17168.GetAreaAGVNum(new int[]
{
300
}) == 1) || (temp.Location_Display == 314 && Cls_A17168.GetAreaAGVNum(new int[]
{
314
}) == 1);
if (flag37)
{
int num4 = Crossing.BlockCross(temp.AssemblyLine, location_temp, temp.Agv_ID, mainfrm.ds_CrossInfo);
bool flag38 = num4 >= 0;
if (flag38)
{
bool flag39 = s7_200SocketClient.WriteVW(2, 116, temp.Location_Display) == 0;
if (flag39)
{
num2 = 0;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "已放行", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
}
}
else
{
bool flag40 = num4 != num2;
if (flag40)
{
num2 = num4;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "AGV" + num4.ToString() + "占用路口", temp.Agv_ID, num3);
}
}
}
}
else
{
bool flag41 = Enumerable.Contains<string>(Frm_A17168.businessCtrl.apiModel.waitRfidList.Split(new char[]
{
','
}), location_temp.ToString());
if (flag41)
{
WriteTxt.SaveLog1("=========》(22):" + location_temp.ToString(), temp.Agv_ID.ToString() + "#Agv", "调试日志");
bool flag42 = Frm_A17168.businessCtrl == null;
if (flag42)
{
Frm_A17168.businessCtrl = new BusinessManage();
}
bool flag43 = Frm_A17168.leavedDic == null;
if (flag43)
{
Frm_A17168.leavedDic = new Dictionary<int, int>();
}
bool flag44 = !Frm_A17168.leavedDic.ContainsKey(temp.Agv_ID);
if (flag44)
{
Frm_A17168.leavedDic.Add(temp.Agv_ID, 0);
}
bool flag45 = false;
WriteTxt.SaveLog1(location_temp.ToString() + "开始请求放行", "放行日志" + temp.Agv_ID.ToString(), "插件日志");
bool flag46 = Frm_A17168.leavedDic[temp.Agv_ID] % Frm_A17168.businessCtrl.apiModel.requestSecond == 0;
if (flag46)
{
flag45 = Frm_A17168.businessCtrl.RequestLeaved(temp.Agv_ID.ToString(), location_temp.ToString());
WriteTxt.SaveLog1(location_temp.ToString() + "请求离开返回的值" + flag45.ToString(), "放行日志" + temp.Agv_ID.ToString(), "插件日志");
}
bool flag47 = flag45;
if (flag47)
{
WriteTxt.SaveLog1("=========》(23):" + location_temp.ToString(), temp.Agv_ID.ToString() + "#Agv", "调试日志");
List<TrafficModel> autoLeavedDic = Frm_A17168.autoLeavedDic;
Predicate<TrafficModel> match;
if ((match = <>9__1) == null)
{
match = (<>9__1 = ((TrafficModel _) => _.areaCode.Equals(location_temp.ToString())));
}
TrafficModel trafficModel = autoLeavedDic.Find(match);
bool flag48 = trafficModel != null;
if (flag48)
{
trafficModel.agvId = temp.Agv_ID;
trafficModel.InArea = DateTime.Now;
}
WriteTxt.SaveLog1(string.Concat(new string[]
{
location_temp.ToString(),
"路口添加",
(trafficModel != null) ? trafficModel.areaCode : null,
"(",
trafficModel.agvId.ToString(),
")"
}), "放行日志" + temp.Agv_ID.ToString(), "插件日志");
bool flag49 = s7_200SocketClient.WriteVW(2, 116, temp.Location_Display) == 0;
if (flag49)
{
Frm_A17168.leavedDic[temp.Agv_ID] = 0;
WriteTxt.SaveLog1(location_temp.ToString() + "路口已放行", "放行日志" + temp.Agv_ID.ToString(), "插件日志");
num2 = 0;
temp.Cross_Location_Go = location_temp;
int location_temp2 = location_temp;
}
}
Dictionary<int, int> leavedDic = Frm_A17168.leavedDic;
int num5 = temp.Agv_ID;
int num6 = leavedDic[num5];
leavedDic[num5] = num6 + 1;
}
else
{
bool flag50 = Enumerable.Contains<string>(Frm_A17168.businessCtrl.apiModel.leavedRfidList.Split(new char[]
{
','
}), location_temp.ToString());
if (flag50)
{
WriteTxt.SaveLog1("=========》(24):" + location_temp.ToString(), temp.Agv_ID.ToString() + "#Agv", "调试日志");
bool flag51 = Frm_A17168.businessCtrl == null;
if (flag51)
{
Frm_A17168.businessCtrl = new BusinessManage();
}
bool flag52 = Frm_A17168.leavedDic == null;
if (flag52)
{
Frm_A17168.leavedDic = new Dictionary<int, int>();
}
bool flag53 = !Frm_A17168.leavedDic.ContainsKey(temp.Agv_ID);
if (flag53)
{
Frm_A17168.leavedDic.Add(temp.Agv_ID, 0);
}
bool flag54 = false;
WriteTxt.SaveLog1(location_temp.ToString() + "开始请求释放", "放行日志" + temp.Agv_ID.ToString(), "插件日志");
bool flag55 = Frm_A17168.leavedDic[temp.Agv_ID] % Frm_A17168.businessCtrl.apiModel.requestSecond == 0;
if (flag55)
{
flag54 = Frm_A17168.businessCtrl.ByLeaved(temp.Agv_ID.ToString(), location_temp.ToString(), (location_temp - 1).ToString());
WriteTxt.SaveLog1(location_temp.ToString() + "离开释放返回的值" + flag54.ToString(), "放行日志" + temp.Agv_ID.ToString(), "插件日志");
}
bool flag56 = flag54;
if (flag56)
{
WriteTxt.SaveLog1("=========》(25):" + location_temp.ToString(), temp.Agv_ID.ToString() + "#Agv", "调试日志");
Frm_A17168.leavedDic[temp.Agv_ID] = 0;
temp.Cross_Location_Go = location_temp;
int location_temp2 = location_temp;
List<TrafficModel> autoLeavedDic2 = Frm_A17168.autoLeavedDic;
Predicate<TrafficModel> match2;
if ((match2 = <>9__2) == null)
{
match2 = (<>9__2 = ((TrafficModel _) => _.areaCode.Equals(location_temp.ToString())));
}
TrafficModel trafficModel2 = autoLeavedDic2.Find(match2);
bool flag57 = trafficModel2 != null;
if (flag57)
{
trafficModel2.agvId = 0;
}
WriteTxt.SaveLog1(location_temp.ToString() + "路口已归还", "放行日志" + temp.Agv_ID.ToString(), "插件日志");
}
Dictionary<int, int> leavedDic2 = Frm_A17168.leavedDic;
int num6 = temp.Agv_ID;
int num5 = leavedDic2[num6];
leavedDic2[num6] = num5 + 1;
}
else
{
int num4 = Crossing.BlockCross(temp.AssemblyLine, location_temp, temp.Agv_ID, mainfrm.ds_CrossInfo);
bool flag58 = num4 >= 0;
if (flag58)
{
bool flag59 = location_temp % 2 == 0;
if (flag59)
{
WriteTxt.SaveLog1("准备放行" + location_temp.ToString(), temp.Agv_ID.ToString() + "#Agv", "AGV");
bool flag60 = s7_200SocketClient.WriteVW(2, 116, temp.Location_Display) == 0;
if (flag60)
{
num2 = 0;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "已放行", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
}
}
else
{
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "路口已复位", temp.Agv_ID, num3);
temp.Cross_Location_Go = location_temp;
num2 = 0;
}
}
else
{
bool flag61 = num4 < 0;
if (flag61)
{
bool flag62 = num4 != num2;
if (flag62)
{
num2 = num4;
Func.CrossInfo_Insert(temp.AssemblyName, temp.AssemblyLine.ToString(), temp.Internal_ID, location_temp, "AGV" + num4.ToString() + "占用路口", temp.Agv_ID, num3);
}
}
}
}
}
}
}
}
}
}
}
}
int[] array4 = new int[2];
s7_200SocketClient.ReadVW(2, 2, 3002, out array4);
string sWarn = (Convert.ToString(array4[0], 2).PadLeft(8, '0') + Convert.ToString(array4[1], 2).PadLeft(8, '0')).PadLeft(64, '0');
ThreadPool.QueueUserWorkItem(delegate(object o)
{
Thread.Sleep(100);
Cls_A17168.Warn_Deal_Plc(temp, sWarn);
});
}
}
}
else
{
bool bPlcLinked = temp.bPlcLinked;
if (bPlcLinked)
{
num--;
bool flag63 = Math.Abs(num) > 50;
if (flag63)
{
temp.Warn_ID = "0000000000000000000000000000000010000000000000000000000000000000";
temp.Warn_Level = 4;
temp.Warn_info = "网络异常";
num = 0;
temp.bPlcLinked = false;
s7_200SocketClient.CloseLinkPLC();
}
}
}
}
catch (Exception ex)
{
bool flag64 = ex.TargetSite.Name.ToString() == "ConnectAsync";
if (flag64)
{
temp.Warn_ID = "0000000000000000000000000000000010000000000000000000000000000000";
temp.Warn_Level = 4;
temp.Warn_info = "网络异常";
num = 0;
temp.bPlcLinked = false;
s7_200SocketClient.CloseLinkPLC();
s7_200SocketClient = new S7_200SocketClient(temp.IP, temp.Port);
temp.Soc = s7_200SocketClient.clientSocket;
}
bool bPlcLinked2 = temp.bPlcLinked;
if (bPlcLinked2)
{
num--;
bool flag65 = Math.Abs(num) > 50;
if (flag65)
{
temp.Warn_ID = "0000000000000000000000000000000010000000000000000000000000000000";
temp.Warn_Level = 4;
temp.Warn_info = "网络异常";
num = 0;
temp.bPlcLinked = false;
s7_200SocketClient.CloseLinkPLC();
}
}
Thread.Sleep(3000);
}
Thread.Sleep(800);
}
}
}
}
}
}
}