using RGD.Common; using RGD.DataService; namespace RGD.MdsAPI { public class Base { #region 子类 /// 入参公共类型 /// 入参公共类型 /// public class InPara { } /// 出参公共类型 /// 出参公共类型 /// public class OutPara { private string _result_flag; private string _error_info; ///成功标志 /// 成功标志 /// public string RESULT_FLAG { get { return this._result_flag; } set { this._result_flag = value; } } ///错误代码 /// 错误代码 /// public string ERROR_INFO { get { return this._error_info; } set { this._error_info = value; } } } #endregion 子类 #region 方法 /// 反序列化 /// 反序列化 /// /// 类型 /// XML字符串 /// public T DeSerialize(string xml) { return XmlSerialization.DeSerialize(xml); } /// 序列化XML文件 /// 序列化XML文件 /// /// 类型 /// 对象 /// public string Serializer(T t) { return XmlSerialization.Serializer(t); } public static string GetWarehouseIndex() { return new WarehouseService().GetWarehouseIndex(); } private static int MAX_X = 12; private static int MAX_Y = 7; //public static string getWCS_LOC_NO(string WMS_LOC_NO) //{ // if (WMS_LOC_NO == "") // return ""; // int x, y, z; // int wms_loc = int.Parse(WMS_LOC_NO); // z = wms_loc / (MAX_X * MAX_Y) + ((wms_loc % (MAX_X * MAX_Y)) > 0 ? 1 : 0); // int m = (wms_loc - (z - 1) * MAX_X * MAX_Y); // x = m / MAX_Y + ((m % MAX_Y) > 0 ? 1 : 0); // y = wms_loc - (z - 1) * MAX_X * MAX_Y - (x - 1) * MAX_Y; // return z.ToString().PadLeft(2, '0') + "-" + x.ToString().PadLeft(2, '0') + "-" + y.ToString().PadLeft(2, '0'); //} public static string getWCS_LOC_NO(string WMS_LOC_NO) { if (WMS_LOC_NO == "") return ""; int.TryParse(WMS_LOC_NO,out int index); int row = (index - 1) / (27 * 6) + 1; int col = ((index - 1) % (27 * 6)) / 6 + 1; int layer = (index - 1) % 6 + 1; return $"{row:D2}-{col:D2}-{layer:D2}"; } //public static string getWMS_LOC_NO(string WCS_LOC_NO) //{ // if (WCS_LOC_NO == "") // return ""; // int x, y, z; // z = int.Parse(WCS_LOC_NO.Split('-')[0]); // x = int.Parse(WCS_LOC_NO.Split('-')[1]); // y = int.Parse(WCS_LOC_NO.Split('-')[2]); // return ((z - 1) * MAX_X * MAX_Y + (x - 1) * MAX_Y + y).ToString().PadLeft(3, '0'); //} public static string getWMS_LOC_NO(string WCS_LOC_NO) { if (WCS_LOC_NO == "") return ""; int x, y, z; z = int.Parse(WCS_LOC_NO.Split('-')[0]); x = int.Parse(WCS_LOC_NO.Split('-')[1]); y = int.Parse(WCS_LOC_NO.Split('-')[2]); int newno = (z-1)*(27*6)+(x-1)*6+(y-1)+1; return $"{newno:D3}"; } //public static string getWMS_LOC_NO(string WCS_LOC_NO) //{ // if (WCS_LOC_NO == "") // return ""; // int x, y, z; // z = int.Parse(WCS_LOC_NO.Split('-')[0]); // x = int.Parse(WCS_LOC_NO.Split('-')[1]); // y = int.Parse(WCS_LOC_NO.Split('-')[2]); // int max_x = 15; // int max_y = 4; // int newno = (z - 1) * max_x * max_y + (x - 1) * max_y + y; // return newno.ToString().PadLeft(3, '0'); //} #endregion 方法 } }