Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
Qisda-SO1037-AGVDispatch
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit c0e131f3
由
张东亮
编写于
2022-03-11 09:16:43 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
2号车出现在T5线未确认就走的的情况修复
1 个父辈
132ba046
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
168 行增加
和
116 行删除
AGVDispatch/FrmMain.Designer.cs
AGVDispatch/FrmMain.cs
DeviceLibrary/Config/XmlConfigOperation.cs
DeviceLibrary/bean/Node.cs
DeviceLibrary/bean/job/F1StoreToLiftJob.cs
DeviceLibrary/bean/job/Job.cs
DeviceLibrary/bean/job/LiftToLinesJob.cs
DeviceLibrary/lift/LiftContext.cs
DeviceLibrary/manager/MissionManager.cs
DeviceLibrary/manager/UploadManager.cs
DeviceLibrary/service/model/MissionInfo.cs
AGVDispatch/FrmMain.Designer.cs
查看文件 @
c0e131f
...
...
@@ -47,10 +47,12 @@
this
.
label12
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
groupBox2
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
tabControlManual
=
new
System
.
Windows
.
Forms
.
TabControl
();
this
.
tableLayoutPanel4
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
flowLayoutPanel1
=
new
System
.
Windows
.
Forms
.
FlowLayoutPanel
();
this
.
tabPage5
=
new
System
.
Windows
.
Forms
.
TabPage
();
this
.
txtShow
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
tableLayoutPanel4
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
flowLayoutPanel1
=
new
System
.
Windows
.
Forms
.
FlowLayoutPanel
();
this
.
textBox1
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
tableLayoutPanel3
.
SuspendLayout
();
this
.
tabControl1
.
SuspendLayout
();
this
.
tabPage2
.
SuspendLayout
();
...
...
@@ -66,8 +68,8 @@
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
dgvInfos
)).
BeginInit
();
this
.
tabPage3
.
SuspendLayout
();
this
.
groupBox2
.
SuspendLayout
();
this
.
tableLayoutPanel4
.
SuspendLayout
();
this
.
tabPage5
.
SuspendLayout
();
this
.
tableLayoutPanel4
.
SuspendLayout
();
this
.
SuspendLayout
();
//
// tableLayoutPanel3
...
...
@@ -267,6 +269,8 @@
//
// tabPage3
//
this
.
tabPage3
.
Controls
.
Add
(
this
.
button1
);
this
.
tabPage3
.
Controls
.
Add
(
this
.
textBox1
);
this
.
tabPage3
.
Controls
.
Add
(
this
.
label12
);
this
.
tabPage3
.
Controls
.
Add
(
this
.
groupBox2
);
this
.
tabPage3
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
22
);
...
...
@@ -312,6 +316,25 @@
this
.
tabControlManual
.
Size
=
new
System
.
Drawing
.
Size
(
425
,
258
);
this
.
tabControlManual
.
TabIndex
=
0
;
//
// tabPage5
//
this
.
tabPage5
.
Controls
.
Add
(
this
.
txtShow
);
this
.
tabPage5
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
22
);
this
.
tabPage5
.
Name
=
"tabPage5"
;
this
.
tabPage5
.
Size
=
new
System
.
Drawing
.
Size
(
1270
,
282
);
this
.
tabPage5
.
TabIndex
=
5
;
this
.
tabPage5
.
Text
=
"AGV定时上报内容"
;
this
.
tabPage5
.
UseVisualStyleBackColor
=
true
;
//
// txtShow
//
this
.
txtShow
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
txtShow
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
txtShow
.
Multiline
=
true
;
this
.
txtShow
.
Name
=
"txtShow"
;
this
.
txtShow
.
Size
=
new
System
.
Drawing
.
Size
(
1270
,
282
);
this
.
txtShow
.
TabIndex
=
0
;
//
// tableLayoutPanel4
//
this
.
tableLayoutPanel4
.
ColumnCount
=
1
;
...
...
@@ -336,24 +359,22 @@
this
.
flowLayoutPanel1
.
Size
=
new
System
.
Drawing
.
Size
(
1274
,
405
);
this
.
flowLayoutPanel1
.
TabIndex
=
0
;
//
// t
abPage5
// t
extBox1
//
this
.
tabPage5
.
Controls
.
Add
(
this
.
txtShow
);
this
.
tabPage5
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
22
);
this
.
tabPage5
.
Name
=
"tabPage5"
;
this
.
tabPage5
.
Size
=
new
System
.
Drawing
.
Size
(
1270
,
282
);
this
.
tabPage5
.
TabIndex
=
5
;
this
.
tabPage5
.
Text
=
"AGV定时上报内容"
;
this
.
tabPage5
.
UseVisualStyleBackColor
=
true
;
this
.
textBox1
.
Location
=
new
System
.
Drawing
.
Point
(
319
,
32
);
this
.
textBox1
.
Name
=
"textBox1"
;
this
.
textBox1
.
Size
=
new
System
.
Drawing
.
Size
(
218
,
21
);
this
.
textBox1
.
TabIndex
=
47
;
//
//
txtShow
//
button1
//
this
.
txtShow
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
txtShow
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
txtShow
.
Multiline
=
true
;
this
.
txtShow
.
Name
=
"txtShow"
;
this
.
txtShow
.
Size
=
new
System
.
Drawing
.
Size
(
1270
,
282
);
this
.
txtShow
.
TabIndex
=
0
;
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
339
,
73
);
this
.
button1
.
Name
=
"button1"
;
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
163
,
41
);
this
.
button1
.
TabIndex
=
48
;
this
.
button1
.
Text
=
"根据任务编号删除任务"
;
this
.
button1
.
UseVisualStyleBackColor
=
true
;
this
.
button1
.
Click
+=
new
System
.
EventHandler
(
this
.
button1_Click
);
//
// FrmMain
//
...
...
@@ -381,10 +402,11 @@
this
.
tblLayoutUnlock
.
ResumeLayout
(
false
);
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
dgvInfos
)).
EndInit
();
this
.
tabPage3
.
ResumeLayout
(
false
);
this
.
tabPage3
.
PerformLayout
();
this
.
groupBox2
.
ResumeLayout
(
false
);
this
.
tableLayoutPanel4
.
ResumeLayout
(
false
);
this
.
tabPage5
.
ResumeLayout
(
false
);
this
.
tabPage5
.
PerformLayout
();
this
.
tableLayoutPanel4
.
ResumeLayout
(
false
);
this
.
ResumeLayout
(
false
);
}
...
...
@@ -412,6 +434,8 @@
private
System
.
Windows
.
Forms
.
DataGridView
dgvInfos
;
private
System
.
Windows
.
Forms
.
TabPage
tabPage5
;
private
System
.
Windows
.
Forms
.
TextBox
txtShow
;
private
System
.
Windows
.
Forms
.
Button
button1
;
private
System
.
Windows
.
Forms
.
TextBox
textBox1
;
}
}
AGVDispatch/FrmMain.cs
查看文件 @
c0e131f
...
...
@@ -13,6 +13,7 @@ using System.Windows.Forms;
using
Common
;
using
DeviceLibrary
;
using
DeviceLibrary.manager
;
using
DeviceLibrary.service.model
;
namespace
AGVControl
{
...
...
@@ -190,6 +191,21 @@ namespace AGVControl
LogUtil
.
logBox
=
this
.
richTextBox1
;
}
}
private
void
button1_Click
(
object
sender
,
EventArgs
e
)
{
try
{
string
missionId
=
textBox1
.
Text
.
Trim
();
MissionInfo
missionInfo
=
MissionManager
.
GetMission
(
missionId
);
if
(
missionInfo
!=
null
)
{
MissionManager
.
DeleteById
(
missionId
);
}
}
catch
{
}
}
private
void
dgvInfos_CellContentClick
(
object
sender
,
DataGridViewCellEventArgs
e
)
{
if
(
e
.
RowIndex
==
-
1
)
...
...
DeviceLibrary/Config/XmlConfigOperation.cs
查看文件 @
c0e131f
...
...
@@ -89,7 +89,7 @@ namespace DeviceLibrary.manager
string
strPath
=
string
.
Format
(
"/agvs/agv[@ip=\"{0}\"]"
,
agv
.
IP
);
XmlElement
selectXe
=
(
XmlElement
)
xe
.
SelectSingleNode
(
strPath
);
//selectSingleNode 根据XPath表达式,获得符合条件的第一个节点.
//selectXe.SetAttribute("Type", dgvBookInfo.CurrentRow.Cells[0].Value.ToString());//也可以通过SetAttribute来增加一个属性
selectXe
.
GetElementsByTagName
(
"IsDebug"
).
Item
(
0
).
InnerText
=
agv
.
Auto
.
ToString
();
selectXe
.
GetElementsByTagName
(
"IsDebug"
).
Item
(
0
).
InnerText
=
agv
.
IsDebug
.
ToString
();
xmlDoc
.
Save
(
File_AgvInfo
);
}
public
static
void
LoadNodeInfos
(
List
<
Node
>
nodes
)
...
...
DeviceLibrary/bean/Node.cs
查看文件 @
c0e131f
...
...
@@ -250,7 +250,6 @@ namespace DeviceLibrary
public
class
ExtendEquip
{
public
string
IP
{
get
;
set
;
}
private
bool
buttonConfirmSig
=
false
;
/// <summary>
/// 确认按钮
/// </summary>
...
...
@@ -264,13 +263,7 @@ namespace DeviceLibrary
return
false
;
else
{
if
(
buttonConfirmSig
)
return
true
;
else
{
buttonConfirmSig
=
GetIO
();
return
buttonConfirmSig
;
}
return
GetIO
();
}
}
...
...
@@ -288,7 +281,7 @@ namespace DeviceLibrary
{
Common
.
LogUtil
.
info
(
$
"线体按钮确认[{IP}]"
);
System
.
Threading
.
Tasks
.
Task
.
Factory
.
StartNew
(
delegate
{
{
IOManager
.
WriteDO
(
IP
,
0
,
1
);
System
.
Threading
.
Thread
.
Sleep
(
5000
);
IOManager
.
WriteDO
(
IP
,
0
,
0
);
...
...
@@ -337,9 +330,8 @@ namespace DeviceLibrary
public
void
Reset
()
{
apiconfirmSig
=
false
;
buttonConfirmSig
=
false
;
IOManager
.
WriteDO
(
IP
,
0
,
0
);
Common
.
LogUtil
.
info
(
$
"线体
按钮状态重置[{IP}]
"
);
Common
.
LogUtil
.
info
(
$
"线体
确认状态重置[{IP}]:apiconfirmSig={apiconfirmSig}
"
);
}
}
/// <summary>
...
...
DeviceLibrary/bean/job/F1StoreToLiftJob.cs
查看文件 @
c0e131f
...
...
@@ -96,7 +96,7 @@ namespace DeviceLibrary
{
if
(
lift
.
LiftContext
.
IsDoorOpen
(
JobParam
.
CurTargetNode
.
Name
,
JobParam
.
GetMissionInfo
().
sourceFloor
))
{
if
(
lift
.
LiftContext
.
HasShelfNeedLeave
(
JobParam
.
CurTargetNode
.
Name
,
agv
.
Client
,
out
lift
.
LiftStatus
lift
Status
))
if
(
lift
.
LiftContext
.
HasShelfNeedLeave
(
JobParam
.
CurTargetNode
.
Name
,
agv
.
Client
,
out
liftStatus
))
{
JobRunStep
.
ToNextStep
(
RunStep
.
S1F_StoreToLift_05_01_ToTemp1
);
runInfo
=
$
"{JobParam.CurTargetNode.AliceName}已开门。电梯内有料车,去临时点1的卸料点,准备卸下车上料车"
;
...
...
@@ -117,7 +117,7 @@ namespace DeviceLibrary
AllocateTask
(
agv
,
$
"{JobParam.CurTargetNode.Name}_{SettingString.TakeShelfOff}"
);
}
}
else
if
(
JobRunStep
.
IsTimeOut
(
5
)
&&
!
lift
.
LiftContext
.
CheckIfRequestOk
(
JobParam
.
CurTargetNode
.
Name
,
JobParam
.
GetMissionInfo
()))
else
if
(
JobRunStep
.
IsTimeOut
(
20
)
&&
!
lift
.
LiftContext
.
CheckIfRequestOk
(
JobParam
.
CurTargetNode
.
Name
,
JobParam
.
GetMissionInfo
()))
{
JobRunStep
.
ToNextStep
(
RunStep
.
S1F_StoreToLift_04_CheckLiftStatus
);
//请求电梯
...
...
@@ -299,6 +299,7 @@ namespace DeviceLibrary
$
"电梯卸车"
));
runInfo
=
$
"料车在{JobParam.CurTargetNode.AliceName}卸下完成,准备离开"
;
ResetOccupiedAgv
(
JobParam
.
GetMissionInfo
());
//任务状态变更
MissionManager
.
SetMissionState
(
JobParam
.
GetMissionInfo
().
missionId
,
service
.
model
.
MissionState
.
到达电梯
,
out
string
msg
);
AllocateTask
(
agv
,
$
"{SettingString.Leave}_{JobParam.CurTargetNode.Name}"
);
...
...
DeviceLibrary/bean/job/Job.cs
查看文件 @
c0e131f
using
Common
;
using
DeviceLibrary.bean
;
using
DeviceLibrary.manager
;
using
DeviceLibrary.service.model
;
using
System
;
namespace
DeviceLibrary
...
...
@@ -169,6 +170,14 @@ namespace DeviceLibrary
}
return
true
;
}
/// <summary>
/// 清除AGV占用的任务
/// </summary>
/// <param name="missionInfo"></param>
protected
void
ResetOccupiedAgv
(
MissionInfo
missionInfo
)
{
missionInfo
.
ResetOccupied
();
}
}
}
DeviceLibrary/bean/job/LiftToLinesJob.cs
查看文件 @
c0e131f
...
...
@@ -224,8 +224,9 @@ namespace DeviceLibrary.bean.job
//上报位置
System
.
Threading
.
Thread
.
Sleep
(
1000
);
}
else
if
(
JobRunStep
.
IsTimeOut
(
5
)
&&
!
lift
.
LiftContext
.
CheckIfRequestOk
(
JobParam
.
SrcNode
.
Name
,
JobParam
.
GetMissionInfo
()))
else
if
(
JobRunStep
.
IsTimeOut
(
20
)
&&
!
lift
.
LiftContext
.
CheckIfRequestOk
(
JobParam
.
SrcNode
.
Name
,
JobParam
.
GetMissionInfo
()))
{
JobRunStep
.
ToNextStep
(
RunStep
.
SD_LiftToLine_12_WaitDoorOpen
);
//请求电梯
lift
.
LiftContext
.
Request
(
JobParam
.
GetMissionInfo
(),
agv
,
true
);
}
...
...
@@ -273,6 +274,7 @@ namespace DeviceLibrary.bean.job
JobRunStep
.
ToNextStep
(
RunStep
.
SD_LiftToLine_14_03_LeaveLift
);
runInfo
=
$
"在{JobParam.SrcNode.AliceName}卸下料车完成,准备离开"
;
JobRunStep
.
Msg
=
runInfo
;
ResetOccupiedAgv
(
JobParam
.
GetMissionInfo
());
AllocateTask
(
agv
,
$
"{SettingString.Leave}_{JobParam.SrcNode.Name}"
);
//上报位置
manager
.
UploadManager
.
UploadTransportStatus
(
new
service
.
model
.
TransportStatus
(
agv
.
CurJob
.
JobParam
.
GetMissionInfo
().
missionId
,
...
...
@@ -338,11 +340,11 @@ namespace DeviceLibrary.bean.job
JobRunStep
.
Msg
=
runInfo
;
AllocateTask
(
agv
,
JobParam
.
SrcNode
.
Name
);
}
else
if
(
JobRunStep
.
IsTimeOut
(
1
,
out
double
timeval
))
else
if
(
JobRunStep
.
IsTimeOut
(
20
))
{
JobRunStep
.
ToNextStep
(
RunStep
.
SD_LiftToLine_14_03_RequestLift
);
//请求电梯
lift
.
LiftContext
.
Request
(
JobParam
.
GetMissionInfo
(),
agv
,
true
);
System
.
Threading
.
Thread
.
Sleep
(
3000
);
}
}
#
endregion
...
...
DeviceLibrary/lift/LiftContext.cs
查看文件 @
c0e131f
...
...
@@ -148,7 +148,10 @@ namespace DeviceLibrary.lift
{
liftStatus
=
GetLiftStatus
(
liftId
);
if
(
liftStatus
.
destinationClient
.
Equals
(
client
))
{
liftStatus
.
missionId
=
manager
.
MissionManager
.
GetMissionIdByShelfInLift
(
liftId
);
return
true
;
}
return
false
;
}
/// <summary>
...
...
DeviceLibrary/manager/MissionManager.cs
查看文件 @
c0e131f
...
...
@@ -101,6 +101,14 @@ namespace DeviceLibrary.manager
return
MissionInfos
[
id
];
return
null
;
}
public
static
string
GetMissionIdByShelfInLift
(
string
liftId
)
{
int
id
=
MissionInfos
.
FindIndex
(
s
=>
liftId
.
Equals
(
s
.
liftName
)
&&
(
s
.
State
==
MissionState
.
电梯运行
||
s
.
State
==
MissionState
.
返回电梯运行
));
if
(
id
>
-
1
)
return
MissionInfos
[
id
].
missionId
;
return
""
;
}
public
static
void
Add
(
MissionInfo
mission
)
{
try
...
...
@@ -159,16 +167,19 @@ namespace DeviceLibrary.manager
{
if
(
Monitor
.
TryEnter
(
lockObj
,
1000
))
{
missionInfo
=
MissionInfos
.
Find
(
s
=>
s
.
sourceWorkshop
.
Equals
(
agv
.
Scope
.
Workshop
)
&&
s
.
State
.
Equals
(
MissionState
.
创建
)
&&
missionInfo
=
MissionInfos
.
Find
(
s
=>
s
.
sourceWorkshop
.
Equals
(
agv
.
Scope
.
Workshop
)
&&
s
.
State
.
Equals
(
MissionState
.
创建
)
&&
agv
.
Scope
.
Tasks
.
Contains
(
s
.
projectType
.
ToString
()));
if
(
missionInfo
!=
null
)
if
(
missionInfo
!=
null
&&
AgvCanGetMission
(
missionInfo
)
)
{
liftname
=
GetLiftName
(
missionInfo
);
if
(
liftname
.
Equals
(
""
))
{
return
null
;
}
SetMissionOccupied
(
missionInfo
,
agv
);
Log
.
Info
(
$
"执行任务[{agv.Name}][起始地] {JsonHelper.SerializeObject(missionInfo)}"
);
return
missionInfo
;
}
}
}
...
...
@@ -180,11 +191,15 @@ namespace DeviceLibrary.manager
{
Monitor
.
Exit
(
lockObj
);
}
return
missionInfo
;
return
null
;
}
static
bool
AgvCanGetMission
(
MissionInfo
missionInfo
)
{
return
string
.
IsNullOrEmpty
(
missionInfo
.
OccupiedAgv
);
}
/// <summary>
/// 获取接收料任务,以准备执行
/// 获取接收料任务,以准备执行
LiftToLinesJobType
/// </summary>
/// <param name="missionType"></param>
/// <returns></returns>
...
...
@@ -197,9 +212,11 @@ namespace DeviceLibrary.manager
{
missionInfo
=
MissionInfos
.
Find
(
s
=>
s
.
destinationWorkshop
.
Equals
(
agv
.
Scope
.
Workshop
)
&&
(
s
.
State
>=
MissionState
.
到达电梯
&&
s
.
State
<=
MissionState
.
电梯到达
)
&&
agv
.
Scope
.
Tasks
.
Contains
(
s
.
projectType
.
ToString
()));
if
(
missionInfo
!=
null
)
if
(
missionInfo
!=
null
&&
AgvCanGetMission
(
missionInfo
)
)
{
SetMissionOccupied
(
missionInfo
,
agv
);
Log
.
Info
(
$
"执行任务[{agv.Name}][目的地] {JsonHelper.SerializeObject(missionInfo)}"
);
return
missionInfo
;
}
}
}
...
...
@@ -211,10 +228,10 @@ namespace DeviceLibrary.manager
{
Monitor
.
Exit
(
lockObj
);
}
return
missionInfo
;
return
null
;
}
/// <summary>
/// 获取1楼接收料任务,以准备执行
/// 获取1楼接收料任务,以准备执行
F1LiftToStoreJobType
/// </summary>
/// <param name="agv"></param>
/// <returns></returns>
...
...
@@ -227,9 +244,11 @@ namespace DeviceLibrary.manager
{
missionInfo
=
MissionInfos
.
Find
(
s
=>
s
.
sourceWorkshop
.
Equals
(
agv
.
Scope
.
Workshop
)
&&
(
s
.
State
>=
MissionState
.
返回到达电梯内
&&
s
.
State
<=
MissionState
.
返回电梯到达
)
&&
agv
.
Scope
.
Tasks
.
Contains
(
s
.
projectType
.
ToString
()));
if
(
missionInfo
!=
null
)
if
(
missionInfo
!=
null
&&
AgvCanGetMission
(
missionInfo
)
)
{
SetMissionOccupied
(
missionInfo
,
agv
);
Log
.
Info
(
$
"执行任务[{agv.Name}][目的地] {JsonHelper.SerializeObject(missionInfo)}"
);
return
missionInfo
;
}
}
}
...
...
@@ -241,7 +260,7 @@ namespace DeviceLibrary.manager
{
Monitor
.
Exit
(
lockObj
);
}
return
missionInfo
;
return
null
;
}
/// <summary>
...
...
@@ -259,9 +278,11 @@ 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
()));
if
(
missionInfo
!=
null
)
if
(
missionInfo
!=
null
&&
AgvCanGetMission
(
missionInfo
)
)
{
SetMissionOccupied
(
missionInfo
,
agv
);
Log
.
Info
(
$
"执行任务[{agv.Name}][目的地] {JsonHelper.SerializeObject(missionInfo)}"
);
return
missionInfo
;
}
}
}
...
...
@@ -273,7 +294,7 @@ namespace DeviceLibrary.manager
{
Monitor
.
Exit
(
lockObj
);
}
return
missionInfo
;
return
null
;
}
/// <summary>
...
...
@@ -293,9 +314,11 @@ namespace DeviceLibrary.manager
(
s
.
projectType
.
Equals
(
ProjectType
.
PCB
领用
)
||
s
.
projectType
.
Equals
(
ProjectType
.
包材领用
))
&&
(
s
.
State
>=
MissionState
.
创建
)
&&
agv
.
Scope
.
Tasks
.
Contains
(
s
.
projectType
.
ToString
()));
if
(
missionInfo
!=
null
)
if
(
missionInfo
!=
null
&&
AgvCanGetMission
(
missionInfo
)
)
{
SetMissionOccupied
(
missionInfo
,
agv
);
Log
.
Info
(
$
"执行任务[{agv.Name}][目的地] {JsonHelper.SerializeObject(missionInfo)}"
);
return
missionInfo
;
}
}
}
...
...
@@ -307,38 +330,12 @@ namespace DeviceLibrary.manager
{
Monitor
.
Exit
(
lockObj
);
}
return
missionInfo
;
return
null
;
}
/// <summary>
/// 获取电梯内的任务信息
/// </summary>
/// <param name="missionType"></param>
/// <returns></returns>
public
static
MissionInfo
GetMissionInLift
(
AgvInfo
agv
)
static
void
SetMissionOccupied
(
MissionInfo
missionInfo
,
AgvInfo
agv
)
{
MissionInfo
missionInfo
=
null
;
try
{
if
(
Monitor
.
TryEnter
(
lockObj
,
1000
))
{
missionInfo
=
MissionInfos
.
Find
(
s
=>
s
.
destinationWorkshop
.
Equals
(
agv
.
Scope
.
Workshop
)
&&
(
s
.
State
>=
MissionState
.
电梯运行
&&
s
.
State
<=
MissionState
.
电梯到达
)
&&
agv
.
Scope
.
Tasks
.
Contains
(
s
.
projectType
.
ToString
()));
if
(
missionInfo
!=
null
)
{
Log
.
Info
(
$
"执行任务[{agv.Name}][目的地] {JsonHelper.SerializeObject(missionInfo)}"
);
}
}
}
catch
(
Exception
e
)
{
Log
.
Error
(
"操作 fixMissionInfos 超时"
,
e
);
}
finally
{
Monitor
.
Exit
(
lockObj
);
}
return
missionInfo
;
missionInfo
.
SetAgvOccupied
(
agv
.
Name
);
MissionChangedEvent
?.
Invoke
();
}
/// <summary>
/// 设置任务状态
...
...
@@ -381,7 +378,7 @@ namespace DeviceLibrary.manager
MissionChangedEvent
?.
Invoke
();
}
static
void
SetMissionState
(
MissionInfo
missionInfo
,
MissionState
missionState
)
static
void
SetMissionState
(
MissionInfo
missionInfo
,
MissionState
missionState
)
{
missionInfo
.
SetState
(
missionState
);
Log
.
Info
(
$
"设置任务[{missionInfo.missionId}] 状态为[{missionState}]成功"
);
...
...
@@ -451,7 +448,7 @@ namespace DeviceLibrary.manager
liftname
=
SettingString
.
LIFT_D2
;
}
}
else
if
(
missionInfo
.
sourceWorkshop
.
Equals
(
SettingString
.
_3C
))
else
if
(
missionInfo
.
sourceWorkshop
.
Equals
(
SettingString
.
_3C
))
{
if
(
missionInfo
.
destinationWorkshop
.
Equals
(
SettingString
.
_4C
))
{
...
...
@@ -462,7 +459,7 @@ namespace DeviceLibrary.manager
case
ProjectType
.
包材领用
:
if
(
missionInfo
.
sourceWorkshop
.
StartsWith
(
"-1"
))
{
if
(
missionInfo
.
destinationWorkshop
.
Equals
(
SettingString
.
_4D
)||
if
(
missionInfo
.
destinationWorkshop
.
Equals
(
SettingString
.
_4D
)
||
missionInfo
.
destinationWorkshop
.
Equals
(
SettingString
.
_3D
))
{
liftname
=
SettingString
.
LIFT_D8
;
...
...
@@ -492,11 +489,11 @@ namespace DeviceLibrary.manager
liftname
=
SettingString
.
LIFT_C1
;
}
}
break
;
break
;
case
ProjectType
.
空台车领用
:
if
(
missionInfo
.
sourceWorkshop
.
StartsWith
(
"1"
))
{
if
(
missionInfo
.
destinationWorkshop
.
Equals
(
SettingString
.
_4D
)||
if
(
missionInfo
.
destinationWorkshop
.
Equals
(
SettingString
.
_4D
)
||
missionInfo
.
destinationWorkshop
.
Equals
(
SettingString
.
_3D
))
{
liftname
=
SettingString
.
LIFT_D2
;
...
...
DeviceLibrary/manager/UploadManager.cs
查看文件 @
c0e131f
...
...
@@ -41,7 +41,9 @@ namespace DeviceLibrary.manager
}
else
if
(
item
.
Auto
)
{
if
(
item
.
CurJob
!=
null
&&
item
.
CurJob
is
StandyJob
)
if
(
item
.
IsDebug
)
agvState
.
state
=
"调试中"
;
else
if
(
item
.
CurJob
!=
null
&&
item
.
CurJob
is
StandyJob
)
{
agvState
.
state
=
"归位中"
;
}
...
...
@@ -55,8 +57,6 @@ namespace DeviceLibrary.manager
agvState
.
missionId
=
item
.
CurJob
.
JobParam
.
GetMissionInfo
().
missionId
;
agvState
.
remark
=
item
.
CurJob
.
JobParam
.
GetMissionInfo
().
Remark
;
}
else
if
(
item
.
IsDebug
)
agvState
.
state
=
"调试中"
;
else
agvState
.
state
=
"自动"
;
}
...
...
DeviceLibrary/service/model/MissionInfo.cs
查看文件 @
c0e131f
...
...
@@ -16,22 +16,22 @@ namespace DeviceLibrary.service.model
/// </summary>
public
string
missionId
{
get
;
set
;
}
/// <summary>
///
使用的电梯名称
///
任务状态
/// </summary>
public
string
liftNam
e
{
get
;
set
;
}
public
MissionState
Stat
e
{
get
;
set
;
}
/// <summary>
///
优先级。3最高,1最低
///
使用的电梯名称
/// </summary>
//public int Priority { get; set; } = 1;
public
string
liftName
{
get
;
set
;
}
/// <summary>
///
是否可合并
///
占用的AGV名称
/// </summary>
public
bool
canMerge
{
get
;
set
;
}
public
string
OccupiedAgv
{
get
;
set
;
}
=
string
.
Empty
;
public
string
JobName
{
get
{
return
string
.
Format
(
"[{0}->{1} {2}任务]"
,
sourceWorkshop
,
destinationWorkshop
,
projectType
.
ToString
());
}
}
/// <summary>
///
任务状态
///
取车的位置
/// </summary>
public
MissionState
State
{
get
;
set
;
}
public
string
sourcePoint
{
get
;
set
;
}
/// <summary>
/// 取车的车间
/// </summary>
...
...
@@ -62,24 +62,10 @@ namespace DeviceLibrary.service.model
}
}
}
public
int
destinationFloor
{
get
{
try
{
return
int
.
Parse
(
destinationWorkshop
.
Substring
(
0
,
1
));
}
catch
{
return
-
1
;
}
}
}
/// <summary>
///
取车的位置
///
目标点位,多个点位使用逗号分割
/// </summary>
public
string
source
Point
{
get
;
set
;
}
public
string
destination
Point
{
get
;
set
;
}
/// <summary>
/// 目标车间
/// </summary>
...
...
@@ -96,15 +82,30 @@ namespace DeviceLibrary.service.model
return
""
;
}
}
/// <summary>
/// 目标点位,多个点位使用逗号分割
/// </summary>
public
string
destinationPoint
{
get
;
set
;
}
public
int
destinationFloor
{
get
{
try
{
return
int
.
Parse
(
destinationWorkshop
.
Substring
(
0
,
1
));
}
catch
{
return
-
1
;
}
}
}
/// <summary>
/// 空架子是否需要返回
/// </summary>
public
bool
needBack
{
get
;
set
;
}
/// <summary>
/// 是否可合并
/// </summary>
public
bool
canMerge
{
get
;
set
;
}
/// <summary>
/// 产品类型
/// </summary>
public
ProjectType
projectType
...
...
@@ -129,7 +130,14 @@ namespace DeviceLibrary.service.model
}
public
string
Remark
{
get
;
set
;
}
public
string
JobName
{
get
{
return
string
.
Format
(
"[{0}->{1} {2}任务]"
,
sourceWorkshop
,
destinationWorkshop
,
projectType
.
ToString
());
}
}
public
void
SetAgvOccupied
(
string
agvname
)
{
OccupiedAgv
=
agvname
;
}
public
void
ResetOccupied
()
{
OccupiedAgv
=
string
.
Empty
;
}
}
public
enum
MissionState
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论