/// <summary> /// <para>將自己轉換為 4 碼的Drawer 代碼, 如果是,回傳 Tuple<true,代碼>如果不是 Drawer Location 的列舉, 就回傳 Tuple<false,""></para> /// <para>代碼格式, 如:0101, 0102, 0704, ......</para> /// </summary> /// <param name="inst"></param> /// <returns></returns> public static Tuple <bool, string> To4DigitDrawerCode(this BoxrobotTransferLocation inst) { Tuple <bool, string> rtnV = null; if (inst.IsDrawer()) { try { var drawerText = inst.ToString(); string code = ""; string[] ary = drawerText.Split('_'); int aryLength = ary.Length; code = ary[ary.Length - 2] + ary[aryLength - 1]; rtnV = Tuple.Create(true, code); } catch (Exception ex) { rtnV = Tuple.Create(false, string.Empty); } } else { rtnV = Tuple.Create(false, string.Empty); } return(rtnV); }
public static string ToText(this BoxrobotTransferLocation inst) { string rtnV = inst.ToDefaultText(); if (inst != BoxrobotTransferLocation.Dontcare) { rtnV = inst.ToString(); } return(rtnV); }