Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 7070aeee
由
LN
编写于
2019-11-19 17:25:20 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
位置调试增加参数保存功能
1 个父辈
f5217b5d
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
174 行增加
和
25 行删除
ProCopyClient/FrmMain.Designer.cs
ProCopyClient/FrmMain.cs
source/ACSingleStore/positionTool/FrmPositionTool.cs
source/Common/Setting_Init.cs
ProCopyClient/FrmMain.Designer.cs
查看文件 @
7070aee
...
...
@@ -29,34 +29,89 @@
private
void
InitializeComponent
()
{
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button2
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
label1
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
txtProName
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
button3
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
SuspendLayout
();
//
// button1
//
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
141
,
72
);
this
.
button1
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
100
,
187
);
this
.
button1
.
Name
=
"button1"
;
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
172
,
69
);
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
217
,
55
);
this
.
button1
.
TabIndex
=
0
;
this
.
button1
.
Text
=
"更新文件复制"
;
this
.
button1
.
Text
=
"
L-R-程序
更新文件复制"
;
this
.
button1
.
UseVisualStyleBackColor
=
true
;
this
.
button1
.
Click
+=
new
System
.
EventHandler
(
this
.
button1_Click
);
//
// button2
//
this
.
button2
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
button2
.
Location
=
new
System
.
Drawing
.
Point
(
100
,
112
);
this
.
button2
.
Name
=
"button2"
;
this
.
button2
.
Size
=
new
System
.
Drawing
.
Size
(
217
,
55
);
this
.
button2
.
TabIndex
=
1
;
this
.
button2
.
Text
=
"单个程序 更新文件复制"
;
this
.
button2
.
UseVisualStyleBackColor
=
true
;
this
.
button2
.
Click
+=
new
System
.
EventHandler
(
this
.
button2_Click
);
//
// label1
//
this
.
label1
.
AutoSize
=
true
;
this
.
label1
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
58
,
40
);
this
.
label1
.
Name
=
"label1"
;
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
79
,
20
);
this
.
label1
.
TabIndex
=
2
;
this
.
label1
.
Text
=
"程序名称:"
;
//
// txtProName
//
this
.
txtProName
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
txtProName
.
Location
=
new
System
.
Drawing
.
Point
(
143
,
37
);
this
.
txtProName
.
Name
=
"txtProName"
;
this
.
txtProName
.
Size
=
new
System
.
Drawing
.
Size
(
192
,
26
);
this
.
txtProName
.
TabIndex
=
3
;
this
.
txtProName
.
Text
=
"ACSingleStore"
;
//
// button3
//
this
.
button3
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
button3
.
Location
=
new
System
.
Drawing
.
Point
(
389
,
187
);
this
.
button3
.
Name
=
"button3"
;
this
.
button3
.
Size
=
new
System
.
Drawing
.
Size
(
93
,
55
);
this
.
button3
.
TabIndex
=
4
;
this
.
button3
.
Text
=
"退出"
;
this
.
button3
.
UseVisualStyleBackColor
=
true
;
this
.
button3
.
Click
+=
new
System
.
EventHandler
(
this
.
button3_Click
);
//
// FrmMain
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
463
,
215
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
494
,
283
);
this
.
Controls
.
Add
(
this
.
button3
);
this
.
Controls
.
Add
(
this
.
txtProName
);
this
.
Controls
.
Add
(
this
.
label1
);
this
.
Controls
.
Add
(
this
.
button2
);
this
.
Controls
.
Add
(
this
.
button1
);
this
.
Name
=
"FrmMain"
;
this
.
StartPosition
=
System
.
Windows
.
Forms
.
FormStartPosition
.
CenterScreen
;
this
.
Text
=
"客户端复制"
;
this
.
ResumeLayout
(
false
);
this
.
PerformLayout
();
}
#
endregion
private
System
.
Windows
.
Forms
.
Button
button1
;
private
System
.
Windows
.
Forms
.
Button
button2
;
private
System
.
Windows
.
Forms
.
Label
label1
;
private
System
.
Windows
.
Forms
.
TextBox
txtProName
;
private
System
.
Windows
.
Forms
.
Button
button3
;
}
}
ProCopyClient/FrmMain.cs
查看文件 @
7070aee
...
...
@@ -28,9 +28,10 @@ namespace ProCopyClient
MessageBox
.
Show
(
"未找到Debug文件夹"
);
return
;
}
string
proName
=
txtProName
.
Text
.
Trim
();
string
date
=
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
);
string
leftPath
=
Application
.
StartupPath
+
"\\"
+
date
+
"-
ACSingleStore
L-更新"
+
"\\"
;
string
rightPath
=
Application
.
StartupPath
+
"\\"
+
date
+
"-
ACSingleStore
R-更新"
+
"\\"
;
string
leftPath
=
Application
.
StartupPath
+
"\\"
+
date
+
"-
"
+
proName
+
"
L-更新"
+
"\\"
;
string
rightPath
=
Application
.
StartupPath
+
"\\"
+
date
+
"-
"
+
proName
+
"
R-更新"
+
"\\"
;
if
(
Directory
.
Exists
(
leftPath
))
{
...
...
@@ -76,5 +77,61 @@ namespace ProCopyClient
MessageBox
.
Show
(
ex
.
ToString
());
}
}
private
void
button2_Click
(
object
sender
,
EventArgs
e
)
{
try
{
string
path
=
Application
.
StartupPath
+
"/Debug/"
;
if
(
Directory
.
Exists
(
path
).
Equals
(
false
))
{
MessageBox
.
Show
(
"未找到Debug文件夹"
);
return
;
}
string
proName
=
txtProName
.
Text
.
Trim
();
string
date
=
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
);
string
leftPath
=
Application
.
StartupPath
+
"\\"
+
date
+
"-"
+
proName
+
"-更新"
+
"\\"
;
if
(
Directory
.
Exists
(
leftPath
))
{
Directory
.
Delete
(
leftPath
,
true
);
}
Directory
.
CreateDirectory
(
leftPath
);
//将此目录的更新文件,复制到上一层的文件夹中
string
[]
fileList
=
Directory
.
GetFiles
(
path
);
foreach
(
string
file
in
fileList
)
{
FileInfo
fileInfo
=
new
FileInfo
(
file
);
TimeSpan
span
=
DateTime
.
Now
-
fileInfo
.
LastWriteTime
;
string
exName
=
Path
.
GetExtension
(
file
);
string
fileName
=
Path
.
GetFileName
(
file
);
if
(
span
.
TotalDays
<
1
)
{
if
(
exName
.
ToLower
().
Equals
(
".dll"
))
{
File
.
Copy
(
file
,
leftPath
+
fileName
);
}
else
if
(
exName
.
ToLower
().
Equals
(
".exe"
))
{
string
f
=
Path
.
GetFileNameWithoutExtension
(
file
);
File
.
Copy
(
file
,
leftPath
+
f
+
""
+
exName
);
}
}
}
MessageBox
.
Show
(
"更新文件复制完成"
);
}
catch
(
Exception
ex
)
{
MessageBox
.
Show
(
ex
.
ToString
());
}
}
private
void
button3_Click
(
object
sender
,
EventArgs
e
)
{
this
.
Close
();
}
}
}
source/ACSingleStore/positionTool/FrmPositionTool.cs
查看文件 @
7070aee
...
...
@@ -61,6 +61,30 @@ namespace OnlineStore.ACSingleStore
IOManager
.
Init
();
IOManager
.
instance
.
ConnectionIOList
(
new
List
<
string
>
{
/*IoIp*/
});
}
P3Offset
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
Tool_P3_Offset
);
P4Offset
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
Tool_P4_Offset
);
P5Offset
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
Tool_P5_Offset
);
P6Offset
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
Tool_P6_Offset
);
int
tSpeed
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
Tool_TargetSpeed
);
int
tPosition
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
Tool_TargetPosition
);
if
(
P3Offset
.
Equals
(
0
))
P3Offset
=
6000
;
if
(
P4Offset
.
Equals
(
0
))
P4Offset
=
-
6000
;
if
(
P5Offset
.
Equals
(
0
))
P5Offset
=
-
6000
;
if
(
P6Offset
.
Equals
(
0
))
P6Offset
=
6000
;
if
(
tSpeed
.
Equals
(
0
))
tSpeed
=
20
;
if
(
tPosition
.
Equals
(
0
))
tPosition
=
6000
;
txtP3Offset
.
Text
=
P3Offset
.
ToString
();
txtP4Offset
.
Text
=
P4Offset
.
ToString
();
txtP5Offset
.
Text
=
P5Offset
.
ToString
();
txtP6Offset
.
Text
=
P6Offset
.
ToString
();
txtSpeed
.
Text
=
tSpeed
.
ToString
();
txtPosition
.
Text
=
tPosition
.
ToString
();
SaveConfig
(
tSpeed
,
tPosition
);
//判断伺服是否已经打开
bool
isOn
=
ACServerManager
.
ServerOnStatus
(
PortName
,
SlvAddr
);
formStatus
(
isOn
);
...
...
@@ -68,17 +92,7 @@ namespace OnlineStore.ACSingleStore
ioStatusControl1
.
IOName
=
ResourceCulture
.
GetString
(
"检测信号"
);
}
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
);
...
...
@@ -165,14 +179,23 @@ namespace OnlineStore.ACSingleStore
value
=
ACServerManager
.
GetActualtPosition
(
PortName
,
SlvAddr
);
txtActualPosition
.
Text
=
value
.
ToString
();
}
private
void
SaveConfig
(
int
speed
,
int
position
)
{
//保存配置
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
Tool_P3_Offset
,
P3Offset
);
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
Tool_P4_Offset
,
P4Offset
);
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
Tool_P5_Offset
,
P5Offset
);
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
Tool_P6_Offset
,
P6Offset
);
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
Tool_TargetSpeed
,
speed
);
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
Tool_TargetPosition
,
position
);
}
private
void
btnAbsMove_Click
(
object
sender
,
EventArgs
e
)
{
int
speed
=
Convert
.
ToInt32
(
txtSpeed
.
Text
);
int
position
=
Convert
.
ToInt32
(
txtPosition
.
Text
.
Trim
(),
10
);
TargetPostion
=
position
;
if
(
speed
<=
(
0
))
if
(
speed
<=
(
0
))
{
MessageBox
.
Show
(
ResourceCulture
.
GetString
(
"请输入正确的速度"
));
txtSpeed
.
Focus
();
...
...
@@ -182,22 +205,25 @@ namespace OnlineStore.ACSingleStore
P4Offset
=
FormUtil
.
GetIntValue
(
txtP4Offset
);
P5Offset
=
FormUtil
.
GetIntValue
(
txtP5Offset
);
P6Offset
=
FormUtil
.
GetIntValue
(
txtP6Offset
);
SaveConfig
(
speed
,
position
);
LastValue
=
IO_VALUE
.
LOW
;
string
fileName
=
txtFileName
.
Text
;
string
filePath
=
Application
.
StartupPath
+
@"\logs\"
+
fileName
;
string
filePath
=
Application
.
StartupPath
+
@"\logs\"
+
fileName
;
if
(
File
.
Exists
(
filePath
))
{
string
msg
=
"文件【"
+
fileName
+
"】已存在,是否确定覆盖?"
;
DialogResult
result
=
MessageBox
.
Show
(
msg
,
""
,
MessageBoxButtons
.
OKCancel
,
MessageBoxIcon
.
Question
);
string
msg
=
"文件【"
+
fileName
+
"】已存在,是否确定覆盖?"
;
DialogResult
result
=
MessageBox
.
Show
(
msg
,
""
,
MessageBoxButtons
.
OKCancel
,
MessageBoxIcon
.
Question
);
if
(!
result
.
Equals
(
DialogResult
.
OK
))
{
return
;
}
}
PositionList
=
new
List
<
int
>();
LogUtil
.
info
(
LogName
+
"伺服开始运动,速度【"
+
speed
+
"】位置【"
+
position
+
"】启动定时器 "
);
PositionList
=
new
List
<
int
>();
LogUtil
.
info
(
LogName
+
"伺服开始运动,速度【"
+
speed
+
"】位置【"
+
position
+
"】启动定时器 "
);
formMoveStatus
(
false
);
ACServerManager
.
AbsMove
(
PortName
,
SlvAddr
,
position
,
speed
);
ACServerManager
.
AbsMove
(
PortName
,
SlvAddr
,
position
,
speed
);
toolTimer
.
Start
();
}
private
int
P3Offset
=
0
;
...
...
source/Common/Setting_Init.cs
查看文件 @
7070aee
...
...
@@ -90,5 +90,16 @@ namespace OnlineStore.Common
public
static
string
IsInDebug
=
"IsInDebug"
;
public
static
string
ACBaudRate
=
"ACBaudRate"
;
public
static
string
Tool_P3_Offset
=
"Tool_P3_Offset"
;
public
static
string
Tool_P4_Offset
=
"Tool_P4_Offset"
;
public
static
string
Tool_P5_Offset
=
"Tool_P5_Offset"
;
public
static
string
Tool_P6_Offset
=
"Tool_P6_Offset"
;
public
static
string
Tool_TargetSpeed
=
"Tool_TargetSpeed"
;
public
static
string
Tool_TargetPosition
=
"Tool_TargetPosition"
;
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论