Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit a4931ab7
由
几米阳光
编写于
2019-01-14 16:08:07 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
改为伺服串联兼容模式
1 个父辈
351b7603
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
45 行增加
和
30 行删除
dll/CodeLibrary.dll
source/ACSingleStore/App.config
source/ACSingleStore/FrmStoreBox.cs
source/DeviceLibrary/PanasonicServo/ACServerManager.cs
source/DeviceLibrary/PanasonicServo/ACServerManager_Partial.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
source/LoadCVSLibrary/storeConfig/ConfigItemBase.cs
dll/CodeLibrary.dll
查看文件 @
a4931ab
此文件类型无法预览
source/ACSingleStore/App.config
查看文件 @
a4931ab
...
...
@@ -31,7 +31,7 @@
<!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<
add
key
=
"CodeParamPath"
value
=
"\CodeParam\"
/>
<
add
key
=
"AI_ConvertPosition"
value
=
"55"
/>
<
add
key
=
"InOutDefaultPosition"
value
=
"8000
0
"
/>
<
add
key
=
"InOutDefaultPosition"
value
=
"8000"
/>
<
add
key
=
"Config_Pwd"
value
=
"123456"
/>
<!--出库等待料盘拿走的时间,秒-->
<
add
key
=
"OutStoreWaitSeconds"
value
=
"600"
/>
...
...
source/ACSingleStore/FrmStoreBox.cs
查看文件 @
a4931ab
...
...
@@ -319,7 +319,7 @@ namespace OnlineStore.ACSingleStore
int
lCountPulse1
=
ACServerManager
.
GetActualtPosition
(
store
.
Config
.
Middle_Axis
.
DeviceName
,
store
.
Config
.
Middle_Axis
.
GetAxisValue
());
lblCountPulse1
.
Text
=
string
.
Format
(
"{0:d}"
,
lCountPulse1
);
txtMiddleTarget
.
Text
=
store
.
Config
.
Middle_Axis
.
TargetPosition
.
ToString
();
if
(
deviceName
.
Equals
(
store
.
Config
.
Middle_Axis
.
DeviceName
))
if
(
store
.
Config
.
Middle_Axis
.
IsSameAxis
(
portName
,
SlvAddr
))
{
lblOutPulse
.
Text
=
lblOutPulse1
.
Text
;
lblCountPulse
.
Text
=
lblCountPulse1
.
Text
;
...
...
@@ -334,7 +334,7 @@ namespace OnlineStore.ACSingleStore
int
lCountPulse2
=
ACServerManager
.
GetActualtPosition
(
store
.
Config
.
UpDown_Axis
.
DeviceName
,
store
.
Config
.
UpDown_Axis
.
GetAxisValue
());
lblCountPulse2
.
Text
=
string
.
Format
(
"{0:d}"
,
lCountPulse2
);
txtInoutTarget
.
Text
=
store
.
Config
.
InOut_Axis
.
TargetPosition
.
ToString
();
if
(
deviceName
.
Equals
(
store
.
Config
.
UpDown_Axis
.
DeviceName
))
if
(
store
.
Config
.
UpDown_Axis
.
IsSameAxis
(
portName
,
SlvAddr
))
{
lblOutPulse
.
Text
=
lblOutPulse2
.
Text
;
lblCountPulse
.
Text
=
lblCountPulse2
.
Text
;
...
...
@@ -348,7 +348,7 @@ namespace OnlineStore.ACSingleStore
int
lCountPulse3
=
ACServerManager
.
GetActualtPosition
(
store
.
Config
.
InOut_Axis
.
DeviceName
,
store
.
Config
.
InOut_Axis
.
GetAxisValue
());
lblCountPulse3
.
Text
=
string
.
Format
(
"{0:d}"
,
lCountPulse3
);
txtUpdownTarget
.
Text
=
store
.
Config
.
UpDown_Axis
.
TargetPosition
.
ToString
();
if
(
deviceName
.
Equals
(
store
.
Config
.
InOut_Axis
.
DeviceName
))
if
(
store
.
Config
.
InOut_Axis
.
IsSameAxis
(
portName
,
SlvAddr
))
{
lblOutPulse
.
Text
=
lblOutPulse3
.
Text
;
lblCountPulse
.
Text
=
lblCountPulse3
.
Text
;
...
...
@@ -512,12 +512,12 @@ namespace OnlineStore.ACSingleStore
// MessageBox.Show("位置超出" + axisC.Explain + "上下限(" + axisC.PositionMin + "-" + axisC.PositionMax + ")");
// return;
//}
if
(
portName
.
Equals
(
store
.
Config
.
InOut_Axis
.
DeviceName
)
&&
(
store
.
InOutAxisCanMove
().
Equals
(
false
)))
if
(
store
.
Config
.
InOut_Axis
.
IsSameAxis
(
portName
,
SlvAddr
)
&&
(
store
.
InOutAxisCanMove
().
Equals
(
false
)))
{
MessageBox
.
Show
(
"定位气缸不在下降端,不能移动进出轴"
,
"警告"
,
MessageBoxButtons
.
OK
,
MessageBoxIcon
.
Warning
);
return
;
}
else
if
(
portName
.
Equals
(
store
.
Config
.
Middle_Axis
.
DeviceName
)
||
portName
.
Equals
(
store
.
Config
.
UpDown_Axis
.
DeviceName
))
else
if
(
store
.
Config
.
Middle_Axis
.
IsSameAxis
(
portName
,
SlvAddr
)
||
store
.
Config
.
UpDown_Axis
.
IsSameAxis
(
portName
,
SlvAddr
))
{
if
(!
InOutIsIsP1
())
{
...
...
@@ -533,12 +533,12 @@ namespace OnlineStore.ACSingleStore
string
portName
=
txtAxisDeviceName
.
Text
;
short
SlvAddr
=
FormUtil
.
GetShortValue
(
txtAxisValue
);
int
speed
=
FormUtil
.
GetIntValue
(
txtASpeed
);
if
(
portName
.
Equals
(
store
.
Config
.
InOut_Axis
.
DeviceName
)
&&
(
store
.
InOutAxisCanMove
().
Equals
(
false
)))
if
(
store
.
Config
.
InOut_Axis
.
IsSameAxis
(
portName
,
SlvAddr
)
&&
(
store
.
InOutAxisCanMove
().
Equals
(
false
)))
{
MessageBox
.
Show
(
"定位气缸不在下降端,不能移动进出轴"
,
"警告"
,
MessageBoxButtons
.
OK
,
MessageBoxIcon
.
Warning
);
return
;
}
else
if
(
portName
.
Equals
(
store
.
Config
.
Middle_Axis
.
DeviceName
)
||
portName
.
Equals
(
store
.
Config
.
UpDown_Axis
.
DeviceName
))
else
if
(
store
.
Config
.
Middle_Axis
.
IsSameAxis
(
portName
,
SlvAddr
)
||
store
.
Config
.
UpDown_Axis
.
IsSameAxis
(
portName
,
SlvAddr
))
{
if
(!
InOutIsIsP1
())
{
...
...
@@ -564,12 +564,12 @@ namespace OnlineStore.ACSingleStore
// return;
//}
if
(
portName
.
Equals
(
store
.
Config
.
InOut_Axis
.
DeviceName
)
&&
(
store
.
InOutAxisCanMove
().
Equals
(
false
)))
if
(
store
.
Config
.
InOut_Axis
.
IsSameAxis
(
portName
,
SlvAddr
)
&&
(
store
.
InOutAxisCanMove
().
Equals
(
false
)))
{
MessageBox
.
Show
(
"定位气缸不在下降端,不能移动进出轴"
,
"警告"
,
MessageBoxButtons
.
OK
,
MessageBoxIcon
.
Warning
);
return
;
}
else
if
(
portName
.
Equals
(
store
.
Config
.
Middle_Axis
.
DeviceName
)
||
portName
.
Equals
(
store
.
Config
.
UpDown_Axis
.
DeviceName
))
else
if
(
store
.
Config
.
Middle_Axis
.
IsSameAxis
(
portName
,
SlvAddr
)
||
store
.
Config
.
UpDown_Axis
.
IsSameAxis
(
portName
,
SlvAddr
))
{
if
(!
InOutIsIsP1
())
{
...
...
@@ -1168,19 +1168,19 @@ namespace OnlineStore.ACSingleStore
{
string
portName
=
txtAxisDeviceName
.
Text
;
short
SlvAddr
=
FormUtil
.
GetShortValue
(
txtAxisValue
);
if
(
portName
.
Equals
(
store
.
Config
.
InOut_Axis
.
DeviceName
)
&&
(
store
.
InOutAxisCanMove
().
Equals
(
false
)))
if
(
store
.
Config
.
InOut_Axis
.
IsSameAxis
(
portName
,
SlvAddr
)
&&
(
store
.
InOutAxisCanMove
().
Equals
(
false
)))
{
MessageBox
.
Show
(
"定位气缸不在下降端,不能移动进出轴"
,
"警告"
,
MessageBoxButtons
.
OK
,
MessageBoxIcon
.
Warning
);
return
;
}
else
if
(
portName
.
Equals
(
store
.
Config
.
Middle_Axis
.
DeviceName
)
||
portName
.
Equals
(
store
.
Config
.
UpDown_Axis
.
DeviceName
))
else
if
(
store
.
Config
.
Middle_Axis
.
IsSameAxis
(
portName
,
SlvAddr
)
||
store
.
Config
.
UpDown_Axis
.
IsSameAxis
(
portName
,
SlvAddr
))
{
if
(!
InOutIsIsP1
())
{
return
;
}
}
int
speed
=
FormUtil
.
GetIntValue
(
txtASpeed
);
LogUtil
.
info
(
"点击【原点返回】,端口号【"
+
portName
+
"】地址【"
+
SlvAddr
+
"】 速度【"
+
speed
+
"】"
);
ACServerManager
.
HomeMove
(
portName
,
SlvAddr
,
speed
);
...
...
source/DeviceLibrary/PanasonicServo/ACServerManager.cs
查看文件 @
a4931ab
...
...
@@ -19,13 +19,14 @@ namespace OnlineStore.DeviceLibrary
private
static
Dictionary
<
string
,
Dictionary
<
string
,
int
>>
ComAddrValue
=
new
Dictionary
<
string
,
Dictionary
<
string
,
int
>>();
private
static
string
mapObj
=
""
;
private
static
int
GetAddrValue
(
string
portName
,
string
addr
)
private
static
int
GetAddrValue
(
string
portName
,
int
slvAddr
,
string
addr
)
{
int
value
=
-
1
;
try
{
string
name
=
portName
+
"_"
+
slvAddr
;
Dictionary
<
string
,
int
>
map
=
null
;
ComAddrValue
.
TryGetValue
(
portN
ame
,
out
map
);
ComAddrValue
.
TryGetValue
(
n
ame
,
out
map
);
if
(
map
==
null
)
{
return
-
1
;
...
...
@@ -41,27 +42,28 @@ namespace OnlineStore.DeviceLibrary
}
return
value
;
}
private
static
void
UpdateAddrValue
(
string
portName
,
string
addr
,
int
value
)
private
static
void
UpdateAddrValue
(
string
portName
,
int
slvAddr
,
string
addr
,
int
value
)
{
try
{
lock
(
mapObj
)
{
string
name
=
portName
+
"_"
+
slvAddr
;
Dictionary
<
string
,
int
>
map
=
null
;
ComAddrValue
.
TryGetValue
(
portN
ame
,
out
map
);
ComAddrValue
.
TryGetValue
(
n
ame
,
out
map
);
if
(
map
==
null
)
{
map
=
new
Dictionary
<
string
,
int
>();
ComAddrValue
.
Add
(
portN
ame
,
map
);
ComAddrValue
.
Add
(
n
ame
,
map
);
}
if
(
map
.
ContainsKey
(
addr
))
{
ComAddrValue
[
portN
ame
][
addr
]
=
value
;
ComAddrValue
[
n
ame
][
addr
]
=
value
;
}
else
{
ComAddrValue
[
portN
ame
].
Add
(
addr
,
value
);
ComAddrValue
[
n
ame
].
Add
(
addr
,
value
);
}
}
}
...
...
@@ -339,7 +341,7 @@ namespace OnlineStore.DeviceLibrary
public
static
void
SpeedMove
(
string
portName
,
int
slvAddr
,
int
speed
)
{
int
preSpeed
=
GetAddrValue
(
portName
,
ACCMDManager
.
Speed_Addr
);
int
preSpeed
=
GetAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
);
if
((
preSpeed
.
Equals
(-
1
))
||
(!
preSpeed
.
Equals
(
Math
.
Abs
(
speed
))))
{
//byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, "4601", string.Format("{0:X2}", Math.Abs(speed)), 2);
...
...
@@ -349,7 +351,7 @@ namespace OnlineStore.DeviceLibrary
string
v1
=
slvAddr
+
"064601 "
+
ACServerManager
.
SpeedToStr
(
speed
,
4
)
+
" ffff"
;
LogUtil
.
debug
(
"轴【"
+
portName
+
"】更新速度为【"
+
speed
+
"】,发送数据【"
+
v1
+
"】"
);
SendStrAndSleep
(
portName
,
v1
,
SleepMSendons
);
UpdateAddrValue
(
portName
,
ACCMDManager
.
Speed_Addr
,
Math
.
Abs
(
speed
));
UpdateAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
,
Math
.
Abs
(
speed
));
Thread
.
Sleep
(
SleepMSendons
);
}
if
(
speed
>
0
)
...
...
@@ -373,13 +375,13 @@ namespace OnlineStore.DeviceLibrary
//先更新速度
string
slvAddrStr
=
string
.
Format
(
strFromat
,
slvAddr
);
int
preSpeed
=
GetAddrValue
(
portName
,
ACCMDManager
.
Speed_Addr
);
int
preSpeed
=
GetAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
);
if
((
preSpeed
.
Equals
(-
1
))
||
(!
preSpeed
.
Equals
(
targetSpeed
)))
{
//速度 V1 =100
string
v1
=
slvAddrStr
+
"064601 "
+
SpeedToStr
(
targetSpeed
,
4
)
+
" ffff"
;
SendStrAndSleep
(
portName
,
v1
,
SleepMSendons
);
UpdateAddrValue
(
portName
,
ACCMDManager
.
Speed_Addr
,
targetSpeed
);
UpdateAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
,
targetSpeed
);
}
//绝对运动
AbsMove
(
portName
,
slvAddr
,
targetPosition
);
...
...
source/DeviceLibrary/PanasonicServo/ACServerManager_Partial.cs
查看文件 @
a4931ab
...
...
@@ -264,6 +264,7 @@ namespace OnlineStore.DeviceLibrary
else
{
bean
.
SendCommand
(
data
,
ref
returnData
,
outTime
,
reviceLength
);
System
.
Threading
.
Thread
.
Sleep
(
2
);
}
}
catch
(
Exception
ex
)
...
...
@@ -327,6 +328,7 @@ namespace OnlineStore.DeviceLibrary
OnlyOpenSTB
(
portName
,
slvAddr
);
System
.
Threading
.
Thread
.
Sleep
(
100
);
CloseSTB
(
portName
,
slvAddr
);
System
.
Threading
.
Thread
.
Sleep
(
100
);
}
public
static
void
OnlyOpenSTB
(
string
portName
,
int
slvAddr
)
...
...
@@ -348,13 +350,13 @@ namespace OnlineStore.DeviceLibrary
public
static
void
UpdateBlock
(
string
portName
,
int
slvAddr
,
string
blockNum
)
{
int
preNum
=
GetAddrValue
(
portName
,
ACCMDManager
.
BlockNo
);
int
preNum
=
GetAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
BlockNo
);
if
(
preNum
.
Equals
(-
1
)
||
(!
preNum
.
ToString
().
Equals
(
blockNum
)))
{
byte
[]
data
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteRegisters
,
ACCMDManager
.
BlockNo
,
blockNum
,
2
);
SendData
(
portName
,
data
);
int
value
=
Convert
.
ToInt16
(
blockNum
);
UpdateAddrValue
(
portName
,
ACCMDManager
.
BlockNo
,
value
);
UpdateAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
BlockNo
,
value
);
Thread
.
Sleep
(
SleepMSendons
);
}
}
...
...
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
查看文件 @
a4931ab
...
...
@@ -146,9 +146,9 @@ namespace OnlineStore.DeviceLibrary
moveAxisList
.
Add
(
Config
.
UpDown_Axis
);
moveAxisList
.
Add
(
Config
.
InOut_Axis
);
this
.
AxisAlarmCodeMap
=
new
Dictionary
<
string
,
AxisAlarmInfo
>();
this
.
AxisAlarmCodeMap
.
Add
(
Config
.
UpDown_Axis
.
DeviceName
,
new
AxisAlarmInfo
());
this
.
AxisAlarmCodeMap
.
Add
(
Config
.
InOut_Axis
.
DeviceName
,
new
AxisAlarmInfo
());
this
.
AxisAlarmCodeMap
.
Add
(
this
.
Config
.
Middle_Axis
.
DeviceName
,
new
AxisAlarmInfo
());
this
.
AxisAlarmCodeMap
.
Add
(
Config
.
UpDown_Axis
.
GetNameStr
()
,
new
AxisAlarmInfo
());
this
.
AxisAlarmCodeMap
.
Add
(
Config
.
InOut_Axis
.
GetNameStr
()
,
new
AxisAlarmInfo
());
this
.
AxisAlarmCodeMap
.
Add
(
this
.
Config
.
Middle_Axis
.
GetNameStr
()
,
new
AxisAlarmInfo
());
}
...
...
source/LoadCVSLibrary/storeConfig/ConfigItemBase.cs
查看文件 @
a4931ab
...
...
@@ -128,7 +128,18 @@ namespace OnlineStore.LoadCSVLibrary
/// 最大位置
/// </summary>
public
int
PositionMax
{
get
;
set
;
}
public
string
GetNameStr
()
{
return
DeviceName
+
"_"
+
GetAxisValue
();
}
public
bool
IsSameAxis
(
string
portName
,
int
slv
)
{
if
(
DeviceName
.
Equals
(
portName
)
&&
slv
.
Equals
(
GetAxisValue
()))
{
return
true
;
}
return
false
;
}
public
bool
PositionIsHasLimit
(){
if
(
PositionMin
.
Equals
(
PositionMax
))
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论