Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS200
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
图表
网络
创建新的问题
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 07bacd1d
由
刘韬
编写于
2025-03-05 09:14:27 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
贴标定位优化
1 个父辈
ca4d7705
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
80 行增加
和
7 行删除
DeviceLibrary/AutoScanAndLabel/LabelParam.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _LabelProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _MiddleProcess.cs
DeviceLibrary/AutoScanAndLabel/MoveStep.cs
DeviceLibrary/DeviceLibrary/CodeManager.cs
DeviceLibrary/DeviceLibrary/RemoteDecodeHelper.cs
DeviceLibrary/AutoScanAndLabel/LabelParam.cs
查看文件 @
07bacd1
...
@@ -47,6 +47,7 @@ namespace DeviceLibrary
...
@@ -47,6 +47,7 @@ namespace DeviceLibrary
/// 料盘宽度
/// 料盘宽度
/// </summary>
/// </summary>
public
int
PlateW
{
get
;
set
;
}
public
int
PlateW
{
get
;
set
;
}
public
string
BitmapBase64
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 是否是入料NG料
/// 是否是入料NG料
/// </summary>
/// </summary>
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _LabelProcess.cs
查看文件 @
07bacd1
...
@@ -296,15 +296,15 @@ namespace DeviceLibrary
...
@@ -296,15 +296,15 @@ namespace DeviceLibrary
//计算贴标角度的脉冲值
//计算贴标角度的脉冲值
int
labelAxisPos
=
Config
.
Label_R_360
/
350
*
labelAngle
;
int
labelAxisPos
=
Config
.
Label_R_360
/
350
*
labelAngle
;
L
ogUtil
.
info
(
$
"贴标角度脉冲{labelAxisPos}"
);
L
abelMoveInfo
.
log
(
$
"贴标角度脉冲{labelAxisPos}"
);
//计算像素点位与中心点的差
//计算像素点位与中心点的差
Label_p3
=
new
Point
(
p
.
X
-
Right_Batch_Point
.
X
,
p
.
Y
-
Right_Batch_Point
.
Y
);
Label_p3
=
new
Point
(
p
.
X
-
Right_Batch_Point
.
X
,
p
.
Y
-
Right_Batch_Point
.
Y
);
//计算像素*脉冲像素比得到脉冲值+中心点基准脉冲
//计算像素*脉冲像素比得到脉冲值+中心点基准脉冲
int
xDiff
=
(
int
)(
Label_p3
.
X
*
Config
.
Cam_Pixel_X_Ratio
);
int
xDiff
=
(
int
)(
Label_p3
.
X
*
Config
.
Cam_Pixel_X_Ratio
);
int
yDiff
=
(
int
)(
Label_p3
.
Y
*
Config
.
Cam_Pixel_Y_Ratio
);
int
yDiff
=
(
int
)(
Label_p3
.
Y
*
Config
.
Cam_Pixel_Y_Ratio
);
L
ogUtil
.
info
(
$
"贴标XY脉冲差:X:{xDiff}={Label_p3.X}*{Config.Cam_Pixel_X_Ratio}, Y:{yDiff}={Label_p3.Y}*{Config.Cam_Pixel_Y_Ratio},"
);
L
abelMoveInfo
.
log
(
$
"贴标XY脉冲差:X:{xDiff}={Label_p3.X}*{Config.Cam_Pixel_X_Ratio}, Y:{yDiff}={Label_p3.Y}*{Config.Cam_Pixel_Y_Ratio},"
);
if
(
LabelMoveInfo
.
MoveParam
.
PlateW
==
7
)
if
(
false
&&
LabelMoveInfo
.
MoveParam
.
PlateW
==
7
)
{
{
LabelMoveInfo
.
log
(
"当前盘为7寸"
);
LabelMoveInfo
.
log
(
"当前盘为7寸"
);
double
x
=
xDiff
;
double
x
=
xDiff
;
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _MiddleProcess.cs
查看文件 @
07bacd1
...
@@ -71,6 +71,12 @@ namespace DeviceLibrary
...
@@ -71,6 +71,12 @@ namespace DeviceLibrary
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
R11_NextReel
);
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
R11_NextReel
);
MiddleMoveInfo
.
MoveParam
.
PlateW
=
GetTrayWidth
();
MiddleMoveInfo
.
MoveParam
.
PlateW
=
GetTrayWidth
();
MiddleMoveInfo
.
log
(
$
"通知右侧料串,料已取走,获取盘宽{MiddleMoveInfo.MoveParam.PlateW}"
);
MiddleMoveInfo
.
log
(
$
"通知右侧料串,料已取走,获取盘宽{MiddleMoveInfo.MoveParam.PlateW}"
);
//Task.Run(() => {
// CodeManager.NS100Service(MiddleMoveInfo, MiddleMoveInfo.MoveParam.BitmapBase64, MiddleMoveInfo.MoveParam.codeInfos, MiddleMoveInfo.MoveParam.PlateW);
//}).ContinueWith((t) => {
// MiddleMoveInfo.NextMoveStep(MoveStep.M06);
//});
}
}
else
if
(
LeftMoveInfo
.
MoveStep
==
MoveStep
.
L10_WaitReelPut
)
else
if
(
LeftMoveInfo
.
MoveStep
==
MoveStep
.
L10_WaitReelPut
)
{
{
...
@@ -104,6 +110,8 @@ namespace DeviceLibrary
...
@@ -104,6 +110,8 @@ namespace DeviceLibrary
}
}
break
;
break
;
//NG料进入NG流程,正常入正常流程
//NG料进入NG流程,正常入正常流程
case
MoveStep
.
M06_Wait
:
break
;
case
MoveStep
.
M06
:
case
MoveStep
.
M06
:
if
(
MiddleMoveInfo
.
MoveParam
.
IsNg
)
if
(
MiddleMoveInfo
.
MoveParam
.
IsNg
)
{
{
...
...
DeviceLibrary/AutoScanAndLabel/MoveStep.cs
查看文件 @
07bacd1
...
@@ -90,6 +90,7 @@ namespace DeviceLibrary
...
@@ -90,6 +90,7 @@ namespace DeviceLibrary
M03
,
M03
,
M04
,
M04
,
M05
,
M05
,
M06_Wait
,
M06
,
M06
,
M07
,
M07
,
M_ReturnToP1
,
M_ReturnToP1
,
...
...
DeviceLibrary/DeviceLibrary/CodeManager.cs
查看文件 @
07bacd1
...
@@ -199,7 +199,7 @@ namespace DeviceLibrary
...
@@ -199,7 +199,7 @@ namespace DeviceLibrary
{
{
//RemoteDecodeHelper_mod.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper_mod.RemoteDecodeParam();
//RemoteDecodeHelper_mod.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper_mod.RemoteDecodeParam();
//webResult = RemoteDecodeHelper_mod.DecodeRequest(bmp, remoteDecodeParam);
//webResult = RemoteDecodeHelper_mod.DecodeRequest(bmp, remoteDecodeParam);
webResult
=
NeoSacnRequest_ordinary
(
bmp
,
PlateW
);
webResult
=
NeoSacnRequest_ordinary
(
BitmapToBase64
(
bmp
)
,
PlateW
);
}
}
if
(
webResult
==
null
)
if
(
webResult
==
null
)
{
{
...
@@ -276,6 +276,70 @@ namespace DeviceLibrary
...
@@ -276,6 +276,70 @@ namespace DeviceLibrary
}
}
return
(
codeList
,
keyword
,
bitmapfilename
,
newpointanlge
);
return
(
codeList
,
keyword
,
bitmapfilename
,
newpointanlge
);
}
}
public
static
void
NS100Service
(
MoveInfo
moveInfo
,
string
bitmapBase64
,
List
<
CodeLibrary
.
CodeInfo
>
codeInfos
,
int
PlateW
)
{
WebResultCode
webResult
;
List
<
CodeInfo
>
codeList
=
new
List
<
CodeInfo
>();
Dictionary
<
string
,
string
>
keyword
=
new
Dictionary
<
string
,
string
>();
Dictionary
<
string
,
int
>
newpointanlge
=
new
Dictionary
<
string
,
int
>();
if
(
iscode
)
{
moveInfo
.
log
(
$
"开始请求ns100服务:识别条码为:{string.Join("
##
", codeInfos.Select(a => a.CodeStr + $"
@
@x
:{
a
.
X
};
y
:{
a
.
Y
};
角度
{
a
.
Orientation
}
"))}"
);
webResult
=
NeoSacnRequest
(
bitmapBase64
,
codeInfos
,
PlateW
);
}
else
{
//RemoteDecodeHelper_mod.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper_mod.RemoteDecodeParam();
//webResult = RemoteDecodeHelper_mod.DecodeRequest(bmp, remoteDecodeParam);
webResult
=
NeoSacnRequest_ordinary
(
bitmapBase64
,
PlateW
);
}
if
(
webResult
==
null
)
{
moveInfo
.
log
(
"调用NS100外部转码失败"
);
}
else
if
(
webResult
.
ErrorCode
!=
0
)
{
moveInfo
.
log
(
"调用NS100转码错误:"
+
webResult
.
ErrorCode
+
","
+
webResult
.
Msg
);
}
else
{
foreach
(
var
code
in
webResult
.
workCodeInfo
)
{
CodeInfo
codeInfo
=
new
CodeInfo
()
{
CodeStr
=
code
.
Text
,
X
=
(
int
)
code
.
Center
.
X
,
Y
=
(
int
)
code
.
Center
.
Y
,
CodeType
=
code
.
CodeType
,
Orientation
=
code
.
Angle
,
};
codeList
.
Add
(
codeInfo
);
}
foreach
(
var
code
in
webResult
.
workCodeKeyword
)
{
if
(!
keyword
.
ContainsKey
(
code
.
Key
))
{
keyword
.
Add
(
code
.
Key
,
code
.
Value
);
}
}
newpointanlge
.
Add
(
"PointX"
,
webResult
.
positionAngle
.
X
);
newpointanlge
.
Add
(
"PointY"
,
webResult
.
positionAngle
.
Y
);
newpointanlge
.
Add
(
"Angle"
,
webResult
.
positionAngle
.
Angle
);
if
(
webResult
.
positionAngle
.
IsCodeUsed
!=
null
)
{
newpointanlge
.
Add
(
"IsCodeUsed"
,
Array
.
FindIndex
(
webResult
.
positionAngle
.
IsCodeUsed
,
x
=>
x
));
;
}
LogUtil
.
info
(
$
"贴标数据X={webResult.positionAngle.X};Y={webResult.positionAngle.Y};角度={webResult.positionAngle.Angle}"
);
}
}
/// <summary>
/// <summary>
///
///
/// </summary>
/// </summary>
...
...
DeviceLibrary/DeviceLibrary/RemoteDecodeHelper.cs
查看文件 @
07bacd1
...
@@ -154,16 +154,15 @@ public class RemoteDecodeHelper_mod
...
@@ -154,16 +154,15 @@ public class RemoteDecodeHelper_mod
return
resultCode
;
return
resultCode
;
}
}
public
static
WebResultCode
NeoSacnRequest_ordinary
(
Bitmap
bitmap
,
int
PlateW
)
public
static
WebResultCode
NeoSacnRequest_ordinary
(
string
bitmapBase64
,
int
PlateW
)
{
{
WebResultCode
resultCode
=
null
;
WebResultCode
resultCode
=
null
;
try
try
{
{
CheckAndRunServer
();
CheckAndRunServer
();
BitmapData
bitmapData
=
new
BitmapData
();
BitmapData
bitmapData
=
new
BitmapData
();
string
iamgestr
=
BitmapToBase64
(
bitmap
);
List
<
BarcodeInfos
>
barcodeInfos
=
new
List
<
BarcodeInfos
>();
List
<
BarcodeInfos
>
barcodeInfos
=
new
List
<
BarcodeInfos
>();
bitmapData
.
ImageData
=
iamgestr
;
bitmapData
.
ImageData
=
bitmapBase64
;
bitmapData
.
BarCodeList
=
barcodeInfos
;
bitmapData
.
BarCodeList
=
barcodeInfos
;
bitmapData
.
X
=
RobotManage
.
Config
.
Right_Batch_X
;
bitmapData
.
X
=
RobotManage
.
Config
.
Right_Batch_X
;
bitmapData
.
Y
=
RobotManage
.
Config
.
Right_Batch_Y
;
bitmapData
.
Y
=
RobotManage
.
Config
.
Right_Batch_Y
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论