Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 0ac1cd37
由
LN
编写于
2020-05-28 17:29:27 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
rfid更改为最新方式
1 个父辈
a683279f
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
223 行增加
和
483 行删除
dll/RFID/Asa.RFID.dll
source/AssemblyLineClient/App.config
source/AssemblyLineClient/AssemblyLineClient.csproj
source/AssemblyLineClient/FrmIOMsg.cs
source/AssemblyLineClient/记录.txt
source/Common/Setting_Init.cs
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/assemblyLine/DischargeLine_Partial.cs
source/DeviceLibrary/assemblyLine/EquipBase.cs
source/DeviceLibrary/assemblyLine/FeedingEquip.cs
source/DeviceLibrary/assemblyLine/FeedingEquip_InStore.cs
source/DeviceLibrary/assemblyLine/LineBean.cs
source/DeviceLibrary/assemblyLine/MoveEquip_Partial.cs
source/DeviceLibrary/assemblyLine/ProvidingEquip_Partial.cs
source/DeviceLibrary/assemblymanager/RFIDManagercs.cs
source/DeviceLibrary/assemblymanager/TrayManager.cs
source/DeviceLibrary/deviceLibrary/RFID/RFID.cs
source/DeviceLibrary/deviceLibrary/RFID/RFIDReader-back.cs
dll/RFID/Asa.RFID.dll
0 → 100644
查看文件 @
0ac1cd3
此文件类型无法预览
source/AssemblyLineClient/App.config
查看文件 @
0ac1cd3
...
@@ -57,6 +57,7 @@
...
@@ -57,6 +57,7 @@
<
add
key
=
"NeedScanCode"
value
=
"1"
/>
<
add
key
=
"NeedScanCode"
value
=
"1"
/>
<
add
key
=
"Agv_Log_Open"
value
=
"0"
/>
<
add
key
=
"Agv_Log_Open"
value
=
"0"
/>
<
add
key
=
"NeedCheckTray"
value
=
"0"
/>
<
add
key
=
"NeedCheckTray"
value
=
"0"
/>
<
add
key
=
"RfidServer_Port"
value
=
"13000"
/>
</
appSettings
>
</
appSettings
>
<!-- <
log4net
> -->
<!-- <
log4net
> -->
<!-- <
appender
name
=
"RollingLogFileAppender"
type
=
"log4net.Appender.RollingFileAppender"
> -->
<!-- <
appender
name
=
"RollingLogFileAppender"
type
=
"log4net.Appender.RollingFileAppender"
> -->
...
...
source/AssemblyLineClient/AssemblyLineClient.csproj
查看文件 @
0ac1cd3
...
@@ -55,6 +55,9 @@
...
@@ -55,6 +55,9 @@
</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>
...
...
source/AssemblyLineClient/FrmIOMsg.cs
查看文件 @
0ac1cd3
...
@@ -42,20 +42,20 @@ namespace OnlineStore.AssemblyLine
...
@@ -42,20 +42,20 @@ namespace OnlineStore.AssemblyLine
}
}
lblConInfo
.
Text
+=
msg
;
lblConInfo
.
Text
+=
msg
;
lblRFID
.
Text
=
"RFID信息:\r\n"
;
//
lblRFID.Text = "RFID信息:\r\n";
msg
=
""
;
//
msg = "";
List
<
string
>
rfidList
=
new
List
<
string
>(
DeviceConfig
.
ProRFIpMap
.
Values
);
//
List<string> rfidList = new List<string>(DeviceConfig.ProRFIpMap.Values);
foreach
(
string
ip
in
rfidList
)
//
foreach (string ip in rfidList)
{
//
{
string
errorCode
=
"?"
;
//
string errorCode = "?";
if
(
RFIDAutoReader
.
rfidErrorMap
.
ContainsKey
(
ip
))
//
if (RFIDAutoReader.rfidErrorMap.ContainsKey(ip))
{
//
{
errorCode
=
""
+
RFIDAutoReader
.
rfidErrorMap
[
ip
];
//
errorCode = "" + RFIDAutoReader.rfidErrorMap[ip];
}
//
}
// string con = RFIDManager.ReadRFID(ip) .NumStr() ;
//
// string con = RFIDManager.ReadRFID(ip) .NumStr() ;
msg
+=
(
"RFID["
+
ip
+
"]:"
).
PadLeft
(
26
,
' '
)
+
"ErrorCode="
+
errorCode
+
"\n"
;
//
msg += ("RFID[" + ip + "]:").PadLeft(26, ' ') + "ErrorCode=" + errorCode + "\n";
}
//
}
lblRFID
.
Text
+=
msg
;
//
lblRFID.Text += msg;
lblBox
.
Text
=
"料仓连接信息:\r\n"
;
lblBox
.
Text
=
"料仓连接信息:\r\n"
;
...
...
source/AssemblyLineClient/记录.txt
查看文件 @
0ac1cd3
需要修改
20200528
RFID更改为最新方式。
接驳台等待料盘到位去掉超时时间。
需要修改
1.紧急出料托盘定位逻辑
1.紧急出料托盘定位逻辑
2.皮带线无信号不扫码。
2.皮带线无信号不扫码。
...
...
source/Common/Setting_Init.cs
查看文件 @
0ac1cd3
...
@@ -89,5 +89,7 @@ namespace OnlineStore.Common
...
@@ -89,5 +89,7 @@ namespace OnlineStore.Common
public
static
string
UseBuzzer
=
"UseBuzzer"
;
public
static
string
UseBuzzer
=
"UseBuzzer"
;
public
static
string
NeedCheckTray
=
"NeedCheckTray"
;
public
static
string
NeedCheckTray
=
"NeedCheckTray"
;
public
static
string
RfidServer_Port
=
"RfidServer_Port"
;
}
}
}
}
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
0ac1cd3
...
@@ -36,6 +36,9 @@
...
@@ -36,6 +36,9 @@
<Prefer32Bit>false</Prefer32Bit>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference Include="Asa.RFID">
<HintPath>..\..\dll\RFID\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>
...
@@ -94,9 +97,6 @@
...
@@ -94,9 +97,6 @@
<Compile Include="deviceLibrary\PanasonicServo\ACServerManager.cs" />
<Compile Include="deviceLibrary\PanasonicServo\ACServerManager.cs" />
<Compile Include="deviceLibrary\PanasonicServo\ACServerManager_Partial.cs" />
<Compile Include="deviceLibrary\PanasonicServo\ACServerManager_Partial.cs" />
<Compile Include="assemblyLine\EquipBase.cs" />
<Compile Include="assemblyLine\EquipBase.cs" />
<Compile Include="deviceLibrary\RFID\RFIDAuto.cs" />
<Compile Include="deviceLibrary\RFID\RFIDAutoReader.cs" />
<Compile Include="deviceLibrary\RFID\RFIDReader.cs" />
<Compile Include="model\LineAlarm.cs">
<Compile Include="model\LineAlarm.cs">
<SubType>Code</SubType>
<SubType>Code</SubType>
</Compile>
</Compile>
...
...
source/DeviceLibrary/assemblyLine/DischargeLine_Partial.cs
查看文件 @
0ac1cd3
...
@@ -144,7 +144,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -144,7 +144,7 @@ namespace OnlineStore.DeviceLibrary
{
{
return
;
return
;
}
}
#
region
新方式的横移料盘处理,扫码工位与
NG
工位分开处理
#
region
新方式的横移料盘处理,扫码工位与
NG
工位分开处理
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
DON_01_WaitTime
))
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
DON_01_WaitTime
))
{
{
...
@@ -161,8 +161,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -161,8 +161,8 @@ namespace OnlineStore.DeviceLibrary
{
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
DON_05_LineRun
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
DON_05_LineRun
);
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料,NG->接驳台,转动接驳台皮带"
);
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料,NG->接驳台,转动接驳台皮带"
);
// IOMove(IO_Type.SeparateDevice_Run, IO_VALUE.HIGH);
// IOMove(IO_Type.SeparateDevice_Run, IO_VALUE.HIGH);
Line3Turn
.
StartLineRun
(
Line3EndProcess
);
Line3Turn
.
StartLineRun
(
Line3EndProcess
);
SeparateLineRun
(
MoveInfo
);
SeparateLineRun
(
MoveInfo
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
Location_Check3
,
IO_VALUE
.
HIGH
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
Location_Check3
,
IO_VALUE
.
HIGH
));
...
@@ -172,10 +172,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -172,10 +172,10 @@ namespace OnlineStore.DeviceLibrary
{
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
DON_07_SeparateCheck
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
DON_07_SeparateCheck
);
// Line3LastTrayP++;
// Line3LastTrayP++;
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料,等待料盘到达接驳台
,最多等待65000
"
);
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料,等待料盘到达接驳台
"
);
MoveInfo
.
TimeOutSeconds
=
40
;
MoveInfo
.
TimeOutSeconds
=
40
;
MoveInfo
.
OneWaitCanEndStep
=
true
;
//
MoveInfo.OneWaitCanEndStep = true;
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
65000
));
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(65000));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
SeparateDevice_Check
,
IO_VALUE
.
HIGH
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
SeparateDevice_Check
,
IO_VALUE
.
HIGH
));
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
DON_07_SeparateCheck
))
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
DON_07_SeparateCheck
))
...
@@ -190,20 +190,27 @@ namespace OnlineStore.DeviceLibrary
...
@@ -190,20 +190,27 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料,接驳台有料,调用arriveRobotLocation="
+
robotIndex
+
"["
+
StationInfo_Move
.
CodeStr
+
"]"
);
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料,接驳台有料,调用arriveRobotLocation="
+
robotIndex
+
"["
+
StationInfo_Move
.
CodeStr
+
"]"
);
SServerManager
.
arriveRobotLocation
(
Name
,
robotIndex
,
StationInfo_Move
.
CodeStr
);
SServerManager
.
arriveRobotLocation
(
Name
,
robotIndex
,
StationInfo_Move
.
CodeStr
);
}
}
else
if
(
span
.
TotalSeconds
<=
60
)
{
int
robotIndex
=
GetRobotIndex
();
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料,接驳台应有料"
+
FormUtil
.
GetSpanStr
(
span
)+
",调用arriveRobotLocation="
+
robotIndex
+
"["
+
StationInfo_Move
.
CodeStr
+
"]"
);
SServerManager
.
arriveRobotLocation
(
Name
,
robotIndex
,
StationInfo_Move
.
CodeStr
);
}
else
else
{
{
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料,接驳台无料"
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
DON_07_SeparateCheck
);
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料,未检测到SeparateDevice_Check,再次 等待料盘到达接驳台 "
);
MoveInfo
.
TimeOutSeconds
=
40
;
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
SeparateDevice_Check
,
IO_VALUE
.
HIGH
));
}
}
//MoveInfo.EndStepWait();
//}
//else if (span.TotalSeconds <= 60)
//{
// int robotIndex = GetRobotIndex();
// LogUtil.info(hengyiName + MoveInfo.SLog + "送料,接驳台应有料"+FormUtil.GetSpanStr(span)+",调用arriveRobotLocation=" + robotIndex + "[" + StationInfo_Move.CodeStr + "]");
// SServerManager.arriveRobotLocation(Name, robotIndex, StationInfo_Move.CodeStr);
//}
//else
//{
// LogUtil.info(hengyiName + MoveInfo.SLog + "送料,接驳台无料");
//}
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
DON_08_CRun
))
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
DON_08_CRun
))
{
{
SeparateStopRun
();
SeparateStopRun
();
MoveEndS
();
MoveEndS
();
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料结束,停止接驳台皮带线 "
);
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料结束,停止接驳台皮带线 "
);
...
@@ -225,7 +232,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -225,7 +232,7 @@ namespace OnlineStore.DeviceLibrary
SeparateStopRun
();
SeparateStopRun
();
MoveEndS
();
MoveEndS
();
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"NG处理结束,停止接驳台皮带线 "
);
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"NG处理结束,停止接驳台皮带线 "
);
// StationInfo_NG = new StationTrayInfo();
// StationInfo_NG = new StationTrayInfo();
}
}
#
endregion
#
endregion
...
...
source/DeviceLibrary/assemblyLine/EquipBase.cs
查看文件 @
0ac1cd3
...
@@ -323,6 +323,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -323,6 +323,10 @@ namespace OnlineStore.DeviceLibrary
}
}
return
true
;
return
true
;
}
}
internal
void
ClearTrayRFID
()
{
RFIDManager
.
ClearTrayNum
(
DeviceID
);
}
#
region
伺服运动
#
region
伺服运动
...
...
source/DeviceLibrary/assemblyLine/FeedingEquip.cs
查看文件 @
0ac1cd3
...
@@ -659,34 +659,34 @@ namespace OnlineStore.DeviceLibrary
...
@@ -659,34 +659,34 @@ namespace OnlineStore.DeviceLibrary
#
endregion
#
endregion
#
region
AGV
#
region
AGV
internal
bool
AgvCanEnter
(
string
nodeId
,
RFIDData
data
)
//
internal bool AgvCanEnter(string nodeId, RFIDData data)
{
//
{
string
logN
=
Name
+
"收到 AgvCanEnter 事件 ["
+
nodeId
+
"] ["
+
data
.
ToData
()
+
"] "
;
// string logN = Name + "收到 AgvCanEnter 事件 [" + nodeId + "] [" + data.NumStr
() + "] ";
bool
usable
=
false
;
//
bool usable = false;
if
(
nodeId
.
Equals
(
Config
.
AgvInName
))
//
if (nodeId.Equals(Config.AgvInName))
{
//
{
if
(
isInSuddenDown
||
isNoAirCheck
)
//
if (isInSuddenDown || isNoAirCheck)
{
//
{
usable
=
false
;
//
usable = false;
}
//
}
else
//
else
{
//
{
//入料口无料架即可进入
//
//入料口无料架即可进入
usable
=
(
runStatus
>=
LineRunStatus
.
Runing
//
usable = (runStatus >= LineRunStatus.Runing
&&
ProcessShelfEnter
.
Equals
(
false
)
//
&& ProcessShelfEnter.Equals(false)
&&
IOValue
(
IO_Type
.
SL_Entry_Check
).
Equals
(
IO_VALUE
.
LOW
));
//
&& IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.LOW));
}
//
}
}
//
}
else
if
(
nodeId
.
Equals
(
Config
.
AgvOutName
))
//
else if (nodeId.Equals(Config.AgvOutName))
{
//
{
//出口有料架才可以进入
//
//出口有料架才可以进入
usable
=
(
runStatus
>=
LineRunStatus
.
Runing
//
usable = (runStatus >= LineRunStatus.Runing
&&
ProcessShelfOut
.
Equals
(
false
)
//
&& ProcessShelfOut.Equals(false)
&&
IOValue
(
IO_Type
.
SL_Out_Check
).
Equals
(
IO_VALUE
.
HIGH
));
//
&& IOValue(IO_Type.SL_Out_Check).Equals(IO_VALUE.HIGH));
}
//
}
LogUtil
.
info
(
logN
+
":"
+
usable
);
//
LogUtil.info(logN + ":" + usable);
return
usable
;
//
return usable;
}
//
}
internal
void
AgvArrive
(
string
nodeId
,
string
rfid
)
internal
void
AgvArrive
(
string
nodeId
,
string
rfid
)
{
{
...
...
source/DeviceLibrary/assemblyLine/FeedingEquip_InStore.cs
查看文件 @
0ac1cd3
...
@@ -115,17 +115,13 @@ namespace OnlineStore.DeviceLibrary
...
@@ -115,17 +115,13 @@ namespace OnlineStore.DeviceLibrary
swWaitWatch
.
Stop
();
swWaitWatch
.
Stop
();
lastStopDown
=
DateTime
.
Now
;
lastStopDown
=
DateTime
.
Now
;
SecondMoveInfo
.
NewMove
(
LineMoveType
.
CheckFixture
,
CheckParam
);
SecondMoveInfo
.
NewMove
(
LineMoveType
.
CheckFixture
,
CheckParam
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MIO_00_Stop1Down
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MIO_00_Stop1Down
);
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
LogUtil
.
debug
(
Name
+
" ["
+
trayCount
+
"] 检测到SW_StopCheck:"
+
SecondMoveInfo
.
SLog
+
"阻挡气缸下降 ,等待 SW_StopCheck=0,清理托盘RFID"
);
LogUtil
.
debug
(
Name
+
" ["
+
trayCount
+
"] 检测到SW_StopCheck:"
+
SecondMoveInfo
.
SLog
+
"阻挡气缸下降 ,等待 SW_StopCheck=0"
);
ClearTrayRFID
();
//CheckLog("检测到SW_StopCheck:" + SecondMoveInfo.SLog + "阻挡气缸下降 ,等待 SW_StopCheck=0" );
IOMove
(
IO_Type
.
SW_StopDown
,
IO_VALUE
.
HIGH
,
1200
);
IOMove
(
IO_Type
.
SW_StopDown
,
IO_VALUE
.
HIGH
,
1200
);
SecondMoveInfo
.
OneWaitCanEndStep
=
true
;
SecondMoveInfo
.
OneWaitCanEndStep
=
true
;
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(TrayManager.StopDownWaitTime));
//SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW_StopDown, IO_VALUE.HIGH));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
SW_StopCheck
,
IO_VALUE
.
LOW
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
SW_StopCheck
,
IO_VALUE
.
LOW
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
SW_TrayCheck
,
IO_VALUE
.
HIGH
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
SW_TrayCheck
,
IO_VALUE
.
HIGH
));
//IOMove(IO_Type.SW_StopDown, IO_VALUE.HIGH, TrayManager.StopDownWaitTime);
}
}
}
}
else
else
...
...
source/DeviceLibrary/assemblyLine/LineBean.cs
查看文件 @
0ac1cd3
...
@@ -166,7 +166,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -166,7 +166,6 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
Name
+
"加载调试设备出错:"
,
ex
);
LogUtil
.
error
(
Name
+
"加载调试设备出错:"
,
ex
);
}
}
}
}
RFIDManager
.
Init
();
Task
.
Factory
.
StartNew
(
delegate
Task
.
Factory
.
StartNew
(
delegate
{
{
LogUtil
.
info
(
Name
+
"开始连接IO模块 "
);
LogUtil
.
info
(
Name
+
"开始连接IO模块 "
);
...
...
source/DeviceLibrary/assemblyLine/MoveEquip_Partial.cs
查看文件 @
0ac1cd3
...
@@ -570,15 +570,13 @@ namespace OnlineStore.DeviceLibrary
...
@@ -570,15 +570,13 @@ namespace OnlineStore.DeviceLibrary
trayCheck2LowWait
.
Stop
();
trayCheck2LowWait
.
Stop
();
//托盘在第一个阻挡处
//托盘在第一个阻挡处
SecondMoveInfo
.
NewMove
(
LineMoveType
.
CheckFixture
);
SecondMoveInfo
.
NewMove
(
LineMoveType
.
CheckFixture
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MIO_00_Stop1Down
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MIO_00_Stop1Down
);
//SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200)
);
CheckLog
(
" 托盘检测:料盘检测StopCylinder_Check1 "
+
SecondMoveInfo
.
SLog
+
"阻挡气缸1-1下降 , 等待 StopCylinder_Check1=0,清理托盘RFID"
);
C
heckLog
(
" 托盘检测:料盘检测StopCylinder_Check1 "
+
SecondMoveInfo
.
SLog
+
"阻挡气缸1-1下降 , 等待 StopCylinder_Check1=0"
);
C
learTrayRFID
(
);
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
HIGH
,
1200
);
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
HIGH
,
1200
);
SecondMoveInfo
.
OneWaitCanEndStep
=
true
;
SecondMoveInfo
.
OneWaitCanEndStep
=
true
;
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Check1
,
IO_VALUE
.
LOW
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Check1
,
IO_VALUE
.
LOW
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Check2
,
IO_VALUE
.
HIGH
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Check2
,
IO_VALUE
.
HIGH
));
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(TrayManager.StopDownWaitTime));
}
}
}
}
else
else
...
...
source/DeviceLibrary/assemblyLine/ProvidingEquip_Partial.cs
查看文件 @
0ac1cd3
...
@@ -73,16 +73,13 @@ namespace OnlineStore.DeviceLibrary
...
@@ -73,16 +73,13 @@ namespace OnlineStore.DeviceLibrary
lastStopDown
=
DateTime
.
Now
;
lastStopDown
=
DateTime
.
Now
;
//托盘在第一个阻挡处
//托盘在第一个阻挡处
SecondMoveInfo
.
NewMove
(
LineMoveType
.
CheckFixture
);
SecondMoveInfo
.
NewMove
(
LineMoveType
.
CheckFixture
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MIO_00_Stop1Down
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MIO_00_Stop1Down
);
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
LogUtil
.
debug
(
Name
+
" ["
+
trayCount
+
"] 托盘检测:"
+
SecondMoveInfo
.
SLog
+
"阻挡气缸1-1下降 ,等待 StopCylinder_Check1=0,清理托盘RFID"
);
LogUtil
.
debug
(
Name
+
" ["
+
trayCount
+
"] 托盘检测:"
+
SecondMoveInfo
.
SLog
+
"阻挡气缸1-1下降 ,等待 StopCylinder_Check1=0"
);
ClearTrayRFID
();
//CheckLog(" 托盘检测:" + SecondMoveInfo.SLog + "阻挡气缸1-1下降 ,等待 StopCylinder_Check1=0" );
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
HIGH
,
1200
);
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
HIGH
,
1200
);
SecondMoveInfo
.
OneWaitCanEndStep
=
true
;
SecondMoveInfo
.
OneWaitCanEndStep
=
true
;
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Check1
,
IO_VALUE
.
LOW
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Check1
,
IO_VALUE
.
LOW
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Check2
,
IO_VALUE
.
HIGH
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Check2
,
IO_VALUE
.
HIGH
));
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(TrayManager.StopDownWaitTime));
}
}
}
}
else
else
...
...
source/DeviceLibrary/assemblymanager/RFIDManagercs.cs
查看文件 @
0ac1cd3
...
@@ -3,6 +3,7 @@ using Asa.RFID;
...
@@ -3,6 +3,7 @@ using Asa.RFID;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System
;
using
System.Collections.Concurrent
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
...
@@ -13,48 +14,38 @@ namespace OnlineStore.DeviceLibrary
...
@@ -13,48 +14,38 @@ namespace OnlineStore.DeviceLibrary
{
{
public
class
RFIDManager
public
class
RFIDManager
{
{
public
static
List
<
string
>
ShelfIpList
=
new
List
<
string
>();
private
static
int
DefaultTrayNum
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
DefaultTrayNum
);
public
static
List
<
string
>
TrayIpList
=
new
List
<
string
>();
private
static
ReadAll
readAll
=
new
ReadAll
(
"TheRFID"
);
private
static
int
DefaultTrayNum
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
DefaultTrayNum
);
private
static
bool
IsOpen
=
false
;
public
static
void
Init
()
private
static
ConcurrentDictionary
<
string
,
string
>
LastRfidMap
=
new
ConcurrentDictionary
<
string
,
string
>();
public
static
void
Open
(
)
{
{
TrayIpList
=
new
List
<
string
>();
if
(
IsOpen
)
ShelfIpList
=
new
List
<
string
>();
{
Dictionary
<
string
,
string
>
rfidMap
=
DeviceConfig
.
ProRFIpMap
;
return
;
foreach
(
string
key
in
rfidMap
.
Keys
)
}
{
try
//if (key.EndsWith("-1"))
{
//{
int
port
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
RfidServer_Port
);
// ShelfIpList.Add(rfidMap[key]);
if
(
port
<=
0
)
//}
//else
{
{
TrayIpList
.
Add
(
rfidMap
[
key
])
;
port
=
13000
;
}
}
LogUtil
.
info
(
"RFID Server Open,port="
+
port
);
readAll
.
Start
();
IsOpen
=
true
;
}
}
}
catch
(
Exception
ex
)
public
static
void
Open
()
{
Task
.
Factory
.
StartNew
(
delegate
{
{
LogUtil
.
info
(
"RFIDManager.Open"
);
LogUtil
.
error
(
"Open 出错:"
+
ex
.
ToString
());
RFIDReader
.
Open
(
ShelfIpList
.
ToArray
());
}
// RFIDAutoReader.Open(null, new List<string>(rfidMap.Values).ToArray());
}
RFIDAutoReader
.
Open
(
null
,
TrayIpList
.
ToArray
());
});
}
/// <summary>
/// 获取托盘编码
/// </summary>
public
static
int
GetTrayNum
(
int
subType
,
bool
isClear
=
false
)
public
static
int
GetTrayNum
(
int
subType
,
bool
isClear
=
false
)
{
{
if
(
DefaultTrayNum
>
0
)
if
(
DefaultTrayNum
>
0
)
{
{
return
DefaultTrayNum
;
return
DefaultTrayNum
;
}
}
// return 9;
if
(
subType
.
Equals
(
104
))
if
(
subType
.
Equals
(
104
))
{
{
return
LineManager
.
Line
.
Sw23TrayNum
;
return
LineManager
.
Line
.
Sw23TrayNum
;
...
@@ -86,56 +77,33 @@ namespace OnlineStore.DeviceLibrary
...
@@ -86,56 +77,33 @@ namespace OnlineStore.DeviceLibrary
return
0
;
return
0
;
}
}
public
static
RFIDData
GetShelfId
(
int
subType
)
public
static
void
ClearTrayNum
(
int
subType
)
{
string
ip
=
GetRFIP
(
subType
,
1
);
return
ReadRFID
(
ip
,
true
);
}
public
static
RFIDData
ReadRFID
(
string
ip
,
bool
isClear
=
false
)
{
{
try
try
{
{
if
(
String
.
IsNullOrEmpty
(
ip
).
Equals
(
false
)
&&
ShelfIpList
.
Contains
(
ip
))
if
(
subType
.
Equals
(
104
))
{
{
byte
[]
bdata
=
RFIDReader
.
Read
(
ip
,
isClear
);
return
;
if
(
bdata
==
null
)
{
LogUtil
.
error
(
"RFID [ "
+
ip
+
" ] 读到数据=null"
);
}
RFIDData
data
=
new
RFIDData
(
bdata
);
return
data
;
}
}
else
else
if
(
subType
.
Equals
(
101
))
//if (String.IsNullOrEmpty(ip).Equals(false) && LineManager.Line.rfidList.Contains(ip))
{
{
byte
[]
bdata
=
null
;
return
;
if
(
isClear
)
{
bdata
=
RFIDAutoReader
.
ReadAndClear
(
ip
);
}
else
{
bdata
=
RFIDAutoReader
.
Read
(
ip
);
}
if
(
bdata
==
null
)
{
LogUtil
.
error
(
"RFID [ "
+
ip
+
" ] 读到数据=null"
);
}
RFIDData
data
=
new
RFIDData
(
bdata
);
return
data
;
}
}
string
ip
=
GetRFIP
(
subType
);
RFIDData
data
=
ReadRFID
(
ip
,
true
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
//LogUtil.error("ReadRFID["+ip+"]出错:",ex
);
LogUtil
.
error
(
"ClearTrayNum【"
+
subType
+
"】出错:"
+
ex
.
ToString
()
);
}
}
return
new
RFIDData
();
}
}
public
static
RFIDData
GetShelfId
(
int
subType
)
{
string
ip
=
GetRFIP
(
subType
,
1
);
return
ReadRFID
(
ip
,
true
);
}
public
static
string
GetRFIP
(
int
subType
,
int
rtType
=
0
)
public
static
string
GetRFIP
(
int
subType
,
int
rtType
=
0
)
{
{
string
ip
=
""
;
string
ip
=
""
;
...
@@ -151,87 +119,113 @@ namespace OnlineStore.DeviceLibrary
...
@@ -151,87 +119,113 @@ namespace OnlineStore.DeviceLibrary
return
ip
;
return
ip
;
}
}
public
static
void
Close
(
)
public
static
RFIDData
ReadRFID
(
string
ip
,
bool
isClear
=
false
)
{
{
Task
.
Factory
.
StartNew
(
delegate
try
{
{
LogUtil
.
info
(
"RFIDManager.Close"
);
if
(
String
.
IsNullOrEmpty
(
ip
).
Equals
(
false
))
try
{
LogUtil
.
info
(
"调用 RFIDAutoReader.CloseAll"
);
RFIDAutoReader
.
CloseAll
();
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"RFIDAutoReader.CloseAll()出错:"
,
ex
);
}
try
{
{
LogUtil
.
info
(
"调用 RFIDReader.CloseAll"
);
string
outValue
=
readAll
.
Read
(
ip
);
RFIDReader
.
CloseAll
();
}
if
(
isClear
)
catch
(
Exception
ex
)
{
{
readAll
.
Clear
(
ip
);
LogUtil
.
error
(
"RFIDReader.CloseAll()出错:"
,
ex
);
}
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
class
RFIDData
public
static
void
Close
()
{
/// <summary>
/// RFID类型,区分是料架还是托盘,托盘E=69,包装料料架A=65,料串=B
/// </summary>
public
char
RFType
=
'0'
;
/// <summary>
/// 托盘编号,从1-32
/// </summary>
public
int
Num
=
0
;
public
RFIDData
(
int
num
=
0
,
int
t
=
0
)
{
{
if
(
t
<
65
)
try
{
{
RFType
=
'0'
;
readAll
.
Stop
()
;
}
}
else
catch
(
Exception
ex
)
{
{
this
.
RFType
=
(
char
)
t
;
LogUtil
.
error
(
"关闭RFID出错:"
+
ex
.
ToString
())
;
}
}
this
.
Num
=
num
;
}
}
public
RFIDData
(
byte
[]
data
)
}
public
class
RFIDData
{
public
string
StrData
=
""
;
public
char
RFType
{
{
try
get
{
{
if
(
data
!=
null
&&
data
.
Length
>
2
)
char
[]
charArray
=
StrData
.
ToCharArray
();
if
(
charArray
.
Length
>
0
)
{
{
if
(
data
[
1
]
<
65
)
return
charArray
[
0
];
{
}
RFType
=
'0'
;
return
'0'
;
}
}
else
}
public
int
Num
{
get
{
try
{
if
(
StrData
.
Length
>=
2
)
{
{
RFType
=
(
char
)
data
[
1
]
;
return
Convert
.
ToInt32
(
StrData
.
Substring
(
1
,
StrData
.
Length
-
1
))
;
}
}
Num
=
(
int
)(
data
[
2
]);
}
}
catch
(
Exception
ex
)
{
}
return
0
;
}
}
catch
(
Exception
ex
)
}
public
RFIDData
(
string
data
=
"00"
)
{
if
(
String
.
IsNullOrEmpty
(
data
))
{
{
LogUtil
.
error
(
"RFIP 数据【"
+
data
+
"】 获取编码失败"
)
;
data
=
"00"
;
}
}
this
.
StrData
=
data
;
}
}
public
byte
[]
ToData
()
public
string
NumStr
()
{
{
return
new
byte
[]
{
(
byte
)
RFType
,
(
byte
)
Num
}
;
return
StrData
;
}
}
public
string
NumStr
()
internal
static
bool
IsRealRfid
(
string
shelfRfid
)
{
{
return
""
+
RFType
+
""
+
Num
.
ToString
()
+
""
;
//判断料架号是否是真实的料架号
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
;
}
}
}
}
}
}
source/DeviceLibrary/assemblymanager/TrayManager.cs
查看文件 @
0ac1cd3
...
@@ -19,11 +19,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -19,11 +19,7 @@ namespace OnlineStore.DeviceLibrary
/// 托盘集合,key=托盘编号,value=托盘详细信息
/// 托盘集合,key=托盘编号,value=托盘详细信息
/// </summary>
/// </summary>
private
static
ConcurrentDictionary
<
int
,
TrayInfo
>
TrayInfoMap
=
new
ConcurrentDictionary
<
int
,
TrayInfo
>();
private
static
ConcurrentDictionary
<
int
,
TrayInfo
>
TrayInfoMap
=
new
ConcurrentDictionary
<
int
,
TrayInfo
>();
/// <summary>
/// 流水线需要的空盘数量
/// </summary>
// internal static int LineNeedEmptyTrayNum = 0;
/// <summary>
/// <summary>
/// 最大托盘号,必须按照顺序从1到6走过
/// 最大托盘号,必须按照顺序从1到6走过
/// </summary>
/// </summary>
...
@@ -44,15 +40,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -44,15 +40,7 @@ namespace OnlineStore.DeviceLibrary
{
{
return
new
List
<
TrayInfo
>(
TrayInfoMap
.
Values
);
return
new
List
<
TrayInfo
>(
TrayInfoMap
.
Values
);
}
}
//internal static void AddNeedEmptyTrayNum()
//{
// Interlocked.Increment(ref LineNeedEmptyTrayNum);
//}
//internal static void DelNeedEmptyTrayNum()
//{
// Interlocked.Decrement(ref LineNeedEmptyTrayNum);
//}
/// <summary>
/// <summary>
/// 对应的盘号(1-6)是否有料盘
/// 对应的盘号(1-6)是否有料盘
/// </summary>
/// </summary>
...
...
source/DeviceLibrary/deviceLibrary/RFID/RFID.cs
deleted
100644 → 0
查看文件 @
a683279
using
log4net
;
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Asa.RFID
{
}
source/DeviceLibrary/deviceLibrary/RFID/RFIDReader-back.cs
deleted
100644 → 0
查看文件 @
a683279
using
log4net
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
static
Asa
.
RFID
.
RFIDAuto
;
namespace
Asa.RFID
{
public
class
RFID
{
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
"TheRFID"
);
private
string
IP
=
""
;
private
byte
addr
;
private
int
portIndex
;
private
bool
IsConnect
=
false
;
private
byte
[]
lastData
=
new
byte
[
8
];
internal
byte
[]
_buff
;
//8字节缓存
private
byte
[]
_uid
;
//卡片ID
public
bool
IsExist
=
false
;
public
int
ErrCode
=
0
;
public
RFID
(
string
ip
)
{
this
.
IP
=
ip
;
}
public
int
Close
()
{
try
{
IsConnect
=
false
;
int
ErrCode
=
ReaderA
.
StaticClassReaderA
.
CloseNetPort
(
portIndex
);
LOGGER
.
Info
(
"Close RFID ["
+
IP
+
"]:"
+
ErrCode
);
return
ErrCode
;
}
catch
(
Exception
e
)
{
LOGGER
.
Error
(
"Close RFID["
+
IP
+
"] has error"
,
e
);
}
return
-
1
;
}
public
int
Open
()
{
if
(
IsConnect
)
{
LOGGER
.
Warn
(
" RFID ["
+
IP
+
"] is already connected, no need to start again"
);
return
0
;
}
//IP合法
string
pattern
=
@"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$"
;
bool
rtn
=
System
.
Text
.
RegularExpressions
.
Regex
.
IsMatch
(
IP
,
pattern
);
if
(!
rtn
)
{
LOGGER
.
Error
(
IP
+
" is error"
);
return
-
1
;
}
string
[]
arr
=
IP
.
Split
(
'.'
);
if
(
arr
.
Length
!=
4
)
{
LOGGER
.
Error
(
IP
+
" length is not 4"
);
return
-
1
;
}
addr
=
Convert
.
ToByte
(
arr
[
3
]);
int
port
=
6000
+
Convert
.
ToInt32
(
arr
[
3
]);
portIndex
=
0
;
int
ErrCode
=
ReaderA
.
StaticClassReaderA
.
OpenNetPort
(
port
,
IP
,
ref
addr
,
ref
portIndex
);
LOGGER
.
Info
(
"Connect ["
+
IP
+
"] :"
+
ErrCode
);
// 在 OpenNetPort 后面使用
System
.
Threading
.
Thread
.
Sleep
(
100
);
OpenCloseRF
(
false
);
System
.
Threading
.
Thread
.
Sleep
(
100
);
OpenCloseRF
(
true
);
return
ErrCode
;
}
private
void
OpenCloseRF
(
bool
rtn
)
{
if
(
rtn
)
ErrCode
=
ReaderA
.
StaticClassReaderA
.
OpenRf
(
ref
addr
,
portIndex
);
else
ErrCode
=
ReaderA
.
StaticClassReaderA
.
CloseRf
(
ref
addr
,
portIndex
);
}
/// <summary>
/// 查找电子标签,扫描模式不能使用
/// </summary>
/// <returns></returns>
public
bool
FindRFID
()
{
//0 不带AFI
//1 带AFI
//2 不带AFI,继续查询
//3 带AFI,继续查询
//6 不带AFI,新的查询
//7 带AFI,新的查询
byte
state
=
0
;
//Select模式需要AFI
byte
AFI
=
0
;
//输出,1字节DSFID,8字节UID
byte
[]
DSFIDAndUID
=
new
byte
[
9
];
//输出,标签数量
byte
cardNumber
=
0
;
ErrCode
=
ReaderA
.
StaticClassReaderA
.
Inventory
(
ref
addr
,
ref
state
,
ref
AFI
,
DSFIDAndUID
,
ref
cardNumber
,
portIndex
);
if
(
ErrCode
==
0
)
{
//查询时间
//fCmdRet = StaticClassReaderA.GetInventoryTime(ref n_time, portIndex);
Array
.
Copy
(
DSFIDAndUID
,
1
,
_uid
,
0
,
8
);
IsExist
=
true
;
return
true
;
}
else
{
for
(
int
i
=
0
;
i
<
_uid
.
Length
;
i
++)
_uid
[
i
]
=
0
;
IsExist
=
false
;
return
false
;
}
}
public
byte
[]
Read
(
bool
isNeedFind
=
false
)
{
if
(
isNeedFind
)
{
FindRFID
();
}
if
(
IsExist
)
{
ReadRFID
();
return
_buff
;
}
else
{
LOGGER
.
Info
(
IP
+
" Read: IsExist=false "
);
}
return
null
;
}
private
void
ReadRFID
()
{
//0 不带AFI
//1 带AFI
//2 不带AFI,继续查询
//3 带AFI,继续查询
//6 不带AFI,新的查询
//7 带AFI,新的查询
byte
state
=
0
;
//起始块号
byte
blockNum
=
0
;
//块数量
byte
blockCount
=
2
;
//输出,块内安全信息,长度为BlockCount个字节
byte
[]
blockSecStatus
=
new
byte
[
blockCount
];
//输出,块内数据信息,长度为块的大小(4或8字节)乘以BlockCount个字节
byte
[]
data
=
new
byte
[
4
*
blockCount
];
//错误代码
byte
errorCode
=
0
;
ErrCode
=
ReaderA
.
StaticClassReaderA
.
ReadMultipleBlock
(
ref
addr
,
ref
state
,
_uid
,
blockNum
,
blockCount
,
blockSecStatus
,
data
,
ref
errorCode
,
portIndex
);
if
(
ErrCode
==
0
)
{
Array
.
Copy
(
data
,
0
,
_buff
,
0
,
data
.
Length
);
string
dataStr
=
byteToStr
(
data
,
data
.
Length
);
LOGGER
.
Info
(
IP
+
" ReadMultipleBlock: Length: "
+
data
.
Length
+
" Data:"
+
dataStr
);
}
else
{
LOGGER
.
Info
(
IP
+
" ReadMultipleBlock: ErrCode: "
+
ErrCode
);
}
}
private
string
byteToStr
(
byte
[]
data
,
int
len
)
{
string
s
=
""
;
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
s
+=
data
[
i
].
ToString
(
"X2"
)
+
" "
;
}
return
s
;
}
}
public
class
RFIDReader
{
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
"TheRFID"
);
private
static
Dictionary
<
string
,
RFID
>
rfidMap
=
new
Dictionary
<
string
,
RFID
>();
public
static
void
Open
(
params
string
[]
ipArr
)
{
foreach
(
var
ip
in
ipArr
)
{
if
(
rfidMap
.
ContainsKey
(
ip
))
{
rfidMap
[
ip
].
Open
();
}
else
{
RFID
rfid
=
new
RFID
(
ip
);
rfid
.
Open
();
rfidMap
.
Add
(
ip
,
rfid
);
}
}
}
public
static
bool
FindRFID
(
string
ip
)
{
if
(
rfidMap
.
ContainsKey
(
ip
))
{
return
rfidMap
[
ip
].
FindRFID
();
}
return
false
;
}
public
static
byte
[]
Read
(
string
ip
,
bool
isNeedFind
)
{
if
(
rfidMap
.
ContainsKey
(
ip
))
{
return
rfidMap
[
ip
].
Read
(
isNeedFind
);
}
return
null
;
}
public
static
void
CloseAll
()
{
foreach
(
var
rfid
in
rfidMap
.
Values
)
{
rfid
.
Close
();
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论