using Rs.DataAccess; using Rs.Framework; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Rs.MotionPlat.Commom { public class OffsetPoint { public double X { get; set; } public double Y { get; set; } public double A { get; set; } public bool FindOK { get; set; } = false; public void Reset() { X= 0; Y = 0; A = 0; FindOK = false; } } /// /// 周转盘单个穴位偏移 /// public static class TurnoverSlotOffset { static DataTable data = new DataTable(); static SqliteHelper db = new SqliteHelper(); public static void Init() { string querySql = $"select * from SlotOffset where recipename='{GlobalVar.CurRecipe}' and trayname='Turnover'"; data = db.GetDataTable(querySql); } public static void Reload() { data = new DataTable(); string querySql = $"select * from SlotOffset where recipename='{GlobalVar.CurRecipe}' and trayname='Turnover'"; data = db.GetDataTable(querySql); } public static OffsetPoint GetOffsetPoint(int slotIndex) { OffsetPoint offsetPoint = new OffsetPoint(); if (ObjectHelper.IsNotNullorEmpty(data)) { List drList = data.AsEnumerable().Where(d => d.Field("SlotIndex") == slotIndex).ToList(); if(drList!=null && drList.Count>0) { offsetPoint.FindOK= true; offsetPoint.X = double.Parse(drList[0]["OffsetX"].ToString()); offsetPoint.Y = double.Parse(drList[0]["OffsetY"].ToString()); offsetPoint.A = double.Parse(drList[0]["OffsetA"].ToString()); return offsetPoint; } } return offsetPoint; } } }