Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
AutoCountMachine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 1995e274
由
LN
编写于
2020-07-16 14:16:25 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
上传结果后需要判断是否NG
1 个父辈
0cb31239
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
61 行增加
和
46 行删除
RC1266-AutoCountMachine/source/AutoCountClient/FrmInputEquip.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/SServerManager.cs
RC1266-AutoCountMachine/source/AutoCountClient/FrmInputEquip.cs
查看文件 @
1995e27
...
...
@@ -759,11 +759,12 @@ namespace OnlineStore.AutoCountClient
private
void
btnReturn_Click
(
object
sender
,
EventArgs
e
)
{
int
qty
=
FormUtil
.
GetIntValue
(
txtQty
)
;
int
qty
=
FormUtil
.
GetIntValue
(
txtQty
)
;
string
reelId
=
txtReelId
.
Text
;
string
pn
=
txtPN
.
Text
;
int
p
=
0
;
SServerManager
.
Return_Material
(
"测试按钮"
,
pn
+
";"
+
reelId
,
qty
);
string
msg
=
SServerManager
.
Return_Material
(
"测试按钮"
,
pn
+
";"
+
reelId
,
qty
);
}
}
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip.cs
查看文件 @
1995e27
...
...
@@ -33,6 +33,7 @@ namespace OnlineStore.DeviceLibrary
public
bool
InXWork
=
false
;
public
int
ThresholdValue
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
ThresholdValue
);
private
int
ResultMinCount
=
100
;
private
string
path_XRAY
=
Application
.
StartupPath
+
@"\XRAY\"
;
private
string
path1_tif
=
Application
.
StartupPath
+
@"\XRAY\tif"
;
...
...
@@ -62,17 +63,12 @@ namespace OnlineStore.DeviceLibrary
}
private
void
XRayLoad
()
{
try
{
//countImage = new CountImage("Count");
//countImage.SetDirectory(path1_tif, path2_out, path3_area);
//LogUtil.info(Name + "CountImage path1【" + path1_tif + "】");
//LogUtil.info(Name + "CountImage path2【" + path2_out + "】");
//LogUtil.info(Name + "CountImage path3【" + path3_area + "】");
//LogUtil.info(Name + "CountImage SetDirectory: 完成");
carerayImage
=
new
CarerayImage
(
"XRay"
);
bool
cResult
=
carerayImage
.
Open
();
LogUtil
.
info
(
Name
+
"carerayImage.Open()="
+
cResult
);
...
...
@@ -95,15 +91,16 @@ namespace OnlineStore.DeviceLibrary
{
System
.
IO
.
Directory
.
CreateDirectory
(
path1_tif
);
}
//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
);
}
LoadParamMap
();
ResultMinCount
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
ResultMinCount
);
if
(
ResultMinCount
<=
0
)
{
ResultMinCount
=
100
;
}
}
catch
(
Exception
ex
)
{
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip_Partial.cs
查看文件 @
1995e27
...
...
@@ -330,8 +330,6 @@ namespace OnlineStore.DeviceLibrary
#
region
点料处理
private
string
lastFileName
=
""
;
//private int lastTh = 0;
//private int lastWSize = 0;
private
CountParam
lastParam
=
new
CountParam
();
private
void
XW15_GetResult
()
{
...
...
@@ -341,16 +339,14 @@ namespace OnlineStore.DeviceLibrary
return
;
}
MoveInfo
.
NextMoveStep
(
StepEnum
.
XW15_GetResult
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
180000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
300000
));
try
{
if
(
xRay
.
IsRayOpen
)
{
xRay
.
Stop
();
}
int
count
=
99999
;
//WorkLog("点料:开始调用 countImage.GetCount ");
//bool result = countImage.GetCount(lastTh, out count);
//WorkLog("点料:获取点料结果[" + lastTh + "]=【" + count + "】,result=" + result + ",保存并上传结果");
string
fileP
=
path1_tif
+
@"\"
+
lastFileName
;
int
n
=
0
;
if
(
lastParam
.
Sign
.
Equals
(
0
))
...
...
@@ -363,34 +359,61 @@ namespace OnlineStore.DeviceLibrary
WorkLog
(
"点料:开始调用 carerayImage.GetLocalCountHuge "
);
n
=
carerayImage
.
GetLocalCountHuge
(
fileP
,
lastParam
.
Threshold
,
lastParam
.
WindowSize
,
out
count
,
out
Asa
.
API
.
EyemImage
tpDstImg
);
}
bool
isNg
=
false
;
int
ResultMinCount
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
ResultMinCount
);
if
(
ResultMinCount
<=
0
)
{
ResultMinCount
=
100
;
}
string
result
=
"保存并上传结果"
;
string
NgMsg
=
""
;
if
(
count
<
ResultMinCount
)
{
result
=
"点料结果小于"
+
ResultMinCount
+
",判断点料NG"
;
isNg
=
true
;
NgMsg
=
"NG:点料结果小于"
+
ResultMinCount
;
}
WorkLog
(
"点料:获取点料结果 【"
+
count
+
"】 "
+
lastParam
.
ToStr
()
+
",n ="
+
n
+
", "
+
result
);
WorkLog
(
"点料:获取点料结果 【"
+
count
+
"】 "
+
lastParam
.
ToStr
()
+
",n ="
+
n
+
", "
+
NgMsg
);
if
(
Work_ReelInfo
.
WareCount
<=
0
)
{
MoveInfo
.
MoveParam
.
WareCount
=
count
;
Work_ReelInfo
.
WareCount
=
count
;
}
InXWork
=
false
;
if
(!
isNg
&&
SServerManager
.
CanConnect
())
{
// string msg = "暂不上传";
string
msg
=
SServerManager
.
Return_Material
(
Name
,
Work_ReelInfo
.
WareCode
,
Work_ReelInfo
.
WareCount
);
if
(!
String
.
IsNullOrEmpty
(
msg
))
{
LogUtil
.
error
(
Name
+
"上传【"
+
Work_ReelInfo
.
ToStr
()
+
"】点料结果失败:"
+
msg
+
",更新状态为NG"
);
isNg
=
true
;
NgMsg
=
msg
;
}
}
if
(
isNg
)
{
MoveInfo
.
MoveParam
.
IsNgReel
=
true
;
Work_ReelInfo
.
IsNgReel
=
true
;
MoveInfo
.
MoveParam
.
NgMsg
=
"点料结果小于"
+
ResultMinCount
;
Work_ReelInfo
.
NgMsg
=
"点料结果小于"
+
ResultMinCount
;
}
MoveInfo
.
MoveParam
.
NgMsg
=
NgMsg
;
Work_ReelInfo
.
NgMsg
=
NgMsg
;
}
string
outF
=
path2_out
+
lastFileName
;
if
(!
isNg
)
{
ReadOutMsg
(
outF
);
}
else
{
outF
=
NgMsg
;
}
int
c
=
RobotManager
.
robot
.
sQLite
.
Insert
(
Work_ReelInfo
.
WareCode
,
Work_ReelInfo
.
PlateW
,
Work_ReelInfo
.
PlateH
,
count
,
outF
);
LogUtil
.
info
(
"插入数据【"
+
Work_ReelInfo
.
WareCode
+
"】【"
+
count
+
"】结果:"
+
c
+
" ,"
+
RobotManager
.
robot
.
sQLite
.
ErrInfo
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"XW15_GetResult出错:"
+
ex
.
ToString
());
}
MoveInfo
.
EndStepWait
();
}
private
bool
ReadOutMsg
(
string
outF
)
{
try
{
if
(
System
.
IO
.
File
.
Exists
(
outF
))
...
...
@@ -398,31 +421,19 @@ namespace OnlineStore.DeviceLibrary
WorkLog
(
"点料:读取结果图片【"
+
outF
+
"】"
);
Bitmap
img
=
(
Bitmap
)
Image
.
FromFile
(
outF
).
Clone
();
GetImageEvent
?.
Invoke
(
img
);
return
true
;
}
else
{
LogUtil
.
error
(
"点料:未找到结果图片【"
+
outF
+
"】"
);
}
int
c
=
RobotManager
.
robot
.
sQLite
.
Insert
(
Work_ReelInfo
.
WareCode
,
Work_ReelInfo
.
PlateW
,
Work_ReelInfo
.
PlateH
,
count
,
outF
);
LogUtil
.
info
(
"插入数据【"
+
Work_ReelInfo
.
WareCode
+
"】【"
+
count
+
"】结果:"
+
c
+
" ,"
+
RobotManager
.
robot
.
sQLite
.
ErrInfo
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"读取结果图片【"
+
outF
+
"】出错:"
+
ex
.
ToString
());
}
InXWork
=
false
;
if
(!
isNg
)
{
// string msg = "暂不上传";
string
msg
=
SServerManager
.
Return_Material
(
Name
,
Work_ReelInfo
.
WareCode
,
Work_ReelInfo
.
WareCount
);
if
(!
String
.
IsNullOrEmpty
(
msg
))
{
LogUtil
.
error
(
Name
+
"上传【"
+
Work_ReelInfo
.
ToStr
()
+
"】点料结果失败:"
+
msg
);
}
}
MoveInfo
.
EndStepWait
();
return
false
;
}
public
string
CapImage
()
{
try
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/manager/SServerManager.cs
查看文件 @
1995e27
...
...
@@ -111,7 +111,13 @@ namespace OnlineStore.DeviceLibrary
}
DateTime
startTime
=
DateTime
.
Now
;
string
resultStr
=
HttpHelper
.
Get
(
server
);
//【<?xml version="1.0" encoding="utf-8"?>< string xmlns = "http://tempuri.org/" > NG 不可退料 厂别:ST </ string >】
LogUtil
.
info
(
deviceName
+
"Return_Material "
+
FormUtil
.
GetSpanStr
(
DateTime
.
Now
-
startTime
)
+
" 【"
+
server
+
"】【"
+
resultStr
+
"】"
);
if
(
resultStr
.
Contains
(
"NG"
))
{
msg
=
resultStr
.
Replace
(
"<?xml version=\"1.0\" encoding=\"utf - 8\"?>< string xmlns = \"http://tempuri.org/\" >"
,
""
).
Replace
(
" </ string >"
,
""
);
}
}
catch
(
Exception
ex
)
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论