using Jc.SnowId;
using SlnMesnac.Model.domain;

namespace SlnMesnac.WCS.Global
{
    public static class StaticData
    {
        public static JcSnowId SnowId = new JcSnowId();

        /// <summary>
        /// plc配置集合
        /// </summary>
        public static List<BaseConfigInfo>? BaseConfigList;

        /// <summary>
        /// 机台信息集合
        /// </summary>
        public static List<WmsMachineInfo> WmsMachineInfos;

        /// <summary>
        /// agv状态码集合
        /// </summary>
        public static List<WcsAgvCodeMap> WcsAgvCodeMaps;

        /// <summary>
        /// 通过key获取plc地址
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string GetPlcAddress(string key)
        {
            if (BaseConfigList == null) return "";
            BaseConfigInfo? config = BaseConfigList.FirstOrDefault(x => x.ConfigKey == key);
            if (config != null)
            {
                return config.ConfigValue;
            }
            return "";
        }
    }
}