Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC30-AutoInOutStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit eb2722ae
由
LN
编写于
2019-09-12 13:28:24 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加升降轴对位置功能
1 个父辈
ace18d91
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
62 行增加
和
30 行删除
source/ACSingleStore/FrmStoreBox.Designer.cs
source/ACSingleStore/FrmStoreBox.cs
source/ACSingleStore/positionTool/FrmPositionTool.Designer.cs
source/ACSingleStore/positionTool/FrmPositionTool.cs
source/ACSingleStore/FrmStoreBox.Designer.cs
查看文件 @
eb2722a
...
...
@@ -2604,7 +2604,6 @@
this
.
升降轴位置调试
ToolStripMenuItem
.
Name
=
"升降轴位置调试ToolStripMenuItem"
;
this
.
升降轴位置调试
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
192
,
26
);
this
.
升降轴位置调试
ToolStripMenuItem
.
Text
=
"升降轴位置调试"
;
this
.
升降轴位置调试
ToolStripMenuItem
.
Visible
=
false
;
this
.
升降轴位置调试
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
升降轴位置调试
ToolStripMenuItem_Click
);
//
// toolStripSeparator11
...
...
source/ACSingleStore/FrmStoreBox.cs
查看文件 @
eb2722a
...
...
@@ -1799,8 +1799,8 @@ namespace OnlineStore.AutoInOutStore
int
ioIndex
=
0
;
if
(
store
.
Config
.
StoreDIList
.
ContainsKey
(
IO_Type
.
UpdownPositionSingal
))
{
ioIP
=
store
.
Config
.
StoreDIList
[
IO_Type
.
UpdownPositionSingal
].
DeviceName
;
ioIndex
=
store
.
Config
.
StoreDIList
[
IO_Type
.
UpdownPositionSingal
].
GetIOAddr
();
ioIP
=
store
.
Config
.
StoreDIList
[
IO_Type
.
TrayCheck_Fixture
].
DeviceName
;
ioIndex
=
store
.
Config
.
StoreDIList
[
IO_Type
.
TrayCheck_Fixture
].
GetIOAddr
();
}
FrmPositionTool
frm
=
new
FrmPositionTool
(
PortName
,
slvAddr
,
ioIP
,
ioIndex
);
frm
.
ShowDialog
();
...
...
source/ACSingleStore/positionTool/FrmPositionTool.Designer.cs
查看文件 @
eb2722a
此文件的差异被折叠,
点击展开。
source/ACSingleStore/positionTool/FrmPositionTool.cs
查看文件 @
eb2722a
...
...
@@ -47,7 +47,7 @@ namespace OnlineStore.AutoInOutStore
ACServerManager
.
IsShowMsg
=
false
;
LogUtil
.
logBox
=
this
.
richTextBox1
;
//ACServerManager.richeBox = this.richTextBox1;
formStatus
(
false
);
CheckForIllegalCrossThreadCalls
=
false
;
txtPortName
.
Text
=
PortName
;
txtAddr
.
Text
=
SlvAddr
.
ToString
();
...
...
@@ -57,12 +57,26 @@ namespace OnlineStore.AutoInOutStore
if
(
IOManager
.
instance
==
null
)
{
IOManager
.
Init
();
IOManager
.
instance
.
ConnectionIOList
(
new
List
<
string
>
{
IoIp
});
IOManager
.
instance
.
ConnectionIOList
(
new
List
<
string
>
{
/*IoIp*/
});
}
//判断伺服是否已经打开
bool
isOn
=
ACServerManager
.
ServerOnStatus
(
PortName
,
SlvAddr
);
formStatus
(
isOn
);
timer1
.
Start
();
ioStatusControl1
.
IOName
=
"检测信号"
;
}
private
void
btnServoOn_Click
(
object
sender
,
EventArgs
e
)
{
//PositionList.Add(32000);
//PositionList.Add(38000);
//PositionList.Add(44000);
//PositionList.Add(50000);
//PositionList.Add(56000);
//P3Offset = FormUtil.GetIntValue(txtP3Offset);
//P4Offset = FormUtil.GetIntValue(txtP4Offset);
//P5Offset = FormUtil.GetIntValue(txtP5Offset);
//P6Offset = FormUtil.GetIntValue(txtP6Offset);
//StopTimer();
this
.
PortName
=
txtPortName
.
Text
;
this
.
SlvAddr
=
FormUtil
.
GetIntValue
(
txtAddr
);
bool
result
=
ACServerManager
.
OpenPort
(
PortName
);
...
...
@@ -85,12 +99,13 @@ namespace OnlineStore.AutoInOutStore
{
}
}
private
void
btnServoOff_Click
(
object
sender
,
EventArgs
e
)
{
StopTimer
();
// toolTimer.Stop();
// toolTimer.Stop();
ACServerManager
.
SuddenStop
(
PortName
,
SlvAddr
);
Thread
.
Sleep
(
100
);
try
...
...
@@ -102,9 +117,7 @@ namespace OnlineStore.AutoInOutStore
}
ACServerManager
.
ServoOff
(
PortName
,
SlvAddr
);
formStatus
(
false
);
formStatus
(
false
);
}
private
void
formStatus
(
bool
p
)
...
...
@@ -163,9 +176,13 @@ namespace OnlineStore.AutoInOutStore
txtSpeed
.
Focus
();
return
;
}
P3Offset
=
FormUtil
.
GetIntValue
(
txtP3Offset
);
P4Offset
=
FormUtil
.
GetIntValue
(
txtP4Offset
);
P5Offset
=
FormUtil
.
GetIntValue
(
txtP5Offset
);
P6Offset
=
FormUtil
.
GetIntValue
(
txtP6Offset
);
LastValue
=
IO_VALUE
.
LOW
;
string
fileName
=
txtFileName
.
Text
;
string
filePath
=
Application
.
StartupPath
+
@"
\"
+
fileName
;
string
filePath
=
Application
.
StartupPath
+
@"\logs
\"
+
fileName
;
if
(
File
.
Exists
(
filePath
))
{
DialogResult
result
=
MessageBox
.
Show
(
"文件【"
+
filePath
+
"】已存在,是否确定覆盖?"
,
""
,
MessageBoxButtons
.
OKCancel
,
MessageBoxIcon
.
Question
);
...
...
@@ -176,10 +193,25 @@ namespace OnlineStore.AutoInOutStore
}
PositionList
=
new
List
<
int
>();
LogUtil
.
info
(
LogName
+
"伺服开始运动,速度【"
+
speed
+
"】位置【"
+
position
+
"】启动定时器 "
);
formMoveStatus
(
false
);
ACServerManager
.
AbsMove
(
PortName
,
SlvAddr
,
position
,
speed
);
toolTimer
.
Start
();
}
}
private
int
P3Offset
=
0
;
private
int
P4Offset
=
0
;
private
int
P5Offset
=
0
;
private
int
P6Offset
=
0
;
private
void
formMoveStatus
(
bool
status
)
{
txtFileName
.
Enabled
=
status
;
txtP5Offset
.
Enabled
=
status
;
txtP3Offset
.
Enabled
=
status
;
txtP4Offset
.
Enabled
=
status
;
txtP6Offset
.
Enabled
=
status
;
txtSpeed
.
Enabled
=
status
;
txtPosition
.
Enabled
=
status
;
}
private
void
btnSdStop_Click
(
object
sender
,
EventArgs
e
)
{
toolTimer
.
Stop
();
...
...
@@ -189,10 +221,7 @@ namespace OnlineStore.AutoInOutStore
private
IO_VALUE
GetSingleValue
()
{
return
IOManager
.
instance
.
GetDIValue
(
IoIp
,
0
,
(
ushort
)
IoIndex
);
}
}
private
int
TargetPostion
=
0
;
private
bool
isInProcesss
=
false
;
private
DateTime
LastTime
=
DateTime
.
Now
;
...
...
@@ -243,26 +272,33 @@ namespace OnlineStore.AutoInOutStore
private
void
StopTimer
()
{
toolTimer
.
Stop
();
toolTimer
.
Stop
();
if
(
PositionList
.
Count
<=
0
)
{
return
;
}
LogUtil
.
info
(
LogName
+
"伺服已停止运动,停止定时器,记录数据"
);
string
resultstr
=
""
;
List
<
string
>
strList
=
new
List
<
string
>();
strList
.
Add
(
"编号,标准位置,升降轴库位出料前点P5,升降轴库位出料缓冲点P6,升降轴库位入料前点P3,升降轴库位入料缓冲点P4"
);
int
index
=
1
;
foreach
(
int
p
in
PositionList
)
{
resultstr
+=
index
+
","
+
p
+
"\r\n"
;
int
P3
=
p
+
P3Offset
;
int
P4
=
p
+
P4Offset
;
int
P5
=
p
+
P5Offset
;
int
P6
=
p
+
P6Offset
;
string
resultstr
=
index
+
","
+
p
+
","
+
P5
+
","
+
P6
+
","
+
P3
+
","
+
P4
+
""
;
strList
.
Add
(
resultstr
);
index
++;
}
string
fileName
=
txtFileName
.
Text
;
string
filePath
=
Application
.
StartupPath
+
@"\"
+
fileName
;
string
filePath
=
Application
.
StartupPath
+
@"\
logs\
"
+
fileName
;
try
{
// Clipboard.SetDataObject(resultstr);
File
.
WriteAll
Text
(
filePath
,
resultstr
);
File
.
WriteAll
Lines
(
filePath
,
strList
.
ToArray
()
);
LogUtil
.
error
(
LogName
+
"保存位置到文件【"
+
filePath
+
"】成功"
);
}
...
...
@@ -270,20 +306,18 @@ namespace OnlineStore.AutoInOutStore
{
LogUtil
.
error
(
LogName
+
"保存位置到文件【"
+
filePath
+
"】出错:"
+
ex
.
ToString
());
}
formMoveStatus
(
true
);
}
private
void
timer1_Tick
(
object
sender
,
EventArgs
e
)
{
{
try
{
ioStatusControl1
.
IOValue
=
(
int
)
GetSingleValue
();
ioStatusControl1
.
ShowData
();
}
catch
(
Exception
ex
)
{
}
{
}
}
private
void
FrmPositionTool_FormClosing
(
object
sender
,
FormClosingEventArgs
e
)
...
...
@@ -294,13 +328,12 @@ namespace OnlineStore.AutoInOutStore
btnServoOff_Click
(
null
,
null
);
}
//ACServerManager.CloseAllPort();
IOManager
.
instance
.
CloseAllConnection
();
IOManager
.
instance
.
CloseAllConnection
();
}
private
void
btnOpenFolder_Click
(
object
sender
,
EventArgs
e
)
{
System
.
Diagnostics
.
Process
.
Start
(
"Explorer.exe"
,
Application
.
StartupPath
);
System
.
Diagnostics
.
Process
.
Start
(
"Explorer.exe"
,
Application
.
StartupPath
+
@"\logs\"
);
}
private
void
btnExit_Click
(
object
sender
,
EventArgs
e
)
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论