kingno
5 天以前 6caff8e3b06535a9652a791454135cf0e6ac110e
src/Bro.M135.Common/ProductModel.cs
@@ -3,6 +3,7 @@
using Bro.Common.Model;
using Bro.M135.DBManager;
using Newtonsoft.Json;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView;
namespace Bro.M135.Common
{
@@ -74,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;
@@ -421,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);
            }
        }
@@ -482,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);
        }
    }
}