using System; using System.Collections.Generic; using System.Linq; using System.Text; using Aitex.Sorter.Common; using MECF.Framework.Common.Equipment; using Aitex.Core.RT.SCCore; using Aitex.Core.RT.Log; namespace Aitex.Sorter.RT.Device.Robot.SR100 { public class RobotConvertor { public static Dictionary TeachStation = new Dictionary() { {ModuleName.LP1, "C01"}, {ModuleName.LP2, "C02"}, {ModuleName.LP3, "C03"}, {ModuleName.LP4, "C04"}, {ModuleName.LP5, "C05"}, {ModuleName.LP6, "C06"}, {ModuleName.LP7, "C07"}, {ModuleName.LP8, "C08"}, {ModuleName.Aligner, "P01"}, {ModuleName.Buffer, "C05"}, {ModuleName.TurnOverStation, "S01"}, {ModuleName.PM1, "S01"}, {ModuleName.PM2, "S02"}, {ModuleName.PM3, "S03"}, {ModuleName.PM4, "S04"}, {ModuleName.PM5, "S05"}, {ModuleName.PM6, "S06"}, {ModuleName.PM7, "S07"}, {ModuleName.PM8, "S08"}, {ModuleName.Spin1L, "S01"}, {ModuleName.Spin1H, "S02"}, {ModuleName.Spin2L, "S03"}, {ModuleName.Spin2H, "S04"}, {ModuleName.Spin3L, "S05"}, {ModuleName.Spin3H, "S06"}, {ModuleName.Spin4L, "S07"}, {ModuleName.Spin4H, "S08"}, {ModuleName.LL1, "S01"}, {ModuleName.LL2, "S02"}, {ModuleName.LL3, "S03"}, {ModuleName.LL4, "S04"}, }; public static string chamber2staion(ModuleName chamber) { if (!TeachStation.ContainsKey(chamber)) { LOG.Error($"not define teach position {chamber}"); return ""; } string ret = TeachStation[chamber]; if (chamber == ModuleName.Aligner && SC.ContainsItem("Aligner.AlignerStation")) return SC.GetStringValue("Aligner.AlignerStation"); if (SC.ContainsItem($"CarrierInfo.{chamber}CarrierIndex")) { int idex = SC.GetValue($"CarrierInfo.{chamber}CarrierIndex"); if (SC.ContainsItem($"CarrierInfo.{chamber}Station{idex}")) { ret = SC.GetStringValue($"CarrierInfo.{chamber}Station{idex}"); } } return ret; } public static string chamberSlot2Slot(ModuleName chamber, int slot) { string sslot = ""; switch (chamber) { case ModuleName.LP1: case ModuleName.LP2: case ModuleName.LP3: case ModuleName.LP4: case ModuleName.LP5: case ModuleName.LP6: case ModuleName.LP7: case ModuleName.LP8: case ModuleName.LP10: case ModuleName.Buffer: sslot = string.Format("{0:D2}", slot + 1); break; case ModuleName.Aligner: case ModuleName.Robot: case ModuleName.LL1: case ModuleName.LL2: case ModuleName.LL3: case ModuleName.LL4: case ModuleName.LLA: case ModuleName.LLB: case ModuleName.LLC: case ModuleName.LLD: case ModuleName.TurnOverStation: sslot = "00"; break; } return sslot; } public static string hand2string(Hand hand) { string st = ""; switch (hand) { case Hand.Blade1: st = "1"; break; case Hand.Blade2: st = "2"; break; case Hand.Both: st = "F"; break; } return st; } public static string IsPick2Position(bool isPick) { var pos = isPick ? "P1" : "G1"; return pos; } public static string Offset2String(int offset) { string st = ""; if (offset >= 0) { st = string.Format("{0:D8}", offset); } else { st = string.Format("{0:D7}", offset); } return st; } } }