Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO1196_X800
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 64d60b01
由
刘韬
编写于
2022-12-05 15:02:46 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
d76580cd
隐藏空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
409 行增加
和
143 行删除
Common/util/SMF.cs
DeviceLibrary/DeviceLibrary/CodeManager.cs
DeviceLibrary/theMachine/Common.cs
DeviceLibrary/theMachine/LabelParam.cs
DeviceLibrary/theMachine/MainMachine _Common.cs
DeviceLibrary/theMachine/MainMachine.cs
DeviceLibrary/theMachine/MainMachine_Counting.cs
DeviceLibrary/theMachine/MainMachine_InCar.cs
DeviceLibrary/theMachine/MainMachine_InMove.cs
DeviceLibrary/theMachine/MainMachine_LabelProcess.cs
DeviceLibrary/theMachine/MainMachine_OutCar.cs
DeviceLibrary/theMachine/MainMachine_OutMove.cs
DeviceLibrary/theMachine/MainMachine_PrinterProcess.cs
DeviceLibrary/theMachine/MoveStep.cs
DeviceLibrary/theMachine/RobotManage.cs
LoadCVSLibrary/Config/InCarReelPostion.csv
LoadCVSLibrary/Config/LabellingPostion.csv
LoadCVSLibrary/Config/OutCarReelPostion.csv
TheMachine/Program.cs
TheMachine/SettingControl.cs
Common/util/SMF.cs
查看文件 @
64d60b0
...
...
@@ -10,7 +10,7 @@ namespace OnlineStore.Common
{
public
class
SMF
{
public
static
string
DeviceType
=
"
MIMO
"
;
public
static
string
DeviceType
=
"
20117
"
;
static
string
_server
=
Setting_Init
.
Device_Server_Address
;
static
string
server
{
...
...
DeviceLibrary/DeviceLibrary/CodeManager.cs
查看文件 @
64d60b0
...
...
@@ -182,7 +182,7 @@ namespace DeviceLibrary
[
HandleProcessCorruptedStateExceptions
]
public
static
List
<
CodeInfo
>
CameraScan
(
List
<
string
>
cameraNameList
)
public
static
(
List
<
CodeInfo
>,
string
)
CameraScan
(
List
<
string
>
cameraNameList
)
{
HashSet
<
string
>
codestr
=
new
HashSet
<
string
>();
List
<
CodeInfo
>
codeList
=
new
List
<
CodeInfo
>();
...
...
@@ -249,16 +249,16 @@ namespace DeviceLibrary
{
lock
(
codeList
)
{
LogUtil
.
info
(
"返回条码:"
+
string
.
Join
(
"#"
,
cc
.
Select
(
c
=>
{
return
c
.
CodeStr
;
}).
ToArray
()));
LogUtil
.
info
(
"返回条码:"
+
string
.
Join
(
"#"
,
cc
.
Select
(
c
=>
{
return
c
.
Code
Type
+
":"
+
c
.
Code
Str
;
}).
ToArray
()));
cc
.
ForEach
((
c
)
=>
{
//c.CodeStr = CodeManager.ReplaceCode(c.CodeStr);
if
(
c
.
CodeStr
.
StartsWith
(
"S2
0"
)
||
c
.
CodeStr
.
StartsWith
(
"AT"
))
//if ((c.CodeStr.StartsWith("S20") && c.CodeType== "Data Matrix ECC 20
0") || c.CodeStr.StartsWith("AT"))
{
if
(!
codestr
.
Contains
(
c
.
CodeStr
))
//
if (!codestr.Contains(c.CodeStr))
{
codeList
.
Add
(
c
);
codestr
.
Add
(
c
.
CodeStr
);
//
codestr.Add(c.CodeStr);
r
+=
"##"
+
c
.
CodeStr
;
}
}
...
...
@@ -273,7 +273,7 @@ namespace DeviceLibrary
}
}
}
if
(!
hasRightCode
)
//
if (!hasRightCode)
{
bitmapfilename
=
SaveImageToFile
(
"mimo"
,
cameraName
,
bmp
);
}
...
...
@@ -320,7 +320,7 @@ namespace DeviceLibrary
LogUtil
.
error
(
" 扫码出错:"
+
ex
.
ToString
());
//throw new Exception("扫码出错");
}
return
codeList
;
return
(
codeList
,
bitmapfilename
)
;
}
/// <summary>
...
...
DeviceLibrary/theMachine/Common.cs
查看文件 @
64d60b0
...
...
@@ -113,11 +113,11 @@ namespace DeviceLibrary
Pen
Greenpen
=
new
Pen
(
Color
.
Green
,
10
);
Bitmap
srcbitmap
;
//
if (File.Exists(labelParam.bitmapfilename))
//
{
//
srcbitmap = new Bitmap(labelParam.bitmapfilename);
//
}
//
else
if
(
File
.
Exists
(
labelParam
.
bitmapfilename
))
{
srcbitmap
=
new
Bitmap
(
labelParam
.
bitmapfilename
);
}
else
{
srcbitmap
=
new
Bitmap
(
3648
,
3648
);
}
...
...
@@ -135,72 +135,113 @@ namespace DeviceLibrary
Size
pointsize
=
new
Size
(
30
,
30
);
int
widthOffset
=
0
;
//Point Right_Batch_Point = new Point(RobotManage.Config.Right_Batch_X, RobotManage.Config.Right_Batch_Y);
Point
Right_Batch_Point
=
org
;
g
.
FillEllipse
(
blue
,
new
Rectangle
(
Right_Batch_Point
,
pointsize
));
g
.
FillEllipse
(
blue
,
new
Rectangle
(
org
,
pointsize
));
List
<
int
>
angles
=
new
List
<
int
>();
CodeInfo
rightcode
=
null
;
int
rightangle
=
0
;
labelParam
.
codeInfos
.
ForEach
((
c
)
=>
{
//var x = c.Y;
//var y = srcbitmap_Width - c.X;
//c.X = x;
//c.Y = y;
if
(
c
.
CodeStr
.
Contains
(
labelParam
.
ReeID
))
if
(
c
.
CodeStr
.
Length
<
5
||
c
.
CodeType
==
"2/5 Interleaved"
||
c
.
CodeType
==
"2/5 Industrial"
)
return
;
Point
op
=
new
Point
(
c
.
X
,
c
.
Y
);
var
a
=
(
int
)
getAngle
(
org
,
op
);
LogUtil
.
info
(
$
"{c.CodeType},{c.CodeStr},angles:{a}"
);
angles
.
Add
(
a
);
if
(
c
.
CodeStr
.
Contains
(
labelParam
.
ReeID
)
&&
c
.
CodeType
==
"Data Matrix ECC 200"
)
{
Point
op
=
new
Point
(
c
.
X
,
c
.
Y
);
g
.
FillEllipse
(
blue
,
new
Rectangle
(
op
,
pointsize
));
var
a
=
(
int
)
getAngle
(
Right_Batch_Point
,
op
);
a
=
a
<
0
?
360
+
a
:
a
;
//g.FillEllipse(red, new Rectangle(PointRotate(org, op, a), pointsize));
angles
.
Add
(
a
);
widthOffset
=
(
int
)
Common
.
distance
(
org
,
op
);
LogUtil
.
info
(
$
"angles:{a}, widthOffset:{widthOffset}"
);
rightcode
=
c
;
}
});
if
(
angles
.
Count
==
0
)
if
(
rightcode
!=
null
)
{
Point
op
=
new
Point
(
rightcode
.
X
,
rightcode
.
Y
);
g
.
FillEllipse
(
blue
,
new
Rectangle
(
op
,
pointsize
));
var
a
=
(
int
)
getAngle
(
org
,
op
);
a
=
a
<
0
?
360
+
a
:
a
;
//g.FillEllipse(red, new Rectangle(PointRotate(org, op, a), pointsize));
//angles.Add(a);
widthOffset
=
(
int
)
Common
.
distance
(
org
,
op
);
LogUtil
.
info
(
$
"angles:{a}, widthOffset:{widthOffset}"
);
rightangle
=
a
;
}
else
{
labelAngle
=
0
;
return
Point
.
Empty
;
}
var
angleset
=
GetAnglesDistribution
(
angles
,
40
);
LogUtil
.
info
(
$
"rightangle:{rightangle},angleset:{string.Join("
,
", angleset)}"
);
if
(
labelParam
.
PlateW
==
15
)
{
labelAngle
=
angles
[
0
]
+
120
;
labelAngle
=
rightangle
+
120
;
}
else
if
(
labelParam
.
PlateW
==
13
)
{
labelAngle
=
angles
[
0
]
+
120
;
labelAngle
=
rightangle
+
120
;
}
else
{
//labelAngle = bigangles + biglen / 2;
labelAngle
=
angles
[
0
]
+
180
;
labelAngle
=
rightangle
+
180
;
}
if
(
angleset
.
Count
>
1
&&
labelParam
.
PlateW
>=
13
)
{
var
ass
=
angleset
.
Select
(
x
=>
x
<
0
?
360
+
x
:
x
).
ToList
();
ass
.
AddRange
(
ass
.
Select
(
x
=>
x
+
360
).
ToArray
());
ass
.
Sort
();
int
minangle
=
720
;
int
minindex
=
0
;
for
(
int
i
=
0
;
i
<
ass
.
Count
;
i
++)
{
if
(
Math
.
Abs
(
ass
[
i
]
-
rightangle
)
<
minangle
)
{
minangle
=
Math
.
Abs
(
ass
[
i
]
-
rightangle
);
minindex
=
i
;
}
}
minangle
=
ass
[
minindex
];
minangle
=
minangle
>
360
?
minangle
-
360
:
minangle
;
rightangle
=
minangle
>=
180
?
minangle
-
180
:
minangle
+
180
;
minangle
=
720
;
for
(
int
i
=
0
;
i
<
ass
.
Count
;
i
++)
{
if
(
Math
.
Abs
(
ass
[
i
]
-
rightangle
)
<
minangle
)
{
minangle
=
Math
.
Abs
(
ass
[
i
]
-
rightangle
);
minindex
=
i
;
}
}
labelAngle
=
ass
[
minindex
];
LogUtil
.
info
(
$
"选择贴标角度:{labelAngle}"
);
}
labelAngle
=
labelAngle
>
360
?
labelAngle
-
360
:
labelAngle
;
//labelAngle = labelAngle > 360 ? labelAngle - 360 : labelAngle;
LogUtil
.
info
(
$
"图像贴标角度:{labelAngle}"
);
labelAngle
=
labelAngle
+
180
;
labelAngle
=
labelAngle
>
360
?
labelAngle
-
360
:
labelAngle
;
LogUtil
.
info
(
$
"labelAngle1:{labelAngle}"
);
//匹配照片角度与贴标旋转轴的角度差
labelAngle
+=
83
;
LogUtil
.
info
(
$
"labelAngle2:{labelAngle}"
);
//g.FillEllipse(red, new Rectangle(PointRotate(org, op, labelAngle), pointsize));
LogUtil
.
info
(
$
"实际贴标角度:+180={labelAngle}"
);
//贴标坐标
var
p2
=
PointWithAngle
(
org
,
labelAngle
,
widthOffset
);
//贴标偏移
var
p3
=
PointWithAngle
(
p2
,
labelAngle
,
Label_R_Offset
);
var
p3
=
p2
;
// PointWithAngle(p2, labelAngle, Label_R_Offset);
g
.
FillEllipse
(
red
,
new
Rectangle
(
p3
,
pointsize
));
labelAngle
=
labelAngle
>
360
?
labelAngle
-
360
:
labelAngle
;
labelAngle
=
360
-
labelAngle
;
LogUtil
.
info
(
$
"labelAngle4:{labelAngle}"
);
labelAngle
+=
Label_R_Angle_Diff
;
labelAngle
=
labelAngle
>
360
?
labelAngle
-
360
:
labelAngle
;
LogUtil
.
info
(
$
"labelAngle5:{labelAngle}"
);
g
.
FillEllipse
(
red
,
new
Rectangle
(
p3
,
pointsize
));
//匹配照片角度与贴标旋转轴的角度差
labelAngle
+=
Label_R_Offset
;
LogUtil
.
info
(
$
"贴标角度差:+{labelAngle}={labelAngle}"
);
labelAngle
=
Math
.
Abs
(
labelAngle
-
180
);
LogUtil
.
info
(
$
"最终贴标角度:{labelAngle}"
);
//labelAngle += Label_R_Angle_Diff;
//labelAngle = labelAngle > 360 ? labelAngle - 360 : labelAngle;
//LogUtil.info($"labelAngle5:{labelAngle}");
g
.
Save
();
g
.
Dispose
();
string
dir
=
"/image/labeldebug/"
;
...
...
@@ -211,6 +252,56 @@ namespace DeviceLibrary
return
p3
;
}
public
static
List
<
int
>
GetAnglesDistribution
(
List
<
int
>
angles
,
int
AngleDiff
)
{
angles
.
Sort
();
List
<
List
<
int
>>
angleGroup
=
new
List
<
List
<
int
>>();
List
<
int
>
anglesnew
=
new
List
<
int
>();
int
groupid
=
0
;
bool
lastsame
=
false
;
for
(
int
i
=
0
;
i
<
angles
.
Count
;
i
++)
{
int
ad
=
0
;
if
(
i
==
angles
.
Count
-
1
)
{
ad
=
360
-
angles
[
angles
.
Count
-
1
]
-
angles
[
0
];
}
else
{
ad
=
angles
[
i
+
1
]
-
angles
[
i
];
}
//Console.WriteLine(ad);
if
(
angleGroup
.
Count
<
groupid
+
1
)
{
angleGroup
.
Add
(
new
List
<
int
>());
}
angleGroup
[
groupid
].
Add
(
angles
[
i
]);
if
(
ad
<=
AngleDiff
)
{
if
(
i
==
angles
.
Count
-
1
)
lastsame
=
true
;
}
else
{
groupid
++;
}
}
if
(
lastsame
&&
angleGroup
.
Count
>
1
)
{
angleGroup
[
0
].
AddRange
(
angleGroup
[
angleGroup
.
Count
-
1
].
Select
(
a
=>
a
-
360
));
angleGroup
[
angleGroup
.
Count
-
1
].
AddRange
(
angleGroup
[
0
].
Select
(
a
=>
a
+
360
));
};
angleGroup
.
ForEach
(
ag
=>
{
LogUtil
.
info
(
string
.
Join
(
","
,
ag
));
});
var
angleset
=
angleGroup
.
Select
(
ag
=>
{
return
ag
.
Min
()
+
(
ag
.
Max
()
-
ag
.
Min
())
/
2
;
}).
ToList
();
LogUtil
.
info
(
string
.
Join
(
","
,
angleset
));
return
angleset
;
}
static
IdWorker
id
=
new
IdWorker
(
1
,
1
);
static
string
[]
pnreglist
;
static
string
[]
qtyreglist
;
...
...
DeviceLibrary/theMachine/LabelParam.cs
查看文件 @
64d60b0
...
...
@@ -49,6 +49,7 @@ namespace DeviceLibrary
_WareCode
=
value
;
}
}
public
string
bitmapfilename
=
""
;
public
string
ReeID
{
get
;
set
;
}
public
string
PN
{
get
;
set
;
}
public
string
Algo
{
get
;
set
;
}
...
...
@@ -114,6 +115,34 @@ namespace DeviceLibrary
return
$
"{PN},{PlateW}inch,{NgMsg},{QTY}"
;
}
bool
islog
=
false
;
public
void
logresult
(
string
xrayfile
=
""
,
string
resultfile
=
""
)
{
if
(!
islog
)
{
islog
=
true
;
var
datetime
=
DateTime
.
Now
;
string
countfile
=
$
"\\XrayLogs\\{datetime:yyyyMMdd_HHmmss}_{QTY}.csv"
;
Directory
.
CreateDirectory
(
"\\XrayLogs\\"
);
if
(!
File
.
Exists
(
countfile
))
{
StreamWriter
sw1
=
new
StreamWriter
(
countfile
,
true
,
Encoding
.
GetEncoding
(
"GB2312"
));
sw1
.
WriteLine
(
$
"ReelId,Quantity,DateCode,XFile,Operator"
);
sw1
.
Close
();
sw1
.
Dispose
();
}
var
sw
=
new
StreamWriter
(
countfile
,
true
,
Encoding
.
GetEncoding
(
"GB2312"
));
//var sw = File.Open(countfile, FileMode.Append, FileAccess.Write);
// string s = $"\r\n{ReeID},{PN},{PlateW}x{PlateH},{ReelDest},{NgMsg},{QTY},{WareCode}";
//var b = Encoding.GetEncoding("gb2312").GetBytes(s);
//sw.Write(b, 0, b.Length);
sw
.
WriteLine
(
$
"{ReeID},{QTY},{datetime:yyyy/MM/dd HH:mm:ss},{xrayfile},"
);
sw
.
Close
();
sw
.
Dispose
();
}
databaseProc
.
Current
.
InsertOrUpdateRI
(
UID
,
PN
,
ReeID
,
IsNg
,
NgMsg
,
QTY
,
LabelState
,
Algo
,
WareCode
,
xrayfile
,
resultfile
);
}
/*
public void logresult(string xrayfile="",string resultfile="")
{
if (!islog)
...
...
@@ -139,7 +168,7 @@ namespace DeviceLibrary
sw.Dispose();
}
databaseProc.Current.InsertOrUpdateRI(UID, PN, ReeID, IsNg, NgMsg, QTY, LabelState, Algo, WareCode,xrayfile,resultfile);
}
}
*/
public
string
GetImgName
()
{
string
timeName
=
"-"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
".png"
;
...
...
DeviceLibrary/theMachine/MainMachine _Common.cs
查看文件 @
64d60b0
...
...
@@ -123,9 +123,10 @@ namespace DeviceLibrary
{
AxisBean
axisBean
=
AxisBean
.
List
.
Find
(
a
=>
a
.
Config
.
GetAxisValue
()
==
wait
.
AxisInfo
.
GetAxisValue
());
//等待信号亮或者走到绝对位置才停止
if
(
axisBean
.
TargetIoType
.
Where
(
io
=>
{
return
IOValue
(
io
).
Equals
(
axisBean
.
TargetIoValue
);
}).
Count
()>
0
)
var
tio
=
axisBean
.
TargetIoType
.
Where
(
io
=>
{
return
IOValue
(
io
).
Equals
(
axisBean
.
TargetIoValue
);
});
if
(
tio
.
Count
()>
0
)
{
LogUtil
.
info
(
Name
+
"CheckWaitResult 检测到"
+
axisBean
.
TargetIoType
+
"="
+
axisBean
.
TargetIoValue
+
",停止运行"
);
LogUtil
.
info
(
Name
+
"CheckWaitResult 检测到"
+
string
.
Join
(
","
,
tio
.
ToArray
())
+
"="
+
axisBean
.
TargetIoValue
+
",停止运行"
);
axisBean
.
StopAxisCheckMove
();
if
(
AxisManager
.
GetBusyStatus
(
wait
.
AxisInfo
.
DeviceName
,
wait
.
AxisInfo
.
GetAxisValue
()).
Equals
(
1
))
{
...
...
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
64d60b0
...
...
@@ -353,7 +353,7 @@ namespace DeviceLibrary
CylinderMove
(
ResetMoveInfo
,
IO_Type
.
Counting_ExitDoor_Close
,
IO_Type
.
Counting_ExitDoor_Open
,
IO_VALUE
.
LOW
);
if
(
IOValue
(
IO_Type
.
Counting_Reel_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
CountMoveInfo
.
NewMove
(
MoveStep
.
Count_0
2
);
CountMoveInfo
.
NewMove
(
MoveStep
.
Count_0
1
);
//CountMoveInfo.MoveParam.IsNg = true;
//CountMoveInfo.MoveParam.NgMsg = "回原时发现无信息料";
CountMoveInfo
.
log
(
"点料区有料直接开始点料"
);
...
...
@@ -384,15 +384,12 @@ namespace DeviceLibrary
bool
SafeCheck
()
{
bool
ok
=
true
;
var
ignorestring
=
"["
+
crc
.
GetString
(
L
.
ignored
,
"已忽略"
)
+
"]"
;
//if (IOValue(IO_Type.SafetyLightCurtains).Equals(IO_VALUE.LOW))
//{
// if (!IgnoreSafecheck)// && IOValue(IO_Type.NGDoor_Open).Equals(IO_VALUE.HIGH))
// {
// ok = false;
// DeviceSuddenStop();
// }
// Msg.add(crc.GetString(L.SafetyLight_is_block, "安全光栅被遮挡") + (ok ? ignorestring : ""), MsgLevel.warning);
//}
if
(
IOValue
(
IO_Type
.
AutoRun_Single
).
Equals
(
IO_VALUE
.
LOW
))
{
ok
=
false
;
DeviceSuddenStop
();
Msg
.
add
(
"运行开关未打开"
,
MsgLevel
.
warning
);
}
if
(
IOValue
(
IO_Type
.
Loading_SafeDoor_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
if
(!
IgnoreSafecheck
)
...
...
@@ -514,8 +511,15 @@ namespace DeviceLibrary
+
crc
.
GetString
(
L
.
motion_alarm
,
"运动报警"
),
MsgLevel
.
alarm
,
ErrInfo
.
SuddenStop
);
ButtenEvent
?.
Invoke
(
null
,
ErrInfo
.
SuddenStop
);
}
var
errcode
=
HuichuanLibrary
.
HCBoardManager
.
GetAxErrCode
(
configMoveAxis
.
GetAxisValue
());
var
errcodebyte
=
BitConverter
.
GetBytes
(
errcode
).
ToList
();
errcodebyte
.
Reverse
();
HuichuanLibrary
.
HCBoardManager
.
GetSdo
((
ushort
)
configMoveAxis
.
GetAxisValue
(),
0x203f
,
0
,
out
byte
[]
data
,
out
uint
datalen
);
var
errdatabyte
=
data
.
ToList
();
errdatabyte
.
Reverse
();
LogUtil
.
error
(
configMoveAxis
.
GetAxisValue
()
+
","
+
configMoveAxis
.
Explain
+
" errcode "
+
BitConverter
.
ToString
(
errcodebyte
.
ToArray
())+
","
+
BitConverter
.
ToString
(
errdatabyte
.
ToArray
()));
ok
=
false
;
}
}
...
...
DeviceLibrary/theMachine/MainMachine_Counting.cs
查看文件 @
64d60b0
...
...
@@ -10,6 +10,7 @@ using System.IO;
using
System.Linq
;
using
System.Runtime.ExceptionServices
;
using
System.Text
;
using
System.Text.RegularExpressions
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
...
...
@@ -46,11 +47,13 @@ namespace DeviceLibrary
{
CountMoveInfo
.
MoveParam
.
PlateH
=
Setting_Init
.
Temp_Last_Reel_Height
;
CountMoveInfo
.
MoveParam
.
PlateW
=
Setting_Init
.
Temp_Last_Reel_Width
;
CountMoveInfo
.
log
(
$
"读取到存储的料盘尺寸:{CountMoveInfo.MoveParam.PlateW}x{CountMoveInfo.MoveParam.PlateH}"
);
}
else
if
(
Setting_Init
.
Temp_Last_Reel_Height
>
0
)
else
if
(
CountMoveInfo
.
MoveParam
.
PlateH
>
0
)
{
Setting_Init
.
Temp_Last_Reel_Height
=
CountMoveInfo
.
MoveParam
.
PlateH
;
Setting_Init
.
Temp_Last_Reel_Width
=
CountMoveInfo
.
MoveParam
.
PlateW
;
}
else
{
...
...
@@ -70,25 +73,36 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
Count_03
:
CountMoveInfo
.
NextMoveStep
(
MoveStep
.
Count_04
);
int
retrytime
=
0
;
retry
:
if
(
RobotManage
.
XRay
.
Start
())
{
CountMoveInfo
.
log
(
$
"打开X光"
);
CountMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
Setting_Init
.
XRay_Light_Delay
));
}
else
{
Msg
.
add
(
"X光打开失败"
,
MsgLevel
.
warning
);
RobotManage
.
UserPause
(
"X光打开失败"
);
CountMoveInfo
.
log
(
$
"X光打开失败"
);
retrytime
++;
RobotManage
.
XRay
.
Close
();
if
(!
RobotManage
.
XRay
.
Open
(
Setting_Init
.
XRay_Port
,
string
.
Format
(
"{0:yyyy-MM-dd}"
,
DateTime
.
Now
)))
{
Msg
.
add
(
"X光打开失败"
,
MsgLevel
.
warning
);
RobotManage
.
UserPause
(
"X光打开失败"
);
}
else
{
if
(
retrytime
<
3
)
goto
retry
;
else
{
Msg
.
add
(
"X光打开失败"
,
MsgLevel
.
warning
);
RobotManage
.
UserPause
(
"X光打开失败"
);
}
}
}
break
;
case
MoveStep
.
Count_04
:
CountMoveInfo
.
NextMoveStep
(
MoveStep
.
Count_05
);
GrabImageTask
=
GrabImageEX
();
CountMoveInfo
.
log
(
$
"X光开始成像"
);
break
;
case
MoveStep
.
Count_05
:
if
(
ScanTask
.
IsCompleted
)
{
var
x
=
ScanTask
.
Result
;
var
(
x
,
s
)
=
ScanTask
.
Result
;
if
(
x
.
Count
==
0
)
{
CountMoveInfo
.
NextMoveStep
(
MoveStep
.
Count_ReadyOut
);
...
...
@@ -99,9 +113,10 @@ namespace DeviceLibrary
}
else
{
CountMoveInfo
.
NextMoveStep
(
MoveStep
.
Count_0
6
);
CountMoveInfo
.
NextMoveStep
(
MoveStep
.
Count_0
5
);
CountMoveInfo
.
MoveParam
.
IsNg
=
false
;
CountMoveInfo
.
MoveParam
.
codeInfos
=
x
;
CountMoveInfo
.
MoveParam
.
bitmapfilename
=
s
;
var
cc
=
x
.
Select
((
a
)
=>
a
.
CodeType
+
":"
+
a
.
CodeStr
);
LastCode
=
String
.
Join
(
"##"
,
cc
);
CountMoveInfo
.
log
(
"已完成扫码 Code:"
+
LastCode
);
...
...
@@ -109,12 +124,17 @@ namespace DeviceLibrary
CountMoveInfo
.
MoveParam
.
WareCode
=
CountMoveInfo
.
MoveParam
.
codeInfos
.
Where
(
c
=>
c
.
CodeStr
.
StartsWith
(
"S20"
)).
FirstOrDefault
().
CodeStr
;
CountMoveInfo
.
MoveParam
.
ReeID
=
CountMoveInfo
.
MoveParam
.
WareCode
;
CountMoveInfo
.
MoveParam
.
PN
=
CountMoveInfo
.
MoveParam
.
codeInfos
.
Where
(
c
=>
c
.
CodeStr
.
StartsWith
(
"AT"
)).
FirstOrDefault
()?.
CodeStr
;
var
xx
=
CountMoveInfo
.
MoveParam
.
codeInfos
.
Find
(
c
=>
{
return
c
.
CodeStr
.
StartsWith
(
"S20"
)
&&
c
.
CodeType
==
"barcode"
;
});
if
(
xx
!=
null
)
{
CountMoveInfo
.
MoveParam
.
codeInfos
.
Remove
(
xx
);
CountMoveInfo
.
log
(
"移除了一个点料标签上的reelid"
);
if
(
string
.
IsNullOrWhiteSpace
(
CountMoveInfo
.
MoveParam
.
PN
))
{
var
hc
=
CountMoveInfo
.
MoveParam
.
codeInfos
.
Where
(
c
=>
Regex
.
IsMatch
(
c
.
CodeStr
,
"@@(AT\\w*)@@"
)).
FirstOrDefault
()?.
CodeStr
;
var
pn
=
Regex
.
Match
(
hc
,
"@@(AT\\w*)@@"
).
Groups
[
1
].
Value
;
CountMoveInfo
.
MoveParam
.
PN
=
pn
;
}
//var xx = CountMoveInfo.MoveParam.codeInfos.Find(c=> { return c.CodeStr.StartsWith("S20") && c.CodeType == "barcode"; });
//if (xx != null)
//{
// CountMoveInfo.MoveParam.codeInfos.Remove(xx);
// CountMoveInfo.log("移除了一个点料标签上的reelid");
//}
CountMoveInfo
.
log
(
"codeProcess:"
+
CountMoveInfo
.
MoveParam
.
ReeID
+
";"
+
CountMoveInfo
.
MoveParam
.
PN
);
}
}
...
...
@@ -131,11 +151,16 @@ namespace DeviceLibrary
{
CountMoveInfo
.
NextMoveStep
(
MoveStep
.
Count_ReadyOut
);
CountMoveInfo
.
MoveParam
.
IsNg
=
false
;
CountMoveInfo
.
MoveParam
.
NgMsg
=
crc
.
GetString
(
L
.
scan_code_timeout
,
"扫码超时"
)
;
CountMoveInfo
.
MoveParam
.
NgMsg
=
"扫码超时"
;
CountMoveInfo
.
log
(
$
"等待扫码超时,NG口送出"
);
}
}
break
;
case
MoveStep
.
Count_05
:
CountMoveInfo
.
NextMoveStep
(
MoveStep
.
Count_06
);
GrabImageTask
=
GrabImageEX
();
CountMoveInfo
.
log
(
$
"X光开始成像"
);
break
;
case
MoveStep
.
Count_06
:
if
(
GrabImageTask
.
IsCompleted
)
{
...
...
@@ -233,19 +258,18 @@ namespace DeviceLibrary
/// <summary>
/// 扫码线程
/// </summary>
Task
<
List
<
CodeInfo
>
>
ScanTask
;
Task
<
(
List
<
CodeInfo
>,
string
)
>
ScanTask
;
public
void
ScanCode
()
{
CountMoveInfo
.
log
(
"开始扫码"
);
try
{
ScanTask
=
Task
.
Run
(
new
Func
<
List
<
CodeInfo
>>(()
=>
ScanTask
=
Task
.
Run
(
new
Func
<
(
List
<
CodeInfo
>,
string
)>(()
=>
{
IOMove
(
IO_Type
.
Counting_Camera_Led
,
IO_VALUE
.
HIGH
);
List
<
CodeInfo
>
LastCodeList
;
LastCodeList
=
CodeManager
.
CameraScan
(
CodeManager
.
hikNameList
);
var
(
LastCodeList
,
filename
)
=
CodeManager
.
CameraScan
(
CodeManager
.
hikNameList
);
return
LastCodeList
;
return
(
LastCodeList
,
filename
)
;
}));
}
catch
(
Exception
ex
)
...
...
DeviceLibrary/theMachine/MainMachine_InCar.cs
查看文件 @
64d60b0
...
...
@@ -134,9 +134,9 @@ namespace DeviceLibrary
return
;
}
if
(!
innewreel
)
SetReelHeight
(
GetHeight
(
InCarMoveInfo
));
innewreel
=
false
;
//
if (!innewreel)
//
SetReelHeight(GetHeight(InCarMoveInfo));
//
innewreel = false;
break
;
case
MoveStep
.
InCarReadyGet
:
Msg
.
add
(
"入口料串取料准备就绪"
,
MsgLevel
.
info
);
...
...
@@ -258,7 +258,8 @@ namespace DeviceLibrary
moveInfo
.
TimeOutSeconds
=
200
;
moveInfo
.
CanWhileCount
=
0
;
// 需要增加定时器,获取验证信号并停止伺服
StartMovePosition
=
axisBean
.
GetAclPosition
();
if
(
axisBean
==
Loading_Batch_Axis
)
StartMovePosition
=
axisBean
.
GetAclPosition
();
moveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitBatchAxisMove
(
axisBean
.
Config
,
targetP2
,
targetSpeed
));
axisBean
.
Config
.
TargetPosition
=
targetP2
;
axisBean
.
AbsMove
(
null
,
targetP2
,
targetSpeed
);
...
...
@@ -285,8 +286,6 @@ namespace DeviceLibrary
string
LastCode
=
""
;
private
int
GetHeight
(
MoveInfo
moveInfo
)
{
int
LastHeight
=
0
;
int
AxisChangeValue
=
Config
.
Loading_Batch_Axis_MMtoPOS
;
//计算高度
...
...
@@ -303,6 +302,8 @@ namespace DeviceLibrary
if
(
LastHeight
<=
8
)
{
LastHeight
=
8
;
}
string
msg
=
Name
+
" 计算盘高:上升前 ["
+
StartMovePosition
+
"]实时[ "
+
EndMovePosition
+
"]差值["
+
(
EndMovePosition
-
StartMovePosition
)
+
"]系数["
+
AxisChangeValue
+
"] 计算后"
+
buchongStr
+
"["
+
height
+
"]"
+
",归类为【"
+
LastHeight
+
"mm】条码【"
+
LastCode
+
"】"
;
LogUtil
.
info
(
msg
);
if
(
LastHeight
>
80
)
LastHeight
=
80
;
return
LastHeight
;
if
(
moveInfo
.
MoveParam
.
PlateW
==
15
)
...
...
DeviceLibrary/theMachine/MainMachine_InMove.cs
查看文件 @
64d60b0
...
...
@@ -40,7 +40,7 @@ namespace DeviceLibrary
InMoveInfo
.
MoveParam
=
InCarMoveInfo
.
MoveParam
.
clone
();
var
frompos
=
"Loading_T"
+
InCurrentStringNum
;
InFromPos
=
RobotManage
.
InCarReelPostion
[
frompos
];
InToPos
=
RobotManage
.
InCarReelPostion
[
"Loading_Counting
"
];
InToPos
=
RobotManage
.
InCarReelPostion
[
"Loading_Counting
_T"
+
InCurrentStringNum
];
InMoveInfo
.
log
(
$
"料盘已经准备好:{frompos}"
);
}
break
;
...
...
DeviceLibrary/theMachine/MainMachine_LabelProcess.cs
查看文件 @
64d60b0
...
...
@@ -30,17 +30,17 @@ namespace DeviceLibrary
Label_Y_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Y_P1
,
Config
.
Label_Y_P1_speed
);
Label_Z_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Z_P1
,
Config
.
Label_Z_P2_speed
);
LabelMoveInfo
.
log
(
"xy待机点"
);
if
(
OutMoveInfo
.
MoveStep
==
MoveStep
.
Out_WaitForLabel
)
{
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out_LabelFinished
);
LabelMoveInfo
.
log
(
"通知OutMoveInfo贴标完成"
);
}
break
;
case
MoveStep
.
Lbl_01
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl_02
);
Label_R_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_R_P2
,
Config
.
Label_Z_P2_speed
);
LabelMoveInfo
.
log
(
"Label_R转到取标点"
);
if
(
OutMoveInfo
.
MoveStep
==
MoveStep
.
Out_WaitForLabel
)
{
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out_LabelFinished
);
LabelMoveInfo
.
log
(
"通知OutMoveInfo贴标完成"
);
}
break
;
case
MoveStep
.
Lbl_02
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl_03
);
...
...
@@ -69,7 +69,7 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
Lbl_05
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl_06
);
LabelMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
500
));
LabelMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1
500
));
break
;
case
MoveStep
.
Lbl_06
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl_07
);
...
...
@@ -89,18 +89,37 @@ namespace DeviceLibrary
case
MoveStep
.
Lbl_10
:
//照片中料盘中心点像素位置
Point
Pixel_Center_Point
=
new
Point
(
Config
.
Graphe_Center_X
,
Config
.
Graphe_Center_Y
);
var
cc
=
RobotManage
.
LabellingPostion
[
"Labelling_T"
+
LabelMoveInfo
.
MoveParam
.
CurrentStringNum
];
LabelMoveInfo
.
log
(
"贴标盘位:"
+
"Labelling_T"
+
LabelMoveInfo
.
MoveParam
.
CurrentStringNum
);
Point
Axis_Center_Point
=
new
Point
(
cc
.
X_Base
,
cc
.
Y_Base
);
//计算照片中贴标的像素位置
Point
p
=
Common
.
CalcLabelPoint
(
LabelMoveInfo
.
MoveParam
,
Pixel_Center_Point
,
0
,
0
,
out
int
labelAngle
);
Point
p
=
Common
.
CalcLabelPoint
(
LabelMoveInfo
.
MoveParam
,
Pixel_Center_Point
,
(
int
)
cc
.
Label_R_Offset_Angle
,
0
,
out
int
labelAngle
);
LabelMoveInfo
.
log
(
$
"源坐标:{p}"
);
var
x
=
p
.
X
;
var
y
=
p
.
Y
;
p
.
Y
=
5472
-
x
;
p
.
X
=
y
;
LabelMoveInfo
.
log
(
$
"变换坐标:{p}"
);
labelAngle
=
360
-
labelAngle
;
LabelMoveInfo
.
log
(
$
"贴标逆时针角度:{labelAngle}"
);
if
(
labelAngle
>
180
)
labelAngle
-=
180
;
LabelMoveInfo
.
log
(
$
"贴标逆时针角度:-180={labelAngle}"
);
if
(
labelAngle
>
350
)
labelAngle
=
350
;
labelAngle
+=
90
;
if
(
labelAngle
>
180
)
labelAngle
-=
180
;
Pixel_Center_Point
=
new
Point
(
Config
.
Graphe_Center_Y
,
5472
-
Config
.
Graphe_Center_X
);
//计算贴标角度的脉冲值
int
labelAxisPos
=
Config
.
Label_R_360
/
35
0
*
labelAngle
;
int
labelAxisPos
=
Config
.
Label_R_360
/
18
0
*
labelAngle
;
//计算像素点位与中心点的差
Label_p3
=
new
Point
(
p
.
X
-
Pixel_Center_Point
.
X
,
p
.
Y
-
Pixel_Center_Point
.
Y
);
//计算像素*脉冲像素比得到脉冲值+中心点基准脉冲
...
...
DeviceLibrary/theMachine/MainMachine_OutCar.cs
查看文件 @
64d60b0
...
...
@@ -102,6 +102,24 @@ namespace DeviceLibrary
BatchAxisToP2
(
OutCarMoveInfo
,
Unloading_Batch_Axis
,
OutGetReelCheckIOList
(),
IO_VALUE
.
LOW
,
Config
.
Unloading_Batch_Axis_P1
,
Config
.
Unloading_Batch_Axis_P1_speed
);
break
;
case
MoveStep
.
OutCar_07
:
OutCarMoveInfo
.
NextMoveStep
(
MoveStep
.
OutCar_08
);
OutCurrentStringNum
=
GetBottomStringNum
(
OutGetLowReelCheckIOList
());
OutCarMoveInfo
.
log
(
$
"第一次检测到最低料串为:{OutCurrentStringNum}"
);
OutCarMoveInfo
.
log
(
$
"批量轴下降1mm再次检测"
);
Unloading_Batch_Axis
.
AbsMove
(
OutCarMoveInfo
,
Unloading_Batch_Axis
.
GetAclPosition
()-
Config
.
Unloading_UpDown_Axis_MMtoPOS
,
Config
.
Unloading_UpDown_Axis_P1_speed
);
break
;
case
MoveStep
.
OutCar_08
:
var
cur
=
GetBottomStringNum
(
OutGetLowReelCheckIOList
());
OutCarMoveInfo
.
log
(
$
"当前low={cur},上次low={OutCurrentStringNum}"
);
if
(
cur
!=
OutCurrentStringNum
)
{
OutCarMoveInfo
.
NextMoveStep
(
MoveStep
.
OutCar_06
);
}
else
{
OutCarMoveInfo
.
NextMoveStep
(
MoveStep
.
OutCar_09
);
}
break
;
case
MoveStep
.
OutCar_09
:
if
(
Unloading_Batch_Axis
.
IsInPosition
(
Config
.
Unloading_Batch_Axis_P1
))
{
OutCarMoveInfo
.
NextMoveStep
(
MoveStep
.
OutCarOut_01
);
...
...
DeviceLibrary/theMachine/MainMachine_OutMove.cs
查看文件 @
64d60b0
...
...
@@ -16,6 +16,7 @@ namespace DeviceLibrary
{
OutCarReelPostion
OutFromPos
;
OutCarReelPostion
OutToPos
;
int
takeretry
=
0
;
void
OutMoveProcess
()
{
if
(
CheckWait
(
OutMoveInfo
))
...
...
@@ -29,6 +30,8 @@ namespace DeviceLibrary
OutMoveInfo
.
MoveParam
=
CountMoveInfo
.
MoveParam
.
clone
();
OutFromPos
=
RobotManage
.
OutCarReelPostion
[
"Unloading_Counting"
];
OutMoveInfo
.
log
(
$
"点料区料盘已经准备好:"
+
OutMoveInfo
.
MoveParam
.
ToDetailStr
());
var
cc
=
OutMoveInfo
.
MoveParam
.
codeInfos
.
Select
((
a
)
=>
a
.
CodeType
+
":"
+
a
.
CodeStr
);
OutMoveInfo
.
log
(
String
.
Join
(
"##"
,
cc
));
}
break
;
case
MoveStep
.
Out_01
:
...
...
@@ -51,10 +54,13 @@ namespace DeviceLibrary
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out_05
);
Unloading_InOut_Axis
.
AbsMove
(
OutMoveInfo
,
OutFromPos
.
InOut_P2
,
Config
.
Unloading_InOut_Axis_P1_speed
);
OutMoveInfo
.
log
(
$
"进出轴达取料p2点"
);
takeretry
=
0
;
break
;
case
MoveStep
.
Out_05
:
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out_06
);
var
pos
=
OutFromPos
.
UpDown_P3
-
(
OutMoveInfo
.
MoveParam
.
PlateH
-
8
)
*
Config
.
Unloading_UpDown_Axis_MMtoPOS
;
if
(
pos
<
0
)
pos
=
0
;
Unloading_UpDown_Axis
.
AbsMove
(
OutMoveInfo
,
pos
,
Config
.
Unloading_UpDown_Axis_P1_speed
);
OutMoveInfo
.
log
(
$
"升降轴到达取料p3点,pos:{pos},PlateH:{OutMoveInfo.MoveParam.PlateH}"
);
break
;
...
...
@@ -78,9 +84,19 @@ namespace DeviceLibrary
}
else
{
Msg
.
add
(
"出口取盘失败"
,
MsgLevel
.
alarm
)
;
RobotManage
.
UserPause
(
"出口取盘失败"
)
;
takeretry
++
;
OutMoveInfo
.
MoveParam
.
PlateH
--
;
OutMoveInfo
.
log
(
$
"未取到料盘"
);
if
(
takeretry
<
3
)
{
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out_05
);
OutMoveInfo
.
log
(
$
"重试取盘:"
+
OutMoveInfo
.
MoveParam
.
PlateH
);
}
else
{
Msg
.
add
(
"出口取盘失败"
,
MsgLevel
.
alarm
);
RobotManage
.
UserPause
(
"出口取盘失败"
);
}
}
break
;
case
MoveStep
.
Out_09
:
...
...
@@ -109,7 +125,7 @@ namespace DeviceLibrary
{
CountList
.
Remove
(
OutMoveInfo
.
MoveParam
.
ReeID
);
}
if
(
OutMoveInfo
.
MoveParam
.
QTY
>
0
)
if
(
OutMoveInfo
.
MoveParam
.
QTY
>
=
0
)
SetPrintJob
(
OutMoveInfo
);
else
{
OutMoveInfo
.
MoveParam
.
IsNg
=
true
;
...
...
@@ -177,8 +193,13 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
Out_22
:
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out_23
);
Unloading_UpDown_Axis
.
AbsMove
(
OutMoveInfo
,
OutToPos
.
UpDown_P3
,
Config
.
Unloading_UpDown_Axis_P1_speed
);
OutMoveInfo
.
log
(
$
"升降轴到达p3点"
);
var
pos1
=
OutToPos
.
UpDown_P3
-
(
OutMoveInfo
.
MoveParam
.
PlateH
-
8
)
*
Config
.
Unloading_UpDown_Axis_MMtoPOS
;
if
(
pos1
<
0
)
pos1
=
0
;
Unloading_UpDown_Axis
.
AbsMove
(
OutMoveInfo
,
pos1
,
Config
.
Unloading_UpDown_Axis_P1_speed
);
OutMoveInfo
.
log
(
$
"升降轴到达放料p3点,pos:{pos1},PlateH:{OutMoveInfo.MoveParam.PlateH}"
);
//Unloading_UpDown_Axis.AbsMove(OutMoveInfo, OutToPos.UpDown_P3, Config.Unloading_UpDown_Axis_P1_speed);
//OutMoveInfo.log($"升降轴到达p3点");
break
;
case
MoveStep
.
Out_23
:
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out_24
);
...
...
@@ -212,18 +233,29 @@ namespace DeviceLibrary
Unloading_Middle_Axis
.
AbsMove
(
OutMoveInfo
,
Config
.
Unloading_Middle_Axis_P1
,
Config
.
Unloading_Middle_Axis_P1_speed
);
Unloading_UpDown_Axis
.
AbsMove
(
OutMoveInfo
,
Config
.
Unloading_UpDown_Axis_P1
,
Config
.
Unloading_UpDown_Axis_P1_speed
);
OutMoveInfo
.
log
(
$
"旋转轴,升降轴到达p1点,完成出口放料"
);
//
Unloading_Batch_Axis
.
RelMove
(
OutMoveInfo
.
MoveParam
.
PlateH
*
Config
.
Unloading_UpDown_Axis_MMtoPOS
*-
1
,
Config
.
Unloading_UpDown_Axis_P1_speed
);
OutMoveInfo
.
log
(
$
"批量轴高速下降:{OutMoveInfo.MoveParam.PlateH * Config.Unloading_UpDown_Axis_MMtoPOS * -1}"
);
break
;
case
MoveStep
.
Out_28
:
if
(!
Unloading_Batch_Axis
.
IsBusy
)
{
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out_WaitForLabel
);
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out_29
);
var
pos3
=
Unloading_Batch_Axis
.
GetAclPosition
();
pos3
=
pos3
-
Config
.
Unloading_UpDown_Axis_MMtoPOS
*
30
;
if
(
pos3
<
0
)
pos3
=
0
;
Unloading_Batch_Axis
.
AbsMove
(
OutMoveInfo
,
pos3
,
Config
.
Unloading_Batch_Axis_P1_speed
);
//Unloading_Batch_Axis.RelMove(OutMoveInfo.MoveParam.PlateH/2 * Config.Unloading_UpDown_Axis_MMtoPOS*-1, Config.Unloading_UpDown_Axis_P1_speed);
OutMoveInfo
.
log
(
$
"批量轴高速下降:{pos3}"
);
break
;
case
MoveStep
.
Out_29
:
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out_30
);
BatchAxisToP2
(
OutMoveInfo
,
Unloading_Batch_Axis
,
OutGetReelCheckIOList
(
OutCurrentStringNum
),
IO_VALUE
.
LOW
,
Config
.
Unloading_Batch_Axis_P1
,
Config
.
Unloading_Batch_Axis_P1_speed
);
OutMoveInfo
.
log
(
$
"批量轴高速下降到检测点灭"
);
}
OutMoveInfo
.
log
(
$
"批量轴快速下降到监测点灭"
);
break
;
case
MoveStep
.
Out_30
:
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out_31
);
BatchAxisToP2
(
OutMoveInfo
,
Unloading_Batch_Axis
,
OutGetReelCheckIOList
(
OutCurrentStringNum
),
IO_VALUE
.
HIGH
,
Config
.
Unloading_Batch_Axis_P2
,
Config
.
Unloading_Batch_Axis_P2_speed
);
OutMoveInfo
.
log
(
$
"批量轴慢速上升到检测点亮"
);
break
;
case
MoveStep
.
Out_31
:
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out_WaitForLabel
);
break
;
case
MoveStep
.
Out_WaitForLabel
:
Msg
.
add
(
"等待贴标"
,
MsgLevel
.
info
);
...
...
DeviceLibrary/theMachine/MainMachine_PrinterProcess.cs
查看文件 @
64d60b0
...
...
@@ -16,7 +16,10 @@ namespace DeviceLibrary
{
void
SetPrintJob
(
MoveInfo
reel
)
{
reel
.
log
(
"设置打印任务:"
+
reel
.
MoveParam
.
ToDetailStr
());
PrintJob
=
reel
.
MoveParam
.
clone
();
PrintJob
=
reel
.
MoveParam
.
clone
();
var
cc
=
PrintJob
.
codeInfos
.
Select
((
a
)
=>
a
.
CodeType
+
":"
+
a
.
CodeStr
);
CountMoveInfo
.
log
(
"打印时 Code:"
+
String
.
Join
(
"##"
,
cc
));
}
readonly
MoveInfo
PrintMoveInfo
=
new
MoveInfo
(
""
,
false
);
...
...
@@ -52,6 +55,7 @@ namespace DeviceLibrary
if
(
result
)
{
PrintMoveInfo
.
NextMoveStep
(
MoveStep
.
Print_04
);
PrintMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
PrintMoveInfo
.
log
(
"打印成功,等待标签被取走"
);
}
else
...
...
DeviceLibrary/theMachine/MoveStep.cs
查看文件 @
64d60b0
...
...
@@ -101,6 +101,7 @@ namespace DeviceLibrary
OutCar_06
,
OutCar_07
,
OutCar_08
,
OutCar_09
,
OutCarReadyPut
,
OutCarReelPut
,
OutCarOut_01
,
...
...
@@ -141,6 +142,8 @@ namespace DeviceLibrary
Out_27
,
Out_28
,
Out_29
,
Out_30
,
Out_31
,
Out_WaitForLabel
,
Out_LabelFinished
,
...
...
DeviceLibrary/theMachine/RobotManage.cs
查看文件 @
64d60b0
...
...
@@ -155,10 +155,17 @@ namespace DeviceLibrary
if
(!
IsConfigMode
)
return
;
}
mainThread
=
new
Thread
(
new
ThreadStart
(
mainMachine
.
Start
));
mainThread
.
Start
();
isRunning
=
true
;
lock
(
mainMachine
)
{
if
(
isRunning
)
{
LogUtil
.
info
(
"系统已经在运行"
);
return
;
}
isRunning
=
true
;
mainThread
=
new
Thread
(
new
ThreadStart
(
mainMachine
.
Start
));
mainThread
.
Start
();
}
GC
.
KeepAlive
(
mainThread
);
Task
.
Run
(()=>
{
AxisBean
.
List
.
ForEach
((
x
)
=>
{
AxisManager
.
AlarmClear
(
x
.
Config
.
DeviceName
,
x
.
Config
.
GetAxisValue
());
});
...
...
LoadCVSLibrary/Config/InCarReelPostion.csv
查看文件 @
64d60b0
位置,备注,旋转轴位置P2,升降轴高点P2,升降轴低点P3,进出轴库取料点P2
Loading_T1,入口料车7寸放料点,219347,31048,20240,236990
Loading_T2,入口料车7寸放料点,219347,60595,49787,236990
Loading_T3,入口料车13/15寸放料点,219347,91377,80569,236990
Loading_T4,入口料车7寸放料点,219347,121147,110339,236990
Loading_T5,入口料车7寸放料点,219347,151889,141081,236990
Loading_Counting,入口点料机放料点,219347,151889,141081,236990
Loading_T1,入口料车7寸放料点,22185,0,140000,494559
Loading_T2,入口料车7寸放料点,25964,0,140000,276000
Loading_T3,入口料车13/15寸放料点,13650,0,131000,369000
Loading_T4,入口料车7寸放料点,5596,0,140000,492403
Loading_T5,入口料车7寸放料点,2758,0,140000,276681
Loading_Counting_T1,入口点料机放料点,193164,0,60000,489637
Loading_Counting_T2,入口点料机放料点,193164,0,60000,489637
Loading_Counting_T3,入口点料机放料点,193164,0,60000,489637
Loading_Counting_T4,入口点料机放料点,193164,0,60000,489637
Loading_Counting_T5,入口点料机放料点,193164,0,60000,489637
LoadCVSLibrary/Config/LabellingPostion.csv
查看文件 @
64d60b0
位置,备注,X轴基准点,Y轴基准点,Z轴贴标高点P4,Z轴贴标点P5,R轴偏转
Labelling_T1,贴标点7寸,2
19347,31048,20240,23699
0,9
Labelling_T2,贴标点7寸,
219347,60595,49787,23699
0,11
Labelling_T3,贴标点13/15寸,
219347,91377,80569,23699
0,0
Labelling_T4,贴标点7寸,
219347,121147,110339,23699
0,11
Labelling_T5,贴标点7寸,2
19347,151889,141081,23699
0,9
Labelling_T1,贴标点7寸,2
80326,427823,0,4250
0,9
Labelling_T2,贴标点7寸,
54606,427823,0,4000
0,11
Labelling_T3,贴标点13/15寸,
172667,323227,0,4300
0,0
Labelling_T4,贴标点7寸,
54606,216008,0,4300
0,11
Labelling_T5,贴标点7寸,2
80326,216008,0,4600
0,9
LoadCVSLibrary/Config/OutCarReelPostion.csv
查看文件 @
64d60b0
位置,备注,旋转轴位置P2,升降轴高点P2,升降轴低点P3,进出轴库取料点P2
Unloading_T1,出口料车7寸放料点,2
19347,182278,171470,236990
Unloading_T2,出口料车7寸放料点,2
19347,212452,201644,236990
Unloading_T3,出口料车13/15寸放料点,
219347,242880,232072,236990
Unloading_T4,出口料车7寸放料点,
219347,273824,263016,236990
Unloading_T5,出口料车7寸放料点,2
19347,303630,292822,236990
Unloading_Counting,出口点料机取料点,
219347,151889,141081,23699
0
Unloading_NgBox,出口NG料箱放料点,2
19347,151889,141081,236990
Unloading_T1,出口料车7寸放料点,2
6587,0,135000,254909
Unloading_T2,出口料车7寸放料点,2
2539,0,135000,468256
Unloading_T3,出口料车13/15寸放料点,
14743,0,124000,365308
Unloading_T4,出口料车7寸放料点,
6492,0,135000,469143
Unloading_T5,出口料车7寸放料点,2
813,0,135000,254513
Unloading_Counting,出口点料机取料点,
195571,0,100000,50341
0
Unloading_NgBox,出口NG料箱放料点,2
84692,0,151761,146725
TheMachine/Program.cs
查看文件 @
64d60b0
using
ConfigHelper
;
using
DeviceLibrary
;
using
log4net.Config
;
using
OnlineStore.Common
;
using
System
;
...
...
@@ -22,6 +23,34 @@ namespace TheMachine
[
STAThread
]
static
void
Main
()
{
var
xxx
=
System
.
Text
.
RegularExpressions
.
Regex
.
Match
(
"@@5023520500@@ATAA000024@@700@@2226@@000847768514@@BAYXE"
,
"@@(AT\\w*)@@"
).
Groups
[
1
].
Value
;
int
rightangle
=
360
-
34
;
List
<
int
>
angleset
=
new
List
<
int
>
{
-
137
,
-
34
,
15
};
var
ass
=
angleset
.
Select
(
x
=>
x
<
0
?
360
+
x
:
x
).
ToList
();
ass
.
AddRange
(
ass
.
Select
(
x
=>
x
+
360
).
ToArray
());
ass
.
Sort
();
int
minangle
=
720
;
int
minindex
=
0
;
for
(
int
i
=
0
;
i
<
ass
.
Count
;
i
++)
{
if
(
Math
.
Abs
(
ass
[
i
]
-
rightangle
)
<
minangle
)
{
minangle
=
Math
.
Abs
(
ass
[
i
]
-
rightangle
);
minindex
=
i
;
}
}
minangle
=
ass
[
minindex
];
minangle
=
minangle
>
360
?
minangle
-
360
:
minangle
;
rightangle
=
minangle
>=
180
?
minangle
-
180
:
minangle
+
180
;
minangle
=
720
;
for
(
int
i
=
0
;
i
<
ass
.
Count
;
i
++)
{
if
(
Math
.
Abs
(
ass
[
i
]
-
rightangle
)
<
minangle
)
{
minangle
=
Math
.
Abs
(
ass
[
i
]
-
rightangle
);
minindex
=
i
;
}
}
var
labelAngle
=
ass
[
minindex
];
_
=
new
Mutex
(
true
,
Application
.
ProductName
,
out
bool
ret
);
if
(!
ret
)
...
...
TheMachine/SettingControl.cs
查看文件 @
64d60b0
...
...
@@ -82,7 +82,7 @@ namespace TheMachine
void
loadlabellist
()
{
cb_labelselect
.
Items
.
Clear
();
cb_labelselect
.
Items
.
AddRange
(
RobotManage
.
printerHelper
.
GetLabelList
());
cb_labelselect
.
Selected
Text
=
Setting_Init
.
Printer_Labelname
;
cb_labelselect
.
Selected
Item
=
Setting_Init
.
Printer_Labelname
.
Val
;
}
private
void
btn_Calibration_Click
(
object
sender
,
EventArgs
e
)
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论