Commit 4ea334ca LN

1

1 个父辈 a35fbfd3
...@@ -43,7 +43,7 @@ namespace OnlineStore.AssemblyLine ...@@ -43,7 +43,7 @@ namespace OnlineStore.AssemblyLine
List<string> rfidList = new List<string>(LineManager.Line. rfidList); List<string> rfidList = new List<string>(LineManager.Line. rfidList);
foreach (string ip in rfidList) foreach (string ip in rfidList)
{ {
string con = TrayManager.ReadRFID(ip) .ToStr() ; string con = RFIDManager.ReadRFID(ip) .ToStr() ;
msg += ("RFID[" + ip + "]:").PadLeft(26, ' ') + con + "\n"; msg += ("RFID[" + ip + "]:").PadLeft(26, ' ') + con + "\n";
} }
lblRFID.Text += msg; lblRFID.Text += msg;
......
...@@ -260,7 +260,7 @@ namespace OnlineStore.AssemblyLine ...@@ -260,7 +260,7 @@ namespace OnlineStore.AssemblyLine
//AIManager.CloseConnect(); //AIManager.CloseConnect();
ACServerManager.CloseAllPort(); ACServerManager.CloseAllPort();
// CodeManager.CloseAllCamera(); // CodeManager.CloseAllCamera();
TrayManager.RfidReader.Close(); RFIDManager.RfidReader.Close();
//this.Close(); //this.Close();
System.Environment.Exit(System.Environment.ExitCode); System.Environment.Exit(System.Environment.ExitCode);
} }
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
<Compile Include="assemblyLine\FeedingEquip_InStore.cs" /> <Compile Include="assemblyLine\FeedingEquip_InStore.cs" />
<Compile Include="assemblyLine\ProvidingEquip.cs" /> <Compile Include="assemblyLine\ProvidingEquip.cs" />
<Compile Include="assemblyLine\FeedingEquip.cs" /> <Compile Include="assemblyLine\FeedingEquip.cs" />
<Compile Include="assemblymanager\RFIDManagercs.cs" />
<Compile Include="assemblymanager\StoreServerManager.cs" /> <Compile Include="assemblymanager\StoreServerManager.cs" />
<Compile Include="assemblymanager\TrayManager.cs" /> <Compile Include="assemblymanager\TrayManager.cs" />
<Compile Include="baan\AxisBean.cs" /> <Compile Include="baan\AxisBean.cs" />
......
...@@ -267,7 +267,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -267,7 +267,7 @@ namespace OnlineStore.DeviceLibrary
{ {
//此处先对托盘号进行验证 //此处先对托盘号进行验证
preTrayNum = currTrayNum; preTrayNum = currTrayNum;
currTrayNum = TrayManager.GetTrayNum(DeviceID, true); currTrayNum = RFIDManager.GetTrayNum(DeviceID, true);
return true; return true;
} }
......
...@@ -665,7 +665,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -665,7 +665,7 @@ namespace OnlineStore.DeviceLibrary
internal void ShelfEnterProcess() internal void ShelfEnterProcess()
{ {
//判断料架的编码是否正确 //判断料架的编码是否正确
RFIDData data = TrayManager.GetShelfData(DeviceID); RFIDData data = RFIDManager.GetShelfData(DeviceID);
if (data.Num <= 0) if (data.Num <= 0)
{ {
MoveInfo.EndMove(); MoveInfo.EndMove();
......
...@@ -71,8 +71,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -71,8 +71,7 @@ namespace OnlineStore.DeviceLibrary
//判断是否是需要的托盘 //判断是否是需要的托盘
if (CurrTrayIsNeed(currTrayNum, true)) if (CurrTrayIsNeed(currTrayNum, true))
{ {
SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam); SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam);
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopCylinderUp); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopCylinderUp);
CheckLog("检测到SW_TrayCheck:" + SecondMoveInfo.SLog + "横移顶升气缸上升 )"); CheckLog("检测到SW_TrayCheck:" + SecondMoveInfo.SLog + "横移顶升气缸上升 )");
CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up); CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up);
...@@ -221,8 +220,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -221,8 +220,7 @@ namespace OnlineStore.DeviceLibrary
CylinderMove(SecondMoveInfo, IO_Type.FL_TopCylinder_Down, IO_Type.FL_TopCylinder_Up); CylinderMove(SecondMoveInfo, IO_Type.FL_TopCylinder_Down, IO_Type.FL_TopCylinder_Up);
} }
else else
{ {
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
CheckLog("托盘检测:" + SecondMoveInfo.SLog + " 需要此托盘,横移顶升气缸上 升 )"); CheckLog("托盘检测:" + SecondMoveInfo.SLog + " 需要此托盘,横移顶升气缸上 升 )");
CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up); CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up);
} }
...@@ -380,8 +378,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -380,8 +378,7 @@ namespace OnlineStore.DeviceLibrary
private void SMoveEnd() private void SMoveEnd()
{ {
lastStopDown = DateTime.Now.AddSeconds(-2); lastStopDown = DateTime.Now.AddSeconds(-2);
TrayManager.UpdateSWState(Config.SidesWayNum, 1);
SecondMoveInfo.EndMove(); SecondMoveInfo.EndMove();
this.TrayPEndEvent?.Invoke(Config.SidesWayNum, currTrayNum); this.TrayPEndEvent?.Invoke(Config.SidesWayNum, currTrayNum);
} }
......
...@@ -18,8 +18,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -18,8 +18,7 @@ namespace OnlineStore.DeviceLibrary
currTrayNum = trayNum; currTrayNum = trayNum;
if (CurrTrayIsNeed(currTrayNum, true)) if (CurrTrayIsNeed(currTrayNum, true))
{ {
SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam); SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam);
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopCylinderUp); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopCylinderUp);
CheckLog("检测到SW_TrayCheck:" + SecondMoveInfo.SLog + "横移顶升气缸上升 )"); CheckLog("检测到SW_TrayCheck:" + SecondMoveInfo.SLog + "横移顶升气缸上升 )");
CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up); CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up);
...@@ -27,8 +26,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -27,8 +26,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
// currTrayNum = num; // currTrayNum = num;
TrayManager.UpdateSWState(Config.SidesWayNum, 1);
return false; return false;
} }
} }
......
...@@ -127,8 +127,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -127,8 +127,14 @@ namespace OnlineStore.DeviceLibrary
rfidList = new List<string>(); rfidList = new List<string>();
if (IsDebug) if (IsDebug)
{ {
//rfidList = new List<string>() {
// "192.168.210.116","192.168.210.120","192.168.210.121"
//};
rfidList = new List<string>() { rfidList = new List<string>() {
"192.168.210.116","192.168.210.120","192.168.210.121" RFIDManager.GetRFIP(103),
RFIDManager.GetRFIP(11),
RFIDManager.GetRFIP(12),
}; };
try try
{ {
...@@ -190,8 +196,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -190,8 +196,8 @@ namespace OnlineStore.DeviceLibrary
Task.Factory.StartNew(delegate Task.Factory.StartNew(delegate
{ {
string[] rfidArray = rfidList.ToArray(); string[] rfidArray = rfidList.ToArray();
//连接rfip //连接rfip
TrayManager.RfidReader.Open(rfidArray); RFIDManager.RfidReader.Open(rfidArray);
}); });
//} //}
addLastDI(IO_Type.Airpressure_Check, IOValue(IO_Type.Airpressure_Check)); addLastDI(IO_Type.Airpressure_Check, IOValue(IO_Type.Airpressure_Check));
......
...@@ -5,6 +5,7 @@ using System.Collections.Generic; ...@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
...@@ -435,11 +436,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -435,11 +436,7 @@ namespace OnlineStore.DeviceLibrary
private void SideWayStop() private void SideWayStop()
{ {
sw23WaitWatch.Stop(); sw23WaitWatch.Stop();
sw41WaitWatch.Stop(); sw41WaitWatch.Stop();
TrayManager.UpdateSWState(4, 0);
TrayManager.UpdateSWState(1, 0);
TrayManager.UpdateSWState(2, 0);
TrayManager.UpdateSWState(3, 0);
SW41_MoveInfo.EndMove(); SW41_MoveInfo.EndMove();
SW23_MoveInfo.EndMove(); SW23_MoveInfo.EndMove();
...@@ -596,7 +593,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -596,7 +593,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
Sw41TrayNum = TrayManager.GetTrayNum(204, true); Sw41TrayNum = RFIDManager.GetTrayNum(204, true);
} }
} }
} }
...@@ -612,7 +609,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -612,7 +609,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
Sw23TrayNum = TrayManager.GetTrayNum(103, true); Sw23TrayNum = RFIDManager.GetTrayNum(103, true);
} }
} }
} }
...@@ -647,6 +644,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -647,6 +644,7 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.SW4_StopDown, IO_VALUE.LOW); IOMove(IO_Type.SW4_StopDown, IO_VALUE.LOW);
SW41_MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); SW41_MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
CylinderMove(SW41_MoveInfo, IO_Type.SW4_TopCylinder_Down, IO_Type.SW4_TopCylinder_Up); CylinderMove(SW41_MoveInfo, IO_Type.SW4_TopCylinder_Down, IO_Type.SW4_TopCylinder_Up);
Thread.Sleep(50);
CylinderMove(SW41_MoveInfo, IO_Type.SW1_TopCylinder_Down, IO_Type.SW1_TopCylinder_Up); CylinderMove(SW41_MoveInfo, IO_Type.SW1_TopCylinder_Down, IO_Type.SW1_TopCylinder_Up);
} }
else if (SW41_MoveInfo.MoveStep.Equals(LineMoveStep.SW03_TopCylinderUp)) else if (SW41_MoveInfo.MoveStep.Equals(LineMoveStep.SW03_TopCylinderUp))
...@@ -679,6 +677,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -679,6 +677,7 @@ namespace OnlineStore.DeviceLibrary
SW41_MoveInfo.NextMoveStep(LineMoveStep.SW07_TopCylinderDown); SW41_MoveInfo.NextMoveStep(LineMoveStep.SW07_TopCylinderDown);
SWLog("横移轨道41:托盘已到达出口,顶升气缸下降,判断入料1是否需要此托盘 "); SWLog("横移轨道41:托盘已到达出口,顶升气缸下降,判断入料1是否需要此托盘 ");
CylinderMove(SW41_MoveInfo, IO_Type.SW4_TopCylinder_Up, IO_Type.SW4_TopCylinder_Down); CylinderMove(SW41_MoveInfo, IO_Type.SW4_TopCylinder_Up, IO_Type.SW4_TopCylinder_Down);
Thread.Sleep(50);
if (!CheckTrayIsNeed(101, Sw41TrayNum)) if (!CheckTrayIsNeed(101, Sw41TrayNum))
{ {
CylinderMove(SW41_MoveInfo, IO_Type.SW1_TopCylinder_Up, IO_Type.SW1_TopCylinder_Down); CylinderMove(SW41_MoveInfo, IO_Type.SW1_TopCylinder_Up, IO_Type.SW1_TopCylinder_Down);
...@@ -714,9 +713,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -714,9 +713,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (SW41_MoveInfo.MoveStep.Equals(LineMoveStep.SW09_WaitTrayGo)) else if (SW41_MoveInfo.MoveStep.Equals(LineMoveStep.SW09_WaitTrayGo))
{ {
TrayManager.UpdateSWState(4, 0);
TrayManager.UpdateSWState(1, 0);
lastSw4StopDownTime = DateTime.Now.AddSeconds(-2); lastSw4StopDownTime = DateTime.Now.AddSeconds(-2);
SW41_MoveInfo.EndMove(); SW41_MoveInfo.EndMove();
SWLog("横移轨道41:横移结束 "); SWLog("横移轨道41:横移结束 ");
...@@ -769,6 +766,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -769,6 +766,7 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.SW2_StopDown, IO_VALUE.LOW); IOMove(IO_Type.SW2_StopDown, IO_VALUE.LOW);
SW23_MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); SW23_MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
CylinderMove(SW23_MoveInfo, IO_Type.SW2_TopCylinder_Down, IO_Type.SW2_TopCylinder_Up); CylinderMove(SW23_MoveInfo, IO_Type.SW2_TopCylinder_Down, IO_Type.SW2_TopCylinder_Up);
Thread.Sleep(50);
CylinderMove(SW23_MoveInfo, IO_Type.SW3_TopCylinder_Down, IO_Type.SW3_TopCylinder_Up); CylinderMove(SW23_MoveInfo, IO_Type.SW3_TopCylinder_Down, IO_Type.SW3_TopCylinder_Up);
} }
else if (SW23_MoveInfo.MoveStep.Equals(LineMoveStep.SW03_TopCylinderUp)) else if (SW23_MoveInfo.MoveStep.Equals(LineMoveStep.SW03_TopCylinderUp))
...@@ -801,6 +799,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -801,6 +799,7 @@ namespace OnlineStore.DeviceLibrary
SW23_MoveInfo.NextMoveStep(LineMoveStep.SW07_TopCylinderDown); SW23_MoveInfo.NextMoveStep(LineMoveStep.SW07_TopCylinderDown);
SWLog("横移轨道23:托盘已到达出口,顶升气缸下降 "); SWLog("横移轨道23:托盘已到达出口,顶升气缸下降 ");
CylinderMove(SW23_MoveInfo, IO_Type.SW2_TopCylinder_Up, IO_Type.SW2_TopCylinder_Down); CylinderMove(SW23_MoveInfo, IO_Type.SW2_TopCylinder_Up, IO_Type.SW2_TopCylinder_Down);
Thread.Sleep(50);
if (!CheckTrayIsNeed(104, Sw23TrayNum)) if (!CheckTrayIsNeed(104, Sw23TrayNum))
{ {
CylinderMove(SW23_MoveInfo, IO_Type.SW3_TopCylinder_Up, IO_Type.SW3_TopCylinder_Down); CylinderMove(SW23_MoveInfo, IO_Type.SW3_TopCylinder_Up, IO_Type.SW3_TopCylinder_Down);
...@@ -835,9 +834,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -835,9 +834,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (SW23_MoveInfo.MoveStep.Equals(LineMoveStep.SW09_WaitTrayGo)) else if (SW23_MoveInfo.MoveStep.Equals(LineMoveStep.SW09_WaitTrayGo))
{ {
TrayManager.UpdateSWState(2, 0);
TrayManager.UpdateSWState(3, 0);
lastSw2StopDownTime = DateTime.Now.AddSeconds(-2); lastSw2StopDownTime = DateTime.Now.AddSeconds(-2);
SW23_MoveInfo.EndMove(); SW23_MoveInfo.EndMove();
SWLog("横移轨道23:横移结束 "); SWLog("横移轨道23:横移结束 ");
......
...@@ -38,8 +38,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -38,8 +38,7 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.HIGH) && canProcess) if (IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.HIGH) && canProcess)
{ {
if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, true)) if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, true))
{ {
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
SecondMoveInfo.NewMove(LineMoveType.CheckFixture); SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
CheckLog("托盘阻挡" + SecondMoveInfo.SLog + "阻挡气缸1-1上升)"); CheckLog("托盘阻挡" + SecondMoveInfo.SLog + "阻挡气缸1-1上升)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopCylinder2Down); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopCylinder2Down);
...@@ -54,8 +53,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -54,8 +53,7 @@ namespace OnlineStore.DeviceLibrary
{ {
//托盘在第一个阻挡处 //托盘在第一个阻挡处
SecondMoveInfo.NewMove(LineMoveType.CheckFixture); SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_00_StopCylinder1Down); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_00_StopCylinder1Down);
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
CheckLog(" 托盘检测:" + SecondMoveInfo.SLog + "阻挡气缸1-1下降 ,最多等待" + TrayManager.StopDownWaitTime); CheckLog(" 托盘检测:" + SecondMoveInfo.SLog + "阻挡气缸1-1下降 ,最多等待" + TrayManager.StopDownWaitTime);
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH)); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH));
......
using Asa;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class RFIDManager
{
public static RFID RfidReader = new RFID();
/// <summary>
/// 获取托盘编码
/// </summary>
public static int GetTrayNum(int subType, bool isClear = false)
{
// return 9;
if (subType.Equals(104))
{
return LineManager.Line.Sw23TrayNum;
}
else if (subType.Equals(101))
{
return LineManager.Line.Sw41TrayNum;
}
string ip = GetRFIP(subType);
//获取盘号
RFIDData data = ReadRFID(ip, isClear);
if (data != null)
{
if (data.RFType.Equals((byte)'E'))
{
return data.Num;
}
return 0;
}
return 0;
}
public static RFIDData GetShelfData(int subType)
{
string ip = GetRFIP(subType, 1);
return ReadRFID(ip);
}
public static RFIDData ReadRFID(string ip, bool isClear = false)
{
try
{
if (String.IsNullOrEmpty(ip).Equals(false) && LineManager.Line.rfidList.Contains(ip))
{
RFIDData data = new RFIDData(RfidReader.Read(ip));
if (isClear)
{
RfidReader.Clear(ip);
}
return data;
}
}
catch (Exception ex)
{
//LogUtil.error("ReadRFID["+ip+"]出错:" + ex.ToString());
}
return new RFIDData(-1, -1);
}
internal static string GetRFIP(int subType, int rtType = 0)
{
string ip = "";
string rtName = DeviceConfig.RFIP_Str + "_" + subType.ToString().PadLeft(3, '0');
if (rtType > 0)
{
rtName += "-" + rtType.ToString();
}
if (DeviceConfig.ProRFIpMap.ContainsKey(rtName))
{
ip = DeviceConfig.ProRFIpMap[rtName];
}
return ip;
}
}
public class RFIDData
{
/// <summary>
/// RFID类型,区分是料架还是托盘,托盘E=69,A=65
/// </summary>
public int RFType = 0;
/// <summary>
/// 托盘编号,从1-32
/// </summary>
public int Num = 0;
public RFIDData(int num, int t)
{
this.RFType = t;
this.Num = num;
}
public RFIDData(byte[] data)
{
try
{
if (data != null && data.Length > 2)
{
RFType = data[1];
Num = Convert.ToInt32(data[2]);
}
}
catch (Exception ex)
{
LogUtil.error("RFIP 数据【" + data + "】 获取编码失败");
}
}
public byte[] ToData()
{
return new byte[] { (byte)RFType, (byte)Num };
}
public string ToStr()
{
return " [" + RFType + "],[" + Num + "] ";
}
}
}
...@@ -15,7 +15,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -15,7 +15,6 @@ namespace OnlineStore.DeviceLibrary
{ {
public static int SwTrayWaitTime = 500; public static int SwTrayWaitTime = 500;
public static int StopDownWaitTime = 500; public static int StopDownWaitTime = 500;
public static RFID RfidReader = new RFID();
/// <summary> /// <summary>
/// 托盘集合,key=托盘编号,value=托盘详细信息 /// 托盘集合,key=托盘编号,value=托盘详细信息
/// </summary> /// </summary>
...@@ -177,93 +176,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -177,93 +176,13 @@ namespace OnlineStore.DeviceLibrary
{ {
TrayInfoMap = new ConcurrentDictionary<int, TrayInfo>(); TrayInfoMap = new ConcurrentDictionary<int, TrayInfo>();
} }
/// <summary>
/// 获取托盘编码
/// </summary>
public static int GetTrayNum(int subType, bool isClear = false)
{
// return 9;
if (subType.Equals(104))
{
return LineManager.Line.Sw23TrayNum;
}
else if (subType.Equals(101))
{
return LineManager.Line.Sw41TrayNum;
}
string ip = GetRFIP(subType);
//获取盘号
RFIDData data = ReadRFID(ip, isClear);
if (data != null)
{
if (data.RFType.Equals((byte)'E'))
{
return data.Num;
}
return 0;
}
return 0;
}
public static RFIDData GetShelfData(int subType)
{
string ip = GetRFIP(subType, 1);
return ReadRFID(ip);
}
public static RFIDData ReadRFID(string ip, bool isClear = false)
{
try
{
if (String.IsNullOrEmpty(ip).Equals(false) && LineManager.Line.rfidList.Contains(ip))
{
RFIDData data = new RFIDData(RfidReader.Read(ip));
if (isClear)
{
RfidReader.Clear(ip);
}
return data;
}
}
catch (Exception ex)
{
//LogUtil.error("ReadRFID["+ip+"]出错:" + ex.ToString());
}
return new RFIDData(-1, -1);
}
private static string GetRFIP(int subType, int rtType = 0)
{
string ip = "";
string rtName = DeviceConfig.RFIP_Str + "_" + subType.ToString().PadLeft(3, '0');
if (rtType > 0)
{
rtName += "-" + rtType.ToString();
}
if (DeviceConfig.ProRFIpMap.ContainsKey(rtName))
{
ip = DeviceConfig.ProRFIpMap[rtName];
}
return ip;
}
#region 横移状态缓存 #region 横移状态缓存
// internal static ConcurrentDictionary<int, int> SidesWayStateMap = new ConcurrentDictionary<int, int>();
internal static int GetSwStatus(int swNum)
{
//if (SidesWayStateMap.ContainsKey(swNum))
//{
// return SidesWayStateMap[swNum];
//}
return 0;
}
internal static bool LineCanMoveSW(int swNum) internal static bool LineCanMoveSW(int swNum)
{ {
int status = GetSwStatus(swNum);
//若此横移对应的设备未启动,直接可处理 //若此横移对应的设备未启动,直接可处理
foreach (FeedingEquip equip in LineManager.Line.FeedingEquipMap.Values) foreach (FeedingEquip equip in LineManager.Line.FeedingEquipMap.Values)
{ {
...@@ -297,29 +216,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -297,29 +216,7 @@ namespace OnlineStore.DeviceLibrary
} }
return false; return false;
} }
/// <summary>
/// 更新横移托盘的处理状态
/// </summary>
/// <param name="swNum">横移编号</param>
/// <param name="value">0=未处理等待中,1=托盘处理完成,可处理横移,2=托盘检测处理中</param>
internal static void UpdateSWState(int swNum, int value)
{
//if (swNum <= 0)
//{
// return;
//}
//if (SidesWayStateMap.ContainsKey(swNum))
//{
// SidesWayStateMap[swNum] = value;
//}
//else
//{
// SidesWayStateMap.TryAdd(swNum, value);
//}
}
#endregion #endregion
public static bool checkWatch(Stopwatch watch, int targetMs, bool isStop = true) public static bool checkWatch(Stopwatch watch, int targetMs, bool isStop = true)
...@@ -336,50 +233,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -336,50 +233,10 @@ namespace OnlineStore.DeviceLibrary
} }
return false; return false;
} }
}
public class RFIDData
{
/// <summary>
/// RFID类型,区分是料架还是托盘,托盘E=69,A=65
/// </summary>
public int RFType=0;
/// <summary>
/// 托盘编号,从1-32
/// </summary>
public int Num = 0;
public RFIDData(int num, int t )
{
this.RFType = t;
this.Num = num;
}
public RFIDData(byte[] data)
{
try
{
if (data != null && data.Length > 2)
{
RFType = data[1];
Num = Convert.ToInt32(data[2]);
}
}
catch (Exception ex)
{
LogUtil.error("RFIP 数据【" + data + "】 获取编码失败");
}
}
public byte[] ToData()
{
return new byte[] { (byte)RFType, (byte)Num };
}
public string ToStr()
{
return " [" + RFType + "],[" + Num + "] ";
}
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!