Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
顾剑亮
/
Camera
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
图表
网络
创建新的问题
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 411cfaab
由
张东亮
编写于
2020-08-13 16:41:54 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
在待机位挺时间长以及在A4不动逻辑修改
1 个父辈
81316f3e
全部展开
显示空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
131 行增加
和
42 行删除
.vs/AGVControl/v16/.suo
AGVControl/BLL/AGVManager.cs
AGVControl/BLL/Control.cs
AGVControl/Common.cs
AGVControl/FrmMain.Designer.cs
AGVControl/FrmMain.cs
AGVControl/FrmMain.resx
AGVControl/bin/Debug/AGVControl.exe
AGVControl/bin/Debug/AGVControl.pdb
AGVControl/obj/Debug/AGVControl.csproj.GenerateResource.cache
AGVControl/obj/Debug/AGVControl.exe
AGVControl/obj/Debug/AGVControl.pdb
AGVControl/obj/Debug/DesignTimeResolveAssemblyReferences.cache
AGVControl/obj/Debug/Interop.IWshRuntimeLibrary.dll
.vs/AGVControl/v16/.suo
查看文件 @
411cfaa
此文件类型无法预览
AGVControl/BLL/AGVManager.cs
查看文件 @
411cfaa
...
...
@@ -35,31 +35,9 @@ namespace BLL
return
true
;
}
if
(
serverResult
.
code
!=
0
)
return
true
;
agv
.
LeftTaskCnt
=
serverResult
.
data
.
taskCount
;
if
(
serverResult
.
data
.
taskCount
==
0
)
//该料架出库完成
{
//清除mark
List
<
string
>
markLst
=
new
List
<
string
>();
foreach
(
var
mark
in
Common
.
control
.
Marks
)
{
int
count
=
0
;
foreach
(
var
node
in
Common
.
nodeInfo
)
{
if
(
mark
.
Equals
(
node
.
Mark
))
count
++;
}
if
(
count
==
0
)
//mark存在标记,但节点任务没有,删除该mark
{
markLst
.
Add
(
mark
);
}
}
if
(
markLst
.
Count
!=
0
)
{
for
(
int
i
=
0
;
i
<
markLst
.
Count
;
i
++)
{
Common
.
control
.
Marks
.
Remove
(
markLst
[
i
]);
}
}
Common
.
log
.
OutInfo
(
agv
.
Name
+
" 料架【"
+
agv
.
RFID
+
"】 无剩余出库任务,serverResult.shelfTaskData.taskCount="
+
serverResult
.
data
.
taskCount
.
ToString
());
return
true
;
}
...
...
AGVControl/BLL/Control.cs
查看文件 @
411cfaa
...
...
@@ -287,7 +287,7 @@ namespace BLL
if
(
change
)
AgvChanged
?.
Invoke
(
i
);
Common
.
log
.
OutInfo
(
log
);
//
Common.log.OutInfo(log);
}
catch
(
Exception
ex
)
{
...
...
@@ -1301,6 +1301,39 @@ namespace BLL
return
FindNeedEnterWithMark
(
agv
);
}
private
readonly
object
clearMarkObj
=
new
object
();
/// <summary>
/// 清除节点上无mark,但任务里还有mark的情况
/// </summary>
private
void
ClearMarkByNodeMark
()
{
lock
(
clearMarkObj
)
{
//清除mark
List
<
string
>
markLst
=
new
List
<
string
>();
foreach
(
var
mark
in
Common
.
control
.
Marks
)
{
int
count
=
0
;
foreach
(
var
node
in
Common
.
nodeInfo
)
{
if
(
mark
.
Equals
(
node
.
Mark
))
count
++;
}
if
(
count
==
0
)
//mark存在标记,但节点任务没有,删除该mark
{
markLst
.
Add
(
mark
);
}
}
if
(
markLst
.
Count
!=
0
)
{
for
(
int
i
=
0
;
i
<
markLst
.
Count
;
i
++)
{
Common
.
control
.
Marks
.
Remove
(
markLst
[
i
]);
}
}
}
}
private
bool
B123456Enter
(
Agv_Info
agv
)
{
int
nodeIdx
;
...
...
@@ -1972,7 +2005,10 @@ namespace BLL
}
else
{
//在Mark缓存中,按照先后顺序出料,只有第一个出完才能出第二个
//在Mark缓存中,如果所有节点只有一mark,那么直接出。多个的按照先后顺序出料,只有第一个出完才能出第二个
List
<
ClientNode
>
lst
=
Common
.
nodeInfo
.
FindAll
(
s
=>
s
.
Mark
==
Common
.
nodeInfo
[
node
[
i
]].
Mark
);
if
(
lst
!=
null
&&
lst
.
Count
>
1
)
//出库涉及多个仓,按顺序执行
{
int
idx
=
Marks
.
FindIndex
(
s
=>
s
==
Common
.
nodeInfo
[
node
[
i
]].
Mark
);
if
(
idx
==
0
)
{
...
...
@@ -1980,6 +2016,12 @@ namespace BLL
break
;
}
}
else
if
(
lst
!=
null
&&
lst
.
Count
==
1
)
//只有一个仓出库,则直接出库
{
nodeIdx
=
node
[
i
];
break
;
}
}
}
...
...
@@ -2028,10 +2070,50 @@ namespace BLL
if
(!
BAreaLeaveCheck
)
{
nodeIdx
=
Common
.
nodeInfo
.
FindIndex
(
s
=>
s
.
Mark
==
agv
.
Mark
);
if
(
nodeIdx
==-
1
)
{
nodeIdx
=
Common
.
nodeInfo
.
FindIndex
(
s
=>
s
.
Name
==
"A3"
&&
s
.
Action
==
ClientAction
.
NeedEnter
&&
s
.
AgvName
==
""
&&
s
.
IsUse
);
if
(
nodeIdx
==-
1
)
{
ClearMarkByNodeMark
();
string
log
=
agv
.
Name
+
" A4 FindNeedEnterWithMark 节点mark没有找到[Mark="
+
agv
.
Mark
+
"],去A3"
;
Common
.
log
.
OutInfo
(
log
);
return
MoveNode
(
agv
,
nodeIdx
);
}
else
{
if
(!
agv
.
StandbyTemp
)
{
agv
.
StandbyTemp
=
true
;
foreach
(
var
item
in
Common
.
nodeInfo
)
{
if
(
item
.
AgvName
.
Equals
(
agv
.
Name
))
item
.
AgvName
=
""
;
}
string
log
=
agv
.
Name
+
" A4 FindNeedEnterWithMark 节点mark没有找到[Mark="
+
agv
.
Mark
+
"],移动到MoveStandbyTemp"
;
Common
.
log
.
OutInfo
(
log
);
Common
.
mir
.
Add_Mission_Fleet
(
agv
,
Common
.
agvMission
[
"MoveStandbyTemp"
]);
}
return
true
;
}
}
else
{
string
log
=
agv
.
Name
+
" A4 FindNeedEnterWithMark [Mark="
+
agv
.
Mark
+
"]"
;
Common
.
log
.
OutInfo
(
log
);
return
true
;
}
}
if
(!
agv
.
Mark
.
Split
(
','
)[
1
].
Equals
(
"pack"
))
{
ClearMarkByNodeMark
();
string
log
=
agv
.
Name
+
" [Mark="
+
agv
.
Mark
+
"] 出库任务完成"
;
Common
.
log
.
OutInfo
(
log
);
Common
.
log
.
OutTextBox
(
log
);
return
false
;
}
bool
rtn
=
AGVManager
.
LeaveCheck
(
agv
,
out
int
taskCount
);
Thread
.
Sleep
(
3000
);
if
(!
rtn
)
//出库任务还未完成
...
...
@@ -2053,9 +2135,10 @@ namespace BLL
}
else
{
ClearMarkByNodeMark
();
string
log
=
agv
.
Name
+
" [Mark="
+
agv
.
Mark
+
"] [taskCount = "
+
taskCount
.
ToString
()
+
"] 出库任务完成"
;
Common
.
log
.
OutInfo
(
log
);
//
Common.log.OutTextBox(log);
Common
.
log
.
OutTextBox
(
log
);
return
false
;
}
//MoveStandby
...
...
AGVControl/Common.cs
查看文件 @
411cfaa
...
...
@@ -349,7 +349,10 @@ namespace AGVControl
/// 是否清除任务缓存
/// </summary>
public
bool
IsClearRunInfo
=
false
;
/// <summary>
/// 剩余出库任务,针对包装仓出库
/// </summary>
public
int
LeftTaskCnt
{
get
;
set
;
}
=
0
;
public
struct
DockingStru
{
public
DateTime
startTime
;
...
...
@@ -380,20 +383,21 @@ namespace AGVControl
public
string
[]
ToRow
()
{
//AGV名称,IP,AGV状态,任务状态,地点,后续任务,在线,电量,调用,清除缓存
string
[]
s
=
new
string
[
1
0
];
string
[]
s
=
new
string
[
1
1
];
s
[
0
]
=
Name
;
s
[
1
]
=
IP
;
if
(
IsCon
)
{
s
[
2
]
=
StateText
;
s
[
3
]
=
string
.
Format
(
"{0}({1})"
,
MissionStatus
.
ToString
(),
(
int
)
MissionStatus
);
s
[
4
]
=
Place
;
s
[
5
]
=
NextMission
;
s
[
4
]
=
Mark
;
s
[
5
]
=
Place
;
s
[
6
]
=
NextMission
;
}
s
[
6
]
=
IsCon
.
ToString
();
s
[
7
]
=
Battery
+
"%"
;
s
[
8
]
=
IsUse
.
ToString
();
s
[
9
]
=
"Clear"
;
s
[
7
]
=
IsCon
.
ToString
();
s
[
8
]
=
Battery
+
"%"
;
s
[
9
]
=
IsUse
.
ToString
();
s
[
10
]
=
"Clear"
;
return
s
;
}
...
...
AGVControl/FrmMain.Designer.cs
查看文件 @
411cfaa
此文件的差异被折叠,
点击展开。
AGVControl/FrmMain.cs
查看文件 @
411cfaa
using
System
;
using
BLL
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Data
;
...
...
@@ -46,8 +47,8 @@ namespace AGVControl
LstAgvPlace
.
Items
.
Clear
();
foreach
(
var
item
in
Common
.
agvMission
.
Keys
.
ToArray
())
{
if
(
item
.
Length
.
Equals
(
6
))
continue
;
//
if (item.Length.Equals(6))
//
continue;
LstAgvPlace
.
Items
.
Add
(
item
);
}
...
...
@@ -60,6 +61,16 @@ namespace AGVControl
{
DgvNode
.
Rows
[
nodeIndex
].
SetValues
(
Common
.
nodeInfo
[
nodeIndex
].
ToRow
());
}));
string
task
=
""
;
Invoke
(
new
Action
(()
=>
{
label4
.
Text
=
""
;
foreach
(
var
item
in
Common
.
agvInfo
)
{
task
+=
string
.
Format
(
"{0}: [Mark={1}] [RFID={2}] [剩余任务={3}]\r\n"
,
item
.
Name
,
item
.
Mark
,
item
.
RFID
,
item
.
LeftTaskCnt
);
}
label4
.
Text
=
task
;
}));
}
private
void
Server_NodeOnline
(
int
nodeIndex
)
...
...
@@ -143,17 +154,17 @@ namespace AGVControl
private
void
DgvAgv_CellClick
(
object
sender
,
DataGridViewCellEventArgs
e
)
{
if
(
e
.
RowIndex
==
-
1
)
return
;
if
(
e
.
ColumnIndex
==
8
)
if
(
e
.
ColumnIndex
==
9
)
{
Common
.
agvInfo
[
e
.
RowIndex
].
IsUse
=
!
Common
.
agvInfo
[
e
.
RowIndex
].
IsUse
;
DgvAgv
.
Rows
[
e
.
RowIndex
].
Cells
[
e
.
ColumnIndex
].
Value
=
Common
.
agvInfo
[
e
.
RowIndex
].
IsUse
.
ToString
();
Common
.
appConfig
.
AppSettings
.
Settings
[
Common
.
agvInfo
[
e
.
RowIndex
].
Name
].
Value
=
Common
.
agvInfo
[
e
.
RowIndex
].
IsUse
.
ToString
();
Common
.
appConfig
.
Save
();
}
else
if
(
e
.
ColumnIndex
==
9
)
else
if
(
e
.
ColumnIndex
==
10
)
{
//清除小车缓存
Common
.
log
.
OutInfo
(
string
.
Format
(
"手动清除缓存,{0} {1}
"
,
Common
.
agvInfo
[
e
.
RowIndex
].
Name
,
Common
.
agvInfo
[
e
.
RowIndex
].
Place
));
Common
.
log
.
OutInfo
(
string
.
Format
(
"手动清除缓存,{0} {1}
Mark={2}"
,
Common
.
agvInfo
[
e
.
RowIndex
].
Name
,
Common
.
agvInfo
[
e
.
RowIndex
].
Place
,
Common
.
agvInfo
[
e
.
RowIndex
].
Mark
));
string
place
=
Common
.
agvInfo
[
e
.
RowIndex
].
Place
;
Common
.
agvInfo
[
e
.
RowIndex
].
Mark
=
""
;
Common
.
agvInfo
[
e
.
RowIndex
].
Place
=
""
;
...
...
@@ -169,7 +180,16 @@ namespace AGVControl
Common
.
nodeInfo
[
idx
].
AgvName
=
""
;
DgvNode
.
Rows
[
idx
].
Cells
[
5
].
Value
=
""
;
}
string
task
=
""
;
Invoke
(
new
Action
(()
=>
{
label4
.
Text
=
""
;
foreach
(
var
item
in
Common
.
agvInfo
)
{
task
+=
string
.
Format
(
"{0}: [Mark={1}] [RFID={2}] [剩余任务={3}]\r\n"
,
item
.
Name
,
item
.
Mark
,
item
.
RFID
,
item
.
LeftTaskCnt
);
}
label4
.
Text
=
task
;
}));
//添加Init任务
Common
.
mir
.
Add_Mission_Fleet
(
Common
.
agvInfo
[
e
.
RowIndex
],
Common
.
agvMission
[
"Init"
]);
Common
.
mir
.
State_Ready
(
Common
.
agvInfo
[
e
.
RowIndex
]);
...
...
@@ -305,7 +325,7 @@ namespace AGVControl
private
void
BtnReadWriteCharge_Click
(
object
sender
,
EventArgs
e
)
{
string
name
=
(
sender
as
Control
).
Name
;
string
name
=
(
sender
as
System
.
Windows
.
Forms
.
Control
).
Name
;
int
num
=
Convert
.
ToInt32
(
name
.
Substring
(
name
.
Length
-
1
,
1
));
if
(
name
.
IndexOf
(
"Read"
)
>
0
)
...
...
@@ -365,5 +385,6 @@ namespace AGVControl
{
System
.
Diagnostics
.
Process
.
Start
(
".\\AGV点位分布.xlsx"
);
}
}
}
AGVControl/FrmMain.resx
查看文件 @
411cfaa
...
...
@@ -129,6 +129,9 @@
<metadata name="Column14.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column22.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column18.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
...
...
AGVControl/bin/Debug/AGVControl.exe
查看文件 @
411cfaa
此文件类型无法预览
AGVControl/bin/Debug/AGVControl.pdb
查看文件 @
411cfaa
此文件类型无法预览
AGVControl/obj/Debug/AGVControl.csproj.GenerateResource.cache
查看文件 @
411cfaa
此文件类型无法预览
AGVControl/obj/Debug/AGVControl.exe
查看文件 @
411cfaa
此文件类型无法预览
AGVControl/obj/Debug/AGVControl.pdb
查看文件 @
411cfaa
此文件类型无法预览
AGVControl/obj/Debug/DesignTimeResolveAssemblyReferences.cache
查看文件 @
411cfaa
此文件类型无法预览
AGVControl/obj/Debug/Interop.IWshRuntimeLibrary.dll
查看文件 @
411cfaa
此文件类型无法预览
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论