using HH.WCS.QingXigongchang.wms;
|
using Newtonsoft.Json;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace HH.WCS.QingXigongchang.util
|
{
|
public class Settings
|
{
|
public static Dictionary<string, WorkOrder> OrderCaches = new Dictionary<string, WorkOrder>();
|
|
static object lockTPnum = new object();
|
/// <summary>
|
/// 记录 翻斗机名称, 和 筐的起点 area
|
/// </summary>
|
public static Dictionary<string, List<string>> _Dic_str_int = new Dictionary<string, List<string>>();
|
|
public static string GetTimeStamp(DateTime? time = null)
|
{
|
TimeSpan ts = DateTime.UtcNow - (time ?? new DateTime(1970, 1, 1, 0, 0, 0, 0));
|
return Convert.ToInt64(ts.TotalMilliseconds).ToString();
|
}
|
|
#region _securityKey
|
private static string _securityKey = "";
|
public static string securityKey
|
{
|
get
|
{
|
if (_securityKey == "")
|
{
|
_securityKey = XmlHelper.GetElementValue("securityKey");
|
}
|
return _securityKey;
|
}
|
}
|
#endregion
|
#region _tokenfrom
|
private static string _tokenfrom = "";
|
public static string tokenfrom
|
{
|
get
|
{
|
if (_tokenfrom == "")
|
{
|
_tokenfrom = XmlHelper.GetElementValue("tokenfrom");
|
}
|
return _tokenfrom;
|
}
|
}
|
#endregion
|
#region _repoNo
|
private static string _repoNo = "";
|
public static string repoNo
|
{
|
get
|
{
|
if (_repoNo == "")
|
{
|
_repoNo = XmlHelper.GetElementValue("repoNo");
|
}
|
return _repoNo;
|
}
|
}
|
#endregion
|
#region _FuleServerUrl
|
private static string _FuleServerUrl = "";
|
public static string FuleServerUrl
|
{
|
get
|
{
|
if (_FuleServerUrl == "")
|
{
|
_FuleServerUrl = XmlHelper.GetElementValue("FuleServerUrl");
|
}
|
return _FuleServerUrl;
|
}
|
}
|
#endregion
|
#region _factoryCode
|
private static string _factoryCode = "";
|
public static string factoryCode
|
{
|
get
|
{
|
if (_factoryCode == "")
|
{
|
_factoryCode = XmlHelper.GetElementValue("factoryCode");
|
}
|
return _factoryCode;
|
}
|
}
|
#endregion
|
|
#region _MesServerUrl
|
private static string _MesServerUrl = "";
|
public static string MesServerUrl
|
{
|
get
|
{
|
if (_MesServerUrl == "")
|
{
|
_MesServerUrl = XmlHelper.GetElementValue("MesServerUrl");
|
}
|
return _MesServerUrl;
|
}
|
}
|
#endregion
|
public static string _TPcc
|
{
|
get
|
{
|
return DateTime.Now.ToString("yyMMdd");
|
}
|
}
|
public static int _TPnum = 0;
|
public static string TPnum()
|
{
|
lock (lockTPnum)
|
{
|
var ti = (++_TPnum) + "";
|
return "TP" + _TPcc + (ti.PadLeft(5, '0'));
|
}
|
}
|
|
public static string areaSuffix(string size)
|
{
|
switch (size)
|
{
|
case "大板":
|
size = "_D";
|
break;
|
case "小板":
|
size = "_X";
|
break;
|
case "集化板":
|
size = "_J";
|
break;
|
default:
|
size = "";
|
break;
|
}
|
return size;
|
}
|
public static string areaSuffixR(string a)
|
{
|
if (a.Contains("_D"))
|
a = "大板";
|
else if (a.Contains("_X"))
|
a = "小板";
|
else if (a.Contains("_J"))
|
a = "集化板";
|
else a = "";
|
return a;
|
}
|
|
|
#region _任务上报地址。
|
private static string _TaskReportUrl = "";
|
public static string TaskReportUrl
|
{
|
get
|
{
|
if (_TaskReportUrl == "")
|
{
|
_TaskReportUrl = XmlHelper.GetElementValue("TaskReportUrl");
|
}
|
return _TaskReportUrl;
|
}
|
}
|
#endregion
|
#region OneSign
|
private static string _OneSign = "";
|
public static string OneSign
|
{
|
get
|
{
|
if (_OneSign == "")
|
{
|
_OneSign = XmlHelper.GetElementValue("OneSign");
|
}
|
return _OneSign;
|
}
|
}
|
#endregion
|
#region FactoryCode
|
private static string _FactoryCode = "";
|
public static string FactoryCode
|
{
|
get
|
{
|
if (_FactoryCode == "")
|
{
|
_FactoryCode = XmlHelper.GetElementValue("FactoryCode");
|
}
|
return _FactoryCode;
|
}
|
}
|
#endregion
|
#region TaskReportKey
|
private static string _TaskReportKey = "";
|
public static string TaskReportKey
|
{
|
get
|
{
|
if (_TaskReportKey == "")
|
{
|
_TaskReportKey = XmlHelper.GetElementValue("TaskReportKey");
|
}
|
return _TaskReportKey;
|
}
|
}
|
#endregion
|
#region FactoryName
|
private static string _FactoryName = "";
|
public static string FactoryName
|
{
|
get
|
{
|
if (_FactoryName == "")
|
{
|
_FactoryName = XmlHelper.GetElementValue("FactoryName");
|
}
|
return _FactoryName;
|
}
|
}
|
#endregion
|
|
#region _HostToAgvServerUrl
|
private static string _hostToAgvServerUrl = "";
|
public static string HostToAgvServerUrl
|
{
|
get
|
{
|
if (_hostToAgvServerUrl == "")
|
{
|
_hostToAgvServerUrl = XmlHelper.GetElementValue("HostToAgvServerUrl");
|
}
|
return _hostToAgvServerUrl;
|
}
|
}
|
#endregion
|
|
#region _OITcpServerUrl
|
private static string _OITcpServerUrl = "";
|
public static string OITcpSeverUrl
|
{
|
get
|
{
|
if (_OITcpServerUrl == "")
|
{
|
_OITcpServerUrl = XmlHelper.GetElementValue("OITcpServerUrl");
|
}
|
return _OITcpServerUrl;
|
}
|
}
|
#endregion
|
|
#region _elevatorIP
|
private static string _elevatorIP = "";
|
public static string ElevatorIP
|
{
|
get
|
{
|
if (_elevatorIP == "")
|
{
|
_elevatorIP = XmlHelper.GetElementValue("elevatorIP");
|
}
|
return _elevatorIP;
|
}
|
}
|
#endregion
|
|
#region _elevatorWaitMinute
|
private static int _elevatorWaitMinute = 0;
|
public static int ElevatorWaitMinute
|
{
|
get
|
{
|
if (_elevatorWaitMinute == 0)
|
{
|
_elevatorWaitMinute = int.Parse(XmlHelper.GetElementValue("elevatorWaitMinute"));
|
}
|
return _elevatorWaitMinute;
|
}
|
}
|
#endregion
|
|
#region _SqlServer
|
private static string _SqlServer = "";
|
public static string SqlServer
|
{
|
get
|
{
|
if (_SqlServer == "")
|
{
|
_SqlServer = XmlHelper.GetElementValue("SqlServer");
|
}
|
return _SqlServer;
|
}
|
}
|
private static string _AgvSqlServer = "";
|
public static string AgvSqlServer
|
{
|
get
|
{
|
if (_AgvSqlServer == "")
|
{
|
_AgvSqlServer = XmlHelper.GetElementValue("AgvSqlServer");
|
}
|
return _AgvSqlServer;
|
}
|
}
|
#endregion
|
|
#region deviceInfo
|
private static string _deviceInfo = "";
|
private static string deviceInfoList
|
{
|
get
|
{
|
if (_deviceInfo == "")
|
{
|
_deviceInfo = XmlHelper.GetElementValue("deviceInfo");
|
}
|
return _deviceInfo;
|
}
|
}
|
|
private static List<deviceInfo> deviceInfos = new List<deviceInfo>();
|
public static List<deviceInfo> GetDeviceInfoList()
|
{
|
if (deviceInfos.Count == 0 && deviceInfoList != "")
|
{
|
Console.WriteLine(deviceInfoList);
|
deviceInfos = Newtonsoft.Json.JsonConvert.DeserializeObject<List<deviceInfo>>(deviceInfoList);
|
}
|
return deviceInfos;
|
}
|
|
public class deviceInfo
|
{
|
public string address { get; set; }
|
public string deviceName { get; set; }
|
public string FuLeLineNo { get; set; }
|
public string[] deviceNo { get; set; }
|
|
/// <summary>
|
/// 优先级
|
/// </summary>
|
public string[] areaPriy { get; set; }
|
|
public string[] location { get; set; }
|
/// <summary>
|
/// 1 门(独立门)
|
/// 2 无菌盖
|
/// 3 水盖
|
/// 4 水盖翻斗机
|
/// 5 瓶坯翻斗机
|
/// 6 无菌翻斗机
|
/// 8 瓶坯
|
/// 9 550水线 1满2空
|
/// 10 水线翻斗机。
|
/// 11电梯,提升机。吊机。 管他啥,从一楼搬二楼。
|
/// </summary>
|
public int deviceType { get; set; }
|
public int enable { get; set; }
|
|
/// <summary>
|
/// 任务权重。
|
/// </summary>
|
public int taskPri { get; set; } = 60;
|
|
/// <summary>
|
/// 分钟数 =- 切筐时的等待。
|
/// </summary>
|
public int EmptyWait { get; set; } = 1;
|
|
}
|
#endregion
|
|
#region inStockCacheBit
|
private static string _inStockCacheBit = "";
|
private static string inStockCacheBitList
|
{
|
get
|
{
|
if (_inStockCacheBit == "")
|
{
|
_inStockCacheBit = XmlHelper.GetElementValue("inStockCacheBit");
|
}
|
return _inStockCacheBit;
|
}
|
}
|
|
private static List<inStockCacheBit> inStockCacheBits = new List<inStockCacheBit>();
|
public static List<inStockCacheBit> GetInStockCacheList()
|
{
|
if (inStockCacheBits.Count == 0 && inStockCacheBitList != "")
|
{
|
inStockCacheBits = Newtonsoft.Json.JsonConvert.DeserializeObject<List<inStockCacheBit>>(inStockCacheBitList);
|
}
|
return inStockCacheBits;
|
}
|
|
public class inStockCacheBit
|
{
|
public string deviceName { get; set; }
|
public string location { get; set; }
|
public int locationType { get; set; }
|
|
}
|
#endregion
|
|
#region elevatorCacheBit
|
private static string _elevatorCacheBit = "";
|
private static string elevatorCacheList
|
{
|
get
|
{
|
if (_elevatorCacheBit == "")
|
{
|
_elevatorCacheBit = XmlHelper.GetElementValue("elevatorCacheBit");
|
}
|
return _elevatorCacheBit;
|
}
|
}
|
|
private static List<elevatorCacheBit> elevatorCacheBits = new List<elevatorCacheBit>();
|
public static List<elevatorCacheBit> GetElevatorCacheBits()
|
{
|
Console.WriteLine("elevatorCacheList =" + elevatorCacheList);
|
if (elevatorCacheBits.Count == 0 && elevatorCacheList != "")
|
{
|
elevatorCacheBits = Newtonsoft.Json.JsonConvert.DeserializeObject<List<elevatorCacheBit>>(elevatorCacheList);
|
}
|
return elevatorCacheBits;
|
}
|
/// <summary>
|
/// {"location":"内部货位","order":0,"agvBits":[100,101]},
|
/// </summary>
|
public class elevatorCacheBit
|
{
|
|
public string location { get; set; }
|
|
public int order { get; set; }
|
public int[] agvBits { get; set; }
|
|
}
|
#endregion
|
|
#region elevatorDoor
|
private static string _elevatorDoor = "";
|
public static string elevatorDoorList
|
{
|
get
|
{
|
if (_elevatorDoor == "")
|
{
|
_elevatorDoor = XmlHelper.GetElementValue("elevatorDoor");
|
}
|
return _elevatorDoor;
|
}
|
}
|
|
private static List<elevatorDoor> elevatorDoors = new List<elevatorDoor>();
|
public static List<elevatorDoor> GetelEvatorDoorList()
|
{
|
if (elevatorDoors.Count == 0 && elevatorDoorList != "")
|
{
|
elevatorDoors = Newtonsoft.Json.JsonConvert.DeserializeObject<List<elevatorDoor>>(elevatorDoorList);
|
}
|
return elevatorDoors;
|
}
|
|
public class elevatorDoor
|
{
|
public string door { get; set; }
|
public int floor { get; set; }
|
public int addr { get; set; }
|
|
|
}
|
#endregion
|
|
#region tipperCacheBit
|
private static string _tipperCacheBit = "";
|
private static string tipperCacheBitList
|
{
|
get
|
{
|
if (_tipperCacheBit == "")
|
{
|
_tipperCacheBit = XmlHelper.GetElementValue("tipperCacheBit");
|
}
|
return _tipperCacheBit;
|
}
|
}
|
|
private static List<TipperCacheBit> tipperCacheBits = new List<TipperCacheBit>();
|
public static List<TipperCacheBit> GetTipperCacheList()
|
{
|
if (tipperCacheBits.Count == 0 && tipperCacheBitList != "")
|
{
|
tipperCacheBits = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TipperCacheBit>>(tipperCacheBitList);
|
}
|
return tipperCacheBits;
|
}
|
|
public class TipperCacheBit
|
{
|
public string deviceName { get; set; }
|
public string[] location { get; set; }
|
/// <summary>
|
///locationType=11 满托位 locationType=12 空铁框 locationType=13 空塑料框
|
/// </summary>
|
public int locationType { get; set; }
|
|
}
|
#endregion
|
|
#region outStockCacheBit
|
private static string _outStockCacheBit = "";
|
private static string outStockCacheBitList
|
{
|
get
|
{
|
if (_outStockCacheBit == "")
|
{
|
_outStockCacheBit = XmlHelper.GetElementValue("outStockCacheBit");
|
}
|
return _outStockCacheBit;
|
}
|
}
|
|
private static List<outStockCacheBit> outStockCacheBits = new List<outStockCacheBit>();
|
public static List<outStockCacheBit> GetOutStockCacheList()
|
{
|
if (outStockCacheBits.Count == 0 && outStockCacheBitList != "")
|
{
|
outStockCacheBits = Newtonsoft.Json.JsonConvert.DeserializeObject<List<outStockCacheBit>>(outStockCacheBitList);
|
}
|
return outStockCacheBits;
|
}
|
|
public class outStockCacheBit
|
{
|
public string areaName { get; set; }
|
public string[] location { get; set; }
|
/// <summary>
|
///locationType=1 无菌盖满(row=0专门给V6) locationType=2 水盖满
|
///locationType=3 铁空2层 loationType = 4 塑料空2层
|
///locationType = 4 v8满 locationType = 5 v8铁空 locationType = 6 v8塑料空
|
/// </summary>
|
public int locationType { get; set; }
|
public int row { get; set; }
|
|
}
|
#endregion
|
|
#region rawMaterialCacheBit
|
private static string _rawMaterialCacheBit = "";
|
private static string rawMaterialCacheBitList
|
{
|
get
|
{
|
if (_rawMaterialCacheBit == "")
|
{
|
_rawMaterialCacheBit = XmlHelper.GetElementValue("rawMaterialCacheBit");
|
}
|
return _rawMaterialCacheBit;
|
}
|
}
|
|
private static List<RawMaterialCacheBit> rawMaterialCacheBits = new List<RawMaterialCacheBit>();
|
public static List<RawMaterialCacheBit> GetRawMaterialCacheList()
|
{
|
if (rawMaterialCacheBits.Count == 0 && rawMaterialCacheBitList != "")
|
{
|
rawMaterialCacheBits = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RawMaterialCacheBit>>(rawMaterialCacheBitList);
|
}
|
return rawMaterialCacheBits;
|
}
|
|
public class RawMaterialCacheBit
|
{
|
public string[] location { get; set; }
|
public int locationType { get; set; }
|
public int row { get; set; }
|
|
}
|
#endregion
|
|
#region outStockCacheBit
|
private static string _outgoCacheBit = "";
|
private static string outgoCacheBitList
|
{
|
get
|
{
|
if (_outgoCacheBit == "")
|
{
|
_outgoCacheBit = XmlHelper.GetElementValue("outgoCacheBit");
|
}
|
return _outgoCacheBit;
|
}
|
}
|
|
private static List<OutgoCacheBit> outgoCacheBits = new List<OutgoCacheBit>();
|
public static List<OutgoCacheBit> GetOutgoCacheList()
|
{
|
if (outgoCacheBits.Count == 0 && outgoCacheBitList != "")
|
{
|
outgoCacheBits = Newtonsoft.Json.JsonConvert.DeserializeObject<List<OutgoCacheBit>>(outgoCacheBitList);
|
}
|
return outgoCacheBits;
|
}
|
|
public class OutgoCacheBit
|
{
|
public string[] location { get; set; }
|
public int locationType { get; set; }
|
public int row { get; set; }
|
|
}
|
#endregion
|
|
#region MoreSites
|
private static string _MoreBit = "";
|
private static string moreBit
|
{
|
get
|
{
|
if (_MoreBit == "")
|
{
|
_MoreBit = XmlHelper.GetElementValue("MoreSites");
|
}
|
return _MoreBit;
|
}
|
}
|
|
private static List<MoreSites> MoreBits = new List<MoreSites>();
|
public static List<MoreSites> GetMoreBits()
|
{
|
if (MoreBits.Count == 0 && moreBit != "")
|
{
|
MoreBits = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MoreSites>>(moreBit);
|
}
|
return MoreBits;
|
}
|
|
public class MoreSites
|
{
|
public string Location { get; set; }
|
public int StartBit { get; set; }
|
public int EndBit { get; set; }
|
|
}
|
#endregion
|
|
#region
|
|
private static string BolAreaList
|
{
|
get
|
{
|
return XmlHelper.GetElementValue("BOLArea") ?? "";
|
}
|
}
|
|
public static List<BolArea> GetBolAreaList()
|
{
|
return Newtonsoft.Json.JsonConvert.DeserializeObject<List<BolArea>>(BolAreaList); ;
|
}
|
public class BolArea
|
{
|
/// <summary>
|
/// 设备名称。
|
/// </summary>
|
public string DeviceName { get; set; }
|
/// <summary>
|
/// F即产线边位
|
/// </summary>
|
public string NotUsingBolArea { get; set; }
|
/// <summary>
|
/// 即产线边位
|
/// </summary>
|
public string UsingBolArea { get; set; }
|
/// <summary>
|
/// F即产线边 kong 位
|
/// </summary>
|
public string NotUsingEmpty { get; set; }
|
/// <summary>
|
/// 即产线边 kong 位
|
/// </summary>
|
public string UsingEmpty { get; set; }
|
/// <summary>
|
/// 设备类型和 deviceiNFO 一样 2水3无菌 盖, 4水5坯 6无菌 10水线(水盖) 斗
|
/// </summary>
|
public int deviceType { get; set; }
|
}
|
#endregion
|
|
|
|
#region DoorOneToMany
|
|
private static string _dm = "";
|
private static string dnl
|
{
|
get
|
{
|
if (_dm == "")
|
{
|
_dm = XmlHelper.GetElementValue("DoorOneToMany");
|
}
|
return _dm;
|
}
|
}
|
|
private static List<DoorOneToMany> DoorOneToManys = new List<DoorOneToMany>();
|
|
|
public static List<DoorOneToMany> GetDoorOneToMany()
|
{
|
if (DoorOneToManys.Count == 0 && dnl != "")
|
{
|
Console.WriteLine(dnl);
|
DoorOneToManys = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DoorOneToMany>>(dnl);
|
}
|
return DoorOneToManys;
|
}
|
|
//{"DoorNo":"10","deviceNo":["184","185"]},
|
public class DoorOneToMany
|
{
|
/// <summary>
|
/// 上报的门号。
|
/// </summary>
|
public string DoorNo { get; set; }
|
/// <summary>
|
/// 这里是设备的IP 对应的门号, 当然,如果现场给的多个门号10 ,那么就自定义ip 的门号
|
/// </summary>
|
public string[] deviceNo { get; set; }
|
/// <summary>
|
/// s数量和 deviceNo 对应, 打开的信号。
|
/// </summary>
|
public string[] SignOpen { get; set; }
|
/// <summary>
|
/// s数量和 deviceNo 对应, 关闭的信号。
|
/// </summary>
|
public string[] SignClose { get; set; }
|
}
|
|
#endregion
|
|
|
|
#region _fromSystem
|
private static string _fromSystem = "";
|
public static string fromSystem
|
{
|
get
|
{
|
if (_fromSystem == "")
|
{
|
_fromSystem = XmlHelper.GetElementValue("fromSystem");
|
}
|
return _fromSystem;
|
}
|
}
|
#endregion
|
#region _asnType
|
private static string _asnType = "";
|
public static string asnType
|
{
|
get
|
{
|
if (_asnType == "")
|
{
|
_asnType = XmlHelper.GetElementValue("asnType");
|
}
|
return _asnType;
|
}
|
}
|
#endregion
|
|
#region _customerId
|
private static string _customerId = "";
|
public static string customerId
|
{
|
get
|
{
|
if (_customerId == "")
|
{
|
_customerId = XmlHelper.GetElementValue("customerId");
|
}
|
return _customerId;
|
}
|
}
|
#endregion
|
#region _warehouseId
|
private static string _warehouseId = "";
|
public static string warehouseId
|
{
|
get
|
{
|
if (_warehouseId == "")
|
{
|
_warehouseId = XmlHelper.GetElementValue("warehouseId");
|
}
|
return _warehouseId;
|
}
|
}
|
#endregion
|
|
}
|
}
|