Commit 0376e1f0 LN

agv对接修改

1 个父辈 50b094c8
...@@ -34,5 +34,7 @@ namespace OnlineStore.Common ...@@ -34,5 +34,7 @@ namespace OnlineStore.Common
public static string AgvServerIp = "AgvServerIp"; public static string AgvServerIp = "AgvServerIp";
public static string Agv_Log_Open = "Agv_Log_Open";
} }
} }
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using Asa; using Asa;
using Asa.RFID; using Asa.RFID;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -47,25 +48,58 @@ namespace OnlineStore.DeviceLibrary ...@@ -47,25 +48,58 @@ namespace OnlineStore.DeviceLibrary
private static void AgvClient_Ready(string id, byte[] content) private static void AgvClient_Ready(string id, byte[] content)
{ {
UpdateAction(id, AGVAction.Ready);
RFIDData data = new RFIDData(content); RFIDData data = new RFIDData(content);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] 未找到对应的设备 "); LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] ");
MayEnter("C2");
if (id.Equals(LineManager.Config.OutL_AgvName))
{
// MayEnter("C2");
if (IOManager.IOValue(IO_Type.OutL_InCheck).Equals(IO_VALUE.LOW))
{
agvClient.MayEnter(id);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] 调用 MayEnter ");
}
} }
else if (id.Equals(LineManager.Config.InL_AgvName))
{
if (IOManager.IOValue(IO_Type.InL_OutStopCheck).Equals(IO_VALUE.HIGH))
{
LineManager.VMILine.StopIOMove(IO_Type.InL_OutStopDown);
agvClient.MayLeave(id);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] 调用 MayLeave ");
}
}
}
private static void AgvClient_CanEnter(string id, byte[] content) private static void AgvClient_CanEnter(string id, byte[] content)
{ {
UpdateAction(id, AGVAction.CanEnter);
RFIDData data = new RFIDData(content); RFIDData data = new RFIDData(content);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] 未找到对应的设备 "); LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] ");
if (id.Equals(LineManager.Config.OutL_AgvName))
{
bool result = IOManager.IOValue(IO_Type.OutL_InCheck).Equals(IO_VALUE.LOW);
if (IOManager.IOValue(IO_Type.OutL_InCheck).Equals(IO_VALUE.LOW))
{
agvClient.IsEnter(id);
}
}
else if (id.Equals(LineManager.Config.InL_AgvName))
{
} }
}
private static void AgvClient_Arrive(string id, byte[] content) private static void AgvClient_Arrive(string id, byte[] content)
{ {
UpdateAction(id, AGVAction.Arrive);
RFIDData data = new RFIDData(content); RFIDData data = new RFIDData(content);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] 未找到对应的设备 "); LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] ");
} }
...@@ -114,8 +148,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -114,8 +148,19 @@ namespace OnlineStore.DeviceLibrary
} }
private static void AgvClient_Log(string s) private static void AgvClient_Log(string s)
{ {
try
{
bool isLog = ConfigAppSettings.GetIntValue(Setting_Init.Agv_Log_Open).Equals(1);
if (isLog)
{
LogUtil.info(" AGV " + ServerIp + " Log : " + s); LogUtil.info(" AGV " + ServerIp + " Log : " + s);
} }
}
catch (Exception ex)
{
LogUtil.error("AgvClient_Log 出错:" + ex.ToString());
}
}
public static string GetAction(string NodeName) public static string GetAction(string NodeName)
{ {
...@@ -125,6 +170,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -125,6 +170,17 @@ namespace OnlineStore.DeviceLibrary
} }
return AGVAction.None; return AGVAction.None;
} }
public static void UpdateAction(string name, string action)
{
if (actionMap.ContainsKey(name))
{
actionMap[name] = action;
}
else
{
actionMap.Add(name, action);
}
}
public static void Dispose() public static void Dispose()
{ {
try try
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<!--是否调试状态--> <!--是否调试状态-->
<add key="IsInDebug" value="1" /> <add key="IsInDebug" value="1" />
<add key ="Agv_Log_Open" value ="1"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!