using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Serialization; using CommonClassLib; using log4net; using System.Reflection; [assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config", Watch = true)] namespace RGDWCSServices { public class Base { public ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); #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 StaticClass.GetWarehouseIndex(); } private static int MAX_X = 15; private static int MAX_Y = 4; //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]); // int newno = (z - 1) * (27 * 6) + (x - 1) * 6 + (y - 1) + 1; // return $"{newno:D3}"; //} 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]); int newno = (z - 1) * (27 * 6) + (x - 1) * 6 + (y - 1) + 1; return $"{newno:D3}"; } #endregion } }