Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
AutoCountMachine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit ab52424f
由
LN
编写于
2020-06-15 09:01:40 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加点料参数
1 个父辈
989393cb
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
131 行增加
和
28 行删除
RC1266-AutoCountMachine/source/AutoCountClient/App.config
RC1266-AutoCountMachine/source/Common/Setting_Init.cs
RC1266-AutoCountMachine/source/DeviceLibrary/DeviceLibrary.csproj
RC1266-AutoCountMachine/source/DeviceLibrary/XRAY/area.txt
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/source/AutoCountClient/App.config
查看文件 @
ab52424
...
@@ -50,6 +50,7 @@
...
@@ -50,6 +50,7 @@
<!--
XRay
射线最后一次使用时间-->
<!--
XRay
射线最后一次使用时间-->
<
add
key
=
"XRay_Data"
value
=
"2020-6-2"
/>
<
add
key
=
"XRay_Data"
value
=
"2020-6-2"
/>
<
add
key
=
"ThresholdValue"
value
=
"30"
/>
<
add
key
=
"ThresholdValue"
value
=
"30"
/>
<
add
key
=
"CounParamConfig"
value
=
"\XRAY\countParam.csv"
/>
</
appSettings
>
</
appSettings
>
<
log4net
>
<
log4net
>
...
...
RC1266-AutoCountMachine/source/Common/Setting_Init.cs
查看文件 @
ab52424
...
@@ -83,5 +83,7 @@ namespace OnlineStore.Common
...
@@ -83,5 +83,7 @@ namespace OnlineStore.Common
public
static
string
XRay_Data
=
"XRay_Data"
;
public
static
string
XRay_Data
=
"XRay_Data"
;
public
static
string
ThresholdValue
=
"ThresholdValue"
;
public
static
string
ThresholdValue
=
"ThresholdValue"
;
public
static
string
CounParamConfig
=
"CounParamConfig"
;
}
}
}
}
RC1266-AutoCountMachine/source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
ab52424
...
@@ -139,6 +139,9 @@
...
@@ -139,6 +139,9 @@
<Content Include="Label\20200520172352.xml">
<Content Include="Label\20200520172352.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</Content>
<Content Include="XRAY\area.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="XRAY\out\out.txt">
<Content Include="XRAY\out\out.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</Content>
...
@@ -172,6 +175,9 @@
...
@@ -172,6 +175,9 @@
<None Include="RobotConfig\Config_OutputEquip.csv">
<None Include="RobotConfig\Config_OutputEquip.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</None>
<None Include="XRAY\countParam.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</ItemGroup>
<ItemGroup />
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/XRAY/area.txt
0 → 100644
查看文件 @
ab52424
001279-4005.png 40
\ No newline at end of file
\ No newline at end of file
RC1266-AutoCountMachine/source/DeviceLibrary/XRAY/countParam.csv
0 → 100644
查看文件 @
ab52424
类型,阈值,面积
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,
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip.cs
查看文件 @
ab52424
...
@@ -4,6 +4,7 @@ using OnlineStore.LoadCSVLibrary;
...
@@ -4,6 +4,7 @@ using OnlineStore.LoadCSVLibrary;
using
System
;
using
System
;
using
System.Collections.Concurrent
;
using
System.Collections.Concurrent
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading
;
using
System.Threading
;
...
@@ -14,7 +15,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -14,7 +15,7 @@ namespace OnlineStore.DeviceLibrary
{
{
public
partial
class
X_RAY_Equip
:
EquipBase
public
partial
class
X_RAY_Equip
:
EquipBase
{
{
public
bool
OpenXLine
=
true
;
public
bool
OpenXLine
=
true
;
public
ReelInfo
In_ReelInfo
=
new
ReelInfo
();
public
ReelInfo
In_ReelInfo
=
new
ReelInfo
();
public
ReelInfo
Work_ReelInfo
=
new
ReelInfo
();
public
ReelInfo
Work_ReelInfo
=
new
ReelInfo
();
...
@@ -35,8 +36,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -35,8 +36,11 @@ namespace OnlineStore.DeviceLibrary
private
string
path_XRAY
=
Application
.
StartupPath
+
@"\XRAY\"
;
private
string
path_XRAY
=
Application
.
StartupPath
+
@"\XRAY\"
;
private
string
path1_tif
=
Application
.
StartupPath
+
@"\XRAY\tif"
;
private
string
path1_tif
=
Application
.
StartupPath
+
@"\XRAY\tif"
;
private
string
path2_png
=
Application
.
StartupPath
+
@"\XRAY\png"
;
// private string path2_png = Application.StartupPath + @"\XRAY\png";
private
string
path3_out
=
Application
.
StartupPath
+
@"\XRAY\out"
;
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
)
public
X_RAY_Equip
(
string
cid
,
XRay_Config
config
)
{
{
...
@@ -50,8 +54,9 @@ namespace OnlineStore.DeviceLibrary
...
@@ -50,8 +54,9 @@ namespace OnlineStore.DeviceLibrary
ledProcessTimer
.
Elapsed
+=
LedProcess
;
ledProcessTimer
.
Elapsed
+=
LedProcess
;
IoCheckTimer
.
Elapsed
+=
IoCheckTimerProcess
;
IoCheckTimer
.
Elapsed
+=
IoCheckTimerProcess
;
MoveInfo
=
new
RobotMoveInfo
(
Name
);
MoveInfo
=
new
RobotMoveInfo
(
Name
);
SecMoveInfo
=
new
RobotMoveInfo
(
Name
.
Trim
()
+
"-SMove"
);
SecMoveInfo
=
new
RobotMoveInfo
(
Name
.
Trim
()
+
"-SMove"
);
Task
.
Factory
.
StartNew
(
delegate
{
Task
.
Factory
.
StartNew
(
delegate
{
XRayLoad
();
XRayLoad
();
});
});
...
@@ -61,12 +66,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -61,12 +66,11 @@ namespace OnlineStore.DeviceLibrary
{
{
try
try
{
{
countImage
=
new
CountImage
(
"XRay"
);
countImage
=
new
CountImage
(
"XRay"
);
countImage
.
SetDirectory
(
path1_tif
,
path2_
png
,
path3_out
);
countImage
.
SetDirectory
(
path1_tif
,
path2_
out
,
path3_area
);
LogUtil
.
info
(
Name
+
"CountImage path1【"
+
path1_tif
+
"】"
);
LogUtil
.
info
(
Name
+
"CountImage path1【"
+
path1_tif
+
"】"
);
LogUtil
.
info
(
Name
+
"CountImage path2【"
+
path2_
png
+
"】"
);
LogUtil
.
info
(
Name
+
"CountImage path2【"
+
path2_
out
+
"】"
);
LogUtil
.
info
(
Name
+
"CountImage path3【"
+
path3_
out
+
"】"
);
LogUtil
.
info
(
Name
+
"CountImage path3【"
+
path3_
area
+
"】"
);
LogUtil
.
info
(
Name
+
"CountImage SetDirectory: 完成"
);
LogUtil
.
info
(
Name
+
"CountImage SetDirectory: 完成"
);
carerayImage
=
new
CarerayImage
(
"XRay"
);
carerayImage
=
new
CarerayImage
(
"XRay"
);
...
@@ -91,13 +95,47 @@ namespace OnlineStore.DeviceLibrary
...
@@ -91,13 +95,47 @@ namespace OnlineStore.DeviceLibrary
{
{
System
.
IO
.
Directory
.
CreateDirectory
(
path1_tif
);
System
.
IO
.
Directory
.
CreateDirectory
(
path1_tif
);
}
}
if
(!
System
.
IO
.
Directory
.
Exists
(
path2_png
))
//if (!System.IO.Directory.Exists(path2_png))
//{
// System.IO.Directory.CreateDirectory(path2_png);
//}
if
(!
System
.
IO
.
Directory
.
Exists
(
path2_out
))
{
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
))
{
{
System
.
IO
.
Directory
.
CreateDirectory
(
path2_png
)
;
continue
;
}
}
if
(!
System
.
IO
.
Directory
.
Exists
(
path3_out
))
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
{
{
System
.
IO
.
Directory
.
CreateDirectory
(
path3_out
);
LogUtil
.
error
(
"未找到点料参数文件:"
+
configPath
);
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
@@ -143,7 +181,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -143,7 +181,7 @@ namespace OnlineStore.DeviceLibrary
return
false
;
return
false
;
}
}
SetAllTimer
(
false
);
SetAllTimer
(
false
);
MoveInfo
.
EndMove
();
MoveInfo
.
EndMove
();
SecMoveInfo
.
EndMove
();
SecMoveInfo
.
EndMove
();
runStatus
=
RobotRunStatus
.
HomeMoving
;
runStatus
=
RobotRunStatus
.
HomeMoving
;
...
@@ -175,7 +213,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -175,7 +213,7 @@ namespace OnlineStore.DeviceLibrary
isNoAirCheck
=
false
;
isNoAirCheck
=
false
;
isInPro
=
false
;
isInPro
=
false
;
MoveInfo
.
NextMoveStep
(
StepEnum
.
XR01_CloseXLock
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
XR01_CloseXLock
);
WorkLog
(
"XRay复位 :关闭X光互锁信号"
);
WorkLog
(
"XRay复位 :关闭X光互锁信号"
);
IOMove
(
IO_Type
.
X_Lock_On
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
X_Lock_On
,
IO_VALUE
.
LOW
);
}
}
...
@@ -261,12 +299,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -261,12 +299,6 @@ namespace OnlineStore.DeviceLibrary
IOMove
(
IO_Type
.
X_InLine_Run
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
X_InLine_Run
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
X_MLine_Run
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
X_MLine_Run
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
X_OLine_Run
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
X_OLine_Run
,
IO_VALUE
.
LOW
);
//IOMove(IO_Type.X_InDoor_Up, IO_VALUE.LOW);
//IOMove(IO_Type.X_InDoor_Down, IO_VALUE.LOW);
//IOMove(IO_Type.X_OutDoor_Up, IO_VALUE.LOW);
//IOMove(IO_Type.X_OutDoor_Down, IO_VALUE.LOW);
//IOMove(IO_Type.X_StopCylinder_Up, IO_VALUE.LOW);
//IOMove(IO_Type.X_StopCylinder_Down, IO_VALUE.LOW);
}
}
...
@@ -359,5 +391,39 @@ namespace OnlineStore.DeviceLibrary
...
@@ -359,5 +391,39 @@ namespace OnlineStore.DeviceLibrary
return
msg
;
return
msg
;
}
}
}
}
public
class
CountParam
{
public
CountParam
(
string
pn
,
int
th
,
string
area
)
{
this
.
PN
=
pn
;
this
.
Threshold
=
th
;
this
.
AreaValue
=
area
;
}
public
string
PN
=
""
;
public
int
Threshold
=
0
;
public
string
AreaValue
=
""
;
internal
static
CountParam
NewParam
(
string
line
)
{
try
{
string
[]
array
=
line
.
Split
(
','
);
if
(
array
.
Length
>=
3
)
{
string
pn
=
array
[
0
].
Trim
();
int
th
=
Convert
.
ToInt32
(
array
[
1
].
Trim
());
string
a
=
array
[
2
].
Trim
();
return
new
CountParam
(
pn
,
th
,
a
);
}
}
catch
(
Exception
ex
)
{
}
return
null
;
}
}
}
}
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip_Partial.cs
查看文件 @
ab52424
...
@@ -5,6 +5,7 @@ using System;
...
@@ -5,6 +5,7 @@ using System;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Drawing
;
using
System.IO
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading
;
using
System.Threading
;
...
@@ -154,11 +155,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -154,11 +155,11 @@ namespace OnlineStore.DeviceLibrary
else
else
{
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
XW08_DoorClose
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
XW08_DoorClose
);
WorkLog
(
"料盘处理:左侧门关闭,右侧门关闭,准备开始点料"
);
//
WorkLog("料盘处理:左侧门关闭,右侧门关闭,准备开始点料");
//
WorkLog("料盘处理:左侧门关闭,右侧门关闭,挡停放行,准备开始点料");
WorkLog
(
"料盘处理:左侧门关闭,右侧门关闭,挡停放行,准备开始点料"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
X_InDoor_Down
,
IO_Type
.
X_InDoor_Up
);
CylinderMove
(
MoveInfo
,
IO_Type
.
X_InDoor_Down
,
IO_Type
.
X_InDoor_Up
);
CylinderMove
(
MoveInfo
,
IO_Type
.
X_OutDoor_Down
,
IO_Type
.
X_OutDoor_Up
);
CylinderMove
(
MoveInfo
,
IO_Type
.
X_OutDoor_Down
,
IO_Type
.
X_OutDoor_Up
);
//
CylinderMove(MoveInfo, IO_Type.X_StopCylinder_Down, IO_Type.X_StopCylinder_Up);
CylinderMove
(
MoveInfo
,
IO_Type
.
X_StopCylinder_Down
,
IO_Type
.
X_StopCylinder_Up
);
}
}
}
}
...
@@ -306,6 +307,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -306,6 +307,7 @@ namespace OnlineStore.DeviceLibrary
}
}
private
string
lastFileName
=
""
;
private
string
lastFileName
=
""
;
private
int
lastTh
=
0
;
private
void
XW13_GetXRayImage
()
private
void
XW13_GetXRayImage
()
{
{
if
(
IOValue
(
IO_Type
.
X_Lock_On
).
Equals
(
IO_VALUE
.
LOW
))
if
(
IOValue
(
IO_Type
.
X_Lock_On
).
Equals
(
IO_VALUE
.
LOW
))
...
@@ -335,16 +337,16 @@ namespace OnlineStore.DeviceLibrary
...
@@ -335,16 +337,16 @@ namespace OnlineStore.DeviceLibrary
xRay
.
Stop
();
xRay
.
Stop
();
}
}
int
count
=
99999
;
int
count
=
99999
;
countImage
.
GetCount
(
ThresholdValue
,
out
count
);
countImage
.
GetCount
(
lastTh
,
out
count
);
InXWork
=
false
;
InXWork
=
false
;
WorkLog
(
"点料:获取点料结果["
+
ThresholdValue
+
"]=【"
+
count
+
"】,保存并上传结果"
);
WorkLog
(
"点料:获取点料结果["
+
lastTh
+
"]=【"
+
count
+
"】,保存并上传结果"
);
if
(
Work_ReelInfo
.
WareCount
<=
0
)
if
(
Work_ReelInfo
.
WareCount
<=
0
)
{
{
MoveInfo
.
MoveParam
.
WareCount
=
count
;
MoveInfo
.
MoveParam
.
WareCount
=
count
;
Work_ReelInfo
.
WareCount
=
count
;
Work_ReelInfo
.
WareCount
=
count
;
}
}
string
outF
=
path
3
_out
+
@"\"
+
lastFileName
;
string
outF
=
path
2
_out
+
@"\"
+
lastFileName
;
try
try
{
{
if
(
System
.
IO
.
File
.
Exists
(
outF
))
if
(
System
.
IO
.
File
.
Exists
(
outF
))
...
@@ -404,6 +406,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -404,6 +406,8 @@ namespace OnlineStore.DeviceLibrary
}
}
WorkLog
(
"点料:获取X射线图形,保存到: "
+
fileP
+
",备份到:"
+
backFile
+
",记录时间"
+
lastData
+
",停止X射线"
);
WorkLog
(
"点料:获取X射线图形,保存到: "
+
fileP
+
",备份到:"
+
backFile
+
",记录时间"
+
lastData
+
",停止X射线"
);
GetImageEvent
?.
Invoke
(
bmp
);
GetImageEvent
?.
Invoke
(
bmp
);
UpdateArea
(
Work_ReelInfo
.
WareCode
);
}
}
else
else
{
{
...
@@ -434,7 +438,23 @@ namespace OnlineStore.DeviceLibrary
...
@@ -434,7 +438,23 @@ namespace OnlineStore.DeviceLibrary
}
}
return
lastFileName
;
return
lastFileName
;
}
}
private
void
UpdateArea
(
string
codeStr
)
{
lastTh
=
ThresholdValue
;
string
[]
codeArray
=
codeStr
.
Split
(
';'
);
if
(
codeArray
.
Length
.
Equals
(
2
))
{
string
pn
=
codeArray
[
0
];
if
(
countParamMap
.
ContainsKey
(
pn
))
{
string
area
=
countParamMap
[
pn
].
AreaValue
;
string
fileValue
=
lastFileName
+
" "
+
area
;
lastTh
=
countParamMap
[
pn
].
Threshold
;
LogUtil
.
info
(
"【"
+
codeStr
+
"】使用参数【"
+
lastTh
+
"】【"
+
area
+
"】,文件名【"
+
lastFileName
+
"】"
);
File
.
WriteAllText
(
path3_area
,
fileValue
);
}
}
}
private
void
ClearFilePath
()
private
void
ClearFilePath
()
{
{
try
try
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论