Commit 3e714c06 LN

rfid更改为最新版本

1 个父辈 6cbba1f8
此文件类型无法预览
...@@ -34,14 +34,9 @@ ...@@ -34,14 +34,9 @@
this.txtIP = new System.Windows.Forms.TextBox(); this.txtIP = new System.Windows.Forms.TextBox();
this.comboxType = new System.Windows.Forms.ComboBox(); this.comboxType = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.comType = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.numNum = new System.Windows.Forms.NumericUpDown();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.lblResult = new System.Windows.Forms.Label(); this.lblResult = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.numNum)).BeginInit();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -50,7 +45,7 @@ ...@@ -50,7 +45,7 @@
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label1.Location = new System.Drawing.Point(83, 36); this.label1.Location = new System.Drawing.Point(83, 46);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(107, 20); this.label1.Size = new System.Drawing.Size(107, 20);
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
...@@ -61,7 +56,7 @@ ...@@ -61,7 +56,7 @@
// //
this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBack.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnBack.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Location = new System.Drawing.Point(283, 257); this.btnBack.Location = new System.Drawing.Point(259, 183);
this.btnBack.Name = "btnBack"; this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(120, 45); this.btnBack.Size = new System.Drawing.Size(120, 45);
this.btnBack.TabIndex = 274; this.btnBack.TabIndex = 274;
...@@ -72,7 +67,7 @@ ...@@ -72,7 +67,7 @@
// txtIP // txtIP
// //
this.txtIP.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtIP.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtIP.Location = new System.Drawing.Point(195, 78); this.txtIP.Location = new System.Drawing.Point(195, 88);
this.txtIP.Name = "txtIP"; this.txtIP.Name = "txtIP";
this.txtIP.Size = new System.Drawing.Size(233, 26); this.txtIP.Size = new System.Drawing.Size(233, 26);
this.txtIP.TabIndex = 276; this.txtIP.TabIndex = 276;
...@@ -82,7 +77,7 @@ ...@@ -82,7 +77,7 @@
this.comboxType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboxType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboxType.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.comboxType.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.comboxType.FormattingEnabled = true; this.comboxType.FormattingEnabled = true;
this.comboxType.Location = new System.Drawing.Point(195, 33); this.comboxType.Location = new System.Drawing.Point(195, 43);
this.comboxType.Name = "comboxType"; this.comboxType.Name = "comboxType";
this.comboxType.Size = new System.Drawing.Size(233, 28); this.comboxType.Size = new System.Drawing.Size(233, 28);
this.comboxType.TabIndex = 277; this.comboxType.TabIndex = 277;
...@@ -93,47 +88,18 @@ ...@@ -93,47 +88,18 @@
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.label2.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label2.Location = new System.Drawing.Point(111, 80); this.label2.Location = new System.Drawing.Point(111, 90);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(78, 20); this.label2.Size = new System.Drawing.Size(78, 20);
this.label2.TabIndex = 278; this.label2.TabIndex = 278;
this.label2.Text = "读卡器IP:"; this.label2.Text = "读卡器IP:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// comType
//
this.comType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comType.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.comType.FormattingEnabled = true;
this.comType.Items.AddRange(new object[] {
"未知",
"A",
"B",
"C",
"D",
"E"});
this.comType.Location = new System.Drawing.Point(195, 158);
this.comType.Name = "comType";
this.comType.Size = new System.Drawing.Size(120, 28);
this.comType.TabIndex = 280;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label3.Location = new System.Drawing.Point(122, 161);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 20);
this.label3.TabIndex = 279;
this.label3.Text = "卡类型:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// button1 // button1
// //
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.button1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(139, 257); this.button1.Location = new System.Drawing.Point(115, 183);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(120, 45); this.button1.Size = new System.Drawing.Size(120, 45);
this.button1.TabIndex = 281; this.button1.TabIndex = 281;
...@@ -141,26 +107,6 @@ ...@@ -141,26 +107,6 @@
this.button1.UseVisualStyleBackColor = false; this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click); this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label4.Location = new System.Drawing.Point(136, 207);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(51, 20);
this.label4.TabIndex = 282;
this.label4.Text = "编号:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// numNum
//
this.numNum.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.numNum.Location = new System.Drawing.Point(195, 203);
this.numNum.Name = "numNum";
this.numNum.Size = new System.Drawing.Size(120, 26);
this.numNum.TabIndex = 283;
//
// groupBox2 // groupBox2
// //
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
...@@ -173,13 +119,9 @@ ...@@ -173,13 +119,9 @@
this.groupBox2.Controls.Add(this.txtIP); this.groupBox2.Controls.Add(this.txtIP);
this.groupBox2.Controls.Add(this.label2); this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.btnBack); this.groupBox2.Controls.Add(this.btnBack);
this.groupBox2.Controls.Add(this.numNum); this.groupBox2.Location = new System.Drawing.Point(22, 12);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.comType);
this.groupBox2.Location = new System.Drawing.Point(22, 6);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(505, 331); this.groupBox2.Size = new System.Drawing.Size(505, 249);
this.groupBox2.TabIndex = 291; this.groupBox2.TabIndex = 291;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "读取RFID"; this.groupBox2.Text = "读取RFID";
...@@ -189,7 +131,7 @@ ...@@ -189,7 +131,7 @@
this.lblResult.AutoSize = true; this.lblResult.AutoSize = true;
this.lblResult.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblResult.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblResult.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.lblResult.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblResult.Location = new System.Drawing.Point(195, 121); this.lblResult.Location = new System.Drawing.Point(195, 131);
this.lblResult.Name = "lblResult"; this.lblResult.Name = "lblResult";
this.lblResult.Size = new System.Drawing.Size(79, 20); this.lblResult.Size = new System.Drawing.Size(79, 20);
this.lblResult.TabIndex = 284; this.lblResult.TabIndex = 284;
...@@ -200,14 +142,13 @@ ...@@ -200,14 +142,13 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(560, 361); this.ClientSize = new System.Drawing.Size(560, 285);
this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox2);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmRFIPEdit"; this.Name = "FrmRFIPEdit";
this.Text = "托盘编码"; this.Text = "托盘编码";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmRFIPEdit_FormClosed); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmRFIPEdit_FormClosed);
this.Load += new System.EventHandler(this.FrmPwd_Load); this.Load += new System.EventHandler(this.FrmPwd_Load);
((System.ComponentModel.ISupportInitialize)(this.numNum)).EndInit();
this.groupBox2.ResumeLayout(false); this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout(); this.groupBox2.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
...@@ -221,11 +162,7 @@ ...@@ -221,11 +162,7 @@
private System.Windows.Forms.TextBox txtIP; private System.Windows.Forms.TextBox txtIP;
private System.Windows.Forms.ComboBox comboxType; private System.Windows.Forms.ComboBox comboxType;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox comType;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.NumericUpDown numNum;
private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label lblResult; private System.Windows.Forms.Label lblResult;
} }
......
...@@ -34,7 +34,7 @@ namespace OnlineStore.ACPackingStore ...@@ -34,7 +34,7 @@ namespace OnlineStore.ACPackingStore
} }
comboxType.SelectedIndex = 0; comboxType.SelectedIndex = 0;
comType.SelectedIndex = 0; //comType.SelectedIndex = 0;
List<string> List = new List<string>(); List<string> List = new List<string>();
List = new List<string>(rfMap.Values); List = new List<string>(rfMap.Values);
...@@ -59,12 +59,12 @@ namespace OnlineStore.ACPackingStore ...@@ -59,12 +59,12 @@ namespace OnlineStore.ACPackingStore
if (data != null) if (data != null)
{ {
resul = data.NumStr(); resul = data.NumStr();
numNum.Value = data.Num; //numNum.Value = data.Num;
int selIndex = data.RFType - 64; //int selIndex = data.RFType - 64;
if (selIndex >= 0 && selIndex <= comboxType.Items.Count) //if (selIndex >= 0 && selIndex <= comboxType.Items.Count)
{ //{
comboxType.SelectedIndex = selIndex; // comboxType.SelectedIndex = selIndex;
} //}
} }
lblResult.Text = resul; lblResult.Text = resul;
......
...@@ -146,6 +146,8 @@ rfidLoc: 料架位置,流水线可传-1 ...@@ -146,6 +146,8 @@ rfidLoc: 料架位置,流水线可传-1
20200429 20200429
调试模式时不发needEnter 调试模式时不发needEnter
SecMoveInfo
......
...@@ -262,11 +262,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -262,11 +262,11 @@ namespace OnlineStore.DeviceLibrary
//开始复位动作 //开始复位动作
MoveInfo.NextMoveStep(StoreMoveStep.BOX_H01_InOutBack); MoveInfo.NextMoveStep(StoreMoveStep.BOX_H01_InOutBack);
LogInfo(MoveInfo.MoveType + ": 开始料架入库,线体停止,进出轴先原点返回,设置agv"+ Config.AgvNodeName + "为None"); LogInfo(MoveInfo.MoveType + ": 开始料架入库,线体停止,进出轴先原点返回,设置agv" + Config.AgvNodeName + "为None");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
LineStop(); LineStop();
ACAxisHomeMove(Config.InOut_Axis); ACAxisHomeMove(Config.InOut_Axis);
AgvClient.SetStatus(Config.AgvNodeName,"","",ClientAction.None,ClientLevel.High,true); AgvClient.SetStatus(Config.AgvNodeName,"","",ClientAction.None,ClientLevel.High,true);
} }
/// <summary> /// <summary>
...@@ -599,7 +599,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -599,7 +599,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (IsChongfu) if (IsChongfu)
{ {
LogUtil.info("【" + info + "】 处理完成,耗时:" + stopwatch.Elapsed.ToString()); LogUtil.info( Name+"【" + info + "】 处理完成,耗时:" + stopwatch.Elapsed.ToString());
} }
} }
......
...@@ -321,7 +321,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -321,7 +321,8 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_08_WaitLineIn)) else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_08_WaitLineIn))
{ {
MoveInfo.NextMoveStep(StoreMoveStep.BS_09_WaitTime); MoveInfo.NextMoveStep(StoreMoveStep.BS_09_WaitTime);
InOutStoreLog(moveName + MoveInfo.SLog + ":再转动1000 , 等待入料口无信号"); InOutStoreLog(moveName + MoveInfo.SLog + ":再转动1000 , 等待入料口无信号,清理RFID");
RFIDManager.ReadRFID(Config.RFID_IP, true);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineIn_Check, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineIn_Check, IO_VALUE.LOW));
} }
...@@ -351,7 +352,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -351,7 +352,8 @@ namespace OnlineStore.DeviceLibrary
MoveEndToRuningStatus(); MoveEndToRuningStatus();
AgvClient.SetStatus(Config.AgvNodeName); AgvClient.SetStatus(Config.AgvNodeName);
//EmprtShelfList = new ConcurrentQueue<string>(); //EmprtShelfList = new ConcurrentQueue<string>();
InOutStoreLog(moveName + MoveInfo.SLog + ":料架"+ CurrShelfID + "已离开 ,设置"+ Config.AgvNodeName + "=None"); InOutStoreLog(moveName + MoveInfo.SLog + ":料架"+ CurrShelfID + "已离开 ,设置"+ Config.AgvNodeName + "=None,清理rfid");
RFIDManager.ReadRFID(Config.RFID_IP, true);
CurrShelfID = ""; CurrShelfID = "";
LastOutParam = new InOutParam(); LastOutParam = new InOutParam();
//LastRfidID = ""; //LastRfidID = "";
......
...@@ -39,6 +39,9 @@ ...@@ -39,6 +39,9 @@
<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="Asa.RFID">
<HintPath>..\..\dll\Asa.RFID.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>
...@@ -83,9 +86,7 @@ ...@@ -83,9 +86,7 @@
<Compile Include="device\PanasonicServo\ACCMDManager.cs" /> <Compile Include="device\PanasonicServo\ACCMDManager.cs" />
<Compile Include="device\PanasonicServo\ACServerManager.cs" /> <Compile Include="device\PanasonicServo\ACServerManager.cs" />
<Compile Include="device\PanasonicServo\ACServerManager_Partial.cs" /> <Compile Include="device\PanasonicServo\ACServerManager_Partial.cs" />
<Compile Include="device\RFID\RFIDAuto.cs" /> <Compile Include="device\RFIDManager.cs" />
<Compile Include="device\RFID\RFIDAutoReader.cs" />
<Compile Include="device\RFID\RFIDManager.cs" />
<Compile Include="store\AutoInoutInfo.cs" /> <Compile Include="store\AutoInoutInfo.cs" />
<Compile Include="store\LineMoveP.cs" /> <Compile Include="store\LineMoveP.cs" />
<Compile Include="store\LineAlarm.cs"> <Compile Include="store\LineAlarm.cs">
......
...@@ -87,7 +87,7 @@ namespace Asa.RFID ...@@ -87,7 +87,7 @@ namespace Asa.RFID
for (int i = 1; i <= 3; i++) for (int i = 1; i <= 3; i++)
{ {
ErrCode = ReaderA.StaticClassReaderA.OpenNetPort(port, IP, ref addr, ref portIndex); ErrCode = ReaderA.StaticClassReaderA.OpenNetPort(port, IP, ref addr, ref portIndex);
LOGGER.Info("Connect [" + IP + "] ["+i+"] :" + ErrCode); LOGGER.Info("Connect [" + IP + "] [" + i + "] :" + ErrCode);
if (ErrCode == 0) if (ErrCode == 0)
{ {
ErrCode = OpenAutoScanMode(addr); ErrCode = OpenAutoScanMode(addr);
...@@ -95,8 +95,9 @@ namespace Asa.RFID ...@@ -95,8 +95,9 @@ namespace Asa.RFID
Task.Factory.StartNew(AutoScan); Task.Factory.StartNew(AutoScan);
break; break;
} }
else else if (i < 3)
{ {
LOGGER.Error("Connect [" + IP + "] " + ErrCode + ", StopAutoScan");
StopAutoScan(); StopAutoScan();
} }
Thread.Sleep(10); Thread.Sleep(10);
......
using Asa.RFID;
using OnlineStore.Common;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class RFIDManager
{
private static ReadAll readAll = new ReadAll("TheRFID");
private static bool IsOpen = false;
private static ConcurrentDictionary<string, string> LastRfidMap = new ConcurrentDictionary<string, string>();
public static void Open(string[] iparray)
{
if (IsOpen)
{
return;
}
try
{
// readAll.Received += ReadAll_Received;
// readAll.Log += ReadAll_Log;
readAll.Start();
IsOpen = true;
}
catch (Exception ex)
{
LogUtil.error("Open 出错:" + ex.ToString());
}
}
private static void ReadAll_Log(string ip, string log)
{
LogUtil.LOGGER.Info("RFID : [" + ip + "] " + log);
}
public static RFIDData ReadRFID(string ip, bool isClear = false)
{
try
{
if (String.IsNullOrEmpty(ip).Equals(false))
{
string outValue = readAll.Read(ip);
if (isClear)
{
readAll.Clear(ip);
}
if (outValue.Equals("000"))
{
// LogUtil.error("ReadRFID[" + ip + "]=" + outValue);
}
RFIDData data = new RFIDData(outValue);
return data;
}
}
catch (Exception ex)
{
LogUtil.error("ReadRFID[" + ip + "] [" + isClear + "] 出错:" + ex.ToString());
}
return new RFIDData();
}
public static void Close()
{
try
{
readAll.Stop();
}
catch (Exception ex)
{
LogUtil.error("关闭RFID出错:" + ex.ToString());
}
}
}
public class RFIDData
{
public string StrData = "";
public RFIDData(string data = "00")
{
if (String.IsNullOrEmpty(data))
{
data = "00";
}
this.StrData = data;
}
public string NumStr()
{
return StrData;
}
internal static bool IsRealRfid(string shelfRfid)
{
//判断料架号是否是真实的料架号
if (shelfRfid.StartsWith("C") || shelfRfid.StartsWith("D"))
{
int num = -1;
try
{
num = Convert.ToInt32(shelfRfid.Substring(1, shelfRfid.Length - 1));
}
catch (Exception ex)
{
}
if (num > 0)
{
return true;
}
}
return false;
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!