Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSquareStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 09f0b0cf
由
LN
编写于
2020-03-26 19:10:30 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
界面修改:DO列表无内容。点动选择速度无效果。
出入库时:托架必须在后退端 出入库时:增加料架信号检测验证(可勾选) 回原点时:前后轴和升降轴不能同时运动。先回升降轴,再回前后轴
1 个父辈
60c16229
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
154 行增加
和
350 行删除
source/ACSquareStore/App.config
source/ACSquareStore/FrmIOStatus.Designer.cs
source/ACSquareStore/FrmIOStatus.cs
source/ACSquareStore/FrmStoreBox.Designer.cs
source/ACSquareStore/FrmStoreBox.cs
source/ACSquareStore/记录.txt
source/Common/Setting_Init.cs
source/DeviceLibrary/PanasonicServo/ACServerManager.cs
source/DeviceLibrary/acSquareStore/Square_BoxBean.cs
source/DeviceLibrary/acSquareStore/Square_BoxBean_Partial.cs
source/DeviceLibrary/acSquareStore/StoreManager.cs
source/DeviceLibrary/lineConnect/LineConnect.cs
source/DeviceLibrary/store/StoreStep.cs
source/ACSquareStore/App.config
查看文件 @
09f0b0c
...
...
@@ -30,7 +30,8 @@
<!--温控器类型,
0
=壁挂王字壳温湿度变送器,
1
=妙昕温湿度记录仪-->
<
add
key
=
"HumitureControllerType"
value
=
"0"
/>
<
add
key
=
"UseAIOBOX"
value
=
"1"
/>
<!--是否启用物料检测信号-->
<
add
key
=
"UseTrayCheck"
value
=
"0"
/>
<!--是否调试状态-->
<
add
key
=
"IsInDebug"
value
=
"1"
/>
</
appSettings
>
...
...
source/ACSquareStore/FrmIOStatus.Designer.cs
查看文件 @
09f0b0c
...
...
@@ -406,14 +406,13 @@
// cmbWriteIO
//
this
.
cmbWriteIO
.
DisplayMember
=
"ProName"
;
this
.
cmbWriteIO
.
DrawMode
=
System
.
Windows
.
Forms
.
DrawMode
.
OwnerDrawVariable
;
this
.
cmbWriteIO
.
DropDownStyle
=
System
.
Windows
.
Forms
.
ComboBoxStyle
.
DropDownList
;
this
.
cmbWriteIO
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
cmbWriteIO
.
FormattingEnabled
=
true
;
this
.
cmbWriteIO
.
ItemHeight
=
22
;
this
.
cmbWriteIO
.
ItemHeight
=
17
;
this
.
cmbWriteIO
.
Location
=
new
System
.
Drawing
.
Point
(
17
,
25
);
this
.
cmbWriteIO
.
Name
=
"cmbWriteIO"
;
this
.
cmbWriteIO
.
Size
=
new
System
.
Drawing
.
Size
(
358
,
2
8
);
this
.
cmbWriteIO
.
Size
=
new
System
.
Drawing
.
Size
(
358
,
2
5
);
this
.
cmbWriteIO
.
TabIndex
=
234
;
this
.
cmbWriteIO
.
ValueMember
=
"ProName"
;
this
.
cmbWriteIO
.
SelectedIndexChanged
+=
new
System
.
EventHandler
(
this
.
cmbWriteIO_SelectedIndexChanged_1
);
...
...
source/ACSquareStore/FrmIOStatus.cs
查看文件 @
09f0b0c
...
...
@@ -68,7 +68,7 @@ namespace OnlineStore.ACSquareStore
DOControlList
.
Add
(
ioValue
.
ProName
,
control
);
}
this
.
SuspendLayout
();
//此处为不闪屏,一定要有的!
cmbWriteIO
.
DataSource
=
new
List
<
ConfigIO
>(
boxBean
.
Config
.
StoreDOList
.
Values
);
cmbWriteIO
.
ValueMember
=
"ProName"
;
cmbWriteIO
.
DisplayMember
=
"DisplayStr"
;
...
...
source/ACSquareStore/FrmStoreBox.Designer.cs
查看文件 @
09f0b0c
...
...
@@ -170,6 +170,7 @@
this
.
button4
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnClearL
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnLogDebug
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
chbUseTrayCheck
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
groupAxis
.
SuspendLayout
();
this
.
groupBox1
.
SuspendLayout
();
this
.
groupInout
.
SuspendLayout
();
...
...
@@ -1624,7 +1625,7 @@
this
.
chbDebug
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
chbDebug
.
AutoSize
=
true
;
this
.
chbDebug
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
chbDebug
.
Location
=
new
System
.
Drawing
.
Point
(
8
08
,
12
);
this
.
chbDebug
.
Location
=
new
System
.
Drawing
.
Point
(
8
45
,
12
);
this
.
chbDebug
.
Name
=
"chbDebug"
;
this
.
chbDebug
.
Size
=
new
System
.
Drawing
.
Size
(
84
,
24
);
this
.
chbDebug
.
TabIndex
=
271
;
...
...
@@ -1863,6 +1864,7 @@
//
// tabPage4
//
this
.
tabPage4
.
Controls
.
Add
(
this
.
chbUseTrayCheck
);
this
.
tabPage4
.
Controls
.
Add
(
this
.
btnStoreExit
);
this
.
tabPage4
.
Controls
.
Add
(
this
.
chbDebug
);
this
.
tabPage4
.
Controls
.
Add
(
this
.
btnStoreHome
);
...
...
@@ -2074,6 +2076,19 @@
this
.
btnLogDebug
.
UseVisualStyleBackColor
=
true
;
this
.
btnLogDebug
.
Click
+=
new
System
.
EventHandler
(
this
.
开启
DEBUGToolStripMenuItem_Click
);
//
// chbUseTrayCheck
//
this
.
chbUseTrayCheck
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
chbUseTrayCheck
.
AutoSize
=
true
;
this
.
chbUseTrayCheck
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
chbUseTrayCheck
.
Location
=
new
System
.
Drawing
.
Point
(
699
,
12
);
this
.
chbUseTrayCheck
.
Name
=
"chbUseTrayCheck"
;
this
.
chbUseTrayCheck
.
Size
=
new
System
.
Drawing
.
Size
(
112
,
24
);
this
.
chbUseTrayCheck
.
TabIndex
=
272
;
this
.
chbUseTrayCheck
.
Text
=
"启用物料检测"
;
this
.
chbUseTrayCheck
.
UseVisualStyleBackColor
=
true
;
this
.
chbUseTrayCheck
.
CheckedChanged
+=
new
System
.
EventHandler
(
this
.
chbUseTrayCheck_CheckedChanged
);
//
// FrmStoreBox
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
96F
,
96F
);
...
...
@@ -2265,6 +2280,7 @@
private
System
.
Windows
.
Forms
.
Button
btnOpenRDoor
;
private
System
.
Windows
.
Forms
.
Button
btnOpenLDoor
;
private
System
.
Windows
.
Forms
.
ComboBox
cmbHumpPort
;
private
System
.
Windows
.
Forms
.
CheckBox
chbUseTrayCheck
;
}
}
source/ACSquareStore/FrmStoreBox.cs
查看文件 @
09f0b0c
...
...
@@ -60,6 +60,7 @@ namespace OnlineStore.ACSquareStore
{
cmbHumpPort
.
SelectedIndex
=
0
;
}
chbUseTrayCheck
.
Checked
=
StoreManager
.
UseShelfCheck
;
// txtTempPort.Text = store.Config.Humiture_Port;
LoadOk
=
true
;
...
...
@@ -1188,8 +1189,8 @@ namespace OnlineStore.ACSquareStore
{
DebugStatus
(
false
);
}
}
}
private
void
chbDebug_CheckedChanged
(
object
sender
,
EventArgs
e
)
{
if
(!
LoadOk
)
...
...
@@ -1223,7 +1224,7 @@ namespace OnlineStore.ACSquareStore
}
}
}
}
}
private
void
btnUpdown_Click
(
object
sender
,
EventArgs
e
)
{
string
PortName
=
store
.
Config
.
UpDown_Axis
.
DeviceName
;
...
...
@@ -1289,5 +1290,20 @@ namespace OnlineStore.ACSquareStore
BtnMove
(
btnOpenRDoor
,
"右侧门锁-打开"
,
"右侧门锁-关闭"
,
IO_Type
.
RightDoor_Close
);
}
private
void
chbUseTrayCheck_CheckedChanged
(
object
sender
,
EventArgs
e
)
{
if
(!
LoadOk
)
{
return
;
}
if
(
chbUseTrayCheck
.
Checked
.
Equals
(
StoreManager
.
UseShelfCheck
))
{
return
;
}
StoreManager
.
UseShelfCheck
=
chbUseTrayCheck
.
Checked
;
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
UseTrayCheck
,
chbUseTrayCheck
.
Checked
?
1
:
0
);
LogUtil
.
info
(
"点击:启用物料检测 = "
+
chbUseTrayCheck
.
Checked
);
}
}
}
source/ACSquareStore/记录.txt
查看文件 @
09f0b0c
...
...
@@ -31,9 +31,9 @@
新建分支ACSquareStore,做为方仓项目。
方仓三个轴:
伺服X轴 1 前原点后正限
伺服Z轴
2 下原点上正限
伺服Y轴 3 中间原点前正限后负限
伺服X轴
-前后轴
1 前原点后正限
伺服Z轴
-升降轴
2 下原点上正限
伺服Y轴
-进出轴
3 中间原点前正限后负限
三个温湿度:
温湿度1 单接com2
温湿度2 单接com3
...
...
@@ -41,3 +41,17 @@
20200320
轴名称修改:X轴-前后轴,Y轴-进出轴。
需需修改?
回原点时:前后轴和升降轴不能同时运动。先回升降轴,再回前后轴
出入库时:托架必须在后退端
出入库时:增加料架信号检测验证(可勾选)
界面修改:DO列表无内容。点动选择速度无效果。
需要增加电池?伺服回好原点之后不需要每次回原点。
20200325修改:
界面修改:DO列表无内容。点动选择速度无效果。
出入库时:托架必须在后退端
出入库时:增加料架信号检测验证(可勾选)
回原点时:前后轴和升降轴不能同时运动。先回升降轴,再回前后轴
source/Common/Setting_Init.cs
查看文件 @
09f0b0c
...
...
@@ -89,7 +89,10 @@ namespace OnlineStore.Common
public
static
string
Tool_P6_Offset
=
"Tool_P6_Offset"
;
public
static
string
Tool_TargetSpeed
=
"Tool_TargetSpeed"
;
public
static
string
Tool_TargetPosition
=
"Tool_TargetPosition"
;
public
static
string
Tool_TargetPosition
=
"Tool_TargetPosition"
;
public
static
string
UseTrayCheck
=
"UseTrayCheck"
;
}
}
source/DeviceLibrary/PanasonicServo/ACServerManager.cs
查看文件 @
09f0b0c
...
...
@@ -8,18 +8,18 @@ using System.Text;
using
System.Threading
;
namespace
OnlineStore.DeviceLibrary
{
{
/// <summary>
/// 外部调用的接口放在此文件中
/// </summary>
public
partial
class
ACServerManager
{
public
static
bool
IsShowMsg
=
false
;
public
static
bool
IsShowMsg
=
false
;
private
static
int
SleepMSendons
=
20
;
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
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
;
...
...
@@ -137,8 +137,8 @@ namespace OnlineStore.DeviceLibrary
ColsePort
(
key
);
}
}
/// <summary>
/// 是否成功打开伺服
/// </summary>
...
...
@@ -146,15 +146,15 @@ namespace OnlineStore.DeviceLibrary
{
if
(!
serialBeanMap
.
ContainsKey
(
portName
))
{
return
false
;
return
false
;
}
PreReadCoilAddr
=
ACCMDManager
.
ServerOn_Addr
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadCoil
,
PreReadCoilAddr
,
"0000"
,
1
);
//SendData(portName,dataArray);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
6
);
int
result
=
GetCoilData
(
portName
,
reviceData
,
PreReadCoilAddr
);
int
result
=
GetCoilData
(
portName
,
reviceData
,
PreReadCoilAddr
);
//TODO
return
result
>=
1
;
return
result
>=
1
;
}
/// <summary>
/// 是否原点返回完成
...
...
@@ -162,23 +162,25 @@ namespace OnlineStore.DeviceLibrary
public
static
bool
IsHomeMoveEnd
(
string
portName
,
int
slvAddr
)
{
int
status
=
GetHomeEndStatus
(
portName
,
slvAddr
);
if
(
status
>=
1
)
bool
isOk
=
ACServerManager
.
GetBusyStatus
(
portName
,
slvAddr
).
Equals
(
0
);
if
(
status
>=
1
&&
isOk
)
{
return
true
;
}
return
false
;
}
return
false
;
}
public
static
void
InitSlvAddr
(
string
portName
,
int
slvAddr
)
{
InitSlvAddr
(
portName
,
slvAddr
,
100
,
30
,
30
);
InitSlvAddr
(
portName
,
slvAddr
,
100
,
30
,
30
);
//InitSlvAddr(portName, slvAddr, 100, 30, 30, 100, 50, 30);
}
//把数字转换为四位的字符串
public
static
string
SpeedToStr
(
int
speed
,
int
length
)
public
static
string
SpeedToStr
(
int
speed
,
int
length
)
{
string
str
=
String
.
Format
(
"{0:X}"
,
speed
);
return
str
.
PadLeft
(
length
,
'0'
);
}
public
static
void
InitSlvAddr
(
string
portName
,
int
slvAddr
,
int
targetSpeed
,
int
addSpeed
,
int
delSpeed
)
public
static
void
InitSlvAddr
(
string
portName
,
int
slvAddr
,
int
targetSpeed
,
int
addSpeed
,
int
delSpeed
)
//public static void InitSlvAddr(string portName, int slvAddr,int targetSpeed,int addSpeed,int delSpeed,int homeHighSpeed,int homeLowSpeed,int homeAddSpeed)
{
LogUtil
.
info
(
"开始初始化伺服【"
+
portName
+
"】【"
+
slvAddr
+
"】"
);
...
...
@@ -187,10 +189,10 @@ namespace OnlineStore.DeviceLibrary
string
slvAddrStr
=
string
.
Format
(
strFromat
,
slvAddr
);
//block0=原点返回,正方向
string
str0
=
slvAddrStr
+
"104800 000408 00000420 00000000 ffff"
;
SendStrAndSleep
(
portName
,
str0
,
sleep
);
SendStrAndSleep
(
portName
,
str0
,
sleep
);
//block1=原点返回,反方向
string
str1
=
slvAddrStr
+
"104804 000408 04000420 00000000 ffff"
;
SendStrAndSleep
(
portName
,
str1
,
sleep
);
SendStrAndSleep
(
portName
,
str1
,
sleep
);
//block2=绝对位置运动
string
str2
=
slvAddrStr
+
"104808 000408 10000211EC78FFFF ffff"
;
SendStrAndSleep
(
portName
,
str2
,
sleep
);
...
...
@@ -233,7 +235,7 @@ namespace OnlineStore.DeviceLibrary
public
static
void
UpdateEEPROM
(
string
portName
,
int
slvAddr
)
{
string
addr
=
ACCMDManager
.
EEPROM_Param_Addr
;
string
data
=
"6173"
;
string
data
=
"6173"
;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteRegisters
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
,
5
);
...
...
@@ -259,13 +261,13 @@ namespace OnlineStore.DeviceLibrary
SendData
(
portName
,
dataArray
);
}
public
static
void
RelMove
(
string
portName
,
int
slvAddr
,
int
position
,
int
targetSpeed
)
{
public
static
void
RelMove
(
string
portName
,
int
slvAddr
,
int
position
,
int
targetSpeed
)
{
//先更新速度
string
slvAddrStr
=
string
.
Format
(
strFromat
,
slvAddr
);
string
slvAddrStr
=
string
.
Format
(
strFromat
,
slvAddr
);
string
v1
=
slvAddrStr
+
"064601 "
+
SpeedToStr
(
targetSpeed
,
4
)
+
" ffff"
;
SendStrAndSleep
(
portName
,
v1
,
SleepMSendons
);
SendStrAndSleep
(
portName
,
v1
,
SleepMSendons
);
RelMove
(
portName
,
slvAddr
,
position
);
}
public
static
void
RelMove
(
string
portName
,
int
slvAddr
,
int
position
)
...
...
@@ -307,8 +309,8 @@ namespace OnlineStore.DeviceLibrary
}
data
=
ACCMDManager
.
buildCheckData
(
data
,
data
.
Length
-
2
);
SendData
(
portName
,
data
);
System
.
Threading
.
Thread
.
Sleep
(
SleepMSendons
);
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_RelMove
);
System
.
Threading
.
Thread
.
Sleep
(
SleepMSendons
);
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_RelMove
);
OpenAndCloseSTB
(
portName
,
slvAddr
);
}
...
...
@@ -323,8 +325,8 @@ namespace OnlineStore.DeviceLibrary
int
isHomeEnd
=
GetHomeEndStatus
(
portName
,
slvAddr
);
if
(
isHomeEnd
.
Equals
(
1
))
{
int
value
=
2000
;
LogUtil
.
info
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】原点返回时发现原点已亮且回过原点,需要先相对走"
+
value
);
int
value
=
2000
;
LogUtil
.
info
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】原点返回时发现原点已亮且回过原点,需要先相对走"
+
value
);
RelMove
(
portName
,
slvAddr
,
value
);
bool
isStop
=
false
;
for
(
int
i
=
0
;
i
<=
10
;
i
++)
...
...
@@ -345,10 +347,10 @@ namespace OnlineStore.DeviceLibrary
}
else
{
int
volSpeed
=
Math
.
Abs
(
speed
/
5
);
int
volSpeed
=
Math
.
Abs
(
speed
/
5
);
int
time
=
1500
;
LogUtil
.
info
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】原点返回时发现原点已亮但未回过原点,先匀速向上走"
+
time
+
",速度["
+
volSpeed
+
"]"
);
LogUtil
.
info
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】原点返回时发现原点已亮但未回过原点,先匀速向上走"
+
time
+
",速度["
+
volSpeed
+
"]"
);
//需要匀速向上走
ACServerManager
.
SpeedMove
(
portName
,
slvAddr
,
volSpeed
);
Thread
.
Sleep
(
time
);
...
...
@@ -357,7 +359,7 @@ namespace OnlineStore.DeviceLibrary
Thread
.
Sleep
(
100
);
}
}
}
catch
(
Exception
ex
)
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】原点返回前验证是否在原点出错:"
+
ex
.
StackTrace
);
}
...
...
@@ -368,8 +370,9 @@ namespace OnlineStore.DeviceLibrary
}
public
static
void
SetSpeed
(
string
portName
,
int
slvAddr
,
int
speed
)
{
speed
=
Math
.
Abs
(
speed
);
int
preSpeed
=
GetAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
);
if
((
preSpeed
.
Equals
(-
1
))
||
(!
preSpeed
.
Equals
(
Math
.
Abs
(
speed
)
)))
if
((
preSpeed
.
Equals
(-
1
))
||
(!
preSpeed
.
Equals
(
speed
)))
{
string
v1
=
slvAddr
+
"064601 "
+
ACServerManager
.
SpeedToStr
(
speed
,
4
)
+
" ffff"
;
LogUtil
.
debug
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】更新速度为【"
+
speed
+
"】,发送数据【"
+
v1
+
"】"
);
...
...
@@ -386,20 +389,20 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】更新速度为【"
+
speed
+
"】,发送数据【"
+
v1
+
"】,第【"
+
i
+
"】次失败"
);
Thread
.
Sleep
(
SleepMSendons
);
}
}
UpdateAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
,
Math
.
Abs
(
speed
)
);
}
UpdateAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
,
speed
);
Thread
.
Sleep
(
SleepMSendons
);
}
}
public
static
void
SpeedMove
(
string
portName
,
int
slvAddr
,
int
speed
)
{
SetSpeed
(
portName
,
slvAddr
,
speed
);
SetSpeed
(
portName
,
slvAddr
,
speed
);
if
(
speed
>
0
)
{
{
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_VolMove0
);
}
else
{
{
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_VolMove1
);
}
//Thread.Sleep(SleepMSendons);
...
...
@@ -425,13 +428,13 @@ namespace OnlineStore.DeviceLibrary
//先更新速度
string
slvAddrStr
=
string
.
Format
(
strFromat
,
slvAddr
);
int
preSpeed
=
GetAddrValue
(
portName
,
slvAddr
,
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
,
slvAddr
,
ACCMDManager
.
Speed_Addr
,
targetSpeed
);
UpdateAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
,
targetSpeed
);
}
//绝对运动
AbsMove
(
portName
,
slvAddr
,
targetPosition
);
...
...
@@ -484,3 +487,4 @@ namespace OnlineStore.DeviceLibrary
}
}
}
source/DeviceLibrary/acSquareStore/Square_BoxBean.cs
查看文件 @
09f0b0c
...
...
@@ -209,7 +209,7 @@ namespace OnlineStore.DeviceLibrary
storeRunStatus
=
StoreRunStatus
.
HomeMoving
;
StoreMove
.
NewMove
(
StoreMoveType
.
ReturnHome
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H
_InOutBack
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SH_12
_InOutBack
);
ACAxisHomeMove
(
Config
.
InOut_Axis
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"开始原点返回,先把进出轴回原点"
);
...
...
@@ -217,14 +217,11 @@ namespace OnlineStore.DeviceLibrary
}
public
void
MoveToP1
()
{
//
压紧轴回原点,
叉子回到P1,关闭门前后轴和升降轴回到P1
//叉子回到P1,关闭门前后轴和升降轴回到P1
StoreMove
.
NewMove
(
StoreMoveType
.
StoreReset
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_M_H_TOP1_InOutToP1
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"到待机状态,进出轴到P1,判断叉子没有料盘"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
//ComBeforeHomeMove();
//判断叉子没有料盘
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Fixture, IO_VALUE.LOW));
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SP1_01_InOutToP1
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"到待机状态,进出轴到P1"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
}
public
override
void
Reset
(
bool
isNeedClearAuto
=
true
)
...
...
@@ -274,7 +271,7 @@ namespace OnlineStore.DeviceLibrary
LeftShlefMove
.
Stop
();
RightShelfMove
.
Stop
();
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H
_InOutBack
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SH_12
_InOutBack
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"复位中,进出轴开始原点返回"
);
ACAxisHomeMove
(
Config
.
InOut_Axis
);
StoreMove
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
...
...
@@ -299,26 +296,26 @@ namespace OnlineStore.DeviceLibrary
}
switch
(
StoreMove
.
MoveStep
)
{
case
StoreMoveStep
.
BOX_H
_LocationCylinderBack
:
case
StoreMoveStep
.
SH_10
_LocationCylinderBack
:
InoutStartReset
();
break
;
case
StoreMoveStep
.
BOX_H
_InOutMove
:
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H
_InOutBack
);
case
StoreMoveStep
.
SH_11
_InOutMove
:
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SH_12
_InOutBack
);
ACAxisHomeMove
(
Config
.
InOut_Axis
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
logName
+
" 进出轴开始原点返回"
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
logName
+
" 进出轴开始原点返回"
);
StoreMove
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
break
;
case
StoreMoveStep
.
BOX_H
_InOutBack
:
case
StoreMoveStep
.
SH_12
_InOutBack
:
Thread
.
Sleep
(
200
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H
_InOutToP1
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SH_13
_InOutToP1
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
logName
+
" 进出轴到待机点P1,关闭左右两侧门"
);
//进出轴原点返回完成,将进出轴的位置设置=0
AxisCountClear
(
Config
.
InOut_Axis
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
CloseDoor
(
1
,
StoreMove
);
CloseDoor
(
2
,
StoreMove
);
CloseDoor
(
1
,
StoreMove
);
CloseDoor
(
2
,
StoreMove
);
break
;
case
StoreMoveStep
.
BOX_H
_InOutToP1
:
case
StoreMoveStep
.
SH_13
_InOutToP1
:
//如果此时轴三还在报警,需要提示错误并等待
if
(
ACServerManager
.
GetAlarmStatus
(
Config
.
InOut_Axis
.
DeviceName
,
Config
.
InOut_Axis
.
GetAxisValue
())
>
0
)
{
...
...
@@ -326,23 +323,28 @@ namespace OnlineStore.DeviceLibrary
}
//复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
LogUtil
.
info
(
LOGGER
,
StoreName
+
logName
+
"
压紧轴,
前后轴,升降轴开始 原点返回 ,左右托盘前进"
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_OtherAxis
Back
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
logName
+
" 前后轴,升降轴开始 原点返回 ,左右托盘前进"
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SH_14_Updown
Back
);
StoreMove
.
TimeOutSeconds
=
100
;
ACAxisHomeMove
(
Config
.
Middle_Axis
);
ACAxisHomeMove
(
Config
.
UpDown_Axis
);
ShelfForward
(
1
);
ShelfForward
(
2
);
break
;
case
StoreMoveStep
.
BOX_H_OtherAxisBack
:
case
StoreMoveStep
.
SH_14_UpdownBack
:
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SH_15_MiddleBack
);
StoreMove
.
TimeOutSeconds
=
100
;
ACAxisHomeMove
(
Config
.
Middle_Axis
);
break
;
case
StoreMoveStep
.
SH_15_MiddleBack
:
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_Middle
AxisToP1
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
logName
+
" 前后轴运动到P1,升降轴走到P1,
压紧轴到P1!
"
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SH_16_Other
AxisToP1
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
logName
+
" 前后轴运动到P1,升降轴走到P1,
托架前进到位
"
);
ACAxisMove
(
Config
.
Middle_Axis
,
Config
.
MiddleAxis_P1_Position
,
Config
.
MiddleAxis_P1_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
Config
.
UpDownAxis_DoorO_P1
,
Config
.
UpDownAxis_P1_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
Config
.
UpDownAxis_DoorO_P1
,
Config
.
UpDownAxis_P1_Speed
);
ShelfForward
(
1
,
StoreMove
);
ShelfForward
(
2
,
StoreMove
);
break
;
case
StoreMoveStep
.
BOX_H_Middle
AxisToP1
:
case
StoreMoveStep
.
SH_16_Other
AxisToP1
:
LogUtil
.
info
(
LOGGER
,
StoreName
+
"复位完成"
);
storeRunStatus
=
StoreRunStatus
.
Runing
;
StoreMove
.
EndMove
();
...
...
@@ -353,21 +355,26 @@ namespace OnlineStore.DeviceLibrary
}
break
;
case
StoreMoveStep
.
BOX_M_H_TOP
1_InOutToP1
:
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_M_H_TOP1_CompressHome
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"到待机状态,
压紧轴回原点,关闭左右两侧门
"
);
case
StoreMoveStep
.
SP1_0
1_InOutToP1
:
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SP1_02_CloseDoor
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"到待机状态,
关闭左右两侧门,托架前进
"
);
CloseDoor
(
1
,
StoreMove
);
CloseDoor
(
2
,
StoreMove
);
break
;
case
StoreMoveStep
.
BOX_M_H_TOP1_CompressHome
:
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_M_H_TOP1_OtherAxisToP1
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"到待机状态:前后轴运动到P1,升降轴走到P1,压紧轴到P1,左右托架前进"
);
ACAxisMove
(
Config
.
Middle_Axis
,
Config
.
MiddleAxis_P1_Position
,
Config
.
MiddleAxis_P1_Speed
);
case
StoreMoveStep
.
SP1_02_CloseDoor
:
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SP1_03_OtherAxisToP1
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"到待机状态:升降轴走到P1,前后轴到P1"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
Config
.
UpDownAxis_DoorO_P1
,
Config
.
UpDownAxis_P1_Speed
);
ShelfForward
(
1
);
ShelfForward
(
2
);
ACAxisMove
(
Config
.
Middle_Axis
,
Config
.
MiddleAxis_P1_Position
,
Config
.
MiddleAxis_P1_Speed
);
break
;
case
StoreMoveStep
.
BOX_M_H_TOP1_OtherAxisToP1
:
case
StoreMoveStep
.
SP1_03_OtherAxisToP1
:
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SP1_04_ShelfForward
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"到待机状态:托架前进"
);
ShelfForward
(
1
,
StoreMove
);
ShelfForward
(
2
,
StoreMove
);
break
;
case
StoreMoveStep
.
SP1_04_ShelfForward
:
LogUtil
.
info
(
LOGGER
,
StoreName
+
"到待机状态完成"
);
StoreMove
.
EndMove
();
storeStatus
=
StoreStatus
.
StoreOnline
;
...
...
@@ -376,6 +383,7 @@ namespace OnlineStore.DeviceLibrary
{
WarnMsg
=
""
;
}
break
;
default
:
break
;
...
...
@@ -1441,8 +1449,8 @@ namespace OnlineStore.DeviceLibrary
{
if
(
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
IOManager
.
IOValue
(
IO_Type
.
TrayCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
{
boxStatus
.
msg
=
"
叉子料盘
检测有料,请检查"
;
lineOperation
.
msg
=
"
叉子料盘
检测有料,请检查"
;
boxStatus
.
msg
=
"
货叉物料
检测有料,请检查"
;
lineOperation
.
msg
=
"
货叉物料
检测有料,请检查"
;
}
}
CodeMsg
=
""
;
...
...
source/DeviceLibrary/acSquareStore/Square_BoxBean_Partial.cs
查看文件 @
09f0b0c
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/acSquareStore/StoreManager.cs
查看文件 @
09f0b0c
...
...
@@ -23,6 +23,8 @@ namespace OnlineStore.DeviceLibrary
public
static
Box_Config
Config
=
null
;
private
static
bool
isInit
=
false
;
public
static
bool
IsConnectServer
=
!
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
).
Equals
(
""
);
public
static
bool
UseShelfCheck
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
UseTrayCheck
).
Equals
(
1
);
public
StoreManager
()
{
}
...
...
source/DeviceLibrary/lineConnect/LineConnect.cs
deleted
100644 → 0
查看文件 @
60c1622
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary
{
public
class
LineConnect
{
private
static
int
ClientKeepSecond
=
10
;
private
static
TcpClient
client
=
null
;
public
static
List
<
string
>
WaitInStoreList
=
new
List
<
string
>();
public
static
void
StartConnect
()
{
Task
.
Factory
.
StartNew
(
delegate
{
string
lineServer
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
LineServerIp
);
int
linePort
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
LineServerPort
);
if
(
lineServer
.
Equals
(
""
))
{
LogUtil
.
error
(
"未配置流水线地址,不需要连接"
);
return
;
}
client
=
new
TcpClient
();
bool
result
=
client
.
StartConnect
(
lineServer
,
linePort
,
HandlerMsg
,
2000
);
});
}
public
static
void
StopConnect
()
{
if
(
client
!=
null
)
{
client
.
close
();
}
}
private
static
int
seq
=
1
;
public
static
int
nextSeq
()
{
if
(
seq
.
Equals
(
Int32
.
MaxValue
))
{
LogUtil
.
info
(
"seq当前值:"
+
seq
+
",重置seq=0"
);
seq
=
0
;
}
Interlocked
.
Increment
(
ref
seq
);
return
seq
;
}
public
static
void
SendHeart
(
StoreSendBean
store
)
{
if
(
client
==
null
)
{
return
;
}
try
{
store
.
Cmd
=
cmd_heart
;
string
heartMsg
=
ToParamStr
(
store
);
client
.
send
(
heartMsg
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"SendHeart 出错:"
+
ex
.
ToString
());
}
}
private
static
DateTime
LastOutStoreEndTime
=
DateTime
.
Now
;
public
static
void
OutStoreEnd
(
StoreSendBean
store
)
{
if
(
client
==
null
)
{
return
;
}
try
{
LastOutStoreEndTime
=
DateTime
.
Now
;
store
.
Cmd
=
cmd_outend
;
string
msg
=
ToParamStr
(
store
);
LogUtil
.
info
(
"OutStoreEnd:"
+
msg
);
client
.
send
(
msg
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"OutStoreEnd 出错:"
+
ex
.
ToString
());
}
}
private
static
string
ToParamStr
(
StoreSendBean
store
)
{
return
JsonHelper
.
SerializeObject
(
store
)+
"\r"
;
}
private
static
void
HandlerMsg
(
string
message
)
{
try
{
message
=
message
.
Replace
(
"\r"
,
""
);
StoreReviceBean
reviceInfo
=
JsonHelper
.
DeserializeJsonToObject
<
StoreReviceBean
>(
message
);
//string[] msgArray = message.Split(cmd_spilt);
if
(
reviceInfo
==
null
)
{
LogUtil
.
debug
(
"收到消息:"
+
message
+
",解析失败"
);
}
else
{
string
cmd
=
reviceInfo
.
Cmd
;
CanOutStore
=
reviceInfo
.
CanOutStore
.
Equals
(
1
);
LastUpdateTime
=
DateTime
.
Now
;
if
(
cmd
.
Equals
(
cmd_startIn
))
{
LogUtil
.
info
(
"收到流水线入库消息:"
+
message
);
StoreManager
.
Store
.
ReviceLineInStoreCMD
(
reviceInfo
.
PosId
,
reviceInfo
.
PlateH
,
reviceInfo
.
PlateW
,
reviceInfo
.
WareCode
);
}
else
if
(
cmd
.
Equals
(
cmd_updateDebug
))
{
int
isDebug
=
reviceInfo
.
IsDebug
;
LogUtil
.
info
(
"收到流水线更改调试状态="
+
isDebug
);
StoreManager
.
Store
.
IsDebug
=
isDebug
.
Equals
(
1
)
?
true
:
false
;
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
IsInDebug
,
isDebug
);
LogUtil
.
info
(
"切换调试状态= "
+
isDebug
+
";"
);
}
else
if
(
cmd
.
Equals
(
cmd_checStartIn
))
{
LogUtil
.
info
(
"收到流水线入库库位验证消息:"
+
message
);
//if (LineConnect.WaitInStoreList.Contains(reviceInfo.PosId))
//{
// LogUtil.error(" LineConnect.WaitInStoreList已存在库位【" + reviceInfo.PosId + "】先移除在验证");
// LineConnect.WaitInStoreList.Remove(reviceInfo.PosId);
//}
bool
result
=
StoreManager
.
Store
.
ReviceLineCheckInStoreCMD
(
reviceInfo
.
PosId
,
reviceInfo
.
PlateH
,
reviceInfo
.
PlateW
,
reviceInfo
.
WareCode
);
if
(
result
&&
(!
WaitInStoreList
.
Contains
(
reviceInfo
.
PosId
)))
{
LineConnect
.
WaitInStoreList
.
Add
(
reviceInfo
.
PosId
);
}
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"处理流水线消息【"
+
message
+
"】出错:"
+
ex
.
ToString
()
);
}
}
public
static
char
cmd_spilt
=
';'
;
public
static
string
cmd_heart
=
"heart"
;
private
static
string
cmd_outend
=
"outend"
;
private
static
string
cmd_startIn
=
"starIn"
;
private
static
string
cmd_updateDebug
=
"updateDebug"
;
private
static
bool
CanOutStore
=
false
;
public
static
DateTime
LastUpdateTime
=
new
DateTime
(
0
);
public
static
string
cmd_checStartIn
=
"cmd_checStartIn"
;
public
static
bool
IsConnect
()
{
if
(
client
==
null
)
{
return
false
;
}
if
(
client
.
IsRun
()&&
client
.
IsConnected
())
{
return
true
;
}
return
false
;
}
public
static
bool
CanStartOut
()
{
TimeSpan
span
=
DateTime
.
Now
-
LastUpdateTime
;
if
(
span
.
TotalSeconds
<
ClientKeepSecond
&&
CanOutStore
)
{
return
true
;
}
return
false
;
}
/// <summary>
/// 是否可以重发消息
/// </summary>
/// <returns></returns>
public
static
bool
CanReSend
()
{
TimeSpan
span
=
DateTime
.
Now
-
LastOutStoreEndTime
;
if
(
span
.
TotalSeconds
>
8
)
{
return
true
;
}
return
false
;
}
}
public
class
StoreReviceBean
{
public
string
Cmd
=
""
;
public
int
CanOutStore
=
0
;
public
string
PosId
=
""
;
public
string
PlateH
=
"0"
;
public
string
PlateW
=
"0"
;
public
string
WareCode
=
""
;
public
int
IsDebug
=
0
;
}
public
class
StoreSendBean
{
public
StoreSendBean
(
int
id
,
string
cid
,
int
ss
,
int
runs
,
int
doorHasTray
,
int
alarmType
)
{
this
.
StoreId
=
id
;
this
.
Cid
=
cid
;
this
.
SStatus
=
ss
;
this
.
SRunStatus
=
runs
;
this
.
DoorHasTray
=
doorHasTray
;
this
.
AlarmType
=
alarmType
;
this
.
Seq
=
LineConnect
.
nextSeq
();
this
.
WaitInStoreList
=
new
List
<
string
>(
LineConnect
.
WaitInStoreList
);
this
.
data
=
new
Dictionary
<
string
,
string
>();
// WaitInStoreList.Add("1#AC1_1_1");
}
public
string
Cmd
=
LineConnect
.
cmd_heart
;
public
int
StoreId
=
0
;
public
string
Cid
=
""
;
public
int
Seq
=
0
;
public
int
SStatus
=
0
;
public
int
SRunStatus
=
0
;
public
int
DoorHasTray
=
0
;
public
int
AlarmType
=
0
;
public
List
<
string
>
WaitInStoreList
=
new
List
<
string
>();
public
Dictionary
<
string
,
string
>
data
=
new
Dictionary
<
string
,
string
>();
//public string PosId = "";
//public string PlateH = "0";
//public string PlateW = "0";
///// <summary>
///// urgentReel: true 表示紧急料,需要出到料串上
///// </summary>
//public bool urgentReel = false;
///// <summary>
///// cutReel: true 表示分盘料,需要出到料串上
///// </summary>
//public bool cutReel = false;
///// <summary>
///// smallReel: true 小料(7x8),放置到小料架上
///// </summary>
//public bool smallReel = false;
///// <summary>
///// rfid: 分配的料架RFID
///// </summary>
//public string rfid = "";
///// <summary>
///// rfidLoc: 料架的架位,值为 - 1时,可以自由分配皮带线,
///// 小料时,架位为1 - 46优先走1 / 2号皮带线,47 - 92优先走3 / 4号皮带线,
///// 70,71,72时只能分配到3 / 4号皮带线;
///// 大料时,架位1 - 6优先走1 / 2号皮带线, 7 - 12优先走3/ 4号皮带线
///// </summary>
//public int rfidLoc = 0;
}
}
source/DeviceLibrary/store/StoreStep.cs
查看文件 @
09f0b0c
此文件的差异被折叠,
点击展开。
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论