Commit f0bd4276 LN

料架RFID读取不到时,自动重启再重新读取一次

1 个父辈 80c3d0b8
此文件类型无法预览
...@@ -55,9 +55,6 @@ ...@@ -55,9 +55,6 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup /> <PropertyGroup />
<ItemGroup> <ItemGroup>
<Reference Include="Asa.RFID">
<HintPath>..\..\dll\RFID\Asa.RFID.dll</HintPath>
</Reference>
<Reference Include="Client"> <Reference Include="Client">
<HintPath>..\..\dll\Client.dll</HintPath> <HintPath>..\..\dll\Client.dll</HintPath>
</Reference> </Reference>
......
...@@ -779,6 +779,17 @@ namespace OnlineStore.AssemblyLine ...@@ -779,6 +779,17 @@ namespace OnlineStore.AssemblyLine
} }
} }
private void btnResetRFID_Click(object sender, EventArgs e)
{
string ip = RFIDManager.GetRFIP(equipBean.DeviceID, 1);
LogUtil.info(equipBean.Name+ " 手动 ResetRFID [" + ip + "] ");
string msg = "";
bool result = RFIDManager.ResetRFID(ip, out msg);
if (!result)
{
LogUtil.error(Name + "手动 ResetRFID [" + ip + "], 失败:" + msg);
}
}
} }
} }
......
using Asa.RFID; using OnlineStore.DeviceLibrary;
using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
......
...@@ -39,9 +39,6 @@ ...@@ -39,9 +39,6 @@
<Reference Include="Asa.Camera.VisionLib"> <Reference Include="Asa.Camera.VisionLib">
<HintPath>..\..\dll\Asa.Camera.VisionLib.dll</HintPath> <HintPath>..\..\dll\Asa.Camera.VisionLib.dll</HintPath>
</Reference> </Reference>
<Reference Include="Asa.RFID.ReadAll">
<HintPath>..\..\dll\RFID\Asa.RFID.ReadAll.dll</HintPath>
</Reference>
<Reference Include="Client, Version=1.0.0.1, 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>
...@@ -61,6 +58,9 @@ ...@@ -61,6 +58,9 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath> <HintPath>..\..\dll\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="RFID.ReadAll">
<HintPath>..\..\dll\RFID\RFID.ReadAll.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
......
...@@ -787,10 +787,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -787,10 +787,22 @@ namespace OnlineStore.DeviceLibrary
if (CurrShelfId.EndsWith("00")) if (CurrShelfId.EndsWith("00"))
{ {
MoveInfo.NextMoveStep(LineMoveStep.FI_53_BatchAxisToP1);
InLog("料架号【" + CurrShelfId + "】无效,送出料架," + MoveInfo.SLog + ":提升伺服到P1点,定位气缸下降"); MoveInfo.NextMoveStep(LineMoveStep.FI_041_ResetRFID);
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP1, Config.BatchAxis_P1Speed); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));
CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Up, IO_Type.SL_LocationCylinder_Down); string ip = RFIDManager.GetRFIP(DeviceID, 1);
InLog("料架号【" + CurrShelfId + "】无效,ResetRFID[" + ip + "], 等待30秒后重新读取");
string msg = "";
bool result=RFIDManager.ResetRFID(ip, out msg);
if (!result)
{
LogUtil.error(Name+ "料架号【" + CurrShelfId + "】无效,ResetRFID[" + ip + "], 失败:"+msg);
}
//MoveInfo.NextMoveStep(LineMoveStep.FI_53_BatchAxisToP1);
//InLog("料架号【" + CurrShelfId + "】无效,送出料架," + MoveInfo.SLog + ":提升伺服到P1点,定位气缸下降");
//BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP1, Config.BatchAxis_P1Speed);
//CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Up, IO_Type.SL_LocationCylinder_Down);
} }
else else
{ {
...@@ -808,7 +820,35 @@ namespace OnlineStore.DeviceLibrary ...@@ -808,7 +820,35 @@ namespace OnlineStore.DeviceLibrary
InLog(" 未检测到料架,入料结束"); InLog(" 未检测到料架,入料结束");
} }
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_041_ResetRFID))
{
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH))
{
ReadShelfId();
if (CurrShelfId.EndsWith("00"))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_53_BatchAxisToP1);
InLog("ResetRFID 后,料架号【" + CurrShelfId + "】无效,送出料架," + MoveInfo.SLog + ":提升伺服到P1点,定位气缸下降");
BatchAxis.AbsMove(MoveInfo, Config.BatchAxisP1, Config.BatchAxis_P1Speed);
CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Up, IO_Type.SL_LocationCylinder_Down);
}
else
{
MoveInfo.ShelfNoTray = false;
//定位工位有料架,直接开始入料
MoveInfo.NextMoveStep(LineMoveStep.FI_05_LocationCylinder_Up);
InLog("定位工位检测到料架: " + MoveInfo.SLog + " 缓冲阻挡上升, 定位气缸上升,ResetRFID 后,读取并缓存料架RFID" + CurrShelfId);
UpdateLastShelfID(CurrShelfId);
CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Down, IO_Type.SL_LocationCylinder_Up);
}
}
else
{
MoveEndS();
InLog(" ResetRFID 后,未检测到料架,入料结束");
}
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_05_LocationCylinder_Up)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_05_LocationCylinder_Up))
{ {
MoveInfo.NextMoveStep(LineMoveStep.FI_06_BatchAxisToP2); MoveInfo.NextMoveStep(LineMoveStep.FI_06_BatchAxisToP2);
......
...@@ -311,7 +311,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -311,7 +311,17 @@ namespace OnlineStore.DeviceLibrary
ReadShelfId(); ReadShelfId();
if (CurrShelfId.EndsWith("00")) if (CurrShelfId.EndsWith("00"))
{ {
SendOutShelfOut("料架号【" + CurrShelfId + "】无效"); //SendOutShelfOut("料架号【" + CurrShelfId + "】无效");
MoveInfo.NextMoveStep(LineMoveStep.FO_041_ResetRFID);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));
string ip = RFIDManager.GetRFIP(DeviceID, 1);
OutLog("料架号【" + CurrShelfId + "】无效,ResetRFID[" + ip + "], 等待30秒后重新读取");
string msg = "";
bool result = RFIDManager.ResetRFID(ip, out msg);
if (!result)
{
LogUtil.error(Name + "料架号【" + CurrShelfId + "】无效,ResetRFID[" + ip + "], 失败:" + msg);
}
return; return;
} }
...@@ -347,6 +357,50 @@ namespace OnlineStore.DeviceLibrary ...@@ -347,6 +357,50 @@ namespace OnlineStore.DeviceLibrary
MoveEndS(); MoveEndS();
OutLog(" 未检测到料架,料架处理结束"); OutLog(" 未检测到料架,料架处理结束");
} }
}else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_041_ResetRFID))
{
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.HIGH))
{
ReadShelfId();
if (CurrShelfId.EndsWith("00"))
{
SendOutShelfOut("ResetRFID后,料架号【" + CurrShelfId + "】无效");
return;
}
//判断是否是第一次获取料架,需要从服务器获取此料架的虚拟料架号,若无虚拟料架号,料架可以用
//有虚拟料架号,从服务器获取此料架剩余任务,若无任务,需要送出料架
if (LastOutParam.rfid.Equals("") && NeedCheckShelf)
{
//只有启动后第一个料架才需要验证
NeedCheckShelf = false;
string tempRfid = "";
string msg = SServerManager.findTempRfid(Name, CurrShelfId, out tempRfid);
if (!String.IsNullOrEmpty(msg))
{
LogUtil.error(Name + "ResetRFID后, findTempRfid 【" + CurrShelfId + "】【" + tempRfid + "】结果:" + msg);
}
if (!String.IsNullOrEmpty(tempRfid))
{
//如果虚拟料架号存在,直接送出料架
SendOutShelfOut("ResetRFID后,料架【" + CurrShelfId + "】【" + tempRfid + "】已绑定,不再使用");
return;
}
}
//定位工位有料架,直接开始入料
MoveInfo.NextMoveStep(LineMoveStep.FO_05_LocationUp);
OutLog("定位工位检测到料架:ResetRFID后, " + MoveInfo.SLog + " 缓冲阻挡下降, 定位气缸上升,读取并缓存料架RFID");
UpdateLastShelfID(CurrShelfId);
CylinderMove(MoveInfo, IO_Type.SL_LocationCylinder_Down, IO_Type.SL_LocationCylinder_Up);
}
else
{
MoveEndS();
OutLog("ResetRFID后, 未检测到料架,料架处理结束");
}
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_05_LocationUp)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_05_LocationUp))
{ {
......
 
using Asa.RFID; using RFID;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
...@@ -16,8 +16,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -16,8 +16,8 @@ namespace OnlineStore.DeviceLibrary
public class RFIDManager public class RFIDManager
{ {
public static int DefaultTrayNum = ConfigAppSettings.GetIntValue(Setting_Init.DefaultTrayNum); public static int DefaultTrayNum = ConfigAppSettings.GetIntValue(Setting_Init.DefaultTrayNum);
private static Asa.RFID.ReadAll readHao; private static RFID.ReadAll readHao;
private static Asa.RFID.ReadAll readPu; private static RFID.ReadAll readPu;
private static bool IsOpen = false; private static bool IsOpen = false;
private static ConcurrentDictionary<string, List<RfidCacheInfo>> LastRfidMap = new ConcurrentDictionary<string, List<RfidCacheInfo>>(); private static ConcurrentDictionary<string, List<RfidCacheInfo>> LastRfidMap = new ConcurrentDictionary<string, List<RfidCacheInfo>>();
public static void Open() public static void Open()
...@@ -34,10 +34,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -34,10 +34,10 @@ namespace OnlineStore.DeviceLibrary
port = 13000; port = 13000;
} }
LogUtil.info($"RFID Server Open,HaoBin port={port},PuYue port={port+1}"); LogUtil.info($"RFID Server Open,HaoBin port={port},PuYue port={port+1}");
readHao = new Asa.RFID.ReadAll("TheRFID") { Type = Asa.RFID.DeviceType.HaoBin }; readHao = new RFID.ReadAll("TheRFID") { Type = RFID.DeviceType.HaoBin };
readHao.Received += ReadAll_Received; readHao.Received += ReadAll_Received;
readHao.Start(port); readHao.Start(port);
readPu = new Asa.RFID.ReadAll("TheRFID") { Type = Asa.RFID.DeviceType.PuYue }; readPu = new RFID.ReadAll("TheRFID") { Type = RFID.DeviceType.PuYue };
readPu.Received += ReadAll_Received; readPu.Received += ReadAll_Received;
readPu.Start(port+1); readPu.Start(port+1);
IsOpen = true; IsOpen = true;
...@@ -292,6 +292,37 @@ namespace OnlineStore.DeviceLibrary ...@@ -292,6 +292,37 @@ namespace OnlineStore.DeviceLibrary
return new RFIDData(); return new RFIDData();
} }
public static bool ResetRFID(string ip, out string msg)
{
try
{
if (String.IsNullOrEmpty(ip))
{
msg = "RFID IP 为空";
return false;
}
bool result = readPu.Reset(ip, out msg);
if (result)
{
LogUtil.info("readPu ResetRFID [" + ip + "] 成功");
return true;
}
readHao.Reset(ip, out msg);
if (result)
{
LogUtil.info("readHao ResetRFID [" + ip + "] 成功");
return true;
}
}
catch (Exception ex)
{
msg = "ResetRFID[" + ip + "] 出错:" + ex.ToString();
LogUtil.error("ResetRFID[" + ip + "] 出错:" + ex.ToString());
}
return false;
}
public static void Close() public static void Close()
{ {
try try
......
...@@ -726,6 +726,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -726,6 +726,12 @@ namespace OnlineStore.DeviceLibrary
[Description("入料_定位工位有料架,进料阻挡上升,缓冲阻挡上升, 等待3秒再次检测")] [Description("入料_定位工位有料架,进料阻挡上升,缓冲阻挡上升, 等待3秒再次检测")]
FI_04_WaitTime , FI_04_WaitTime ,
/// <summary>
/// 入口流水线转动,定位工位有料架,未读到料架号,重启RFID后再次尝试
/// </summary>
[Description("入料_定位工位有料架,未读到料架号,重启RFID后再次尝试")]
FI_041_ResetRFID,
/// <summary> /// <summary>
///入料检测: 工位检测信号,缓冲阻挡上升, 定位气缸上升,读取并缓存料架RFID ///入料检测: 工位检测信号,缓冲阻挡上升, 定位气缸上升,读取并缓存料架RFID
...@@ -973,6 +979,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -973,6 +979,11 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
[Description("出料_料串准备_定位工位检测到料架:进料阻挡上升, 等待3秒再次检测")] [Description("出料_料串准备_定位工位检测到料架:进料阻挡上升, 等待3秒再次检测")]
FO_04_WaitTime , FO_04_WaitTime ,
/// <summary>
/// 定位工位检测到料架,读取RFID失败,重启RFID再读一次
/// </summary>
[Description("出料_料串准备_读取RFID失败,重启RFID再读一次")]
FO_041_ResetRFID,
/// <summary> /// <summary>
///出料检测: 缓冲阻挡下降, 定位气缸上升,读取并缓存料架RFID ///出料检测: 缓冲阻挡下降, 定位气缸上升,读取并缓存料架RFID
...@@ -1010,7 +1021,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1010,7 +1021,7 @@ namespace OnlineStore.DeviceLibrary
/// 紧急出料移栽:上料轴下降指定的高度 /// 紧急出料移栽:上料轴下降指定的高度
/// </summary> /// </summary>
[Description("出料_上料轴下降指定的高度")] [Description("出料_上料轴下降指定的高度")]
FO_211_AxisDownMove = 2211, FO_211_AxisDownMove ,
/// <summary> /// <summary>
/// 紧急出料移栽:上料横移机构到取料端 /// 紧急出料移栽:上料横移机构到取料端
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!