143 lines
4.0 KiB
C#
143 lines
4.0 KiB
C#
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 子类
|
|
|
|
/// <summary>入参公共类型
|
|
/// 入参公共类型
|
|
/// </summary>
|
|
public class InPara
|
|
{
|
|
}
|
|
|
|
/// <summary>出参公共类型
|
|
/// 出参公共类型
|
|
/// </summary>
|
|
public class OutPara
|
|
{
|
|
private string _result_flag;
|
|
private string _error_info;
|
|
|
|
|
|
///<sumary>成功标志
|
|
/// 成功标志
|
|
///</sumary>
|
|
public string RESULT_FLAG
|
|
{
|
|
get { return this._result_flag; }
|
|
set { this._result_flag = value; }
|
|
}
|
|
///<sumary>错误代码
|
|
/// 错误代码
|
|
///</sumary>
|
|
public string ERROR_INFO
|
|
{
|
|
get { return this._error_info; }
|
|
set { this._error_info = value; }
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 方法
|
|
|
|
/// <summary> 反序列化
|
|
/// 反序列化
|
|
/// </summary>
|
|
/// <param name="type">类型</param>
|
|
/// <param name="xml">XML字符串</param>
|
|
/// <returns></returns>
|
|
public T DeSerialize<T>(string xml)
|
|
{
|
|
return XmlSerialization.DeSerialize<T>(xml);
|
|
}
|
|
|
|
/// <summary> 序列化XML文件
|
|
/// 序列化XML文件
|
|
/// </summary>
|
|
/// <param name="type">类型</param>
|
|
/// <param name="obj">对象</param>
|
|
/// <returns></returns>
|
|
public string Serializer<T>(T t)
|
|
{
|
|
return XmlSerialization.Serializer<T>(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
|
|
}
|
|
}
|