Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 20ae38b0
由
LN
编写于
2019-07-25 09:10:55 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
有开关门的才需要检测气压信号,无舱门的不需要检测气压信号
1 个父辈
1c9af478
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
102 行增加
和
19 行删除
source/ACSingleStore/App.config
source/ACSingleStore/FrmAxisDebug.cs
source/ACSingleStore/FrmStoreBox.Designer.cs
source/ACSingleStore/记录.txt
source/DeviceLibrary/PanasonicServo/ACServerManager.cs
source/DeviceLibrary/PanasonicServo/ACServerManager_Partial.cs
source/DeviceLibrary/StoreConfig/AC/linePositions.csv
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
source/ACSingleStore/App.config
查看文件 @
20ae38b
...
...
@@ -21,7 +21,7 @@
<
add
key
=
"Store_ConfigPath"
value
=
"\StoreConfig\AC\StoreConfig.csv"
/>
<
add
key
=
"Store_Type"
value
=
"RC_AC_SA"
/>
<
add
key
=
"Store_CID"
value
=
"rc1246ac-1"
/>
<
add
key
=
"Store_ID"
value
=
"
1
"
/>
<
add
key
=
"Store_ID"
value
=
"
3
"
/>
<!--
end
one
store
config
-->
<
add
key
=
"ACBaudRate"
value
=
"115200"
/>
<
add
key
=
"InOutDefaultPosition"
value
=
"8000"
/>
...
...
source/ACSingleStore/FrmAxisDebug.cs
查看文件 @
20ae38b
...
...
@@ -47,6 +47,7 @@ namespace OnlineStore.ACSingleStore
}
private
void
FrmAxisDebug_Load
(
object
sender
,
EventArgs
e
)
{
ACServerManager
.
ClearSpeed
();
txtMiddleSpeed
.
Text
=
(
middle
.
TargetSpeed
/
5
).
ToString
();
txtInOutSpeed
.
Text
=
(
inout
.
TargetSpeed
/
5
).
ToString
();
txtUpDownSpeed
.
Text
=
(
updown
.
TargetSpeed
/
5
).
ToString
();
...
...
source/ACSingleStore/FrmStoreBox.Designer.cs
查看文件 @
20ae38b
...
...
@@ -1332,9 +1332,6 @@
this
.
cmbPosition
.
DropDownStyle
=
System
.
Windows
.
Forms
.
ComboBoxStyle
.
DropDownList
;
this
.
cmbPosition
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
cmbPosition
.
FormattingEnabled
=
true
;
this
.
cmbPosition
.
Items
.
AddRange
(
new
object
[]
{
"料仓0"
,
"料仓1"
});
this
.
cmbPosition
.
Location
=
new
System
.
Drawing
.
Point
(
76
,
31
);
this
.
cmbPosition
.
Name
=
"cmbPosition"
;
this
.
cmbPosition
.
Size
=
new
System
.
Drawing
.
Size
(
189
,
28
);
...
...
source/ACSingleStore/记录.txt
查看文件 @
20ae38b
...
...
@@ -91,4 +91,7 @@
去掉测高,测高在流水线处处理.
料仓ID改为配置,方便与流水线通信。
20190724调试修改
有开关门的才需要检测气压信号,无舱门的不需要检测气压信号
\ No newline at end of file
source/DeviceLibrary/PanasonicServo/ACServerManager.cs
查看文件 @
20ae38b
...
...
@@ -19,7 +19,7 @@ namespace OnlineStore.DeviceLibrary
private
static
int
ReviceOutTimeMS
=
100
;
private
static
Dictionary
<
string
,
Dictionary
<
string
,
int
>>
ComAddrValue
=
new
Dictionary
<
string
,
Dictionary
<
string
,
int
>>();
private
static
string
mapObj
=
""
;
private
static
int
GetAddrValue
(
string
portName
,
int
slvAddr
,
string
addr
)
{
int
value
=
-
1
;
...
...
@@ -74,6 +74,12 @@ namespace OnlineStore.DeviceLibrary
}
}
public
static
void
ClearSpeed
()
{
LogUtil
.
info
(
"清理之前设置保存的速度列表"
);
ComAddrValue
=
new
Dictionary
<
string
,
Dictionary
<
string
,
int
>>();
}
public
static
bool
OpenPort
(
string
portName
)
{
if
(
serialBeanMap
.
ContainsKey
(
portName
))
...
...
@@ -362,16 +368,28 @@ namespace OnlineStore.DeviceLibrary
}
public
static
void
SetSpeed
(
string
portName
,
int
slvAddr
,
int
speed
)
{
int
preSpeed
=
GetAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
);
int
preSpeed
=
GetAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
);
if
((
preSpeed
.
Equals
(-
1
))
||
(!
preSpeed
.
Equals
(
Math
.
Abs
(
speed
))))
{
string
v1
=
slvAddr
+
"064601 "
+
ACServerManager
.
SpeedToStr
(
speed
,
4
)
+
" ffff"
;
LogUtil
.
debug
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】更新速度为【"
+
speed
+
"】,发送数据【"
+
v1
+
"】"
);
SendStrAndSleep
(
portName
,
v1
,
SleepMSendons
);
UpdateAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
,
Math
.
Abs
(
speed
));
Thread
.
Sleep
(
SleepMSendons
);
}
for
(
int
i
=
1
;
i
<=
3
;
i
++)
{
bool
result
=
SendStrAndSleep
(
portName
,
v1
,
SleepMSendons
);
if
(
result
)
{
break
;
}
else
{
LogUtil
.
error
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】更新速度为【"
+
speed
+
"】,发送数据【"
+
v1
+
"】,第【"
+
i
+
"】次失败"
);
Thread
.
Sleep
(
SleepMSendons
);
}
}
UpdateAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
,
Math
.
Abs
(
speed
));
Thread
.
Sleep
(
SleepMSendons
);
}
}
public
static
void
SpeedMove
(
string
portName
,
int
slvAddr
,
int
speed
)
{
...
...
source/DeviceLibrary/PanasonicServo/ACServerManager_Partial.cs
查看文件 @
20ae38b
...
...
@@ -27,15 +27,16 @@ namespace OnlineStore.DeviceLibrary
}
return
null
;
}
public
static
void
SendStrAndSleep
(
string
portName
,
string
str
,
int
sleepS
)
public
static
bool
SendStrAndSleep
(
string
portName
,
string
str
,
int
sleepS
)
{
byte
[]
data
=
AcSerialBean
.
StringToByte
(
str
);
data
[
data
.
Length
-
1
]
=
0x00
;
data
[
data
.
Length
-
2
]
=
0x00
;
data
=
ACCMDManager
.
buildCheckData
(
data
,
data
.
Length
-
2
);
SendData
(
portName
,
data
);
bool
result
=
SendData
(
portName
,
data
);
System
.
Threading
.
Thread
.
Sleep
(
sleepS
);
return
result
;
}
public
static
void
SaveData
(
string
portName
,
byte
slvAddr
,
string
regAddr
,
int
value
)
...
...
@@ -88,13 +89,14 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
info
(
"串口"
+
portName
+
" 收到数据:"
+
strSend
+
""
);
}
}
public
static
void
SendData
(
string
portName
,
byte
[]
data
)
public
static
bool
SendData
(
string
portName
,
byte
[]
data
)
{
if
(
data
==
null
)
{
return
;
return
false
;
}
byte
[]
returnData
=
SendCommand
(
portName
,
data
,
ReviceOutTimeMS
,
8
);
bool
result
=
false
;
byte
[]
returnData
=
SendCommand
(
portName
,
data
,
ReviceOutTimeMS
,
8
,
out
result
);
if
(
returnData
!=
null
)
{
string
strSend
=
""
;
...
...
@@ -107,6 +109,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
info
(
"串口"
+
portName
+
" 收到数据:"
+
strSend
+
""
);
}
}
return
result
;
}
/// <summary>
/// 发送数据并获取返回值
...
...
@@ -162,7 +165,64 @@ namespace OnlineStore.DeviceLibrary
}
return
returnData
;
}
/// <summary>
/// 发送数据并获取返回值
/// </summary>
/// <param name="data">发送的数据</param>
/// <param name="outTime">超时时间</param>
/// <param name="result">返回结果,是否发送成功</param>
/// <returns>返回值的长度</returns>
public
static
byte
[]
SendCommand
(
string
portName
,
byte
[]
data
,
int
outTime
,
int
reviceLength
,
out
bool
result
)
{
if
(
outTime
<
100
)
{
outTime
=
100
;
}
byte
[]
returnData
=
null
;
result
=
false
;
try
{
if
(
data
==
null
)
{
return
returnData
;
}
string
strSend
=
""
;
for
(
int
i
=
0
;
i
<
data
.
Length
;
i
++)
{
strSend
+=
string
.
Format
(
"{0:X2} "
,
data
[
i
]);
}
if
(
strSend
.
Equals
(
""
))
{
return
returnData
;
}
if
(
IsShowMsg
)
{
LogUtil
.
info
(
"串口"
+
portName
+
" 写入数据:"
+
strSend
+
""
);
}
AcSerialBean
bean
=
GetSerialBean
(
portName
);
if
(
bean
==
null
)
{
LogUtil
.
debug
(
"ACServerManager SendCommand 试图向未打开串口【"
+
portName
+
"】写入数据:"
+
strSend
+
"。"
);
}
else
{
int
ret
=
bean
.
SendCommand
(
data
,
ref
returnData
,
outTime
,
reviceLength
);
if
(!
ret
.
Equals
(
reviceLength
))
{
LogUtil
.
error
(
"串口"
+
portName
+
" 写入数据:"
+
strSend
+
",预计返回字节数【"
+
reviceLength
+
"】实际返回【"
+
ret
+
"】"
);
}
else
{
result
=
true
;
}
System
.
Threading
.
Thread
.
Sleep
(
2
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
info
(
ex
.
ToString
());
}
return
returnData
;
}
public
static
void
WriteData
(
string
portName
,
int
slvAddr
,
string
addr
,
string
data
,
byte
cmd
,
int
length
)
{
...
...
source/DeviceLibrary/StoreConfig/AC/linePositions.csv
查看文件 @
20ae38b
此文件的差异太大,无法显示。
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
查看文件 @
20ae38b
...
...
@@ -158,7 +158,7 @@ namespace OnlineStore.DeviceLibrary
IO_VALUE
airCheck
=
IOManager
.
IOValue
(
IO_Type
.
Airpressure_Check
);
//if (suddenBtn == IO_VALUE.HIGH)
if
(
suddenBtn
==
IO_VALUE
.
HIGH
&&
airCheck
==
IO_VALUE
.
HIGH
)
if
(
suddenBtn
.
Equals
(
IO_VALUE
.
HIGH
)
&&
(
airCheck
.
Equals
(
IO_VALUE
.
HIGH
)
||
Config
.
HasDoor
.
Equals
(
0
))
)
{
//lastAirValue = airCheck;
lastAirCloseTime
=
DateTime
.
Now
;
...
...
@@ -184,7 +184,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if
(
suddenBtn
.
Equals
(
IO_VALUE
.
LOW
))
if
(
Config
.
HasDoor
.
Equals
(
1
)
&&
suddenBtn
.
Equals
(
IO_VALUE
.
LOW
))
{
LogUtil
.
error
(
LOGGER
,
" ("
+
StoreName
+
")启动出现错误:急停没开 !启动失败!"
);
}
...
...
@@ -721,6 +721,10 @@ namespace OnlineStore.DeviceLibrary
private
IO_VALUE
preAirValue
=
IO_VALUE
.
HIGH
;
private
void
AirCheckProcess
()
{
if
(
Config
.
HasDoor
.
Equals
(
0
))
{
return
;
}
IO_VALUE
currAirValue
=
IOManager
.
IOValue
(
IO_Type
.
Airpressure_Check
);
if
(
isInSuddenDown
)
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论