Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-ACPackingStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 5f25134d
由
LN
编写于
2020-01-05 13:27:15 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
rfid修改
1 个父辈
4fdbf97d
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
60 行增加
和
276 行删除
dll/RFID/RFIDLibrary.dll
source/ACPackingStore/App.config
source/ACPackingStore/FrmBox.cs
source/ACPackingStore/FrmRFIPEdit.cs
source/ACPackingStore/FrmStore.cs
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Partial.cs
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/device/RFID/RFIDManager.cs
source/DeviceLibrary/lineConnect/LineConnect.cs
dll/RFID/RFIDLibrary.dll
0 → 100644
查看文件 @
5f25134
此文件类型无法预览
source/ACPackingStore/App.config
查看文件 @
5f25134
...
@@ -66,6 +66,25 @@
...
@@ -66,6 +66,25 @@
<
conversionPattern
value
=
"[%date][%t]%-5p %m%n"
/>
<
conversionPattern
value
=
"[%date][%t]%-5p %m%n"
/>
</
layout
>
</
layout
>
</
appender
>
</
appender
>
<
appender
name
=
"TheRFID"
type
=
"log4net.Appender.RollingFileAppender"
>
<
file
value
=
"logs/TheRFID.log"
/>
<
param
name
=
"Encoding"
value
=
"UTF-8"
/>
<
appendToFile
value
=
"true"
/>
<
rollingStyle
value
=
"Date"
/>
<
datePattern
value
=
"yyyy-MM-dd"
/>
<
layout
type
=
"log4net.Layout.PatternLayout"
>
<
conversionPattern
value
=
"[%date][%t]%-5p %m%n"
/>
</
layout
>
</
appender
>
<
logger
name
=
"RollingLogFileAppender"
>
<
level
value
=
"Info"
/>
<
appender
-
ref
ref
=
"RollingLogFileAppender"
/>
</
logger
>
<
logger
name
=
"TheRFID"
>
<
level
value
=
"Debug"
/>
<
appender
-
ref
ref
=
"TheRFID"
/>
</
logger
>
<
root
>
<
root
>
<
level
value
=
"Info"
/>
<
level
value
=
"Info"
/>
<
appender
-
ref
ref
=
"RollingLogFileAppender"
/>
<
appender
-
ref
ref
=
"RollingLogFileAppender"
/>
...
...
source/ACPackingStore/FrmBox.cs
查看文件 @
5f25134
...
@@ -852,7 +852,7 @@ namespace OnlineStore.ACPackingStore
...
@@ -852,7 +852,7 @@ namespace OnlineStore.ACPackingStore
ioIndex
=
BoxBean
.
Config
.
DIList
[
IO_Type
.
Compress_Check
].
GetIOAddr
();
ioIndex
=
BoxBean
.
Config
.
DIList
[
IO_Type
.
Compress_Check
].
GetIOAddr
();
}
}
FrmPositionTool
frm
=
new
FrmPositionTool
(
PortName
,
slvAddr
,
ioIP
,
ioIndex
,
Text
,
BoxBean
.
DeviceID
);
FrmPositionTool
frm
=
new
FrmPositionTool
(
PortName
,
slvAddr
,
ioIP
,
ioIndex
,
Text
,
BoxBean
.
DeviceID
);
frm
.
ShowDialog
();
frm
.
ShowDialog
();
}
}
private
void
btnSaveCom_Click
(
object
sender
,
EventArgs
e
)
private
void
btnSaveCom_Click
(
object
sender
,
EventArgs
e
)
...
...
source/ACPackingStore/FrmRFIPEdit.cs
查看文件 @
5f25134
...
@@ -65,7 +65,7 @@ namespace OnlineStore.ACPackingStore
...
@@ -65,7 +65,7 @@ namespace OnlineStore.ACPackingStore
string
resul
=
""
;
string
resul
=
""
;
if
(
data
!=
null
)
if
(
data
!=
null
)
{
{
resul
=
data
.
To
Str
();
resul
=
data
.
Num
Str
();
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
)
...
...
source/ACPackingStore/FrmStore.cs
查看文件 @
5f25134
...
@@ -473,7 +473,14 @@ namespace OnlineStore.ACPackingStore
...
@@ -473,7 +473,14 @@ namespace OnlineStore.ACPackingStore
private
void
logBox_VisibleChanged
(
object
sender
,
EventArgs
e
)
private
void
logBox_VisibleChanged
(
object
sender
,
EventArgs
e
)
{
{
LogUtil
.
UpdateLogbox
();
if
(
logBox
.
Visible
)
{
if
(
LogUtil
.
logBox
==
null
)
{
LogUtil
.
logBox
=
logBox
;
LogUtil
.
UpdateLogbox
();
}
}
}
}
}
}
}
}
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Partial.cs
查看文件 @
5f25134
...
@@ -284,7 +284,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -284,7 +284,7 @@ namespace OnlineStore.DeviceLibrary
private
void
UpdateShelfId
()
private
void
UpdateShelfId
()
{
{
//读取RFID
//读取RFID
RFIDData
data
=
RFIDManager
.
ReadRFID
(
Config
.
RFID_IP
);
RFIDData
data
=
RFIDManager
.
ReadRFID
(
Config
.
RFID_IP
,
true
);
//TODO 判断料架是否正确
//TODO 判断料架是否正确
if
(
data
.
RFType
.
Equals
(
"A"
))
if
(
data
.
RFType
.
Equals
(
"A"
))
{
{
...
@@ -293,7 +293,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -293,7 +293,7 @@ namespace OnlineStore.DeviceLibrary
}
}
else
else
{
{
LogUtil
.
error
(
Name
+
"检测到入料口有料架,读取RFID数据错误:"
+
data
.
To
Str
());
LogUtil
.
error
(
Name
+
"检测到入料口有料架,读取RFID数据错误:"
+
data
.
Num
Str
());
// return;
// return;
}
}
}
}
...
@@ -856,9 +856,9 @@ namespace OnlineStore.DeviceLibrary
...
@@ -856,9 +856,9 @@ namespace OnlineStore.DeviceLibrary
{
{
LineStop
();
LineStop
();
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_08_LocationUp
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_08_LocationUp
);
InOutStoreLog
(
moveName
+
MoveInfo
.
SLog
+
"线体停止转动,定位装置上升"
);
InOutStoreLog
(
moveName
+
MoveInfo
.
SLog
+
"线体停止转动,定位装置上升
,读取料架编号
"
);
// CylinderMove(MoveInfo, IO_Type.LocationCylinder_Down, IO_Type.LocationCylinder_Up);
// CylinderMove(MoveInfo, IO_Type.LocationCylinder_Down, IO_Type.LocationCylinder_Up);
UpdateShelfId
();
if
(!
instoreShelf
)
if
(!
instoreShelf
)
{
{
InOutStoreLog
(
"出库 "
+
MoveInfo
.
SLog
+
":叉子进入库位中, 进出轴至P3(库位取放料点) "
);
InOutStoreLog
(
"出库 "
+
MoveInfo
.
SLog
+
":叉子进入库位中, 进出轴至P3(库位取放料点) "
);
...
@@ -1190,7 +1190,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1190,7 +1190,7 @@ namespace OnlineStore.DeviceLibrary
Task
.
Factory
.
StartNew
(
delegate
Task
.
Factory
.
StartNew
(
delegate
{
{
int
posLoc
=
ShelfPosList
.
IndexOf
(
MoveInfo
.
MoveParam
.
ShelfPosID
);
int
posLoc
=
ShelfPosList
.
IndexOf
(
MoveInfo
.
MoveParam
.
ShelfPosID
);
string
msg
=
StoreManager
.
PutShelfFinished
(
Name
,
MoveInfo
.
MoveParam
.
WareCode
,
LastShelfData
.
To
Str
(),
posLoc
.
ToString
(),
out
serverShelfData
);
string
msg
=
StoreManager
.
PutShelfFinished
(
Name
,
MoveInfo
.
MoveParam
.
WareCode
,
LastShelfData
.
Num
Str
(),
posLoc
.
ToString
(),
out
serverShelfData
);
if
(
String
.
IsNullOrEmpty
(
msg
).
Equals
(
false
))
if
(
String
.
IsNullOrEmpty
(
msg
).
Equals
(
false
))
{
{
LogUtil
.
error
(
Name
+
"【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】【"
+
LastShelfData
+
"】【"
+
posLoc
+
"】PutShelfFinished 结果:"
+
msg
);
LogUtil
.
error
(
Name
+
"【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】【"
+
LastShelfData
+
"】【"
+
posLoc
+
"】PutShelfFinished 结果:"
+
msg
);
...
...
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
5f25134
...
@@ -39,15 +39,11 @@
...
@@ -39,15 +39,11 @@
<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\RFID\Asa.RFID.dll</HintPath>
</Reference>
<Reference Include="Client">
<Reference Include="Client">
<HintPath>..\..\dll\Client.dll</HintPath>
<HintPath>..\..\dll\Client.dll</HintPath>
</Reference>
</Reference>
<Reference Include="CodeLibrary, Version=1.0.6995.29021, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="CodeLibrary">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
<HintPath>..\..\..\RC1250-AssemblyLine\dll\CodeLibrary.dll</HintPath>
</Reference>
</Reference>
<Reference Include="halcondotnet">
<Reference Include="halcondotnet">
<HintPath>..\..\..\RC32-SZBOSCH-ACSingleStore\dll\halcondotnet.dll</HintPath>
<HintPath>..\..\..\RC32-SZBOSCH-ACSingleStore\dll\halcondotnet.dll</HintPath>
...
@@ -56,6 +52,9 @@
...
@@ -56,6 +52,9 @@
<SpecificVersion>False</SpecificVersion>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath>
<HintPath>..\..\dll\log4net.dll</HintPath>
</Reference>
</Reference>
<Reference Include="RFIDLibrary">
<HintPath>..\..\dll\RFID\RFIDLibrary.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing" />
...
...
source/DeviceLibrary/device/RFID/RFIDManager.cs
查看文件 @
5f25134
...
@@ -12,34 +12,32 @@ using System.Windows.Forms;
...
@@ -12,34 +12,32 @@ using System.Windows.Forms;
namespace
OnlineStore.DeviceLibrary
namespace
OnlineStore.DeviceLibrary
{
{
public
class
RFIDManager
public
class
RFIDManager
{
{
public
static
ReaderAll
RfidReader
=
new
Asa
.
RFID
.
ReaderAll
();
public
static
void
Open
(
string
[]
iparray
)
public
static
void
Open
(
string
[]
iparray
)
{
{
string
path
=
Application
.
StartupPath
+
@"\logs\rfid\"
;
RFIDReader
.
Open
(
null
,
iparray
);
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
);
}
}
public
static
RFIDData
ReadRFID
(
string
ip
,
bool
isClear
=
false
)
public
static
RFIDData
ReadRFID
(
string
ip
,
bool
isClear
=
false
)
{
{
try
try
{
{
if
(
String
.
IsNullOrEmpty
(
ip
).
Equals
(
false
)
)
if
(
String
.
IsNullOrEmpty
(
ip
).
Equals
(
false
))
{
{
RFIDData
data
=
new
RFIDData
(
RfidReader
.
Read
(
ip
))
;
byte
[]
bdata
=
null
;
if
(
isClear
)
if
(
isClear
)
{
{
RfidReader
.
Clear
(
ip
);
bdata
=
RFIDReader
.
ReadAndClear
(
ip
);
}
else
{
bdata
=
RFIDReader
.
Read
(
ip
);
}
}
if
(
bdata
==
null
)
{
LogUtil
.
error
(
"RFID [ "
+
ip
+
" ] 读到数据=null"
);
}
RFIDData
data
=
new
RFIDData
(
bdata
);
return
data
;
return
data
;
}
}
}
}
...
@@ -50,12 +48,12 @@ namespace OnlineStore.DeviceLibrary
...
@@ -50,12 +48,12 @@ namespace OnlineStore.DeviceLibrary
return
new
RFIDData
(-
1
,
-
1
);
return
new
RFIDData
(-
1
,
-
1
);
}
}
public
static
void
Close
()
public
static
void
Close
()
{
{
try
try
{
{
R
fidReader
.
Close
();
R
FIDReader
.
CloseAll
();
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -100,11 +98,9 @@ namespace OnlineStore.DeviceLibrary
...
@@ -100,11 +98,9 @@ namespace OnlineStore.DeviceLibrary
{
{
return
new
byte
[]
{
(
byte
)
RFType
,
(
byte
)
Num
};
return
new
byte
[]
{
(
byte
)
RFType
,
(
byte
)
Num
};
}
}
public
string
To
Str
()
public
string
Num
Str
()
{
{
return
""
+
RFType
+
""
+
Num
.
ToString
().
PadLeft
(
2
,
'0'
)
+
""
;
return
""
+
RFType
+
""
+
Num
.
ToString
().
PadLeft
(
2
,
'0'
)
+
""
;
}
}
}
}
}
}
source/DeviceLibrary/lineConnect/LineConnect.cs
deleted
100644 → 0
查看文件 @
4fdbf97
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
namespace
OnlineStore.DeviceLibrary
{
public
class
LineConnect
{
private
static
int
ClientKeepSecond
=
10
;
private
static
TcpClient
client
=
null
;
public
static
List
<
string
>
WaitInStoreList
=
new
List
<
string
>();
public
static
void
StartConnect
()
{
string
lineServer
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
LineServerIp
);
int
linePort
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
LineServerPort
);
if
(
lineServer
.
Equals
(
""
))
{
LogUtil
.
error
(
"未配置流水线地址,不需要连接"
);
return
;
}
client
=
new
TcpClient
();
bool
result
=
client
.
StartConnect
(
lineServer
,
linePort
,
HandlerMsg
,
2000
);
}
public
static
void
StopConnect
()
{
if
(
client
!=
null
)
{
client
.
close
();
}
}
private
static
int
seq
=
1
;
public
static
int
nextSeq
()
{
if
(
seq
.
Equals
(
Int32
.
MaxValue
))
{
LogUtil
.
info
(
"seq当前值:"
+
seq
+
",重置seq=0"
);
seq
=
0
;
}
Interlocked
.
Increment
(
ref
seq
);
return
seq
;
}
public
static
void
SendHeart
(
StoreSendBean
store
)
{
if
(
client
==
null
)
{
return
;
}
try
{
store
.
Cmd
=
cmd_heart
;
string
heartMsg
=
ToParamStr
(
store
);
client
.
send
(
heartMsg
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"SendHeart 出错:"
+
ex
.
ToString
());
}
}
private
static
DateTime
LastOutStoreEndTime
=
DateTime
.
Now
;
public
static
void
OutStoreEnd
(
StoreSendBean
store
)
{
if
(
client
==
null
)
{
return
;
}
try
{
LastOutStoreEndTime
=
DateTime
.
Now
;
store
.
Cmd
=
cmd_outend
;
string
msg
=
ToParamStr
(
store
);
LogUtil
.
info
(
"OutStoreEnd:"
+
msg
);
client
.
send
(
msg
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"OutStoreEnd 出错:"
+
ex
.
ToString
());
}
}
private
static
string
ToParamStr
(
StoreSendBean
store
)
{
return
JsonHelper
.
SerializeObject
(
store
)+
"\r"
;
}
//private static string ToParamStr(List<object> paramList)
//{
// string result = "";
// foreach (object str in paramList)
// {
// result += str + cmd_spilt.ToString();
// }
// return result + "\r";
//}
private
static
void
HandlerMsg
(
string
message
)
{
try
{
message
=
message
.
Replace
(
"\r"
,
""
);
StoreReviceBean
reviceInfo
=
JsonHelper
.
DeserializeJsonToObject
<
StoreReviceBean
>(
message
);
//string[] msgArray = message.Split(cmd_spilt);
if
(
reviceInfo
==
null
)
{
LogUtil
.
debug
(
"收到消息:"
+
message
+
",解析失败"
);
}
else
{
string
cmd
=
reviceInfo
.
Cmd
;
CanOutStore
=
reviceInfo
.
CanOutStore
.
Equals
(
1
);
LastUpdateTime
=
DateTime
.
Now
;
if
(
cmd
.
Equals
(
cmd_startIn
))
{
LogUtil
.
info
(
"收到流水线入库消息:"
+
message
);
StoreManager
.
Store
.
ReviceLineInStoreCMD
(
reviceInfo
.
PosId
,
reviceInfo
.
PlateH
,
reviceInfo
.
PlateW
,
reviceInfo
.
WareCode
);
}
else
if
(
cmd
.
Equals
(
cmd_updateDebug
))
{
int
isDebug
=
reviceInfo
.
IsDebug
;
LogUtil
.
info
(
"收到流水线更改调试状态="
+
isDebug
);
StoreManager
.
Store
.
IsDebug
=
isDebug
.
Equals
(
1
)
?
true
:
false
;
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
IsInDebug
,
isDebug
);
LogUtil
.
info
(
"切换调试状态= "
+
isDebug
+
";"
);
}
else
if
(
cmd
.
Equals
(
cmd_checStartIn
))
{
LogUtil
.
info
(
"收到流水线入库库位验证消息:"
+
message
);
//if (LineConnect.WaitInStoreList.Contains(reviceInfo.PosId))
//{
// LogUtil.error(" LineConnect.WaitInStoreList已存在库位【" + reviceInfo.PosId + "】先移除在验证");
// LineConnect.WaitInStoreList.Remove(reviceInfo.PosId);
//}
bool
result
=
StoreManager
.
Store
.
ReviceLineCheckInStoreCMD
(
reviceInfo
.
PosId
,
reviceInfo
.
PlateH
,
reviceInfo
.
PlateW
,
reviceInfo
.
WareCode
);
if
(
result
&&
(!
WaitInStoreList
.
Contains
(
reviceInfo
.
PosId
)))
{
LineConnect
.
WaitInStoreList
.
Add
(
reviceInfo
.
PosId
);
}
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"处理流水线消息【"
+
message
+
"】出错:"
+
ex
.
ToString
()
);
}
}
public
static
char
cmd_spilt
=
';'
;
public
static
string
cmd_heart
=
"heart"
;
private
static
string
cmd_outend
=
"outend"
;
private
static
string
cmd_startIn
=
"starIn"
;
private
static
string
cmd_updateDebug
=
"updateDebug"
;
private
static
bool
CanOutStore
=
false
;
public
static
DateTime
LastUpdateTime
=
new
DateTime
(
0
);
public
static
string
cmd_checStartIn
=
"cmd_checStartIn"
;
public
static
bool
IsConnect
()
{
if
(
client
==
null
)
{
return
false
;
}
if
(
client
.
IsRun
()&&
client
.
IsConnected
())
{
return
true
;
}
return
false
;
}
public
static
bool
CanStartOut
()
{
TimeSpan
span
=
DateTime
.
Now
-
LastUpdateTime
;
if
(
span
.
TotalSeconds
<
ClientKeepSecond
&&
CanOutStore
)
{
return
true
;
}
return
false
;
}
/// <summary>
/// 是否可以重发消息
/// </summary>
/// <returns></returns>
public
static
bool
CanReSend
()
{
TimeSpan
span
=
DateTime
.
Now
-
LastOutStoreEndTime
;
if
(
span
.
TotalSeconds
>
8
)
{
return
true
;
}
return
false
;
}
}
public
class
StoreReviceBean
{
public
string
Cmd
=
""
;
public
int
CanOutStore
=
0
;
public
string
PosId
=
""
;
public
string
PlateH
=
"0"
;
public
string
PlateW
=
"0"
;
public
string
WareCode
=
""
;
public
int
IsDebug
=
0
;
}
public
class
StoreSendBean
{
public
StoreSendBean
(
int
id
,
string
cid
,
int
ss
,
int
runs
,
int
doorHasTray
,
int
alarmType
)
{
this
.
StoreId
=
id
;
this
.
Cid
=
cid
;
this
.
SStatus
=
ss
;
this
.
SRunStatus
=
runs
;
this
.
DoorHasTray
=
doorHasTray
;
this
.
AlarmType
=
alarmType
;
this
.
Seq
=
LineConnect
.
nextSeq
();
this
.
WaitInStoreList
=
new
List
<
string
>(
LineConnect
.
WaitInStoreList
);
// WaitInStoreList.Add("1#AC1_1_1");
}
public
string
Cmd
=
LineConnect
.
cmd_heart
;
public
int
StoreId
=
0
;
public
string
Cid
=
""
;
public
int
Seq
=
0
;
public
int
SStatus
=
0
;
public
int
SRunStatus
=
0
;
public
int
DoorHasTray
=
0
;
public
int
AlarmType
=
0
;
public
string
PosId
=
""
;
public
string
PlateH
=
"0"
;
public
string
PlateW
=
"0"
;
public
List
<
string
>
WaitInStoreList
=
new
List
<
string
>();
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论