Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
Qisda-SO1037-AGVDispatch
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 2bcd27b0
由
张东亮
编写于
2022-03-17 10:42:49 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
楼上两小车抢用同一电梯问题修复
1 个父辈
c0e131f3
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
132 行增加
和
42 行删除
AGVDispatch/App.config
AGVDispatch/Manual.cs
AGVDispatch/Program.cs
DeviceLibrary/Config/agvinfos.xml
DeviceLibrary/Control.cs
DeviceLibrary/DeviceLibrary.csproj
DeviceLibrary/bean/MiR_API.cs
DeviceLibrary/bean/agv/Agv_Info.cs
DeviceLibrary/bean/agv/Mir_Error.cs
DeviceLibrary/bean/job/F1LiftToStoreJob.cs
DeviceLibrary/bean/job/F1StoreToLiftJob.cs
DeviceLibrary/bean/job/LiftToLinesJob.cs
DeviceLibrary/lift/LiftContext.cs
DeviceLibrary/lift/LiftInfo.cs
DeviceLibrary/manager/AgvTaskManager.cs
DeviceLibrary/manager/UploadManager.cs
AGVDispatch/App.config
查看文件 @
2bcd27b
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
<!--点位配置文件名-->
<!--点位配置文件名-->
<
add
key
=
"File_NodeInfo"
value
=
"nodeinfos.xml"
/>
<
add
key
=
"File_NodeInfo"
value
=
"nodeinfos.xml"
/>
<!--使用到的电梯名配置名-->
<!--使用到的电梯名配置名-->
<
add
key
=
"Lift_Names"
value
=
"L
EFT_D2,LE
FT_C1"
/>
<
add
key
=
"Lift_Names"
value
=
"L
IFT_D2,LI
FT_C1"
/>
<!--充电最低/最高电量值-->
<!--充电最低/最高电量值-->
<
add
key
=
"ChargeThreshold"
value
=
"20,90"
/>
<
add
key
=
"ChargeThreshold"
value
=
"20,90"
/>
<!--等待人员操作超时时间(分钟)-->
<!--等待人员操作超时时间(分钟)-->
...
...
AGVDispatch/Manual.cs
查看文件 @
2bcd27b
...
@@ -118,6 +118,10 @@ namespace AGVControl
...
@@ -118,6 +118,10 @@ namespace AGVControl
}
}
}
}
catch
{
}
catch
{
}
foreach
(
string
item
in
Agv
.
Scope
.
Remark
.
Split
(
','
))
{
DeviceLibrary
.
lift
.
LiftContext
.
ResetLiftOccupiedAgv
(
item
);
}
//MiR_API.Del_Mission(Agv);
//MiR_API.Del_Mission(Agv);
//添加Init任务
//添加Init任务
AgvTaskManager
.
AssignMission
(
Agv
,
$
"{SettingString.Init}"
);
AgvTaskManager
.
AssignMission
(
Agv
,
$
"{SettingString.Init}"
);
...
...
AGVDispatch/Program.cs
查看文件 @
2bcd27b
...
@@ -45,6 +45,7 @@ namespace AGVControl
...
@@ -45,6 +45,7 @@ namespace AGVControl
LogUtil
.
info
(
"=====程序开始====="
);
LogUtil
.
info
(
"=====程序开始====="
);
NodeManager
.
InitNodesInfos
();
NodeManager
.
InitNodesInfos
();
IOManager
.
Start
();
IOManager
.
Start
();
DeviceLibrary
.
lift
.
LiftContext
.
Init
();
DeviceLibrary
.
manager
.
MissionManager
.
InitMission
();
DeviceLibrary
.
manager
.
MissionManager
.
InitMission
();
ChargePileManager
.
Init
();
ChargePileManager
.
Init
();
AGVManager
.
Init
();
AGVManager
.
Init
();
...
...
DeviceLibrary/Config/agvinfos.xml
查看文件 @
2bcd27b
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<agvs>
<agvs>
<agv
id=
"20"
ip=
"1
0.85.199.68
"
>
<agv
id=
"20"
ip=
"1
92.168.101.75
"
>
<name>
2号车
</name>
<name>
2号车
</name>
<!--职责范围-->
<!--职责范围-->
<Scope>
<Scope>
...
...
DeviceLibrary/Control.cs
查看文件 @
2bcd27b
...
@@ -111,9 +111,9 @@ namespace DeviceLibrary
...
@@ -111,9 +111,9 @@ namespace DeviceLibrary
Thread
.
Sleep
(
50
);
Thread
.
Sleep
(
50
);
MiR_API
.
Get_IO_Status
(
agv
);
MiR_API
.
Get_IO_Status
(
agv
);
//获取AGV状态
//获取AGV状态
rtn
=
MiR_API
.
Get_State
(
agv
,
out
eAGVState
stateID
,
out
string
stateText
,
out
int
battery
,
out
string
mission_text
,
out
AgvInfo
.
MirPosition
position
);
rtn
=
MiR_API
.
Get_State
(
agv
,
out
eAGVState
stateID
,
out
string
stateText
,
out
int
battery
,
out
string
mission_text
,
out
AgvInfo
.
MirPosition
position
,
out
List
<
Mir_Error
>
errors
);
Thread
.
Sleep
(
50
);
Thread
.
Sleep
(
50
);
if
(
rtn
)
change
=
agv
.
SetState
(
stateID
,
battery
,
mission_text
,
position
);
if
(
rtn
)
change
=
agv
.
SetState
(
stateID
,
battery
,
mission_text
,
position
,
errors
);
// if (change)
// if (change)
{
{
...
...
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
2bcd27b
...
@@ -62,6 +62,7 @@
...
@@ -62,6 +62,7 @@
<ItemGroup>
<ItemGroup>
<Compile Include="bean\agv\Agv_Info.cs" />
<Compile Include="bean\agv\Agv_Info.cs" />
<Compile Include="bean\agv\JobContext.cs" />
<Compile Include="bean\agv\JobContext.cs" />
<Compile Include="bean\agv\Mir_Error.cs" />
<Compile Include="bean\agv\Scope.cs" />
<Compile Include="bean\agv\Scope.cs" />
<Compile Include="bean\ChargePiles.cs" />
<Compile Include="bean\ChargePiles.cs" />
<Compile Include="bean\jobType\LineToLineJobType.cs" />
<Compile Include="bean\jobType\LineToLineJobType.cs" />
...
@@ -85,6 +86,7 @@
...
@@ -85,6 +86,7 @@
<Compile Include="Control.cs" />
<Compile Include="Control.cs" />
<Compile Include="lift\ClientStatus.cs" />
<Compile Include="lift\ClientStatus.cs" />
<Compile Include="lift\LiftContext.cs" />
<Compile Include="lift\LiftContext.cs" />
<Compile Include="lift\LiftInfo.cs" />
<Compile Include="lift\LiftStatus.cs" />
<Compile Include="lift\LiftStatus.cs" />
<Compile Include="manager\IOManager.cs" />
<Compile Include="manager\IOManager.cs" />
<Compile Include="manager\NodeManager.cs" />
<Compile Include="manager\NodeManager.cs" />
...
...
DeviceLibrary/bean/MiR_API.cs
查看文件 @
2bcd27b
...
@@ -571,16 +571,17 @@ namespace DeviceLibrary
...
@@ -571,16 +571,17 @@ namespace DeviceLibrary
/// <param name="battery"></param>
/// <param name="battery"></param>
/// <param name="mission_text"></param>
/// <param name="mission_text"></param>
/// <returns></returns>
/// <returns></returns>
public
static
bool
Get_State
(
AgvInfo
info
,
out
eAGVState
stateID
,
out
string
stateText
,
out
int
battery
,
out
string
mission_text
,
out
MirPosition
position
)
public
static
bool
Get_State
(
AgvInfo
info
,
out
eAGVState
stateID
,
out
string
stateText
,
out
int
battery
,
out
string
mission_text
,
out
MirPosition
position
,
out
List
<
Mir_Error
>
mir_Errors
)
{
{
stateID
=
eAGVState
.
UNKNOWN
;
stateID
=
eAGVState
.
UNKNOWN
;
stateText
=
""
;
stateText
=
""
;
battery
=
0
;
battery
=
0
;
mission_text
=
""
;
mission_text
=
""
;
position
=
new
MirPosition
();
position
=
new
MirPosition
();
mir_Errors
=
new
List
<
Mir_Error
>();
try
try
{
{
string
url
=
"http://"
+
info
.
IP
+
"/api/v2.0.0/status?whitelist=state_id,state_text,battery_percentage,mission_text,position"
;
string
url
=
"http://"
+
info
.
IP
+
"/api/v2.0.0/status?whitelist=state_id,state_text,battery_percentage,mission_text,position
,errors
"
;
string
json
=
HttpGet
(
url
,
info
.
IP
,
info
.
Authorization
);
string
json
=
HttpGet
(
url
,
info
.
IP
,
info
.
Authorization
);
if
(
string
.
IsNullOrWhiteSpace
(
json
))
return
false
;
if
(
string
.
IsNullOrWhiteSpace
(
json
))
return
false
;
JavaScriptSerializer
serializer
=
new
JavaScriptSerializer
();
JavaScriptSerializer
serializer
=
new
JavaScriptSerializer
();
...
@@ -609,6 +610,17 @@ namespace DeviceLibrary
...
@@ -609,6 +610,17 @@ namespace DeviceLibrary
position
.
orientation
=
Convert
.
ToSingle
(
posDic
[
"orientation"
].
ToString
());
position
.
orientation
=
Convert
.
ToSingle
(
posDic
[
"orientation"
].
ToString
());
position
.
Point
.
X
=
Convert
.
ToSingle
(
posDic
[
"x"
]);
position
.
Point
.
X
=
Convert
.
ToSingle
(
posDic
[
"x"
]);
position
.
Point
.
Y
=
Convert
.
ToSingle
(
posDic
[
"y"
]);
position
.
Point
.
Y
=
Convert
.
ToSingle
(
posDic
[
"y"
]);
object
[]
errors
=
(
object
[])
dic
[
"errors"
];
if
(
errors
!=
null
)
{
foreach
(
var
item
in
errors
)
{
Dictionary
<
string
,
object
>
tmp
=
(
Dictionary
<
string
,
object
>)
item
;
mir_Errors
.
Add
(
new
Mir_Error
()
{
code
=
int
.
Parse
(
tmp
[
"code"
].
ToString
()),
description
=
tmp
[
"description"
].
ToString
(),
module
=
tmp
[
"module"
].
ToString
()
});
}
}
return
true
;
return
true
;
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
...
DeviceLibrary/bean/agv/Agv_Info.cs
查看文件 @
2bcd27b
...
@@ -92,7 +92,7 @@ namespace DeviceLibrary
...
@@ -92,7 +92,7 @@ namespace DeviceLibrary
/// 小车的状态ID,(从小车获取)
/// 小车的状态ID,(从小车获取)
/// </summary>
/// </summary>
public
eAGVState
StateID
{
set
;
get
;
}
public
eAGVState
StateID
{
set
;
get
;
}
public
List
<
Mir_Error
>
Errors
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 负载
/// 负载
/// </summary>
/// </summary>
...
@@ -265,7 +265,7 @@ namespace DeviceLibrary
...
@@ -265,7 +265,7 @@ namespace DeviceLibrary
Place
=
new
Node
();
Place
=
new
Node
();
Msg
=
""
;
Msg
=
""
;
Position
=
new
MirPosition
();
Position
=
new
MirPosition
();
RunInfos
=
new
List
<
string
>()
{
"状态"
,
"目的地"
,
"车间"
,
"负载"
,
"运行模式"
,
"任务信息"
,
"AGV运行信息"
};
RunInfos
=
new
List
<
string
>()
{
"状态"
,
"目的地"
,
"车间"
,
"负载"
,
"运行模式"
,
"任务信息"
,
"AGV运行信息"
,
"错误消息"
};
StateKanban
=
new
AGV_UI
.
Status
(
name
,
RunInfos
);
StateKanban
=
new
AGV_UI
.
Status
(
name
,
RunInfos
);
}
}
public
AgvInfo
()
public
AgvInfo
()
...
@@ -273,7 +273,7 @@ namespace DeviceLibrary
...
@@ -273,7 +273,7 @@ namespace DeviceLibrary
Place
=
new
Node
();
Place
=
new
Node
();
Msg
=
""
;
Msg
=
""
;
Position
=
new
MirPosition
();
Position
=
new
MirPosition
();
RunInfos
=
new
List
<
string
>()
{
"状态"
,
"目的地"
,
"车间"
,
"顶升"
,
"运行模式"
,
"任务信息"
,
"AGV运行信息"
};
RunInfos
=
new
List
<
string
>()
{
"状态"
,
"目的地"
,
"车间"
,
"顶升"
,
"运行模式"
,
"任务信息"
,
"AGV运行信息"
,
"错误消息"
};
StateKanban
=
new
AGV_UI
.
Status
(
RunInfos
);
StateKanban
=
new
AGV_UI
.
Status
(
RunInfos
);
IOStatus
=
new
List
<
IOInfo
>();
IOStatus
=
new
List
<
IOInfo
>();
TaskRunState
=
new
TaskRunState
();
TaskRunState
=
new
TaskRunState
();
...
@@ -284,7 +284,7 @@ namespace DeviceLibrary
...
@@ -284,7 +284,7 @@ namespace DeviceLibrary
int
IoLastTime
=
5000
;
int
IoLastTime
=
5000
;
int
StandLastTimeMinute
=
AppConfigHelper
.
GetIntValue
(
SettingString
.
StandTimeout
);
int
StandLastTimeMinute
=
AppConfigHelper
.
GetIntValue
(
SettingString
.
StandTimeout
);
public
DateTime
StandStartTime
=
DateTime
.
MaxValue
;
public
DateTime
StandStartTime
=
DateTime
.
MaxValue
;
public
bool
SetState
(
eAGVState
stateID
,
int
battery
,
string
missionText
,
MirPosition
position
)
public
bool
SetState
(
eAGVState
stateID
,
int
battery
,
string
missionText
,
MirPosition
position
,
List
<
Mir_Error
>
mir_Errors
)
{
{
bool
isChange
=
false
;
bool
isChange
=
false
;
bool
preShelfState
=
IsExistShelf
;
bool
preShelfState
=
IsExistShelf
;
...
@@ -343,6 +343,11 @@ namespace DeviceLibrary
...
@@ -343,6 +343,11 @@ namespace DeviceLibrary
MissionText
=
missionText
;
MissionText
=
missionText
;
StateKanban
.
ShowInfo
(
"AGV运行信息"
,
missionText
);
StateKanban
.
ShowInfo
(
"AGV运行信息"
,
missionText
);
}
}
if
(
mir_Errors
!=
null
&&
mir_Errors
.
Count
>
0
)
{
Errors
=
mir_Errors
;
StateKanban
.
ShowInfo
(
"错误消息"
,
string
.
Join
(
";"
,
Errors
));
}
CheckErrorState
();
CheckErrorState
();
CheckOfflineTimeOut
();
CheckOfflineTimeOut
();
CheckStandTimeOut
(
position
);
CheckStandTimeOut
(
position
);
...
@@ -520,7 +525,11 @@ namespace DeviceLibrary
...
@@ -520,7 +525,11 @@ namespace DeviceLibrary
if
(!
isAlarm
&&
errorState
)
if
(!
isAlarm
&&
errorState
)
{
{
isAlarm
=
true
;
isAlarm
=
true
;
SetErrorMsg
(
"状态:"
+
StateID
.
ToString
(),
(
DateTime
.
Now
-
offlineStartTime
).
TotalMinutes
.
ToString
(
"f2"
));
if
(
Errors
!=
null
&&
Errors
.
Count
>
0
)
{
SetErrorMsg
(
$
"状态:[{StateID.ToString()}][{string.Join("
;
", Errors)}]"
,
(
DateTime
.
Now
-
offlineStartTime
).
TotalMinutes
.
ToString
(
"f2"
));
}
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
()));
}
}
...
...
DeviceLibrary/bean/agv/Mir_Error.cs
0 → 100644
查看文件 @
2bcd27b
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
DeviceLibrary
{
public
class
Mir_Error
{
public
int
code
{
get
;
set
;
}
public
string
description
{
get
;
set
;
}
public
string
module
{
get
;
set
;
}
public
override
string
ToString
()
{
return
$
"code={code},description={description},module={module}"
;
}
}
}
DeviceLibrary/bean/job/F1LiftToStoreJob.cs
查看文件 @
2bcd27b
...
@@ -56,6 +56,7 @@ namespace DeviceLibrary.bean.job
...
@@ -56,6 +56,7 @@ namespace DeviceLibrary.bean.job
JobRunStep
.
ToNextStep
(
RunStep
.
S1F_LiftToStore_02_02_EnterLift
);
JobRunStep
.
ToNextStep
(
RunStep
.
S1F_LiftToStore_02_02_EnterLift
);
runInfo
=
$
"{JobParam.SrcNode.AliceName}门已开启,去取料点"
;
runInfo
=
$
"{JobParam.SrcNode.AliceName}门已开启,去取料点"
;
//任务状态变更
//任务状态变更
lift
.
LiftContext
.
SetLiftOccupiedAgv
(
JobParam
.
SrcNode
.
Name
,
agv
.
IP
);
MissionManager
.
SetMissionState
(
JobParam
.
GetMissionInfo
().
missionId
,
service
.
model
.
MissionState
.
返回电梯到达
,
out
string
msg
);
MissionManager
.
SetMissionState
(
JobParam
.
GetMissionInfo
().
missionId
,
service
.
model
.
MissionState
.
返回电梯到达
,
out
string
msg
);
AllocateTask
(
agv
,
$
"{JobParam.SrcNode.Name}_{SettingString.PutShelfOn}"
);
AllocateTask
(
agv
,
$
"{JobParam.SrcNode.Name}_{SettingString.PutShelfOn}"
);
JobRunStep
.
Msg
=
runInfo
;
JobRunStep
.
Msg
=
runInfo
;
...
...
DeviceLibrary/bean/job/F1StoreToLiftJob.cs
查看文件 @
2bcd27b
...
@@ -99,6 +99,7 @@ namespace DeviceLibrary
...
@@ -99,6 +99,7 @@ namespace DeviceLibrary
if
(
lift
.
LiftContext
.
HasShelfNeedLeave
(
JobParam
.
CurTargetNode
.
Name
,
agv
.
Client
,
out
liftStatus
))
if
(
lift
.
LiftContext
.
HasShelfNeedLeave
(
JobParam
.
CurTargetNode
.
Name
,
agv
.
Client
,
out
liftStatus
))
{
{
JobRunStep
.
ToNextStep
(
RunStep
.
S1F_StoreToLift_05_01_ToTemp1
);
JobRunStep
.
ToNextStep
(
RunStep
.
S1F_StoreToLift_05_01_ToTemp1
);
lift
.
LiftContext
.
SetLiftOccupiedAgv
(
JobParam
.
CurTargetNode
.
Name
,
agv
.
IP
);
runInfo
=
$
"{JobParam.CurTargetNode.AliceName}已开门。电梯内有料车,去临时点1的卸料点,准备卸下车上料车"
;
runInfo
=
$
"{JobParam.CurTargetNode.AliceName}已开门。电梯内有料车,去临时点1的卸料点,准备卸下车上料车"
;
AllocateTask
(
agv
,
$
"{JobParam.CurTargetNode.Name}_{SettingString.Temp1}_{SettingString.TakeShelfOff}"
);
AllocateTask
(
agv
,
$
"{JobParam.CurTargetNode.Name}_{SettingString.Temp1}_{SettingString.TakeShelfOff}"
);
service
.
model
.
MissionInfo
missionInfo
=
manager
.
MissionManager
.
GetMission
(
liftStatus
.
missionId
);
service
.
model
.
MissionInfo
missionInfo
=
manager
.
MissionManager
.
GetMission
(
liftStatus
.
missionId
);
...
...
DeviceLibrary/bean/job/LiftToLinesJob.cs
查看文件 @
2bcd27b
...
@@ -56,6 +56,7 @@ namespace DeviceLibrary.bean.job
...
@@ -56,6 +56,7 @@ namespace DeviceLibrary.bean.job
if
(
lift
.
LiftContext
.
IsDoorOpen
(
JobParam
.
SrcNode
.
Name
,
JobParam
.
GetMissionInfo
().
destinationFloor
))
if
(
lift
.
LiftContext
.
IsDoorOpen
(
JobParam
.
SrcNode
.
Name
,
JobParam
.
GetMissionInfo
().
destinationFloor
))
{
{
JobRunStep
.
ToNextStep
(
RunStep
.
SD_LiftToLine_03_EnterLift
);
JobRunStep
.
ToNextStep
(
RunStep
.
SD_LiftToLine_03_EnterLift
);
lift
.
LiftContext
.
SetLiftOccupiedAgv
(
JobParam
.
SrcNode
.
Name
,
agv
.
IP
);
runInfo
=
$
"{JobParam.SrcNode.AliceName}门已开启,进电梯取料点"
;
runInfo
=
$
"{JobParam.SrcNode.AliceName}门已开启,进电梯取料点"
;
AllocateTask
(
agv
,
$
"{JobParam.SrcNode.Name}_{SettingString.PutShelfOn}"
);
AllocateTask
(
agv
,
$
"{JobParam.SrcNode.Name}_{SettingString.PutShelfOn}"
);
//任务状态变更
//任务状态变更
...
@@ -219,6 +220,7 @@ namespace DeviceLibrary.bean.job
...
@@ -219,6 +220,7 @@ namespace DeviceLibrary.bean.job
if
(
lift
.
LiftContext
.
IsDoorOpen
(
JobParam
.
SrcNode
.
Name
,
JobParam
.
GetMissionInfo
().
destinationFloor
))
if
(
lift
.
LiftContext
.
IsDoorOpen
(
JobParam
.
SrcNode
.
Name
,
JobParam
.
GetMissionInfo
().
destinationFloor
))
{
{
JobRunStep
.
ToNextStep
(
RunStep
.
SD_LiftToLine_13_CheckLiftStatus
);
JobRunStep
.
ToNextStep
(
RunStep
.
SD_LiftToLine_13_CheckLiftStatus
);
lift
.
LiftContext
.
SetLiftOccupiedAgv
(
JobParam
.
SrcNode
.
Name
,
agv
.
IP
);
runInfo
=
$
"{JobParam.SrcNode.AliceName}门已开,检查电梯内该层是否有料车"
;
runInfo
=
$
"{JobParam.SrcNode.AliceName}门已开,检查电梯内该层是否有料车"
;
JobRunStep
.
Msg
=
runInfo
;
JobRunStep
.
Msg
=
runInfo
;
//上报位置
//上报位置
...
...
DeviceLibrary/lift/LiftContext.cs
查看文件 @
2bcd27b
...
@@ -9,15 +9,16 @@ namespace DeviceLibrary.lift
...
@@ -9,15 +9,16 @@ namespace DeviceLibrary.lift
public
class
LiftContext
public
class
LiftContext
{
{
/// <summary>
/// <summary>
/// 所有电梯
/// 所有电梯
状态
/// </summary>
/// </summary>
static
Dictionary
<
string
,
LiftStatus
>
lifts
=
new
Dictionary
<
string
,
LiftStatus
>();
static
Dictionary
<
string
,
LiftInfo
>
lifts
=
new
Dictionary
<
string
,
LiftInfo
>();
public
static
void
Init
()
public
static
void
Init
()
{
{
string
[]
names
=
Common
.
AppConfigHelper
.
GetValue
(
Common
.
SettingString
.
Lift_Names
).
Split
(
','
);
string
[]
names
=
Common
.
AppConfigHelper
.
GetValue
(
Common
.
SettingString
.
Lift_Names
).
Split
(
','
);
foreach
(
var
item
in
names
)
foreach
(
var
item
in
names
)
{
{
lifts
.
Add
(
item
,
new
Lift
Status
());
lifts
.
Add
(
item
,
new
Lift
Info
());
}
}
Common
.
LogUtil
.
info
(
$
"加载电梯信息完成:{string.Join("
,
", names)}"
);
Common
.
LogUtil
.
info
(
$
"加载电梯信息完成:{string.Join("
,
", names)}"
);
}
}
...
@@ -29,19 +30,11 @@ namespace DeviceLibrary.lift
...
@@ -29,19 +30,11 @@ namespace DeviceLibrary.lift
public
static
bool
IsDoorOpen
(
string
liftId
,
int
floor
)
public
static
bool
IsDoorOpen
(
string
liftId
,
int
floor
)
{
{
LiftStatus
liftStatus
=
GetLiftStatus
(
liftId
);
LiftStatus
liftStatus
=
GetLiftStatus
(
liftId
);
if
(
liftStatus
.
door
.
Equals
(
"opened"
)
&&
liftStatus
.
floor
.
Equals
(
floor
))
if
(
liftStatus
.
door
.
Equals
(
"opened"
)
&&
liftStatus
.
floor
.
Equals
(
floor
)
&&!
CheckLiftOccupied
(
liftId
)
)
return
true
;
return
true
;
return
false
;
return
false
;
}
}
/// <summary>
/// 电梯关门
/// </summary>
/// <param name="liftId"></param>
//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>
/// 请求使用电梯
/// 请求使用电梯
/// </summary>
/// </summary>
...
@@ -63,7 +56,7 @@ namespace DeviceLibrary.lift
...
@@ -63,7 +56,7 @@ namespace DeviceLibrary.lift
{
{
liftId
=
missionInfo
.
liftName
,
liftId
=
missionInfo
.
liftName
,
destinationFloor
=
missionInfo
.
sourceFloor
,
destinationFloor
=
missionInfo
.
sourceFloor
,
destinationPoint
=
missionInfo
.
sourcePoint
,
destinationPoint
=
missionInfo
.
sourcePoint
,
destinationClient
=
destclient
,
destinationClient
=
destclient
,
sourceFloor
=
missionInfo
.
destinationFloor
,
sourceFloor
=
missionInfo
.
destinationFloor
,
sourceClient
=
agvInfo
.
Client
sourceClient
=
agvInfo
.
Client
...
@@ -104,7 +97,8 @@ namespace DeviceLibrary.lift
...
@@ -104,7 +97,8 @@ namespace DeviceLibrary.lift
public
static
bool
AGVLeave
(
string
liftId
,
AgvInfo
agvInfo
)
public
static
bool
AGVLeave
(
string
liftId
,
AgvInfo
agvInfo
)
{
{
bool
rtn
=
HttpManager
.
AGVLeave
(
new
service
.
model
.
DoorInfo
()
{
liftId
=
liftId
,
sourceClient
=
agvInfo
.
Client
,
sourceFloor
=
agvInfo
.
Scope
.
Floor
});
bool
rtn
=
HttpManager
.
AGVLeave
(
new
service
.
model
.
DoorInfo
()
{
liftId
=
liftId
,
sourceClient
=
agvInfo
.
Client
,
sourceFloor
=
agvInfo
.
Scope
.
Floor
});
Common
.
LogUtil
.
info
(
$
"{agvInfo.Name} 离开 {rtn}"
);
ResetLiftOccupiedAgv
(
liftId
);
Common
.
LogUtil
.
info
(
$
"{agvInfo.Name} 离开 {liftId}:{rtn}"
);
return
rtn
;
return
rtn
;
}
}
/// <summary>
/// <summary>
...
@@ -127,19 +121,11 @@ namespace DeviceLibrary.lift
...
@@ -127,19 +121,11 @@ namespace DeviceLibrary.lift
/// <returns></returns>
/// <returns></returns>
public
static
bool
CheckAgvLeaveSig
(
string
liftId
)
public
static
bool
CheckAgvLeaveSig
(
string
liftId
)
{
{
if
(!
lifts
[
liftId
].
door
.
Equals
(
"opened"
))
if
(!
lifts
[
liftId
].
LiftStatus
.
door
.
Equals
(
"opened"
))
return
true
;
return
true
;
return
false
;
return
false
;
}
}
/// <summary>
/// <summary>
/// 运行到指定楼层
/// </summary>
/// <param name="liftId"></param>
/// <param name="floor"></param>
//public static void RunTo(string liftId,int floor)
//{
//}
/// <summary>
/// 有架子需要离开电梯
/// 有架子需要离开电梯
/// </summary>
/// </summary>
/// <param name="liftId"></param>
/// <param name="liftId"></param>
...
@@ -168,6 +154,34 @@ namespace DeviceLibrary.lift
...
@@ -168,6 +154,34 @@ namespace DeviceLibrary.lift
return
false
;
return
false
;
}
}
/// <summary>
/// <summary>
/// 占用电梯的agv
/// </summary>
/// <param name="agvIp"></param>
public
static
void
SetLiftOccupiedAgv
(
string
liftId
,
string
agvIp
)
{
lifts
[
liftId
].
OccupiedAgv
=
agvIp
;
}
public
static
void
ResetLiftOccupiedAgv
(
string
liftId
)
{
try
{
lifts
[
liftId
].
OccupiedAgv
=
""
;
}
catch
(
Exception
ex
)
{
Common
.
LogUtil
.
error
(
$
"清除电梯占用失败:{liftId}"
,
ex
);
}
}
/// <summary>
/// 检查电梯是否被占用
/// </summary>
/// <param name="liftId"></param>
/// <returns>true:占用</returns>
public
static
bool
CheckLiftOccupied
(
string
liftId
)
{
return
!
lifts
[
liftId
].
OccupiedAgv
.
Equals
(
""
);
}
/// <summary>
/// 获取电梯状态
/// 获取电梯状态
/// </summary>
/// </summary>
/// <param name="liftId"></param>
/// <param name="liftId"></param>
...
@@ -176,7 +190,7 @@ namespace DeviceLibrary.lift
...
@@ -176,7 +190,7 @@ namespace DeviceLibrary.lift
{
{
if
(
lifts
.
ContainsKey
(
liftId
))
if
(
lifts
.
ContainsKey
(
liftId
))
{
{
return
lifts
[
liftId
];
return
lifts
[
liftId
]
.
LiftStatus
;
}
}
else
else
return
new
LiftStatus
();
return
new
LiftStatus
();
...
@@ -192,7 +206,7 @@ namespace DeviceLibrary.lift
...
@@ -192,7 +206,7 @@ namespace DeviceLibrary.lift
LiftStatus
lift
=
HttpManager
.
UpdateStatusToLift
(
status
);
LiftStatus
lift
=
HttpManager
.
UpdateStatusToLift
(
status
);
if
(
lift
!=
null
)
if
(
lift
!=
null
)
{
{
lifts
[
status
.
liftId
]
=
lift
;
lifts
[
status
.
liftId
]
.
LiftStatus
=
lift
;
}
}
}
}
catch
(
Exception
e
)
catch
(
Exception
e
)
...
...
DeviceLibrary/lift/LiftInfo.cs
0 → 100644
查看文件 @
2bcd27b
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
DeviceLibrary.lift
{
public
class
LiftInfo
{
public
LiftStatus
LiftStatus
{
get
;
set
;
}
public
string
OccupiedAgv
{
get
;
set
;
}
=
""
;
public
LiftInfo
()
{
LiftStatus
=
new
LiftStatus
();
}
}
}
DeviceLibrary/manager/AgvTaskManager.cs
查看文件 @
2bcd27b
...
@@ -96,12 +96,16 @@ namespace DeviceLibrary
...
@@ -96,12 +96,16 @@ namespace DeviceLibrary
}
}
else
else
{
{
string
[]
names
=
taskname
.
Split
(
'_'
);
node
=
manager
.
NodeManager
.
GetNodeByName
(
taskname
);
foreach
(
string
item
in
names
)
if
(
node
==
null
)
{
{
node
=
manager
.
NodeManager
.
GetNodeByName
(
item
);
string
[]
names
=
taskname
.
Split
(
'_'
);
if
(
node
!=
null
)
foreach
(
string
item
in
names
)
break
;
{
node
=
manager
.
NodeManager
.
GetNodeByName
(
item
);
if
(
node
!=
null
)
break
;
}
}
}
}
}
...
...
DeviceLibrary/manager/UploadManager.cs
查看文件 @
2bcd27b
...
@@ -38,6 +38,8 @@ namespace DeviceLibrary.manager
...
@@ -38,6 +38,8 @@ namespace DeviceLibrary.manager
if
(
item
.
StateID
.
Equals
(
eAGVState
.
Error
)
||
item
.
StateID
.
Equals
(
eAGVState
.
EmergencyStop
))
if
(
item
.
StateID
.
Equals
(
eAGVState
.
Error
)
||
item
.
StateID
.
Equals
(
eAGVState
.
EmergencyStop
))
{
{
agvState
.
state
=
"故障中"
;
agvState
.
state
=
"故障中"
;
if
(
item
.
Errors
!=
null
&&
item
.
Errors
.
Count
>
0
)
agvState
.
remark
=
string
.
Join
(
";"
,
item
.
Errors
);
}
}
else
if
(
item
.
Auto
)
else
if
(
item
.
Auto
)
{
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论