From aa6b32cb313c914e5f8eed0a347551f8fc65ffbd Mon Sep 17 00:00:00 2001
From: kingno <30263@KINGNO>
Date: 星期三, 27 八月 2025 16:51:18 +0800
Subject: [PATCH] 合并
---
src/Bro.M135.Common/ProductModel.cs | 97 ++++++++++++++++++++++++++++++++++++++----------
1 files changed, 76 insertions(+), 21 deletions(-)
diff --git a/src/Bro.M135.Common/ProductModel.cs b/src/Bro.M135.Common/ProductModel.cs
index 5e1df4b..6737e19 100644
--- a/src/Bro.M135.Common/ProductModel.cs
+++ b/src/Bro.M135.Common/ProductModel.cs
@@ -1,7 +1,9 @@
锘縰sing Bro.Common.Helper;
+using Bro.Common.Interface;
using Bro.Common.Model;
using Bro.M135.DBManager;
using Newtonsoft.Json;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView;
namespace Bro.M135.Common
{
@@ -53,11 +55,11 @@
{
if (!string.IsNullOrWhiteSpace(d.FAIData))
{
- d.SpecList = JsonConvert.DeserializeObject<List<Spec>>(d.FAIData);
+ d.SpecList = JsonConvert.DeserializeObject<List<ISpec>>(d.FAIData);
}
else
{
- d.SpecList = new List<Spec>();
+ d.SpecList = new List<ISpec>();
}
if (!string.IsNullOrWhiteSpace(d.DefectDesc))
@@ -73,6 +75,13 @@
#endregion
public bool IsPreStationOK { get; set; } = false;
+
+ [JsonIgnore]
+ public List<string> ImagePaths { get; set; } = new List<string>();
+
+ public List<Netdefectdetail> Netdefectdetails = new List<Netdefectdetail>();
+
+ public List<double> Centermatrix { get; set; } = new List<double>();
public DateTime? EndTime { get; set; } = null;
@@ -193,10 +202,12 @@
});
});
- head = $"PID,鏉$爜,姹囨�绘娴嬬粨鏋�,";
+ allSpecs.RemoveAll(u => (u.Code.ToLower() == "ngspec" || u.Code == "妫�娴婽BD"));
+
+ head = $"鏃堕棿,PID,鏍忓叿鐮�,鐗╂枡鐮�,鏉$爜,姹囨�绘娴嬬粨鏋�,";
positionList = new List<string>();
- Details = Details.OrderBy(u => u.PositionName).ToList();
+ Details = Details.OrderBy(u => u.STATION_CODE).ThenBy(u => u.PositionName).ToList();
foreach (var d in Details)
{
positionList.Add($"{d.STATION_CODE}_{d.PositionName}");
@@ -233,7 +244,8 @@
});
});
- string data = $"{PID},{SN},{Result},";
+ //鏃堕棿,PID,鏍忓叿鐮�,鐗╂枡鐮�,鏉$爜,姹囨�绘娴嬬粨鏋�,";
+ string data = $"{DateTime.Now.ToString("yyyyMMddHHmmss")}T,{PID},{BasketCode},{SEQUENCE},{SN},{Result},";
positionList.ForEach(pName =>
{
var detail = Details.FirstOrDefault(u => $"{u.STATION_CODE}_{u.PositionName}" == pName);
@@ -301,7 +313,9 @@
});
});
- head = $"鏃堕棿,PID,搴忓彿,鏉$爜,";
+ allSpecs.RemoveAll(u => u.Code.ToLower() == "ngspec" || u.Code == "妫�娴婽BD");
+
+ head = $"鏃堕棿,鏍忓叿鐮�,PID,搴忓彿,鏉$爜,";
foreach (var d in positionDetail)
{
@@ -338,7 +352,7 @@
});
});
- string data = $"{DateTime.Now.ToString("HH:mm:ss.fff")}T,{PID},{SEQUENCE},{SN},";
+ string data = $"{DateTime.Now.ToString("HH:mm:ss.fff")}T,{BasketCode},{PID},{SEQUENCE},{SN},";
positionDetail.ForEach(detail =>
{
if (!detail.IsDone)
@@ -378,22 +392,22 @@
}
});
- positionDetail.ForEach(detail =>
- {
- if (detail.IsDone)
- {
+ //positionDetail.ForEach(detail =>
+ //{
+ // if (detail.IsDone)
+ // {
- var results = detail.ResultList;
+ // var results = detail.ResultList;
- var list = results.Where((DetectResult u) => u.ResultState != EnumHelper.ResultState.OK).SelectMany((DetectResult u) => u.NetResults.Where((NetResult m) => !m.IsAbandoned && m.CurResult != EnumHelper.ResultState.OK).SelectMany((NetResult m) => from n in m.DetectDetails where !n.IsAbandoned && n.FinalResult != EnumHelper.ResultState.OK select n)).ToList();
+ // var list = results.Where((DetectResult u) => u.ResultState != EnumHelper.ResultState.OK).SelectMany((DetectResult u) => u.NetResults.Where((NetResult m) => !m.IsAbandoned && m.CurResult != EnumHelper.ResultState.OK).SelectMany((NetResult m) => from n in m.DetectDetails where !n.IsAbandoned && n.FinalResult != EnumHelper.ResultState.OK select n)).ToList();
- list.ForEach(d =>
- {
- data += $"{(d.Rect.Height * d.PixelSize).ToString("f4")},";
- data += $"{(d.Rect.Width * d.PixelSize).ToString("f4")},";
- });
- }
- });
+ // list.ForEach(d =>
+ // {
+ // data += $"{(d.Rect.Height * d.PixelSize).ToString("f4")},";
+ // data += $"{(d.Rect.Width * d.PixelSize).ToString("f4")},";
+ // });
+ // }
+ //});
@@ -415,12 +429,20 @@
#endregion
#region PositionCheckTimes
- public void InitialPositionCheckList(string positionName, List<int> checkTimes)
+ public void InitialPositionCheckList(string positionName, List<int> checkTimes, string stationName)
{
lock (_checkResultLock)
{
PositionCheckList[positionName] = new List<int>(checkTimes);
Details.RemoveAll(u => u.PositionName == positionName);
+
+
+ P_PRODUCT_DETAIL detail = new P_PRODUCT_DETAIL();
+ detail.STATION_CODE = stationName;
+ detail.PositionName = positionName;
+ detail.PID = PID;
+ detail.IsDone = false;
+ Details.Add(detail);
}
}
@@ -476,4 +498,37 @@
TimeoutTimer = null;
}
}
+
+
+
+ public class Netdefectdetail
+ {
+ public string name { get; set; }
+
+ public double centerX { get; set; }
+ public double centerY { get; set; }
+
+
+
+
+ public static double GetDistance(double x1, double y1, double x2, double y2)
+ {
+ double dx = x2 - x1;
+ double dy = y2 - y1;
+ return Math.Sqrt(dx * dx + dy * dy);
+ }
+ public static bool operator ==(Netdefectdetail a, Netdefectdetail b)
+ {
+ if (GetDistance(a.centerX, a.centerY, b.centerX, b.centerY) < 50)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public static bool operator !=(Netdefectdetail a, Netdefectdetail b)
+ {
+ return !(a == b);
+ }
+ }
}
--
Gitblit v1.8.0