Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 3547a0c6
由
LN
编写于
2019-10-08 10:07:39 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
179c6ed8
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
62 行增加
和
64 行删除
source/DeviceLibrary/assemblyLine/LineBean.cs
source/DeviceLibrary/assemblyLine/LineBean_Partial.cs
source/DeviceLibrary/assemblyLine/MoveEquip.cs
source/DeviceLibrary/assemblyLine/MoveEquip_Partial.cs
source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
source/DeviceLibrary/server/LineServer.cs
source/DeviceLibrary/assemblyLine/LineBean.cs
查看文件 @
3547a0c
...
...
@@ -377,6 +377,10 @@ namespace OnlineStore.DeviceLibrary
{
return
true
;
}
if
(
MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
).
Equals
(
false
))
{
return
true
;
}
if
(
SW12_MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
).
Equals
(
false
))
{
return
true
;
...
...
source/DeviceLibrary/assemblyLine/LineBean_Partial.cs
查看文件 @
3547a0c
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/assemblyLine/MoveEquip.cs
查看文件 @
3547a0c
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/assemblyLine/MoveEquip_Partial.cs
查看文件 @
3547a0c
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
查看文件 @
3547a0c
...
...
@@ -88,17 +88,13 @@ namespace OnlineStore.DeviceLibrary
{
if
(
balserNameList
.
Contains
(
cameraName
))
{
bool
result
=
BaslerCamera
.
Instance
.
IsOpen
;
if
(!
result
)
{
result
=
BaslerCamera
.
Instance
.
Open
(
cameraName
);
LogUtil
.
info
(
"打开相机:"
+
cameraName
+
"("
+
result
+
")"
);
}
bool
result
=
BaslerCamera
.
Instance
.
Open
(
cameraName
);
// LogUtil.info("打开相机:" + cameraName + "(" + result + ")");
if
(
result
)
{
BaslerCamera
.
Instance
.
GrabOne
();
bitm
=
BaslerCamera
.
Instance
.
Image
;
//
BaslerCamera.Instance.Close();
BaslerCamera
.
Instance
.
Close
();
}
else
{
...
...
@@ -107,17 +103,13 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
hikNameList
.
Contains
(
cameraName
))
{
bool
result
=
HIKCamera
.
Instance
.
IsOpen
;
if
(!
result
)
{
result
=
HIKCamera
.
Instance
.
Open
(
cameraName
);
LogUtil
.
info
(
"打开相机:"
+
cameraName
+
"("
+
result
+
")"
);
}
bool
result
=
HIKCamera
.
Instance
.
Open
(
cameraName
);
// LogUtil.info("打开相机:" + cameraName + "(" + result + ")");
if
(
result
)
{
HIKCamera
.
Instance
.
GrabOne
();
bitm
=
HIKCamera
.
Instance
.
Image
;
//
HIKCamera.Instance.Close();
HIKCamera
.
Instance
.
Close
();
}
else
{
...
...
source/DeviceLibrary/server/LineServer.cs
查看文件 @
3547a0c
...
...
@@ -38,7 +38,8 @@ namespace OnlineStore.DeviceLibrary
{
return
true
;
}
}
return
false
;
}
return
false
;
}
/// <summary>
/// 移栽装置拦截托盘时, 判断是否可以入库,入库执行可以入库,出库过程中不能入库
...
...
@@ -54,7 +55,7 @@ namespace OnlineStore.DeviceLibrary
if
(
span
.
TotalSeconds
<
ClientKeepSecond
&&
box
.
SAlarmType
.
Equals
(
LineAlarmType
.
None
))
{
LineRunStatus
runs
=
(
LineRunStatus
)
box
.
SRunStatus
;
if
(
runs
.
Equals
(
LineRunStatus
.
Runing
))
{
return
true
;
...
...
@@ -74,18 +75,39 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 判断库位是否验证成功
/// </summary>
public
static
bool
RightInPosId
(
int
id
,
string
posId
)
public
static
bool
RightInPosId
(
int
id
,
string
posId
)
{
BoxInfo
box
=
GetBoxInfo
(
id
);
if
(
box
!=
null
)
{
TimeSpan
span
=
DateTime
.
Now
-
box
.
LastMsgTime
;
if
(
span
.
TotalSeconds
<
ClientKeepSecond
)
if
(
span
.
TotalSeconds
<
ClientKeepSecond
)
{
if
(
box
.
WaitInStoreList
!=
null
&&
box
.
WaitInStoreList
.
Contains
(
posId
))
{
return
true
;
}
}
}
}
return
false
;
}
public
static
bool
IsInStorePro
(
int
id
)
{
BoxInfo
box
=
GetBoxInfo
(
id
);
TimeSpan
span
=
DateTime
.
Now
-
box
.
LastMsgTime
;
if
(
box
!=
null
&&
span
.
TotalSeconds
<
ClientKeepSecond
)
{
LineStatus
status
=
(
LineStatus
)
box
.
SStatus
;
LineRunStatus
runs
=
(
LineRunStatus
)
box
.
SRunStatus
;
if
(
runs
.
Equals
(
LineRunStatus
.
Busy
))
{
if
(
status
.
Equals
(
LineStatus
.
InStoreEnd
)
||
status
.
Equals
(
LineStatus
.
InStoreExecute
))
{
return
true
;
}
}
}
return
false
;
...
...
@@ -101,34 +123,13 @@ namespace OnlineStore.DeviceLibrary
if
(
box
!=
null
)
{
TimeSpan
span
=
DateTime
.
Now
-
box
.
LastMsgTime
;
if
(
span
.
TotalSeconds
<
ClientKeepSecond
&&
box
.
HasTray
.
Equals
(
0
)&&
box
.
SAlarmType
.
Equals
(
LineAlarmType
.
None
)
)
if
(
span
.
TotalSeconds
<
ClientKeepSecond
&&
box
.
HasTray
.
Equals
(
0
)
&&
box
.
SAlarmType
.
Equals
(
LineAlarmType
.
None
)
)
{
LineRunStatus
runs
=
(
LineRunStatus
)
box
.
SRunStatus
;
if
(
runs
.
Equals
(
LineRunStatus
.
Runing
))
{
return
true
;
}
}
}
return
false
;
}
public
static
bool
IsInStorePro
(
int
id
)
{
BoxInfo
box
=
GetBoxInfo
(
id
);
TimeSpan
span
=
DateTime
.
Now
-
box
.
LastMsgTime
;
if
(
box
!=
null
&&
span
.
TotalSeconds
<
ClientKeepSecond
)
{
LineStatus
status
=
(
LineStatus
)
box
.
SStatus
;
LineRunStatus
runs
=
(
LineRunStatus
)
box
.
SRunStatus
;
if
(
runs
.
Equals
(
LineRunStatus
.
Busy
))
{
if
(
status
.
Equals
(
LineStatus
.
InStoreEnd
)
||
status
.
Equals
(
LineStatus
.
InStoreExecute
))
{
return
true
;
}
}
}
...
...
@@ -147,7 +148,7 @@ namespace OnlineStore.DeviceLibrary
if
(
span
.
TotalSeconds
<
ClientKeepSecond
)
{
if
(
LineManager
.
Line
.
CanIntore
(
box
.
ID
))
{
{
result
+=
box
.
CId
+
","
;
}
}
...
...
@@ -176,7 +177,7 @@ namespace OnlineStore.DeviceLibrary
}
}
public
static
void
StopServer
()
{
try
...
...
@@ -192,15 +193,15 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
LOGGER
,
"关闭 监听出错:"
+
ex
.
ToString
());
}
}
public
static
bool
UpdateBoxDebug
(
int
id
,
int
isDebug
)
public
static
bool
UpdateBoxDebug
(
int
id
,
int
isDebug
)
{
if
(
ClientMap
.
ContainsKey
(
id
))
{
Dictionary
<
string
,
object
>
paramList
=
new
Dictionary
<
string
,
object
>();
Dictionary
<
string
,
object
>
paramList
=
new
Dictionary
<
string
,
object
>();
paramList
.
Add
(
S_Cmd
,
cmd_updateDebug
);
int
canOutStore
=
LineManager
.
Line
.
CanOutStore
(
id
)
?
1
:
0
;
paramList
.
Add
(
S_CanOutStore
,
canOutStore
);
paramList
.
Add
(
S_IsDebug
,
isDebug
);
paramList
.
Add
(
S_IsDebug
,
isDebug
);
string
msg
=
ToParamStr
(
paramList
);
Client
client
=
ClientMap
[
id
];
bool
result
=
SendStrToClient
(
client
,
msg
);
...
...
@@ -228,7 +229,7 @@ namespace OnlineStore.DeviceLibrary
bool
result
=
SendStrToClient
(
client
,
msg
);
if
(!
result
)
{
LogUtil
.
error
(
"StartInStore【"
+
id
+
"】【"
+
msg
+
"】失败"
);
LogUtil
.
error
(
"StartInStore【"
+
id
+
"】【"
+
msg
+
"】失败"
);
}
}
return
false
;
...
...
@@ -236,7 +237,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 获取整个料仓的状态
/// </summary>
public
static
Operation
GetInStoreOperation
(
string
message
)
public
static
Operation
GetInStoreOperation
(
string
message
)
{
//构建发送给服务器的对象
Operation
lineOperation
=
new
Operation
();
...
...
@@ -273,21 +274,22 @@ namespace OnlineStore.DeviceLibrary
}
else
{
// LogUtil.info("CheckInStorePos【" + id + "】【" + msg + "】发送成功");
// LogUtil.info("CheckInStorePos【" + id + "】【" + msg + "】发送成功");
}
}
}
catch
(
Exception
ex
)
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"CheckInStorePos【"
+
id
+
"】【"
+
param
.
ToStr
()
+
"】失败"
);
}
return
false
;
}
private
static
bool
SendStrToClient
(
Client
client
,
string
sendMsg
)
private
static
bool
SendStrToClient
(
Client
client
,
string
sendMsg
)
{
if
(
client
!=
null
&&
client
.
ClientSocket
.
Connected
)
{
...
...
@@ -296,7 +298,7 @@ namespace OnlineStore.DeviceLibrary
client
.
ClientSocket
.
Send
(
sendBuffer
);
return
true
;
}
return
false
;
}
private
static
string
ToParamStr
(
Dictionary
<
string
,
object
>
paramList
)
...
...
@@ -306,7 +308,7 @@ namespace OnlineStore.DeviceLibrary
return
result
+
"\r"
;
}
private
static
object
MapLock
=
""
;
private
static
void
SaveBoxClient
(
int
id
,
BoxInfo
box
,
Client
client
)
private
static
void
SaveBoxClient
(
int
id
,
BoxInfo
box
,
Client
client
)
{
lock
(
MapLock
)
{
...
...
@@ -324,19 +326,19 @@ namespace OnlineStore.DeviceLibrary
}
}
private
static
void
tcp_ReviceMsgEvent
(
Client
client
,
string
msg
)
{
{
try
{
if
(
String
.
IsNullOrEmpty
(
msg
))
{
return
;
}
ProcessMsg
(
client
,
msg
);
ProcessMsg
(
client
,
msg
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"处理料仓消息【"
+
msg
+
"】出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"处理料仓消息【"
+
msg
+
"】出错:"
+
ex
.
ToString
());
}
}
...
...
@@ -349,14 +351,14 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
debug
(
"收到【"
+
add
+
"】的消息【"
+
msg
+
"】"
);
StoreSendBean
storeSMsg
=
JsonHelper
.
DeserializeJsonToObject
<
StoreSendBean
>(
msg
);
if
(
storeSMsg
==
null
)
if
(
storeSMsg
==
null
)
{
LogUtil
.
error
(
"收到【"
+
add
+
"】的消息【"
+
msg
+
"】,解析失败"
);
}
else
{
int
id
=
storeSMsg
.
StoreId
;
BoxInfo
box
=
new
BoxInfo
(
storeSMsg
.
StoreId
,
storeSMsg
.
Cid
,
storeSMsg
.
Seq
,
storeSMsg
.
SStatus
,
storeSMsg
.
SRunStatus
,
storeSMsg
.
DoorHasTray
,
storeSMsg
.
AlarmType
,
storeSMsg
.
WaitInStoreList
);
BoxInfo
box
=
new
BoxInfo
(
storeSMsg
.
StoreId
,
storeSMsg
.
Cid
,
storeSMsg
.
Seq
,
storeSMsg
.
SStatus
,
storeSMsg
.
SRunStatus
,
storeSMsg
.
DoorHasTray
,
storeSMsg
.
AlarmType
,
storeSMsg
.
WaitInStoreList
);
SaveBoxClient
(
id
,
box
,
client
);
string
cmd
=
storeSMsg
.
Cmd
;
...
...
@@ -385,16 +387,16 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
"SendHeartBack【"
+
id
+
"】【"
+
msg
+
"】失败"
);
}
return
true
;
}
return
false
;
}
private
static
char
cmd_spilt
=
';'
;
private
static
char
cmd_spilt
=
';'
;
private
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
string
cmd_updateDebug
=
"updateDebug"
;
public
static
string
cmd_checStartIn
=
"cmd_checStartIn"
;
...
...
@@ -444,4 +446,4 @@ namespace OnlineStore.DeviceLibrary
public
List
<
string
>
WaitInStoreList
=
new
List
<
string
>();
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论