2026-06-05 13:44:39 +09:00

61 lines
2.1 KiB
C#

using Aurora.Api;
using System;
using System.Collections.Generic;
namespace VisionCommon {
public class BcrResultItem {
public string Time { get; set; }
public string Code { get; set; }
public double IX { get; set; }
public double IY { get; set; }
public double SX { get; set; }
public double SY { get; set; }
public string Status { get; set; }
}
public class BcrResultItemManager : ItemManagerBase {
private static readonly Logger _Logger = new Logger("BcrResultItemManager");
private static readonly object _Lock = new object();
public static BcrResultItem GetBcrResultItem(SubSysInfo subSysInfo, PatternResult patternResult) {
string timeStamp = GetTimeStamp(subSysInfo, patternResult);
try {
lock (_Lock) {
double ix = 0;
double iy = 0;
double sx = 0;
double sy = 0;
foreach (BaseResult result in patternResult.Results) {
ix = result.ImagePosition.X;
iy = result.ImagePosition.Y;
sx = result.MaterialPosition.X;
sy = result.MaterialPosition.Y;
break;
}
foreach (CodeResult result in patternResult.Results) {
return new BcrResultItem() {
Time = timeStamp,
Code = result.Code,
IX = ix,
IY = iy,
SX = CoordUnitValueConverter.GetCoordUnitValue(sx),
SY = CoordUnitValueConverter.GetCoordUnitValue(sy),
Status = patternResult.Status.ToString()
};
}
}
}
catch (Exception e) {
_Logger.FuncE(e.Message);
}
return new BcrResultItem() {
Time = timeStamp,
Status = eFoundStatus.NotFound.ToString()
};
}
}
}