Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
AutoCountMachine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit cbf0aa24
由
LN
编写于
2020-06-24 15:33:47 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
历史记录查询修改
1 个父辈
9475593b
全部展开
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
133 行增加
和
87 行删除
RC1266-AutoCountMachine/dll/X-Ray/area.txt
RC1266-AutoCountMachine/source/AutoCountClient/FrmAnalyze.Designer.cs
RC1266-AutoCountMachine/source/AutoCountClient/FrmAnalyze.cs
RC1266-AutoCountMachine/source/AutoCountClient/FrmAnalyze.resx
RC1266-AutoCountMachine/source/AutoCountClient/FrmXRay.Designer.cs
RC1266-AutoCountMachine/source/AutoCountClient/FrmXRay.cs
RC1266-AutoCountMachine/source/AutoCountClient/FrmXRay.resx
RC1266-AutoCountMachine/source/AutoCountClient/data/DB.db3
RC1266-AutoCountMachine/source/DeviceLibrary/XRAY/countParam.csv
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip_Partial.cs
RC1266-AutoCountMachine/dll/X-Ray/area.txt
0 → 100644
查看文件 @
cbf0aa2
5S1 2 3
6C1D1 2 5
6D551 2 7
7H5S1 2 3
RC1266-AutoCountMachine/source/AutoCountClient/FrmAnalyze.Designer.cs
查看文件 @
cbf0aa2
此文件的差异被折叠,
点击展开。
RC1266-AutoCountMachine/source/AutoCountClient/FrmAnalyze.cs
查看文件 @
cbf0aa2
...
...
@@ -31,8 +31,9 @@ namespace OnlineStore.AutoCountClient
}
else
{
DateTime
time1
=
DateTime
.
Now
.
AddDays
(-
4
);
dtpStartTime
.
Value
=
new
DateTime
(
time1
.
Year
,
time1
.
Month
,
time1
.
Day
,
0
,
0
,
0
);
DateTime
time1
=
DateTime
.
Now
.
AddHours
(-
6
);
//dtpStartTime.Value = new DateTime(time1.Year, time1.Month, time1.Day, 0, 0, 0);
dtpStartTime
.
Value
=
time1
;
DateTime
time
=
DateTime
.
Now
.
AddDays
(-
1
);
dtpEndTime
.
Value
=
new
DateTime
(
time
.
Year
,
time
.
Month
,
time
.
Day
,
23
,
59
,
59
);
dtpEndTime
.
Value
=
DateTime
.
Now
;
...
...
@@ -66,10 +67,16 @@ namespace OnlineStore.AutoCountClient
PreStartTime
=
startTime
;
PreEndTime
=
endTime
;
string
code
=
txtCode
.
Text
.
Trim
();
try
{
lastList
=
new
List
<
XRayHistory
>();
string
[][]
array
=
null
;
bool
result
=
RobotManager
.
robot
.
sQLite
.
Select
(
code
,
startTime
.
ToString
(),
endTime
.
ToString
(),
out
array
);
LogUtil
.
error
(
"查数据【"
+
code
+
"】【"
+
startTime
.
ToString
()
+
"】【"
+
endTime
.
ToString
()
+
"】结果:"
+
result
+
","
+
RobotManager
.
robot
.
sQLite
.
ErrInfo
);
string
str
=
"yyyy-MM-dd HH:mm:ss"
;
string
startStr
=
startTime
.
ToString
(
str
);
string
endStr
=
endTime
.
ToString
(
str
);
bool
result
=
RobotManager
.
robot
.
sQLite
.
Select
(
code
,
startStr
,
endStr
,
out
array
);
LogUtil
.
error
(
"查数据【"
+
code
+
"】【"
+
startStr
+
"】【"
+
endStr
+
"】结果:"
+
result
+
","
+
RobotManager
.
robot
.
sQLite
.
ErrInfo
);
if
(
array
!=
null
&&
array
.
Length
>
0
)
{
LogUtil
.
info
(
"共查询到【"
+
array
.
Length
+
"】行数据"
);
...
...
@@ -81,27 +88,27 @@ namespace OnlineStore.AutoCountClient
DataGridViewRow
view
=
new
DataGridViewRow
();
view
.
CreateCells
(
dataGridView1
);
view
.
Cells
[
0
].
Value
=
index
;
lastList
.
Add
(
new
XRayHistory
(
index
,
a
[
0
],
a
[
1
],
a
[
2
],
a
[
3
],
a
[
4
]));
for
(
int
i
=
1
;
i
<
a
.
Length
;
i
++)
if
(
a
.
Length
>=
6
)
{
view
.
Cells
[
i
].
Value
=
a
[
i
];
XRayHistory
his
=
new
XRayHistory
(
index
,
a
[
0
],
a
[
1
],
a
[
2
],
a
[
3
],
a
[
4
],
a
[
5
]);
lastList
.
Add
(
his
);
view
.
Cells
[
Column_Code
.
Index
]
.
Value
=
his
.
Code
;
view
.
Cells
[
Column_Count
.
Index
].
Value
=
his
.
Count
;
view
.
Cells
[
Column_Data
.
Index
].
Value
=
his
.
DataStr
;
view
.
Cells
[
Column_Height
.
Index
].
Value
=
his
.
Height
;
view
.
Cells
[
Column_Width
.
Index
].
Value
=
his
.
Width
;
view
.
Cells
[
Column_ImageName
.
Index
].
Value
=
his
.
FileName
;
}
//view.Cells[0].Value = point.pointNum.ToString();
//view.Cells[1].Value = point.PartNum.ToString();
//view.Cells[2].Value = point.pointName;
//view.Cells[3].Value = point.PositionX.ToString();
//view.Cells[4].Value = point.PositionY.ToString();
//view.Cells[5].Value = point.NodePositionX.ToString();
//view.Cells[6].Value = point.NodePositionY.ToString();
//view.Cells[7].Value = point.PositionNum.ToString();
//view.Cells[8].Value = point.NeedSoldering;
//view.Cells[9].Value = point.WeldTemp;
dataGridView1
.
Rows
.
Add
(
view
);
index
++;
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"查询数据出错:"
+
ex
.
ToString
());
}
}
private
void
btnBack_Click
(
object
sender
,
EventArgs
e
)
{
...
...
@@ -129,7 +136,7 @@ namespace OnlineStore.AutoCountClient
}
List
<
string
>
list
=
new
List
<
string
>();
list
.
Add
(
"编号,条码,高度,宽度,数量,图片文件名"
);
list
.
Add
(
"编号,条码,高度,宽度,数量,图片文件名
,时间
"
);
foreach
(
XRayHistory
obj
in
lastList
)
{
list
.
Add
(
obj
.
ToCSVStr
());
...
...
@@ -150,13 +157,14 @@ namespace OnlineStore.AutoCountClient
public
class
XRayHistory
{
public
XRayHistory
(
int
num
,
string
code
,
string
h
,
string
w
,
string
c
,
string
fname
)
public
XRayHistory
(
int
num
,
string
code
,
string
h
,
string
w
,
string
c
,
string
fname
,
string
dataStr
)
{
this
.
Code
=
code
;
this
.
Height
=
h
;
this
.
Width
=
w
;
this
.
Count
=
c
;
this
.
FileName
=
fname
;
this
.
DataStr
=
dataStr
;
}
public
int
Num
=
0
;
...
...
@@ -169,10 +177,11 @@ namespace OnlineStore.AutoCountClient
public
string
Count
=
""
;
public
string
FileName
=
""
;
public
string
DataStr
=
""
;
public
string
ToCSVStr
()
{
return
Num
+
","
+
Code
+
","
+
Height
+
","
+
Width
+
","
+
Count
+
","
+
FileName
+
","
;
return
Num
+
","
+
Code
+
","
+
Height
+
","
+
Width
+
","
+
Count
+
","
+
FileName
+
","
+
DataStr
;
}
}
}
RC1266-AutoCountMachine/source/AutoCountClient/FrmAnalyze.resx
查看文件 @
cbf0aa2
...
...
@@ -123,33 +123,18 @@
<metadata name="Column_Code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Width.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Height.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="Column_Data.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_ImageName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Num.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Width.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Height.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_ImageName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
...
...
RC1266-AutoCountMachine/source/AutoCountClient/FrmXRay.Designer.cs
查看文件 @
cbf0aa2
此文件的差异被折叠,
点击展开。
RC1266-AutoCountMachine/source/AutoCountClient/FrmXRay.cs
查看文件 @
cbf0aa2
...
...
@@ -424,15 +424,22 @@ namespace OnlineStore.AutoCountClient
btnWorkTest
.
Enabled
=
false
;
try
{
string
filePath
=
txtImage
.
Text
.
Trim
();
if
(!
File
.
Exists
(
filePath
))
{
MessageBox
.
Show
(
"请先选择正确的图片"
);
return
;
}
txtResult
.
Text
=
"点料中..."
;
int
th
=
(
int
)
numTh
.
Value
;
int
wsize
=
(
int
)
numWSize
.
Value
;
int
outCount
=
0
;
// equipBean.countImage.GetCount(th, out outCount);
int
n
=
equipBean
.
carerayImage
.
Get
Count
(
2
,
3
,
out
outCount
,
out
Asa
.
API
.
EyemImage
tpDstImg
);
int
n
=
equipBean
.
carerayImage
.
Get
LocalCount
(
filePath
,
th
,
wsize
,
out
outCount
,
out
Asa
.
API
.
EyemImage
tpDstImg
);
txtResult
.
Text
=
outCount
.
ToString
();
LogUtil
.
info
(
equipBean
.
Name
+
"用户点击 点料测试 结果["
+
n
+
"]:"
+
outCount
);
LogUtil
.
info
(
equipBean
.
Name
+
"用户点击 点料测试
【"
+
filePath
+
"】【"
+
th
+
"】【"
+
wsize
+
"】
结果["
+
n
+
"]:"
+
outCount
);
}
catch
(
Exception
ex
)
{
...
...
@@ -450,6 +457,21 @@ namespace OnlineStore.AutoCountClient
MessageBox
.
Show
(
"保存阈值["
+
th
+
"]成功!"
);
LogUtil
.
info
(
"用户点击:保存阈值["
+
th
+
"]成功!"
);
}
private
void
btnSelImage_Click
(
object
sender
,
EventArgs
e
)
{
System
.
Windows
.
Forms
.
OpenFileDialog
openDialog
=
new
System
.
Windows
.
Forms
.
OpenFileDialog
();
openDialog
.
Title
=
"请选择要点料的图片"
;
openDialog
.
Filter
=
"(*.png)|*.png"
;
openDialog
.
DefaultExt
=
"png"
;
openDialog
.
InitialDirectory
=
Application
.
StartupPath
+
@"\XRAY\tif"
;
System
.
Windows
.
Forms
.
DialogResult
result
=
openDialog
.
ShowDialog
();
if
(
result
==
System
.
Windows
.
Forms
.
DialogResult
.
Cancel
)
{
return
;
}
txtImage
.
Text
=
openDialog
.
FileName
;
}
}
}
...
...
RC1266-AutoCountMachine/source/AutoCountClient/FrmXRay.resx
查看文件 @
cbf0aa2
...
...
@@ -120,6 +120,9 @@
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 11</value>
</metadata>
<metadata name="fileSystemWatcher1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>107, 11</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
...
...
RC1266-AutoCountMachine/source/AutoCountClient/data/DB.db3
查看文件 @
cbf0aa2
此文件类型无法预览
RC1266-AutoCountMachine/source/DeviceLibrary/XRAY/countParam.csv
查看文件 @
cbf0aa2
类型,阈值,面积
6J.42001.181,45,16
TY.7H230.00M,45,
6H.12160.0RH,45,11
8C.R2003.H81,45,35
8C.2R006.A8H,45,
8C.1R004.D8H,45,
类型,阈值,窗口大小
6D5S1,2,3
6C1D1,2,5
6D551,2,7
7H5S1,2,3
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip.cs
查看文件 @
cbf0aa2
...
...
@@ -39,7 +39,7 @@ namespace OnlineStore.DeviceLibrary
// private string path2_png = Application.StartupPath + @"\XRAY\png";
private
string
path2_out
=
Application
.
StartupPath
+
@"\XRAY\out\"
;
private
string
path3_area
=
Application
.
StartupPath
+
@"\XRAY\area.txt"
;
private
string
configPath
=
Application
.
StartupPath
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
CounParamConfig
);
private
Dictionary
<
string
,
CountParam
>
countParamMap
=
new
Dictionary
<
string
,
CountParam
>();
public
X_RAY_Equip
(
string
cid
,
XRay_Config
config
)
...
...
@@ -103,40 +103,7 @@ namespace OnlineStore.DeviceLibrary
{
System
.
IO
.
Directory
.
CreateDirectory
(
path2_out
);
}
countParamMap
=
new
Dictionary
<
string
,
CountParam
>();
if
(
File
.
Exists
(
configPath
))
{
try
{
string
[]
lines
=
File
.
ReadAllLines
(
configPath
);
int
index
=
-
1
;
foreach
(
string
line
in
lines
)
{
index
++;
if
(
index
.
Equals
(
0
))
{
continue
;
}
CountParam
param
=
CountParam
.
NewParam
(
line
);
if
(
param
!=
null
)
{
if
(!
countParamMap
.
ContainsKey
(
param
.
PN
))
{
countParamMap
.
Add
(
param
.
PN
,
param
);
}
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"解析点料配置文件【"
+
configPath
+
"】出错:"
+
ex
.
ToString
());
}
LogUtil
.
info
(
"加载点料参数共【"
+
countParamMap
.
Count
+
"】条有效数据"
+
configPath
);
}
else
{
LogUtil
.
error
(
"未找到点料参数文件:"
+
configPath
);
}
LoadParamMap
();
}
catch
(
Exception
ex
)
{
...
...
@@ -397,6 +364,46 @@ namespace OnlineStore.DeviceLibrary
return
msg
;
}
private
void
LoadParamMap
()
{
countParamMap
=
new
Dictionary
<
string
,
CountParam
>();
string
configPath
=
Application
.
StartupPath
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
CounParamConfig
);
if
(
File
.
Exists
(
configPath
))
{
try
{
string
[]
lines
=
File
.
ReadAllLines
(
configPath
);
int
index
=
-
1
;
foreach
(
string
line
in
lines
)
{
index
++;
if
(
index
.
Equals
(
0
))
{
continue
;
}
CountParam
param
=
CountParam
.
NewParam
(
line
);
if
(
param
!=
null
)
{
if
(!
countParamMap
.
ContainsKey
(
param
.
PN
))
{
countParamMap
.
Add
(
param
.
PN
,
param
);
}
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"解析点料配置文件【"
+
configPath
+
"】出错:"
+
ex
.
ToString
());
}
LogUtil
.
info
(
"加载点料参数共【"
+
countParamMap
.
Count
+
"】条有效数据"
+
configPath
);
}
else
{
LogUtil
.
error
(
"未找到点料参数文件:"
+
configPath
);
}
}
}
public
class
CountParam
...
...
@@ -407,8 +414,15 @@ namespace OnlineStore.DeviceLibrary
this
.
Threshold
=
th
;
this
.
AreaValue
=
area
;
}
public
CountParam
(
string
pn
,
int
th
,
int
size
)
{
this
.
PN
=
pn
;
this
.
Threshold
=
th
;
this
.
WindowSize
=
size
;
}
public
string
PN
=
""
;
public
int
Threshold
=
0
;
public
int
WindowSize
=
0
;
public
string
AreaValue
=
""
;
internal
static
CountParam
NewParam
(
string
line
)
...
...
@@ -420,9 +434,9 @@ namespace OnlineStore.DeviceLibrary
{
string
pn
=
array
[
0
].
Trim
();
int
th
=
Convert
.
ToInt32
(
array
[
1
].
Trim
());
string
a
=
array
[
2
].
Trim
(
);
int
size
=
Convert
.
ToInt32
(
array
[
2
].
Trim
()
);
return
new
CountParam
(
pn
,
th
,
a
);
return
new
CountParam
(
pn
,
th
,
size
);
}
}
catch
(
Exception
ex
)
...
...
@@ -431,6 +445,8 @@ namespace OnlineStore.DeviceLibrary
return
null
;
}
}
}
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip_Partial.cs
查看文件 @
cbf0aa2
...
...
@@ -326,7 +326,7 @@ namespace OnlineStore.DeviceLibrary
private
string
lastFileName
=
""
;
private
int
lastTh
=
0
;
private
int
lastWSize
=
0
;
private
void
XW15_GetResult
()
{
if
(
IOValue
(
IO_Type
.
X_Lock_On
).
Equals
(
IO_VALUE
.
LOW
))
...
...
@@ -346,8 +346,9 @@ namespace OnlineStore.DeviceLibrary
//WorkLog("点料:获取点料结果[" + lastTh + "]=【" + count + "】,result=" + result + ",保存并上传结果");
WorkLog
(
"点料:开始调用 countImage.GetCount "
);
int
n
=
carerayImage
.
GetCount
(
2
,
3
,
out
count
,
out
Asa
.
API
.
EyemImage
tpDstImg
);
WorkLog
(
"点料:获取点料结果 【"
+
count
+
"】,n ="
+
n
+
",保存并上传结果"
);
string
fileP
=
path1_tif
+
@"\"
+
lastFileName
;
int
n
=
carerayImage
.
GetLocalCount
(
fileP
,
lastTh
,
lastWSize
,
out
count
,
out
Asa
.
API
.
EyemImage
tpDstImg
);
WorkLog
(
"点料:获取点料结果 【"
+
count
+
"】【"
+
lastTh
+
"】【"
+
lastWSize
+
"】,n ="
+
n
+
",保存并上传结果"
);
if
(
Work_ReelInfo
.
WareCount
<=
0
)
{
...
...
@@ -475,20 +476,28 @@ namespace OnlineStore.DeviceLibrary
private
void
UpdateArea
(
string
codeStr
)
{
lastTh
=
ThresholdValue
;
lastWSize
=
3
;
string
[]
codeArray
=
codeStr
.
Split
(
';'
);
string
fileValue
=
""
;
string
area
=
""
;
if
(
codeArray
.
Length
.
Equals
(
2
))
{
string
pn
=
codeArray
[
0
];
string
type
=
pn
.
Substring
(
0
,
2
)
+
pn
.
Substring
(
pn
.
Length
-
3
,
3
);
if
(
countParamMap
.
ContainsKey
(
pn
))
{
area
=
countParamMap
[
pn
].
AreaValue
;
fileValue
=
lastFileName
+
" "
+
area
;
lastTh
=
countParamMap
[
pn
].
Threshold
;
}
else
if
(
countParamMap
.
ContainsKey
(
type
))
{
lastTh
=
countParamMap
[
type
].
Threshold
;
lastWSize
=
countParamMap
[
type
].
WindowSize
;
}
}
LogUtil
.
info
(
"【"
+
codeStr
+
"】使用参数【"
+
lastTh
+
"】【"
+
area
+
"】,文件名【"
+
lastFileName
+
"】内容【"
+
fileValue
+
"】"
);
LogUtil
.
info
(
"【"
+
codeStr
+
"】使用参数【"
+
lastTh
+
"】【"
+
lastWSize
+
"】 "
);
//LogUtil.info("【" + codeStr + "】使用参数【" + lastTh + "】【" + area + "】,文件名【" + lastFileName + "】内容【" + fileValue + "】");
File
.
WriteAllText
(
path3_area
,
fileValue
);
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论