Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
1069_MIMO_PlUS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 80107032
由
张东亮
编写于
2023-10-26 09:05:28 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
添加agv对接逻辑
1 个父辈
a04de88a
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
391 行增加
和
185 行删除
1069_MIMO_G2.sln
Common/util/ConfigAppSettings.cs
DeviceLibrary/DeviceLibrary.csproj
DeviceLibrary/theMachine/MainMachine.cs
DeviceLibrary/theMachine/MainMachine_AGV.cs
DeviceLibrary/theMachine/MainMachine_String.cs
DeviceLibrary/theMachine/MoveStep.cs
TheMachine/SettingControl.cs
1069_MIMO_G2.sln
查看文件 @
8010703
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 1
6
# Visual Studio Version 1
7
VisualStudioVersion = 1
6.0.30907.101
VisualStudioVersion = 1
7.5.33414.496
MinimumVisualStudioVersion = 10.0.40219.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}"
EndProject
EndProject
...
...
Common/util/ConfigAppSettings.cs
查看文件 @
8010703
...
@@ -22,188 +22,15 @@ namespace OnlineStore.Common
...
@@ -22,188 +22,15 @@ namespace OnlineStore.Common
Interlocked
.
Increment
(
ref
seq
);
Interlocked
.
Increment
(
ref
seq
);
return
seq
;
return
seq
;
}
}
public
static
string
GetValue
(
string
keyStr
,
string
storeStr
)
{
string
key
=
keyStr
+
storeStr
;
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
return
GetValue
(
keyStr
);
}
else
{
return
config
.
AppSettings
.
Settings
[
key
].
Value
;
}
}
public
static
decimal
GetNumValue
(
string
keyStr
,
string
storeStr
)
public
static
T
GetValue
<
T
>(
string
key
,
T
defaultVal
=
default
(
T
),
string
comment
=
""
)
{
string
key
=
keyStr
+
storeStr
;
decimal
a
=
0
;
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
return
GetNumValue
(
keyStr
);
}
else
{
{
Decimal
.
TryParse
(
config
.
AppSettings
.
Settings
[
key
].
Value
,
out
a
);
}
}
return
a
;
}
public
static
int
GetIntValue
(
string
keyStr
,
string
storeStr
)
{
string
key
=
keyStr
+
storeStr
;
int
a
=
0
;
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
return
GetIntValue
(
keyStr
);
}
else
{
{
Int32
.
TryParse
(
config
.
AppSettings
.
Settings
[
key
].
Value
,
out
a
);
}
}
return
a
;
}
public
static
string
GetValue
(
string
key
)
{
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
LogUtil
.
error
(
"未找到配置:"
+
key
+
",请检查配置是否完整!"
);
return
""
;
}
else
{
return
config
.
AppSettings
.
Settings
[
key
].
Value
;
}
}
public
static
decimal
GetNumValue
(
string
key
)
{
decimal
a
=
0
;
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
LogUtil
.
error
(
"未找到配置:"
+
key
+
",请检查配置是否完整!"
);
return
a
;
}
else
{
{
Decimal
.
TryParse
(
config
.
AppSettings
.
Settings
[
key
].
Value
,
out
a
);
}
}
return
a
;
}
public
static
int
GetIntValue
(
string
key
)
{
int
a
=
0
;
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
{
LogUtil
.
error
(
"未找到配置:"
+
key
+
",请检查配置是否完整!"
);
ConfigHelper
.
Config
.
SetComment
(
key
,
comment
);
return
a
;
return
ConfigHelper
.
Config
.
Get
(
key
,
defaultVal
);
}
}
else
public
static
void
SetValue
<
T
>(
string
key
,
T
defaultVal
=
default
(
T
))
{
{
{
ConfigHelper
.
Config
.
Set
(
key
,
defaultVal
);
Int32
.
TryParse
(
config
.
AppSettings
.
Settings
[
key
].
Value
,
out
a
);
}
}
return
a
;
}
public
static
void
SaveValue
(
string
key
,
int
value
)
{
SaveValue
(
key
,
value
.
ToString
());
}
public
static
void
SaveValue
(
string
key
,
string
value
)
{
try
{
if
(
key
.
Equals
(
""
)
||
value
.
Equals
(
""
))
{
return
;
}
//增加的内容写在appSettings段下 <add key="RegCode" value="0"/>
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
SetValue
(
key
,
value
);
}
else
{
UpdateConfig
(
key
,
value
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"SaveValue保存配置出错:AppKey="
+
key
+
",AppValue="
+
value
+
","
,
ex
);
}
}
public
static
string
GetValue
(
object
debugDeviceId
)
{
throw
new
NotImplementedException
();
}
/// <summary>
/// 更新配置文件信息
/// </summary>
/// <param name="name">配置文件字段名称</param>
/// <param name="Xvalue">值</param>
private
static
void
UpdateConfig
(
string
name
,
string
Xvalue
)
{
try
{
XmlDocument
doc
=
new
XmlDocument
();
doc
.
Load
(
Application
.
ExecutablePath
+
".config"
);
XmlNode
node
=
doc
.
SelectSingleNode
(
@"//add[@key='"
+
name
+
"']"
);
XmlElement
ele
=
(
XmlElement
)
node
;
ele
.
SetAttribute
(
"value"
,
Xvalue
);
doc
.
Save
(
Application
.
ExecutablePath
+
".config"
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"UpdateConfig保存配置出错:name="
+
name
+
",Xvalue="
+
Xvalue
+
","
,
ex
);
}
}
///<summary>
///向.config文件的appKey结写入信息AppValue 保存设置
///</summary>
///<param name="AppKey">节点名</param>
///<param name="AppValue">值</param>
private
static
void
SetValue
(
String
AppKey
,
String
AppValue
)
{
try
{
XmlDocument
xDoc
=
new
XmlDocument
();
xDoc
.
Load
(
System
.
Windows
.
Forms
.
Application
.
ExecutablePath
+
".config"
);
XmlNode
xNode
;
XmlElement
xElem1
;
XmlElement
xElem2
;
xNode
=
xDoc
.
SelectSingleNode
(
"//appSettings"
);
xElem1
=
(
XmlElement
)
xNode
.
SelectSingleNode
(
"//add[@key='"
+
AppKey
+
"']"
);
if
(
xElem1
!=
null
)
xElem1
.
SetAttribute
(
"value"
,
AppValue
);
else
{
xElem2
=
xDoc
.
CreateElement
(
"add"
);
xElem2
.
SetAttribute
(
"key"
,
AppKey
);
xElem2
.
SetAttribute
(
"value"
,
AppValue
);
xNode
.
AppendChild
(
xElem2
);
}
xDoc
.
Save
(
System
.
Windows
.
Forms
.
Application
.
ExecutablePath
+
".config"
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"SetValue保存配置出错:AppKey="
+
AppKey
+
",AppValue="
+
AppValue
+
","
,
ex
);
}
}
}
}
}
}
}
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
8010703
...
@@ -32,6 +32,10 @@
...
@@ -32,6 +32,10 @@
<WarningLevel>4</WarningLevel>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference Include="AGVLib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\DLL\AGVLib\AGVLib\bin\Debug\AGVLib.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary, Version=1.0.8384.25672, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="CodeLibrary, Version=1.0.8384.25672, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\CodeLibrary.dll</HintPath>
<HintPath>..\DLL\CodeLibrary.dll</HintPath>
...
@@ -90,6 +94,7 @@
...
@@ -90,6 +94,7 @@
<Compile Include="theMachine\Common.cs" />
<Compile Include="theMachine\Common.cs" />
<Compile Include="theMachine\JobList.cs" />
<Compile Include="theMachine\JobList.cs" />
<Compile Include="theMachine\LabelParam.cs" />
<Compile Include="theMachine\LabelParam.cs" />
<Compile Include="theMachine\MainMachine_AGV.cs" />
<Compile Include="theMachine\MainMachine_ServerControl.cs" />
<Compile Include="theMachine\MainMachine_ServerControl.cs" />
<Compile Include="theMachine\MainMachine _BtnProcess.cs" />
<Compile Include="theMachine\MainMachine _BtnProcess.cs" />
<Compile Include="theMachine\MainMachine _Common.cs" />
<Compile Include="theMachine\MainMachine _Common.cs" />
...
...
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
8010703
...
@@ -191,6 +191,7 @@ namespace DeviceLibrary
...
@@ -191,6 +191,7 @@ namespace DeviceLibrary
ConfigHelper
.
Config
.
Get
(
"CamTestReel_Ability"
,
false
);
ConfigHelper
.
Config
.
Get
(
"CamTestReel_Ability"
,
false
);
ConfigHelper
.
Config
.
Set
(
"CamTestReel_debug"
,
false
);
ConfigHelper
.
Config
.
Set
(
"CamTestReel_debug"
,
false
);
ConfigHelper
.
Config
.
Get
(
"Device_1315_ReelHeight_Compensation"
,
0
);
ConfigHelper
.
Config
.
Get
(
"Device_1315_ReelHeight_Compensation"
,
0
);
initAgv
();
}
}
private
void
Crc_LanguageChangeEvent
(
object
sender
,
EventArgs
e
)
private
void
Crc_LanguageChangeEvent
(
object
sender
,
EventArgs
e
)
...
@@ -275,6 +276,7 @@ namespace DeviceLibrary
...
@@ -275,6 +276,7 @@ namespace DeviceLibrary
if
(
runStatus
==
RunStatus
.
Running
)
if
(
runStatus
==
RunStatus
.
Running
)
{
{
ioMonitor
();
ioMonitor
();
AGVProcess
();
StringProcess
();
StringProcess
();
ClampProcess
();
ClampProcess
();
boxTransport
.
Process
();
boxTransport
.
Process
();
...
...
DeviceLibrary/theMachine/MainMachine_AGV.cs
0 → 100644
查看文件 @
8010703
using
AGVLib
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.Globalization
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Xml.Linq
;
namespace
DeviceLibrary
{
public
partial
class
MainMachine
{
string
serverIp
=
ConfigAppSettings
.
GetValue
(
"AGV_ServerIp"
,
"127.0.0.1"
,
"AGV服务软件所在电脑IP"
);
int
serverPort
=
ConfigAppSettings
.
GetValue
(
"AGV_ServerPort"
,
12000
,
"AGV服务接口"
);
int
nodeId
=
ConfigAppSettings
.
GetValue
(
"AGV_NodeId"
,
1
,
"AGV节点编号"
);
string
nodeName
=
ConfigAppSettings
.
GetValue
(
"AGV_NodeName"
,
"MIMO"
,
"AGV节点名称"
);
Client
client
;
Node
curNode
;
MoveInfo
AGVMoveInfo
;
void
initAgv
()
{
if
(!
UseAgv
())
return
;
AGVMoveInfo
=
new
MoveInfo
(
"AGV模块"
);
curNode
=
new
Node
()
{
id
=
nodeId
,
name
=
nodeName
,
};
client
=
new
Client
(
new
List
<
Node
>
{
curNode
});
client
.
ConnectedEvent
+=
Client_ConnectedEvent
;
client
.
ReceivedEvent
+=
Client_ReceivedEvent
;
client
.
Connect
(
serverIp
,
serverPort
);
LogUtil
.
LOGGER
.
Info
(
$
"初始化AGV节点,并连接服务端:{serverIp}:{serverPort}"
);
}
public
bool
UseAgv
()
{
return
ConfigAppSettings
.
GetValue
(
"AGV_Enable"
,
false
,
"是否启用AGV"
);
}
public
void
SetStatus
(
NodeStatus
nodeStatus
)
{
curNode
.
status
=
nodeStatus
;
client
.
SetStatus
(
curNode
);
}
private
void
Client_ReceivedEvent
(
Node
node
)
{
if
(
curNode
.
id
==
nodeId
&&
curNode
.
name
.
Equals
(
node
.
name
))
{
curNode
.
status
=
node
.
status
;
curNode
.
shelf_id
=
node
.
shelf_id
;
curNode
.
level
=
node
.
level
;
LogUtil
.
LOGGER
.
Info
(
$
"收到AGV服务端信息:【{node.name}】【{node.status}】【{node.shelf_id}】"
);
}
}
private
void
Client_ConnectedEvent
(
bool
status
)
{
if
(
status
)
LogUtil
.
LOGGER
.
Info
(
"已连接AGV服务端"
);
else
{
LogUtil
.
LOGGER
.
Info
(
"已断开AGV服务"
);
}
}
NodeStatus
curNodeStatus
;
/// <summary>
/// 呼叫AGV--需要料串
/// </summary>
void
needEnter
(
NodeStatus
nodeStatus
)
{
if
(
nodeStatus
.
Equals
(
NodeStatus
.
NeedEnter
)
||
nodeStatus
.
Equals
(
NodeStatus
.
NeedEnter_Empty
)
||
nodeStatus
.
Equals
(
NodeStatus
.
NeedEnter_Full
))
{
if
(
AGVMoveInfo
.
IsStep
(
MoveStep
.
Wait
))
{
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_In01
);
curNodeStatus
=
nodeStatus
;
AGVMoveInfo
.
log
(
$
"需要进入料串,{curNodeStatus}"
);
}
}
}
/// <summary>
/// 呼叫AGV--送出料串
/// </summary>
void
needLeave
(
NodeStatus
nodeStatus
)
{
if
(
nodeStatus
.
Equals
(
NodeStatus
.
NeedLeave
)
||
nodeStatus
.
Equals
(
NodeStatus
.
NeedLeave_Full
)
||
nodeStatus
.
Equals
(
NodeStatus
.
NeedLeave_Empty
))
{
if
(
AGVMoveInfo
.
IsStep
(
MoveStep
.
Wait
))
{
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_Out01
);
curNodeStatus
=
nodeStatus
;
AGVMoveInfo
.
log
(
$
"需要离开料串,{curNodeStatus}"
);
}
}
}
public
void
AGVProcess
()
{
if
(!
UseAgv
())
{
return
;
}
if
(
CheckWait
(
AGVMoveInfo
))
return
;
Node
curnode
=
curNode
;
if
(
curnode
==
null
)
{
LogUtil
.
LOGGER
.
Error
(
"无节点信息,请检查配置"
);
return
;
}
switch
(
AGVMoveInfo
.
MoveStep
)
{
case
MoveStep
.
Wait
:
if
(
StringMoveInfo
.
IsStep
(
MoveStep
.
StringOut_Released
)
||
StringMoveInfo
.
IsStep
(
MoveStep
.
Wait
))
{
if
(
curnode
.
status
.
Equals
(
NodeStatus
.
RequsetDock
)
||
curnode
.
status
.
Equals
(
NodeStatus
.
Arrive
))
{
//AGV已到达,请求开门
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_OpenDoor
);
AGVMoveInfo
.
log
(
$
"Wait,AGV到达,准备开门"
);
//AGV已到达,请求开门
OpenDoor
(
AGVMoveInfo
);
}
else
if
(
curnode
.
status
.
Equals
(
NodeStatus
.
DetachOk
))
{
//AGV分离完成,可关门
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_CloseDoor
);
CloseDoor
(
AGVMoveInfo
);
AGVMoveInfo
.
log
(
$
"Wait,收到脱离脱离信号,关闭折叠门"
);
}
else
{
AGVMoveInfo
.
log
(
$
"Wait,收到{curnode.status}信号,不处理"
);
}
}
else
//料串不在正常状态
{
if
(
curnode
.
status
.
Equals
(
NodeStatus
.
RequsetDock
)
||
curnode
.
status
.
Equals
(
NodeStatus
.
Arrive
))
{
//AGV已到达,请求开门
SetStatus
(
NodeStatus
.
RejectDock
);
AGVMoveInfo
.
log
(
$
"收到AGV的{NodeStatus.RequsetDock}/{NodeStatus.Arrive}信号,当前料串正在使用,拒绝停靠"
);
}
else
if
(
curnode
.
status
.
Equals
(
NodeStatus
.
RequestEnter
))
{
//AGV请求出料到料仓
SetStatus
(
NodeStatus
.
RejectEnter
);
AGVMoveInfo
.
log
(
$
"收到AGV的{NodeStatus.RequestEnter}信号,当前料串正在使用,拒绝AGV出料"
);
}
else
if
(
curnode
.
status
.
Equals
(
NodeStatus
.
RequestLeave
))
{
//AGV请求进料到AGV
SetStatus
(
NodeStatus
.
RejectLeave
);
AGVMoveInfo
.
log
(
$
"收到AGV的{NodeStatus.RequestLeave}信号,当前料串正在使用,拒绝AGV进料"
);
}
}
break
;
#
region
进料
case
MoveStep
.
AGV_In01
:
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_In02
);
RobotManage
.
mainMachine
.
SetStatus
(
curNodeStatus
);
AGVMoveInfo
.
log
(
$
"设置{curnode.name}状态为{curNodeStatus}"
);
break
;
case
MoveStep
.
AGV_In02
:
if
(
IOMonitor
.
IODebound
(
IO_Type
.
StringFront_Check
,
Config
,
IO_VALUE
.
HIGH
,
2000
)
||
IOMonitor
.
IODebound
(
IO_Type
.
StringBack_Check
,
Config
,
IO_VALUE
.
HIGH
,
2000
))
{
RobotManage
.
mainMachine
.
SetStatus
(
NodeStatus
.
None
);
AGVMoveInfo
.
log
(
$
"前端信号/后端信号亮,取消呼叫AGV送料串"
);
AGVMoveInfo
.
EndMove
();
}
else
if
(
AGVMoveInfo
.
IsTimeOut
(
5
)
&&
curnode
.
status
!=
curNodeStatus
)
{
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_In02
);
RobotManage
.
mainMachine
.
SetStatus
(
curNodeStatus
);
AGVMoveInfo
.
log
(
$
"AGV状态不是{curNodeStatus},重新呼叫AGV"
);
}
else
{
if
(
curnode
.
status
.
Equals
(
NodeStatus
.
RequsetDock
)
||
curnode
.
status
.
Equals
(
NodeStatus
.
Arrive
))
{
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_OpenDoor
);
AGVMoveInfo
.
log
(
$
"AGV到达,准备开门"
);
//AGV已到达,请求开门
OpenDoor
(
AGVMoveInfo
);
}
}
break
;
case
MoveStep
.
AGV_In03
:
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_In04
);
break
;
case
MoveStep
.
AGV_In04
:
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_In05
);
Line
.
LineRun
(
"n"
,
false
,
10
);
AGVMoveInfo
.
log
(
$
"收到AGV的{NodeStatus.RequestEnter}信号,允许进料"
);
break
;
case
MoveStep
.
AGV_In05
:
if
(
curnode
.
status
==
NodeStatus
.
MayEnter
)
{
if
(
IOValue
(
IO_Type
.
StringBack_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_In06
);
RobotManage
.
mainMachine
.
SetStatus
(
NodeStatus
.
FinishEnter
);
AGVMoveInfo
.
log
(
$
"料串到位"
);
AGVMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
5000
));
}
else
{
// ShowInfo("等待料串到位");
}
}
else
{
RobotManage
.
mainMachine
.
SetStatus
(
NodeStatus
.
MayEnter
);
}
break
;
case
MoveStep
.
AGV_In06
:
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_DetachOK
);
RobotManage
.
mainMachine
.
SetStatus
(
NodeStatus
.
Detach
);
AGVMoveInfo
.
log
(
$
"向AGV发送脱离信号"
);
break
;
#
endregion
#
region
出料
case
MoveStep
.
AGV_Out01
:
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_Out02
);
RobotManage
.
mainMachine
.
SetStatus
(
curNodeStatus
);
AGVMoveInfo
.
log
(
$
"设置{curnode.name}状态为{curNodeStatus}"
);
break
;
case
MoveStep
.
AGV_Out02
:
if
(
IOValue
(
IO_Type
.
StringFront_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
StringBack_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
RobotManage
.
mainMachine
.
SetStatus
(
NodeStatus
.
None
);
AGVMoveInfo
.
log
(
$
"前端信号和后端信号均灭,取消呼叫AGV接料串"
);
AGVMoveInfo
.
EndMove
();
}
else
if
(
AGVMoveInfo
.
IsTimeOut
(
5
)
&&
curnode
.
status
!=
curNodeStatus
)
{
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_Out02
);
RobotManage
.
mainMachine
.
SetStatus
(
curNodeStatus
);
AGVMoveInfo
.
log
(
$
"AGV状态不是{curNodeStatus},重新呼叫AGV"
);
}
else
{
if
(
curnode
.
status
.
Equals
(
NodeStatus
.
RequsetDock
)
||
curnode
.
status
.
Equals
(
NodeStatus
.
Arrive
))
{
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_OpenDoor
);
AGVMoveInfo
.
log
(
$
"AGV到达,准备开门"
);
//AGV已到达,请求开门
OpenDoor
(
AGVMoveInfo
);
}
}
break
;
case
MoveStep
.
AGV_Out03
:
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_Out04
);
break
;
case
MoveStep
.
AGV_Out04
:
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_Out05
);
Line
.
LineRun
(
"n"
,
true
,
2
);
AGVMoveInfo
.
log
(
$
"收到AGV的{NodeStatus.RequestLeave}信号,允许出料"
);
break
;
case
MoveStep
.
AGV_Out05
:
if
(
curnode
.
status
!=
NodeStatus
.
MayLeave
)
{
RobotManage
.
mainMachine
.
SetStatus
(
NodeStatus
.
MayLeave
);
}
else
{
if
(
IOValue
(
IO_Type
.
StringBack_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
StringFront_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_Out06
);
RobotManage
.
mainMachine
.
SetStatus
(
NodeStatus
.
FinishLeave
);
AGVMoveInfo
.
log
(
$
"料串离开"
);
AGVMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
5000
));
}
}
break
;
case
MoveStep
.
AGV_Out06
:
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_DetachOK
);
RobotManage
.
mainMachine
.
SetStatus
(
NodeStatus
.
Detach
);
AGVMoveInfo
.
log
(
$
"向AGV发送脱离信号"
);
break
;
#
endregion
case
MoveStep
.
AGV_OpenDoor
:
if
(
curnode
.
status
==
NodeStatus
.
RequestEnter
)
{
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_In03
);
RobotManage
.
mainMachine
.
SetStatus
(
NodeStatus
.
MayEnter
);
CylinderMove
(
StringMoveInfo
,
IO_Type
.
StringFix_Bottom
,
IO_Type
.
StringFix_Top
,
IO_VALUE
.
LOW
);
Line
.
LineRun
(
"n"
,
false
,
2
);
AGVMoveInfo
.
log
(
$
"收到AGV的{NodeStatus.RequestEnter}信号,无料串,允许进料"
);
}
else
if
(
curnode
.
status
==
NodeStatus
.
RequestLeave
)
{
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_Out03
);
RobotManage
.
mainMachine
.
SetStatus
(
NodeStatus
.
MayLeave
);
CylinderMove
(
StringMoveInfo
,
IO_Type
.
StringFix_Bottom
,
IO_Type
.
StringFix_Top
,
IO_VALUE
.
LOW
);
Line
.
LineRun
(
"n"
,
true
,
2
);
AGVMoveInfo
.
log
(
$
"收到AGV的{NodeStatus.RequestLeave}信号,有料串,允许出料"
);
}
else
if
(
curnode
.
status
.
Equals
(
NodeStatus
.
RequsetDock
))
{
if
(
IOValue
(
IO_Type
.
StringDoor_Open
).
Equals
(
IO_VALUE
.
HIGH
))
{
RobotManage
.
mainMachine
.
SetStatus
(
NodeStatus
.
MayDock
);
}
}
break
;
case
MoveStep
.
AGV_DetachOK
:
if
(
curnode
.
status
==
NodeStatus
.
DetachOk
)
{
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_CloseDoor
);
CloseDoor
(
AGVMoveInfo
);
AGVMoveInfo
.
log
(
$
"收到脱离脱离信号,关闭折叠门"
);
}
else
if
(
AGVMoveInfo
.
IsTimeOut
())
{
AGVMoveInfo
.
NextMoveStep
(
MoveStep
.
AGV_CloseDoor
);
CloseDoor
(
AGVMoveInfo
);
AGVMoveInfo
.
log
(
$
"收到脱离脱离信号超时,关闭折叠门"
);
}
break
;
case
MoveStep
.
AGV_CloseDoor
:
AGVMoveInfo
.
EndMove
();
break
;
}
}
void
OpenDoor
(
MoveInfo
moveInfo
)
{
StringDoorOpen
(
moveInfo
);
}
void
CloseDoor
(
MoveInfo
moveInfo
)
{
StringDoorClose
(
moveInfo
);
}
}
}
DeviceLibrary/theMachine/MainMachine_String.cs
查看文件 @
8010703
...
@@ -121,6 +121,7 @@ namespace DeviceLibrary
...
@@ -121,6 +121,7 @@ namespace DeviceLibrary
StringMoveInfo
.
log
(
$
"当前没有料串"
);
StringMoveInfo
.
log
(
$
"当前没有料串"
);
StringState
=
StringStateE
.
None
;
StringState
=
StringStateE
.
None
;
LastStringState
=
StringStateE
.
None
;
LastStringState
=
StringStateE
.
None
;
needEnter
(
AGVLib
.
NodeStatus
.
NeedEnter
);
}
}
else
if
(
IOValue
(
IO_Type
.
StringFront_Check
).
Equals
(
IO_VALUE
.
HIGH
))
else
if
(
IOValue
(
IO_Type
.
StringFront_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
{
...
@@ -428,7 +429,9 @@ namespace DeviceLibrary
...
@@ -428,7 +429,9 @@ namespace DeviceLibrary
break
;
break
;
case
MoveStep
.
StringOut_02
:
case
MoveStep
.
StringOut_02
:
StringMoveInfo
.
NextMoveStep
(
MoveStep
.
StringOut_03
);
StringMoveInfo
.
NextMoveStep
(
MoveStep
.
StringOut_03
);
StringMoveInfo
.
log
(
$
"打开门"
);
needLeave
(
AGVLib
.
NodeStatus
.
NeedLeave
);
StringMoveInfo
.
log
(
$
"呼叫AGV取料串"
);
// StringMoveInfo.log($"打开门");
//CylinderMove(StringMoveInfo, IO_Type.StringDoor_Close, IO_Type.StringDoor_Open, IO_VALUE.HIGH);
//CylinderMove(StringMoveInfo, IO_Type.StringDoor_Close, IO_Type.StringDoor_Open, IO_VALUE.HIGH);
break
;
break
;
case
MoveStep
.
StringOut_03
:
case
MoveStep
.
StringOut_03
:
...
@@ -678,7 +681,7 @@ namespace DeviceLibrary
...
@@ -678,7 +681,7 @@ namespace DeviceLibrary
}
}
if
(
LastHeight
<=
8
)
{
LastHeight
=
8
;
}
if
(
LastHeight
<=
8
)
{
LastHeight
=
8
;
}
//string code = CodeManager.ProcessCode(LastCodeList);
//string code = CodeManager.ProcessCode(LastCodeList);
string
msg
=
Name
+
prefix
+
"上升前 ["
+
StartMovePosition
+
"]实时[ "
+
EndMovePosition
+
"]差值["
+
(
EndMovePosition
-
StartMovePosition
)
+
"]系数["
+
AxisChangeValue
+
"] 计算后"
+
"["
+
height
+
"],"
+
buchongStr
+
",归类为【"
+
LastHeight
+
"mm】条码【"
+
LastCode
+
"】"
;
string
msg
=
Name
+
prefix
+
"上升前 ["
+
StartMovePosition
+
"]实时[ "
+
EndMovePosition
+
"]差值["
+
(
EndMovePosition
-
StartMovePosition
)
+
"]系数["
+
AxisChangeValue
+
"] 计算后"
+
"["
+
height
+
"],"
+
buchongStr
+
",归类为【"
+
LastHeight
+
"mm】条码【"
+
LastCode
+
"】"
;
LogUtil
.
info
(
msg
);
LogUtil
.
info
(
msg
);
return
LastHeight
;
return
LastHeight
;
}
}
...
...
DeviceLibrary/theMachine/MoveStep.cs
查看文件 @
8010703
...
@@ -157,6 +157,26 @@ namespace DeviceLibrary
...
@@ -157,6 +157,26 @@ namespace DeviceLibrary
StoreTS16
,
StoreTS16
,
StoreTS17
,
StoreTS17
,
StoreTS18
,
StoreTS18
,
//AGV
AGV_In01
,
AGV_In02
,
AGV_In03
,
AGV_In04
,
AGV_In05
,
AGV_In06
,
AGV_In07
,
AGV_In08
,
AGV_Out01
,
AGV_Out02
,
AGV_Out03
,
AGV_Out04
,
AGV_Out05
,
AGV_Out06
,
AGV_Out07
,
AGV_OpenDoor
,
AGV_DetachOK
,
AGV_CloseDoor
,
}
}
...
...
TheMachine/SettingControl.cs
查看文件 @
8010703
...
@@ -25,7 +25,7 @@ namespace TheMachine
...
@@ -25,7 +25,7 @@ namespace TheMachine
InitializeComponent
();
InitializeComponent
();
RobotManage
.
LoadFinishEvent
+=
RobotManage_LoadFinishEvent
;
RobotManage
.
LoadFinishEvent
+=
RobotManage_LoadFinishEvent
;
//chbAutoRun.Enabled = false;
//chbAutoRun.Enabled = false;
chbAutoRun
.
Checked
=
Convert
.
ToBoolean
(
ConfigAppSettings
.
Get
IntValue
(
Setting_Init
.
App_AutoRun
));
chbAutoRun
.
Checked
=
Convert
.
ToBoolean
(
ConfigAppSettings
.
Get
Value
(
Setting_Init
.
App_AutoRun
,
0
,
"系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要"
));
this
.
chbAutoRun
.
CheckedChanged
+=
new
System
.
EventHandler
(
this
.
chbAutoRun_CheckedChanged
);
this
.
chbAutoRun
.
CheckedChanged
+=
new
System
.
EventHandler
(
this
.
chbAutoRun_CheckedChanged
);
//chbAutoRun.Enabled = true;
//chbAutoRun.Enabled = true;
for
(
int
i
=
0
;
i
<
20
;
i
++)
for
(
int
i
=
0
;
i
<
20
;
i
++)
...
@@ -80,12 +80,12 @@ namespace TheMachine
...
@@ -80,12 +80,12 @@ namespace TheMachine
{
{
if
(
chbAutoRun
.
Checked
)
if
(
chbAutoRun
.
Checked
)
{
{
ConfigAppSettings
.
S
ave
Value
(
Setting_Init
.
App_AutoRun
,
1
);
ConfigAppSettings
.
S
et
Value
(
Setting_Init
.
App_AutoRun
,
1
);
AutoRun
(
Application
.
ExecutablePath
,
true
);
AutoRun
(
Application
.
ExecutablePath
,
true
);
}
}
else
else
{
{
ConfigAppSettings
.
S
ave
Value
(
Setting_Init
.
App_AutoRun
,
0
);
ConfigAppSettings
.
S
et
Value
(
Setting_Init
.
App_AutoRun
,
0
);
AutoRun
(
Application
.
ExecutablePath
,
false
);
AutoRun
(
Application
.
ExecutablePath
,
false
);
}
}
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论