using System; using System.Collections.Generic; using System.Linq; using System.Text; using Aitex.Core.RT.SCCore; using Aitex.Sorter.Common; using MECF.Framework.Common.Equipment; namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot.NX100 { public class ProtocolTag { public const string tag_end = "\r"; public const string tag_cmd_start = "$"; public const string cmd_token = ","; public const string resp_tag_normal = "$"; public const string resp_tag_error = "?"; public const string resp_tag_excute = "!"; public const string resp_tag_event = ">"; public const string resp_evt_error = "100"; } public class RobotConvertor { public static string chamber2staion(ModuleName chamber) { string st = ""; switch (chamber) { case ModuleName.LP1: st = "C1"; break; case ModuleName.LP2: st = "C2"; break; case ModuleName.LP3: st = "C3"; break; case ModuleName.LP4: st = "C4"; break; case ModuleName.LP5: st = "C5"; break; case ModuleName.LP6: st = "C6"; break; case ModuleName.LP7: st = "C7"; break; case ModuleName.LP8: st = "C8"; break; case ModuleName.LP9: st = "C9"; break; case ModuleName.LP10: st = "CA"; break; case ModuleName.Aligner: st = "P1"; break; } return st; } 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.LP9: case ModuleName.LP10: sslot = string.Format("{0:D2}", slot + 1); break; case ModuleName.Aligner: case ModuleName.Robot: case ModuleName.PMA: case ModuleName.PMB: case ModuleName.PMC: case ModuleName.PMD: case ModuleName.PME: case ModuleName.PMF: sslot = "00"; break; } return sslot; } public static string hand2string(Hand hand) { string st = ""; if (SC.ContainsItem("Robot.BladeUpDownReverse") && SC.GetValue("Robot.BladeUpDownReverse")) { switch (hand) { case Hand.Blade1: st = "A"; //单手臂 下 break; case Hand.Blade2: st = "B"; //4手臂 上 break; case Hand.Both: st = "W"; break; } } else { switch (hand) { case Hand.Blade1: st = "B"; //单手臂 下 break; case Hand.Blade2: st = "A"; //4手臂 上 break; case Hand.Both: st = "W"; break; } } return st; } public static string NextMotion2String(Motion motion,Hand hand) { string st = ""; switch (motion) { case Motion.Pick: st = string.Format("G{0}", hand2string(hand)); break; case Motion.Place: st = string.Format("P{0}", hand2string(hand)); break; case Motion.Exchange: st = string.Format("E{0}", hand2string(hand)); break; default: st = "AL"; break; } return st; } public static string Offset2String(int offset) { string st = ""; if (offset >= 0) { st = string.Format("{0:D5}", offset); } else { st = string.Format("{0:D4}", offset); } return st; } } }