Commit e2efb7d5 刘韬

取料失败检测

1 个父辈 0e6af7ba
...@@ -525,37 +525,55 @@ Res0132.45f8ce0b 请先选择相机 Please select camera ...@@ -525,37 +525,55 @@ Res0132.45f8ce0b 请先选择相机 Please select camera
Res0133.348f1b33 请先选择图片 Please select picture Res0133.348f1b33 请先选择图片 Please select picture
Res0134.2f36fc36 获取二维码图片为空 Get the two-dimensional code picture is empty Res0134.2f36fc36 获取二维码图片为空 Get the two-dimensional code picture is empty
Res0135.4cc0a7a8 确定删除文件: Make sure to delete the file: Res0135.4cc0a7a8 确定删除文件: Make sure to delete the file:
Res0136.c56a14a0 读取文件失败: Res0136.c56a14a0 读取文件失败: Failed to read file:
Res0137.f18f365a 扫码测试_ Res0137.f18f365a 扫码测试_ Barcode Test_
Res0138.72eff852 识别 Res0138.72eff852 识别 Recognition
Res0139.29d9f02a //ID,启用,宽度,高度,角度,中点x,中点y,p1.x,p1.y,p2.x,p2.y,p3.x,p3.y,p4.x,p4.y Res0139.29d9f02a //ID,启用,宽度,高度,角度,中点x,中点y,p1.x,p1.y,p2.x,p2.y,p3.x,p3.y,p4.x,p4.y //ID,Enabled,Width,Height,Angle,CenterX,CenterY,p1.x,p1.y,p2.x,p2.y,p3.x,p3.y,p4.x,p4.y
Res0140.3b7b140a //类型,中点X,中点Y,角度,文本 Res0140.3b7b140a //类型,中点X,中点Y,角度,文本 //Type,CenterX,CenterY,Angle,Text
Res0141.45b4fe3b 选择二维码图片 Res0141.45b4fe3b 选择二维码图片 Select QR Code Image
Res0142.5358d483 图片(*.jpg)|*.jpg|图片(*.png)|*.png Res0142.5358d483 图片(*.jpg)|*.jpg|图片(*.png)|*.png Images(*.jpg)|*.jpg|Images(*.png)|*.png
Res0143.836d6b0c 请先解析条码! Res0143.836d6b0c 请先解析条码! Please decode barcode first!
Res0144.0d4a0d99 请等待上个二维码生成成功后再操作! Res0144.0d4a0d99 请等待上个二维码生成成功后再操作! Please wait until the previous QR code is generated successfully!
Res0145.308b5439 生成中: Res0145.308b5439 生成中: Generating:
Res0146.2f29961e 拼接格式说明:*为分隔符 Res0146.2f29961e 拼接格式说明:*为分隔符 Splicing format note: * as separator
Res0147.fa67f3ad \r\nRID表示RealID对应的条码内容 Res0147.fa67f3ad \r\nRID表示RealID对应的条码内容 \r\nRID represents barcode content of RealID
Res0148.1a900ea2 \r\nPN表示Customer PN 对应的条码内容 Res0148.1a900ea2 \r\nPN表示Customer PN 对应的条码内容 \r\nPN represents barcode content of Customer PN
Res0149.d96f4e8e \r\nQTY表示QTY对应的条码内容 Res0149.d96f4e8e \r\nQTY表示QTY对应的条码内容 \r\nQTY represents barcode content of QTY
Res0150.620048ee \r\nDATE表示DATE对应的条码内容 Res0150.620048ee \r\nDATE表示DATE对应的条码内容 \r\nDATE represents barcode content of DATE
Res0151.6926e3be \r\nLOT表示LOT对应的条码内容 Res0151.6926e3be \r\nLOT表示LOT对应的条码内容 \r\nLOT represents barcode content of LOT
Res0152.3b108349 保存成功 Res0152.3b108349 保存成功 Save successful
Res0153.78876856 (默认) Res0153.78876856 (默认) (Default)
Res0154.7854b52a 启用 Res0154.7854b52a 启用 Enabled
Res0155.5daef6b4 输入新的标签名称: Res0155.5daef6b4 输入新的标签名称: Enter new label name:
Res0156.67a79371 输入字段名: Res0156.67a79371 输入字段名: Enter field name:
Res0157.89d3b48c 图片文件|*.jpg;*.jpeg;*.png;*.bmp;*.gif|所有文件|*.* Res0157.89d3b48c 图片文件|*.jpg;*.jpeg;*.png;*.bmp;*.gif|所有文件|*.* Image files|*.jpg;*.jpeg;*.png;*.bmp;*.gif|All files|*.*
Res0158.14175694 输入模板的名称: Res0158.14175694 输入模板的名称: Enter template name:
Res0159.a5d1c511 模板名称 Res0159.a5d1c511 模板名称 Template Name
Res0160.e7991e32 图片(*.png)|*.png|图片(*.jpg)|*.jpg Res0160.e7991e32 图片(*.png)|*.png|图片(*.jpg)|*.jpg Images(*.png)|*.png|Images(*.jpg)|*.jpg
Res0161.631cd220 确认删除 Res0161.631cd220 确认删除 Confirm deletion
Res0162.b04fbd0f \r\n识别到二维码: Res0162.b04fbd0f \r\n识别到二维码: \r\nQR code recognized:
Res0163.17995f3f \r\n未识别到二维码 Res0163.17995f3f \r\n未识别到二维码 \r\nNo QR code recognized
Res0164.d42d76fd \r\n扫码结束耗时: Res0164.d42d76fd \r\n扫码结束耗时: \r\nScanning time:
Res0165.5e2a4b76 \r\n转换图片耗时: Res0165.5e2a4b76 \r\n转换图片耗时: \r\nImage conversion time:
Res0166.2bf72810 NG物料厚度超过72mm无法放入NG箱 NG materials exceeding 72mm in thickness cannot be placed into the NG container. Res0166.2bf72810 NG物料厚度超过72mm无法放入NG箱 NG material thickness exceeds 72mm, cannot be placed in NG bin
Res0167.8f7ee19b 确定要删除 Are you sure to delete
Res0168.16f7fa08 吗? ?
Res0169.8ab026c3 确定要删除选中的文本吗? Are you sure to delete the selected text?
Res0170.2ce02deb 保存完成。 Save completed.
Res0171.be2bceb3 确定要删除 Are you sure to delete
Res0172.b6fbde9f 吗? ?
Res0173.0ab20883 HomeMove,需要先相对走 HomeMove, need to move relatively first
Res0174.047fab65 已结束 Completed
Res0175.4afedf1a 已等待2分钟,直接停止 Waited 2 minutes, stopping directly
Res0176.267f5bb6 HomeMove,先匀速向上走 HomeMove, move up at constant speed first
Res0177.be3b5212 ,速度[ , speed[
Res0178.4dc5ed31 ,直接停止 , stop directly
Res0179.7d9058a1 串口 Serial port
Res0180.e4b541f2 收到数据: Received data:
Res0181.3f39fd86 写入数据: Write data:
Res0182.2def73c9 NG物料, 等待测高 NG material, waiting for height measurement
Res0183.b7688c25 条码重复 Barcode duplicate
Res0184.4aa86524 条码出现重复,请分别取走左右料串顶层的料盘,然后按右侧按钮继续 Barcode duplicate detected, please remove top reels from both left/right stackers, then press right button to continue
Res0188 电夹爪通讯失败:{0} Eletric Gripper Communication Failure:{0} Res0188 电夹爪通讯失败:{0} Eletric Gripper Communication Failure:{0}
Res0189 IO板卡初始化失败 IO Card Initialization Failure Res0189 IO板卡初始化失败 IO Card Initialization Failure
Res0190 打开配置模式 Turn On Configuration Modo Res0190 打开配置模式 Turn On Configuration Modo
......
...@@ -708,7 +708,7 @@ namespace DeviceLibrary ...@@ -708,7 +708,7 @@ namespace DeviceLibrary
} }
return curagv; return curagv;
} }
public T DeepClone<T>(T _object) public static T DeepClone<T>(T _object)
{ {
T dstobject; T dstobject;
using (MemoryStream mStream = new MemoryStream()) using (MemoryStream mStream = new MemoryStream())
...@@ -721,6 +721,23 @@ namespace DeviceLibrary ...@@ -721,6 +721,23 @@ namespace DeviceLibrary
} }
return dstobject; return dstobject;
} }
public static (int commonCount, double overlapPercentage) CompareLists(List<string> list1, List<string> list2)
{
// 计算交集
var intersection = list1.Intersect(list2).ToList();
int commonCount = intersection.Count;
// 确定较小的列表
int smallerCount = Math.Min(list1.Count, list2.Count);
// 计算重合百分比
double overlapPercentage = smallerCount > 0
? (double)commonCount / smallerCount * 100
: 0;
return (commonCount, overlapPercentage);
}
/// <summary> /// <summary>
/// 覆盖识别到条码算法 /// 覆盖识别到条码算法
/// </summary> /// </summary>
......
...@@ -139,7 +139,7 @@ namespace DeviceLibrary ...@@ -139,7 +139,7 @@ namespace DeviceLibrary
//左侧空闲,等待贴标流程为打印标签,复制信息给标签流程,进入下一步,移动旋转轴到p3 //左侧空闲,等待贴标流程为打印标签,复制信息给标签流程,进入下一步,移动旋转轴到p3
else if(LeftMoveInfo.MoveStep == MoveStep.L10_WaitReelPut) else if(LeftMoveInfo.MoveStep == MoveStep.L10_WaitReelPut)
{ {
if (true || clampTool.IsClamp()) if (clampTool.IsClamp())
{ {
if (!LabelMoveInfo.IsStep(MoveStep.Lbl_WaitPrintInfo)) if (!LabelMoveInfo.IsStep(MoveStep.Lbl_WaitPrintInfo))
{ {
...@@ -155,13 +155,25 @@ namespace DeviceLibrary ...@@ -155,13 +155,25 @@ namespace DeviceLibrary
} }
else else
{ {
//Take_Middle_Axis.AbsMove(MiddleMoveInfo, Config.Take_Middle_P1, Config.Take_Middle_P1_speed); Msg.add(crc.GetString("Res0097", "抓料失败请手动处理,请将料盘放入: 左侧料串,按右侧按钮继续"), MsgLevel.alarm);
//Take_UpDown_Axis.AbsMove(MiddleMoveInfo, Config.Take_UpDown_P1, Config.Take_UpDown_P1_speed); if (IOValue(IO_Type.Right_BTN).Equals(IO_VALUE.HIGH))
MiddleMoveInfo.log("没有抓到料,继续下一步"); {
RightMoveInfo.NextMoveStep(MoveStep.R11_NextReel);
MiddleMoveInfo.NextMoveStep(MoveStep.M09);
CurrentPrintInfo = MiddleMoveInfo.MoveParam.clone();
LabelMoveInfo.NextMoveStep(MoveStep.Lbl_PrintLabel);
LabelMoveInfo.MoveParam = MiddleMoveInfo.MoveParam.clone();
MiddleMoveInfo.log("用户按下右侧Reset,继续贴标");
}
else
{
bool isclamp = clampTool.IsClamp();
bool che = IOValue(IO_Type.RightTop_Check).Equals(IO_VALUE.LOW);
MiddleMoveInfo.log($"物料掉落, 取起物料状态{isclamp};io状态{che}");
}
} }
bool isclamp = clampTool.IsClamp();
bool che = IOValue(IO_Type.RightTop_Check).Equals(IO_VALUE.LOW);
MiddleMoveInfo.log($"取起物料状态{isclamp};io状态{che}");
} }
else if (MiddleMoveInfo.IsTimeOut(60)) else if (MiddleMoveInfo.IsTimeOut(60))
{ {
...@@ -218,7 +230,7 @@ namespace DeviceLibrary ...@@ -218,7 +230,7 @@ namespace DeviceLibrary
} }
else else
{ {
Msg.add("NG物料, 等待测高", MsgLevel.info); Msg.add(crc.GetString("Res0182.2def73c9","NG物料, 等待测高"), MsgLevel.info);
MiddleMoveInfo.log("NG物料, 等待测高"); MiddleMoveInfo.log("NG物料, 等待测高");
} }
break; break;
......
...@@ -7,6 +7,7 @@ using OnlineStore.LoadCSVLibrary; ...@@ -7,6 +7,7 @@ using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -44,6 +45,8 @@ namespace DeviceLibrary ...@@ -44,6 +45,8 @@ namespace DeviceLibrary
RightMoveInfo.NextMoveStep(MoveStep.R04); RightMoveInfo.NextMoveStep(MoveStep.R04);
var Uplast = Right_Batch_Axis.GetAclPosition(); var Uplast = Right_Batch_Axis.GetAclPosition();
PlwHight = Uplast - LastBatchAxisPosition; PlwHight = Uplast - LastBatchAxisPosition;
if (PlwHight <= 0)
PlwHight = 5000;
RightMoveInfo.log($"批量轴上升到P2位置到位,当前位置:{Uplast}, PlwHight:{PlwHight}"); RightMoveInfo.log($"批量轴上升到P2位置到位,当前位置:{Uplast}, PlwHight:{PlwHight}");
break; break;
//如果定位上升并且特定中间步骤偶,开始扫码 //如果定位上升并且特定中间步骤偶,开始扫码
...@@ -120,6 +123,21 @@ namespace DeviceLibrary ...@@ -120,6 +123,21 @@ namespace DeviceLibrary
{ {
RightMoveInfo.MoveParam.IsNg = false; RightMoveInfo.MoveParam.IsNg = false;
RightMoveInfo.MoveParam.codeInfos = x; RightMoveInfo.MoveParam.codeInfos = x;
if (false && LastCodeList != null && LastCodeList.Count > 1)
{
var result = Common.CompareLists(x.Select(a => a.CodeStr).ToList(), LastCodeList.Select(a => a.CodeStr).ToList());
RightMoveInfo.log($"相同条目数: {result.commonCount}, 重合百分比: {result.overlapPercentage:F2}%");
//bool duplicate = false;
if (result.overlapPercentage == 100)
{
RightMoveInfo.NextMoveStep(MoveStep.R20_reel_duplicate);
RightMoveInfo.MoveParam.IsNg = true;
RightMoveInfo.MoveParam.NgMsg = crc.GetString("Res0183.b7688c25","条码重复");
//duplicate = true;
RightMoveInfo.log($"条码重复:{result.overlapPercentage} > 50");
}
}
LastCodeList = Common.DeepClone(x);
RightMoveInfo.MoveParam.Keyword = k; RightMoveInfo.MoveParam.Keyword = k;
RightMoveInfo.MoveParam.bitmapfilename = s; RightMoveInfo.MoveParam.bitmapfilename = s;
RightMoveInfo.MoveParam.NewXYAngle = b; RightMoveInfo.MoveParam.NewXYAngle = b;
...@@ -160,6 +178,17 @@ namespace DeviceLibrary ...@@ -160,6 +178,17 @@ namespace DeviceLibrary
RightMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); RightMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
} }
break; break;
case MoveStep.R20_reel_duplicate:
Msg.add(crc.GetString("Res0184.4aa86524","条码出现重复,请分别取走左右料串顶层的料盘,然后按右侧按钮继续"), MsgLevel.alarm);
if (IOValue(IO_Type.GratingSignal_Check).Equals(IO_VALUE.LOW))
{
if (IOValue(IO_Type.Right_BTN).Equals(IO_VALUE.HIGH))
{
RightMoveInfo.NextMoveStep(MoveStep.R11_NextReel);
RightMoveInfo.log("用户按下右侧reset,开始扫码下一盘");
}
}
break;
//无料流程,轴下降到P1点,如果用AGV运输料串那么进料口阻挡下降,进入到结束流程(会进入到出料串流程) //无料流程,轴下降到P1点,如果用AGV运输料串那么进料口阻挡下降,进入到结束流程(会进入到出料串流程)
case MoveStep.R12_ShelfNoTray: case MoveStep.R12_ShelfNoTray:
RightShelfNoTray = true; RightShelfNoTray = true;
...@@ -299,6 +328,7 @@ namespace DeviceLibrary ...@@ -299,6 +328,7 @@ namespace DeviceLibrary
/// 扫码线程 /// 扫码线程
/// </summary> /// </summary>
Task<(List<CodeInfo>, Dictionary<string, string>, string, Dictionary<string, int>)> RightScanTask; Task<(List<CodeInfo>, Dictionary<string, string>, string, Dictionary<string, int>)> RightScanTask;
List<CodeInfo> LastCodeList;
void ScanCode() void ScanCode()
{ {
RightMoveInfo.log("开始扫码"); RightMoveInfo.log("开始扫码");
...@@ -309,13 +339,13 @@ namespace DeviceLibrary ...@@ -309,13 +339,13 @@ namespace DeviceLibrary
IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH); IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
string filename; string filename;
Task.Delay(10).Wait(); Task.Delay(10).Wait();
List<CodeInfo> LastCodeList; List<CodeInfo> CodeList;
Dictionary<string, string> keyword; Dictionary<string, string> keyword;
Dictionary<string, int> newpointangle; Dictionary<string, int> newpointangle;
int plantw = GetTrayWidth(); int plantw = GetTrayWidth();
(LastCodeList, keyword, filename, newpointangle) = CodeManager.CameraScan(new List<string> { Config.RightCameraName }, plantw); (CodeList, keyword, filename, newpointangle) = CodeManager.CameraScan(new List<string> { Config.RightCameraName }, plantw);
return (LastCodeList, keyword, filename, newpointangle); return (CodeList, keyword, filename, newpointangle);
})); }));
} }
catch (Exception ex) catch (Exception ex)
......
...@@ -6,9 +6,6 @@ using System.Collections.Generic; ...@@ -6,9 +6,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace DeviceLibrary namespace DeviceLibrary
{ {
......
...@@ -39,6 +39,7 @@ namespace DeviceLibrary ...@@ -39,6 +39,7 @@ namespace DeviceLibrary
R11_NextReel, //开始下一盘料 R11_NextReel, //开始下一盘料
R12_ShelfNoTray, //料串已清空 R12_ShelfNoTray, //料串已清空
R20, R20,
R20_reel_duplicate,
R21, R21,
REND, REND,
//入料流程 //入料流程
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!