Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-ACPackingStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 8737200d
由
张东亮
编写于
2023-06-09 09:44:35 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
rfid读取异常
1 个父辈
8b465734
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
21 行增加
和
23 行删除
source/ACPackingStore/FrmStore.cs
source/DeviceLibrary/PackingStore/PackingStoreBean.cs
source/DeviceLibrary/device/RFIDManager.cs
source/ACPackingStore/FrmStore.cs
查看文件 @
8737200
...
@@ -211,6 +211,12 @@ namespace OnlineStore.ACPackingStore
...
@@ -211,6 +211,12 @@ namespace OnlineStore.ACPackingStore
}
}
//this.Close();
//this.Close();
try
{
RFIDManager
.
Close
();
AgvClient
.
Dispose
();
}
finally
{
}
System
.
Environment
.
Exit
(
System
.
Environment
.
ExitCode
);
System
.
Environment
.
Exit
(
System
.
Environment
.
ExitCode
);
}
}
}
}
...
@@ -332,9 +338,6 @@ namespace OnlineStore.ACPackingStore
...
@@ -332,9 +338,6 @@ namespace OnlineStore.ACPackingStore
{
{
停止所有料仓
TToolStripMenuItem_Click
(
null
,
null
);
停止所有料仓
TToolStripMenuItem_Click
(
null
,
null
);
}
}
RFIDManager
.
Close
();
AgvClient
.
Dispose
();
}
}
private
void
btnClearLog_Click
(
object
sender
,
EventArgs
e
)
private
void
btnClearLog_Click
(
object
sender
,
EventArgs
e
)
{
{
...
...
source/DeviceLibrary/PackingStore/PackingStoreBean.cs
查看文件 @
8737200
...
@@ -73,7 +73,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -73,7 +73,7 @@ namespace OnlineStore.DeviceLibrary
IOManager
.
Init
();
IOManager
.
Init
();
//先初始化设备
//先初始化设备
RFIDManager
.
Open
(
rfidList
.
ToArray
());
//初始化摄像机配置
//初始化摄像机配置
CodeManager
.
LoadConfig
();
CodeManager
.
LoadConfig
();
...
@@ -153,8 +153,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -153,8 +153,6 @@ namespace OnlineStore.DeviceLibrary
StartTime
=
DateTime
.
Now
;
StartTime
=
DateTime
.
Now
;
//AgvClient.SetCancelState(false);
//AgvClient.SetCancelState(false);
RFIDManager
.
Open
(
rfidList
.
ToArray
());
mainTimer
.
Enabled
=
false
;
mainTimer
.
Enabled
=
false
;
isInSuddenDown
=
false
;
isInSuddenDown
=
false
;
isNoAirCheck
=
false
;
isNoAirCheck
=
false
;
...
...
source/DeviceLibrary/device/RFIDManager.cs
查看文件 @
8737200
...
@@ -3,6 +3,7 @@ using OnlineStore.Common;
...
@@ -3,6 +3,7 @@ using OnlineStore.Common;
using
System
;
using
System
;
using
System.Collections.Concurrent
;
using
System.Collections.Concurrent
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics.Eventing.Reader
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
...
@@ -15,7 +16,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -15,7 +16,7 @@ namespace OnlineStore.DeviceLibrary
private
static
Asa
.
RFID
.
ReadAll
readHao
;
private
static
Asa
.
RFID
.
ReadAll
readHao
;
private
static
Asa
.
RFID
.
ReadAll
readPu
;
private
static
Asa
.
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
Dictionary
<
string
,
string
>
LastRfidMap
=
new
Dictionary
<
string
,
string
>();
public
static
void
Open
(
string
[]
iparray
)
public
static
void
Open
(
string
[]
iparray
)
{
{
if
(
IsOpen
)
if
(
IsOpen
)
...
@@ -29,13 +30,13 @@ namespace OnlineStore.DeviceLibrary
...
@@ -29,13 +30,13 @@ namespace OnlineStore.DeviceLibrary
{
{
port
=
13000
;
port
=
13000
;
}
}
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
Asa
.
RFID
.
ReadAll
(
"TheRFID"
)
{
Type
=
Asa
.
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
Asa
.
RFID
.
ReadAll
(
"TheRFID"
)
{
Type
=
Asa
.
RFID
.
DeviceType
.
PuYue
};
readPu
.
Received
+=
ReadAll_Received
;
readPu
.
Received
+=
ReadAll_Received
;
readPu
.
Start
(
port
+
1
);
readPu
.
Start
(
port
+
1
);
LogUtil
.
info
(
$
"RFID Server Open,HaoBin port={port},PuYue port={port + 1}"
);
IsOpen
=
true
;
IsOpen
=
true
;
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
@@ -46,23 +47,15 @@ namespace OnlineStore.DeviceLibrary
...
@@ -46,23 +47,15 @@ namespace OnlineStore.DeviceLibrary
private
static
void
ReadAll_Received
(
string
ip
,
string
id
)
private
static
void
ReadAll_Received
(
string
ip
,
string
id
)
{
{
List
<
RfidCacheInfo
>
list
=
LastRfidMap
.
GetOrAdd
(
ip
,
new
List
<
RfidCacheInfo
>());
if
(
LastRfidMap
.
ContainsKey
(
ip
))
int
count
=
list
.
Count
;
if
(
count
>
0
)
{
{
RfidCacheInfo
last
=
list
[
count
-
1
];
LastRfidMap
[
ip
]
=
id
;
if
(!
last
.
Data
.
StrData
.
Equals
(
id
))
}
{
else
RFIDData
data
=
new
RFIDData
(
id
);
{
list
.
Add
(
new
RfidCacheInfo
(
data
));
LastRfidMap
.
Add
(
ip
,
id
);
if
(
list
.
Count
>
3
)
{
list
.
RemoveAt
(
0
);
}
LogUtil
.
debug
(
"ReadAll_Received["
+
ip
+
"]["
+
id
+
"]加入缓存"
);
LastRfidMap
.
AddOrUpdate
(
ip
,
list
,
(
key
,
value
)
=>
value
);
}
}
}
LogUtil
.
debug
(
"ReadAll_Received["
+
ip
+
"]["
+
id
+
"]加入缓存"
);
}
}
private
static
void
ReadAll_Log
(
string
ip
,
string
log
)
private
static
void
ReadAll_Log
(
string
ip
,
string
log
)
...
@@ -111,6 +104,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -111,6 +104,10 @@ namespace OnlineStore.DeviceLibrary
{
{
LogUtil
.
error
(
"ReadRFID["
+
ip
+
"] ["
+
isClear
+
"] 出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"ReadRFID["
+
ip
+
"] ["
+
isClear
+
"] 出错:"
+
ex
.
ToString
());
}
}
if
(
LastRfidMap
.
ContainsKey
(
ip
))
{
return
new
RFIDData
()
{
StrData
=
LastRfidMap
[
ip
]
};
}
return
new
RFIDData
();
return
new
RFIDData
();
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论