Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO1057_XLC_Store
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 60bd1e2b
由
张东亮
编写于
2025-09-10 13:13:18 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
738ee324
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
38 行增加
和
24 行删除
DeviceLibrary/theMachine/RobotManage.cs
DeviceLibrary/theMachine/RobotManage.cs
查看文件 @
60bd1e2
...
...
@@ -19,7 +19,7 @@ namespace DeviceLibrary
public
static
bool
IsLoadOk
=
true
;
public
static
bool
IsConfigMode
=
false
;
public
static
bool
InoutDebugMode
=
false
;
public
delegate
void
LoadFinish
(
bool
state
,
string
msg
);
public
delegate
void
LoadFinish
(
bool
state
,
string
msg
);
public
static
event
LoadFinish
LoadFinishEvent
;
public
static
event
EventHandler
<
bool
>
UserPauseSet
;
...
...
@@ -31,20 +31,27 @@ namespace DeviceLibrary
public
static
List
<
HumitureController
>
humitureControllers
=
new
List
<
HumitureController
>();
public
static
double
averageHumidity
()
{
return
humitureControllers
.
FindAll
(
s
=>
s
.
LastData
.
Humidity
>
0
).
Average
(
x
=>
x
.
LastData
.
Humidity
);
var
ss
=
humitureControllers
.
FindAll
(
s
=>
s
.
LastData
.
Humidity
>
0
);
if
(
ss
!=
null
&&
ss
.
Count
>
0
)
return
ss
.
Average
(
x
=>
x
.
LastData
.
Humidity
);
return
0
;
}
public
static
double
averageTemp
()
{
return
humitureControllers
.
FindAll
(
s
=>
s
.
LastData
.
Temperate
>
0
).
Average
(
x
=>
x
.
LastData
.
Temperate
);
var
ss
=
humitureControllers
.
FindAll
(
s
=>
s
.
LastData
.
Temperate
>
0
);
if
(
ss
!=
null
&&
ss
.
Count
>
0
)
return
ss
.
Average
(
x
=>
x
.
LastData
.
Temperate
);
return
0
;
}
public
static
HIKCamera
CameraA
=
new
HIKCamera
();
public
static
HIKCamera
CameraB
=
new
HIKCamera
();
public
static
void
Init
()
{
public
static
HIKCamera
CameraA
=
new
HIKCamera
();
public
static
HIKCamera
CameraB
=
new
HIKCamera
();
public
static
void
Init
()
{
string
msg
=
""
;
try
{
mainMachine
=
null
;
mainMachine
=
null
;
string
configFile
=
Path
.
Combine
(
baseDir
,
"config\\Config.csv"
);
Config
=
new
Robot_Config
(
0
,
""
,
configFile
);
Config
=
(
Robot_Config
)
CSVConfigReader
.
LoadConfig
(
Config
);
...
...
@@ -56,7 +63,8 @@ namespace DeviceLibrary
LogUtil
.
info
(
"加载位置文件:"
+
positionConfigFile
);
CSVPositionReader
<
ACStorePosition
>.
ReloadCSVFile
(
positionConfigFile
);
}
else
{
else
{
IsLoadOk
=
false
;
msg
+=
"找不到库位配置文件\n"
;
}
...
...
@@ -70,16 +78,17 @@ namespace DeviceLibrary
msg
+=
"IO板卡初始化失败\n"
;
}
var
hports
=
Setting_Init
.
Device_Humiture_Port
.
Val
.
Split
(
','
);
foreach
(
var
p
in
hports
)
{
foreach
(
var
p
in
hports
)
{
var
hc
=
new
HumitureController
();
if
(!
hc
.
Init
(
p
))
{
LogUtil
.
info
(
"尝试打开端口:"
+
p
+
" 失败"
);
LogUtil
.
info
(
"尝试打开端口:"
+
p
+
" 失败"
);
IsLoadOk
=
false
;
msg
+=
"温湿度传感器初始化失败,端口:"
+
$
"{p}\n"
;
}
else
{
else
{
LogUtil
.
info
(
"尝试打开端口:"
+
p
+
" 成功"
);
humitureControllers
.
Add
(
hc
);
}
...
...
@@ -102,22 +111,25 @@ namespace DeviceLibrary
if
(!
CameraB
.
LoadCameraConfig
(
"CameraB"
,
out
errmsg
))
{
//IsLoadOk = false;
msg
+=
errmsg
+
"\r\n"
;
msg
+=
errmsg
+
"\r\n"
;
}
//IOManager.IOMove(IO_Type.Device_Led, IO_VALUE.HIGH);
//IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
LoadFinishEvent
?.
Invoke
(
IsConfigMode
?
IsConfigMode
:
IsLoadOk
,
msg
);
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
LoadFinishEvent
?.
Invoke
(
false
,
ex
.
Message
);
LogUtil
.
error
(
ex
.
Message
+
ex
.
StackTrace
);
LogUtil
.
error
(
ex
.
Message
+
ex
.
StackTrace
);
return
;
}
}
public
static
void
LoadDebug
()
{
public
static
void
LoadDebug
()
{
LoadFinishEvent
?.
Invoke
(
true
,
"打开调试模式"
);
}
public
static
void
Start
()
{
public
static
void
Start
()
{
//Init();
if
(!
IsLoadOk
)
{
...
...
@@ -130,20 +142,21 @@ namespace DeviceLibrary
isRunning
=
true
;
GC
.
KeepAlive
(
mainThread
);
Task
.
Run
(()=>
{
Task
.
Run
(()
=>
{
AxisBean
.
List
.
ForEach
((
x
)
=>
{
AxisManager
.
AlarmClear
(
x
.
Config
.
DeviceName
,
x
.
Config
.
GetAxisValue
());
});
Task
.
Delay
(
1000
).
Wait
();
if
(
mainMachine
.
DeviceCheck
())
mainMachine
.
BeginHomeReset
(
true
);
});
}
public
static
void
Stop
()
{
LogUtil
.
info
(
"开始停止系统."
);
mainMachine
.
Stop
();
mainMachine
.
UserPause
=
false
;
//IOManager.CloseAllConnection();
...
...
@@ -160,14 +173,15 @@ namespace DeviceLibrary
}
public
static
void
UserPause
(
bool
userpause
)
{
UserPause
(
""
,
userpause
,
false
);
UserPause
(
""
,
userpause
,
false
);
}
public
static
void
UserPause
(
string
msg
=
""
,
bool
userpause
=
true
,
bool
upload
=
true
)
{
public
static
void
UserPause
(
string
msg
=
""
,
bool
userpause
=
true
,
bool
upload
=
true
)
{
if
(
userpause
)
{
if
(
string
.
IsNullOrEmpty
(
msg
))
if
(
string
.
IsNullOrEmpty
(
msg
))
{
if
(
upload
)
if
(
upload
)
{
Msg
.
add
(
"用户暂停"
,
MsgLevel
.
critical
);
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论