Commit 92c43c5a 张东亮

init

1 个父辈 82f8c8fa
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
......@@ -39,18 +39,15 @@
<Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference>
<Reference Include="Asa.RFID">
<HintPath>..\..\dll\Asa.RFID.dll</HintPath>
<Reference Include="Asa.RFID.HiStation">
<HintPath>..\..\dll\Asa.RFID.HiStation.dll</HintPath>
</Reference>
<Reference Include="Asa.RFID.IReadAll">
<HintPath>..\..\dll\Asa.RFID.IReadAll.dll</HintPath>
</Reference>
<Reference Include="Client">
<HintPath>..\..\dll\Client.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary">
<HintPath>..\..\..\RC32-SZBOSCH-ACSingleStore\dll\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<HintPath>..\..\..\RC32-SZBOSCH-ACSingleStore\dll\halcondotnet.dll</HintPath>
</Reference>
<Reference Include="HFReader9CSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\RFID\HFReader9CSharp.dll</HintPath>
......
......@@ -5,16 +5,23 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class RFIDManager
{
private static ReadAll readAll =new ReadAll ("TheRFID");
private static Asa.RFID.ReadAll read;
private static bool IsOpen = false;
// private static ConcurrentDictionary<string, string> LastRfidMap = new ConcurrentDictionary<string, string>();
public static void Open(string[] iparray)
public static bool IsAuto = false;
/// <summary>
/// 是否连接
/// </summary>
public static bool IsConnected { get; set; } = false;
private static Dictionary<string, string> LastRfidMap = new Dictionary<string, string>();
public static void Open(string[] ip)
{
if (IsOpen)
{
......@@ -22,15 +29,9 @@ namespace OnlineStore.DeviceLibrary
}
try
{
int port = ConfigAppSettings.GetIntValue(Setting_Init.RfidServer_Port);
if (port <= 0)
{
port = 13001;
}
// readAll.Received += ReadAll_Received;
// readAll.Log += ReadAll_Log;
LogUtil.info("RFID Server Open,port=" + port);
readAll.Start(port);
read = new ReadAll("TheRFID");
read.Received += Read_Received;
read.Start(13001);
IsOpen = true;
}
catch (Exception ex)
......@@ -39,7 +40,27 @@ namespace OnlineStore.DeviceLibrary
}
}
private static string lastStr = "";
private static void Read_Received(string ip, string id)
{
try
{
if(LastRfidMap.ContainsKey(ip))
{
LastRfidMap[ip] = id;
}
else
{
LastRfidMap.Add(ip,id);
}
}
catch (ObjectDisposedException ex)
{
//程序刚退出,又回传数据
}
}
private static void ReadAll_Log(string ip, string log)
{
string str = "RFID : [" + ip + "] " + log;
......@@ -51,20 +72,21 @@ namespace OnlineStore.DeviceLibrary
lastStr = str;
}
public static RFIDData ReadRFID(string ip, bool isClear = false)
public static RFIDData ReadRFID(string ip,bool isClear= true)
{
try
{
if (String.IsNullOrEmpty(ip).Equals(false))
if (String.IsNullOrEmpty(ip).Equals(false) && read!=null)
{
string outValue = readAll.Read(ip);
if (isClear)
{
readAll.Clear(ip);
read.Clear(ip);
}
Thread.Sleep(100);
string outValue = read.Read(ip);
RFIDData data = new RFIDData(outValue);
return data;
}
}
......@@ -80,10 +102,15 @@ namespace OnlineStore.DeviceLibrary
{
try
{
readAll.Stop();
if(IsOpen)
{
read.Stop();
IsOpen = false;
}
}
catch (Exception ex)
{
IsOpen = false;
LogUtil.error("关闭RFID出错:" + ex.ToString());
}
}
......
......@@ -8,7 +8,7 @@
<add key="App_AutoRun" value="1" />
<add key="App_Title" value="VMI总仓进出料架缓存线" />
<!--Server address-->
<add key="http.server" value="http://10.85.160.25/myproject/" />
<add key="http.server" value="http://10.85.162.124/myproject/" />
<!--storeType-->
<add key="store_count" value="1" />
<!--start one store config-->
......@@ -19,7 +19,7 @@
<add key="DIMS" value="60" />
<add key="DOMS" value="300" />
<!--AGV调度服务器地址-->
<add key="AgvServerIp" value="192.168.103.12" />
<add key="AgvServerIp" value="10.85.162.40" />
<!--是否调试状态-->
<add key="IsInDebug" value="1" />
<add key ="Agv_Log_Open" value ="1"/>
......@@ -29,8 +29,11 @@
<file type="log4net.Util.PatternString" value="logs/vmiLine.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<param name="MaxSizeRollBackups" value="10"/>
<!-- 切割最多文件数 -->
<param name="MaximumFileSize" value="100MB"/>
<!-- 每个文件的大小 -->
<param name="RollingStyle" value="Size"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
</layout>
......@@ -39,8 +42,11 @@
<file value="logs/TheRFID-vmi.log"/>
<param name="Encoding" value="UTF-8" />
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<param name="MaxSizeRollBackups" value="10"/>
<!-- 切割最多文件数 -->
<param name="MaximumFileSize" value="100MB"/>
<!-- 每个文件的大小 -->
<param name="RollingStyle" value="Size"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
</layout>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!