Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
Qisda-SO1037-AGVDispatch
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 18a55eb0
由
张东亮
编写于
2023-02-16 21:52:21 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
添加AUO接口
1 个父辈
af252c41
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
77 行增加
和
25 行删除
AGVDispatch/App.config
AGVDispatch/FrmMain.cs
DeviceLibrary/Control.cs
DeviceLibrary/bean/jobType/JobType.cs
DeviceLibrary/bean/jobType/LineToLiftJobType.cs
DeviceLibrary/bean/jobType/ShelfBuffToLiftJobType.cs
DeviceLibrary/bean/jobType/SteelLineToLiftJobType.cs
DeviceLibrary/manager/HttpManager.cs
DeviceLibrary/manager/MissionManager.cs
DeviceLibrary/manager/UploadManager.cs
DeviceLibrary/service/IService.cs
AGVDispatch/App.config
查看文件 @
18a55eb
...
...
@@ -63,6 +63,8 @@
<
add
key
=
"FileName_AgvContext"
value
=
"AgvContext.json"
/>
<!--
3
D
放置钢网的地方-->
<
add
key
=
"SteelShelfPos"
value
=
"SteelShelfPos"
/>
<!--
AUO
接口地址-->
<
add
key
=
"AUOServer"
value
=
"http://127.0.0.1:8088/AuoAgv/UseElevator"
/>
</
appSettings
>
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
...
...
AGVDispatch/FrmMain.cs
查看文件 @
18a55eb
...
...
@@ -157,7 +157,7 @@ namespace AGVControl
Invoke
(
new
Action
(()
=>
{
txtShow
.
Text
=
DeviceLibrary
.
HttpManager
.
Agvtransinfo
;
txtShow
.
Text
=
JsonHelper
.
SerializeObject
(
MissionManager
.
AUOResult
)
;
try
{
...
...
DeviceLibrary/Control.cs
查看文件 @
18a55eb
...
...
@@ -6,6 +6,7 @@ using System.Threading;
using
System.Threading.Tasks
;
using
System.Web.Script.Serialization
;
using
Common
;
using
DeviceLibrary.manager
;
using
log4net.Util
;
using
RestSharp
;
...
...
@@ -123,6 +124,7 @@ namespace DeviceLibrary
bool
rtn
;
if
(
AgvStateInProcess
)
return
;
AgvStateInProcess
=
true
;
HttpManager
.
AUOIsUsingD2
(
out
MissionManager
.
AUOResult
);
for
(
int
i
=
0
;
i
<
AGVManager
.
agvInfo
.
Count
;
i
++)
{
AgvInfo
agv
=
AGVManager
.
agvInfo
[
i
];
...
...
@@ -143,10 +145,13 @@ namespace DeviceLibrary
log
.
Info
(
$
"{agv.Name}:Task=-1处理,Fleet有任务,自动赋值FleetTaskID={agv.TaskRunState.TaskID}"
);
}
}
MiR_API
.
Get_Task_State
(
agv
);
Thread
.
Sleep
(
50
);
MiR_API
.
Get_IO_Status
(
agv
);
if
((
agv
.
CurJob
!=
null
&&
!(
agv
.
CurJob
is
ChargeJob
||
agv
.
CurJob
is
StandyJob
))
&&
(
AGVManager
.
agvInfo
[
i
].
StateID
.
Equals
(
eAGVState
.
Executing
)))
{
MiR_API
.
Get_Task_State
(
agv
);
Thread
.
Sleep
(
50
);
MiR_API
.
Get_IO_Status
(
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
,
out
List
<
Mir_Error
>
errors
);
Thread
.
Sleep
(
50
);
...
...
@@ -236,14 +241,6 @@ namespace DeviceLibrary
{
agv
.
CurJob
=
agv
.
CurJob
.
Execute
(
agv
);
}
if
(
(
agv
.
CurJob
!=
null
&&
!(
agv
.
CurJob
is
ChargeJob
||
agv
.
CurJob
is
StandyJob
))&&
(
AGVManager
.
agvInfo
[
i
].
StateID
.
Equals
(
eAGVState
.
Executing
)))
{
MiR_API
.
Get_Task_State
(
agv
);
Thread
.
Sleep
(
50
);
MiR_API
.
Get_IO_Status
(
agv
);
}
}
catch
(
Exception
ex
)
{
...
...
DeviceLibrary/bean/jobType/JobType.cs
查看文件 @
18a55eb
using
Common
;
using
DeviceLibrary.lift
;
using
DeviceLibrary.manager
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
@@ -70,5 +71,9 @@ namespace DeviceLibrary
return
false
;
}
}
protected
bool
AUOUsingD2
(
string
liftName
)
{
return
SettingString
.
LIFT_D2
.
Equals
(
liftName
)
&&
MissionManager
.
AUOIsUsingD2
();
}
}
}
DeviceLibrary/bean/jobType/LineToLiftJobType.cs
查看文件 @
18a55eb
...
...
@@ -24,6 +24,10 @@ namespace DeviceLibrary.bean.jobType
service
.
model
.
MissionInfo
missionInfo
=
manager
.
MissionManager
.
GetLineToLiftMission
(
agv
,
out
string
liftname
);
if
(
missionInfo
!=
null
)
{
if
(
AUOUsingD2
(
liftname
))
{
return
null
;
}
if
(
CheckHasSameJob
(
agv
,
liftname
))
return
null
;
Node
src
=
manager
.
NodeManager
.
GetNode
(
missionInfo
.
sourcePoint
,
NodeType
.
Node
);
...
...
DeviceLibrary/bean/jobType/ShelfBuffToLiftJobType.cs
查看文件 @
18a55eb
...
...
@@ -25,6 +25,10 @@ namespace DeviceLibrary.bean.jobType
service
.
model
.
MissionInfo
missionInfo
=
manager
.
MissionManager
.
BuffToLiftMission
(
agv
);
if
(
missionInfo
!=
null
)
{
if
(
AUOUsingD2
(
SettingString
.
LIFT_D2
))
{
return
null
;
}
if
(
CheckHasSameJob
(
agv
,
missionInfo
.
liftName
))
return
null
;
Node
src
=
manager
.
NodeManager
.
GetNode
(
SettingString
.
ShelfBuff
,
NodeType
.
Node
);
...
...
DeviceLibrary/bean/jobType/SteelLineToLiftJobType.cs
查看文件 @
18a55eb
...
...
@@ -20,6 +20,10 @@ namespace DeviceLibrary.bean.jobType
service
.
model
.
MissionInfo
missionInfo
=
manager
.
MissionManager
.
GetSteelLineToLiftMission
(
agv
,
out
string
liftname
);
if
(
missionInfo
!=
null
)
{
if
(
AUOUsingD2
(
liftname
))
{
return
null
;
}
Node
src
=
manager
.
NodeManager
.
GetNode
(
missionInfo
.
sourcePoint
,
NodeType
.
Node
);
Node
dest
=
manager
.
NodeManager
.
GetNode
(
liftname
,
NodeType
.
Lift
);
if
(
src
==
null
)
...
...
DeviceLibrary/manager/HttpManager.cs
查看文件 @
18a55eb
using
Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Runtime.CompilerServices
;
using
static
DeviceLibrary
.
HttpManager
;
namespace
DeviceLibrary
{
...
...
@@ -388,7 +390,32 @@ namespace DeviceLibrary
return
false
;
}
static
string
auoServer
=
Common
.
AppConfigHelper
.
GetValue
(
"AUOServer"
);
/// <summary>
/// AUO小车是否在用D2
/// </summary>
/// <param name="result"></param>
/// <returns>true:在使用中</returns>
public
static
bool
AUOIsUsingD2
(
out
Result
result
)
{
result
=
new
Result
();
try
{
string
resultStr
=
HttpHelper
.
Get
(
auoServer
);
result
=
JsonHelper
.
DeserializeJsonToObject
<
Result
>(
resultStr
);
if
(
result
==
null
)
return
false
;
else
if
(
result
.
code
.
Equals
(
0
))
{
return
true
;
}
}
catch
(
Exception
ex
)
{
log
.
Error
(
ex
);
}
return
false
;
}
#
region
ITS
接口
...
...
@@ -422,9 +449,9 @@ namespace DeviceLibrary
//Dictionary<string, string> param = new Dictionary<string, string>();
//param.Add("info", txt);
//string addr = GetItsAddr("/UpdateAgvtransinfo", param);
// string resultStr = HttpHelper.Get(addr);
// string resultStr = HttpHelper.Get(addr);
string
resultStr
=
HttpHelper
.
PostWithFormUrlEncoded
(
agvreportstate
,
$
"info={txt}"
,
System
.
Text
.
Encoding
.
UTF8
);
string
resultStr
=
HttpHelper
.
PostWithFormUrlEncoded
(
agvreportstate
,
$
"info={txt}"
,
System
.
Text
.
Encoding
.
UTF8
);
itsData
data
=
JsonHelper
.
DeserializeJsonToObject
<
itsData
>(
resultStr
);
//fbackkinfo":"no agvinfo","fbacktime":"20215306105317"}
//if (data == null)
...
...
@@ -439,7 +466,7 @@ namespace DeviceLibrary
}
catch
(
Exception
e
)
{
log
.
Error
(
"AgvReportState"
,
e
);
//
log.Error("AgvReportState", e);
}
}
...
...
DeviceLibrary/manager/MissionManager.cs
查看文件 @
18a55eb
...
...
@@ -18,7 +18,16 @@ namespace DeviceLibrary.manager
public
delegate
void
MissionChangedEventHandler
();
public
static
event
MissionChangedEventHandler
MissionChangedEvent
;
static
Service
web
=
new
Service
();
public
static
Result
AUOResult
=
new
Result
()
{
code
=
-
1
};
public
static
log4net
.
ILog
Log
=
log4net
.
LogManager
.
GetLogger
(
"MissionManager"
);
/// <summary>
/// AUO是否在使用电梯D2
/// </summary>
/// <returns></returns>
public
static
bool
AUOIsUsingD2
()
{
return
AUOResult
?.
code
==
0
;
}
public
static
void
InitMission
()
{
DataBufferManager
.
Missions
=
getValiteMissionsFromDB
();
...
...
@@ -142,7 +151,7 @@ namespace DeviceLibrary.manager
public
static
string
GetByFinishedShelfNeedLeaveInLift
(
string
liftId
)
{
var
m
=
GetMissionInfos
().
Find
(
s
=>
liftId
.
Equals
(
s
.
liftName
)
&&
s
.
projectType
.
Equals
(
ProjectType
.
移远成品入库
)
&&
(
s
.
state
==
MissionState
.
电梯运行
&&
(
s
.
state
==
MissionState
.
电梯运行
||
s
.
state
==
MissionState
.
返回电梯运行
));
if
(
m
!=
null
)
return
m
.
missionId
;
...
...
@@ -283,7 +292,7 @@ namespace DeviceLibrary.manager
agv
.
Scope
.
Tasks
.
Contains
(
s
.
projectType
.
ToString
())
));
if
(
missionInfo
!=
null
&&
AgvCanGetMission
(
missionInfo
))
return
missionInfo
;
return
missionInfo
;
}
catch
(
Exception
e
)
...
...
@@ -466,10 +475,10 @@ namespace DeviceLibrary.manager
missionInfo
=
missions
.
Where
(
s
=>
s
.
destinationWorkshop
.
Equals
(
agv
.
Scope
.
Workshop
)
&&
s
.
sourceWorkshop
.
Equals
(
agv
.
Scope
.
Workshop
)
&&
((
s
.
projectType
.
Equals
(
ProjectType
.
半成品领用
)
||
s
.
projectType
.
Equals
(
ProjectType
.
空台车领用
)||
s
.
projectType
.
Equals
(
ProjectType
.
空台车归还
))
||
(
s
.
sourceWorkshop
.
Equals
(
s
.
destinationWorkshop
)))
((
s
.
projectType
.
Equals
(
ProjectType
.
半成品领用
)
||
s
.
projectType
.
Equals
(
ProjectType
.
空台车领用
)
||
s
.
projectType
.
Equals
(
ProjectType
.
空台车归还
))
||
(
s
.
sourceWorkshop
.
Equals
(
s
.
destinationWorkshop
)))
&&
(
s
.
state
==
MissionState
.
创建
)
&&
agv
.
Scope
.
Tasks
.
Contains
(
s
.
projectType
.
ToString
())).
FirstOrDefault
();
if
(
missionInfo
!=
null
&&
AgvCanGetMission
(
missionInfo
))
...
...
DeviceLibrary/manager/UploadManager.cs
查看文件 @
18a55eb
...
...
@@ -17,7 +17,7 @@ namespace DeviceLibrary.manager
/// </summary>
public
static
void
UploadAgvState
()
{
if
(
Monitor
.
TryEnter
(
locupdate
,
2000
))
if
(
Monitor
.
TryEnter
(
locupdate
))
{
try
{
...
...
DeviceLibrary/service/IService.cs
查看文件 @
18a55eb
...
...
@@ -39,7 +39,7 @@ namespace DeviceLibrary
}
[
DataContract
]
internal
class
Result
public
class
Result
{
/// <summary>
/// 状态码,0为正常
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论