Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO775-DUOStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 1c43d39d
由
刘韬
编写于
2020-11-18 16:03:56 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
导入汇川库
1 个父辈
73bbb05b
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
29 个修改的文件
包含
656 行增加
和
242 行删除
RC1271-DUOStore.sln → SO755-DUOStore.sln
source/Common/Setting_Init.cs
source/DUOStore/DUOStore.csproj
source/DUOStore/FrmAxisDebug.cs
source/DUOStore/FrmAxisMove.cs
source/DUOStore/FrmBox.cs
source/DUOStore/FrmStore.cs
source/DUOStore/positionTool/FrmPositionTool.cs
source/DUOStore/useControl/AxisMoveControl.cs
source/DeviceLibrary/AXIS/AxisManager.cs
source/DeviceLibrary/AXIS/HC/HCAxisManager.cs
source/DeviceLibrary/AXIS/PanasonicServo/ACCMDManager.cs
source/DeviceLibrary/AXIS/PanasonicServo/ACServerManager.cs
source/DeviceLibrary/AXIS/PanasonicServo/ACServerManager_Partial.cs
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/StoreConfig/StoreConfig.csv
source/DeviceLibrary/device/IO/AIOBOX/AIOBOXManager.cs
source/DeviceLibrary/device/IO/HCIOManager.cs
source/DeviceLibrary/device/IO/IOManager.cs
source/DeviceLibrary/duoStore/AxisBean.cs
source/DeviceLibrary/duoStore/BoxBean.cs
source/DeviceLibrary/duoStore/BoxBean_Partial.cs
source/DeviceLibrary/duoStore/DUOStoreBean.cs
source/DeviceLibrary/duoStore/DUOStoreBean_Partial.cs
source/DeviceLibrary/duoStore/EquipBase.cs
source/DeviceLibrary/duoStore/StoreManager.cs
source/DeviceLibrary/store/KTK_Store.cs
source/LoadCVSLibrary/storeConfig/ConfigItemBase.cs
source/LoadCVSLibrary/storeConfig/config/IO_Type.cs
RC1271
-DUOStore.sln
→
SO755
-DUOStore.sln
查看文件 @
1c43d39
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio
15
VisualStudioVersion = 1
5.0.27130.2024
# Visual Studio
Version 16
VisualStudioVersion = 1
6.0.30621.155
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "source\Common\Common.csproj", "{43CDD09E-FCF3-4960-A01D-3BBFE9933122}"
EndProject
...
...
source/Common/Setting_Init.cs
查看文件 @
1c43d39
...
...
@@ -73,7 +73,10 @@ namespace OnlineStore.Common
/// 温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪
/// </summary>
public
static
string
HumitureControllerType
=
"HumitureControllerType"
;
public
static
string
UseHCBoard
=
"UseHCBoard"
;
public
static
string
UseAIOBOX
=
"UseAIOBOX"
;
public
static
string
LineServerIp
=
"LineServerIp"
;
public
static
string
LineServerPort
=
"LineServerPort"
;
...
...
source/DUOStore/DUOStore.csproj
查看文件 @
1c43d39
...
...
@@ -41,9 +41,6 @@
<Reference Include="CodeLibrary">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="DeviceLib">
<HintPath>..\..\dll\DeviceLib.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<HintPath>..\..\dll\halcondotnet.dll</HintPath>
</Reference>
...
...
source/DUOStore/FrmAxisDebug.cs
查看文件 @
1c43d39
using
DeviceLib
;
using
log4net
;
using
log4net
;
using
OnlineStore.Common
;
using
OnlineStore.DeviceLibrary
;
using
OnlineStore.LoadCSVLibrary
;
...
...
@@ -40,7 +39,7 @@ namespace OnlineStore.DUOStore
private
void
AxisMove
(
ConfigMoveAxis
axis
,
int
speed
)
{
LogUtil
.
debug
(
"点动:deviceName="
+
axis
.
DeviceName
+
",axis="
+
axis
.
GetAxisValue
()
+
",speed="
+
speed
);
A
CServerManager
.
SpeedMove
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
speed
);
A
xisManager
.
instance
.
SpeedMove
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
speed
);
}
private
void
FrmAxisDebug_Load
(
object
sender
,
EventArgs
e
)
...
...
@@ -55,7 +54,7 @@ namespace OnlineStore.DUOStore
{
int
InOutDefaultPosition
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
InOutDefaultPosition
);
int
currValue
=
A
CServerManager
.
GetActualtPosition
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
int
currValue
=
A
xisManager
.
instance
.
GetActualtPosition
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
if
(
currValue
<=
InOutDefaultPosition
)
{
return
true
;
...
...
@@ -88,7 +87,7 @@ namespace OnlineStore.DUOStore
if
(
btnMiddleMove
.
BackColor
==
Color
.
Green
)
{
btnMiddleMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
middle
.
DeviceName
,
middle
.
GetAxisValue
());
A
xisManager
.
instance
.
SuddenStop
(
middle
.
DeviceName
,
middle
.
GetAxisValue
());
UpdateMiddlePosition
();
}
}
...
...
@@ -116,8 +115,8 @@ namespace OnlineStore.DUOStore
{
if
(
btnUpDownMove
.
BackColor
==
Color
.
Green
)
{
btnUpDownMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
updown
.
DeviceName
,
updown
.
GetAxisValue
());
btnUpDownMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
xisManager
.
instance
.
SuddenStop
(
updown
.
DeviceName
,
updown
.
GetAxisValue
());
UpdateUpdownPosition
();
}
}
...
...
@@ -142,7 +141,7 @@ namespace OnlineStore.DUOStore
if
(
this
.
btnInOutMove
.
BackColor
==
Color
.
Green
)
{
btnInOutMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
A
xisManager
.
instance
.
SuddenStop
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
UpdateInOutPosition
();
}
}
...
...
@@ -170,7 +169,7 @@ namespace OnlineStore.DUOStore
if
(
btnMiddleMovej
.
BackColor
==
Color
.
Green
)
{
btnMiddleMovej
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
middle
.
DeviceName
,
middle
.
GetAxisValue
());
A
xisManager
.
instance
.
SuddenStop
(
middle
.
DeviceName
,
middle
.
GetAxisValue
());
UpdateMiddlePosition
();
}
}
...
...
@@ -199,7 +198,7 @@ namespace OnlineStore.DUOStore
if
(
btnUpDownMovej
.
BackColor
==
Color
.
Green
)
{
btnUpDownMovej
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
updown
.
DeviceName
,
updown
.
GetAxisValue
());
A
xisManager
.
instance
.
SuddenStop
(
updown
.
DeviceName
,
updown
.
GetAxisValue
());
UpdateUpdownPosition
();
}
}
...
...
@@ -224,7 +223,7 @@ namespace OnlineStore.DUOStore
if
(
btnInOutMovej
.
BackColor
.
Equals
(
Color
.
Green
))
{
btnInOutMovej
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
A
xisManager
.
instance
.
SuddenStop
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
UpdateInOutPosition
();
}
}
...
...
@@ -247,8 +246,8 @@ namespace OnlineStore.DUOStore
{
if
(
this
.
btnComMove
.
BackColor
==
Color
.
Green
)
{
btnComMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
comp
.
DeviceName
,
comp
.
GetAxisValue
());
btnComMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
xisManager
.
instance
.
SuddenStop
(
comp
.
DeviceName
,
comp
.
GetAxisValue
());
UpdateCompPosition
();
}
}
...
...
@@ -268,8 +267,8 @@ namespace OnlineStore.DUOStore
{
if
(
btnComMovej
.
BackColor
.
Equals
(
Color
.
Green
))
{
btnComMovej
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
CServerManager
.
SuddenStop
(
comp
.
DeviceName
,
comp
.
GetAxisValue
());
btnComMovej
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
A
xisManager
.
instance
.
SuddenStop
(
comp
.
DeviceName
,
comp
.
GetAxisValue
());
UpdateCompPosition
();
}
}
...
...
@@ -297,7 +296,7 @@ namespace OnlineStore.DUOStore
}
private
void
UpdateCompPosition
()
{
int
compPosition
=
A
CServerManager
.
GetTargetPosition
(
comp
.
DeviceName
,
comp
.
GetAxisValue
());
int
compPosition
=
A
xisManager
.
instance
.
GetTargetPosition
(
comp
.
DeviceName
,
comp
.
GetAxisValue
());
if
(!
txtComPosition
.
Text
.
Equals
(
compPosition
.
ToString
()))
{
txtComPosition
.
Text
=
compPosition
.
ToString
();
...
...
@@ -305,7 +304,7 @@ namespace OnlineStore.DUOStore
}
private
void
UpdateUpdownPosition
()
{
int
updownPosition
=
A
CServerManager
.
GetTargetPosition
(
updown
.
DeviceName
,
updown
.
GetAxisValue
());
int
updownPosition
=
A
xisManager
.
instance
.
GetTargetPosition
(
updown
.
DeviceName
,
updown
.
GetAxisValue
());
if
(!
txtUpdownPosition
.
Text
.
Equals
(
updownPosition
.
ToString
()))
{
txtUpdownPosition
.
Text
=
updownPosition
.
ToString
();
...
...
@@ -314,7 +313,7 @@ namespace OnlineStore.DUOStore
private
void
UpdateMiddlePosition
()
{
int
middlePosition
=
A
CServerManager
.
GetTargetPosition
(
middle
.
DeviceName
,
middle
.
GetAxisValue
());
int
middlePosition
=
A
xisManager
.
instance
.
GetTargetPosition
(
middle
.
DeviceName
,
middle
.
GetAxisValue
());
if
(!
txtMiddlePosition
.
Text
.
Equals
(
middlePosition
.
ToString
()))
{
txtMiddlePosition
.
Text
=
middlePosition
.
ToString
();
...
...
@@ -323,7 +322,7 @@ namespace OnlineStore.DUOStore
private
void
UpdateInOutPosition
()
{
int
inoutPosition
=
A
CServerManager
.
GetTargetPosition
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
int
inoutPosition
=
A
xisManager
.
instance
.
GetTargetPosition
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
if
(!
txtInOutPosition
.
Text
.
Equals
(
inoutPosition
.
ToString
()))
{
txtInOutPosition
.
Text
=
inoutPosition
.
ToString
();
...
...
source/DUOStore/FrmAxisMove.cs
查看文件 @
1c43d39
...
...
@@ -17,7 +17,6 @@ using OnlineStore.DeviceLibrary;
using
System.IO.Ports
;
using
OnlineStore.LoadCSVLibrary
;
using
CodeLibrary
;
using
DeviceLib
;
using
UserFromControl
;
namespace
OnlineStore.DUOStore
...
...
source/DUOStore/FrmBox.cs
查看文件 @
1c43d39
...
...
@@ -17,7 +17,6 @@ using OnlineStore.DeviceLibrary;
using
System.IO.Ports
;
using
OnlineStore.LoadCSVLibrary
;
using
CodeLibrary
;
using
DeviceLib
;
using
UserFromControl
;
namespace
OnlineStore.DUOStore
...
...
@@ -411,7 +410,7 @@ namespace OnlineStore.DUOStore
private
bool
InOutIsIsP1
()
{
int
InOutDefaultPosition
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
InOutDefaultPosition
);
int
currValue
=
A
CServerManager
.
GetActualtPosition
(
BoxBean
.
Config
.
InOut_Axis
.
DeviceName
,
BoxBean
.
Config
.
InOut_Axis
.
GetAxisValue
());
int
currValue
=
A
xisManager
.
instance
.
GetActualtPosition
(
BoxBean
.
Config
.
InOut_Axis
.
DeviceName
,
BoxBean
.
Config
.
InOut_Axis
.
GetAxisValue
());
if
(
currValue
<=
InOutDefaultPosition
)
{
return
true
;
...
...
@@ -431,7 +430,7 @@ namespace OnlineStore.DUOStore
}
int
targetPosition
=
FormUtil
.
GetIntValue
(
txtValue
);
moveAxis
.
TargetPosition
=
targetPosition
;
A
CServerManager
.
AbsMove
(
moveAxis
.
DeviceName
,
moveAxis
.
GetAxisValue
(),
targetPosition
,
target
Speed
);
A
xisManager
.
instance
.
AbsMove
(
moveAxis
.
DeviceName
,
moveAxis
.
GetAxisValue
(),
targetPosition
,
targetSpeed
,
moveAxis
.
AddSpeed
,
moveAxis
.
Del
Speed
);
}
private
void
btnUpDownP1_Click
(
object
sender
,
EventArgs
e
)
{
...
...
@@ -711,7 +710,7 @@ namespace OnlineStore.DUOStore
private
void
btnUpdown_Click
(
object
sender
,
EventArgs
e
)
{
string
PortName
=
BoxBean
.
Config
.
UpDown_Axis
.
DeviceName
;
in
t
slvAddr
=
BoxBean
.
Config
.
UpDown_Axis
.
GetAxisValue
();
shor
t
slvAddr
=
BoxBean
.
Config
.
UpDown_Axis
.
GetAxisValue
();
string
ioIP
=
"192.168.200.13"
;
int
ioIndex
=
0
;
// if (store.Config.StoreDIList.ContainsKey(IO_Type.UpdownPositionSingal))
...
...
source/DUOStore/FrmStore.cs
查看文件 @
1c43d39
using
CodeLibrary
;
using
DeviceLib
;
using
log4net
;
using
OnlineStore.Common
;
using
OnlineStore.DeviceLibrary
;
...
...
@@ -243,7 +242,7 @@ namespace OnlineStore.DUOStore
e
.
Cancel
=
true
;
HideForm
();
}
}
}
private
void
ExitApp
()
{
...
...
@@ -270,8 +269,8 @@ namespace OnlineStore.DUOStore
IOManager
.
instance
.
CloseAllDO
();
IOManager
.
instance
.
CloseAllConnection
();
HumitureController
.
CloseAllPort
();
A
CServerManager
.
CloseAllPort
();
HumitureController
.
CloseAllPort
();
A
xisManager
.
instance
.
CloseAllPort
();
if
(
Camera
.
_cam
!=
null
)
{
Camera
.
_cam
.
CloseAll
();
...
...
source/DUOStore/positionTool/FrmPositionTool.cs
查看文件 @
1c43d39
using
DeviceLib
;
using
OnlineStore.Common
;
using
OnlineStore.DeviceLibrary
;
using
OnlineStore.LoadCSVLibrary
;
...
...
@@ -22,14 +21,16 @@ namespace OnlineStore.DUOStore
{
private
string
LogName
=
ResourceCulture
.
GetString
(
"升降轴位置调试:"
);
private
string
PortName
=
""
;
private
in
t
SlvAddr
=
0
;
private
shor
t
SlvAddr
=
0
;
private
string
IoIp
=
""
;
private
int
IoIndex
=
0
;
public
string
Axis_Brake
=
IO_Type
.
UpdownAxis_Break
;
private
int
subType
=
0
;
private
System
.
Timers
.
Timer
toolTimer
=
new
System
.
Timers
.
Timer
();
public
int
ptpAcc
=
0
;
public
int
ptpDec
=
0
;
private
string
boxName
=
""
;
public
FrmPositionTool
(
string
protName
,
in
t
slvAddr
,
string
ioIp
,
int
ioIndex
,
string
text
,
int
ioSubType
)
public
FrmPositionTool
(
string
protName
,
shor
t
slvAddr
,
string
ioIp
,
int
ioIndex
,
string
text
,
int
ioSubType
)
{
InitializeComponent
();
this
.
PortName
=
protName
;
...
...
@@ -49,11 +50,11 @@ namespace OnlineStore.DUOStore
private
void
Form1_Load
(
object
sender
,
EventArgs
e
)
{
A
CServerManager
.
IsShowMsg
=
false
;
A
xisManager
.
instance
.
IsShowMsg
=
false
;
LogUtil
.
logBox
=
this
.
richTextBox1
;
//A
CServerManager
.richeBox = this.richTextBox1;
//A
xisManager.instance
.richeBox = this.richTextBox1;
CheckForIllegalCrossThreadCalls
=
false
;
txtPortName
.
Text
=
PortName
;
...
...
@@ -91,7 +92,7 @@ namespace OnlineStore.DUOStore
SaveConfig
(
tSpeed
,
tPosition
);
//判断伺服是否已经打开
bool
isOn
=
A
CServerManager
.
ServerOnStatus
(
PortName
,
SlvAddr
);
bool
isOn
=
A
xisManager
.
instance
.
IsServeoOn
(
PortName
,
SlvAddr
);
formStatus
(
isOn
);
timer1
.
Start
();
ioStatusControl1
.
IOName
=
ResourceCulture
.
GetString
(
"检测信号"
);
...
...
@@ -109,8 +110,8 @@ namespace OnlineStore.DUOStore
//P6Offset = FormUtil.GetIntValue(txtP6Offset);
//StopTimer();
this
.
PortName
=
txtPortName
.
Text
;
this
.
SlvAddr
=
FormUtil
.
Get
In
tValue
(
txtAddr
);
bool
result
=
A
CServerManager
.
OpenPort
(
PortName
,
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
ACBaudRate
)
);
this
.
SlvAddr
=
FormUtil
.
Get
Shor
tValue
(
txtAddr
);
bool
result
=
A
xisManager
.
instance
.
OpenPort
(
PortName
);
if
(!
result
)
{
MessageBox
.
Show
(
ResourceCulture
.
GetString
(
"打开串口失败"
));
...
...
@@ -118,10 +119,10 @@ namespace OnlineStore.DUOStore
}
formStatus
(
true
);
ACServerManager
.
InitSlvAddr
(
PortName
,
SlvAddr
);
//AxisManager.instance
.InitSlvAddr(PortName, SlvAddr);
Thread
.
Sleep
(
100
);
A
CServerManager
.
AlarmClear
(
PortName
,
SlvAddr
);
A
CServerManager
.
ServoOn
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
AlarmClear
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
ServoOn
(
PortName
,
SlvAddr
);
try
{
...
...
@@ -137,7 +138,7 @@ namespace OnlineStore.DUOStore
{
StopTimer
();
// toolTimer.Stop();
A
CServerManager
.
SuddenStop
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
SuddenStop
(
PortName
,
SlvAddr
);
Thread
.
Sleep
(
100
);
try
{
...
...
@@ -147,7 +148,7 @@ namespace OnlineStore.DUOStore
{
}
A
CServerManager
.
ServoOff
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
ServoOff
(
PortName
,
SlvAddr
);
formStatus
(
false
);
}
...
...
@@ -174,25 +175,25 @@ namespace OnlineStore.DUOStore
private
void
btnRelMove_Click
(
object
sender
,
EventArgs
e
)
{
int
speed
=
Convert
.
ToInt32
(
txtSpeed
.
Text
);
int
position
=
Convert
.
ToInt32
(
txtPosition
.
Text
);
ACServerManager
.
RelMove
(
PortName
,
SlvAddr
,
position
,
speed
);
//
int speed = Convert.ToInt32(txtSpeed.Text);
//
int position = Convert.ToInt32(txtPosition.Text);
//AxisManager.instance
.RelMove(PortName, SlvAddr, position,speed);
}
private
void
btnHomeMove_Click
(
object
sender
,
EventArgs
e
)
{
int
speed
=
Convert
.
ToInt32
(
txtSpeed
.
Text
);
A
CServerManager
.
HomeMove
(
PortName
,
SlvAddr
,
speed
);
A
xisManager
.
instance
.
HomeMove
(
PortName
,
SlvAddr
,
50
,
1
,
speed
);
}
private
void
btnSpeedMove_Click
(
object
sender
,
EventArgs
e
)
{
int
speed
=
Convert
.
ToInt32
(
txtSpeed
.
Text
);
A
CServerManager
.
SpeedMove
(
PortName
,
SlvAddr
,
speed
);
A
xisManager
.
instance
.
SpeedMove
(
PortName
,
SlvAddr
,
speed
);
}
private
void
btnGetActualPosition_Click
(
object
sender
,
EventArgs
e
)
{
int
value
=
A
CServerManager
.
GetTargetPosition
(
PortName
,
SlvAddr
);
int
value
=
A
xisManager
.
instance
.
GetTargetPosition
(
PortName
,
SlvAddr
);
txtTargetPosition
.
Text
=
value
.
ToString
();
value
=
A
CServerManager
.
GetActualtPosition
(
PortName
,
SlvAddr
);
value
=
A
xisManager
.
instance
.
GetActualtPosition
(
PortName
,
SlvAddr
);
txtActualPosition
.
Text
=
value
.
ToString
();
}
...
...
@@ -242,7 +243,7 @@ namespace OnlineStore.DUOStore
PositionList
=
new
List
<
int
>();
LogUtil
.
info
(
LogName
+
"伺服开始运动,速度【"
+
speed
+
"】位置【"
+
position
+
"】启动定时器 "
);
formMoveStatus
(
false
);
A
CServerManager
.
AbsMove
(
PortName
,
SlvAddr
,
position
,
speed
);
A
xisManager
.
instance
.
AbsMove
(
PortName
,
SlvAddr
,
position
,
speed
,
ptpAcc
,
ptpDec
);
toolTimer
.
Start
();
}
private
int
P3Offset
=
0
;
...
...
@@ -263,7 +264,7 @@ namespace OnlineStore.DUOStore
private
void
btnSdStop_Click
(
object
sender
,
EventArgs
e
)
{
toolTimer
.
Stop
();
A
CServerManager
.
SuddenStop
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
SuddenStop
(
PortName
,
SlvAddr
);
}
private
IO_VALUE
GetSingleValue
()
...
...
@@ -289,14 +290,14 @@ namespace OnlineStore.DUOStore
isInProcesss
=
true
;
try
{
int
moveS
=
A
CServerManager
.
GetBusyStatus
(
PortName
,
SlvAddr
);
int
moveS
=
A
xisManager
.
instance
.
GetBusyStatus
(
PortName
,
SlvAddr
);
if
(
moveS
.
Equals
(
1
))
{
IO_VALUE
currValue
=
GetSingleValue
();
TimeSpan
checkSpan
=
DateTime
.
Now
-
LastGetPTime
;
if
(
LastValue
.
Equals
(
IO_VALUE
.
LOW
)
&&
currValue
.
Equals
(
IO_VALUE
.
HIGH
)
&&
checkSpan
.
TotalSeconds
>
2
)
{
int
currPos
=
A
CServerManager
.
GetActualtPosition
(
PortName
,
SlvAddr
);
int
currPos
=
A
xisManager
.
instance
.
GetActualtPosition
(
PortName
,
SlvAddr
);
txtActualPosition
.
Text
=
currPos
.
ToString
();
PositionList
.
Add
(
currPos
);
int
num
=
PositionList
.
Count
;
...
...
@@ -399,11 +400,11 @@ namespace OnlineStore.DUOStore
{
StopTimer
();
// toolTimer.Stop();
A
CServerManager
.
SuddenStop
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
SuddenStop
(
PortName
,
SlvAddr
);
Thread
.
Sleep
(
100
);
}
LogUtil
.
logBox
=
null
;
//A
CServerManager
.CloseAllPort();
//A
xisManager.instance
.CloseAllPort();
//IOManager.instance.CloseAllConnection();
}
...
...
source/DUOStore/useControl/AxisMoveControl.cs
查看文件 @
1c43d39
...
...
@@ -11,7 +11,6 @@ using OnlineStore.DeviceLibrary;
using
OnlineStore.Common
;
using
System.Threading
;
using
OnlineStore.LoadCSVLibrary
;
using
DeviceLib
;
namespace
OnlineStore.DUOStore
{
...
...
@@ -20,8 +19,9 @@ namespace OnlineStore.DUOStore
private
List
<
AxisBean
>
axisList
=
new
List
<
AxisBean
>();
private
BoxBean
boxBean
=
null
;
private
string
PortName
=
""
;
private
int
SlvAddr
=
0
;
private
short
SlvAddr
=
0
;
public
int
ptpAcc
=
0
;
public
int
ptpDec
=
0
;
public
AxisMoveControl
()
{
InitializeComponent
();
...
...
@@ -85,7 +85,7 @@ namespace OnlineStore.DUOStore
private
void
btnCloseAxis_Click
(
object
sender
,
EventArgs
e
)
{
LogUtil
.
info
(
"点击【关闭伺服】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】 "
);
// A
CServerManager
.ServoOff(PortName, SlvAddr);
// A
xisManager.instance
.ServoOff(PortName, SlvAddr);
axisList
[
comboBox1
.
SelectedIndex
].
ServoOff
();
}
...
...
@@ -98,7 +98,7 @@ namespace OnlineStore.DUOStore
int
position
=
FormUtil
.
GetIntValue
(
txtAPosition
);
int
speed
=
FormUtil
.
GetIntValue
(
txtASpeed
);
LogUtil
.
info
(
"点击【绝对运动】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】位置【"
+
position
+
"】速度【"
+
speed
+
"】"
);
A
CServerManager
.
AbsMove
(
PortName
,
SlvAddr
,
position
,
speed
);
A
xisManager
.
instance
.
AbsMove
(
PortName
,
SlvAddr
,
position
,
speed
,
ptpAcc
,
ptpDec
);
}
private
void
btnAxisRMove_Click
(
object
sender
,
EventArgs
e
)
...
...
@@ -110,7 +110,7 @@ namespace OnlineStore.DUOStore
int
position
=
FormUtil
.
GetIntValue
(
txtAPosition
);
int
speed
=
FormUtil
.
GetIntValue
(
txtASpeed
);
LogUtil
.
info
(
"点击【相对运动】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】位置【"
+
position
+
"】速度【"
+
speed
+
"】"
);
A
CServerManager
.
RelMove
(
PortName
,
SlvAddr
,
position
,
speed
);
A
xisManager
.
instance
.
RelMove
(
PortName
,
SlvAddr
,
position
,
speed
,
ptpAcc
,
ptpDec
);
}
private
void
btnAxisVMove_Click
(
object
sender
,
EventArgs
e
)
...
...
@@ -121,13 +121,13 @@ namespace OnlineStore.DUOStore
}
int
speed
=
FormUtil
.
GetIntValue
(
txtASpeed
);
LogUtil
.
info
(
"点击【匀速运动】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】 速度【"
+
speed
+
"】"
);
A
CServerManager
.
SpeedMove
(
PortName
,
SlvAddr
,
speed
);
A
xisManager
.
instance
.
SpeedMove
(
PortName
,
SlvAddr
,
speed
);
}
private
void
btnAxisStop_Click
(
object
sender
,
EventArgs
e
)
{
LogUtil
.
info
(
"点击【停止运动】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】 "
);
A
CServerManager
.
SuddenStop
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
SuddenStop
(
PortName
,
SlvAddr
);
if
(
btnAddMove
.
BackColor
==
Color
.
Green
)
{
btnAddMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
...
...
@@ -143,9 +143,9 @@ namespace OnlineStore.DUOStore
private
void
btnComAlarmClear_Click
(
object
sender
,
EventArgs
e
)
{
LogUtil
.
info
(
"点击【清理报警】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】 "
);
A
CServerManager
.
AlarmClear
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
AlarmClear
(
PortName
,
SlvAddr
);
Thread
.
Sleep
(
100
);
A
CServerManager
.
ServoOn
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
ServoOn
(
PortName
,
SlvAddr
);
}
private
void
btnAxisReturnHome_Click
(
object
sender
,
EventArgs
e
)
...
...
@@ -156,25 +156,25 @@ namespace OnlineStore.DUOStore
}
int
speed
=
FormUtil
.
GetIntValue
(
txtASpeed
);
LogUtil
.
info
(
"点击【原点返回】,【"
+
PortName
+
"_"
+
SlvAddr
+
"】 速度【"
+
speed
+
"】"
);
A
CServerManager
.
HomeMove
(
PortName
,
SlvAddr
,
speed
);
A
xisManager
.
instance
.
HomeMove
(
PortName
,
SlvAddr
,
50
,
1
,
speed
);
}
private
void
btnGetAlarm_Click
(
object
sender
,
EventArgs
e
)
{
this
.
txtAlarmStatus
.
Text
=
A
CServerManager
.
GetAlarmStatus
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtBusyStatus
.
Text
=
A
CServerManager
.
GetBusyStatus
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtStb
.
Text
=
ACServerManager
.
GetSTBState
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtHomeStatus
.
Text
=
A
CServerManager
.
GetHomeEndStatus
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtHomeSingle
.
Text
=
A
CServerManager
.
GetHomeSingle
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtLimit1
.
Text
=
A
CServerManager
.
GetLimitPositiveSingle
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtLimit2
.
Text
=
A
CServerManager
.
GetLimitNegativeSingle
(
PortName
,
SlvAddr
).
ToString
();
txtServoStatue
.
Text
=
A
CServerManager
.
ServerOnStatus
(
PortName
,
SlvAddr
)
?
"✔"
:
"✘"
;
this
.
txtAlarmStatus
.
Text
=
A
xisManager
.
instance
.
GetAlarmStatus
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtBusyStatus
.
Text
=
A
xisManager
.
instance
.
GetBusyStatus
(
PortName
,
SlvAddr
).
ToString
();
//this.txtStb.Text = AxisManager.instance
.GetSTBState(PortName, SlvAddr).ToString();
this
.
txtHomeStatus
.
Text
=
A
xisManager
.
instance
.
GetHomeEndStatus
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtHomeSingle
.
Text
=
A
xisManager
.
instance
.
GetHomeSingle
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtLimit1
.
Text
=
A
xisManager
.
instance
.
GetLimitPositiveSingle
(
PortName
,
SlvAddr
).
ToString
();
this
.
txtLimit2
.
Text
=
A
xisManager
.
instance
.
GetLimitNegativeSingle
(
PortName
,
SlvAddr
).
ToString
();
txtServoStatue
.
Text
=
A
xisManager
.
instance
.
IsServeoOn
(
PortName
,
SlvAddr
)
?
"✔"
:
"✘"
;
}
private
void
btnReadPosition_Click
(
object
sender
,
EventArgs
e
)
{
lblCountPulse
.
Text
=
A
CServerManager
.
GetActualtPosition
(
PortName
,
SlvAddr
).
ToString
();
lblCountPulse
.
Text
=
A
xisManager
.
instance
.
GetActualtPosition
(
PortName
,
SlvAddr
).
ToString
();
}
...
...
@@ -254,7 +254,7 @@ namespace OnlineStore.DUOStore
private
void
AxisMove
(
int
speed
)
{
LogUtil
.
info
(
"【"
+
PortName
+
"_"
+
SlvAddr
+
"】点动: 速度:"
+
speed
);
A
CServerManager
.
SpeedMove
(
PortName
,
SlvAddr
,
speed
);
A
xisManager
.
instance
.
SpeedMove
(
PortName
,
SlvAddr
,
speed
);
}
private
void
btnAddMove_MouseDown
(
object
sender
,
MouseEventArgs
e
)
{
...
...
@@ -280,7 +280,7 @@ namespace OnlineStore.DUOStore
if
(
btnAddMove
.
BackColor
==
Color
.
Green
)
{
btnAddMove
.
BackColor
=
Color
.
White
;
A
CServerManager
.
SuddenStop
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
SuddenStop
(
PortName
,
SlvAddr
);
btnReadPosition_Click
(
null
,
null
);
}
}
...
...
@@ -309,7 +309,7 @@ namespace OnlineStore.DUOStore
if
(
btnDelMove
.
BackColor
==
Color
.
Green
)
{
btnDelMove
.
BackColor
=
Color
.
White
;
A
CServerManager
.
SuddenStop
(
PortName
,
SlvAddr
);
A
xisManager
.
instance
.
SuddenStop
(
PortName
,
SlvAddr
);
btnReadPosition_Click
(
null
,
null
);
}
}
...
...
source/DeviceLibrary/AXIS/AxisManager.cs
0 → 100644
查看文件 @
1c43d39
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary
{
public
abstract
class
AxisManager
{
public
bool
IsShowMsg
=
false
;
public
static
AxisManager
instance
;
public
static
bool
UseHCBoard
=
true
;
public
static
void
Init
()
{
// UseHCBoard = ConfigAppSettings.GetIntValue(Setting_Init.UseHCBoard).Equals(1);
if
(
UseHCBoard
)
{
instance
=
new
HCAxisManager
();
}
else
{
//instance = new ACServerManager();
}
}
#
region
485
通信方法
public
abstract
bool
OpenPort
(
string
portName
);
/// <summary>
/// 松下专用
/// </summary>
/// <param name="portName"></param>
public
abstract
void
ColsePort
(
string
portName
);
/// <summary>
/// 松下专用
/// </summary>
public
abstract
void
CloseAllPort
();
/// <summary>
/// 松下专用
/// </summary>
public
abstract
void
ClearSpeed
();
/// <summary>
/// 松下专用
/// </summary>
/// <param name="portName"></param>
/// <param name="slvAddr"></param>
/// <param name="targetSpeed"></param>
/// <param name="addSpeed"></param>
/// <param name="delSpeed"></param>
public
abstract
void
InitSlvAddr
(
string
portName
,
short
slvAddr
,
int
targetSpeed
,
int
addSpeed
,
int
delSpeed
);
public
abstract
bool
IsServeoOn
(
string
portName
,
short
slvAddr
);
#
endregion
public
abstract
bool
OpenCard
();
public
abstract
bool
CloseCard
();
public
abstract
bool
IsHomeMoveEnd
(
string
portName
,
short
slvAddr
);
public
abstract
bool
AbsMoveIsEnd
(
string
portName
,
short
axisNo
,
int
targetPosition
,
int
canErrorCount
,
out
bool
countError
);
public
abstract
void
ServoOn
(
string
portName
,
short
slvAddr
);
public
abstract
void
ServoOff
(
string
portName
,
short
slvAddr
);
public
abstract
void
RelMove
(
string
portName
,
short
slvAddr
,
int
position
,
int
targetSpeed
,
int
ptpAcc
,
int
ptpDec
);
public
abstract
void
HomeMove
(
string
portName
,
short
slvAddr
,
int
highVel
,
int
lowVel
,
int
acc
);
public
abstract
void
SpeedMove
(
string
portName
,
short
slvAddr
,
int
speed
);
public
abstract
void
SuddenStop
(
string
portName
,
short
slvAddr
);
public
abstract
bool
isInPosition
(
string
portName
,
short
slvAddr
,
int
PPosition
,
int
canErrorCount
,
bool
isLog
=
false
);
public
abstract
void
AbsMove
(
string
portName
,
short
slvAddr
,
int
targetPosition
,
int
targetSpeed
,
int
ptpAcc
,
int
ptpDec
);
public
abstract
void
AlarmClear
(
string
portName
,
short
slvAddr
);
public
abstract
int
GetTargetPosition
(
string
portName
,
short
slvAddr
);
public
abstract
int
GetActualtPosition
(
string
portName
,
short
slvAddr
);
public
abstract
int
GetAlarmStatus
(
string
portName
,
short
slvAddr
);
public
abstract
int
GetBusyStatus
(
string
portName
,
short
slvAddr
);
public
abstract
int
GetHomeEndStatus
(
string
portName
,
short
slvAddr
);
public
abstract
int
GetHomeSingle
(
string
portName
,
short
slvAddr
);
/// <summary>
/// 负极限
/// </summary>
public
abstract
int
GetLimitNegativeSingle
(
string
portName
,
short
slvAddr
);
/// <summary>
/// 正极限
/// </summary>
public
abstract
int
GetLimitPositiveSingle
(
string
portName
,
short
slvAddr
);
public
abstract
short
GetErrorCode
(
string
portName
,
short
slvAddr
);
}
}
source/DeviceLibrary/AXIS/HC/HCAxisManager.cs
0 → 100644
查看文件 @
1c43d39
using
HuichuanLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary
{
public
class
HCAxisManager
:
AxisManager
{
public
override
bool
OpenCard
()
{
return
HCBoardManager
.
OpenCard
();
}
public
override
bool
CloseCard
()
{
return
HCBoardManager
.
CloseCard
();
}
public
override
void
AbsMove
(
string
portName
,
short
slvAddr
,
int
targetPosition
,
int
targetSpeed
,
int
ptpAcc
,
int
ptpDec
)
{
HCBoardManager
.
AbsMove
((
short
)
slvAddr
,
targetPosition
,
targetSpeed
,
ptpAcc
,
ptpDec
);
}
public
override
void
AlarmClear
(
string
portName
,
short
slvAddr
)
{
HCBoardManager
.
ClearAxisSts
((
short
)
slvAddr
);
}
public
override
bool
OpenPort
(
string
portName
)
{
return
true
;
}
public
override
void
ClearSpeed
()
{
}
public
override
void
CloseAllPort
()
{
}
public
override
void
ColsePort
(
string
portName
)
{
}
public
override
void
InitSlvAddr
(
string
portName
,
short
slvAddr
,
int
targetSpeed
,
int
addSpeed
,
int
delSpeed
)
{
}
public
override
int
GetActualtPosition
(
string
portName
,
short
slvAddr
)
{
return
(
int
)
HCBoardManager
.
GetAxisCurrPos
(
slvAddr
);
}
public
override
int
GetAlarmStatus
(
string
portName
,
short
slvAddr
)
{
AxisSts
axisS
=
HCBoardManager
.
GetAxisSts
(
slvAddr
);
return
axisS
.
ALM
;
}
public
override
int
GetBusyStatus
(
string
portName
,
short
slvAddr
)
{
AxisSts
axisS
=
HCBoardManager
.
GetAxisSts
(
slvAddr
);
return
axisS
.
BUSY
;
}
public
override
int
GetHomeEndStatus
(
string
portName
,
short
slvAddr
)
{
return
(
int
)
HCBoardManager
.
GetHomeStatus
(
slvAddr
);
}
public
override
int
GetHomeSingle
(
string
portName
,
short
slvAddr
)
{
AxisSts
axisS
=
HCBoardManager
.
GetAxisSts
(
slvAddr
);
return
axisS
.
ALM
;
}
public
override
int
GetLimitNegativeSingle
(
string
portName
,
short
slvAddr
)
{
AxisSts
axisS
=
HCBoardManager
.
GetAxisSts
(
slvAddr
);
return
axisS
.
NEL
;
}
public
override
int
GetLimitPositiveSingle
(
string
portName
,
short
slvAddr
)
{
AxisSts
axisS
=
HCBoardManager
.
GetAxisSts
(
slvAddr
);
return
axisS
.
PEL
;
}
public
override
int
GetTargetPosition
(
string
portName
,
short
slvAddr
)
{
return
(
int
)
HCBoardManager
.
GetAxisPrfPos
(
slvAddr
);
}
public
override
void
HomeMove
(
string
portName
,
short
slvAddr
,
int
highVel
,
int
lowVel
,
int
acc
)
{
HCBoardManager
.
StartHomeMove
(
slvAddr
,(
uint
)
highVel
,
(
uint
)
lowVel
,
(
uint
)
acc
);
}
public
override
bool
IsHomeMoveEnd
(
string
portName
,
short
slvAddr
)
{
return
HCBoardManager
.
HomeingIsEnd
(
slvAddr
);
}
public
override
bool
isInPosition
(
string
portName
,
short
slvAddr
,
int
PPosition
,
int
canErrorCount
,
bool
isLog
=
false
)
{
return
HCBoardManager
.
IsInPosition
(
slvAddr
,
PPosition
,
canErrorCount
);
}
public
override
void
RelMove
(
string
portName
,
short
slvAddr
,
int
position
,
int
targetSpeed
,
int
ptpAcc
,
int
ptpDec
)
{
HCBoardManager
.
RelMove
(
slvAddr
,
position
,
targetSpeed
,
ptpAcc
,
ptpDec
);
}
public
override
bool
IsServeoOn
(
string
portName
,
short
slvAddr
)
{
AxisSts
axisS
=
HCBoardManager
.
GetAxisSts
(
slvAddr
);
return
axisS
.
ServoOn
.
Equals
(
1
);
}
public
override
void
ServoOff
(
string
portName
,
short
slvAddr
)
{
HCBoardManager
.
ServoOff
(
slvAddr
);
}
public
override
void
ServoOn
(
string
portName
,
short
slvAddr
)
{
HCBoardManager
.
ServoOn
(
slvAddr
);
}
public
override
void
SpeedMove
(
string
portName
,
short
slvAddr
,
int
speed
)
{
HCBoardManager
.
SpeedMove
(
slvAddr
,
speed
);
}
public
override
void
SuddenStop
(
string
portName
,
short
slvAddr
)
{
HCBoardManager
.
AxisStop
(
slvAddr
);
}
public
override
bool
AbsMoveIsEnd
(
string
portName
,
short
axisNo
,
int
targetPosition
,
int
canErrorCount
,
out
bool
countError
)
{
countError
=
false
;
bool
isOk
=
HCBoardManager
.
MoveIsEnd
(
axisNo
);
if
(
isOk
)
{
if
(
HCBoardManager
.
IsInPosition
(
axisNo
,
targetPosition
,
canErrorCount
))
{
return
true
;
}
else
{
countError
=
true
;
}
}
return
false
;
}
public
override
short
GetErrorCode
(
string
portName
,
short
slvAddr
)
{
return
HCBoardManager
.
GetAxErrCode
(
slvAddr
);
}
}
}
source/DeviceLibrary/AXIS/PanasonicServo/ACCMDManager.cs
0 → 100644
查看文件 @
1c43d39
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/AXIS/PanasonicServo/ACServerManager.cs
0 → 100644
查看文件 @
1c43d39
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/AXIS/PanasonicServo/ACServerManager_Partial.cs
0 → 100644
查看文件 @
1c43d39
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
1c43d39
...
...
@@ -46,13 +46,12 @@
<Reference Include="CodeLibrary">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="DeviceLib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\DeviceLib.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<HintPath>..\..\dll\halcondotnet.dll</HintPath>
</Reference>
<Reference Include="HuichuanLibrary">
<HintPath>..\..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\HuichuanLibrary.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath>
...
...
@@ -68,6 +67,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AXIS\AxisManager.cs" />
<Compile Include="AXIS\HC\HCAxisManager.cs" />
<Compile Include="AXIS\PanasonicServo\ACCMDManager.cs" />
<Compile Include="AXIS\PanasonicServo\ACServerManager.cs" />
<Compile Include="AXIS\PanasonicServo\ACServerManager_Partial.cs" />
<Compile Include="device\IO\HCIOManager.cs" />
<Compile Include="duoStore\AxisBean.cs" />
<Compile Include="duoStore\BoxBean.cs" />
<Compile Include="duoStore\BoxBean_Partial.cs" />
...
...
source/DeviceLibrary/StoreConfig/StoreConfig.csv
查看文件 @
1c43d39
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/device/IO/AIOBOX/AIOBOXManager.cs
查看文件 @
1c43d39
...
...
@@ -15,6 +15,9 @@ namespace OnlineStore.DeviceLibrary
{
public
class
AIOBOXManager
:
IOManager
{
//public static uint DefaultDICount = 16;
//public static uint DefaultDOCount = 16;
public
Dictionary
<
string
,
AIOBOX
>
AIOMap
=
new
Dictionary
<
string
,
AIOBOX
>();
public
Dictionary
<
string
,
List
<
Box_Sta
>>
DIValueMap
=
new
Dictionary
<
string
,
List
<
Box_Sta
>>();
...
...
@@ -25,18 +28,19 @@ namespace OnlineStore.DeviceLibrary
private
object
DILock
=
""
;
private
object
DOLock
=
""
;
private
List
<
string
>
IoIPLIst
=
new
List
<
string
>();
private
System
.
Timers
.
Timer
conTimer
=
null
;
public
override
void
ConnectionIOList
(
List
<
string
>
DIONameList
)
{
foreach
(
string
ip
in
DIONameList
)
{
ConnectionIP
(
ip
);
}
}
private
bool
isProcess
=
false
;
private
DateTime
lastTime
=
DateTime
.
Now
;
public
void
ConnectionIP
(
string
ioIp
)
{
AIOBOX
aioBox
=
null
;
...
...
@@ -65,46 +69,80 @@ namespace OnlineStore.DeviceLibrary
{
DOValueMap
.
Remove
(
ioIp
);
}
int
DIMS
=
ConfigAppSettings
.
GetIntValue
(
"DIMS"
);
if
(
DIMS
<=
0
)
{
DIMS
=
150
;
}
else
if
(
DIMS
<
20
)
{
DIMS
=
100
;
}
int
DOMS
=
ConfigAppSettings
.
GetIntValue
(
"DOMS"
);
if
(
DOMS
<=
0
)
{
DOMS
=
300
;
}
else
if
(
DOMS
<
100
)
{
DOMS
=
300
;
}
int
DILength
=
StoreManager
.
Config
.
GetDILength
(
ioIp
);
int
DOLength
=
StoreManager
.
Config
.
GetDOLength
(
ioIp
);
string
logName
=
"IO模块["
+
ioIp
+
"] DI["
+
DILength
+
"] DO["
+
DOLength
+
"]
"
;
string
logName
=
"IO模块["
+
ioIp
+
"] DI["
+
DILength
+
"] DO["
+
DOLength
+
"]
,["
+
DIMS
+
"] ["
+
DOMS
+
"]
"
;
try
{
aioBox
=
new
AIOBOX
(
"AIOBOX"
);
aioBox
.
SetType
(
Asa
.
IOModule
.
Box_Type
.
DI
,
DILength
,
Asa
.
IOModule
.
Box_Type
.
DO
,
DOLength
);
// Create new modbus master and add event functions
aioBox
=
new
AIOBOX
();
aioBox
.
SetType
(
Box_Type
.
DI
,
DILength
,
Box_Type
.
DO
,
DOLength
);
//aioBox.LogPath(Application.StartupPath + @"\logs\aio\", LogType.OnlyError);
aioBox
.
IP
=
ioIp
;
aioBox
.
Upload
=
false
;
// bool rtn = aioBox.AutoIP(ioIp);
// aioBox.SetInput(Asa.IOModule.Box_Type.DI, DILength);
// aioBox.SetOutput(Asa.IOModule.Box_Type.DO, DOLength);
//DI主动上传
// aioBox.AutoReadInput(true, DIMS);
// aioBox.AutoReadOutput(false, DOMS);
aioBox
.
DI_Changed_Event
+=
AioBox_DI_Changed_Event
;
;
aioBox
.
DO_Changed_Event
+=
AioBox_DO_Changed_Event
;
LogUtil
.
info
(
"开始连接:"
+
logName
+
":"
);
aioBox
.
Connect
();
bool
conRes
=
aioBox
.
Connect
();
LogUtil
.
info
(
"开始连接:"
+
logName
+
":"
+
conRes
.
ToString
());
AIOMap
.
Add
(
ioIp
,
aioBox
);
Thread
.
Sleep
(
5
);
//读取所有的DO
ReadAllDI
(
ioIp
,
0
);
Thread
.
Sleep
(
5
);
GC
.
Collect
();
}
catch
(
Exception
error
)
{
LogUtil
.
error
(
"连接IO模块 "
+
logName
+
" 出错:"
+
error
.
ToString
());
LogUtil
.
error
(
"连接IO模块 "
+
logName
+
" 出错:"
+
error
.
ToString
());
}
}
private
DateTime
lastLogTime
=
DateTime
.
Now
;
private
void
AioBox_Log_Out_Event
(
AIOBOX
box
,
string
[]
s
)
{
foreach
(
string
str
in
s
)
{
LogUtil
.
AIOLog
.
Debug
(
"["
+
box
.
IP
+
"]"
+
str
);
}
}
private
void
AioBox_DI_Changed_Event
(
AIOBOX
box
,
Box_Sta
[]
sta
)
{
try
{
UpdateAllDI
(
box
.
IP
,
sta
);
//LogUtil.info("ReadAllDI [" + box.IP + "]:" + string.Join(" ", sta));
}
catch
(
Exception
ex
)
{
...
...
@@ -123,6 +161,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
"AioBox_DO_Changed_Event出错:"
+
ex
.
ToString
());
}
}
private
void
UpdateAllDI
(
string
ip
,
Box_Sta
[]
sta
)
{
if
(
sta
!=
null
&&
sta
.
Length
>=
StoreManager
.
Config
.
GetDILength
(
ip
))
...
...
@@ -171,7 +210,12 @@ namespace OnlineStore.DeviceLibrary
newList
.
AddRange
(
sta
);
List
<
Box_Sta
>
oldList
=
null
;
DOValueMap
.
TryGetValue
(
ip
,
out
oldList
);
//string result = "UpdateAllDO ip[" + ip + "], sta :";
//for (int i = 0; i < newList.Count; i++)
//{
// result += newList[i] + ",";
//}
//LogUtil.info(result);
if
(
oldList
==
null
||
oldList
.
Count
.
Equals
(
newList
.
Count
).
Equals
(
false
))
{
needUpdate
=
true
;
...
...
@@ -247,7 +291,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil
.
error
(
"WriteSingleDO出错 没有连接IO模块:"
+
ioIp
);
LogUtil
.
error
(
"WriteSingleDO出错 没有连接IO模块:"
+
ioIp
);
}
}
catch
(
Exception
ex
)
...
...
@@ -272,11 +316,11 @@ namespace OnlineStore.DeviceLibrary
try
{
aioBox
.
WriteDO
(
StartAddress
,
aioBox
.
ReverseStatus
(
currBox_Sta
));
LogUtil
.
debug
(
"**********定时回写入 IO ["
+
ioIp
+
"] ["
+
StartAddress
+
"]值"
+
aioBox
.
ReverseStatus
(
currBox_Sta
)
+
"】:"
);
LogUtil
.
debug
(
"**********定时回写入 IO ["
+
ioIp
+
"] ["
+
StartAddress
+
"]值"
+
aioBox
.
ReverseStatus
(
currBox_Sta
)
+
"】:"
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"**********定时回写入 出错:"
+
ex
.
ToString
()
);
LogUtil
.
error
(
"**********定时回写入 出错:"
+
ex
.
StackTrace
);
}
};
mytimer
.
AutoReset
=
false
;
//设置是否自动重启,即自动执行多次;
...
...
@@ -285,7 +329,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil
.
error
(
"AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"] 出错 没有连接IO模块:"
+
ioIp
);
LogUtil
.
error
(
"AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"] 出错 没有连接IO模块:"
+
ioIp
);
}
}
catch
(
Exception
ex
)
...
...
@@ -328,7 +372,7 @@ namespace OnlineStore.DeviceLibrary
}
public
override
IO_VALUE
GetDOValue
(
string
ioIP
,
byte
slaveId
,
ushort
StartAddress
)
{
IO_VALUE
value
=
IO_VALUE
.
None
;
IO_VALUE
value
=
IO_VALUE
.
LOW
;
try
{
AIOBOX
aioBox
=
getAIO
(
ioIP
);
...
...
@@ -345,10 +389,6 @@ namespace OnlineStore.DeviceLibrary
{
value
=
IO_VALUE
.
HIGH
;
}
else
{
value
=
IO_VALUE
.
LOW
;
}
}
}
catch
(
Exception
ex
)
...
...
@@ -360,7 +400,7 @@ namespace OnlineStore.DeviceLibrary
public
override
IO_VALUE
GetDIValue
(
string
ioIP
,
byte
slaveId
,
ushort
StartAddress
)
{
IO_VALUE
value
=
IO_VALUE
.
None
;
IO_VALUE
value
=
IO_VALUE
.
LOW
;
for
(
int
i
=
1
;
i
<=
3
;
i
++)
{
try
...
...
@@ -383,44 +423,32 @@ namespace OnlineStore.DeviceLibrary
{
value
=
IO_VALUE
.
HIGH
;
}
else
{
value
=
IO_VALUE
.
LOW
;
}
}
break
;
}
catch
(
Exception
ex
)
{
if
(
i
<=
1
)
{
LogUtil
.
debug
(
" 第【"
+
i
+
"】次 GetDIValue ["
+
ioIP
+
"] ["
+
StartAddress
+
"] 出错:"
+
ex
.
ToString
());
}
else
{
LogUtil
.
error
(
" 第【"
+
i
+
"】次 GetDIValue ["
+
ioIP
+
"] ["
+
StartAddress
+
"] 出错:"
+
ex
.
ToString
());
}
LogUtil
.
error
(
"GetDIValue ["
+
ioIP
+
"] ["
+
StartAddress
+
"] ["
+
i
+
"] 出错:"
+
ex
.
ToString
());
}
}
return
value
;
}
public
override
IO_VALUE
GetIOValue
(
ConfigIO
configIO
)
{
IO_VALUE
value
=
IO_VALUE
.
None
;
IO_VALUE
value
=
IO_VALUE
.
LOW
;
try
{
if
(
configIO
.
ProType
.
Equals
(
ConfigItemType
.
DI
))
{
return
GetDIValue
(
configIO
.
IO_IP
,
0
,
configIO
.
GetIOAddr
());
return
GetDIValue
(
configIO
.
IO_IP
,
configIO
.
SlaveID
,
configIO
.
GetIOAddr
());
}
else
if
(
configIO
.
ProType
.
Equals
(
ConfigItemType
.
DO
))
{
return
GetDOValue
(
configIO
.
IO_IP
,
0
,
configIO
.
GetIOAddr
());
return
GetDOValue
(
configIO
.
IO_IP
,
configIO
.
SlaveID
,
configIO
.
GetIOAddr
());
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
" GetIOValue ["
+
configIO
.
IO_IP
+
"] ["
+
configIO
.
GetIOAddr
()
+
"] 获取数据出错:"
,
ex
);
LogUtil
.
error
(
" GetIOValue ["
+
configIO
.
IO_IP
+
"] ["
+
configIO
.
GetIOAddr
()
+
"] 获取数据出错:"
+
ex
.
ToString
()
);
}
return
value
;
}
...
...
@@ -448,4 +476,5 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
\ No newline at end of file
source/DeviceLibrary/device/IO/HCIOManager.cs
0 → 100644
查看文件 @
1c43d39
using
HuichuanLibrary
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary.IO
{
public
class
HCIOManager
:
IOManager
{
public
override
void
CloseAllConnection
()
{
}
public
override
void
CloseAllDO
()
{
HCBoardManager
.
CloseAllDO
();
}
public
override
void
ConnectionIOList
(
List
<
string
>
dIODeviceNameList
)
{
if
(
dIODeviceNameList
.
Count
>
0
&&
dIODeviceNameList
.
Contains
(
"HC"
))
{
if
(!
HCBoardManager
.
CardInitOk
())
{
HCBoardManager
.
OpenCard
();
}
}
}
public
override
IO_VALUE
GetDIValue
(
string
deviceName
,
byte
slaveID
,
ushort
index
)
{
short
v
=
HCBoardManager
.
GetBitDI
((
short
)
index
);
return
(
IO_VALUE
)
v
;
}
public
override
IO_VALUE
GetDOValue
(
string
deviceName
,
byte
slaveID
,
ushort
index
)
{
short
v
=
HCBoardManager
.
GetBitDO
((
short
)
index
);
return
(
IO_VALUE
)
v
;
}
public
override
IO_VALUE
GetIOValue
(
ConfigIO
configIO
)
{
short
index
=(
short
)
configIO
.
GetIOAddr
();
short
v
=
HCBoardManager
.
GetBitDO
(
index
);
return
(
IO_VALUE
)
v
;
}
public
override
void
ReadAllDI
(
string
deviceName
,
byte
slaveId
)
{
}
public
override
void
ReadAllDO
(
string
deviceName
,
byte
slaveId
)
{
}
public
override
void
WriteSingleDO
(
string
deviceName
,
byte
slaveId
,
ushort
index
,
IO_VALUE
value
,
int
time
)
{
try
{
short
v
=
(
short
)
value
;
HCBoardManager
.
SetBitDO
((
short
)
index
,
v
);
short
targetV
=
0
;
if
(
v
.
Equals
((
short
)
0
))
{
targetV
=
1
;
}
//写入之后,等待指定间隔后回写
System
.
Timers
.
Timer
mytimer
=
new
System
.
Timers
.
Timer
(
time
);
mytimer
.
Elapsed
+=
(
o1
,
e1
)
=>
{
try
{
HCBoardManager
.
SetBitDO
((
short
)
index
,
targetV
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"**********定时回写入 出错:"
+
ex
.
StackTrace
);
}
};
mytimer
.
AutoReset
=
false
;
mytimer
.
Enabled
=
true
;
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"AIO WriteSingleDO ["
+
index
+
"] 出错:"
+
ex
.
ToString
());
}
}
public
override
void
WriteSingleDO
(
string
deviceName
,
byte
slaveId
,
ushort
index
,
IO_VALUE
value
)
{
short
v
=
(
short
)
value
;
HCBoardManager
.
SetBitDO
((
short
)
index
,
v
);
}
}
}
source/DeviceLibrary/device/IO/IOManager.cs
查看文件 @
1c43d39
using
OnlineStore.Common
;
using
OnlineStore.DeviceLibrary.IO
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -18,11 +19,15 @@ namespace OnlineStore.DeviceLibrary
#
region
KNDIO
public
static
void
IOMove
(
string
ioType
,
IO_VALUE
ioValue
,
int
subType
)
{
if
(
string
.
IsNullOrEmpty
(
ioType
))
{
return
;
}
ConfigIO
configIo
=
GetDO
(
ioType
,
subType
);
if
(
configIo
!=
null
)
{
instance
.
WriteSingleDO
(
configIo
.
IO_IP
,
0
,
configIo
.
GetIOAddr
(),
ioValue
);
Thread
.
Sleep
(
1
);
instance
.
WriteSingleDO
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
(),
ioValue
);
Thread
.
Sleep
(
1
0
);
}
else
{
...
...
@@ -32,7 +37,11 @@ namespace OnlineStore.DeviceLibrary
public
static
IO_VALUE
IOValue
(
string
ioType
,
int
subType
)
{
IO_VALUE
ioValue
=
IO_VALUE
.
LOW
;
if
(
string
.
IsNullOrEmpty
(
ioType
))
{
return
IO_VALUE
.
None
;
}
IO_VALUE
ioValue
=
IO_VALUE
.
None
;
ConfigIO
configIo
=
GetDI
(
ioType
,
subType
);
if
(
configIo
==
null
)
{
...
...
@@ -43,12 +52,11 @@ namespace OnlineStore.DeviceLibrary
{
if
(
configIo
.
ProType
.
Equals
(
ConfigItemType
.
DI
))
{
ioValue
=
instance
.
GetDIValue
(
configIo
.
IO_IP
,
0
,
configIo
.
GetIOAddr
());
ioValue
=
instance
.
GetDIValue
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
());
}
else
{
ioValue
=
instance
.
GetDOValue
(
configIo
.
IO_IP
,
0
,
configIo
.
GetIOAddr
());
ioValue
=
instance
.
GetDOValue
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
());
}
}
else
...
...
@@ -57,14 +65,18 @@ namespace OnlineStore.DeviceLibrary
}
return
ioValue
;
}
public
static
IO_VALUE
DOValue
(
string
ioType
,
int
subType
=
0
)
public
static
IO_VALUE
DOValue
(
string
ioType
,
int
subType
)
{
IO_VALUE
ioValue
=
IO_VALUE
.
LOW
;
if
(
string
.
IsNullOrEmpty
(
ioType
))
{
return
IO_VALUE
.
None
;
}
IO_VALUE
ioValue
=
IO_VALUE
.
None
;
ConfigIO
configIo
=
GetDO
(
ioType
,
subType
);
if
(
configIo
!=
null
)
{
ioValue
=
instance
.
GetDOValue
(
configIo
.
IO_IP
,
0
,
configIo
.
GetIOAddr
());
ioValue
=
instance
.
GetDOValue
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
());
}
else
{
...
...
@@ -72,7 +84,34 @@ namespace OnlineStore.DeviceLibrary
}
return
ioValue
;
}
private
static
ConfigIO
GetDI
(
string
ioType
,
int
subType
)
public
static
IO_VALUE
DIValue
(
string
ioType
,
int
subType
)
{
if
(
string
.
IsNullOrEmpty
(
ioType
))
{
return
IO_VALUE
.
None
;
}
IO_VALUE
ioValue
=
IO_VALUE
.
None
;
ConfigIO
configIo
=
GetDI
(
ioType
,
subType
);
if
(
configIo
!=
null
)
{
ioValue
=
instance
.
GetDIValue
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
());
}
else
{
LogUtil
.
error
(
"未找到 DI ["
+
ioType
+
"]["
+
subType
+
"]"
);
}
return
ioValue
;
}
internal
static
ConfigIO
GetIO
(
string
ioType
,
int
subType
)
{
ConfigIO
configIo
=
GetDI
(
ioType
,
subType
);
if
(
configIo
==
null
)
{
configIo
=
GetDO
(
ioType
,
subType
);
}
return
configIo
;
}
internal
static
ConfigIO
GetDI
(
string
ioType
,
int
subType
)
{
ConfigIO
configIo
=
null
;
if
(
subType
<=
0
)
...
...
@@ -84,19 +123,25 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if
(
StoreManager
.
A
llConfigMap
.
ContainsKey
(
subType
))
if
(
StoreManager
.
a
llConfigMap
.
ContainsKey
(
subType
))
{
string
newType
=
ioType
.
Replace
(
"SW1_"
,
"SW_"
).
Replace
(
"SW2_"
,
"SW_"
).
Replace
(
"SW3_"
,
"SW_"
).
Replace
(
"SW4_"
,
"SW_"
);
if
(
StoreManager
.
AllConfigMap
[
subType
].
DIList
.
ContainsKey
(
newType
))
if
(
StoreManager
.
allConfigMap
[
subType
].
DIList
.
ContainsKey
(
ioType
))
{
return
StoreManager
.
AllConfigMap
[
subType
].
DIList
[
new
Type
];
return
StoreManager
.
allConfigMap
[
subType
].
DIList
[
io
Type
];
}
}
}
if
(
configIo
==
null
&&
subType
>
0
)
{
if
(
StoreManager
.
Config
.
DIList
.
ContainsKey
(
ioType
))
{
return
StoreManager
.
Config
.
DIList
[
ioType
];
}
}
return
configIo
;
}
private
static
ConfigIO
GetDO
(
string
ioType
,
int
subType
)
internal
static
ConfigIO
GetDO
(
string
ioType
,
int
subType
)
{
ConfigIO
configIo
=
null
;
if
(
subType
<=
0
)
...
...
@@ -108,48 +153,44 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if
(
StoreManager
.
A
llConfigMap
.
ContainsKey
(
subType
))
if
(
StoreManager
.
a
llConfigMap
.
ContainsKey
(
subType
))
{
string
newType
=
ioType
.
Replace
(
"SW1_"
,
"SW_"
).
Replace
(
"SW2_"
,
"SW_"
).
Replace
(
"SW3_"
,
"SW_"
).
Replace
(
"SW4_"
,
"SW_"
);
if
(
StoreManager
.
AllConfigMap
[
subType
].
DOList
.
ContainsKey
(
newType
))
if
(
StoreManager
.
allConfigMap
[
subType
].
DOList
.
ContainsKey
(
ioType
))
{
return
StoreManager
.
AllConfigMap
[
subType
].
DOList
[
new
Type
];
return
StoreManager
.
allConfigMap
[
subType
].
DOList
[
io
Type
];
}
}
}
return
configIo
;
}
public
static
void
CloseDeviceDO
(
List
<
ConfigIO
>
DoList
)
{
foreach
(
ConfigIO
io
in
DoList
)
if
(
configIo
==
null
&&
subType
>
0
)
{
instance
.
WriteSingleDO
(
io
.
IO_IP
,
0
,
io
.
GetIOAddr
(),
IO_VALUE
.
LOW
);
Thread
.
Sleep
(
60
);
if
(
StoreManager
.
Config
.
DOList
.
ContainsKey
(
ioType
))
{
return
StoreManager
.
Config
.
DOList
[
ioType
];
}
}
return
configIo
;
}
public
static
void
CloseDeviceDO
(
int
subType
)
#
endregion
public
static
void
Init
()
{
List
<
ConfigIO
>
DoList
=
new
List
<
ConfigIO
>(
);
if
(
subType
<=
0
)
bool
UseHCBoard
=
true
;
// ConfigAppSettings.GetIntValue(Setting_Init.UseHCBoard).Equals(1
);
if
(
UseHCBoard
)
{
DoList
=
new
List
<
ConfigIO
>(
StoreManager
.
Config
.
DOList
.
Values
);
instance
=
new
HCIOManager
(
);
}
else
{
if
(
StoreManager
.
AllConfigMap
.
ContainsKey
(
subType
)
)
bool
isAIOBox
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
UseAIOBOX
).
Equals
(
1
);
if
(
isAIOBox
)
{
DoList
=
new
List
<
ConfigIO
>(
StoreManager
.
AllConfigMap
[
subType
].
DOList
.
Values
);
instance
=
new
AIOBOXManager
(
);
}
//else
//{
// instance = new KNDManager();
//}
}
CloseDeviceDO
(
DoList
);
}
#
endregion
public
static
void
Init
()
{
instance
=
new
AIOBOXManager
();
}
public
abstract
void
ReadAllDI
(
string
deviceName
,
byte
slaveId
);
public
abstract
void
ReadAllDI
(
string
deviceName
,
byte
slaveId
);
public
abstract
void
ReadAllDO
(
string
deviceName
,
byte
slaveId
);
...
...
@@ -158,11 +199,11 @@ namespace OnlineStore.DeviceLibrary
public
abstract
void
WriteSingleDO
(
string
deviceName
,
byte
slaveId
,
ushort
index
,
IO_VALUE
value
);
public
abstract
IO_VALUE
GetDIValue
(
string
deviceName
,
byte
slaveID
,
ushort
v
);
public
abstract
IO_VALUE
GetDIValue
(
string
deviceName
,
byte
slaveID
,
ushort
index
);
public
abstract
IO_VALUE
GetDOValue
(
string
deviceName
,
byte
slaveID
,
ushort
v
);
public
abstract
IO_VALUE
GetDOValue
(
string
deviceName
,
byte
slaveID
,
ushort
index
);
public
abstract
IO_VALUE
GetIOValue
(
ConfigIO
configIO
);
...
...
source/DeviceLibrary/duoStore/AxisBean.cs
查看文件 @
1c43d39
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/duoStore/BoxBean.cs
查看文件 @
1c43d39
using
Asa
;
using
DeviceLib
;
using
Asa
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
...
...
@@ -224,7 +222,7 @@ namespace OnlineStore.DeviceLibrary
case
StoreMoveStep
.
BOX_H02_InoutToP1
:
//如果此时轴三还在报警,需要提示错误并等待
if
(
A
CServerManager
.
GetAlarmStatus
(
Config
.
InOut_Axis
.
DeviceName
,
Config
.
InOut_Axis
.
GetAxisValue
())
>
0
)
if
(
A
xisManager
.
instance
.
GetAlarmStatus
(
Config
.
InOut_Axis
.
DeviceName
,
Config
.
InOut_Axis
.
GetAxisValue
())
>
0
)
{
LogUtil
.
error
(
Name
+
MoveInfo
.
MoveType
+
"复位失败: "
+
Config
.
InOut_Axis
.
Explain
+
"报警"
);
WarnMsg
=
Name
+
"复位失败: "
+
Config
.
InOut_Axis
.
Explain
+
"报警"
;
...
...
@@ -370,10 +368,10 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
EndMove
();
IOMove
(
IO_Type
.
UpdownAxis_Break
,
IO_VALUE
.
LOW
);
//运动版停止
MiddleAxis
.
SuddenStop
(
true
);
UpdownAxis
.
SuddenStop
(
true
);
InoutAxis
.
SuddenStop
(
true
);
ComAxis
.
SuddenStop
(
true
);
MiddleAxis
.
SuddenStop
();
UpdownAxis
.
SuddenStop
();
InoutAxis
.
SuddenStop
();
ComAxis
.
SuddenStop
();
CloseAllAxis
();
LogInfo
(
"StopMove"
);
isInPro
=
false
;
...
...
source/DeviceLibrary/duoStore/BoxBean_Partial.cs
查看文件 @
1c43d39
using
Asa
;
using
DeviceLib
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
...
...
@@ -20,7 +19,7 @@ namespace OnlineStore.DeviceLibrary
#
region
出入库结果验证
private
bool
AcInPosition
(
ConfigMoveAxis
axis
,
int
p
)
{
return
A
CServerManager
.
isInPosition
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
p
,
axis
.
CanErrorCountMax
);
return
A
xisManager
.
instance
.
isInPosition
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
p
,
axis
.
CanErrorCountMax
);
}
private
static
DateTime
lastComRHomeTime
=
DateTime
.
Now
;
...
...
source/DeviceLibrary/duoStore/DUOStoreBean.cs
查看文件 @
1c43d39
...
...
@@ -294,7 +294,6 @@ namespace OnlineStore.DeviceLibrary
}
}
}
public
override
void
StopMove
()
{
foreach
(
BoxBean
equip
in
this
.
BoxMap
.
Values
)
...
...
@@ -304,16 +303,14 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
EndMove
();
hoisterCylinder
.
Stop
();
//轴运动停止
T3_UpdownAxis
.
SuddenStop
(
true
);
T2_MiddleAxis
.
SuddenStop
(
true
);
T1_BatchAxis
.
SuddenStop
(
true
);
T3_UpdownAxis
.
SuddenStop
();
T2_MiddleAxis
.
SuddenStop
();
T1_BatchAxis
.
SuddenStop
();
CloseAllAxis
();
LineStop
();
}
public
override
void
StopRun
()
{
mainTimer
.
Enabled
=
false
;
...
...
@@ -323,7 +320,7 @@ namespace OnlineStore.DeviceLibrary
foreach
(
BoxBean
equip
in
BoxMap
.
Values
)
{
equip
.
StopRun
();
}
}
runStatus
=
StoreRunStatus
.
Wait
;
// RFIDManager.Close();
TimeSpan
span
=
DateTime
.
Now
-
StartTime
;
...
...
@@ -657,7 +654,6 @@ namespace OnlineStore.DeviceLibrary
public
bool
OpenAllAxis
(
bool
isCheck
=
true
)
{
if
(
RunMultiAxis
(
isCheck
,
IO_Type
.
MoveAxis_Run
,
IO_Type
.
MoveAxis_Break
,
new
AxisBean
[]{
T3_UpdownAxis
,
T2_MiddleAxis
}))
{
if
(
RunAxis
(
isCheck
,
T1_BatchAxis
)
)
...
...
source/DeviceLibrary/duoStore/DUOStoreBean_Partial.cs
查看文件 @
1c43d39
using
DeviceLib
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -48,7 +47,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil
.
debug
(
Name
+
"CheckWaitResult 检测到"
+
T1_BatchAxis
.
TargetIoType
+
"="
+
T1_BatchAxis
.
TargetIoValue
+
",停止运行"
);
T1_BatchAxis
.
StopAxisCheckMove
();
if
(
A
CServerManager
.
GetBusyStatus
(
wait
.
AxisInfo
.
DeviceName
,
wait
.
AxisInfo
.
GetAxisValue
()).
Equals
(
1
))
if
(
A
xisManager
.
instance
.
GetBusyStatus
(
wait
.
AxisInfo
.
DeviceName
,
wait
.
AxisInfo
.
GetAxisValue
()).
Equals
(
1
))
{
T1_BatchAxis
.
SuddenStop
();
}
...
...
@@ -56,7 +55,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
bool
isOk
=
A
CServerManager
.
GetBusyStatus
(
wait
.
AxisInfo
.
DeviceName
,
wait
.
AxisInfo
.
GetAxisValue
()).
Equals
(
0
);
bool
isOk
=
A
xisManager
.
instance
.
GetBusyStatus
(
wait
.
AxisInfo
.
DeviceName
,
wait
.
AxisInfo
.
GetAxisValue
()).
Equals
(
0
);
if
(
isOk
)
{
//TODO 判断是否达到高度,如果未达到,继续上升
...
...
source/DeviceLibrary/duoStore/EquipBase.cs
查看文件 @
1c43d39
using
DeviceLib
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -147,7 +146,7 @@ namespace OnlineStore.DeviceLibrary
{
short
axis
=
axisInfo
.
Config
.
GetAxisValue
();
string
deviceName
=
axisInfo
.
Config
.
GetNameStr
();
int
value
=
A
CServerManager
.
GetAlarmStatus
(
deviceName
,
axis
);
int
value
=
A
xisManager
.
instance
.
GetAlarmStatus
(
deviceName
,
axis
);
//if (value.Equals(-1))
//{
// value = ACServerManager.GetAlarmStatus(deviceName, axis);
...
...
source/DeviceLibrary/duoStore/StoreManager.cs
查看文件 @
1c43d39
using
DeviceLib
;
using
log4net
;
using
log4net
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
...
...
@@ -18,7 +17,7 @@ namespace OnlineStore.DeviceLibrary
public
static
DUOStoreBean
Store
=
null
;
public
static
Store_Config
Config
=
null
;
public
static
Dictionary
<
int
,
BaseConfig
>
A
llConfigMap
=
null
;
public
static
Dictionary
<
int
,
BaseConfig
>
a
llConfigMap
=
null
;
private
static
bool
isInit
=
false
;
public
static
bool
IsConnectServer
=
!
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
).
Equals
(
""
);
public
StoreManager
()
...
...
@@ -48,7 +47,7 @@ namespace OnlineStore.DeviceLibrary
{
try
{
A
llConfigMap
=
new
Dictionary
<
int
,
BaseConfig
>();
a
llConfigMap
=
new
Dictionary
<
int
,
BaseConfig
>();
BaseConfig
.
ProIOIpMap
=
new
Dictionary
<
string
,
string
>();
if
(!
isInit
)
{
...
...
@@ -77,7 +76,7 @@ namespace OnlineStore.DeviceLibrary
string
linefilePath
=
appPath
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
Store_ConfigPath
);
Config
=
CSVConfigReader
.
LoadLineConfig
(
0
,
CID
,
"Line"
,
linefilePath
);
A
llConfigMap
.
Add
(
0
,
Config
);
a
llConfigMap
.
Add
(
0
,
Config
);
string
moveEquipConfig
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
BOX_ConfigPath
);
for
(
int
i
=
1
;
i
<=
count
;
i
++)
...
...
@@ -88,7 +87,7 @@ namespace OnlineStore.DeviceLibrary
string
boxCid
=
ConfigAppSettings
.
GetValue
(
storeIdConfig
);
BOX_Config
moveConfig
=
CSVConfigReader
.
LoadBoxConfig
(
i
,
boxCid
,
"BOX"
,
config
);
moveConfig
.
SetIO
(
i
);
A
llConfigMap
.
Add
(
i
,
moveConfig
);
a
llConfigMap
.
Add
(
i
,
moveConfig
);
storeConfig
.
Add
(
i
,
moveConfig
);
}
string
positionConfigFile
=
appPath
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
Store_Position_Config
);
...
...
@@ -108,7 +107,6 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
info
(
"加载料仓完成!"
);
}
ACServerManager
.
LogEvent
+=
ACServerManager_LogEvent
;
Store
=
new
DUOStoreBean
(
Config
,
storeConfig
);
}
}
...
...
@@ -137,7 +135,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil
.
error
(
"保存配置文件失败:"
+
configFile
);
}
A
llConfigMap
[
storeConfig
.
Id
]
=
storeConfig
;
a
llConfigMap
[
storeConfig
.
Id
]
=
storeConfig
;
Store
.
BoxConfigMap
[
storeConfig
.
Id
]
=
storeConfig
;
Store
.
BoxMap
[
storeConfig
.
Id
].
Config
=
storeConfig
;
Store
.
BoxMap
[
storeConfig
.
Id
].
MoveAxisConfig
();
...
...
@@ -176,21 +174,7 @@ namespace OnlineStore.DeviceLibrary
}
return
false
;
}
private
static
void
ACServerManager_LogEvent
(
InfoType
type
,
string
msg
)
{
if
(
type
.
Equals
(
InfoType
.
Error
))
{
LogUtil
.
error
(
msg
);
}
else
if
(
type
.
Equals
(
InfoType
.
Info
))
{
LogUtil
.
info
(
msg
);
}
else
{
LogUtil
.
debug
(
msg
);
}
}
#
endregion
#
region
位置加载
...
...
source/DeviceLibrary/store/KTK_Store.cs
查看文件 @
1c43d39
using
DeviceLib
;
using
log4net
;
using
log4net
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
...
...
@@ -458,7 +457,7 @@ namespace OnlineStore.DeviceLibrary
#
region
多个伺服运动
public
bool
RunMultiAxis
(
bool
isCheck
,
string
serverOnDO
,
string
breakOnDO
,
params
AxisBean
[]
axisArray
)
public
bool
RunMultiAxis
(
bool
isCheck
,
params
AxisBean
[]
axisArray
)
{
IOManager
.
IOMove
(
serverOnDO
,
IO_VALUE
.
HIGH
,
baseConfig
.
Id
);
string
msg
=
""
;
...
...
@@ -474,18 +473,18 @@ namespace OnlineStore.DeviceLibrary
}
Thread
.
Sleep
(
500
);
//打开所有轴
if
(
isCheck
)
{
foreach
(
AxisBean
axis
in
axisArray
)
{
if
(!
axis
.
AxisIsOpen
(
out
msg
))
{
SetWarnMsg
(
Name
+
msg
);
Alarm
(
AlarmType
.
AxisAlarm
);
return
false
;
}
}
}
//
if (isCheck)
//
{
//
foreach (AxisBean axis in axisArray)
//
{
// if (!axis.OpenAxis
(out msg))
//
{
//
SetWarnMsg(Name + msg);
//
Alarm(AlarmType.AxisAlarm);
//
return false;
//
}
//
}
//
}
IOManager
.
IOMove
(
breakOnDO
,
IO_VALUE
.
HIGH
,
baseConfig
.
Id
);
return
true
;
}
...
...
source/LoadCVSLibrary/storeConfig/ConfigItemBase.cs
查看文件 @
1c43d39
...
...
@@ -51,6 +51,7 @@ namespace OnlineStore.LoadCSVLibrary
throw
new
CVSFieldNotMatchingExection
(
ConfigStr
+
",【类型:"
+
ProType
+
"】【名称:"
+
ProName
+
"】【属性值:"
+
ProValue
+
"】必须配置值!"
);
}
}
public
byte
SlaveID
=
0
;
}
/// <summary>
/// 运动轴配置
...
...
source/LoadCVSLibrary/storeConfig/config/IO_Type.cs
查看文件 @
1c43d39
...
...
@@ -36,7 +36,7 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// DI,0,启动,AutoRun_BTN,2,PRO_AOI_IP_1,X03,
/// </summary>
public
static
string
AutoRun_BTN
=
"AutoRun_BTN"
;
//
public static string AutoRun_BTN = "AutoRun_BTN";
/// <summary>
/// DI,0,气压检测,Airpressure_Check,3,PRO_AOI_IP_1,X04,
/// </summary>
...
...
@@ -126,22 +126,22 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// DO,1,左侧料仓升降轴刹车ON,UpdownAxis_Break,11,PRO_AOI_IP_1,Y12,
/// </summary>
public
static
string
UpdownAxis_Break
=
"UpdownAxis_Break"
;
//
public static string UpdownAxis_Break = "UpdownAxis_Break";
/// <summary>
/// DO,0,提升机构升降轴刹车ON,BatchAxis_Break,13,PRO_AOI_IP_1,Y14,
/// </summary>
public
static
string
BatchAxis_Break
=
"BatchAxis_Break"
;
//
public static string BatchAxis_Break = "BatchAxis_Break";
/// <summary>
/// DO,0,移栽机构上下轴刹车ON,MoveAxis_Break,14,PRO_AOI_IP_1,Y15,
/// </summary>
public
static
string
MoveAxis_Break
=
"MoveAxis_Break"
;
//
public static string MoveAxis_Break = "MoveAxis_Break";
/// <summary>
/// DO,1,左侧料仓伺服ON,Axis_Run,15,PRO_AOI_IP_1,Y16,
/// </summary>
public
static
string
Axis_Run
=
"Axis_Run"
;
//
public static string Axis_Run = "Axis_Run";
/// <summary>
...
...
@@ -213,19 +213,19 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// DI,0,取料气缸料盘检测,ClampCylinder_Check,0,PRO_AOI_IP_3,X41,
/// </summary>
public
static
string
ClampCylinder_Check
=
"ClampCylinder_Check"
;
//
public static string ClampCylinder_Check = "ClampCylinder_Check";
/// <summary>
/// DI,0,线体出口放行信号,LineOut_BTN,1,PRO_AOI_IP_3,X42,
/// </summary>
public
static
string
LineOut_BTN
=
"LineOut_BTN"
;
//
public static string LineOut_BTN = "LineOut_BTN";
/// <summary>
/// DO,0,线体入口指示灯,LineIn_Led,0,PRO_AOI_IP_3,Y41,
/// </summary>
public
static
string
LineIn_Led
=
"LineIn_Led"
;
//
public static string LineIn_Led = "LineIn_Led";
/// <summary>
/// DO,0,线体出口指示灯,LineOut_Led,1,PRO_AOI_IP_3,Y42,
/// </summary>
public
static
string
LineOut_Led
=
"LineOut_Led"
;
//
public static string LineOut_Led = "LineOut_Led";
/// <summary>
/// DO,0,设备内部照明ON,Device_Led,2,PRO_AOI_IP_3,Y43,
/// </summary>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论