Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
SO1037-LiftController
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 29fc87a5
由
张东亮
编写于
2022-01-18 16:37:37 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
测试可用
1 个父辈
757c5c07
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
42 行增加
和
38 行删除
LiftController/FrmMain.Designer.cs
LiftController/FrmMain.cs
source/DeviceLibrary/Config/LineConfig.csv
source/DeviceLibrary/Context/Context.cs
source/DeviceLibrary/IO/IOManager.cs
source/DeviceLibrary/Models/LiftInfo.cs
source/DeviceLibrary/Models/Service/Request/DoorInfo.cs
source/DeviceLibrary/Models/Service/Response/Status.cs
source/DeviceLibrary/Service/IService.cs
source/DeviceLibrary/Service/Services.cs
LiftController/FrmMain.Designer.cs
查看文件 @
29fc87a
...
...
@@ -105,7 +105,6 @@ namespace LogisticsIntelligence
this
.
Name
=
"FrmMain"
;
this
.
Text
=
"LiftController"
;
this
.
FormClosing
+=
new
System
.
Windows
.
Forms
.
FormClosingEventHandler
(
this
.
FrmMain_FormClosing
);
this
.
FormClosed
+=
new
System
.
Windows
.
Forms
.
FormClosedEventHandler
(
this
.
FrmMain_FormClosed
);
this
.
Load
+=
new
System
.
EventHandler
(
this
.
FrmMain_Load
);
this
.
tableLayoutPanel1
.
ResumeLayout
(
false
);
this
.
groupBox1
.
ResumeLayout
(
false
);
...
...
LiftController/FrmMain.cs
查看文件 @
29fc87a
...
...
@@ -29,11 +29,6 @@ namespace LogisticsIntelligence
AddForm
(
" IO列表 "
,
frmi
);
timer1
.
Start
();
}
private
void
FrmMain_FormClosed
(
object
sender
,
FormClosedEventArgs
e
)
{
//appContext.Close();
timer1
.
Enabled
=
false
;
}
private
void
UpdateLift
()
{
this
.
Invoke
(
new
Action
(()=>
{
...
...
@@ -52,6 +47,11 @@ namespace LogisticsIntelligence
{
e
.
Cancel
=
true
;
}
else
{
timer1
.
Enabled
=
false
;
System
.
Environment
.
Exit
(
System
.
Environment
.
ExitCode
);
}
}
private
void
AddForm
(
string
text
,
Form
form
)
{
...
...
source/DeviceLibrary/Config/LineConfig.csv
查看文件 @
29fc87a
类型,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义,SlaveID
PRO,IO模块对应的DI数量,IO_DILength,192.168.103.21#8;192.168.103.22#8,,,,,,
PRO,模块对应的DO数量,IO_DOLength,192.168.103.21#8;192.168.103.22#8,,,,,,
PRO,IO模块IP,PRO_AOI_IP_1,192.168.103.21,,,,,,
PRO,IO模块IP,PRO_AOI_IP_2,192.168.103.22,,,,,,
PRO,IO模块对应的DI数量,IO_DILength,10.85.199.29#8;192.168.103.22#8,,,,,,
PRO,模块对应的DO数量,IO_DOLength,10.85.199.29#8;192.168.103.22#8,,,,,,
PRO,IO模块IP,PRO_AOI_IP_1,10.85.199.29,,,,,,
,,,,,,,,,
DI,D2-任务应答,LIFT_D2_Response,0,PRO_AOI_IP_1,0,D2-任务应答,X21,X21,0
DI,D2-到达1F,LIFT_D2_AtFirst,1,PRO_AOI_IP_1,0,D2-到达1F,X22,X22,0
...
...
source/DeviceLibrary/Context/Context.cs
查看文件 @
29fc87a
...
...
@@ -6,11 +6,13 @@ namespace DeviceLibrary.Context
{
ServiceContext
serviceContext
=
new
ServiceContext
();
LineManager
lineManager
=
new
LineManager
();
public
void
Init
()
{
LiftContext
.
Init
();
lineManager
.
Init
();
IOManager
.
Init
();
IOManager
.
instance
.
ConnectionIOList
(
LineManager
.
Config
.
DIODeviceNameList
);
}
public
void
Open
()
{
...
...
source/DeviceLibrary/IO/IOManager.cs
查看文件 @
29fc87a
...
...
@@ -5,6 +5,7 @@ using System.Collections.Generic;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
DeviceLibrary
{
...
...
@@ -21,21 +22,18 @@ namespace DeviceLibrary
if
(
LineManager
.
Config
.
DOList
.
ContainsKey
(
ioType
))
{
int
trytimes
=
5
;
ConfigIO
configIo
=
LineManager
.
Config
.
DOList
[
ioType
];
ConfigIO
configIo
=
LineManager
.
Config
.
DOList
[
ioType
];
instance
.
WriteSingleDO
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
(),
ioValue
);
instance
.
WriteSingleDO
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
(),
ioValue
);
Thread
.
Sleep
(
60
);
while
(
trytimes
>
0
&&
!
IOValue
(
ioType
).
Equals
(
ioValue
))
{
instance
.
WriteSingleDO
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
(),
ioValue
);
trytimes
--;
}
Thread
.
Sleep
(
100
);
}
else
{
LogUtil
.
error
(
"没有DO="
+
ioType
);
}
}
public
static
void
CIOMove
(
string
ioType
,
IO_VALUE
ioValue
)
public
static
void
CIOMove
(
string
ioType
,
IO_VALUE
ioValue
)
{
if
(!
IOValue
(
ioType
).
Equals
(
ioValue
))
{
...
...
@@ -62,11 +60,11 @@ namespace DeviceLibrary
}
return
ioValue
;
}
public
static
IO_VALUE
DOValue
(
string
ioType
)
public
static
IO_VALUE
DOValue
(
string
ioType
)
{
IO_VALUE
ioValue
=
IO_VALUE
.
None
;
ConfigIO
configIo
=
GetDO
(
ioType
);
ConfigIO
configIo
=
GetDO
(
ioType
);
if
(
configIo
!=
null
)
{
...
...
@@ -78,10 +76,10 @@ namespace DeviceLibrary
}
return
ioValue
;
}
public
static
IO_VALUE
DIValue
(
string
ioType
)
public
static
IO_VALUE
DIValue
(
string
ioType
)
{
IO_VALUE
ioValue
=
IO_VALUE
.
None
;
ConfigIO
configIo
=
GetDI
(
ioType
);
ConfigIO
configIo
=
GetDI
(
ioType
);
if
(
configIo
!=
null
)
{
ioValue
=
instance
.
GetDIValue
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
());
...
...
@@ -92,7 +90,7 @@ namespace DeviceLibrary
}
return
ioValue
;
}
private
static
ConfigIO
GetDI
(
string
ioType
)
private
static
ConfigIO
GetDI
(
string
ioType
)
{
ConfigIO
configIo
=
null
;
if
(
LineManager
.
Config
.
DIList
.
ContainsKey
(
ioType
))
...
...
@@ -101,13 +99,13 @@ namespace DeviceLibrary
}
return
configIo
;
}
private
static
ConfigIO
GetDO
(
string
ioType
)
private
static
ConfigIO
GetDO
(
string
ioType
)
{
ConfigIO
configIo
=
null
;
ConfigIO
configIo
=
null
;
if
(
LineManager
.
Config
.
DOList
.
ContainsKey
(
ioType
))
{
return
LineManager
.
Config
.
DOList
[
ioType
];
}
}
return
configIo
;
}
#
endregion
...
...
@@ -123,7 +121,7 @@ namespace DeviceLibrary
instance
=
new
KNDManager
();
}
}
public
abstract
void
ReadAllDI
(
string
deviceName
,
byte
slaveId
);
public
abstract
void
ReadAllDI
(
string
deviceName
,
byte
slaveId
);
public
abstract
void
ReadAllDO
(
string
deviceName
,
byte
slaveId
);
...
...
@@ -136,7 +134,7 @@ namespace DeviceLibrary
public
abstract
IO_VALUE
GetDOValue
(
string
deviceName
,
byte
slaveID
,
ushort
v
);
public
abstract
IO_VALUE
GetIOValue
(
ConfigIO
configIO
);
...
...
source/DeviceLibrary/Models/LiftInfo.cs
查看文件 @
29fc87a
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/Models/Service/Request/DoorInfo.cs
查看文件 @
29fc87a
...
...
@@ -22,8 +22,11 @@ namespace DeviceLibrary.Models.Service.Request
/// <summary>
/// 架子来源层
/// </summary>
public
int
sourceFloor
{
get
;
set
;
}
=
0
;
public
int
sourceFloor
{
get
;
set
;
}
=
-
1
;
/// <summary>
/// 继续使用电梯
/// </summary>
public
bool
continueUse
{
get
;
set
;}=
false
;
public
override
string
ToString
()
{
return
$
"{sourceClient}[{sourceFloor}]:{liftId}"
;
...
...
source/DeviceLibrary/Models/Service/Response/Status.cs
查看文件 @
29fc87a
...
...
@@ -13,7 +13,7 @@ namespace DeviceLibrary.Models.Service.Response
/// <summary>
/// 当前电梯处于哪一层
/// </summary>
public
int
floor
{
get
;
set
;
}
=
0
;
public
int
floor
{
get
;
set
;
}
=
-
1
;
/// <summary>
/// 电梯门是否打开,打开=opened,关闭=closed
/// </summary>
...
...
@@ -25,7 +25,7 @@ namespace DeviceLibrary.Models.Service.Response
/// <summary>
/// 架子来源楼层
/// </summary>
public
int
sourceFloor
{
get
;
set
;
}
=
0
;
public
int
sourceFloor
{
get
;
set
;
}
=
-
1
;
/// <summary>
/// 架子来源点位
/// </summary>
...
...
@@ -37,7 +37,7 @@ namespace DeviceLibrary.Models.Service.Response
/// <summary>
/// 目的地楼层
/// </summary>
public
int
destinationFloor
{
get
;
set
;
}
=
0
;
public
int
destinationFloor
{
get
;
set
;
}
=
-
1
;
/// <summary>
/// 目的地点位
/// </summary>
...
...
@@ -65,10 +65,10 @@ namespace DeviceLibrary.Models.Service.Response
public
void
Clear
()
{
sourceClient
=
""
;
sourceFloor
=
0
;
sourceFloor
=
-
1
;
sourcePoint
=
""
;
destinationClient
=
""
;
destinationFloor
=
0
;
destinationFloor
=
-
1
;
destinationPoint
=
""
;
}
}
...
...
source/DeviceLibrary/Service/IService.cs
查看文件 @
29fc87a
...
...
@@ -2,7 +2,7 @@
using
System.Runtime.Serialization
;
using
System.ServiceModel
;
using
System.ServiceModel.Web
;
using
System.Threading.Tasks
;
namespace
DeviceLibrary.Service
{
...
...
source/DeviceLibrary/Service/Services.cs
查看文件 @
29fc87a
...
...
@@ -29,6 +29,7 @@ namespace DeviceLibrary.Service
}
else
{
Log
.
Info
(
$
"AGVLeave接口被调用:{doorInfo}"
);
Context
.
LiftContext
.
AGVLeave
(
doorInfo
,
out
string
msg
);
result
.
msg
=
msg
;
}
...
...
@@ -49,6 +50,7 @@ namespace DeviceLibrary.Service
}
else
{
Log
.
Info
(
$
"AGVCall接口被调用:{doorInfo}"
);
Context
.
LiftContext
.
AGVCall
(
doorInfo
,
out
string
msg
);
result
.
msg
=
msg
;
}
...
...
@@ -69,7 +71,8 @@ namespace DeviceLibrary.Service
}
else
{
bool
idle
=
Context
.
LiftContext
.
RequestSendIn
(
sendInInfo
,
out
string
msg
);
Log
.
Info
(
$
"请求接口被调用:{sendInInfo}"
);
bool
idle
=
Context
.
LiftContext
.
RequestSendIn
(
sendInInfo
,
out
string
msg
);
result
.
msg
=
msg
;
}
return
result
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论