using ServiceCenter.Redis;
using WCS.Core;
using WCS.Entity.Protocol.Station;
using WCS.WorkEngineering.Worlds.Logs;

namespace WCS.WorkEngineering.Extensions
{
    public class Station : Device<IStation520, IStation521, IStation523>
    {
        public Station(Device device, World world) : base(device, world)
        {
        }

        /// <summary>
        ///  入库站点是否被禁止
        /// </summary>
        /// <returns></returns>
        public void StorageStationIsForbid()
        {
            var config = RedisHub.Default.Check("ForbidTubuEnter") ?? throw new Exception("请在Redis中配置互斥量值");
            var configs = config.Split(",");
            if (configs.Contains(Entity.Code)) throw new KnownException("当前入库口已被禁用，请联系运维人员了解具体情况", LogLevelEnum.High);
        }
    }
}
