Commit e45fc0ce LN

agvClint修改

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