Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
Qisda-SO1037-AGVDispatch
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 132ba046
由
张东亮
编写于
2022-03-07 14:59:14 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
添加调试状态
1 个父辈
685b768b
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
94 行增加
和
63 行删除
AGVDispatch/FrmMain.Designer.cs
AGVDispatch/FrmMain.cs
AGVDispatch/FrmMain.resx
AGVDispatch/Manual.Designer.cs
AGVDispatch/Manual.cs
Common/SettingString.cs
DeviceLibrary/Config/XmlConfigOperation.cs
DeviceLibrary/Config/agvinfos.xml
DeviceLibrary/bean/ChargePiles.cs
DeviceLibrary/bean/agv/Agv_Info.cs
DeviceLibrary/manager/HttpManager.cs
DeviceLibrary/manager/MissionManager.cs
DeviceLibrary/manager/UploadManager.cs
DeviceLibrary/service/Service.cs
DeviceLibrary/service/model/AgvState.cs
DeviceLibrary/service/model/MissionInfo.cs
AGVDispatch/FrmMain.Designer.cs
查看文件 @
132ba04
此文件的差异被折叠,
点击展开。
AGVDispatch/FrmMain.cs
查看文件 @
132ba04
...
...
@@ -110,7 +110,6 @@ namespace AGVControl
//托盘控件
notify
=
new
NotifyIcon
{
Icon
=
Icon
,
Visible
=
true
,
ContextMenuStrip
=
notifyMenu
,
Text
=
Text
};
notify
.
MouseDoubleClick
+=
Notify_MouseDoubleClick
;
ShowConfig
();
NodeManager
.
RegisEvent
(
Server_NodeChanged
,
Server_NodeOnline
);
}
...
...
@@ -156,7 +155,7 @@ namespace AGVControl
Invoke
(
new
Action
(()
=>
{
lbl
Show
.
Text
=
DeviceLibrary
.
HttpManager
.
Agvtransinfo
;
txt
Show
.
Text
=
DeviceLibrary
.
HttpManager
.
Agvtransinfo
;
}));
...
...
@@ -191,23 +190,10 @@ namespace AGVControl
LogUtil
.
logBox
=
this
.
richTextBox1
;
}
}
int
missionCurRow
=
0
,
missionCurColum
=
0
;
private
void
dgvInfos_CellContentClick
(
object
sender
,
DataGridViewCellEventArgs
e
)
{
if
(
e
.
RowIndex
==
-
1
)
return
;
missionCurColum
=
e
.
ColumnIndex
;
missionCurRow
=
e
.
RowIndex
;
}
private
void
dgvInfos_CellContentClick_1
(
object
sender
,
DataGridViewCellEventArgs
e
)
{
}
private
void
button1_Click
(
object
sender
,
EventArgs
e
)
{
HttpManager
.
UpdateStatusToLift
(
new
DeviceLibrary
.
lift
.
ClientStatus
()
{
liftId
=
"D2"
,
sourceClient
=
"4D"
,
hasIdleAgv
=
true
});
}
}
...
...
AGVDispatch/FrmMain.resx
查看文件 @
132ba04
...
...
@@ -117,9 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="lblShow.Text" xml:space="preserve">
<value>[2021-12-28 16:17:29,631][162][HttpManager:282]ERROR AgvReportState fail[http://10.85.17.233/ESMTCommonInterface/CommonService.asmx/UpdateAgvtransinfo]:[[{"agvNum":"2号车","workshop":"4D","battery":0,"position":{"Point":{"IsEmpty":true,"X":0.0,"Y":0.0},"orientation":0.0},"state":null,"missionId":null,"remark":null,"curTarget":null,"statusTxt":""},{"agvNum":"7号车","workshop":"4D","battery":0,"position":{"Point":{"IsEmpty":true,"X":0.0,"Y":0.0},"orientation":0.0},"state":null,"missionId":null,"remark":null,"curTarget":null,"statusTxt":""},{"agvNum":"17号车","workshop":"3D","battery":0,"position":{"Point":{"IsEmpty":true,"X":0.0,"Y":0.0},"orientation":0.0},"state":null,"missionId":null,"remark":null,"curTarget":null,"statusTxt":""}]][]</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
...
...
AGVDispatch/Manual.Designer.cs
查看文件 @
132ba04
此文件的差异被折叠,
点击展开。
AGVDispatch/Manual.cs
查看文件 @
132ba04
...
...
@@ -21,13 +21,14 @@ namespace AGVControl
chkBxAuto
.
Checked
=
agv
.
Auto
;
btnReSendTask
.
Enabled
=
agv
.
Auto
;
btnAssignTask
.
Enabled
=
!
agv
.
Auto
;
chkDebug
.
Checked
=
agv
.
IsDebug
;
}
AgvInfo
Agv
;
private
bool
isIni
=
false
;
private
void
Manual_Load
(
object
sender
,
EventArgs
e
)
{
lblInfo
.
Text
=
string
.
Format
(
"[{0}]"
,
Agv
.
IP
);
AgvTaskManager
.
InitView
(
cmbBxMission
,
Agv
);
AgvTaskManager
.
InitView
(
cmbBxMission
,
Agv
);
InState
.
AddRange
(
new
PictureBox
[]
{
pictureBox1
,
pictureBox2
,
pictureBox3
,
pictureBox4
});
OutState
.
AddRange
(
new
PictureBox
[]
{
pictureBox5
,
pictureBox6
,
pictureBox7
,
pictureBox8
});
timer1
.
Enabled
=
true
;
...
...
@@ -43,11 +44,11 @@ namespace AGVControl
{
try
{
if
(
Agv
.
IOStatus
[
0
]
!=
null
&&
Agv
.
IOStatus
[
0
].
Inputs
!=
null
)
if
(
Agv
.
IOStatus
[
0
]
!=
null
&&
Agv
.
IOStatus
[
0
].
Inputs
!=
null
)
{
for
(
int
i
=
0
;
i
<
Agv
.
IOStatus
[
0
].
Inputs
.
Length
;
i
++)
{
if
(
Agv
.
GetInput
(
0
,
i
))
if
(
Agv
.
GetInput
(
0
,
i
))
{
InState
[
i
].
Image
=
AGVDispatch
.
Properties
.
Resources
.
green1
;
}
...
...
@@ -57,7 +58,7 @@ namespace AGVControl
}
}
}
if
(
Agv
.
IOStatus
[
0
]!=
null
&&
Agv
.
IOStatus
[
0
].
Inputs
!=
null
)
if
(
Agv
.
IOStatus
[
0
]
!=
null
&&
Agv
.
IOStatus
[
0
].
Inputs
!=
null
)
{
for
(
int
i
=
0
;
i
<
Agv
.
IOStatus
[
0
].
Inputs
.
Length
;
i
++)
{
...
...
@@ -71,7 +72,6 @@ namespace AGVControl
}
}
}
}
catch
{
}
}));
...
...
@@ -83,7 +83,7 @@ namespace AGVControl
{
if
(!
chkBxAuto
.
Checked
&&
!
Agv
.
JobContext
.
MissionId
.
Equals
(
""
))
{
if
(
MessageBox
.
Show
(
$
"正在执行任务[{Agv.JobContext.MissionId}],切到手动后该任务无法继续执行,确定切到手动状态?"
,
"警告"
,
MessageBoxButtons
.
YesNo
).
Equals
(
if
(
MessageBox
.
Show
(
$
"正在执行任务[{Agv.JobContext.MissionId}],切到手动后该任务无法继续执行,确定切到手动状态?"
,
"警告"
,
MessageBoxButtons
.
YesNo
).
Equals
(
DialogResult
.
No
))
{
chkBxAuto
.
Checked
=
true
;
...
...
@@ -104,7 +104,7 @@ namespace AGVControl
try
{
//Agv.CurJob != null && Agv.CurJob.JobParam != null &&
if
(
Agv
.
CurJob
.
JobParam
.
GetMissionInfo
()
!=
null
)
if
(
Agv
.
CurJob
.
JobParam
.
GetMissionInfo
()
!=
null
)
{
if
(
MessageBox
.
Show
(
$
"是否删除该任务[{Agv.JobContext.MissionId}]?"
,
"提示"
,
MessageBoxButtons
.
YesNo
).
Equals
(
DialogResult
.
Yes
))
{
...
...
@@ -120,7 +120,7 @@ namespace AGVControl
catch
{
}
//MiR_API.Del_Mission(Agv);
//添加Init任务
AgvTaskManager
.
AssignMission
(
Agv
,
$
"{SettingString.Init}"
);
AgvTaskManager
.
AssignMission
(
Agv
,
$
"{SettingString.Init}"
);
}
Agv
.
CurJob
=
null
;
Agv
.
JobContext
=
new
DeviceLibrary
.
bean
.
agv
.
JobContext
();
...
...
@@ -194,7 +194,7 @@ namespace AGVControl
{
if
(
Agv
.
IsCon
)
{
DeviceLibrary
.
AgvTask
task
=
AgvTaskManager
.
GetTaskByName
((
cmbBxMission
.
SelectedItem
as
DeviceLibrary
.
AgvTask
).
Name
,
Agv
);
DeviceLibrary
.
AgvTask
task
=
AgvTaskManager
.
GetTaskByName
((
cmbBxMission
.
SelectedItem
as
DeviceLibrary
.
AgvTask
).
Name
,
Agv
);
if
(
task
.
Type
.
Equals
(
TaskType
.
InOut
))
if
(
MessageBox
.
Show
(
"确定对小车发送进/出任务?"
,
Agv
.
Name
,
MessageBoxButtons
.
YesNo
)
==
DialogResult
.
No
)
return
;
...
...
@@ -214,5 +214,10 @@ namespace AGVControl
{
Close
();
}
private
void
chkDebug_CheckedChanged
(
object
sender
,
EventArgs
e
)
{
Agv
.
IsDebug
=
chkDebug
.
Checked
;
}
}
}
Common/SettingString.cs
查看文件 @
132ba04
...
...
@@ -66,6 +66,7 @@ namespace Common
public
const
string
Lift_Server
=
"Lift_Server"
;
public
const
string
AppIdentity
=
"AppIdentity"
;
public
const
string
Lift_Names
=
"Lift_Names"
;
public
const
string
IsDebug
=
"IsDebug"
;
#
endregion
}
...
...
DeviceLibrary/Config/XmlConfigOperation.cs
查看文件 @
132ba04
...
...
@@ -53,6 +53,7 @@ namespace DeviceLibrary.manager
agv_Info
.
UseFleet
=
bool
.
Parse
(
xnl0
.
Item
(
3
).
InnerText
);
agv_Info
.
FleetIP
=
xnl0
.
Item
(
4
).
InnerText
;
agv_Info
.
Authorization
=
xnl0
.
Item
(
5
).
InnerText
;
agv_Info
.
IsDebug
=
bool
.
Parse
(
xnl0
.
Item
(
6
).
InnerText
);
XmlNode
xnIO
=
xe
.
SelectSingleNode
(
"IO_GUIDs"
);
XmlNodeList
xnlios
=
xnIO
.
ChildNodes
;
foreach
(
XmlNode
item
in
xnlios
)
...
...
@@ -79,7 +80,18 @@ namespace DeviceLibrary.manager
selectXe
.
GetElementsByTagName
(
"Auto"
).
Item
(
0
).
InnerText
=
agv
.
Auto
.
ToString
();
xmlDoc
.
Save
(
File_AgvInfo
);
}
public
static
void
SetAgvIsDebug
(
AgvInfo
agv
)
{
if
(!
isLoadAgv
)
return
;
XmlDocument
xmlDoc
=
new
XmlDocument
();
xmlDoc
.
Load
(
File_AgvInfo
);
XmlElement
xe
=
xmlDoc
.
DocumentElement
;
// DocumentElement 获取xml文档对象的根XmlElement.
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
();
xmlDoc
.
Save
(
File_AgvInfo
);
}
public
static
void
LoadNodeInfos
(
List
<
Node
>
nodes
)
{
XmlDocument
doc
=
new
XmlDocument
();
...
...
DeviceLibrary/Config/agvinfos.xml
查看文件 @
132ba04
此文件的差异被折叠,
点击展开。
DeviceLibrary/bean/ChargePiles.cs
查看文件 @
132ba04
...
...
@@ -102,7 +102,7 @@ namespace DeviceLibrary.bean
else
//多个agv共享充电桩
{
if
(
Agvs
.
Contains
(
agv
.
IP
))
return
Occupied
;
return
!
Occupied
;
else
return
false
;
}
...
...
DeviceLibrary/bean/agv/Agv_Info.cs
查看文件 @
132ba04
...
...
@@ -97,7 +97,22 @@ namespace DeviceLibrary
/// 负载
/// </summary>
public
bool
IsExistShelf
{
set
;
get
;
}
=
false
;
private
bool
_isdebug
=
false
;
/// <summary>
/// 是否是调试状态,true时不执行新任务
/// </summary>
public
bool
IsDebug
{
set
{
if
(!
value
.
Equals
(
_isdebug
))
{
_isdebug
=
value
;
XmlConfigOperation
.
SetAgvIsDebug
(
this
);
}
}
get
{
return
_isdebug
;
}
}
/// <summary>
/// 电量百分比,(从小车获取)
/// </summary>
...
...
@@ -162,6 +177,8 @@ namespace DeviceLibrary
}
else
{
if
(
IsDebug
)
return
false
;
if
(
CurJob
==
null
||
((
CurJob
is
ChargeJob
||
CurJob
is
StandyJob
)
&&
!
IsExistShelf
))
return
true
;
else
...
...
@@ -271,7 +288,7 @@ namespace DeviceLibrary
{
bool
isChange
=
false
;
bool
preShelfState
=
IsExistShelf
;
bool
reachIoValue
=
GetInput
(
0
,
0
).
Equals
(
true
);
bool
reachIoValue
=
GetInput
(
0
,
3
).
Equals
(
true
);
if
(
reachIoValue
)
{
//满足给定的IO值,计算持续时间
...
...
@@ -335,7 +352,16 @@ namespace DeviceLibrary
public
void
SetKanban
()
{
StateKanban
.
ShowInfo
(
"目的地"
,
Place
==
null
?
""
:
Place
.
AliceName
);
StateKanban
.
ShowInfo
(
"运行模式"
,
Auto
?
"自动"
:
"手动"
);
string
runmode
=
""
;
if
(
Auto
)
{
runmode
=
IsDebug
?
"调试"
:
"自动"
;
}
else
{
runmode
=
"手动"
;
}
StateKanban
.
ShowInfo
(
"运行模式"
,
runmode
);
if
(
Scope
!=
null
)
StateKanban
.
ShowInfo
(
"车间"
,
Scope
.
Workshop
);
if
(
this
.
CurJob
!=
null
)
...
...
DeviceLibrary/manager/HttpManager.cs
查看文件 @
132ba04
...
...
@@ -358,7 +358,7 @@ namespace DeviceLibrary
//fbackkinfo":"no agvinfo","fbacktime":"20215306105317"}
//if (data == null)
{
Agvtransinfo
=
$
"{agvreportstate}:
[{txt}]\r\n[{resultStr}]
"
;
Agvtransinfo
=
$
"{agvreportstate}:
【{txt}】\r\n【{resultStr}】
"
;
}
log
.
Debug
(
$
"[{agvreportstate}]【{txt}】"
);
//else
...
...
DeviceLibrary/manager/MissionManager.cs
查看文件 @
132ba04
...
...
@@ -180,7 +180,6 @@ namespace DeviceLibrary.manager
{
Monitor
.
Exit
(
lockObj
);
}
MissionChangedEvent
?.
Invoke
();
return
missionInfo
;
}
...
...
@@ -212,7 +211,6 @@ namespace DeviceLibrary.manager
{
Monitor
.
Exit
(
lockObj
);
}
MissionChangedEvent
?.
Invoke
();
return
missionInfo
;
}
/// <summary>
...
...
@@ -243,7 +241,6 @@ namespace DeviceLibrary.manager
{
Monitor
.
Exit
(
lockObj
);
}
MissionChangedEvent
?.
Invoke
();
return
missionInfo
;
}
...
...
@@ -276,7 +273,6 @@ namespace DeviceLibrary.manager
{
Monitor
.
Exit
(
lockObj
);
}
MissionChangedEvent
?.
Invoke
();
return
missionInfo
;
}
...
...
@@ -311,7 +307,6 @@ namespace DeviceLibrary.manager
{
Monitor
.
Exit
(
lockObj
);
}
MissionChangedEvent
?.
Invoke
();
return
missionInfo
;
}
...
...
@@ -343,7 +338,6 @@ namespace DeviceLibrary.manager
{
Monitor
.
Exit
(
lockObj
);
}
MissionChangedEvent
?.
Invoke
();
return
missionInfo
;
}
/// <summary>
...
...
@@ -387,7 +381,7 @@ namespace DeviceLibrary.manager
MissionChangedEvent
?.
Invoke
();
}
public
static
void
SetMissionState
(
MissionInfo
missionInfo
,
MissionState
missionState
)
static
void
SetMissionState
(
MissionInfo
missionInfo
,
MissionState
missionState
)
{
missionInfo
.
SetState
(
missionState
);
Log
.
Info
(
$
"设置任务[{missionInfo.missionId}] 状态为[{missionState}]成功"
);
...
...
DeviceLibrary/manager/UploadManager.cs
查看文件 @
132ba04
...
...
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace
DeviceLibrary.manager
{
public
class
UploadManager
public
class
UploadManager
{
#
region
上传到
ITS
static
object
locupdate
=
new
object
();
...
...
@@ -34,19 +34,14 @@ namespace DeviceLibrary.manager
curTarget
=
item
.
Place
.
Name
,
statusTxt
=
item
.
MissionText
};
if
(
item
.
CurJob
!=
null
&&
item
.
CurJob
.
JobParam
!=
null
&&
item
.
CurJob
.
JobParam
.
GetMissionInfo
()
!=
null
)
//当前状态:执行任务/归位中/充电中/故障中/调试中/手动/自动
if
(
item
.
StateID
.
Equals
(
eAGVState
.
Error
)
||
item
.
StateID
.
Equals
(
eAGVState
.
EmergencyStop
))
{
agvState
.
state
=
"执行任务"
;
agvState
.
missionId
=
item
.
CurJob
.
JobParam
.
GetMissionInfo
().
missionId
;
agvState
.
remark
=
item
.
CurJob
.
JobParam
.
GetMissionInfo
().
Remark
;
agvState
.
state
=
"故障中"
;
}
else
else
if
(
item
.
Auto
)
{
if
(
item
.
StateID
.
Equals
(
eAGVState
.
Error
)
||
item
.
StateID
.
Equals
(
eAGVState
.
EmergencyStop
))
{
agvState
.
state
=
"故障中"
;
}
else
if
(
item
.
CurJob
!=
null
&&
item
.
CurJob
is
StandyJob
)
if
(
item
.
CurJob
!=
null
&&
item
.
CurJob
is
StandyJob
)
{
agvState
.
state
=
"归位中"
;
}
...
...
@@ -54,6 +49,20 @@ namespace DeviceLibrary.manager
{
agvState
.
state
=
"充电中"
;
}
else
if
(
item
.
CurJob
!=
null
&&
item
.
CurJob
.
JobParam
!=
null
&&
item
.
CurJob
.
JobParam
.
GetMissionInfo
()
!=
null
)
{
agvState
.
state
=
"执行任务"
;
agvState
.
missionId
=
item
.
CurJob
.
JobParam
.
GetMissionInfo
().
missionId
;
agvState
.
remark
=
item
.
CurJob
.
JobParam
.
GetMissionInfo
().
Remark
;
}
else
if
(
item
.
IsDebug
)
agvState
.
state
=
"调试中"
;
else
agvState
.
state
=
"自动"
;
}
else
{
agvState
.
state
=
"手动"
;
}
agvStates
.
Add
(
agvState
);
}
...
...
@@ -82,8 +91,9 @@ namespace DeviceLibrary.manager
HttpManager
.
UpdateAGVtranstask
(
txt
);
System
.
Threading
.
Thread
.
Sleep
(
2000
);
}
catch
(
Exception
ex
)
{
Common
.
LogUtil
.
error
(
$
"UploadTransportStatus:{Common.JsonHelper.SerializeObject(transportStatus)}"
,
ex
);
catch
(
Exception
ex
)
{
Common
.
LogUtil
.
error
(
$
"UploadTransportStatus:{Common.JsonHelper.SerializeObject(transportStatus)}"
,
ex
);
}
}
#
endregion
...
...
DeviceLibrary/service/Service.cs
查看文件 @
132ba04
...
...
@@ -105,16 +105,16 @@ namespace DeviceLibrary
{
if
(
missionInfo
.
State
.
Equals
(
MissionState
.
创建
))
{
MissionManager
.
SetMissionState
(
missionInfo
,
MissionState
.
取消
);
MissionManager
.
DeleteById
(
deleteMission
.
missionId
)
;
MissionManager
.
SetMissionState
(
missionInfo
.
missionId
,
MissionState
.
取消
,
out
string
msg
);
result
.
msg
=
msg
;
}
else
{
AgvInfo
agvInfo
=
AGVManager
.
agvInfo
.
Find
(
k
=>
k
.
JobContext
.
MissionId
==
deleteMission
.
missionId
);
if
(
agvInfo
==
null
)
{
MissionManager
.
SetMissionState
(
missionInfo
,
MissionState
.
中止
);
MissionManager
.
DeleteById
(
deleteMission
.
missionId
)
;
MissionManager
.
SetMissionState
(
missionInfo
.
missionId
,
MissionState
.
中止
,
out
string
msg
);
result
.
msg
=
msg
;
}
else
{
...
...
DeviceLibrary/service/model/AgvState.cs
查看文件 @
132ba04
...
...
@@ -30,7 +30,7 @@ namespace DeviceLibrary.service.model
/// </summary>
public
MirPosition
position
{
get
;
set
;
}
/// <summary>
/// 当前状态:执行任务/归位中/充电中/故障中
/// 当前状态:执行任务/归位中/充电中/故障中
/调试中/手动/自动
/// </summary>
public
string
state
{
get
;
set
;
}
/// <summary>
...
...
DeviceLibrary/service/model/MissionInfo.cs
查看文件 @
132ba04
...
...
@@ -23,7 +23,7 @@ namespace DeviceLibrary.service.model
/// 优先级。3最高,1最低
/// </summary>
//public int Priority { get; set; } = 1;
/// <summary>
/// 是否可合并
/// </summary>
...
...
@@ -195,19 +195,19 @@ namespace DeviceLibrary.service.model
/// </summary>
public
enum
ProjectType
{
无
=
0
,
无
=
0
,
PCB
领用
,
Tray
领用
,
治具领用
,
包材领用
,
半成品领用
,
静电箱领用
,
空台车领用
,
空台车归还
,
包材归还
,
成品入库
,
半成品入库
,
半成品入库与领用
,
垃圾清运
垃圾清运
,
治具领用
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论