Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
AutoCountMachine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit fa81c6e7
由
刘韬
编写于
2020-12-01 10:18:38 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
出料防撞检测,平板出错检测
1 个父辈
dbedd0e8
显示空白字符变更
内嵌
并排
正在显示
21 个修改的文件
包含
461 行增加
和
260 行删除
RC1266-AutoCountMachine/source/AutoCountClient/App.config
RC1266-AutoCountMachine/source/AutoCountClient/AutoCountClient.csproj
RC1266-AutoCountMachine/source/AutoCountClient/FrmComponentList.cs
RC1266-AutoCountMachine/source/AutoCountClient/FrmLearning.Designer.cs
RC1266-AutoCountMachine/source/AutoCountClient/FrmLearning.cs
RC1266-AutoCountMachine/source/AutoCountClient/FrmRobotMain.Designer.cs
RC1266-AutoCountMachine/source/AutoCountClient/FrmRobotMain.cs
RC1266-AutoCountMachine/source/AutoCountClient/FrmXRay.cs
RC1266-AutoCountMachine/source/CodeLibrary/camera/HIK.cs
RC1266-AutoCountMachine/source/DeviceLibrary/DeviceLibrary.csproj
RC1266-AutoCountMachine/source/DeviceLibrary/bean/BatchMoveBean.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/BatchMoveBean_Partial.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/InputEquip.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/InputEquip_InStore.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/OutputEquip_Partial.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/OutputEquip_Shelf.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/RobotBean.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip_Partial.cs
RC1266-AutoCountMachine/source/DeviceLibrary/manager/ParamManager.cs
RC1266-AutoCountMachine/source/DeviceLibrary/model/AxisBean.cs
RC1266-AutoCountMachine/source/AutoCountClient/App.config
查看文件 @
fa81c6e
...
...
@@ -14,13 +14,13 @@
<
add
key
=
"ConfigPath_XRay"
value
=
"\RobotConfig\Config_XRay.csv"
/>
<
add
key
=
"ConfigPath_InputEquip"
value
=
"\RobotConfig\Config_InputEquip.csv"
/>
<
add
key
=
"ConfigPath_OutputEquip"
value
=
"\RobotConfig\Config_OutputEquip.csv"
/>
<
add
key
=
"CounParamConfig"
value
=
"\XRAY\countParam.csv"
/>
<!--二维码类型列表配置,用
#分割,一维码=Barcode 二维码: QR Code#Data Matrix ECC 200#Micro QR Code-->
<
add
key
=
"CodeType"
value
=
"Data Matrix ECC 200#QR Code"
/>
<!--<
add
key
=
"CodeType"
value
=
"Data Matrix ECC 200"
/>-->
<
add
key
=
"ACBaudRate"
value
=
"115200"
/>
<!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<
add
key
=
"CodeParamPath"
value
=
"\CodeParam\"
/>
<
add
key
=
"CodeParamPath"
value
=
"\CodeParam\
\XRAY\countParam.csv
"
/>
<
add
key
=
"Config_Pwd"
value
=
"123456"
/>
<
add
key
=
"UseAIOBOX"
value
=
"1"
/>
...
...
RC1266-AutoCountMachine/source/AutoCountClient/AutoCountClient.csproj
查看文件 @
fa81c6e
...
...
@@ -61,10 +61,6 @@
<Reference Include="AccImageBox">
<HintPath>..\..\dll\AccImageBox.dll</HintPath>
</Reference>
<Reference Include="Asa.CarerayImage, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\X-Ray\Asa.CarerayImage.dll</HintPath>
</Reference>
<Reference Include="Asa.PrintLabel">
<HintPath>..\..\dll\label\Asa.PrintLabel.dll</HintPath>
</Reference>
...
...
RC1266-AutoCountMachine/source/AutoCountClient/FrmComponentList.cs
查看文件 @
fa81c6e
...
...
@@ -12,6 +12,7 @@ using System.IO;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.Common
;
using
OnlineStore.DeviceLibrary
;
using
static
OnlineStore
.
DeviceLibrary
.
CountParam
;
namespace
OnlineStore.AutoCountClient
{
...
...
@@ -96,7 +97,9 @@ namespace OnlineStore.AutoCountClient
if
(
obj
.
Sufan
>=
0
)
{
ParamManager
.
UpdateParam
(
new
CountParam
(
obj
.
PartNum
,
RobotManager
.
robot
.
XrayBean
.
ThresholdValue
,
3
,
obj
.
Sufan
));
var
suanfa
=
SignType
.
AUTO
;
Enum
.
TryParse
<
SignType
>(
obj
.
Sufan
.
ToString
(),
out
suanfa
);
ParamManager
.
UpdateParam
(
new
CountParam
(
obj
.
PartNum
,
RobotManager
.
robot
.
XrayBean
.
ThresholdValue
,
3
,
suanfa
));
ParamManager
.
SaveMapToFile
();
}
}
...
...
@@ -134,7 +137,9 @@ namespace OnlineStore.AutoCountClient
groupInfo
.
Text
=
"元器件【"
+
obj
.
PartNum
+
"】的基本信息"
;
if
(
obj
.
Sufan
>=
0
)
{
ParamManager
.
UpdateParam
(
new
CountParam
(
obj
.
PartNum
,
RobotManager
.
robot
.
XrayBean
.
ThresholdValue
,
3
,
obj
.
Sufan
));
var
suanfa
=
SignType
.
AUTO
;
Enum
.
TryParse
<
SignType
>(
obj
.
Sufan
.
ToString
(),
out
suanfa
);
ParamManager
.
UpdateParam
(
new
CountParam
(
obj
.
PartNum
,
RobotManager
.
robot
.
XrayBean
.
ThresholdValue
,
3
,
suanfa
));
ParamManager
.
SaveMapToFile
();
}
}
...
...
@@ -387,7 +392,7 @@ namespace OnlineStore.AutoCountClient
CountParam
param
=
ParamManager
.
GetParamByPN
(
com
.
PartNum
);
if
(
param
!=
null
)
{
com
.
Sufan
=
param
.
Sign
;
com
.
Sufan
=
(
int
)
param
.
Sign
;
}
else
{
...
...
RC1266-AutoCountMachine/source/AutoCountClient/FrmLearning.Designer.cs
查看文件 @
fa81c6e
...
...
@@ -35,7 +35,6 @@
this
.
lblCountInfo
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
imgCurrImg
=
new
Acc
.
ImageBox
.
ImageBox
();
this
.
lblPnInfo
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
btnTest
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnNext
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
numWSize
=
new
System
.
Windows
.
Forms
.
NumericUpDown
();
this
.
label3
=
new
System
.
Windows
.
Forms
.
Label
();
...
...
@@ -48,12 +47,14 @@
this
.
buttonD
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
buttonC
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
buttonB
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
buttonAuto
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
buttonA
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
groupBox2
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
lblPN
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblFeng
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblDes
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblProName
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label_coutresult
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
groupBox1
.
SuspendLayout
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
numWSize
)).
BeginInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
numTh
)).
BeginInit
();
...
...
@@ -136,19 +137,6 @@
this
.
lblPnInfo
.
Text
=
"料盘PN:"
;
this
.
lblPnInfo
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
//
// btnTest
//
this
.
btnTest
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
btnTest
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btnTest
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnTest
.
Location
=
new
System
.
Drawing
.
Point
(
31
,
337
);
this
.
btnTest
.
Name
=
"btnTest"
;
this
.
btnTest
.
Size
=
new
System
.
Drawing
.
Size
(
235
,
46
);
this
.
btnTest
.
TabIndex
=
285
;
this
.
btnTest
.
Text
=
"点料测试"
;
this
.
btnTest
.
UseVisualStyleBackColor
=
false
;
this
.
btnTest
.
Click
+=
new
System
.
EventHandler
(
this
.
btnTest_Click
);
//
// btnNext
//
this
.
btnNext
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
...
...
@@ -166,7 +154,7 @@
// numWSize
//
this
.
numWSize
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
numWSize
.
Location
=
new
System
.
Drawing
.
Point
(
2
46
,
4
7
);
this
.
numWSize
.
Location
=
new
System
.
Drawing
.
Point
(
2
71
,
5
7
);
this
.
numWSize
.
Maximum
=
new
decimal
(
new
int
[]
{
1000
,
0
,
...
...
@@ -185,7 +173,7 @@
// label3
//
this
.
label3
.
AutoSize
=
true
;
this
.
label3
.
Location
=
new
System
.
Drawing
.
Point
(
194
,
5
0
);
this
.
label3
.
Location
=
new
System
.
Drawing
.
Point
(
219
,
6
0
);
this
.
label3
.
Name
=
"label3"
;
this
.
label3
.
Size
=
new
System
.
Drawing
.
Size
(
68
,
20
);
this
.
label3
.
TabIndex
=
296
;
...
...
@@ -195,7 +183,7 @@
// numTh
//
this
.
numTh
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
numTh
.
Location
=
new
System
.
Drawing
.
Point
(
2
46
,
9
);
this
.
numTh
.
Location
=
new
System
.
Drawing
.
Point
(
2
71
,
1
9
);
this
.
numTh
.
Name
=
"numTh"
;
this
.
numTh
.
Size
=
new
System
.
Drawing
.
Size
(
56
,
26
);
this
.
numTh
.
TabIndex
=
295
;
...
...
@@ -209,7 +197,7 @@
// label1
//
this
.
label1
.
AutoSize
=
true
;
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
2
20
,
1
2
);
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
2
45
,
2
2
);
this
.
label1
.
Name
=
"label1"
;
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
40
,
20
);
this
.
label1
.
TabIndex
=
294
;
...
...
@@ -238,19 +226,20 @@
// groupBox4
//
this
.
groupBox4
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
groupBox4
.
Controls
.
Add
(
this
.
label_coutresult
);
this
.
groupBox4
.
Controls
.
Add
(
this
.
buttonE
);
this
.
groupBox4
.
Controls
.
Add
(
this
.
buttonD
);
this
.
groupBox4
.
Controls
.
Add
(
this
.
buttonC
);
this
.
groupBox4
.
Controls
.
Add
(
this
.
buttonB
);
this
.
groupBox4
.
Controls
.
Add
(
this
.
buttonAuto
);
this
.
groupBox4
.
Controls
.
Add
(
this
.
buttonA
);
this
.
groupBox4
.
Controls
.
Add
(
this
.
numTh
);
this
.
groupBox4
.
Controls
.
Add
(
this
.
btnTest
);
this
.
groupBox4
.
Controls
.
Add
(
this
.
numWSize
);
this
.
groupBox4
.
Controls
.
Add
(
this
.
label3
);
this
.
groupBox4
.
Controls
.
Add
(
this
.
label1
);
this
.
groupBox4
.
Location
=
new
System
.
Drawing
.
Point
(
990
,
162
);
this
.
groupBox4
.
Name
=
"groupBox4"
;
this
.
groupBox4
.
Size
=
new
System
.
Drawing
.
Size
(
308
,
4
01
);
this
.
groupBox4
.
Size
=
new
System
.
Drawing
.
Size
(
308
,
4
26
);
this
.
groupBox4
.
TabIndex
=
295
;
this
.
groupBox4
.
TabStop
=
false
;
this
.
groupBox4
.
Text
=
"请选择参数"
;
...
...
@@ -260,7 +249,7 @@
this
.
buttonE
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
buttonE
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
buttonE
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
buttonE
.
Location
=
new
System
.
Drawing
.
Point
(
8
2
,
272
);
this
.
buttonE
.
Location
=
new
System
.
Drawing
.
Point
(
8
0
,
310
);
this
.
buttonE
.
Name
=
"buttonE"
;
this
.
buttonE
.
Size
=
new
System
.
Drawing
.
Size
(
133
,
50
);
this
.
buttonE
.
TabIndex
=
303
;
...
...
@@ -273,7 +262,7 @@
this
.
buttonD
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
buttonD
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
buttonD
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
buttonD
.
Location
=
new
System
.
Drawing
.
Point
(
8
2
,
215
);
this
.
buttonD
.
Location
=
new
System
.
Drawing
.
Point
(
8
0
,
253
);
this
.
buttonD
.
Name
=
"buttonD"
;
this
.
buttonD
.
Size
=
new
System
.
Drawing
.
Size
(
133
,
50
);
this
.
buttonD
.
TabIndex
=
302
;
...
...
@@ -286,7 +275,7 @@
this
.
buttonC
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
buttonC
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
buttonC
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
buttonC
.
Location
=
new
System
.
Drawing
.
Point
(
8
2
,
158
);
this
.
buttonC
.
Location
=
new
System
.
Drawing
.
Point
(
8
0
,
196
);
this
.
buttonC
.
Name
=
"buttonC"
;
this
.
buttonC
.
Size
=
new
System
.
Drawing
.
Size
(
133
,
50
);
this
.
buttonC
.
TabIndex
=
301
;
...
...
@@ -299,7 +288,7 @@
this
.
buttonB
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
buttonB
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
buttonB
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
buttonB
.
Location
=
new
System
.
Drawing
.
Point
(
8
2
,
101
);
this
.
buttonB
.
Location
=
new
System
.
Drawing
.
Point
(
8
0
,
139
);
this
.
buttonB
.
Name
=
"buttonB"
;
this
.
buttonB
.
Size
=
new
System
.
Drawing
.
Size
(
133
,
50
);
this
.
buttonB
.
TabIndex
=
300
;
...
...
@@ -307,12 +296,25 @@
this
.
buttonB
.
UseVisualStyleBackColor
=
false
;
this
.
buttonB
.
Click
+=
new
System
.
EventHandler
(
this
.
buttonB_Click
);
//
// buttonAuto
//
this
.
buttonAuto
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
buttonAuto
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
buttonAuto
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
buttonAuto
.
Location
=
new
System
.
Drawing
.
Point
(
80
,
26
);
this
.
buttonAuto
.
Name
=
"buttonAuto"
;
this
.
buttonAuto
.
Size
=
new
System
.
Drawing
.
Size
(
133
,
50
);
this
.
buttonAuto
.
TabIndex
=
299
;
this
.
buttonAuto
.
Text
=
"默认算法"
;
this
.
buttonAuto
.
UseVisualStyleBackColor
=
false
;
this
.
buttonAuto
.
Click
+=
new
System
.
EventHandler
(
this
.
buttonAuto_Click
);
//
// buttonA
//
this
.
buttonA
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
buttonA
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
buttonA
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
buttonA
.
Location
=
new
System
.
Drawing
.
Point
(
8
2
,
44
);
this
.
buttonA
.
Location
=
new
System
.
Drawing
.
Point
(
8
0
,
82
);
this
.
buttonA
.
Name
=
"buttonA"
;
this
.
buttonA
.
Size
=
new
System
.
Drawing
.
Size
(
133
,
50
);
this
.
buttonA
.
TabIndex
=
299
;
...
...
@@ -372,6 +374,15 @@
this
.
lblProName
.
Text
=
"产品:"
;
this
.
lblProName
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
//
// label_coutresult
//
this
.
label_coutresult
.
AutoSize
=
true
;
this
.
label_coutresult
.
Location
=
new
System
.
Drawing
.
Point
(
57
,
380
);
this
.
label_coutresult
.
Name
=
"label_coutresult"
;
this
.
label_coutresult
.
Size
=
new
System
.
Drawing
.
Size
(
79
,
20
);
this
.
label_coutresult
.
TabIndex
=
304
;
this
.
label_coutresult
.
Text
=
"点料结果:"
;
//
// FrmLearning
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
8F
,
20F
);
...
...
@@ -407,7 +418,6 @@
private
System
.
Windows
.
Forms
.
GroupBox
groupBox1
;
private
System
.
Windows
.
Forms
.
Label
lblPnInfo
;
private
Acc
.
ImageBox
.
ImageBox
imgCurrImg
;
private
System
.
Windows
.
Forms
.
Button
btnTest
;
private
System
.
Windows
.
Forms
.
Button
btnEnd
;
private
System
.
Windows
.
Forms
.
NumericUpDown
numWSize
;
private
System
.
Windows
.
Forms
.
Label
label3
;
...
...
@@ -429,5 +439,7 @@
private
System
.
Windows
.
Forms
.
Label
lblFeng
;
private
System
.
Windows
.
Forms
.
Label
lblDes
;
private
System
.
Windows
.
Forms
.
Label
lblProName
;
private
System
.
Windows
.
Forms
.
Button
buttonAuto
;
private
System
.
Windows
.
Forms
.
Label
label_coutresult
;
}
}
\ No newline at end of file
RC1266-AutoCountMachine/source/AutoCountClient/FrmLearning.cs
查看文件 @
fa81c6e
...
...
@@ -13,6 +13,7 @@ using System.Linq;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
using
static
OnlineStore
.
DeviceLibrary
.
CountParam
;
namespace
OnlineStore.AutoCountClient
{
...
...
@@ -22,25 +23,30 @@ namespace OnlineStore.AutoCountClient
{
InitializeComponent
();
}
private
int
CurrType
=
-
2
;
private
SignType
CurrType
=
SignType
.
AUTO
;
private
string
CurrFullFileName
=
""
;
private
string
CurrPN
=
""
;
internal
string
ImagePath
=
ParamManager
.
NoConfigPath
;
internal
string
[]
ImageFiles
;
private
List
<
Button
>
SelBtnList
=
new
List
<
Button
>();
private
string
gouStr
=
"✔ "
;
private
void
FrmLearning_Load
(
object
sender
,
EventArgs
e
)
{
ParamManager
.
Init
();
SelBtnList
.
Add
(
buttonAuto
);
SelBtnList
.
Add
(
buttonA
);
SelBtnList
.
Add
(
buttonB
);
SelBtnList
.
Add
(
buttonC
);
SelBtnList
.
Add
(
buttonD
);
SelBtnList
.
Add
(
buttonE
);
foreach
(
Button
btn
in
SelBtnList
)
{
btn
.
Tag
=
btn
.
Text
;
}
buttonAuto
.
Tag
=
99
;
buttonA
.
Tag
=
0
;
buttonB
.
Tag
=
1
;
buttonC
.
Tag
=
2
;
buttonD
.
Tag
=
3
;
buttonE
.
Tag
=
4
;
LoadImgList
();
}
...
...
@@ -48,12 +54,21 @@ namespace OnlineStore.AutoCountClient
private
int
currIndex
=
-
1
;
private
void
LoadImgList
()
{
if
(!
Directory
.
Exists
(
ImagePath
))
ParamManager
.
Init
();
string
[]
fileList
=
new
string
[]
{
};
if
(
ImageFiles
!=
null
)
{
fileList
=
ImageFiles
;
}
else
if
(!
Directory
.
Exists
(
ImagePath
))
{
MessageBox
.
Show
(
"未找到文件夹:"
+
ImagePath
);
this
.
Close
();
}
string
[]
fileList
=
Directory
.
GetFiles
(
ImagePath
);
else
{
fileList
=
Directory
.
GetFiles
(
ImagePath
);
}
lblFolder
.
Text
=
"当前文件夹:"
+
ImagePath
;
List
<
string
>
list
=
(
from
m
in
fileList
orderby
m
ascending
select
m
).
ToList
();
...
...
@@ -93,10 +108,8 @@ namespace OnlineStore.AutoCountClient
string
[]
array
=
filename
.
Split
(
'-'
);
if
(
array
.
Length
>=
3
)
{
CurrPN
=
array
[
0
];
}
groupBox4
.
Text
=
"["
+
CurrPN
+
"] 请选择参数:"
;
CurrFullFileName
=
fullFName
;
lblPnInfo
.
Text
=
fullFName
;
...
...
@@ -112,11 +125,11 @@ namespace OnlineStore.AutoCountClient
{
numTh
.
Value
=
p
.
Threshold
;
numWSize
.
Value
=
p
.
WindowSize
;
ShowType
(
p
.
Sign
);
CurrType
=
(
p
.
Sign
);
}
else
{
ShowType
(-
1
);
CurrType
=
(
SignType
.
AUTO
);
}
imgCurrImg
.
HorizontalScroll
.
Value
=
173
;
...
...
@@ -125,7 +138,8 @@ namespace OnlineStore.AutoCountClient
{
btnNext
.
Enabled
=
false
;
}
CurrType
=
(
SignType
.
AUTO
);
btnTest_Click
(
buttonAuto
);
if
(
LoadCSVLibrary
.
CSVBomManager
.
allComMap
.
ContainsKey
(
CurrPN
))
{
...
...
@@ -146,69 +160,47 @@ namespace OnlineStore.AutoCountClient
timer1
.
Start
();
}
private
void
ShowType
(
int
type
)
{
if
(
CurrType
.
Equals
(
type
))
{
return
;
}
CurrType
=
type
;
int
index
=
0
;
btnTest
.
Text
=
"请选择算法"
;
bool
findsuanfa
=
false
;
foreach
(
Button
btn
in
SelBtnList
)
{
if
(
index
.
Equals
(
type
))
{
findsuanfa
=
true
;
btn
.
Text
=
gouStr
+
btn
.
Tag
;
btnTest
.
Text
=
btn
.
Tag
+
"-点料测试"
;
btn
.
BackColor
=
Color
.
LightGreen
;
}
else
{
btn
.
Text
=
btn
.
Tag
.
ToString
();
btn
.
BackColor
=
Color
.
White
;
}
index
++;
}
btnTest
.
Enabled
=
findsuanfa
;
btnNext
.
Enabled
=
findsuanfa
;
}
private
void
btnTest_Click
(
object
sender
,
EventArgs
e
)
private
void
btnTest_Click
(
object
sender
)
{
int
count
=
1
;
if
(
imgCurrImg
.
Image
==
null
||
String
.
IsNullOrEmpty
(
CurrFullFileName
))
{
MessageBox
.
Show
(
"未加载图片,无法点料"
);
return
;
}
int
index
=
0
;
var
btnTest
=
(
Button
)
sender
;
foreach
(
Button
btn
in
SelBtnList
)
{
if
(
index
.
Equals
(
CurrType
))
if
(
btn
.
Equals
(
btnTest
))
{
btnTest
.
Text
=
btn
.
Tag
+
"-点料测试"
;
break
;
btn
.
BackColor
=
Color
.
LightGreen
;
}
index
++;
else
{
btn
.
BackColor
=
Color
.
White
;
}
btnTest
.
Enabled
=
false
;
}
Application
.
DoEvents
();
LogUtil
.
info
(
Name
+
"用户点击 "
+
btnTest
.
Text
);
try
{
btnTest
.
Enabled
=
false
;
this
.
Cursor
=
System
.
Windows
.
Forms
.
Cursors
.
WaitCursor
;
int
th
=
(
int
)
numTh
.
Value
;
int
wsize
=
(
int
)
numWSize
.
Value
;
Asa
.
API
.
EyemImage
tpDstImg
;
//Asa.API.EyemImage tpDstImg;
string
resfile
;
CountParam
param
=
new
CountParam
(
""
,
th
,
wsize
,
CurrType
);
int
outCount
=
RobotManager
.
robot
.
XrayBean
.
GetCountResult
(
CurrFullFileName
,
param
,
out
tpDstImg
);
btnTest
.
Text
+=
" 结果:"
+
outCount
.
ToString
();
int
outCount
=
RobotManager
.
robot
.
XrayBean
.
GetCountResult
(
CurrFullFileName
,
param
,
out
resfile
);
if
(
System
.
IO
.
File
.
Exists
(
resfile
))
{
Bitmap
bmp
=
FileToBitmap
(
resfile
);
imgCurrImg
.
Image
=
bmp
;
}
else
{
imgCurrImg
.
Image
=
KiLighten
((
Bitmap
)
ParamManager
.
FormImage
(
ImageList
[
currIndex
]),
80
);
}
label_coutresult
.
Text
=
"点料结果:"
+
outCount
.
ToString
();
LogUtil
.
info
(
"用户点击 "
+
btnTest
.
Text
+
"【"
+
CurrFullFileName
+
"】 参数 "
+
param
.
ToStr
()
+
" 结果:"
+
outCount
);
}
catch
(
Exception
ex
)
...
...
@@ -216,9 +208,11 @@ namespace OnlineStore.AutoCountClient
MessageBox
.
Show
(
ex
.
ToString
());
LogUtil
.
error
(
"点料测试出错:"
+
ex
.
ToString
());
}
btnTest
.
Enabled
=
true
;
this
.
Cursor
=
System
.
Windows
.
Forms
.
Cursors
.
Default
;
SelBtnList
.
ForEach
((
b
)=>
{
b
.
Enabled
=
true
;
});
}
...
...
@@ -258,15 +252,8 @@ namespace OnlineStore.AutoCountClient
}
}
ParamManager
.
SaveMapToFile
();
DialogResult
result2
=
MessageBox
.
Show
(
"保存成功!是否自动清理已配置算法的图片?\r\n"
+
"点击’确定‘:删除已配置算法的物料图片\r\n"
+
"点击’取消‘:暂不删除"
,
"提示"
,
MessageBoxButtons
.
OKCancel
,
MessageBoxIcon
.
Asterisk
);
if
(
result2
.
Equals
(
DialogResult
.
OK
))
{
MessageBox
.
Show
(
"保存成功!"
);
ClearImage
();
}
IsSave
=
true
;
this
.
Close
();
}
...
...
@@ -283,25 +270,23 @@ namespace OnlineStore.AutoCountClient
{
Directory
.
CreateDirectory
(
targetPath
);
}
string
[]
fileList
=
Directory
.
GetFiles
(
ImagePath
);
string
[]
fileList
=
Directory
.
GetFiles
(
ImagePath
,
"*.png"
);
List
<
string
>
list
=
(
from
m
in
fileList
orderby
m
ascending
select
m
).
ToList
();
foreach
(
string
f
in
list
)
{
string
houzhui
=
Path
.
GetExtension
(
f
);
string
filename
=
Path
.
GetFileNameWithoutExtension
(
f
);
string
[]
array
=
filename
.
Split
(
'-'
);
if
(
houzhui
.
Equals
(
".png"
)
&&
array
.
Length
>=
3
)
{
string
pn
=
array
[
0
];
CountParam
p
=
ParamManager
.
GetOptimal
ParamByPN
(
pn
);
if
(
p
!=
null
&&
p
.
Sign
>=
0
)
CountParam
p
=
ParamManager
.
Get
ParamByPN
(
pn
);
if
(
p
!=
null
&&
p
.
Sign
>=
0
)
{
string
targetFile
=
targetPath
+
filename
+
houzhui
;
File
.
Copy
(
f
,
targetPath
+
filename
+
houzhui
,
true
);
File
.
Delete
(
f
);
File
.
Move
(
f
,
targetPath
+
filename
+
houzhui
);
//
File.Delete(f);
LogUtil
.
info
(
"算法配置后清理:备份文件【"
+
f
+
"】到【"
+
targetFile
+
"】,并删除原文件"
);
}
}
}
}
catch
(
Exception
ex
)
{
...
...
@@ -403,23 +388,68 @@ namespace OnlineStore.AutoCountClient
private
void
buttonA_Click
(
object
sender
,
EventArgs
e
)
{
ShowType
(
0
);
CurrType
=
(
SignType
.
IP_SMALL_PARTS
);
btnTest_Click
(
sender
);
}
private
void
buttonB_Click
(
object
sender
,
EventArgs
e
)
{
ShowType
(
1
);
CurrType
=
(
SignType
.
IP_LARGE_PARTS
);
btnTest_Click
(
sender
);
}
private
void
buttonC_Click
(
object
sender
,
EventArgs
e
)
{
ShowType
(
2
);
CurrType
=
(
SignType
.
IP_LONG_PARTS
);
btnTest_Click
(
sender
);
}
private
void
buttonD_Click
(
object
sender
,
EventArgs
e
)
{
ShowType
(
3
);
CurrType
=
(
SignType
.
IP_SQUARE_PARTS
);
btnTest_Click
(
sender
);
}
private
void
buttonE_Click
(
object
sender
,
EventArgs
e
)
{
ShowType
(
4
);
CurrType
=
(
SignType
.
IP_GEN_PARTS
);
btnTest_Click
(
sender
);
}
private
void
buttonAuto_Click
(
object
sender
,
EventArgs
e
)
{
CurrType
=
(
SignType
.
AUTO
);
btnTest_Click
(
sender
);
}
public
static
Bitmap
FileToBitmap
(
string
fileName
)
{
// 打开文件
FileStream
fileStream
=
new
FileStream
(
fileName
,
FileMode
.
Open
,
FileAccess
.
Read
,
FileShare
.
Read
);
// 读取文件的 byte[]
byte
[]
bytes
=
new
byte
[
fileStream
.
Length
];
fileStream
.
Read
(
bytes
,
0
,
bytes
.
Length
);
fileStream
.
Close
();
// 把 byte[] 转换成 Stream
Stream
stream
=
new
MemoryStream
(
bytes
);
stream
.
Read
(
bytes
,
0
,
bytes
.
Length
);
// 设置当前流的位置为流的开始
stream
.
Seek
(
0
,
SeekOrigin
.
Begin
);
MemoryStream
mstream
=
null
;
try
{
mstream
=
new
MemoryStream
(
bytes
);
return
new
Bitmap
((
Image
)
new
Bitmap
(
stream
));
}
catch
(
ArgumentNullException
ex
)
{
return
null
;
}
catch
(
ArgumentException
ex
)
{
return
null
;
}
finally
{
stream
.
Close
();
}
}
}
}
RC1266-AutoCountMachine/source/AutoCountClient/FrmRobotMain.Designer.cs
查看文件 @
fa81c6e
...
...
@@ -58,6 +58,8 @@
this
.
toolStripSeparator2
=
new
System
.
Windows
.
Forms
.
ToolStripSeparator
();
this
.
设置
TToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
元器件学习
ToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
批量
ToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
单盘
ToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
toolStripSeparator17
=
new
System
.
Windows
.
Forms
.
ToolStripSeparator
();
this
.
二维码学习
ToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
toolStripSeparator7
=
new
System
.
Windows
.
Forms
.
ToolStripSeparator
();
...
...
@@ -361,11 +363,28 @@
//
// 元器件学习ToolStripMenuItem
//
this
.
元器件学习
ToolStripMenuItem
.
DropDownItems
.
AddRange
(
new
System
.
Windows
.
Forms
.
ToolStripItem
[]
{
this
.
批量
ToolStripMenuItem
,
this
.
单盘
ToolStripMenuItem
});
this
.
元器件学习
ToolStripMenuItem
.
Name
=
"元器件学习ToolStripMenuItem"
;
this
.
元器件学习
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
180
,
26
);
this
.
元器件学习
ToolStripMenuItem
.
Text
=
"元器件学习"
;
this
.
元器件学习
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
元器件学习
ToolStripMenuItem_Click
);
//
// 批量ToolStripMenuItem
//
this
.
批量
ToolStripMenuItem
.
Name
=
"批量ToolStripMenuItem"
;
this
.
批量
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
112
,
26
);
this
.
批量
ToolStripMenuItem
.
Text
=
"批量"
;
this
.
批量
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
批量
ToolStripMenuItem_Click
);
//
// 单盘ToolStripMenuItem
//
this
.
单盘
ToolStripMenuItem
.
Name
=
"单盘ToolStripMenuItem"
;
this
.
单盘
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
112
,
26
);
this
.
单盘
ToolStripMenuItem
.
Text
=
"单盘"
;
this
.
单盘
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
单盘
ToolStripMenuItem_Click
);
//
// toolStripSeparator17
//
this
.
toolStripSeparator17
.
Name
=
"toolStripSeparator17"
;
...
...
@@ -388,12 +407,14 @@
this
.
toolStripMenuItem2
.
Name
=
"toolStripMenuItem2"
;
this
.
toolStripMenuItem2
.
Size
=
new
System
.
Drawing
.
Size
(
180
,
26
);
this
.
toolStripMenuItem2
.
Text
=
"AGV调试"
;
this
.
toolStripMenuItem2
.
Visible
=
false
;
this
.
toolStripMenuItem2
.
Click
+=
new
System
.
EventHandler
(
this
.
toolStripMenuItem2_Click
);
//
// toolStripSeparator6
//
this
.
toolStripSeparator6
.
Name
=
"toolStripSeparator6"
;
this
.
toolStripSeparator6
.
Size
=
new
System
.
Drawing
.
Size
(
177
,
6
);
this
.
toolStripSeparator6
.
Visible
=
false
;
//
// 标签编辑ToolStripMenuItem
//
...
...
@@ -421,55 +442,57 @@
// toolStripMenuItem3
//
this
.
toolStripMenuItem3
.
Name
=
"toolStripMenuItem3"
;
this
.
toolStripMenuItem3
.
Size
=
new
System
.
Drawing
.
Size
(
1
44
,
26
);
this
.
toolStripMenuItem3
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
toolStripMenuItem3
.
Text
=
"历史记录"
;
this
.
toolStripMenuItem3
.
Click
+=
new
System
.
EventHandler
(
this
.
toolStripMenuItem3_Click
);
//
// toolStripSeparator5
//
this
.
toolStripSeparator5
.
Name
=
"toolStripSeparator5"
;
this
.
toolStripSeparator5
.
Size
=
new
System
.
Drawing
.
Size
(
1
41
,
6
);
this
.
toolStripSeparator5
.
Size
=
new
System
.
Drawing
.
Size
(
1
77
,
6
);
//
// 元器件库ToolStripMenuItem
//
this
.
元器件库
ToolStripMenuItem
.
Name
=
"元器件库ToolStripMenuItem"
;
this
.
元器件库
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
44
,
26
);
this
.
元器件库
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
元器件库
ToolStripMenuItem
.
Text
=
"元器件库"
;
this
.
元器件库
ToolStripMenuItem
.
Visible
=
false
;
this
.
元器件库
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
元器件库
ToolStripMenuItem_Click
);
//
// toolStripSeparator16
//
this
.
toolStripSeparator16
.
Name
=
"toolStripSeparator16"
;
this
.
toolStripSeparator16
.
Size
=
new
System
.
Drawing
.
Size
(
141
,
6
);
this
.
toolStripSeparator16
.
Size
=
new
System
.
Drawing
.
Size
(
177
,
6
);
this
.
toolStripSeparator16
.
Visible
=
false
;
//
// 清空日志ToolStripMenuItem
//
this
.
清空日志
ToolStripMenuItem
.
Name
=
"清空日志ToolStripMenuItem"
;
this
.
清空日志
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
44
,
26
);
this
.
清空日志
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
清空日志
ToolStripMenuItem
.
Text
=
"清空日志"
;
this
.
清空日志
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
清空日志
ToolStripMenuItem_Click
);
//
// toolStripSeparator10
//
this
.
toolStripSeparator10
.
Name
=
"toolStripSeparator10"
;
this
.
toolStripSeparator10
.
Size
=
new
System
.
Drawing
.
Size
(
1
41
,
6
);
this
.
toolStripSeparator10
.
Size
=
new
System
.
Drawing
.
Size
(
1
77
,
6
);
//
// 复制日志ToolStripMenuItem
//
this
.
复制日志
ToolStripMenuItem
.
Name
=
"复制日志ToolStripMenuItem"
;
this
.
复制日志
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
44
,
26
);
this
.
复制日志
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
复制日志
ToolStripMenuItem
.
Text
=
"复制日志"
;
this
.
复制日志
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
复制日志
ToolStripMenuItem_Click
);
//
// toolStripSeparator11
//
this
.
toolStripSeparator11
.
Name
=
"toolStripSeparator11"
;
this
.
toolStripSeparator11
.
Size
=
new
System
.
Drawing
.
Size
(
1
41
,
6
);
this
.
toolStripSeparator11
.
Size
=
new
System
.
Drawing
.
Size
(
1
77
,
6
);
//
// 版本号ToolStripMenuItem
//
this
.
版本号
ToolStripMenuItem
.
Name
=
"版本号ToolStripMenuItem"
;
this
.
版本号
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
44
,
26
);
this
.
版本号
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
1
80
,
26
);
this
.
版本号
ToolStripMenuItem
.
Text
=
"关于软件"
;
this
.
版本号
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
版本号
ToolStripMenuItem_Click
);
//
...
...
@@ -535,7 +558,7 @@
//
this
.
aGVCancelStateToolStripMenuItem
.
Name
=
"aGVCancelStateToolStripMenuItem"
;
this
.
aGVCancelStateToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
213
,
26
);
this
.
aGVCancelStateToolStripMenuItem
.
Text
=
"
AGV cancelState
"
;
this
.
aGVCancelStateToolStripMenuItem
.
Text
=
"
禁用AGV
"
;
this
.
aGVCancelStateToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
aGVCancelStateToolStripMenuItem_Click
);
//
// toolStripSeparator13
...
...
@@ -681,6 +704,8 @@
private
System
.
Windows
.
Forms
.
ToolStripSeparator
toolStripSeparator12
;
private
System
.
Windows
.
Forms
.
ToolStripSeparator
toolStripSeparator14
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
启用贴标功能
ToolStripMenuItem
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
批量
ToolStripMenuItem
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
单盘
ToolStripMenuItem
;
}
}
RC1266-AutoCountMachine/source/AutoCountClient/FrmRobotMain.cs
查看文件 @
fa81c6e
...
...
@@ -257,6 +257,7 @@ namespace OnlineStore.AutoCountClient
{
Camera
.
_cam
.
CloseAll
();
}
if
(
robot
.
sQLite
!=
null
)
robot
.
sQLite
.
Close
();
}
catch
(
Exception
ex
)
...
...
@@ -486,7 +487,17 @@ namespace OnlineStore.AutoCountClient
{
return
;
}
lblXrayWork
.
Visible
=
robot
.
XrayBean
.
InXWork
;
if
(
robot
.
XrayBean
.
carerayImageError
)
{
robot
.
XrayBean
.
MoveStop
=
true
;
lblXrayWork
.
Text
=
"图像平板失效,请及时处理。"
;
lblXrayWork
.
Visible
=
true
;
}
string
canScanCode
=
""
;
lblStatus
.
Text
=
robot
.
GetRunStr
()
+
canScanCode
;
string
warnMsg
=
robot
.
WarnMsg
;
...
...
@@ -535,11 +546,11 @@ namespace OnlineStore.AutoCountClient
//}
if
(
AgvClient
.
CurrCancelState
)
{
aGVCancelStateToolStripMenuItem
.
Text
=
gouStr
+
"
AGV cancelState
"
;
aGVCancelStateToolStripMenuItem
.
Text
=
gouStr
+
"
禁用 AGV
"
;
}
else
{
aGVCancelStateToolStripMenuItem
.
Text
=
"
AGV cancelState
"
;
aGVCancelStateToolStripMenuItem
.
Text
=
"
禁用 AGV
"
;
}
UpdateListBox
();
}
...
...
@@ -707,7 +718,6 @@ namespace OnlineStore.AutoCountClient
ExitApp
();
}
private
void
logBox_VisibleChanged
(
object
sender
,
EventArgs
e
)
{
if
(!
LoadOk
)
...
...
@@ -941,7 +951,32 @@ namespace OnlineStore.AutoCountClient
private
void
元器件学习
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
}
private
void
单盘
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
string
backPath
=
ParamManager
.
NoConfigPath
;
OpenFileDialog
ofd
=
new
OpenFileDialog
();
ofd
.
InitialDirectory
=
ParamManager
.
NoConfigPath
;
ofd
.
Multiselect
=
true
;
ofd
.
Filter
=
"PNG|*.png"
;
if
(
DialogResult
.
OK
==
ofd
.
ShowDialog
(
this
))
{
FrmLearning
frm
=
new
FrmLearning
();
frm
.
ImageFiles
=
ofd
.
FileNames
;
frm
.
ImagePath
=
ParamManager
.
NoConfigPath
;
frm
.
Show
();
//Task.Run(() => { frm.ShowDialog(); });
}
}
private
void
批量
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
string
backPath
=
ParamManager
.
NoConfigPath
;
FrmLearning
frm
=
new
FrmLearning
();
frm
.
ImagePath
=
backPath
;
frm
.
Show
();
/*
folderBrowserDialog1.Description = "请选择需要学习的图片文件夹";
if (!Directory.Exists(backPath))
{
...
...
@@ -954,8 +989,9 @@ namespace OnlineStore.AutoCountClient
string folder = folderBrowserDialog1.SelectedPath;
FrmLearning frm = new FrmLearning();
frm.ImagePath = folder;
frm
.
ShowDialog
();
}
frm.Show();
//Task.Run(() => { frm.ShowDialog(); });
}*/
}
private
void
元器件库
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
...
...
@@ -1012,5 +1048,7 @@ namespace OnlineStore.AutoCountClient
}
LogUtil
.
info
(
Name
+
" 点击:"
+
启用贴标功能
ToolStripMenuItem
.
Text
);
}
}
}
RC1266-AutoCountMachine/source/AutoCountClient/FrmXRay.cs
查看文件 @
fa81c6e
...
...
@@ -16,13 +16,13 @@ using System.Reflection;
using
UserFromControl
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.Common
;
using
static
OnlineStore
.
DeviceLibrary
.
CountParam
;
namespace
OnlineStore.AutoCountClient
{
internal
partial
class
FrmXRay
:
FrmEquipBase
{
private
int
DeviceType
=
0
;
private
SignType
DeviceType
=
SignType
.
AUTO
;
private
bool
IsLoad
=
false
;
private
X_RAY_Equip
equipBean
;
...
...
@@ -34,10 +34,15 @@ namespace OnlineStore.AutoCountClient
InitializeComponent
();
LoadIOList
();
}
private
void
FrmXRay_Shown
(
object
sender
,
EventArgs
e
)
{
}
private
void
FrmStoreIOStatus_Load
(
object
sender
,
EventArgs
e
)
{
cmbType
.
Items
.
AddRange
(
new
string
[]
{
"
小器件"
,
"大器件"
,
"异形三角器件"
,
"异形三脚大器件"
,
"异形长条形器件
"
});
cmbType
.
SelectedIndex
=
DeviceType
;
cmbType
.
Items
.
AddRange
(
new
string
[]
{
"
默认算法"
,
"算法A"
,
"算法B"
,
"算法C"
,
"算法D"
,
"算法E
"
});
cmbType
.
SelectedIndex
=
(
DeviceType
==
SignType
.
AUTO
?
0
:
(
int
)
DeviceType
)
;
chbDebug
.
Checked
=
equipBean
.
IsDebug
;
lblCom
.
Text
=
"X射线端口号:"
+
equipBean
.
Config
.
XRay_Port
;
...
...
@@ -105,6 +110,7 @@ namespace OnlineStore.AutoCountClient
{
return
;
}
this
.
chbMoveStop
.
Checked
=
equipBean
.
MoveStop
;
ReadIOList
();
ReadBtnDO
();
lblOpen
.
Visible
=(!
equipBean
.
OpenXLine
);
...
...
@@ -447,9 +453,8 @@ namespace OnlineStore.AutoCountClient
txtResult
.
Text
=
"点料中..."
;
int
th
=
(
int
)
numTh
.
Value
;
int
wsize
=
(
int
)
numWSize
.
Value
;
Asa
.
API
.
EyemImage
tpDstImg
;
CountParam
param
=
new
CountParam
(
""
,
th
,
wsize
,
DeviceType
);
int
outCount
=
equipBean
.
GetCountResult
(
filePath
,
param
,
out
tpDstImg
);
int
outCount
=
equipBean
.
GetCountResult
(
filePath
,
param
,
out
_
);
txtResult
.
Text
=
outCount
.
ToString
();
LogUtil
.
info
(
equipBean
.
Name
+
"用户点击 点料测试【"
+
filePath
+
"】【"
+
th
+
"】【"
+
wsize
+
"】 结果:"
+
outCount
);
}
...
...
@@ -494,7 +499,8 @@ namespace OnlineStore.AutoCountClient
int
index
=
cmbType
.
SelectedIndex
;
if
(
index
>=
0
)
{
DeviceType
=
index
;
index
--;
Enum
.
TryParse
<
SignType
>(
index
.
ToString
(),
out
DeviceType
);
LogUtil
.
info
(
Name
+
" "
+
equipBean
.
Name
+
" 更改 equipBean.DeviceType="
+
index
);
}
}
...
...
RC1266-AutoCountMachine/source/CodeLibrary/camera/HIK.cs
查看文件 @
fa81c6e
...
...
@@ -48,6 +48,8 @@ namespace CodeLibrary
}
public
override
void
CloseAll
()
{
if
(
cameraCurr
==
null
)
return
;
for
(
int
i
=
0
;
i
<
cameraCurr
.
Length
;
i
++)
{
if
(
cameraCurr
[
i
]
!=
null
)
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
fa81c6e
...
...
@@ -41,8 +41,9 @@
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Reference Include="Asa.CarerayImage">
<HintPath>..\..\dll\X-Ray\Asa.CarerayImage.dll</HintPath>
<Reference Include="Asa.CarerayImage, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\CarerayImage\CarerayImage\bin\Debug\Asa.CarerayImage.dll</HintPath>
</Reference>
<Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/BatchMoveBean.cs
查看文件 @
fa81c6e
...
...
@@ -81,6 +81,7 @@ namespace OnlineStore.DeviceLibrary
{
if
(
Robot
.
AutoInput
&&
Robot
.
IOValue
(
IO_LineIn_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
//WorkLog("启动位置1");
StartWorking
(
new
WorkParam
());
}
}
...
...
@@ -106,12 +107,12 @@ namespace OnlineStore.DeviceLibrary
WorkLog
(
"无料串,:通知agv来送料串AgvName:"
+
AgvName
+
",agvcallresult:"
+
agvcallresult
.
ToString
());
}
}
else
// if(AgvClient.GetAction(AgvName)!=Asa.ClientAction.NeedLeave && AgvClient.GetAction(AgvName)!=Asa.ClientAction.MayLeave)
else
if
(
Robot
.
IOValue
(
IO_LineIn_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
Robot
.
IOValue
(
IO_LineEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
AgvClient
.
GetAction
(
AgvName
)!=
Asa
.
ClientAction
.
NeedLeave
&&
AgvClient
.
GetAction
(
AgvName
)!=
Asa
.
ClientAction
.
MayLeave
&&
AgvClient
.
GetAction
(
AgvName
)
!=
Asa
.
ClientAction
.
FinishLeave
)
{
shelfWatch
.
Stop
();
//
AgvClient.SetToNone(AgvName);
AgvClient
.
SetToNone
(
AgvName
);
}
}
private
Stopwatch
shelfWatch
=
new
Stopwatch
();
public
bool
Reset
(
bool
needStop
=
false
)
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/BatchMoveBean_Partial.cs
查看文件 @
fa81c6e
...
...
@@ -187,11 +187,45 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IB09_ScanCode
))
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
IB10_ScanOK
);
WorkLog
(
"IB09_ScanCode"
);
MoveInfo
.
MoveParam
=
new
WorkParam
();
MoveInfo
.
MoveParam
.
WareCode
=
CodeManager
.
GetValidCode
(
LastCodeList
);
if
(
String
.
IsNullOrEmpty
(
MoveInfo
.
MoveParam
.
WareCode
))
{
MoveInfo
.
MoveParam
.
IsNgReel
=
true
;
MoveInfo
.
MoveParam
.
NgMsg
=
"无有效条码"
;
MoveInfo
.
MoveParam
.
TargetPosType
=
1
;
WorkLog
(
" 无有效条码,从XRay放到NG箱:"
+
MoveInfo
.
MoveParam
.
ToStr
());
string
outF
=
"无有效条码NG."
;
RobotManager
.
robot
.
sQLite
.
Insert
(
MoveInfo
.
MoveParam
.
WareCode
,
MoveInfo
.
MoveParam
.
PlateW
,
MoveInfo
.
MoveParam
.
PlateH
,
0
,
outF
);
}
else
if
(
SServerManager
.
CanConnect
())
{
int
needPosition
=
0
;
string
msg
=
SServerManager
.
Get_VMICheckRLC
(
Name
,
MoveInfo
.
MoveParam
.
WareCode
,
out
needPosition
);
if
(
needPosition
>=
1
&&
needPosition
<=
3
)
{
MoveInfo
.
MoveParam
.
TargetPosType
=
needPosition
;
WorkLog
(
" 【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】通过接口获取目标位置:"
+
needPosition
);
}
else
{
WorkLog
(
" 【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】获取是否测值失败:"
+
msg
);
MoveInfo
.
MoveParam
.
TargetPosType
=
1
;
MoveInfo
.
MoveParam
.
IsNgReel
=
true
;
MoveInfo
.
MoveParam
.
NgMsg
=
msg
;
RobotManager
.
robot
.
sQLite
.
Insert
(
MoveInfo
.
MoveParam
.
WareCode
,
MoveInfo
.
MoveParam
.
PlateW
,
MoveInfo
.
MoveParam
.
PlateH
,
0
,
msg
);
}
}
else
{
MoveInfo
.
MoveParam
.
TargetPosType
=
1
;
}
MoveInfo
.
NextMoveStep
(
StepEnum
.
IB10_ScanOK
);
var
span
=
DateTime
.
Now
-
MoveInfo
.
LastSetpTime
;
LogUtil
.
ticklog
(
""
,
MoveInfo
.
MoveParam
.
WareCode
,
span
.
TotalSeconds
,
"拍照扫码结束"
);
WorkLog
(
"料串入料 :扫码结束【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】,等待取料机构来取料,
拍照识别耗时:"
+
span
.
TotalSeconds
.
ToString
());
//
LogUtil.ticklog("", MoveInfo.MoveParam.WareCode, span.TotalSeconds, "拍照扫码结束");
WorkLog
(
"料串入料 :扫码结束【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】,等待取料机构来取料,
"
+
MoveInfo
.
MoveParam
.
ToStr
());
}
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IB11_TrayLeave
))
{
...
...
@@ -546,6 +580,11 @@ namespace OnlineStore.DeviceLibrary
{
//入口有料串,暂不处理
LogUtil
.
error
(
logName
+
",入口已有料架,暂不处理"
);
Task
.
Factory
.
StartNew
(
delegate
{
Thread
.
Sleep
(
3000
);
AgvClient
.
SetStatus
(
AgvName
,
""
,
ClientAction
.
None
,
ClientLevel
.
High
,
true
);
});
}
}
catch
(
TimeoutException
te
)
...
...
@@ -601,6 +640,11 @@ namespace OnlineStore.DeviceLibrary
else
{
LogUtil
.
info
(
logName
+
" 未检测到料架,暂不处理"
);
Task
.
Factory
.
StartNew
(
delegate
{
Thread
.
Sleep
(
3000
);
AgvClient
.
SetStatus
(
AgvName
,
""
,
ClientAction
.
None
,
ClientLevel
.
High
,
true
);
});
}
}
catch
(
TimeoutException
te
)
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/InputEquip.cs
查看文件 @
fa81c6e
...
...
@@ -249,13 +249,23 @@ namespace OnlineStore.DeviceLibrary
if
(
LeftBatchMove
.
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Working
)
&&
LeftBatchMove
.
MoveInfo
.
IsStep
(
StepEnum
.
IB10_ScanOK
))
{
WorkLog
(
"左侧开始取料"
);
string
code
=
LeftBatchMove
.
MoveInfo
.
MoveParam
.
WareCode
;
StartWorking
(
new
WorkParam
(
1
,
0
,
code
));
var
p
=
new
WorkParam
(
1
,
0
,
code
);
p
.
IsNgReel
=
LeftBatchMove
.
MoveInfo
.
MoveParam
.
IsNgReel
;
p
.
TargetPosType
=
LeftBatchMove
.
MoveInfo
.
MoveParam
.
TargetPosType
;
p
.
NgMsg
=
LeftBatchMove
.
MoveInfo
.
MoveParam
.
NgMsg
;
StartWorking
(
p
);
}
else
if
(
RightBatchMove
.
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Working
)
&&
RightBatchMove
.
MoveInfo
.
IsStep
(
StepEnum
.
IB10_ScanOK
))
{
WorkLog
(
"右侧开始取料"
);
string
code
=
RightBatchMove
.
MoveInfo
.
MoveParam
.
WareCode
;
StartWorking
(
new
WorkParam
(
2
,
0
,
code
));
var
p
=
new
WorkParam
(
2
,
0
,
code
);
p
.
IsNgReel
=
RightBatchMove
.
MoveInfo
.
MoveParam
.
IsNgReel
;
p
.
TargetPosType
=
RightBatchMove
.
MoveInfo
.
MoveParam
.
TargetPosType
;
p
.
NgMsg
=
RightBatchMove
.
MoveInfo
.
MoveParam
.
NgMsg
;
StartWorking
(
p
);
}
}
if
(
SecMoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
None
)
&&
NoErrorAlarm
())
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/InputEquip_InStore.cs
查看文件 @
fa81c6e
...
...
@@ -39,7 +39,7 @@ namespace OnlineStore.DeviceLibrary
if
(
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
None
))
{
MoveInfo
.
NewMove
(
RobotMoveType
.
Working
,
StepEnum
.
IW01_InoutToP1
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
500
));
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
MoveInfo
.
MoveParam
=
param
;
//如果升降轴,旋转轴,进出轴都在指定位置,直接进出轴前进
...
...
@@ -127,7 +127,7 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW06_Clamping_Work
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
500
));
WorkLog
(
"取料: 夹料气缸夹紧1"
,
0
);
WorkLog
(
"取料: 夹料气缸夹紧1"
,
0
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Relax
,
IO_Type
.
Clamping_Work
);
}
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IW06_Clamping_Work
))
...
...
@@ -135,7 +135,7 @@ namespace OnlineStore.DeviceLibrary
if
(
CylinderIsOk
(
IO_Type
.
Clamping_Relax
,
IO_Type
.
Clamping_Work
))
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW07_UpdownToP1
);
WorkLog
(
"取料: 升降轴到待机点P1"
,
0
);
WorkLog
(
"取料: 升降轴到待机点P1"
,
0
);
UpdownAxis
.
AbsMove
(
MoveInfo
,
Config
.
UpdownAxis_P1
,
Config
.
UpdownAxis_P1Speed
);
WorkLog
(
"取料: 进出轴返回P1"
,
1
);
InOutAxis
.
AbsMove
(
MoveInfo
,
Config
.
InoutAxis_P1
,
Config
.
InoutAxis_P1Speed
);
...
...
@@ -144,7 +144,7 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW06_Clamping_Work
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
500
));
WorkLog
(
"取料: 夹料气缸夹紧2"
,
0
);
WorkLog
(
"取料: 夹料气缸夹紧2"
,
0
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Relax
,
IO_Type
.
Clamping_Work
);
}
}
...
...
@@ -152,9 +152,12 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW08_WaitAxisCheck
);
WorkLog
(
"取料: 等待伺服检测信号消失"
);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_7, IO_VALUE.HIGH));
if
(
MoveInfo
.
MoveParam
.
InPosType
.
Equals
(
1
))
{
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
L_AxisTrayCheck
,
IO_VALUE
.
LOW
));
//
}
else
{
...
...
@@ -164,9 +167,9 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IW08_WaitAxisCheck
))
{
//MoveInfo.NextMoveStep(StepEnum.IW09_InoutToP1);
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW10_SaveSize
);
//MoveInfo.NextMoveStep(StepEnum.IW10_SaveSize);
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW11_GetTargetPosition
);
if
(
MoveInfo
.
MoveParam
.
InPosType
.
Equals
(
1
))
{
LeftBatchMove
.
GetTrayOK
();
...
...
@@ -200,23 +203,20 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IW10_SaveSize
))
{
GetTargetPTask
=
null
;
//GetTargetPTask = null;
WorkLog
(
" IW10_SaveSize"
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW11_GetTargetPosition
);
return
;
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
100
));
if
(
String
.
IsNullOrEmpty
(
MoveInfo
.
MoveParam
.
WareCode
))
{
MoveInfo
.
MoveParam
.
IsNgReel
=
true
;
MoveInfo
.
MoveParam
.
NgMsg
=
"无有效条码"
;
MoveInfo
.
MoveParam
.
TargetPosType
=
1
;
WorkLog
(
" 无有效条码,从XRay放到NG箱:"
+
MoveInfo
.
MoveParam
.
ToStr
(),
1
);
WorkLog
(
" 无有效条码,从XRay放到NG箱:"
+
MoveInfo
.
MoveParam
.
ToStr
(),
1
);
string
outF
=
"无有效条码NG."
;
RobotManager
.
robot
.
sQLite
.
Insert
(
MoveInfo
.
MoveParam
.
WareCode
,
MoveInfo
.
MoveParam
.
PlateW
,
MoveInfo
.
MoveParam
.
PlateH
,
0
,
outF
);
}
//else if (MoveInfo.MoveParam.InPosType.Equals(2))
//{
// MoveInfo.MoveParam.TargetPosType = 1;
// WorkLog(" 右侧入口入料,直接放到XRay:" + MoveInfo.MoveParam.ToStr());
//}
else
if
(
SServerManager
.
CanConnect
())
{
GetTargetPTask
=
Task
.
Factory
.
StartNew
(
delegate
...
...
@@ -227,18 +227,19 @@ namespace OnlineStore.DeviceLibrary
if
(
needPosition
>=
1
&&
needPosition
<=
3
)
{
MoveInfo
.
MoveParam
.
TargetPosType
=
needPosition
;
WorkLog
(
" 【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】通过接口获取目标位置:"
+
needPosition
,
1
);
WorkLog
(
" 【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】通过接口获取目标位置:"
+
needPosition
,
1
);
//if (needPosition>1)
// RobotManager.robot.sQLite.Insert(MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PlateW, MoveInfo.MoveParam.PlateH, 0, msg);
}
// else if (!msg.Equals("") || needPosition.Equals(0))
else
{
WorkLog
(
" 【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】获取是否测值失败:"
+
msg
,
1
);
WorkLog
(
" 【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】获取是否测值失败:"
+
msg
,
1
);
MoveInfo
.
MoveParam
.
TargetPosType
=
1
;
MoveInfo
.
MoveParam
.
IsNgReel
=
true
;
MoveInfo
.
MoveParam
.
NgMsg
=
msg
;
string
outF
=
msg
;
RobotManager
.
robot
.
sQLite
.
Insert
(
MoveInfo
.
MoveParam
.
WareCode
,
MoveInfo
.
MoveParam
.
PlateW
,
MoveInfo
.
MoveParam
.
PlateH
,
0
,
outF
);
RobotManager
.
robot
.
sQLite
.
Insert
(
MoveInfo
.
MoveParam
.
WareCode
,
MoveInfo
.
MoveParam
.
PlateW
,
MoveInfo
.
MoveParam
.
PlateH
,
0
,
msg
);
}
});
}
...
...
@@ -251,15 +252,22 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
MoveParam
.
TargetPosType
=
DefautTargetP
;
}
}
WorkLog
(
" 根据条码获取目标位置:"
+
MoveInfo
.
MoveParam
.
ToStr
(),
1
);
WorkLog
(
" 根据条码获取目标位置:"
+
MoveInfo
.
MoveParam
.
ToStr
(),
1
);
}
}
#
endregion
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IW11_GetTargetPosition
))
{
if
(
GetTargetPTask
==
null
||
GetTargetPTask
.
IsCompleted
)
WorkLog
(
" IW11_GetTargetPosition"
);
if
(
MoveInfo
.
MoveParam
.
TargetPosType
.
Equals
(
0
))
{
WorkLog
(
" TargetPosType:0"
);
MoveInfo
.
MoveParam
.
TargetPosType
=
1
;
}
//if (GetTargetPTask == null || GetTargetPTask.IsCompleted)
//{
/*
if (MoveInfo.MoveParam.TargetPosType.Equals(0))
{
if (SServerManager.CanConnect())
...
...
@@ -280,31 +288,31 @@ namespace OnlineStore.DeviceLibrary
WorkLog(" 随机放料目标:" + 1, 1);
}
}
*/
if
(
MoveInfo
.
MoveParam
.
TargetPosType
.
Equals
(
1
))
{
ClearTimeoutAlarm
(
"验证是否测值"
);
//
ClearTimeoutAlarm("验证是否测值");
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW21_MiddleToP3
);
WorkLog
(
" 开始放料到XRay入口,旋转轴到P3"
,
1
);
MiddleAxis
.
AbsMove
(
MoveInfo
,
Config
.
MiddleAxis_P3
,
Config
.
MiddleAxis_P3Speed
);
}
else
{
ClearTimeoutAlarm
(
"验证是否测值"
);
//
ClearTimeoutAlarm("验证是否测值");
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW31_MIddleToP4
);
WorkLog
(
" 开始放料到测值工位,旋转轴到P4"
,
1
);
string
outF
=
MoveInfo
.
MoveParam
.
TargetPosType
.
Equals
(
2
)?
"电容"
:
"电阻"
;
string
outF
=
MoveInfo
.
MoveParam
.
TargetPosType
.
Equals
(
2
)
?
"电容"
:
"电阻"
;
outF
+=
"需测值"
;
RobotManager
.
robot
.
sQLite
.
Insert
(
MoveInfo
.
MoveParam
.
WareCode
,
MoveInfo
.
MoveParam
.
PlateW
,
MoveInfo
.
MoveParam
.
PlateH
,
0
,
outF
);
MiddleAxis
.
AbsMove
(
MoveInfo
,
Config
.
MiddleAxis_P4
,
Config
.
MiddleAxis_P4Speed
);
}
}
else
if
(
MoveInfo
.
IsTimeOut
(
120
))
{
WarnMsg
=
Name
+
"等待"
+
MoveInfo
.
MoveParam
.
WareCode
+
"验证是否测值 超时["
+
MoveInfo
.
TimeOutSeconds
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
MoveInfo
.
ErrorLogType
,
MoveInfo
.
logSeconds
());
Alarm
(
AlarmType
.
IoSingleTimeOut
);
}
//
}else if (MoveInfo.IsTimeOut(120))
//
{
//
WarnMsg = Name + "等待" + MoveInfo.MoveParam.WareCode + "验证是否测值 超时[" + MoveInfo.TimeOutSeconds + "]秒";
//
LogUtil.error(WarnMsg, MoveInfo.ErrorLogType, MoveInfo.logSeconds());
//
Alarm(AlarmType.IoSingleTimeOut);
//
}
}
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IW21_MiddleToP3
))
{
if
(
IOValue
(
IO_Type
.
TakeAxis_Location_1
).
Equals
(
IO_VALUE
.
HIGH
))
...
...
@@ -320,15 +328,15 @@ namespace OnlineStore.DeviceLibrary
{
WorkLog
(
"旋转轴已经到P3,但X42传感器没有检测到。"
);
}
else
{
else
{
WorkLog
(
"旋转轴没有到位。"
);
}
}
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IW22_UpdownToP3
))
{
//向上合并
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW23_InoutToP3
);
//MoveInfo.NextMoveStep(StepEnum.IW23_InoutToP3);
bool
isOk
=
MoveInfo
.
MoveParam
.
PlateH
>
0
&&
MoveInfo
.
MoveParam
.
PlateW
>
0
;
BatchMoveBean
moveBean
=
MoveInfo
.
MoveParam
.
InPosType
.
Equals
(
1
)
?
LeftBatchMove
:
RightBatchMove
;
...
...
@@ -348,12 +356,11 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
WarnMsg
,
MoveInfo
.
ErrorLogType
,
MoveInfo
.
logSeconds
());
Alarm
(
AlarmType
.
IoSingleTimeOut
);
}
}
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IW23_InoutToP3
))
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW24_WaitCanPut
);
WorkLog
(
"->XRay:等待XRay可放料"
,
1
);
WorkLog
(
"->XRay:等待XRay可放料"
,
1
);
MoveInfo
.
TimeOutSeconds
=
120
;
//TODO
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
...
...
@@ -362,10 +369,10 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IW24_WaitCanPut
))
{
TickLog
(
"等待XRay可放料"
,
true
);
TickLog
(
"等待XRay可放料"
,
true
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW41_Clamping_Relax
);
RobotManager
.
robot
.
XrayBean
.
In_ReelInfo
=
MoveInfo
.
MoveParam
.
GetReelInfo
();
WorkLog
(
"->XRay:夹料气缸放松,更新XRay入口料盘:"
+
RobotManager
.
robot
.
XrayBean
.
In_ReelInfo
.
ToStr
(),
1
);
WorkLog
(
"->XRay:夹料气缸放松,更新XRay入口料盘:"
+
RobotManager
.
robot
.
XrayBean
.
In_ReelInfo
.
ToStr
(),
1
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Work
,
IO_Type
.
Clamping_Relax
);
}
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/OutputEquip_Partial.cs
查看文件 @
fa81c6e
...
...
@@ -50,7 +50,6 @@ namespace OnlineStore.DeviceLibrary
}
#
region
取料
internal
bool
IsInGetWare
()
{
if
(
MoveInfo
.
MoveStep
>=
StepEnum
.
OT06_MoveXToP2
&&
MoveInfo
.
MoveStep
<=
StepEnum
.
OT09_MoveZToP1
)
...
...
@@ -110,7 +109,6 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
MoveParam
.
IsNgReel
=
true
;
}
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
Out_TrayCheck
,
IO_VALUE
.
HIGH
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
X_OLine_Run
,
IO_VALUE
.
LOW
));
}
...
...
@@ -175,7 +173,6 @@ namespace OnlineStore.DeviceLibrary
}
private
void
OT03_MoveXToP2
()
{
int
position
=
Config
.
GetMoveXP2
(
MoveInfo
.
MoveParam
.
PlateW
);
if
(
MoveXAxis
.
IsInPosition
(
position
))
{
...
...
@@ -347,6 +344,7 @@ namespace OnlineStore.DeviceLibrary
{
int
trayHeight
=
MoveInfo
.
MoveParam
.
PlateH
;
ShelfMoveInfo
.
NextMoveStep
(
StepEnum
.
OS_21_BatchDownH
);
int
currP
=
BatchAxis
.
GetAclPosition
();
int
targetP
=
currP
-
(
trayHeight
+
20
)
*
Config
.
Height_ChangeValue
;
if
(
targetP
<
Config
.
BatchAxisP2
)
...
...
@@ -354,6 +352,7 @@ namespace OnlineStore.DeviceLibrary
targetP
=
Config
.
BatchAxisP2
;
}
ShelfWorkLog
(
"放料: 提升轴下降指定高度 : 盘高【"
+
trayHeight
+
"】实时位置【"
+
currP
+
"】目标位置【"
+
targetP
+
"】"
);
ShelfMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
BatchAxis
.
AbsMove
(
ShelfMoveInfo
,
targetP
,
Config
.
BatchAxis_P2Speed
);
}
}
...
...
@@ -367,13 +366,21 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
OT12_MoveXToP3
))
{
if
(
IOValue
(
IO_Type
.
O_WLine_TrayCheck
).
Equals
(
IO_VALUE
.
HIGH
))
{
ShelfMoveInfo
.
NextMoveStep
(
StepEnum
.
OS_20_ShelfReady
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
OT11_WaitShelfOk
);
WorkLog
(
"放料:料串下降不到位,重新下降 "
,
1
);
}
else
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
OT13_MoveZToP3
);
int
p
=
Config
.
GetMoveZP3
(
MoveInfo
.
MoveParam
.
PlateH
);
WorkLog
(
"放料:取料Z轴下降到P3 ["
+
p
+
"] "
,
1
);
WorkLog
(
"放料:取料Z轴下降到P3 ["
+
p
+
"] "
,
1
);
MoveZAxis
.
AbsMove
(
MoveInfo
,
p
,
Config
.
MoveZ_P3Speed
);
CheckStartLabel
();
}
}
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
OT13_MoveZToP3
))
{
bool
shelfOk
=
ShelfMoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
ShelfPro
)
&&
ShelfMoveInfo
.
IsStep
(
StepEnum
.
OS_22_WaitTray
);
...
...
@@ -424,7 +431,6 @@ namespace OnlineStore.DeviceLibrary
WorkLog
(
"放料完成,耗时("
+
FormUtil
.
GetSpanStr
(
span
)
+
")"
);
TickLog
(
"出口料串,放料完成"
);
MoveInfo
.
EndMove
();
}
else
{
...
...
@@ -438,10 +444,7 @@ namespace OnlineStore.DeviceLibrary
}
}
}
#
region
NG
料
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
OT21_NG_MoveXToP1
))
{
int
busyStatus
=
ACServerManager
.
GetBusyStatus
(
MoveZAxis
.
Config
.
DeviceName
,
MoveZAxis
.
Config
.
GetAxisValue
());
...
...
@@ -478,16 +481,12 @@ namespace OnlineStore.DeviceLibrary
TickLog
(
"出口NG,放料完成"
);
WorkLog
(
"放料完成,耗时("
+
FormUtil
.
GetSpanStr
(
span
)
+
")"
);
MoveInfo
.
EndMove
();
}
#
endregion
}
#
endregion
#
region
贴标
public
override
bool
StartLabelling
(
WorkParam
param
)
{
if
(!
SecMoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
None
))
...
...
@@ -508,7 +507,6 @@ namespace OnlineStore.DeviceLibrary
{
LabelZAxis
.
AbsMove
(
SecMoveInfo
,
Config
.
LabelZ_P1
,
Config
.
LabelZ_P1Speed
);
}
return
true
;
}
...
...
@@ -529,8 +527,12 @@ namespace OnlineStore.DeviceLibrary
{
SecMoveInfo
.
NextMoveStep
(
StepEnum
.
OL03_PrintLabel
);
RobotManager
.
LastPrintStatus
=
Asa
.
PrintLabel
.
PrinterStatus
.
Unknown
;
try
{
NeedPrint
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
NeedPrintLabel
).
Equals
(
1
);
StickingPosJudgment
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
StickingPosJudgment
).
Equals
(
1
);
}
catch
{
}
SecWorkLog
(
"贴标: 重置PrintLabel状态=Unknown,开始打印标签["
+
NeedPrint
+
"] ,贴标XYR轴到取标签点P2, 等待1s"
);
SecMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
if
(
NeedPrint
)
...
...
@@ -548,7 +550,6 @@ namespace OnlineStore.DeviceLibrary
LabelXAxis
.
AbsMove
(
SecMoveInfo
,
Config
.
LabelX_P2
,
Config
.
LabelX_P2Speed
);
LabelYAxis
.
AbsMove
(
SecMoveInfo
,
Config
.
LabelY_P2
,
Config
.
LabelY_P2Speed
);
LabelRAxis
.
AbsMove
(
SecMoveInfo
,
Config
.
LabelR_P2
,
Config
.
LabelR_P2Speed
);
}
else
if
(
SecMoveInfo
.
IsStep
(
StepEnum
.
OL03_PrintLabel
))
{
...
...
@@ -576,7 +577,6 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
WarnMsg
,
SecMoveInfo
.
ErrorLogType
,
SecMoveInfo
.
logSeconds
());
Alarm
(
AlarmType
.
IoSingleTimeOut
);
}
}
else
if
(
SecMoveInfo
.
IsStep
(
StepEnum
.
OL05_TakeBack
))
{
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/OutputEquip_Shelf.cs
查看文件 @
fa81c6e
...
...
@@ -246,12 +246,12 @@ namespace OnlineStore.DeviceLibrary
else
if
(
ShelfMoveInfo
.
IsStep
(
StepEnum
.
OS_21_BatchDownH
))
{
ShelfMoveInfo
.
NextMoveStep
(
StepEnum
.
OS_22_WaitTray
);
ShelfWorkLog
(
"等待料盘放入料串
"
);
ShelfWorkLog
(
"等待料盘放入料串
,O_WLine_TrayCheck="
+
IOValue
(
IO_Type
.
O_WLine_TrayCheck
).
ToString
()
);
}
else
if
(
ShelfMoveInfo
.
IsStep
(
StepEnum
.
OS_23_TrayOK
))
{
ShelfMoveInfo
.
NextMoveStep
(
StepEnum
.
OS_24_BatchToP3
);
ShelfWorkLog
(
"批量轴匀速到P3或信号亮
"
)
;
ShelfWorkLog
(
"批量轴匀速到P3或信号亮
,O_WLine_TrayCheck="
+
IOValue
(
IO_Type
.
O_WLine_TrayCheck
).
ToString
());
;
BatchAxisToP3
(
ShelfMoveInfo
);
}
else
if
(
ShelfMoveInfo
.
IsStep
(
StepEnum
.
OS_24_BatchToP3
))
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/RobotBean.cs
查看文件 @
fa81c6e
using
BLL
;
using
Asa
;
using
BLL
;
using
log4net
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
...
...
@@ -64,6 +65,17 @@ namespace OnlineStore.DeviceLibrary
AgvClient
.
NodeList
.
Add
(
outputEquip
.
Config
.
AgvOutName
);
AgvClient
.
NodeList
.
Add
(
inputEquip
.
Config
.
RightAgvName
);
AgvClient
.
NodeList
.
Add
(
inputEquip
.
Config
.
LeftAgvName
);
/*var carerayImage = new CarerayImage();
if (carerayImage.Open())
{
carerayImage.Close();
}
else {
LogUtil.info(Name + "图像平板打开失败! 系统不允许启动。");
return;
}
*/
Task
.
Factory
.
StartNew
(
delegate
{
LogUtil
.
info
(
Name
+
"开始连接IO模块 "
);
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip.cs
查看文件 @
fa81c6e
...
...
@@ -61,7 +61,7 @@ namespace OnlineStore.DeviceLibrary
}
public
bool
carerayImageError
=
false
;
private
void
XRayLoad
()
{
try
...
...
@@ -69,7 +69,7 @@ namespace OnlineStore.DeviceLibrary
carerayImage
=
new
CarerayImage
(
"XRay"
);
bool
cResult
=
carerayImage
.
Open
();
LogUtil
.
info
(
Name
+
"carerayImage.Open()="
+
cResult
);
carerayImageError
=
!
cResult
;
xRay
=
new
XRay
(
"XRay"
);
xRay
.
WarmUp
+=
XRay_WarmUp
;
...
...
@@ -346,10 +346,8 @@ namespace OnlineStore.DeviceLibrary
}
return
false
;
}
#
endregion
public
override
string
GetMoveStr
()
{
string
msg
=
""
;
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip_Partial.cs
查看文件 @
fa81c6e
...
...
@@ -239,7 +239,9 @@ namespace OnlineStore.DeviceLibrary
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(8000));
WorkLog
(
"点料:清理"
+
path1_tif
+
"内容,开始获取X射线图形 "
);
CapImage
();
if
(
string
.
IsNullOrEmpty
(
CapImage
()))
{
//Alarm(AlarmType.IoSingleTimeOut);
}
MoveInfo
.
EndStepWait
();
}
...
...
@@ -398,13 +400,15 @@ namespace OnlineStore.DeviceLibrary
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300000));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
GetResultTask
=
Task
.
Factory
.
StartNew
(
delegate
{
GetResultTask
=
Task
.
Factory
.
StartNew
(
delegate
{
try
{
if
(
xRay
.
IsRayOpen
)
{
xRay
.
Stop
();
}
InXWork
=
false
;
WorkLog
(
"点料:停止X射线,设置 InXWork = false,开始获取点料结果"
);
bool
isNg
=
false
;
...
...
@@ -414,11 +418,12 @@ namespace OnlineStore.DeviceLibrary
if
(
lastParam
==
null
)
{
lastParam
=
new
CountParam
(
""
,
ThresholdValue
,
3
);
WorkLog
(
"点料:"
+
"NG:未找到元器件类型,PN["
+
ParamManager
.
GetCodeStrPN
(
Work_ReelInfo
.
WareCode
)
+
"]"
);
BackNoConfigImg
(
ParamManager
.
GetCodeStrPN
(
Work_ReelInfo
.
WareCode
));
}
if
(
lastParam
!=
null
)
{
string
fileP
=
path1_tif
+
@"\"
+
lastFileName
;
count
=
GetCountResult
(
fileP
,
lastParam
,
out
Asa
.
API
.
EyemImage
tpDstImg
);
count
=
GetCountResult
(
fileP
,
lastParam
,
out
_
);
if
(
count
<
ResultMinCount
)
{
isNg
=
true
;
...
...
@@ -441,14 +446,8 @@ namespace OnlineStore.DeviceLibrary
NgMsg
=
msg
;
}
}
}
else
{
isNg
=
true
;
NgMsg
=
"NG:未找到元器件类型,PN["
+
ParamManager
.
GetCodeStrPN
(
Work_ReelInfo
.
WareCode
)
+
"]"
;
WorkLog
(
"点料:"
+
NgMsg
);
BackNoConfigImg
();
}
string
outF
=
path2_out
+
lastFileName
;
if
(!
isNg
)
...
...
@@ -521,7 +520,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
Name
+
"carerayImage.GetImage 获取图片失败 = "
+
imgResult
+
", carerayImage.Close 失败"
);
}
}
carerayImageError
=
!
imgResult
;
carerayImage
.
WindowWidth
=
Config
.
WindowWidth
;
carerayImage
.
WindowLevel
=
Config
.
WindowLevel
;
if
(
imgResult
)
...
...
@@ -552,12 +551,15 @@ namespace OnlineStore.DeviceLibrary
{
WorkLog
(
"点料:获取X射线图形,获取图片失败,carerayImage.Get48bImage()=null"
);
LogUtil
.
error
(
Name
+
" 获取图片失败,carerayImage.Get48bImage()=null"
);
lastFileName
=
""
;
}
}
else
{
WorkLog
(
"点料:获取X射线图形,获取图片失败,carerayImage.GetImage()="
+
imgResult
);
LogUtil
.
error
(
Name
+
" 获取图片失败,carerayImage.GetImage()="
+
imgResult
);
lastFileName
=
""
;
}
bool
result
=
xRay
.
Stop
();
if
(!
result
)
...
...
@@ -603,22 +605,25 @@ namespace OnlineStore.DeviceLibrary
}
private
void
BackNoConfigImg
()
private
void
BackNoConfigImg
(
string
pn
)
{
//将未找到料号配置的图片保存到新的文件夹
string
fileP
=
path1_tif
+
@"\"
+
lastFileName
;
string
backPath
=
ParamManager
.
NoConfigPath
;
string
backFile
=
backPath
+
lastFileName
;
string
backFile
=
Path
.
Combine
(
backPath
,
pn
+
".png"
)
;
try
{
if
(!
Directory
.
Exists
(
backPath
))
{
Directory
.
CreateDirectory
(
backPath
);
}
if
(!
File
.
Exists
(
backFile
))
{
System
.
IO
.
File
.
Copy
(
fileP
,
backFile
);
LogUtil
.
info
(
"BackNoConfigImg 【"
+
fileP
+
"】 -> 【"
+
backFile
+
"】"
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"X图片备份到【"
+
backFile
+
"】错误:"
+
ex
.
ToString
());
...
...
@@ -626,52 +631,46 @@ namespace OnlineStore.DeviceLibrary
}
public
int
GetCountResult
(
string
fileP
,
CountParam
param
,
out
Asa
.
API
.
EyemImage
tpDstImg
)
public
int
GetCountResult
(
string
fileP
,
CountParam
param
,
out
string
resfile
)
{
// 器件类型
//"小器件" GetLocalCount
//"粘连不严重" GetLocalCountIrregular type = 0
//"大器件" GetLocalCountIrregular type = 1
//"长条型器件" GetLocalCountIrregular type = 2
//"E形状" GetLocalCountIrregular type = 3
//返回的数量是string类型,count = "4000,3000,3500,2000"
int
count
=
0
;
tpDstImg
=
new
API
.
EyemImage
();
resfile
=
""
;
//tpDstImg = new API.EyemImage();
try
{
string
countStr
=
""
;
int
result
=
0
;
int
type
=
param
.
Sign
;
CountParam
.
SignType
type
=
param
.
Sign
;
int
threshold
=
param
.
Threshold
;
int
windowsize
=
param
.
WindowSize
;
/*
if (param.Sign.Equals(0))
int
windowsize
=
param
.
WindowSize
;
;
if
(
param
.
Sign
==
CountParam
.
SignType
.
AUTO
)
{
result = carerayImage.GetLocalCount(fileP, threshold, windowsize, out countStr, out
tpDstImg
);
result
=
carerayImage
.
GetLocalCount
(
fileP
,
threshold
,
windowsize
,
out
countStr
,
out
_
);
LogUtil
.
info
(
"GetCountResult "
+
type
+
" 调用 GetLocalCount 【"
+
fileP
+
"】【"
+
threshold
+
"】【"
+
windowsize
+
"】,返回【"
+
result
+
"】,结果【"
+
countStr
+
"】"
);
}
else
{
int t = param.Sign ;
result = carerayImage.GetLocalCountIrregular(fileP, threshold, t, windowsize, out countStr, out tpDstImg);
LogUtil.info("GetCountResult " + type + " 调用 GetLocalCountIrregular 【" + fileP + "】【" + threshold + "】[" + t + "]【" + windowsize + "】,返回【" + result + "】,结果【" + countStr + "】");
else
{
result
=
carerayImage
.
GetLocalCountIrregular
(
fileP
,
threshold
,
type
.
ToString
(),
windowsize
,
out
countStr
,
out
_
);
LogUtil
.
info
(
"GetCountResult "
+
type
+
" 调用 GetLocalCountIrregular 【"
+
fileP
+
"】【"
+
threshold
+
"】【"
+
windowsize
+
"】,返回【"
+
result
+
"】,结果【"
+
countStr
+
"】"
);
}
string[] array = countStr.Split(',');
if (array.Length > 0)
if
(
countStr
!=
null
)
{
count= Convert.ToInt32(array[0]);
}*/
result
=
carerayImage
.
GetLocalCount
(
fileP
,
threshold
,
windowsize
,
out
countStr
,
out
tpDstImg
);
LogUtil
.
info
(
"GetCountResult "
+
type
+
" 调用 GetLocalCount 【"
+
fileP
+
"】【"
+
threshold
+
"】【"
+
windowsize
+
"】,返回【"
+
result
+
"】,结果【"
+
countStr
+
"】"
);
string
[]
array
=
countStr
.
Split
(
new
char
[]
{
','
},
StringSplitOptions
.
RemoveEmptyEntries
);
count
=
(
from
a
in
array
where
int
.
TryParse
(
a
,
out
_
)
&&
int
.
Parse
(
a
)
>
0
select
int
.
Parse
(
a
)).
FirstOrDefault
();
}
else
{
count
=
0
;
}
string
resfilename
=
Path
.
GetFileNameWithoutExtension
(
fileP
)+
"-Mark.png"
;
string
root
=
Path
.
Combine
(
Application
.
StartupPath
,
"ResOut"
);
var
n
=
DateTime
.
Now
;
string
destdir
=
Path
.
Combine
(
root
,
n
.
Year
.
ToString
()
+
"-"
+
n
.
Month
.
ToString
(),
n
.
Day
.
ToString
(),
n
.
Hour
.
ToString
());
Directory
.
CreateDirectory
(
destdir
);
Directory
.
Move
(
Path
.
Combine
(
root
,
resfilename
),
Path
.
Combine
(
destdir
,
resfilename
));
resfile
=
Path
.
Combine
(
destdir
,
resfilename
);
if
(
File
.
Exists
(
resfile
))
File
.
Delete
(
resfile
);
Directory
.
Move
(
Path
.
Combine
(
root
,
resfilename
),
resfile
);
}
catch
(
Exception
ex
)
{
...
...
@@ -686,7 +685,6 @@ namespace OnlineStore.DeviceLibrary
Bitmap
bit
=
null
;
return
bit
;
}
#
endregion
}
}
\ No newline at end of file
RC1266-AutoCountMachine/source/DeviceLibrary/manager/ParamManager.cs
查看文件 @
fa81c6e
...
...
@@ -8,6 +8,7 @@ using System.Linq;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
using
static
OnlineStore
.
DeviceLibrary
.
CountParam
;
namespace
OnlineStore.DeviceLibrary
{
...
...
@@ -16,14 +17,19 @@ namespace OnlineStore.DeviceLibrary
public
static
string
NoConfigPath
=
@"D:\NoConfigImg\"
;
private
static
Dictionary
<
string
,
CountParam
>
countParamMap
=
new
Dictionary
<
string
,
CountParam
>();
private
static
string
ConfigFilePath
=
""
;
internal
static
void
Init
()
public
static
void
Init
()
{
ConfigFilePath
=
Application
.
StartupPath
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
CounParamConfig
);
countParamMap
=
LoadParamMap
(
);
countParamMap
=
LoadParamMap
();
}
public
static
string
GetSufanStr
(
int
type
)
{
SignType
sign
=
SignType
.
AUTO
;
Enum
.
TryParse
<
SignType
>(
type
.
ToString
(),
out
sign
);
return
GetSufanStr
(
sign
);
}
public
static
string
GetSufanStr
(
SignType
type
)
{
if
(
type
.
Equals
(
0
))
{
return
"算法A"
;
...
...
@@ -44,7 +50,7 @@ namespace OnlineStore.DeviceLibrary
{
return
"算法E"
;
}
return
""
;
return
"
默认算法
"
;
}
public
static
CountParam
GetParamByPN
(
string
pn
)
{
...
...
@@ -190,7 +196,7 @@ namespace OnlineStore.DeviceLibrary
List
<
ComponetInfo
>
FZList
=
new
List
<
ComponetInfo
>();
Dictionary
<
int
,
int
>
sufaCount
=
new
Dictionary
<
int
,
int
>();
int
maxSufa
=
-
1
;
SignType
maxSufa
=
SignType
.
AUTO
;
int
maxCount
=
0
;
foreach
(
ComponetInfo
obj
in
CSVBomManager
.
allComMap
.
Values
)
{
...
...
@@ -199,7 +205,7 @@ namespace OnlineStore.DeviceLibrary
CountParam
p
=
GetParamByPN
(
obj
.
PartNum
);
if
(
p
!=
null
)
{
obj
.
Sufan
=
p
.
Sign
;
obj
.
Sufan
=
(
int
)
p
.
Sign
;
if
(
sufaCount
.
ContainsKey
(
obj
.
Sufan
))
{
...
...
@@ -213,7 +219,7 @@ namespace OnlineStore.DeviceLibrary
if
(
sufaCount
[
obj
.
Sufan
]
>
maxCount
)
{
maxCount
=
sufaCount
[
obj
.
Sufan
];
maxSufa
=
obj
.
Sufan
;
Enum
.
TryParse
<
SignType
>(
obj
.
Sufan
.
ToString
(),
out
maxSufa
)
;
}
}
FZList
.
Add
(
obj
);
...
...
@@ -244,7 +250,7 @@ namespace OnlineStore.DeviceLibrary
}
public
class
CountParam
{
public
CountParam
(
string
pn
,
int
th
=
0
,
int
size
=
0
,
int
sign
=
0
,
int
value
=
0
)
public
CountParam
(
string
pn
,
int
th
=
0
,
int
size
=
0
,
SignType
sign
=
SignType
.
AUTO
,
int
value
=
0
)
{
this
.
PN
=
pn
;
this
.
Threshold
=
th
;
...
...
@@ -256,12 +262,12 @@ namespace OnlineStore.DeviceLibrary
public
int
Threshold
=
0
;
public
int
WindowSize
=
0
;
public
string
AreaValue
=
""
;
public
int
Sign
=
0
;
public
SignType
Sign
=
0
;
public
int
Value
=
0
;
public
string
ToStr
()
{
return
"【PN="
+
PN
+
",sign="
+
Sign
+
",value="
+
Value
+
",th="
+
Threshold
+
",wsize="
+
WindowSize
+
"】"
;
return
"【PN="
+
PN
+
",sign="
+
Sign
.
ToString
()
+
",value="
+
Value
+
",th="
+
Threshold
+
",wsize="
+
WindowSize
+
"】"
;
}
public
string
ToCSVStr
()
{
...
...
@@ -277,7 +283,9 @@ namespace OnlineStore.DeviceLibrary
if
(
array
.
Length
>=
5
)
{
string
pn
=
array
[
0
].
Trim
();
int
sign
=
Convert
.
ToInt32
(
array
[
1
].
Trim
());
SignType
sign
=
SignType
.
AUTO
;
Enum
.
TryParse
<
SignType
>(
array
[
1
].
Trim
(),
out
sign
);
int
value
=
Convert
.
ToInt32
(
array
[
2
].
Trim
());
int
th
=
Convert
.
ToInt32
(
array
[
3
].
Trim
());
int
size
=
Convert
.
ToInt32
(
array
[
4
].
Trim
());
...
...
@@ -290,7 +298,15 @@ namespace OnlineStore.DeviceLibrary
return
null
;
}
public
enum
SignType
{
IP_SMALL_PARTS
=
0
,
IP_LARGE_PARTS
=
1
,
IP_LONG_PARTS
=
2
,
IP_SQUARE_PARTS
=
3
,
IP_GEN_PARTS
=
4
,
AUTO
=
99
,
}
internal
static
string
GetCSVTitle
()
{
return
"type,sign,value,threshold,windowSize"
;
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/model/AxisBean.cs
查看文件 @
fa81c6e
...
...
@@ -275,7 +275,7 @@ namespace OnlineStore.DeviceLibrary
if
(
IOManager
.
IOValue
(
TargetIoType
,
0
).
Equals
(
TargetIoValue
))
{
AxisStopCheckMove
();
LogUtil
.
info
(
AxisName
+
"上料轴,检测到 "
+
TargetIoType
+
"="
+
TargetIoValue
+
",停止运动
"
);
LogUtil
.
info
(
AxisName
+
"上料轴,检测到 "
+
TargetIoType
+
"="
+
TargetIoValue
+
",停止运动
,AclPosition="
+
GetAclPosition
().
ToString
()
);
SuddenStop
();
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论