Commit e45fc0ce LN

agvClint修改

1 个父辈 dec60dc4
此文件类型无法预览
......@@ -53,6 +53,7 @@
<add key ="DebugDeviceId" value ="301"/>
<add key ="NeedScanCode" value ="1"/>
<add key ="Server_Log_Open" value ="0"/>
<add key ="Agv_Log_Open" value ="1"/>
<add key ="CodeCount" value ="1"/>
<add key ="DefaultTrayNum" value ="9"/>
</appSettings>
......
......@@ -55,9 +55,6 @@
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<Reference Include="Client">
<HintPath>..\..\..\RC1250-ACPackingStore\dll\Client.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
......
......@@ -11,6 +11,7 @@ namespace OnlineStore.Common
/// </summary>
public class Setting_Init
{
public static string Agv_Log_Open = "Agv_Log_Open";
public static string Server_Log_Open = "Server_Log_Open";
/// <summary>
/// 系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要
......
......@@ -39,7 +39,7 @@
<Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference>
<Reference Include="Client, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Client, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\Client.dll</HintPath>
</Reference>
......
......@@ -44,11 +44,14 @@ namespace OnlineStore.DeviceLibrary
private static void AgvClient_Ready(string id, byte[] content)
{
FeedingEquip equip = getFeedEquip(id);
UpdateAction(id, AGVAction.Ready);
RFIDData data = new RFIDData(content);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] ");
FeedingEquip equip = getFeedEquip(id);
if (equip == null)
{
LogUtil.info("收到 AgvClient_Ready ["+id+"] ["+data.ToData()+"] 未找到对应的设备 ");
LogUtil.error ("收到 AgvClient_Ready ["+id+"] ["+data.ToData()+"] 未找到对应的设备 ,暂不处理");
return;
}
equip.AgvReady(id,data);
......@@ -56,23 +59,42 @@ namespace OnlineStore.DeviceLibrary
private static void AgvClient_CanEnter(string id, byte[] content)
{
FeedingEquip equip = getFeedEquip(id);
UpdateAction(id, AGVAction.CanEnter);
RFIDData data = new RFIDData(content);
LogUtil.info("收到 AgvClient_CanEnter [" + id + "] [" + data.ToData() + "] ");
FeedingEquip equip = getFeedEquip(id);
if (equip == null)
{
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] 未找到对应的设备 ");
string okName = "";
foreach(FeedingEquip feed in LineManager.Line.FeedingEquipMap.Values)
{
if (id.Contains(feed.Config.AgvInName))
{
if (feed.AgvCanEnter(id, data))
{
okName += feed.Config.AgvInName;
}
}
}
agvClient.IsEnter(okName);
return;
}
equip.AgvCanEnter(id, data);
else
{
bool result = equip.AgvCanEnter(id, data);
agvClient.IsEnter(equip.Config.AgvInName);
}
}
private static void AgvClient_Arrive(string id, byte[] content)
{
FeedingEquip equip = getFeedEquip(id);
UpdateAction(id, AGVAction.Arrive );
RFIDData data = new RFIDData(content);
LogUtil.info("收到 AgvClient_Arrive [" + id + "] [" + data.ToData() + "] ");
FeedingEquip equip = getFeedEquip(id);
if (equip == null)
{
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] 未找到对应的设备 ");
LogUtil.error("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] 未找到对应的设备 ,暂不处理 ");
return;
}
equip.AgvArrive(id, data);
......@@ -124,14 +146,21 @@ namespace OnlineStore.DeviceLibrary
{
agvClient.MayLeave(NodeName);
}
internal static void IsEnter(string NodeName,bool result)
{
agvClient.IsEnter(NodeName, result);
}
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);
}
}catch(Exception ex)
{
LogUtil.error("AgvClient_Log 出错:" + ex.ToString());
}
}
public static string GetAction(string NodeName)
{
......@@ -141,6 +170,17 @@ namespace OnlineStore.DeviceLibrary
}
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()
{
try
......
......@@ -569,17 +569,24 @@ namespace OnlineStore.DeviceLibrary
#endregion
#region AGV
internal void AgvCanEnter(string nodeId, RFIDData data)
internal bool AgvCanEnter(string nodeId, RFIDData data)
{
string logN = Name + "收到 AgvCanEnter 事件 [" + nodeId + "] [" + data.ToData() + "] ";
bool usable = false;
if (nodeId.Equals(Config.AgvInName))
{
if (isInSuddenDown || isNoAirCheck)
{
usable = false;
}
else
{
//入料口无料架即可进入
usable = (runStatus >= LineRunStatus.Runing
&& ProcessShelfEnter.Equals(false)
&& IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.LOW));
}
}
else if (nodeId.Equals(Config.AgvOutName))
{
//出口有料架才可以进入
......@@ -588,7 +595,7 @@ namespace OnlineStore.DeviceLibrary
&& IOValue(IO_Type.SL_Out_Check).Equals(IO_VALUE.HIGH));
}
LogUtil.info(logN + ":" + usable);
AgvClient.IsEnter(nodeId, usable);
return usable;
}
internal void AgvArrive(string nodeId, RFIDData data)
......@@ -652,7 +659,7 @@ namespace OnlineStore.DeviceLibrary
//{
// return AgvClient.GetAction(Config.AgvOutName).Equals(AGVAction.);
//}, "等待AGV收到料架");
AgvClient.MayLeave(Config.AgvOutName);
// AgvClient.MayLeave(Config.AgvOutName);
//停止转动 ,阻挡上升
IOMove(IO_Type.SL_OutLine_Run, IO_VALUE.LOW);
IOMove(IO_Type.SL_Out_StopDown, IO_VALUE.LOW);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!