Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-ACPackingStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 5d9fc6fe
由
LN
编写于
2021-09-29 14:14:47 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
修改与服务器通信代码
1 个父辈
386b9dc2
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
90 行增加
和
13 行删除
source/Common/util/HttpHelper.cs
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Shelf.cs
source/DeviceLibrary/ACPackingStore/PackingStoreBean.cs
source/Common/util/HttpHelper.cs
查看文件 @
5d9fc6f
...
...
@@ -17,7 +17,7 @@ using System.Net.NetworkInformation;
namespace
OnlineStore.Common
{
public
class
HttpHelper
{
{
public
static
string
PostAndWait
(
string
url
,
string
paramData
)
{
string
postRes
=
""
;
...
...
@@ -95,7 +95,17 @@ namespace OnlineStore.Common
{
try
{
return
JsonHelper
.
DeserializeJsonToObject
<
Operation
>(
result
);
Operation
resultOP
=
JsonHelper
.
DeserializeJsonToObject
<
Operation
>(
result
);
if
(
resultOP
!=
null
&&
(!
operation
.
seq
.
Equals
(
resultOP
.
seq
)))
{
LogUtil
.
error
(
" seq error : send 【"
+
json
+
"】 "
+
",receive 【 "
+
result
+
"】"
);
}
if
(
resultOP
!=
null
&&
(!
operation
.
cid
.
Equals
(
resultOP
.
cid
)))
{
LogUtil
.
error
(
" cid error : send 【"
+
json
+
"】 "
+
",receive 【 "
+
result
+
"】,return null"
);
return
null
;
}
return
resultOP
;
}
catch
(
Exception
ex
)
{
...
...
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Shelf.cs
查看文件 @
5d9fc6f
...
...
@@ -499,14 +499,12 @@ namespace OnlineStore.DeviceLibrary
lastConTime
=
DateTime
.
Now
;
try
{
//HumitureController.QueryData();
humBean
.
HumidityProcess
(
this
);
if
(
StoreManager
.
IsConnectServer
)
{
SendLineStatus
();
}
////HumitureController.QueryData();
//humBean.HumidityProcess(this);
//if (StoreManager.IsConnectServer)
//{
// SendLineStatus();
//}
}
catch
(
Exception
ex
)
{
...
...
source/DeviceLibrary/ACPackingStore/PackingStoreBean.cs
查看文件 @
5d9fc6f
...
...
@@ -22,8 +22,9 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 灯闪烁定时器
/// </summary>
private
System
.
Timers
.
Timer
ledProcessTimer
=
null
;
private
System
.
Timers
.
Timer
ledProcessTimer
=
null
;
private
System
.
Timers
.
Timer
serverConnectTimer
=
new
System
.
Timers
.
Timer
();
public
Dictionary
<
int
,
AC_BOX_Config
>
BoxConfigMap
{
get
;
set
;
}
public
Dictionary
<
int
,
AC_BOX_Bean
>
BoxMap
=
new
Dictionary
<
int
,
AC_BOX_Bean
>();
...
...
@@ -86,6 +87,7 @@ namespace OnlineStore.DeviceLibrary
mainTimer
.
Enabled
=
true
;
canStart
=
true
;
serverConnectTimer
.
Enabled
=
true
;
//连接AGV调度
AgvClient
.
Init
();
});
...
...
@@ -107,7 +109,13 @@ namespace OnlineStore.DeviceLibrary
ledProcessTimer
.
Interval
=
1000
;
ledProcessTimer
.
Elapsed
+=
LedProcess
;
ledProcessTimer
.
AutoReset
=
true
;
ledProcessTimer
.
Enabled
=
false
;
ledProcessTimer
.
Enabled
=
false
;
serverConnectTimer
=
new
System
.
Timers
.
Timer
();
serverConnectTimer
.
Interval
=
1000
;
serverConnectTimer
.
AutoReset
=
true
;
serverConnectTimer
.
Enabled
=
false
;
serverConnectTimer
.
Elapsed
+=
server_connect_timer_Tick
;
}
private
void
IoCheckTimerProcess
(
object
sender
,
ElapsedEventArgs
e
)
...
...
@@ -155,6 +163,7 @@ namespace OnlineStore.DeviceLibrary
box
.
StartRun
();
}
serverConnectTimer
.
Enabled
=
true
;
ledProcessTimer
.
Enabled
=
true
;
mainTimer
.
Enabled
=
true
;
return
true
;
...
...
@@ -449,5 +458,65 @@ namespace OnlineStore.DeviceLibrary
}
#
endregion
#
region
与服务器通信
private
bool
isInProcess
=
false
;
private
DateTime
lastConTime
=
DateTime
.
Now
;
public
void
server_connect_timer_Tick
(
object
sender
,
EventArgs
e
)
{
if
(
isInProcess
)
{
TimeSpan
span
=
DateTime
.
Now
-
lastConTime
;
if
(
span
.
TotalSeconds
<
10
)
{
return
;
}
else
{
LogUtil
.
error
(
$
"{Name}server_connect_timer_Tick 已耗时{span.TotalSeconds}秒,重新处理"
);
}
}
isInProcess
=
true
;
lastConTime
=
DateTime
.
Now
;
try
{
foreach
(
AC_BOX_Bean
box
in
BoxMap
.
Values
)
{
if
(
box
.
storeRunStatus
.
Equals
(
StoreRunStatus
.
Wait
))
{
continue
;
}
if
((!
box
.
IsDebug
)
&&
StoreManager
.
IsConnectServer
)
{
try
{
box
.
SendLineStatus
();
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
Name
+
"定时给服务器发送消息出错:"
+
ex
.
ToString
());
}
}
box
.
humBean
.
HumidityProcess
(
box
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
Name
+
"server_connect_timer_Tick出错:"
+
ex
.
ToString
());
}
finally
{
isInProcess
=
false
;
}
}
#
endregion
}
}
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论