Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
Qisda-SO1037-AGVDispatch
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit fac119ae
由
张东亮
编写于
2021-12-01 09:23:14 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
V1
1 个父辈
2f437d22
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
33 个修改的文件
包含
450 行增加
和
219 行删除
AGVDispatch/App.config
AGVDispatch/FrmMain.Designer.cs
AGVDispatch/Manual.cs
AGVDispatch/log4net.config
Common/SettingString.cs
DeviceLibrary/Config/XmlConfigOperation.cs
DeviceLibrary/Config/agvinfos.xml
DeviceLibrary/Config/taskinfos - 副本.xml
DeviceLibrary/Config/taskinfos.xml
DeviceLibrary/bean/Node.cs
DeviceLibrary/bean/Task.cs
DeviceLibrary/bean/agv/Agv_Info.cs
DeviceLibrary/bean/agv/Scope.cs
DeviceLibrary/bean/job/ChargeJob.cs
DeviceLibrary/bean/job/F1LiftToStoreJob.cs
DeviceLibrary/bean/job/F1StoreToLiftJob.cs
DeviceLibrary/bean/job/Job.cs
DeviceLibrary/bean/job/SendToLinesWithBackJob.cs
DeviceLibrary/bean/job/StandyJob.cs
DeviceLibrary/bean/jobType/ChargeJobType.cs
DeviceLibrary/bean/jobType/F1LiftToStoreJobType.cs
DeviceLibrary/bean/jobType/F1StoreToLiftJobType.cs
DeviceLibrary/bean/jobType/LineToLineJobType.cs
DeviceLibrary/bean/jobType/SendToLinesWithBackJobType.cs
DeviceLibrary/bean/jobType/StoreToLinesWithBackJobType.cs
DeviceLibrary/lift/LiftContext.cs
DeviceLibrary/manager/AGVManager.cs
DeviceLibrary/manager/AgvTaskManager.cs
DeviceLibrary/manager/HttpManager.cs
DeviceLibrary/manager/MissionManager.cs
DeviceLibrary/manager/NodeManager.cs
DeviceLibrary/manager/UploadManager.cs
DeviceLibrary/service/Service.cs
AGVDispatch/App.config
查看文件 @
fac119a
...
...
@@ -15,7 +15,7 @@
<!--
ITS
智能物流系统服务端口-->
<
add
key
=
"ITS_UpdateLine"
value
=
"http://127.0.0.1:8888"
/>
<!--电梯控制系统系统服务端口-->
<
add
key
=
"Lift_
GetState"
value
=
"http://127.0.0.1:8888/lift/status
"
/>
<
add
key
=
"Lift_
Server"
value
=
"http://127.0.0.1:8888/lift/
"
/>
<!--日志配置文件名-->
<
add
key
=
"log4net_configname"
value
=
"log4net.config"
/>
<!--
agv
配置文件名-->
...
...
AGVDispatch/FrmMain.Designer.cs
查看文件 @
fac119a
...
...
@@ -31,6 +31,9 @@
System
.
ComponentModel
.
ComponentResourceManager
resources
=
new
System
.
ComponentModel
.
ComponentResourceManager
(
typeof
(
FrmMain
));
this
.
tableLayoutPanel3
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
tabControl1
=
new
System
.
Windows
.
Forms
.
TabControl
();
this
.
tabPage2
=
new
System
.
Windows
.
Forms
.
TabPage
();
this
.
tableLayoutPanel1
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
richTextBox1
=
new
System
.
Windows
.
Forms
.
RichTextBox
();
this
.
tabPage1
=
new
System
.
Windows
.
Forms
.
TabPage
();
this
.
tableLayoutPanel2
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
DgvNode
=
new
System
.
Windows
.
Forms
.
DataGridView
();
...
...
@@ -40,11 +43,7 @@
this
.
grpUnlock
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
tblLayoutUnlock
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
dgvInfos
=
new
System
.
Windows
.
Forms
.
DataGridView
();
this
.
tabPage2
=
new
System
.
Windows
.
Forms
.
TabPage
();
this
.
tableLayoutPanel1
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
richTextBox1
=
new
System
.
Windows
.
Forms
.
RichTextBox
();
this
.
tabPage3
=
new
System
.
Windows
.
Forms
.
TabPage
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
label12
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
groupBox2
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
tabControlManual
=
new
System
.
Windows
.
Forms
.
TabControl
();
...
...
@@ -52,6 +51,8 @@
this
.
flowLayoutPanel1
=
new
System
.
Windows
.
Forms
.
FlowLayoutPanel
();
this
.
tableLayoutPanel3
.
SuspendLayout
();
this
.
tabControl1
.
SuspendLayout
();
this
.
tabPage2
.
SuspendLayout
();
this
.
tableLayoutPanel1
.
SuspendLayout
();
this
.
tabPage1
.
SuspendLayout
();
this
.
tableLayoutPanel2
.
SuspendLayout
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
DgvNode
)).
BeginInit
();
...
...
@@ -61,8 +62,6 @@
this
.
grpUnlock
.
SuspendLayout
();
this
.
tblLayoutUnlock
.
SuspendLayout
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
dgvInfos
)).
BeginInit
();
this
.
tabPage2
.
SuspendLayout
();
this
.
tableLayoutPanel1
.
SuspendLayout
();
this
.
tabPage3
.
SuspendLayout
();
this
.
groupBox2
.
SuspendLayout
();
this
.
tableLayoutPanel4
.
SuspendLayout
();
...
...
@@ -99,6 +98,41 @@
this
.
tabControl1
.
TabIndex
=
7
;
this
.
tabControl1
.
SelectedIndexChanged
+=
new
System
.
EventHandler
(
this
.
tabControl1_SelectedIndexChanged
);
//
// tabPage2
//
this
.
tabPage2
.
Controls
.
Add
(
this
.
tableLayoutPanel1
);
this
.
tabPage2
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
22
);
this
.
tabPage2
.
Name
=
"tabPage2"
;
this
.
tabPage2
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
3
);
this
.
tabPage2
.
Size
=
new
System
.
Drawing
.
Size
(
1201
,
347
);
this
.
tabPage2
.
TabIndex
=
3
;
this
.
tabPage2
.
Text
=
"日志"
;
this
.
tabPage2
.
UseVisualStyleBackColor
=
true
;
//
// tableLayoutPanel1
//
this
.
tableLayoutPanel1
.
ColumnCount
=
1
;
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
100F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Absolute
,
20F
));
this
.
tableLayoutPanel1
.
Controls
.
Add
(
this
.
richTextBox1
,
0
,
0
);
this
.
tableLayoutPanel1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
tableLayoutPanel1
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
);
this
.
tableLayoutPanel1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
2
);
this
.
tableLayoutPanel1
.
Name
=
"tableLayoutPanel1"
;
this
.
tableLayoutPanel1
.
RowCount
=
1
;
this
.
tableLayoutPanel1
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
100F
));
this
.
tableLayoutPanel1
.
Size
=
new
System
.
Drawing
.
Size
(
1195
,
341
);
this
.
tableLayoutPanel1
.
TabIndex
=
6
;
//
// richTextBox1
//
this
.
richTextBox1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
richTextBox1
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
);
this
.
richTextBox1
.
Name
=
"richTextBox1"
;
this
.
richTextBox1
.
Size
=
new
System
.
Drawing
.
Size
(
1189
,
335
);
this
.
richTextBox1
.
TabIndex
=
7
;
this
.
richTextBox1
.
Text
=
""
;
//
// tabPage1
//
this
.
tabPage1
.
Controls
.
Add
(
this
.
tableLayoutPanel2
);
...
...
@@ -226,44 +260,8 @@
this
.
dgvInfos
.
Size
=
new
System
.
Drawing
.
Size
(
1179
,
292
);
this
.
dgvInfos
.
TabIndex
=
0
;
//
// tabPage2
//
this
.
tabPage2
.
Controls
.
Add
(
this
.
tableLayoutPanel1
);
this
.
tabPage2
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
22
);
this
.
tabPage2
.
Name
=
"tabPage2"
;
this
.
tabPage2
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
3
);
this
.
tabPage2
.
Size
=
new
System
.
Drawing
.
Size
(
1201
,
347
);
this
.
tabPage2
.
TabIndex
=
3
;
this
.
tabPage2
.
Text
=
"日志"
;
this
.
tabPage2
.
UseVisualStyleBackColor
=
true
;
//
// tableLayoutPanel1
//
this
.
tableLayoutPanel1
.
ColumnCount
=
1
;
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
100F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Absolute
,
20F
));
this
.
tableLayoutPanel1
.
Controls
.
Add
(
this
.
richTextBox1
,
0
,
0
);
this
.
tableLayoutPanel1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
tableLayoutPanel1
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
);
this
.
tableLayoutPanel1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
2
);
this
.
tableLayoutPanel1
.
Name
=
"tableLayoutPanel1"
;
this
.
tableLayoutPanel1
.
RowCount
=
1
;
this
.
tableLayoutPanel1
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
100F
));
this
.
tableLayoutPanel1
.
Size
=
new
System
.
Drawing
.
Size
(
1195
,
341
);
this
.
tableLayoutPanel1
.
TabIndex
=
6
;
//
// richTextBox1
//
this
.
richTextBox1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
richTextBox1
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
);
this
.
richTextBox1
.
Name
=
"richTextBox1"
;
this
.
richTextBox1
.
Size
=
new
System
.
Drawing
.
Size
(
1189
,
335
);
this
.
richTextBox1
.
TabIndex
=
7
;
this
.
richTextBox1
.
Text
=
""
;
//
// tabPage3
//
this
.
tabPage3
.
Controls
.
Add
(
this
.
button1
);
this
.
tabPage3
.
Controls
.
Add
(
this
.
label12
);
this
.
tabPage3
.
Controls
.
Add
(
this
.
groupBox2
);
this
.
tabPage3
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
22
);
...
...
@@ -274,16 +272,6 @@
this
.
tabPage3
.
Text
=
"手动"
;
this
.
tabPage3
.
UseVisualStyleBackColor
=
true
;
//
// button1
//
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
300
,
71
);
this
.
button1
.
Name
=
"button1"
;
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button1
.
TabIndex
=
47
;
this
.
button1
.
Text
=
"button1"
;
this
.
button1
.
UseVisualStyleBackColor
=
true
;
this
.
button1
.
Click
+=
new
System
.
EventHandler
(
this
.
button1_Click
);
//
// label12
//
this
.
label12
.
BackColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
255
)))),
((
int
)(((
byte
)(
224
)))),
((
int
)(((
byte
)(
192
)))));
...
...
@@ -355,6 +343,8 @@
this
.
Load
+=
new
System
.
EventHandler
(
this
.
FrmMain_Load
);
this
.
tableLayoutPanel3
.
ResumeLayout
(
false
);
this
.
tabControl1
.
ResumeLayout
(
false
);
this
.
tabPage2
.
ResumeLayout
(
false
);
this
.
tableLayoutPanel1
.
ResumeLayout
(
false
);
this
.
tabPage1
.
ResumeLayout
(
false
);
this
.
tableLayoutPanel2
.
ResumeLayout
(
false
);
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
DgvNode
)).
EndInit
();
...
...
@@ -365,8 +355,6 @@
this
.
grpUnlock
.
PerformLayout
();
this
.
tblLayoutUnlock
.
ResumeLayout
(
false
);
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
dgvInfos
)).
EndInit
();
this
.
tabPage2
.
ResumeLayout
(
false
);
this
.
tableLayoutPanel1
.
ResumeLayout
(
false
);
this
.
tabPage3
.
ResumeLayout
(
false
);
this
.
groupBox2
.
ResumeLayout
(
false
);
this
.
tableLayoutPanel4
.
ResumeLayout
(
false
);
...
...
@@ -389,7 +377,6 @@
private
System
.
Windows
.
Forms
.
FlowLayoutPanel
flowLayoutPanel1
;
private
System
.
Windows
.
Forms
.
TabControl
tabControlManual
;
private
System
.
Windows
.
Forms
.
DataGridView
DgvNode
;
private
System
.
Windows
.
Forms
.
Button
button1
;
private
System
.
Windows
.
Forms
.
TabPage
tabPage4
;
private
System
.
Windows
.
Forms
.
GroupBox
groupBox1
;
private
System
.
Windows
.
Forms
.
TableLayoutPanel
tableLayoutPanel5
;
...
...
AGVDispatch/Manual.cs
查看文件 @
fac119a
...
...
@@ -27,7 +27,7 @@ namespace AGVControl
private
void
Manual_Load
(
object
sender
,
EventArgs
e
)
{
lblInfo
.
Text
=
string
.
Format
(
"[{0}]"
,
Agv
.
IP
);
AgvTaskManager
.
InitView
(
cmbBxMission
);
AgvTaskManager
.
InitView
(
cmbBxMission
,
Agv
);
InState
.
AddRange
(
new
PictureBox
[]
{
pictureBox1
,
pictureBox2
,
pictureBox3
,
pictureBox4
});
OutState
.
AddRange
(
new
PictureBox
[]
{
pictureBox5
,
pictureBox6
,
pictureBox7
,
pictureBox8
});
timer1
.
Enabled
=
true
;
...
...
@@ -57,11 +57,11 @@ namespace AGVControl
}
}
}
if
(
Agv
.
IOStatus
[
2
]!=
null
&&
Agv
.
IOStatus
[
2
].
Inputs
!=
null
)
if
(
Agv
.
IOStatus
[
0
]!=
null
&&
Agv
.
IOStatus
[
0
].
Inputs
!=
null
)
{
for
(
int
i
=
0
;
i
<
Agv
.
IOStatus
[
2
].
Inputs
.
Length
;
i
++)
for
(
int
i
=
0
;
i
<
Agv
.
IOStatus
[
0
].
Inputs
.
Length
;
i
++)
{
if
(
Agv
.
Get
Input
(
2
,
i
))
if
(
Agv
.
Get
Output
(
0
,
i
))
{
OutState
[
i
].
Image
=
AGVDispatch
.
Properties
.
Resources
.
green1
;
}
...
...
@@ -90,7 +90,17 @@ namespace AGVControl
ChargePileManager
.
StopCharge
(
Agv
);
if
(
Agv
.
IsCon
)
{
LogUtil
.
info
(
$
"取消自动任务,当前任务信息是:{Agv.Msg}"
);
LogUtil
.
info
(
$
"取消自动任务,当前运行信息是:{Agv.Msg}"
);
try
{
if
(
Agv
.
CurJob
!=
null
&&
Agv
.
CurJob
.
JobParam
!=
null
&&
Agv
.
CurJob
.
JobParam
.
GetMissionInfo
()
!=
null
)
{
DeviceLibrary
.
manager
.
MissionManager
.
SetMissionState
(
Agv
.
CurJob
.
JobParam
.
GetMissionInfo
(),
DeviceLibrary
.
service
.
model
.
MissionState
.
中止
);
LogUtil
.
info
(
$
"取消自动任务,当前任务信息是:{Common.JsonHelper.SerializeObject(Agv.CurJob.JobParam.GetMissionInfo())}"
);
}
}
catch
{
}
Agv
.
CurJob
=
null
;
//MiR_API.Del_Mission(Agv);
//添加Init任务
...
...
@@ -167,7 +177,7 @@ namespace AGVControl
{
if
(
Agv
.
IsCon
)
{
DeviceLibrary
.
AgvTask
task
=
AgvTaskManager
.
GetTaskBy
Id
((
cmbBxMission
.
SelectedItem
as
DeviceLibrary
.
AgvTask
).
Id
);
DeviceLibrary
.
AgvTask
task
=
AgvTaskManager
.
GetTaskBy
Name
((
cmbBxMission
.
SelectedItem
as
DeviceLibrary
.
AgvTask
).
Name
,
Agv
);
if
(
task
.
Type
.
Equals
(
TaskType
.
InOut
))
if
(
MessageBox
.
Show
(
"确定对小车发送进/出任务?"
,
Agv
.
Name
,
MessageBoxButtons
.
YesNo
)
==
DialogResult
.
No
)
return
;
...
...
AGVDispatch/log4net.config
查看文件 @
fac119a
...
...
@@ -39,8 +39,8 @@
<
conversionPattern
value
=
"[%date][%t][%c:%L]%-5p %m%n"
/>
</
layout
>
</
appender
>
<
appender
name
=
"
FixtureServices
"
type
=
"log4net.Appender.RollingFileAppender"
>
<
file
value
=
"logs/Service/Records.log"
/>
<
appender
name
=
"
WebService
"
type
=
"log4net.Appender.RollingFileAppender"
>
<
file
value
=
"logs/
Web
Service/Records.log"
/>
<
param
name
=
"Encoding"
value
=
"UTF-8"
/>
<
appendToFile
value
=
"true"
/>
<
param
name
=
"MaxSizeRollBackups"
value
=
"30"
/>
...
...
@@ -75,17 +75,32 @@
<
conversionPattern
value
=
"%m%n"
/>
</
layout
>
</
appender
>
<
appender
name
=
"MissionManager"
type
=
"log4net.Appender.RollingFileAppender"
>
<
file
value
=
"logs/MissionManager/MissionManager.log"
/>
<
param
name
=
"Encoding"
value
=
"UTF-8"
/>
<
appendToFile
value
=
"true"
/>
<
param
name
=
"MaxSizeRollBackups"
value
=
"30"
/>
<
rollingStyle
value
=
"Date"
/>
<
datePattern
value
=
"yyyy-MM-dd"
/>
<
layout
type
=
"log4net.Layout.PatternLayout"
>
<
conversionPattern
value
=
"%m%n"
/>
</
layout
>
</
appender
>
<
logger
name
=
"MissionManager"
>
<
level
value
=
"info"
/>
<
appender
-
ref
ref
=
"MissionManager"
/>
</
logger
>
<
logger
name
=
"MiR_API"
>
<
level
value
=
"
MiR_API
"
/>
<
level
value
=
"
info
"
/>
<
appender
-
ref
ref
=
"MiR_API"
/>
</
logger
>
<
logger
name
=
"RunLog"
>
<
level
value
=
"Info"
/>
<
appender
-
ref
ref
=
"RunLog"
/>
</
logger
>
<
logger
name
=
"
FixtureServices
"
>
<
logger
name
=
"
WebService
"
>
<
level
value
=
"Info"
/>
<
appender
-
ref
ref
=
"
FixtureServices
"
/>
<
appender
-
ref
ref
=
"
WebService
"
/>
</
logger
>
<
logger
name
=
"AgvServer"
>
<
level
value
=
"Info"
/>
...
...
Common/SettingString.cs
查看文件 @
fac119a
...
...
@@ -63,7 +63,7 @@ namespace Common
public
const
string
httpServer
=
"http.server"
;
public
const
string
log4net_configname
=
"log4net_configname"
;
public
const
string
ITS_UpdateLine
=
"ITS_UpdateLine"
;
public
const
string
Lift_
GetState
=
"Lift_GetState
"
;
public
const
string
Lift_
Server
=
"Lift_Server
"
;
public
const
string
AppIdentity
=
"AppIdentity"
;
public
const
string
Lift_Names
=
"Lift_Names"
;
#
endregion
...
...
DeviceLibrary/Config/XmlConfigOperation.cs
查看文件 @
fac119a
...
...
@@ -24,7 +24,6 @@ namespace DeviceLibrary.manager
XmlReader
xmlReader
=
XmlReader
.
Create
(
File_AgvInfo
,
xmlReaderSettings
);
doc
.
Load
(
xmlReader
);
XmlNode
xn
=
doc
.
SelectSingleNode
(
"agvs"
);
XmlNodeList
xnl
=
xn
.
ChildNodes
;
foreach
(
XmlNode
node
in
xnl
)
{
...
...
@@ -66,9 +65,8 @@ namespace DeviceLibrary.manager
}
xmlReader
.
Close
();
isLoadAgv
=
true
;
LogUtil
.
info
(
$
"加载Agv配置成功{File_AgvInfo}"
);
LogUtil
.
info
(
$
"加载Agv配置成功
:
{File_AgvInfo}"
);
}
public
static
void
SetAgvIsUse
(
AgvInfo
agv
)
{
if
(!
isLoadAgv
)
return
;
...
...
@@ -78,7 +76,7 @@ namespace DeviceLibrary.manager
string
strPath
=
string
.
Format
(
"/agvs/agv[@id=\"{0}\"]"
,
agv
.
ID
);
XmlElement
selectXe
=
(
XmlElement
)
xe
.
SelectSingleNode
(
strPath
);
//selectSingleNode 根据XPath表达式,获得符合条件的第一个节点.
//selectXe.SetAttribute("Type", dgvBookInfo.CurrentRow.Cells[0].Value.ToString());//也可以通过SetAttribute来增加一个属性
selectXe
.
GetElementsByTagName
(
"
IsUse
"
).
Item
(
0
).
InnerText
=
agv
.
Auto
.
ToString
();
selectXe
.
GetElementsByTagName
(
"
Auto
"
).
Item
(
0
).
InnerText
=
agv
.
Auto
.
ToString
();
xmlDoc
.
Save
(
File_AgvInfo
);
}
...
...
@@ -138,26 +136,31 @@ namespace DeviceLibrary.manager
XmlReader
xmlReader
=
XmlReader
.
Create
(
File_AgvTaskInfo
,
xmlReaderSettings
);
doc
.
Load
(
xmlReader
);
XmlNode
xn
=
doc
.
SelectSingleNode
(
"tasks"
);
XmlNodeList
xnl
=
xn
.
ChildNodes
;
foreach
(
XmlNode
xnode
in
xnl
)
{
// nodeInfo.Add(new Node(id, name, ip, alicename, nodeType, area, isUse));
AgvTask
node
=
new
AgvTask
();
// 将节点转换为元素,便于得到节点的属性值
XmlElement
xe
=
(
XmlElement
)
xnode
;
// 得到属性的属性值
node
.
Id
=
int
.
Parse
(
xe
.
GetAttribute
(
"id"
));
// 得到节点的所有子节点
XmlNodeList
xnl0
=
xe
.
ChildNodes
;
node
.
Name
=
xnl0
.
Item
(
0
).
InnerText
;
node
.
AliceName
=
xnl0
.
Item
(
1
).
InnerText
;
node
.
Guid
=
xnl0
.
Item
(
2
).
InnerText
;
node
.
Type
=
(
TaskType
)
Enum
.
Parse
(
typeof
(
TaskType
),
xnl0
.
Item
(
3
).
InnerText
);
tasks
.
Add
(
node
);
XmlNodeList
xnls
=
xnode
.
ChildNodes
;
foreach
(
XmlNode
item
in
xnls
)
{
AgvTask
node
=
new
AgvTask
();
// 将节点转换为元素,便于得到节点的属性值
XmlElement
xe
=
(
XmlElement
)
xnode
;
node
.
TypeId
=
xe
.
GetAttribute
(
"id"
);
// 得到属性的属性值
XmlElement
itemxe
=
(
XmlElement
)
item
;
node
.
Id
=
int
.
Parse
(
itemxe
.
GetAttribute
(
"id"
));
// 得到节点的所有子节点
XmlNodeList
xnl0
=
itemxe
.
ChildNodes
;
node
.
Name
=
xnl0
.
Item
(
0
).
InnerText
;
node
.
AliceName
=
xnl0
.
Item
(
1
).
InnerText
;
node
.
Guid
=
xnl0
.
Item
(
2
).
InnerText
;
node
.
Type
=
(
TaskType
)
Enum
.
Parse
(
typeof
(
TaskType
),
xnl0
.
Item
(
3
).
InnerText
);
tasks
.
Add
(
node
);
}
}
xmlReader
.
Close
();
LogUtil
.
info
(
$
"加载任务配置成功{File_AgvTaskInfo}"
);
LogUtil
.
info
(
$
"加载任务配置成功
:
{File_AgvTaskInfo}"
);
}
public
static
void
LoadChargePileInfos
(
bean
.
ChargePiles
chargePiles
)
...
...
@@ -197,7 +200,7 @@ namespace DeviceLibrary.manager
chargePiles
.
AddPile
(
node
);
}
xmlReader
.
Close
();
LogUtil
.
info
(
$
"加载充电桩配置成功{File_ChargePileInfo}"
);
LogUtil
.
info
(
$
"加载充电桩配置成功
:
{File_ChargePileInfo}"
);
}
}
}
DeviceLibrary/Config/agvinfos.xml
查看文件 @
fac119a
<?xml version="1.0" encoding="utf-8"?>
<agvs>
<agv
id=
"
49"
ip=
"10.85.199.81
"
>
<name>
1
号车
</name>
<agv
id=
"
20"
ip=
"10.85.199.68
"
>
<name>
2
号车
</name>
<!--职责范围-->
<Scope>
<Workshop>
4D
</Workshop>
<!--可执行的任务: 无,
治具,
PCB,
Tray盘,
PCBA,
包材,
静电箱,
半成品,
成品,
台车,
垃圾-->
<!--可执行的任务:
无,
PCB领用 = 1,
Tray领用 = 2,
包材领用 = 4,
半成品领用,
静电箱领用,
空台车领用,
空台车归还,
成品入库,
半成品入库,
半成品入库与领用,
垃圾清运
-->
<Tasks>
<Task>
PCB
</Task>
<Task>
Tray盘
</Task>
<Task>
PCB
领用
</Task>
<Task>
半成品领用
</Task>
</Tasks>
<!--使用的电梯,多个电梯使用逗号隔开-->
<Remark>
LIFT_D2
</Remark>
...
...
@@ -32,25 +35,28 @@
<IO_GUID
index=
"0"
>
6ad07e3a-e0e9-11eb-a184-0001299981d4
</IO_GUID>
</IO_GUIDs>
</agv>
<agv
id=
"
50"
ip=
"10.85.199.82
"
>
<name>
2
号车
</name>
<agv
id=
"
7"
ip=
"10.85.199.73
"
>
<name>
7
号车
</name>
<!--职责范围-->
<Scope>
<Workshop>
4D
</Workshop>
<!--可执行的任务: 无,
治具,
PCB,
Tray盘,
PCBA,
包材,
静电箱,
半成品,
成品,
台车,
垃圾-->
<!--可执行的任务:
无,
PCB领用 = 1,
Tray领用 = 2,
包材领用 = 4,
半成品领用,
静电箱领用,
空台车领用,
空台车归还,
成品入库,
半成品入库,
半成品入库与领用,
垃圾清运
-->
<Tasks>
<Task>
PCB
</Task>
<Task>
Tray盘
</Task>
<Task>
PCB
领用
</Task>
<Task>
半成品领用
</Task>
</Tasks>
<!--使用的电梯,多个电梯使用逗号隔开-->
<Remark>
LIFT_D2
</Remark>
...
...
@@ -64,4 +70,39 @@
<IO_GUID
index=
"0"
>
6ad07e3a-e0e9-11eb-a184-0001299981d4
</IO_GUID>
</IO_GUIDs>
</agv>
<agv
id=
"17"
ip=
"10.85.199.64"
>
<name>
17号车
</name>
<!--职责范围-->
<Scope>
<Workshop>
3D
</Workshop>
<!--可执行的任务:
无,
PCB领用 = 1,
Tray领用 = 2,
包材领用 = 4,
半成品领用,
静电箱领用,
空台车领用,
空台车归还,
成品入库,
半成品入库,
半成品入库与领用,
垃圾清运
-->
<Tasks>
<Task>
PCB领用
</Task>
<Task>
半成品领用
</Task>
</Tasks>
<!--使用的电梯,多个电梯使用逗号隔开-->
<Remark>
LIFT_D2
</Remark>
</Scope>
<!--是否自动-->
<Auto>
False
</Auto>
<UseFleet>
true
</UseFleet>
<FleetIp>
10.85.199.140
</FleetIp>
<Authorization>
Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==
</Authorization>
<IO_GUIDs>
<IO_GUID
index=
"0"
>
6ad07e3a-e0e9-11eb-a184-0001299981d4
</IO_GUID>
</IO_GUIDs>
</agv>
</agvs>
\ No newline at end of file
DeviceLibrary/Config/taskinfos - 副本.xml
0 → 100644
查看文件 @
fac119a
此文件的差异被折叠,
点击展开。
DeviceLibrary/Config/taskinfos.xml
查看文件 @
fac119a
此文件的差异被折叠,
点击展开。
DeviceLibrary/bean/Node.cs
查看文件 @
fac119a
...
...
@@ -26,7 +26,7 @@ namespace DeviceLibrary
/// <summary>
/// 节点IP
/// </summary>
public
string
IP
{
get
;
set
;
}
public
string
IP
{
get
;
set
;
}
=
""
;
/// <summary>
/// 在线状态
/// </summary>
...
...
DeviceLibrary/bean/Task.cs
查看文件 @
fac119a
...
...
@@ -33,6 +33,10 @@ namespace DeviceLibrary
/// </summary>
public
TaskType
Type
{
get
;
set
;
}
/// <summary>
/// 任务类型ID
/// </summary>
public
string
TypeId
{
get
;
set
;
}
/// <summary>
/// 任务
/// </summary>
/// <param name="name">任务名称</param>
...
...
DeviceLibrary/bean/agv/Agv_Info.cs
查看文件 @
fac119a
...
...
@@ -35,6 +35,16 @@ namespace DeviceLibrary
/// </summary>
public
string
Authorization
{
set
;
get
;
}
/// <summary>
/// 系统标识
/// </summary>
public
string
Client
{
get
{
if
(
Scope
!=
null
)
{
return
$
"{Common.AppConfigHelper.GetValue(SettingString.AppIdentity)}-{Scope.Workshop}-{Name}"
;
}
else
return
Name
;
}
}
/// <summary>
/// 责任范围
/// </summary>
public
Scope
Scope
{
get
;
set
;
}
...
...
@@ -175,6 +185,26 @@ namespace DeviceLibrary
ErrorMsg
=
""
;
}
/// <summary>
/// 是否有空料车在电梯中准备送出
/// </summary>
/// <param name="liftname"></param>
/// <returns></returns>
public
bool
HasEmptyShelfInLift
(
out
string
liftname
,
out
lift
.
LiftStatus
liftStatus
)
{
liftname
=
""
;
liftStatus
=
null
;
string
[]
lifts
=
Scope
.
Remark
.
Split
(
','
);
foreach
(
string
item
in
lifts
)
{
if
(
lift
.
LiftContext
.
HasShelfNeedLeave
(
item
,
Client
,
out
liftStatus
))
{
liftname
=
item
;
return
true
;
}
}
return
false
;
}
/// <summary>
/// 任务重发
/// </summary>
public
void
Resend
()
...
...
@@ -305,7 +335,10 @@ namespace DeviceLibrary
if
(
this
.
CurJob
!=
null
)
{
Msg
=
this
.
CurJob
.
runInfo
;
if
(
CurJob
.
JobParam
.
GetMissionInfo
()==
null
)
StateKanban
.
ShowInfo
(
"任务信息"
,
this
.
CurJob
.
RunInfo
);
else
StateKanban
.
ShowInfo
(
"任务信息"
,
string
.
Format
(
"[{0}]{1}"
,
CurJob
.
JobParam
.
GetMissionInfo
().
missionId
,
this
.
CurJob
.
RunInfo
));
}
}
DateTime
agvErrorStartTime
=
DateTime
.
MaxValue
;
...
...
@@ -456,7 +489,7 @@ namespace DeviceLibrary
{
isAlarm
=
true
;
SetErrorMsg
(
"状态:"
+
StateID
.
ToString
(),
(
DateTime
.
Now
-
offlineStartTime
).
TotalMinutes
.
ToString
(
"f2"
));
msglist
.
Add
(
new
AlarmMsg
(
Name
,
"lineAgv."
+
Name
+
".Msg"
,
"状态:"
+
StateID
.
ToString
()));
msglist
.
Add
(
new
AlarmMsg
(
Name
,
"lineAgv."
+
Name
+
".Msg"
,
StateID
.
ToString
()));
}
if
(!
isAlarm
&&
StandTimeOut
)
...
...
DeviceLibrary/bean/agv/Scope.cs
查看文件 @
fac119a
...
...
@@ -37,29 +37,5 @@ namespace DeviceLibrary.bean.agv
/// </summary>
public
string
Remark
{
get
;
set
;
}
/// <summary>
/// 任务系统标识
/// </summary>
public
string
client
{
get
{
return
Workshop
;
}
}
/// <summary>
/// 是否有空料车在电梯中准备送出
/// </summary>
/// <param name="liftname"></param>
/// <returns></returns>
public
bool
HasEmptyShelfInLift
(
out
string
liftname
,
out
lift
.
LiftStatus
liftStatus
)
{
liftname
=
""
;
liftStatus
=
null
;
string
[]
lifts
=
Remark
.
Split
(
','
);
foreach
(
string
item
in
lifts
)
{
if
(
lift
.
LiftContext
.
HasShelfNeedLeave
(
item
,
client
,
out
liftStatus
))
{
liftname
=
item
;
return
true
;
}
}
return
false
;
}
}
}
DeviceLibrary/bean/job/ChargeJob.cs
查看文件 @
fac119a
...
...
@@ -30,14 +30,14 @@ namespace DeviceLibrary
{
runInfo
=
$
"无空闲充电桩,从"
+
JobParam
.
SrcNode
+
"回到待机位"
;
JobRunStep
.
Msg
=
runInfo
;
return
new
StandyJob
(
new
JobParam
(
JobParam
.
CurTargetNode
.
ToCopy
(),
manager
.
NodeManager
.
GetNodeByType
(
NodeType
.
Standby
)));
return
new
StandyJob
(
new
JobParam
(
JobParam
.
SrcNode
.
ToCopy
(
)));
}
else
{
JobRunStep
.
ToNextStep
(
RunStep
.
CHARGE_WAIT_REACH_CHARGE
);
runInfo
=
$
"当前电量{agv.Battery}小于最大电量{BatteryMax},从{JobParam.SrcNode}去
充电桩
{charge.AliceName}"
;
runInfo
=
$
"当前电量{agv.Battery}小于最大电量{BatteryMax},从{JobParam.SrcNode}去{charge.AliceName}"
;
JobRunStep
.
Msg
=
runInfo
;
AllocateTask
(
agv
,
charge
.
Guid
);
AllocateTask
(
agv
,
charge
);
ChargePileManager
.
StartCharge
(
agv
,
charge
.
Name
);
}
}
...
...
@@ -85,7 +85,7 @@ namespace DeviceLibrary
runInfo
=
"充电完成"
;
JobRunStep
.
Msg
=
runInfo
;
JobRunStep
.
EndJob
();
return
new
StandyJob
(
new
JobParam
(
JobParam
.
CurTarget
Node
.
ToCopy
()));
return
new
StandyJob
(
new
JobParam
(
JobParam
.
Src
Node
.
ToCopy
()));
}
else
if
(
agv
.
Battery
>=
ChargePileManager
.
GetChargePiles
().
BatteryMin
)
{
...
...
DeviceLibrary/bean/job/F1LiftToStoreJob.cs
查看文件 @
fac119a
...
...
@@ -74,7 +74,7 @@ namespace DeviceLibrary.bean.job
MissionManager
.
SetMissionState
(
JobParam
.
GetMissionInfo
().
missionId
,
service
.
model
.
MissionState
.
返回离开电梯
,
out
string
msg
);
JobRunStep
.
Msg
=
runInfo
;
//关门
lift
.
LiftContext
.
CloseDoor
(
JobParam
.
SrcNode
.
Name
);
lift
.
LiftContext
.
CloseDoor
(
JobParam
.
SrcNode
.
Name
,
agv
);
}
}
else
if
(
JobRunStep
.
IsStep
(
RunStep
.
S1F_LiftToStore_05_CloseLiftDoor
))
...
...
DeviceLibrary/bean/job/F1StoreToLiftJob.cs
查看文件 @
fac119a
...
...
@@ -67,7 +67,7 @@ namespace DeviceLibrary
{
if
(
lift
.
LiftContext
.
IsDoorOpen
(
JobParam
.
CurTargetNode
.
Name
,
JobParam
.
GetMissionInfo
().
sourceFloor
))
{
if
(
lift
.
LiftContext
.
HasShelfNeedLeave
(
JobParam
.
CurTargetNode
.
Name
,
agv
.
Scope
.
c
lient
,
out
lift
.
LiftStatus
liftStatus
))
if
(
lift
.
LiftContext
.
HasShelfNeedLeave
(
JobParam
.
CurTargetNode
.
Name
,
agv
.
C
lient
,
out
lift
.
LiftStatus
liftStatus
))
{
JobRunStep
.
ToNextStep
(
RunStep
.
S1F_StoreToLift_05_01_ToTemp1
);
runInfo
=
$
"{JobParam.CurTargetNode.AliceName}已开门。电梯内有料车,去临时点1的卸料点,准备卸下车上料车"
;
...
...
DeviceLibrary/bean/job/Job.cs
查看文件 @
fac119a
...
...
@@ -23,7 +23,7 @@ namespace DeviceLibrary
/// <summary>
/// 运行信息
/// </summary>
public
string
RunInfo
{
get
{
return
$
"{JobName}{TaskStateInfo}{FixInfo}:{runInfo}"
;
}
}
public
string
RunInfo
{
get
{
return
$
"{JobName}
{TaskStateInfo}{FixInfo}:{runInfo}"
;
}
}
/// <summary>
/// agv任务状态信息
/// </summary>
...
...
@@ -66,10 +66,19 @@ namespace DeviceLibrary
protected
void
AllocateTask
(
AgvInfo
agv
,
string
taskName
)
{
Task
=
AgvTaskManager
.
GetTaskByName
(
taskName
);
Task
=
AgvTaskManager
.
GetTaskByName
(
taskName
,
agv
);
AgvTaskManager
.
AssignMission
(
agv
,
taskName
);
}
protected
void
AllocateTask
(
AgvInfo
agv
,
ChargePile
chargePile
)
{
Task
=
new
AgvTask
()
{
AliceName
=
chargePile
.
AliceName
,
Name
=
chargePile
.
Name
,
Guid
=
chargePile
.
Guid
};
AgvTaskManager
.
AssignMission
(
agv
,
chargePile
,
Task
);
}
protected
void
AllocateStandbyTask
(
AgvInfo
agv
)
{
Task
=
AgvTaskManager
.
GetTaskByName
(
SettingString
.
Standby
,
agv
);
AgvTaskManager
.
AssignMission
(
agv
,
SettingString
.
Standby
);
}
/// <summary>
/// 设置PLC值
/// </summary>
...
...
DeviceLibrary/bean/job/SendToLinesWithBackJob.cs
查看文件 @
fac119a
...
...
@@ -75,7 +75,7 @@ namespace DeviceLibrary.bean.job
//任务状态变更
MissionManager
.
SetMissionState
(
JobParam
.
GetMissionInfo
().
missionId
,
service
.
model
.
MissionState
.
离开电梯
,
out
string
msg
);
//关门
lift
.
LiftContext
.
CloseDoor
(
JobParam
.
SrcNode
.
Name
);
lift
.
LiftContext
.
CloseDoor
(
JobParam
.
SrcNode
.
Name
,
agv
);
}
}
else
if
(
JobRunStep
.
IsStep
(
RunStep
.
SD_LiftToLine_06_CloseLiftDoor
))
...
...
@@ -183,7 +183,7 @@ namespace DeviceLibrary.bean.job
{
if
(
lift
.
LiftContext
.
IsDoorOpen
(
JobParam
.
CurTargetNode
.
Name
,
JobParam
.
GetMissionInfo
().
sourceFloor
))
{
if
(
lift
.
LiftContext
.
HasShelfNeedLeave
(
JobParam
.
SrcNode
.
Name
,
agv
.
Scope
.
c
lient
,
out
liftStatus
))
if
(
lift
.
LiftContext
.
HasShelfNeedLeave
(
JobParam
.
SrcNode
.
Name
,
agv
.
C
lient
,
out
liftStatus
))
{
JobRunStep
.
ToNextStep
(
RunStep
.
SD_LiftToLine_14_01_ToTemp1
);
runInfo
=
$
"{JobParam.SrcNode.AliceName}内有料车,去临时点1放料点"
;
...
...
@@ -239,7 +239,7 @@ namespace DeviceLibrary.bean.job
JobRunStep
.
ToNextStep
(
RunStep
.
SD_LiftToLine_14_04_CloseLiftDoor
);
runInfo
=
$
"离开{JobParam.SrcNode.AliceName},关门"
;
JobRunStep
.
Msg
=
runInfo
;
lift
.
LiftContext
.
CloseDoor
(
JobParam
.
SrcNode
.
Name
);
lift
.
LiftContext
.
CloseDoor
(
JobParam
.
SrcNode
.
Name
,
agv
);
System
.
Threading
.
Thread
.
Sleep
(
1000
);
}
}
...
...
@@ -253,7 +253,7 @@ namespace DeviceLibrary.bean.job
}
else
if
(
JobRunStep
.
IsTimeOut
(
1
,
out
double
time
))
{
lift
.
LiftContext
.
CloseDoor
(
JobParam
.
SrcNode
.
Name
);
lift
.
LiftContext
.
CloseDoor
(
JobParam
.
SrcNode
.
Name
,
agv
);
System
.
Threading
.
Thread
.
Sleep
(
1000
);
}
}
...
...
@@ -429,7 +429,7 @@ namespace DeviceLibrary.bean.job
}
else
if
(
JobRunStep
.
IsTimeOut
(
1
,
out
double
time
))
{
lift
.
LiftContext
.
CloseDoor
(
JobParam
.
SrcNode
.
Name
);
lift
.
LiftContext
.
CloseDoor
(
JobParam
.
SrcNode
.
Name
,
agv
);
System
.
Threading
.
Thread
.
Sleep
(
1000
);
}
}
...
...
DeviceLibrary/bean/job/StandyJob.cs
查看文件 @
fac119a
...
...
@@ -33,7 +33,7 @@ namespace DeviceLibrary
JobRunStep
.
ToNextStep
(
RunStep
.
STANDBY_WAIT_REACH_STANDBY
);
runInfo
=
"从"
+
JobParam
.
SrcNode
+
"回到待机位"
;
JobRunStep
.
Msg
=
runInfo
;
Allocate
Task
(
agv
,
SettingString
.
Standby
);
Allocate
StandbyTask
(
agv
);
}
}
...
...
DeviceLibrary/bean/jobType/ChargeJobType.cs
查看文件 @
fac119a
using
Common
;
namespace
DeviceLibrary
{
/// <summary>
...
...
@@ -16,10 +18,10 @@ namespace DeviceLibrary
{
if
(
agv
.
Battery
<
ChargePileManager
.
GetChargePiles
().
BatteryMax
&&
ChargePileManager
.
HasEmpty
(
agv
,
out
bean
.
ChargePile
charge
))
{
return
new
ChargeJob
(
new
bean
.
JobParam
(
agv
.
Place
,
manager
.
NodeManager
.
GetNodeByType
(
NodeType
.
AutoCharge
)
));
return
new
ChargeJob
(
new
bean
.
JobParam
(
agv
.
Place
));
}
else
return
new
StandyJob
(
new
bean
.
JobParam
(
agv
.
Place
,
manager
.
NodeManager
.
GetNodeByType
(
NodeType
.
Standby
)
));
return
new
StandyJob
(
new
bean
.
JobParam
(
agv
.
Place
));
}
}
}
DeviceLibrary/bean/jobType/F1LiftToStoreJobType.cs
查看文件 @
fac119a
...
...
@@ -14,7 +14,7 @@ namespace DeviceLibrary.bean.jobType
return
null
;
else
{
if
(
agv
.
Scope
.
Floor
.
Equals
(
1
)
&&
agv
.
Scope
.
HasEmptyShelfInLift
(
out
string
liftname
,
out
lift
.
LiftStatus
lift
))
if
(
agv
.
Scope
.
Floor
.
Equals
(
1
)
&&
agv
.
HasEmptyShelfInLift
(
out
string
liftname
,
out
lift
.
LiftStatus
lift
))
{
service
.
model
.
MissionInfo
missionInfo
=
manager
.
MissionManager
.
GetReceiveMission
(
agv
);
if
(
missionInfo
!=
null
)
...
...
DeviceLibrary/bean/jobType/F1StoreToLiftJobType.cs
查看文件 @
fac119a
...
...
@@ -15,7 +15,7 @@ namespace DeviceLibrary.bean.jobType
{
if
(!
agv
.
IsIdle
())
return
null
;
else
else
if
(
agv
.
Scope
.
Floor
.
Equals
(
1
))
{
service
.
model
.
MissionInfo
missionInfo
=
manager
.
MissionManager
.
GetDeliverMission
(
agv
,
out
string
liftname
);
if
(
missionInfo
!=
null
)
...
...
DeviceLibrary/bean/jobType/LineToLineJobType.cs
查看文件 @
fac119a
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
DeviceLibrary.bean.job
;
namespace
DeviceLibrary.bean.jobType
{
public
class
LineToLineJobType
:
JobType
...
...
@@ -12,7 +8,7 @@ namespace DeviceLibrary.bean.jobType
{
if
(!
agv
.
IsIdle
())
return
null
;
else
else
if
(!
agv
.
Scope
.
Floor
.
Equals
(
1
))
{
service
.
model
.
MissionInfo
missionInfo
=
manager
.
MissionManager
.
GetLineToLineMission
(
agv
);
if
(
missionInfo
!=
null
)
...
...
@@ -20,7 +16,7 @@ namespace DeviceLibrary.bean.jobType
Node
src
=
manager
.
NodeManager
.
GetNode
(
missionInfo
.
sourcePoint
,
NodeType
.
Node
);
Node
dest
=
manager
.
NodeManager
.
GetNode
(
missionInfo
.
destinationPoint
,
NodeType
.
Node
);
JobParam
jobParam
=
new
JobParam
(
src
,
dest
,
null
,
missionInfo
);
return
new
F1StoreToLift
Job
(
jobParam
);
return
new
LineToLine
Job
(
jobParam
);
}
}
return
null
;
...
...
DeviceLibrary/bean/jobType/SendToLinesWithBackJobType.cs
查看文件 @
fac119a
...
...
@@ -25,7 +25,7 @@ namespace DeviceLibrary
return
null
;
else
{
if
(!
agv
.
Scope
.
Floor
.
Equals
(
1
)
&&
agv
.
Scope
.
HasEmptyShelfInLift
(
out
string
liftname
,
out
lift
.
LiftStatus
lift
))
if
(!
agv
.
Scope
.
Floor
.
Equals
(
1
)
&&
agv
.
HasEmptyShelfInLift
(
out
string
liftname
,
out
lift
.
LiftStatus
lift
))
{
service
.
model
.
MissionInfo
missionInfo
=
manager
.
MissionManager
.
GetReceiveMission
(
agv
);
if
(
missionInfo
!=
null
)
...
...
DeviceLibrary/bean/jobType/StoreToLinesWithBackJobType.cs
查看文件 @
fac119a
using
Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
DeviceLibrary.bean.job
;
namespace
DeviceLibrary.bean.jobType
{
...
...
@@ -13,7 +9,7 @@ namespace DeviceLibrary.bean.jobType
{
if
(!
agv
.
IsIdle
())
return
null
;
else
else
if
(!
agv
.
Scope
.
Floor
.
Equals
(
1
))
{
service
.
model
.
MissionInfo
missionInfo
=
manager
.
MissionManager
.
GetStoreToLinesMission
(
agv
);
if
(
missionInfo
!=
null
)
...
...
@@ -37,7 +33,7 @@ namespace DeviceLibrary.bean.jobType
}
}
return
new
F1StoreToLift
Job
(
jobParam
);
return
new
StoreToLinesWithBack
Job
(
jobParam
);
}
}
return
null
;
...
...
DeviceLibrary/lift/LiftContext.cs
查看文件 @
fac119a
...
...
@@ -37,17 +37,29 @@ namespace DeviceLibrary.lift
/// 电梯关门
/// </summary>
/// <param name="liftId"></param>
public
static
void
CloseDoor
(
string
liftId
)
public
static
void
CloseDoor
(
string
liftId
,
AgvInfo
agvInfo
)
{
bool
rtn
=
HttpManager
.
CloseDoor
(
new
service
.
model
.
DoorInfo
()
{
liftId
=
liftId
,
sourceClient
=
agvInfo
.
Client
,
sourceFloor
=
agvInfo
.
Scope
.
Floor
});
Common
.
LogUtil
.
info
(
$
"{agvInfo.Name} 关门 {rtn}"
);
}
/// <summary>
/// 请求使用电梯
/// </summary>
/// <param name="liftId"></param>
public
static
void
Request
(
string
liftId
,
service
.
model
.
MissionInfo
missionInfo
)
/// <param name="missionInfo"></param>
/// <param name="isback">是否是返回</param>
public
static
void
Request
(
string
liftId
,
service
.
model
.
MissionInfo
missionInfo
,
bool
isback
=
false
)
{
service
.
model
.
SendInInfo
info
;
if
(
isback
)
{
info
=
new
service
.
model
.
SendInInfo
()
{
};
}
else
{
info
=
new
service
.
model
.
SendInInfo
()
{
};
}
HttpManager
.
RequestSendIn
(
info
);
}
public
static
void
SwitchControl
(
string
liftId
,
service
.
model
.
MissionInfo
missionInfo
)
{
...
...
@@ -57,9 +69,10 @@ namespace DeviceLibrary.lift
/// 电梯开门
/// </summary>
/// <param name="liftId"></param>
public
static
void
OpenDoor
(
string
liftId
)
public
static
void
OpenDoor
(
string
liftId
,
AgvInfo
agvInfo
)
{
bool
rtn
=
HttpManager
.
OpenDoor
(
new
service
.
model
.
DoorInfo
()
{
liftId
=
liftId
,
sourceClient
=
agvInfo
.
Client
,
sourceFloor
=
agvInfo
.
Scope
.
Floor
});
Common
.
LogUtil
.
info
(
$
"{agvInfo.Name} 开门 {rtn}"
);
}
/// <summary>
/// 运行到指定楼层
...
...
DeviceLibrary/manager/AGVManager.cs
查看文件 @
fac119a
...
...
@@ -62,6 +62,8 @@ namespace DeviceLibrary
jobTypes
.
Add
(
new
SendToLinesWithBackJobType
());
jobTypes
.
Add
(
new
F1LiftToStoreJobType
());
jobTypes
.
Add
(
new
F1StoreToLiftJobType
());
jobTypes
.
Add
(
new
LineToLineJobType
());
jobTypes
.
Add
(
new
StoreToLinesWithBackJobType
());
jobTypes
.
Add
(
new
ChargeJobType
());
InitAgv
();
...
...
DeviceLibrary/manager/AgvTaskManager.cs
查看文件 @
fac119a
...
...
@@ -34,37 +34,38 @@ namespace DeviceLibrary
}
}
public
static
void
InitView
(
ComboBox
comboBox
)
public
static
void
InitView
(
ComboBox
comboBox
,
AgvInfo
agv
)
{
comboBox
.
DisplayMember
=
"AliceName"
;
comboBox
.
ValueMember
=
"Id"
;
foreach
(
AgvTask
mission
in
AgvTaskManager
.
AgvTasks
)
comboBox
.
ValueMember
=
"Name"
;
List
<
AgvTask
>
tasks
=
AgvTaskManager
.
AgvTasks
.
FindAll
(
s
=>
s
.
TypeId
.
Equals
(
agv
.
FleetIP
));
foreach
(
AgvTask
mission
in
tasks
)
{
comboBox
.
Items
.
Add
(
mission
);
}
comboBox
.
SelectedItem
=
GetTaskByName
(
SettingString
.
Init
);
comboBox
.
SelectedItem
=
GetTaskByName
(
SettingString
.
Init
,
agv
);
}
/// <summary>
/// 根据id获取任务
/// </summary>
/// <param name="taskName"></param>
/// <returns></returns>
public
static
AgvTask
GetTaskById
(
int
id
)
{
AgvTask
task
=
AgvTasks
.
Find
(
s
=>
s
.
Id
.
Equals
(
id
));
if
(
task
!=
null
)
return
task
;
else
LogUtil
.
error
(
string
.
Format
(
"任务Id={0}不存在,请检查配置文件!"
,
id
));
return
new
AgvTask
();
}
//
public static AgvTask GetTaskById(int id)
//
{
//
AgvTask task = AgvTasks.Find(s => s.Id.Equals(id));
//
if (task != null)
//
return task;
//
else
//
LogUtil.error(string.Format("任务Id={0}不存在,请检查配置文件!", id));
//
return new AgvTask();
//
}
/// <summary>
/// 根据任务名获取任务
/// </summary>
/// <returns></returns>
public
static
AgvTask
GetTaskByName
(
string
name
)
public
static
AgvTask
GetTaskByName
(
string
name
,
AgvInfo
agv
)
{
AgvTask
task
=
AgvTasks
.
Find
(
s
=>
s
.
Name
.
Equals
(
name
));
AgvTask
task
=
AgvTasks
.
Find
(
s
=>
s
.
Name
.
Equals
(
name
)
&&
agv
.
FleetIP
.
Equals
(
s
.
TypeId
)
);
if
(
task
!=
null
)
return
task
.
ToCopy
();
else
...
...
@@ -87,9 +88,73 @@ namespace DeviceLibrary
public
static
bool
AssignMission
(
AgvInfo
agv
,
string
taskname
)
{
bool
rtn
=
false
;
AgvTask
task
=
GetTaskByName
(
taskname
);
Node
node
=
manager
.
NodeManager
.
GetNodeByName
(
taskname
);
if
(
task
!=
null
)
AgvTask
task
=
GetTaskByName
(
taskname
,
agv
);
Node
node
=
null
;
if
(
taskname
.
Equals
(
SettingString
.
Standby
))
{
node
=
new
Node
()
{
Name
=
SettingString
.
Standby
,
AliceName
=
"待机位"
,
Type
=
NodeType
.
Standby
};
}
else
{
string
[]
names
=
taskname
.
Split
(
'_'
);
foreach
(
string
item
in
names
)
{
node
=
manager
.
NodeManager
.
GetNodeByName
(
item
);
if
(
node
!=
null
)
break
;
}
}
if
(
task
!=
null
)
{
agv
.
TaskRunState
.
Task
=
task
;
if
(
node
!=
null
)
agv
.
Place
=
node
;
if
(!
agv
.
IsCon
)
{
agv
.
TaskRunState
.
ResetInfo
();
agv
.
TaskRunState
.
EnWaitTaskQueue
(
task
);
LogUtil
.
info
(
string
.
Format
(
"{0} 离线,任务{1}加入等待队列 "
,
agv
.
Name
,
task
.
AliceName
));
return
false
;
}
if
(
agv
.
UseFleet
)
{
rtn
=
MiR_API
.
Add_Mission_Fleet
(
agv
);
MiR_API
.
State_Ready
(
agv
);
if
(
rtn
)
{
LogUtil
.
info
(
string
.
Format
(
"{0} Add_Mission_Fleet {1} Success"
,
agv
.
Name
,
agv
.
TaskRunState
.
ToTaskInfo
()));
}
else
{
LogUtil
.
info
(
string
.
Format
(
"{0} Add_Mission_Fleet {1} Fail"
,
agv
.
Name
,
agv
.
TaskRunState
.
ToTaskInfo
()));
}
}
else
{
rtn
=
MiR_API
.
Add_Mission
(
agv
);
MiR_API
.
State_Ready
(
agv
);
if
(
rtn
)
{
LogUtil
.
info
(
string
.
Format
(
"{0} Add_Mission {1} Success"
,
agv
.
Name
,
agv
.
TaskRunState
.
ToTaskInfo
()));
}
else
{
LogUtil
.
info
(
string
.
Format
(
"{0} Add_Mission {1} Fail"
,
agv
.
Name
,
agv
.
TaskRunState
.
ToTaskInfo
()));
}
}
agv
.
StateKanban
.
SetCurTask
(
agv
.
TaskRunState
.
ToTaskShowInfo
());
if
(!
rtn
)
agv
.
TaskRunState
.
EnWaitTaskQueue
(
task
);
}
return
rtn
;
}
public
static
bool
AssignMission
(
AgvInfo
agv
,
DeviceLibrary
.
bean
.
ChargePile
chargePile
,
AgvTask
task
)
{
bool
rtn
=
false
;
Node
node
=
new
Node
()
{
Name
=
chargePile
.
Name
,
AliceName
=
chargePile
.
AliceName
,
Type
=
NodeType
.
AutoCharge
};
if
(
task
!=
null
)
{
agv
.
TaskRunState
.
Task
=
task
;
if
(
node
!=
null
)
...
...
DeviceLibrary/manager/HttpManager.cs
查看文件 @
fac119a
...
...
@@ -103,7 +103,7 @@ namespace DeviceLibrary
return
path
;
}
public
static
string
updateStatus
=
AppConfigHelper
.
GetValue
(
SettingString
.
Lift_GetState
)
;
static
string
updateStatus
=
AppConfigHelper
.
GetValue
(
SettingString
.
Lift_Server
)+
"status"
;
public
static
lift
.
LiftStatus
UpdateStatusToLift
(
lift
.
ClientStatus
clientStatus
)
{
try
...
...
@@ -127,35 +127,114 @@ namespace DeviceLibrary
}
}
public
static
bool
DoorOperation
(
service
.
model
.
DoorInfo
doorInfo
)
static
string
opendoor
=
AppConfigHelper
.
GetValue
(
SettingString
.
Lift_Server
)
+
"openDoor"
;
/// <summary>
/// 开门操作
/// </summary>
/// <param name="doorInfo"></param>
/// <returns></returns>
public
static
bool
OpenDoor
(
service
.
model
.
DoorInfo
doorInfo
)
{
try
{
string
resultStr
=
HttpHelper
.
Post
(
updateStatus
,
JsonHelper
.
SerializeObject
(
doorInfo
));
string
resultStr
=
HttpHelper
.
Post
(
opendoor
,
JsonHelper
.
SerializeObject
(
doorInfo
));
Result
data
=
JsonHelper
.
DeserializeJsonToObject
<
Result
>(
resultStr
);
if
(
data
==
null
)
{
log
.
Warn
(
$
"
DoorOperation
fail:{JsonHelper.SerializeObject(doorInfo)}"
);
log
.
Warn
(
$
"
OpenDoor
fail:{JsonHelper.SerializeObject(doorInfo)}"
);
return
false
;
}
else
{
if
(
data
.
code
.
Equals
(
0
))
{
log
.
Info
(
$
"
DoorOperation
info:{JsonHelper.SerializeObject(doorInfo)},result:code={data.code},msg={data.msg},data={data.data}"
);
log
.
Info
(
$
"
OpenDoor
info:{JsonHelper.SerializeObject(doorInfo)},result:code={data.code},msg={data.msg},data={data.data}"
);
return
true
;
}
else
{
log
.
Warn
(
$
"DoorOperation info:{JsonHelper.SerializeObject(doorInfo)},result:code={data.code},msg={data.msg},data={data.data}"
);
log
.
Warn
(
$
"OpenDoor info:{JsonHelper.SerializeObject(doorInfo)},result:code={data.code},msg={data.msg},data={data.data}"
);
return
false
;
}
}
}
catch
(
Exception
e
)
{
log
.
Error
(
"OpenDoor"
,
e
);
}
return
false
;
}
static
string
closedoor
=
AppConfigHelper
.
GetValue
(
SettingString
.
Lift_Server
)
+
"closeDoor"
;
/// <summary>
/// 关门操作
/// </summary>
/// <param name="doorInfo"></param>
/// <returns></returns>
public
static
bool
CloseDoor
(
service
.
model
.
DoorInfo
doorInfo
)
{
try
{
string
resultStr
=
HttpHelper
.
Post
(
closedoor
,
JsonHelper
.
SerializeObject
(
doorInfo
));
Result
data
=
JsonHelper
.
DeserializeJsonToObject
<
Result
>(
resultStr
);
if
(
data
==
null
)
{
log
.
Warn
(
$
"CloseDoor fail:{JsonHelper.SerializeObject(doorInfo)}"
);
return
false
;
}
else
{
if
(
data
.
code
.
Equals
(
0
))
{
log
.
Info
(
$
"CloseDoor info:{JsonHelper.SerializeObject(doorInfo)},result:code={data.code},msg={data.msg},data={data.data}"
);
return
true
;
}
else
{
log
.
Warn
(
$
"CloseDoor info:{JsonHelper.SerializeObject(doorInfo)},result:code={data.code},msg={data.msg},data={data.data}"
);
return
false
;
}
}
}
catch
(
Exception
e
)
{
log
.
Error
(
"CloseDoor"
,
e
);
}
return
false
;
}
static
string
sendIn
=
AppConfigHelper
.
GetValue
(
SettingString
.
Lift_Server
)
+
"sendIn"
;
public
static
bool
RequestSendIn
(
service
.
model
.
SendInInfo
send
)
{
try
{
string
resultStr
=
HttpHelper
.
Post
(
sendIn
,
JsonHelper
.
SerializeObject
(
send
));
Result
data
=
JsonHelper
.
DeserializeJsonToObject
<
Result
>(
resultStr
);
if
(
data
==
null
)
{
log
.
Warn
(
$
"RequestSendIn fail:{JsonHelper.SerializeObject(send)}"
);
return
false
;
}
else
{
if
(
data
.
code
.
Equals
(
0
))
{
log
.
Info
(
$
"RequestSendIn info:{JsonHelper.SerializeObject(send)},result:code={data.code},msg={data.msg},data={data.data}"
);
return
true
;
}
else
{
log
.
Warn
(
$
"RequestSendIn info:{JsonHelper.SerializeObject(send)},result:code={data.code},msg={data.msg},data={data.data}"
);
return
false
;
}
}
}
catch
(
Exception
e
)
{
log
.
Error
(
"
DoorOperatio
n"
,
e
);
log
.
Error
(
"
RequestSendI
n"
,
e
);
}
return
false
;
}
...
...
DeviceLibrary/manager/MissionManager.cs
查看文件 @
fac119a
...
...
@@ -107,7 +107,7 @@ namespace DeviceLibrary.manager
if
(
Monitor
.
TryEnter
(
lockObj
,
1000
))
{
MissionInfos
.
Add
(
mission
);
Log
.
Info
(
$
"新建任务
{JsonHelper.SerializeObject(mission)}"
);
Log
.
Info
(
$
"新建任务
:
{JsonHelper.SerializeObject(mission)}"
);
WriteMission
();
}
}
...
...
@@ -130,7 +130,7 @@ namespace DeviceLibrary.manager
{
missionInfo
=
MissionInfos
.
Find
(
s
=>
s
.
missionId
.
Equals
(
missioId
));
MissionInfos
.
Remove
(
missionInfo
);
Log
.
Info
(
$
"删除任务
{JsonHelper.SerializeObject(missionInfo)}"
);
Log
.
Info
(
$
"删除任务
:
{JsonHelper.SerializeObject(missionInfo)}"
);
WriteMission
();
}
}
...
...
@@ -227,7 +227,7 @@ namespace DeviceLibrary.manager
{
missionInfo
=
MissionInfos
.
Find
(
s
=>
s
.
destinationWorkshop
.
Equals
(
agv
.
Scope
.
Workshop
)
&&
s
.
sourceWorkshop
.
Equals
(
agv
.
Scope
.
Workshop
)
&&
s
.
projectType
.
Equals
(
ProjectType
.
半成品领用
)
&&
(
s
.
State
>
=
MissionState
.
创建
)
&&
agv
.
Scope
.
Tasks
.
Contains
(
s
.
projectType
.
ToString
()));
(
s
.
State
=
=
MissionState
.
创建
)
&&
agv
.
Scope
.
Tasks
.
Contains
(
s
.
projectType
.
ToString
()));
if
(
missionInfo
!=
null
)
{
Log
.
Info
(
$
"执行任务[{agv.Name}][目的地] {JsonHelper.SerializeObject(missionInfo)}"
);
...
...
@@ -336,7 +336,7 @@ namespace DeviceLibrary.manager
if
(
CanMissionDelete
(
missionState
))
{
MissionInfos
.
Remove
(
missionInfo
);
Log
.
Info
(
$
"删除任务
{JsonHelper.SerializeObject(missionInfo)}"
);
Log
.
Info
(
$
"删除任务
:
{JsonHelper.SerializeObject(missionInfo)}"
);
}
}
WriteMission
();
...
...
@@ -356,7 +356,7 @@ namespace DeviceLibrary.manager
public
static
void
SetMissionState
(
MissionInfo
missionInfo
,
MissionState
missionState
)
{
missionInfo
.
SetState
(
missionState
);
Log
.
Info
(
$
"设置任务
{missionInfo.missionId}
状态为{missionState}成功"
);
Log
.
Info
(
$
"设置任务
[{missionInfo.missionId}]
状态为{missionState}成功"
);
}
/// <summary>
/// 任务能否被删除
...
...
@@ -365,7 +365,7 @@ namespace DeviceLibrary.manager
/// <returns></returns>
static
bool
CanMissionDelete
(
MissionState
missionState
)
{
if
(
missionState
.
Equals
(
MissionState
.
中止
)
||
missionState
.
Equals
(
MissionState
.
取消
))
if
(
missionState
.
Equals
(
MissionState
.
中止
)
||
missionState
.
Equals
(
MissionState
.
取消
)
||
missionState
.
Equals
(
MissionState
.
完成
)
)
return
true
;
return
false
;
}
...
...
DeviceLibrary/manager/NodeManager.cs
查看文件 @
fac119a
...
...
@@ -41,7 +41,7 @@ namespace DeviceLibrary.manager
DgvNode
.
AlternatingRowsDefaultCellStyle
.
BackColor
=
Color
.
LightBlue
;
};
DgvNode
.
Columns
.
Add
(
new
DataGridViewCheckBoxColumn
()
{
HeaderText
=
"启用"
,
DataPropertyName
=
"IsUse"
});
DgvNode
.
Columns
.
Add
(
new
DataGridViewTextBoxColumn
()
{
HeaderText
=
"编号"
,
DataPropertyName
=
"Id"
});
//
DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "编号", DataPropertyName = "Id" });
DgvNode
.
Columns
.
Add
(
new
DataGridViewTextBoxColumn
()
{
HeaderText
=
"名称"
,
DataPropertyName
=
"Name"
});
DgvNode
.
Columns
.
Add
(
new
DataGridViewTextBoxColumn
()
{
HeaderText
=
"别名"
,
DataPropertyName
=
"AliceName"
});
DgvNode
.
Columns
.
Add
(
new
DataGridViewTextBoxColumn
()
{
HeaderText
=
"车间"
,
DataPropertyName
=
"Workshop"
});
...
...
DeviceLibrary/manager/UploadManager.cs
查看文件 @
fac119a
...
...
@@ -46,7 +46,7 @@ namespace DeviceLibrary.manager
agvStates
.
Add
(
agvState
);
}
string
txt
=
Common
.
JsonHelper
.
SerializeObject
(
agvStates
);
Common
.
LogUtil
.
info
(
txt
);
Common
.
LogUtil
.
debug
(
txt
);
}
finally
{
...
...
DeviceLibrary/service/Service.cs
查看文件 @
fac119a
...
...
@@ -29,7 +29,6 @@ namespace DeviceLibrary
}
else
{
MissionManager
.
SetMissionState
(
createMissionInfo
.
missionId
,
MissionState
.
创建
,
out
string
msg
);
if
(!
NodeManager
.
CheckNode
(
createMissionInfo
.
sourcePoint
))
{
result
.
code
=
-
1
;
...
...
@@ -44,6 +43,7 @@ namespace DeviceLibrary
}
else
if
(!
MissionManager
.
Contains
(
createMissionInfo
))
{
MissionManager
.
SetMissionState
(
createMissionInfo
.
missionId
,
MissionState
.
创建
,
out
string
msg
);
MissionManager
.
Add
(
createMissionInfo
);
Log
.
Info
(
$
"Create mission from API:{s}"
);
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论