Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 115f1361
由
LN
编写于
2019-12-27 11:26:50 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
Rfid修改
1 个父辈
a881b542
隐藏空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
297 行增加
和
187 行删除
dll/RFID/Asa.RFID.dll
dll/RFID/Asa.RFID.xml
dll/RFID/Basic.dll
dll/RFID/HFReader9CSharp.dll
source/AssemblyLineClient/App.config
source/AssemblyLineClient/AssemblyLineClient.csproj
source/AssemblyLineClient/FrmFeedingEquip.cs
source/AssemblyLineClient/FrmLineStore.cs
source/AssemblyLineClient/FrmMoveEquip.cs
source/AssemblyLineClient/FrmProvidingEquip.cs
source/Common/bean/Bean.cs
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/assemblyLine/EquipBase.cs
source/DeviceLibrary/assemblyLine/FeedingEquip_InStore.cs
source/DeviceLibrary/assemblyLine/LineBean.cs
source/DeviceLibrary/assemblyLine/MoveEquip_Partial.cs
source/DeviceLibrary/assemblymanager/ALineManager.cs
source/DeviceLibrary/assemblymanager/RFIDManagercs.cs
source/DeviceLibrary/assemblymanager/StoreServerManager.cs → source/DeviceLibrary/assemblymanager/SServerManager.cs
source/DeviceLibrary/deviceLibrary/RFID/RFIDManager.cs
dll/RFID/Asa.RFID.dll
查看文件 @
115f136
此文件类型无法预览
dll/RFID/Asa.RFID.xml
查看文件 @
115f136
...
...
@@ -118,129 +118,44 @@
<param
name=
"start"
></param>
<param
name=
"len"
></param>
</member>
<member
name=
"T:Asa.RFID.Reader
2
"
>
<member
name=
"T:Asa.RFID.Reader
All
"
>
<summary>
RFID读卡器
</summary>
</member>
<member
name=
"M:Asa.RFID.Reader
2
.#ctor"
>
<member
name=
"M:Asa.RFID.Reader
All
.#ctor"
>
<summary>
RFID
读卡器
RFID
</summary>
</member>
<member
name=
"
M:Asa.RFID.Reader2.IsConn(System.Int32)
"
>
<member
name=
"
P:Asa.RFID.ReaderAll.LogPath
"
>
<summary>
是否连接
日志目录
</summary>
<returns></returns>
</member>
<member
name=
"M:Asa.RFID.Reader
2.AddIP
(System.String[])"
>
<member
name=
"M:Asa.RFID.Reader
All.Open
(System.String[])"
>
<summary>
添加设备IP地址
打开所有
</summary>
<param
name=
"ip"
></param>
</member>
<member
name=
"M:Asa.RFID.Reader2.Connect(System.Boolean)"
>
<summary>
连接
</summary>
<param
name=
"autoScan"
>
自动扫描
</param>
</member>
<member
name=
"M:Asa.RFID.Reader2.Connect(System.Int32,System.Boolean)"
>
<summary>
连接
</summary>
<param
name=
"index"
></param>
<param
name=
"autoScan"
>
自动扫描
</param>
</member>
<member
name=
"M:Asa.RFID.Reader2.Close"
>
<member
name=
"M:Asa.RFID.ReaderAll.Close"
>
<summary>
关闭所有
</summary>
</member>
<member
name=
"M:Asa.RFID.Reader2.Close(System.Int32)"
>
<summary>
关闭
</summary>
<param
name=
"index"
></param>
</member>
<member
name=
"M:Asa.RFID.Reader2.FindRFID(System.Int32)"
>
<summary>
查找电子标签
</summary>
<param
name=
"index"
></param>
<returns></returns>
</member>
<member
name=
"M:Asa.RFID.Reader2.GetID(System.Int32)"
>
<summary>
ID号码
</summary>
<param
name=
"index"
></param>
<returns></returns>
</member>
<member
name=
"M:Asa.RFID.Reader2.Read(System.Int32)"
>
<summary>
读取电子标签
</summary>
<param
name=
"index"
></param>
<returns></returns>
</member>
<member
name=
"M:Asa.RFID.Reader2.Read(System.Int32,System.Int32,System.Int32)"
>
<summary>
读取电子标签
</summary>
<param
name=
"index"
></param>
<param
name=
"start"
></param>
<param
name=
"len"
></param>
<returns></returns>
</member>
<member
name=
"M:Asa.RFID.Reader2.Write(System.Int32,System.Byte[],System.Int32)"
>
<member
name=
"M:Asa.RFID.ReaderAll.Read(System.String)"
>
<summary>
写入数据到电子标签
读取
</summary>
<param
name=
"index"
></param>
<param
name=
"buff"
></param>
<param
name=
"start"
></param>
<param
name=
"ip"
></param>
<returns></returns>
</member>
<member
name=
"M:Asa.RFID.Reader2.AutoScan(System.Int32,System.Boolean)"
>
<summary>
自动读取扫描,扫描模式只读
</summary>
<param
name=
"idx"
></param>
<param
name=
"open"
></param>
</member>
<member
name=
"M:Asa.RFID.Reader2.Receive(System.Object)"
>
<summary>
自动扫描接受数据事件
</summary>
</member>
<member
name=
"M:Asa.RFID.Reader2.Find(System.Int32)"
>
<member
name=
"M:Asa.RFID.ReaderAll.Clear(System.String)"
>
<summary>
查找电子标签
清零
</summary>
<param
name=
"idx"
></param>
</member>
<member
name=
"M:Asa.RFID.Reader2.ReadRFID(System.Int32)"
>
<summary>
读取电子标签内所有数据
</summary>
<param
name=
"idx"
></param>
</member>
<member
name=
"M:Asa.RFID.Reader2.ReadRFID(System.Int32,System.Int32)"
>
<summary>
读取电子标签指定块
</summary>
<param
name=
"idx"
></param>
<param
name=
"num"
></param>
</member>
<member
name=
"M:Asa.RFID.Reader2.WriteRFID(System.Int32,System.Int32)"
>
<summary>
写入指定块数据到电子标签
</summary>
<param
name=
"idx"
></param>
<param
name=
"num"
></param>
<returns></returns>
<param
name=
"ip"
></param>
</member>
<member
name=
"T:Asa.RFID.IP"
>
<summary>
...
...
dll/RFID/Basic.dll
查看文件 @
115f136
此文件类型无法预览
dll/RFID/HFReader9CSharp.dll
查看文件 @
115f136
此文件类型无法预览
source/AssemblyLineClient/App.config
查看文件 @
115f136
...
...
@@ -8,7 +8,8 @@
<
add
key
=
"App_AutoRun"
value
=
"1"
/>
<
add
key
=
"App_Title"
value
=
"流水线客户端"
/>
<!--
Server
address
-->
<
add
key
=
"http.server"
value
=
"http://localhost/myproject/service/store/emptyPosForPutin"
/>
<
add
key
=
"http.server"
value
=
"http://localhost/myproject/"
/>
<!--<
add
key
=
"http.server"
value
=
"http://localhost/myproject/service/store/emptyPosForPutin"
/>-->
<!--
storeType
-->
<
add
key
=
"Line_moveEquip_count"
value
=
"18"
/>
<
add
key
=
"Line_feedingEquip_count"
value
=
"4"
/>
...
...
source/AssemblyLineClient/AssemblyLineClient.csproj
查看文件 @
115f136
...
...
@@ -55,9 +55,6 @@
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<Reference Include="ClassLibrary1">
<HintPath>..\..\dll\RFID\ClassLibrary1.dll</HintPath>
</Reference>
<Reference Include="Client">
<HintPath>..\..\dll\Client.dll</HintPath>
</Reference>
...
...
source/AssemblyLineClient/FrmFeedingEquip.cs
查看文件 @
115f136
...
...
@@ -235,10 +235,14 @@ namespace OnlineStore.AssemblyLine
cmbSizeList
.
Items
.
Clear
();
cmbSizeList
.
Items
.
Add
(
"0=默认位置"
);
for
(
int
i
=
8
;
i
<=
48
;
i
=
i
+
4
)
//for (int i = 8; i <= 48; i = i + 4)
//{
// cmbSizeList.Items.Add(i.ToString());
//}
foreach
(
int
heigth
in
LineManager
.
GetTrayList
())
{
cmbSizeList
.
Items
.
Add
(
i
.
ToString
()
);
}
cmbSizeList
.
Items
.
Add
(
heigth
);
}
cmbSizeList
.
SelectedIndex
=
0
;
lblStoreStatus
.
Text
=
KTK_Store
.
GetRunStr
(
equipBean
.
lineStatus
,
equipBean
.
runStatus
);
lblThisSta
.
Text
=
equipBean
.
WarnMsg
;
...
...
@@ -432,7 +436,7 @@ namespace OnlineStore.AssemblyLine
int
size
=
0
;
try
{
size
=
Convert
.
ToInt32
(
cmbSizeList
.
Text
);
}
catch
(
Exception
ex
)
{
}
txtSizePosition
.
Text
=
equipBean
.
Config
.
GetUpdownPositionP2
(
size
).
ToString
();
btnMoveto
.
Text
=
size
+
"
寸 托
盘放料位置P2 :"
;
btnMoveto
.
Text
=
size
+
"
mm
盘放料位置P2 :"
;
}
private
void
btnMoveto_Click
(
object
sender
,
EventArgs
e
)
...
...
source/AssemblyLineClient/FrmLineStore.cs
查看文件 @
115f136
...
...
@@ -277,7 +277,7 @@ namespace OnlineStore.AssemblyLine
//AIManager.CloseConnect();
ACServerManager
.
CloseAllPort
();
// CodeManager.CloseAllCamera();
RFIDManager
.
RfidReader
.
Close
();
RFIDManager
.
Close
();
System
.
Environment
.
Exit
(
System
.
Environment
.
ExitCode
);
}
catch
(
Exception
ex
)
...
...
source/AssemblyLineClient/FrmMoveEquip.cs
查看文件 @
115f136
...
...
@@ -49,10 +49,14 @@ namespace OnlineStore.AssemblyLine
cmbSizeList
.
Items
.
Clear
();
cmbSizeList
.
Items
.
Add
(
"0=默认位置"
);
for
(
int
i
=
8
;
i
<=
48
;
i
=
i
+
4
)
for
each
(
int
heigth
in
LineManager
.
GetTrayList
()
)
{
cmbSizeList
.
Items
.
Add
(
i
.
ToString
()
);
cmbSizeList
.
Items
.
Add
(
heigth
);
}
//for (int i = 8; i <= 48; i = i + 4)
//{
// cmbSizeList.Items.Add(i.ToString());
//}
cmbSizeList
.
SelectedIndex
=
0
;
lblStoreStatus
.
Text
=
KTK_Store
.
GetRunStr
(
equipBean
.
lineStatus
,
equipBean
.
runStatus
);
lblThisSta
.
Text
=
equipBean
.
WarnMsg
;
...
...
@@ -385,9 +389,9 @@ namespace OnlineStore.AssemblyLine
try
{
size
=
Convert
.
ToInt32
(
cmbSizeList
.
Text
);
}
catch
(
Exception
ex
)
{
}
txtP2
.
Text
=
equipBean
.
Config
.
GetUpdownP2
(
size
).
ToString
();
txtP3
.
Text
=
equipBean
.
Config
.
GetUpdownP3
(
size
).
ToString
();
btnP2
.
Text
=
size
+
"
寸
移栽位置 :"
;
btnP3
.
Text
=
size
+
"
寸
料仓门口位置 :"
;
// btnMoveto.Text = "尺
寸
" + size + "对应位置:";
btnP2
.
Text
=
size
+
"
mm盘
移栽位置 :"
;
btnP3
.
Text
=
size
+
"
mm盘
料仓门口位置 :"
;
// btnMoveto.Text = "尺
mm
" + size + "对应位置:";
}
private
void
btnMoveto_Click
(
object
sender
,
EventArgs
e
)
...
...
source/AssemblyLineClient/FrmProvidingEquip.cs
查看文件 @
115f136
...
...
@@ -39,10 +39,14 @@ namespace OnlineStore.AssemblyLine
axisMoveControl1
.
LoadData
(
equipBean
,
new
AxisBean
[]
{
equipBean
.
UpdownAxis
});
cmbSizeList
.
Items
.
Clear
();
cmbSizeList
.
Items
.
Add
(
"0=默认位置"
);
for
(
int
i
=
8
;
i
<=
48
;
i
=
i
+
4
)
for
each
(
int
heigth
in
LineManager
.
GetTrayList
()
)
{
cmbSizeList
.
Items
.
Add
(
i
.
ToString
()
);
cmbSizeList
.
Items
.
Add
(
heigth
);
}
//for (int i = 8; i <= 48; i = i + 4)
//{
// cmbSizeList.Items.Add(i.ToString());
//}
cmbSizeList
.
SelectedIndex
=
0
;
btnUpDownUp
.
Visible
=
false
;
}
...
...
@@ -398,8 +402,8 @@ namespace OnlineStore.AssemblyLine
try
{
size
=
Convert
.
ToInt32
(
cmbSizeList
.
Text
);
}
catch
(
Exception
ex
)
{
}
txtP2
.
Text
=
equipBean
.
Config
.
GetUpdownP2
(
size
).
ToString
();
txtP3
.
Text
=
equipBean
.
Config
.
GetUpdownP3
(
size
).
ToString
();
btnP2
.
Text
=
size
+
"
寸
移栽位置P2 :"
;
btnP3
.
Text
=
size
+
"
寸料
出料皮带线位置P3 :"
;
btnP2
.
Text
=
size
+
"
mm盘
移栽位置P2 :"
;
btnP3
.
Text
=
size
+
"
mm盘
出料皮带线位置P3 :"
;
}
private
void
btnSave_Click
(
object
sender
,
EventArgs
e
)
...
...
source/Common/bean/Bean.cs
查看文件 @
115f136
...
...
@@ -21,6 +21,7 @@ namespace OnlineStore.Common
public
class
LineOperation
{
// //{"result":"0","msg":"","pos":"11#AC1_18_4_28","barcode":"R506072019102200414","cid":"line-ac-11"}
// 返回: {"code": 0, "msg":"ok", data:7}
/// <summary>
/// 0=成功
/// </summary>
...
...
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
115f136
...
...
@@ -39,8 +39,9 @@
<Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference>
<Reference Include="ClassLibrary1">
<HintPath>..\..\dll\RFID\ClassLibrary1.dll</HintPath>
<Reference Include="Asa.RFID, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\RFID\Asa.RFID.dll</HintPath>
</Reference>
<Reference Include="Client">
<HintPath>..\..\dll\Client.dll</HintPath>
...
...
@@ -76,7 +77,7 @@
<Compile Include="assemblyLine\ProvidingEquip.cs" />
<Compile Include="assemblyLine\FeedingEquip.cs" />
<Compile Include="assemblymanager\RFIDManagercs.cs" />
<Compile Include="assemblymanager\S
tore
ServerManager.cs" />
<Compile Include="assemblymanager\SServerManager.cs" />
<Compile Include="assemblymanager\TrayManager.cs" />
<Compile Include="baan\AxisBean.cs" />
<Compile Include="baan\WaitUtil.cs" />
...
...
source/DeviceLibrary/assemblyLine/EquipBase.cs
查看文件 @
115f136
...
...
@@ -267,7 +267,7 @@ namespace OnlineStore.DeviceLibrary
//此处先对托盘号进行验证
preTrayNum
=
currTrayNum
;
currTrayNum
=
RFIDManager
.
GetTrayNum
(
DeviceID
,
true
);
LogInfo
(
"
编号"
+
trayCount
+
"***************上个托盘["
+
preTrayNum
+
"]当前托盘["
+
currTrayNum
+
"]
"
);
LogInfo
(
"
编号【"
+
trayCount
+
"】IP【"
+
RFIDManager
.
GetRFIP
(
DeviceID
)
+
"】上个托盘 【"
+
preTrayNum
+
"】 当前托盘 【"
+
currTrayNum
+
"】
"
);
return
true
;
}
...
...
source/DeviceLibrary/assemblyLine/FeedingEquip_InStore.cs
查看文件 @
115f136
...
...
@@ -710,7 +710,7 @@ namespace OnlineStore.DeviceLibrary
TrayManager
.
UpdateInStoreNG
(
currTrayNum
,
true
,
"扫码失败"
);
}
//从服务器获取库位号
string
result
=
S
tore
ServerManager
.
CodeReceived
(
Name
,
currTrayNum
,
LastCodeList
,
LastHeight
,
LastWidth
);
string
result
=
SServerManager
.
CodeReceived
(
Name
,
currTrayNum
,
LastCodeList
,
LastHeight
,
LastWidth
);
if
(!
result
.
Equals
(
""
))
{
TrayManager
.
UpdateInStoreNG
(
currTrayNum
,
true
,
result
);
...
...
@@ -908,22 +908,34 @@ namespace OnlineStore.DeviceLibrary
int
AxisChangeValue
=
Config
.
Height_ChangeValue
;
//计算高度
EndMovePosition
=
BatchAxis
.
GetAclPosition
();
LastH
eight
=
(
int
)
Math
.
Ceiling
(
1F
*
(
EndMovePosition
-
StartMovePosition
)
/
AxisChangeValue
);
int
h
eight
=
(
int
)
Math
.
Ceiling
(
1F
*
(
EndMovePosition
-
StartMovePosition
)
/
AxisChangeValue
);
int
addHeight
=
0
;
//如果检测信号未亮,极限亮了,需要补充高
//if (IOManager.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.LOW))
//{
// addHeight = Config.LastTrayAddHeight;
//}
LastH
eight
+=
addHeight
;
string
msg
=
Name
+
" 计算盘高:上升前【"
+
StartMovePosition
+
"】实时【"
+
EndMovePosition
+
"】补充【"
+
addHeight
+
"】计算后【"
+
LastHeight
+
"】"
;
if
(
LastHeight
<=
8
)
{
LastH
eight
=
8
;
}
h
eight
+=
addHeight
;
if
(
height
<=
8
)
{
h
eight
=
8
;
}
else
{
LastHeight
=
(
int
)
Math
.
Floor
(
1F
*
(
LastHeight
-
4
)
/
4
)
*
4
;
height
=
(
int
)
Math
.
Floor
(
1F
*
(
height
-
4
)
/
4
)
*
4
;
}
if
(
height
<=
8
)
{
height
=
8
;
}
LastHeight
=
height
;
List
<
int
>
heightList
=
LineManager
.
GetTrayList
();
heightList
=
(
from
m
in
heightList
orderby
m
descending
select
m
).
ToList
<
int
>();
foreach
(
int
h
in
heightList
)
{
if
(
height
>=
h
)
{
LastHeight
=
h
;
}
}
if
(
LastHeight
<=
8
)
{
LastHeight
=
8
;
}
LogUtil
.
info
(
msg
+
",归类为"
+
LastHeight
);
string
msg
=
Name
+
" 计算盘高:上升前【"
+
StartMovePosition
+
"】实时【"
+
EndMovePosition
+
"】补充【"
+
addHeight
+
"】计算后【"
+
height
+
"】"
+
",归类为"
+
LastHeight
;
LogUtil
.
info
(
msg
);
return
LastHeight
;
}
public
int
GetWidth
()
...
...
source/DeviceLibrary/assemblyLine/LineBean.cs
查看文件 @
115f136
...
...
@@ -174,11 +174,12 @@ namespace OnlineStore.DeviceLibrary
Thread
.
Sleep
(
5
);
Task
.
Factory
.
StartNew
(
delegate
{
// string path = Application.StartupPath + @"\logs\rfid\";
// RFIDManager.RfidReader.LogPath(path);
string
[]
rfidArray
=
rfidList
.
ToArray
();
//连接rfip
RFIDManager
.
RfidReader
.
Open
(
rfidArray
);
//string path = Application.StartupPath + @"\logs\rfid\";
//RFIDManager.RfidReader.LogPath = path;
//string[] rfidArray = rfidList.ToArray();
////连接rfip
//RFIDManager.RfidReader.Open(rfidArray);
RFIDManager
.
Open
(
rfidList
.
ToArray
());
});
addLastDI
(
IO_Type
.
Airpressure_Check
,
IOValue
(
IO_Type
.
Airpressure_Check
));
addLastDI
(
IO_Type
.
SuddenStop_BTN
,
IOValue
(
IO_Type
.
SuddenStop_BTN
));
...
...
source/DeviceLibrary/assemblyLine/MoveEquip_Partial.cs
查看文件 @
115f136
...
...
@@ -488,7 +488,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
Log
Info
(
SecondMoveInfo
.
MoveNum
+
"***************上个托盘号【"
+
preTrayNum
+
"】,当前"
+
(
isFull
?
"有料托盘"
:
"空托盘"
)
+
"【"
+
currTrayNum
+
"】没有出入库任务,放盘通过~"
);
Log
Util
.
debug
(
Name
+
SecondMoveInfo
.
MoveNum
+
"***************上个托盘号【"
+
preTrayNum
+
"】,当前"
+
(
isFull
?
"有料托盘"
:
"空托盘"
)
+
"【"
+
currTrayNum
+
"】没有出入库任务,放盘通过~"
);
// preTrayNum = currMoveTrayNum;
if
(
TrayManager
.
ErrorDeviceId
.
Equals
(
DeviceID
))
{
...
...
source/DeviceLibrary/assemblymanager/ALineManager.cs
查看文件 @
115f136
...
...
@@ -247,5 +247,11 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
"出错:"
+
ex
);
}
}
private
static
List
<
int
>
trayHeightList
=
new
List
<
int
>()
{
8
,
12
,
16
,
24
,
32
,
44
,
56
};
public
static
List
<
int
>
GetTrayList
()
{
return
trayHeightList
;
}
}
}
source/DeviceLibrary/assemblymanager/RFIDManagercs.cs
查看文件 @
115f136
using
Asa
;
using
Asa.RFID
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
...
...
@@ -6,13 +7,30 @@ using System.Collections.Generic;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
namespace
OnlineStore.DeviceLibrary
{
public
class
RFIDManager
{
public
static
RFID
RfidReader
=
new
RFID
();
public
static
Asa
.
RFID
.
ReaderAll
RfidReader
=
new
ReaderAll
();
private
static
int
DefaultTrayNum
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
DefaultTrayNum
);
public
static
void
Open
(
string
[]
iparray
)
{
string
path
=
Application
.
StartupPath
+
@"\logs\rfid\"
;
RFIDManager
.
RfidReader
.
LogPath
=
path
;
// string[] rfidArray = rfidList.ToArray();
//连接rfip
RFIDManager
.
RfidReader
.
Open
(
iparray
);
RfidReader
.
GetValue
+=
RfidReader_GetValue
;
}
private
static
void
RfidReader_GetValue
(
string
s
)
{
LogUtil
.
info
(
"RfidReader_GetValue:"
+
s
);
}
/// <summary>
/// 获取托盘编码
/// </summary>
...
...
@@ -82,7 +100,7 @@ namespace OnlineStore.DeviceLibrary
return
new
RFIDData
(-
1
,
-
1
);
}
public
static
string
GetRFIP
(
int
subType
,
int
rtType
=
0
)
public
static
string
GetRFIP
(
int
subType
,
int
rtType
=
0
)
{
string
ip
=
""
;
string
rtName
=
DeviceConfig
.
RFIP_Str
+
"_"
+
subType
.
ToString
().
PadLeft
(
3
,
'0'
);
...
...
@@ -96,6 +114,11 @@ namespace OnlineStore.DeviceLibrary
}
return
ip
;
}
public
static
void
Close
()
{
RfidReader
.
Close
();
}
}
public
class
RFIDData
{
...
...
source/DeviceLibrary/assemblymanager/S
tore
ServerManager.cs
→
source/DeviceLibrary/assemblymanager/SServerManager.cs
查看文件 @
115f136
...
...
@@ -7,8 +7,68 @@ using System.Threading.Tasks;
namespace
OnlineStore.DeviceLibrary
{
public
class
S
tore
ServerManager
public
class
SServerManager
{
//http://localhost/myproject/service/store/emptyPosForPutin
private
static
string
Addr_PosForPutin
=
"/service/store/emptyPosForPutin"
;
/// <summary>
/// 1 皮带线扫码后调用,用于获取尺寸后升起气缸
/// 地址: /rest/api/qisda/device/getSize
/// 参数: robotIndex=机器人编号,IP为51的机器人为1, 52的机器人为2, 53的机器人为3
/// barcode = 扫到的条码
/// 返回: {"code": 0, "msg":"ok", data:7}
/// code: 0为正常,其他为异常,
/// msg:消息,
/// data:料盘直径,=7时升起气缸
/// </summary>
private
static
string
Addr_GetSize
=
"/rest/api/qisda/device/getSize"
;
/// <summary>
/// 2 料盘流转位置信息更新
/// 地址: /rest/api/qisda/device/updateLocInfo
/// 参数: barcode=料盘的条码
/// status = 状态信息, 移栽 = MOVING, 流水线 = INLINE, 皮带线 = INBELT
/// locInfo=位置信息,移栽时为移栽编号,流水线时为托盘号,皮带线时为皮带线编号,机器人时为机器人编号
///返回: {"code": 0, "msg":"ok", "data":""}
/// code: 0为正常,其他为异常, msg:消息, data:为空
/// </summary>
private
static
string
Addr_updateLocInfo
=
"/rest/api/qisda/device/updateLocInfo"
;
/// <summary>
/// 3 放入料架(A,B,C,D)后调用,根据返回值决定当前料架是否放满,以及后续是否还有任务
// 地址: /rest/api/qisda/device/putShelfFinished
// 参数: barcode=料盘的条码
// rfid = 料架的RFID信息
// rfidLoc=料架的架位信息
// robotIndex = 机器人编号(非机器人放置时不传此参数), IP为51的机器人为1, 52的机器人为2, 53的机器人为3
// 返回: {"code": 0, "msg":"ok", "data":{"rfid":"xxx","smallEmpty":0,"bigEmpty":0, "packageEmpty":0,"cutPackageTask":0,"packageTask":10,"cutTask":10, "smallTask":5, "bigTask":5}
//}
//code: 0为正常,其他为异常,
// msg:消息,
// data:为料架和任务信息
// rfid: 当前料架的RFID
// packageEmpty: 当前料架还可放置的包装料的数量(C料架和A料架有值, 其他料架为0)
// smallEmpty: 当前料架还可放置的小料盘(7x8)的数量(D料架, 其他料架为0)
// bigEmpty:当前料架还可放置的大料盘的数量(C料架, 其他料架为0)
// cutPackageTask:还有多少盘分盘的包装料任务(放到A料架上, 转运到分盘区)
// packageTask:还有多少盘包装料任务(放到A料架上, 并转运到包装线, 最终到C料架)
// cutTask: 还有多少盘分盘料任务(放置到料串B上, 转运到分盘区)
// smallTask: 还有多少盘小料任务(放置到双层线的D料架上)
// bigTask: 还有多少盘大料任务(放置到C料架上)
/// </summary>
private
static
string
Addr_putShelfFinished
=
"/rest/api/qisda/device/putShelfFinished"
;
private
static
string
GetAddr
(
string
addr
)
{
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
);
if
(
server
.
EndsWith
(
"/"
))
{
server
=
server
.
Substring
(
0
,
server
.
Length
-
1
);
}
return
server
+
addr
.
Trim
();
}
//##
private
static
string
spiltStr
=
"%23%23"
;
public
static
string
CodeReceived
(
string
deviceName
,
int
trayNum
,
List
<
string
>
codeList
,
int
height
,
int
width
)
{
...
...
@@ -42,7 +102,7 @@ namespace OnlineStore.DeviceLibrary
// 参数:cids: 多个 cid
//code: 条码内容
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
)
+
"?cids="
+
LineServer
.
GetAllCID
()
+
"&code=%3D"
+
codeStr
;
string
server
=
GetAddr
(
Addr_PosForPutin
)
+
"?cids="
+
LineServer
.
GetAllCID
()
+
"&code=%3D"
+
codeStr
;
LogUtil
.
info
(
deviceName
+
"托盘【"
+
trayNum
+
"】 条码<< "
+
codeStr
+
",获取入库PosID:"
+
server
);
string
resultStr
=
HttpHelper
.
Post
(
server
,
""
);
...
...
@@ -103,4 +163,28 @@ namespace OnlineStore.DeviceLibrary
return
""
;
}
}
public
class
ServerData
{
//返回: {"code": 0, "msg":"ok", "data":{"rfid":"xxx","smallEmpty":0,"bigEmpty":0, "packageEmpty":0,"cutPackageTask":0,"packageTask":10,"cutTask":10, "smallTask":5, "bigTask":5}
public
int
code
{
get
;
set
;
}
public
string
msg
{
get
;
set
;
}
public
string
data
{
get
;
set
;
}
}
public
class
ShelfData
{
// rfid: 当前料架的RFID
// packageEmpty: 当前料架还可放置的包装料的数量(C料架和A料架有值, 其他料架为0)
// smallEmpty: 当前料架还可放置的小料盘(7x8)的数量(D料架, 其他料架为0)
// bigEmpty:当前料架还可放置的大料盘的数量(C料架, 其他料架为0)
// cutPackageTask:还有多少盘分盘的包装料任务(放到A料架上, 转运到分盘区)
// packageTask:还有多少盘包装料任务(放到A料架上, 并转运到包装线, 最终到C料架)
// cutTask: 还有多少盘分盘料任务(放置到料串B上, 转运到分盘区)
// smallTask: 还有多少盘小料任务(放置到双层线的D料架上)
// bigTask: 还有多少盘大料任务(放置到C料架上)
}
}
source/DeviceLibrary/deviceLibrary/RFID/RFIDManager.cs
查看文件 @
115f136
...
...
@@ -41,6 +41,92 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
"ConnectRFIOList出错:"
+
ex
.
ToString
());
}
}
private
static
int
DefaultTrayNum
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
DefaultTrayNum
);
/// <summary>
/// 获取托盘编码
/// </summary>
public
static
int
GetTrayNum
(
int
subType
,
bool
isClear
=
false
)
{
if
(
DefaultTrayNum
>
0
)
{
return
DefaultTrayNum
;
}
// 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
;
}
else
if
(
data
.
RFType
>
0
)
{
LogUtil
.
error
(
"RFID [ "
+
ip
+
" ] 读到数据 "
+
data
.
ToStr
()
+
" 返回盘号 0"
);
}
else
{
LogUtil
.
debug
(
"RFID [ "
+
ip
+
" ] 读到数据 "
+
data
.
ToStr
()
+
" 返回盘号 0"
);
}
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
);
}
public
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
;
}
private
static
bool
isProcess
=
false
;
private
static
DateTime
lastTime
=
DateTime
.
Now
;
...
...
@@ -93,11 +179,6 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
debug
(
"开始连接"
+
logName
+
",尝试重连3次"
);
rfidReader
=
new
Reader
();
// rfidReader.LocalIP = "192.168.100.101";
// rfidReader.RemoteIP = rfid;
//string[] array = rfid.Split('.');
//int index = Convert.ToInt32(array[3]);
bool
result
=
rfidReader
.
Connect
(
rfid
,
true
);
if
(
result
)
{
...
...
@@ -151,11 +232,7 @@ namespace OnlineStore.DeviceLibrary
reader
.
Close
();
}
}
public
static
bool
WriteData
(
string
IP
,
RFIDData
obj
)
{
byte
[]
sendData
=
obj
.
ToData
();
return
WriteData
(
IP
,
sendData
,
3
);
}
public
static
RFIDData
ReadData
(
string
IP
)
{
byte
[]
reviceData
=
ReadData
(
IP
,
3
);
...
...
@@ -165,26 +242,8 @@ namespace OnlineStore.DeviceLibrary
}
return
null
;
}
//public static byte[] ReadData(string IP)
//{
// byte[] reviceData = ReadData(IP, 3);
// return reviceData;
//}
public
static
string
[]
SearchIP
(
string
localIp
)
{
string
[]
ipList
=
null
;
//try
//{
// Reader rfReader = new Reader();
// rfReader.LocalIP = localIp;
// ipList = rfReader.FindIP();
//}
//catch (Exception ex)
//{
//}
return
ipList
;
}
public
static
bool
FindRFID
(
string
IP
)
private
static
bool
FindRFID
(
string
IP
)
{
try
{
...
...
@@ -200,7 +259,7 @@ namespace OnlineStore.DeviceLibrary
}
return
false
;
}
p
ublic
static
byte
[]
ReadData
(
string
IP
,
int
reReadCount
=
1
,
int
startIndex
=
0
,
int
readLength
=
8
)
p
rivate
static
byte
[]
ReadData
(
string
IP
,
int
reReadCount
=
1
,
int
startIndex
=
0
,
int
readLength
=
4
)
{
try
{
...
...
@@ -225,7 +284,7 @@ namespace OnlineStore.DeviceLibrary
}
return
null
;
}
p
ublic
static
bool
WriteData
(
string
IP
,
byte
[]
data
,
int
reWriteCount
=
1
)
p
rivate
static
bool
WriteData
(
string
IP
,
byte
[]
data
,
int
reWriteCount
=
1
)
{
try
{
...
...
@@ -267,15 +326,15 @@ namespace OnlineStore.DeviceLibrary
public
class
RFIDData
{
/// <summary>
/// RFID类型,区分是料架还是托盘,托盘
=E
/// RFID类型,区分是料架还是托盘,托盘
E=69,A=65
/// </summary>
public
char
RFType
=
'E'
;
public
int
RFType
=
0
;
/// <summary>
/// 托盘编号,从1-32
/// </summary>
public
int
Num
=
0
;
public
RFIDData
(
int
num
,
char
t
=
'E'
)
public
RFIDData
(
int
num
,
int
t
)
{
this
.
RFType
=
t
;
this
.
Num
=
num
;
...
...
@@ -285,28 +344,26 @@ namespace OnlineStore.DeviceLibrary
{
try
{
RFType
=(
char
)
data
[
1
];
Num
=
Convert
.
ToInt32
(
data
[
2
]);
if
(
data
!=
null
&&
data
.
Length
>
2
)
{
RFType
=
data
[
1
];
Num
=
Convert
.
ToInt32
(
data
[
2
]);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"RFIP 数据【"
+
data
+
"】 获取编码失败"
);
}
}
public
byte
[]
ToData
(
int
dataLength
=
10
)
public
byte
[]
ToData
()
{
byte
[]
sendData
=
new
byte
[
dataLength
];
for
(
int
i
=
0
;
i
<
sendData
.
Length
;
i
++)
{
sendData
[
i
]
=
0x00
;
}
sendData
[
0
]
=
(
byte
)
RFType
;
sendData
[
1
]
=
(
byte
)
Num
;
return
sendData
;
return
new
byte
[]
{
(
byte
)
RFType
,
(
byte
)
Num
};
}
public
string
ToStr
()
{
return
"
Type=["
+
RFType
+
"],Num=["
+
Num
+
"]
"
;
return
"
["
+
RFType
+
"],["
+
Num
+
"]
"
;
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论