Status.cs 2.5 KB

using Common;
using DeviceLibrary.Models.Service.Request;
using Newtonsoft.Json;

namespace DeviceLibrary.Models.Service.Response
{
    /// <summary>
    /// 电梯状态信息
    /// </summary>
    public class Status
    {
        /// <summary>
        /// 当前电梯处于哪一层
        /// </summary>
        public int floor { get; set; } = -1;
        /// <summary>
        /// 电梯门是否打开,打开=opened,关闭=closed
        /// </summary>
        public string door { get; set; } = "";
        /// <summary>
        /// 任务来源系统标识
        /// </summary>
        public string sourceClient { get; set; } = "";
        /// <summary>
        /// 架子来源楼层
        /// </summary>
        public int sourceFloor { get; set; } = -1;
        /// <summary>
        /// 架子来源点位
        /// </summary>
        public string sourcePoint { get; set; } = "";
        /// <summary>
        /// 任务目的地系统标识
        /// </summary>
        public string destinationClient { get; set; } = "";
        /// <summary>
        /// 目的地楼层
        /// </summary>
        public int destinationFloor { get; set; } = -1;
        /// <summary>
        /// 目的地点位
        /// </summary>
        public string destinationPoint { get; set; } = "";
        /// <summary>
        /// 成品空架子标识
        /// </summary>
        public bool HasEmptyFinishedShelf { get; set; } = false;
        [JsonIgnore]
        public bool Occupied { get { return !string.IsNullOrEmpty(sourceClient); } }

        public Status()
        {

        }
        public void Set(SendInInfo sendInInfo)
        {
            sourceClient = sendInInfo.sourceClient;
            sourceFloor = sendInInfo.sourceFloor;
            sourcePoint = sendInInfo.sourcePoint;
            destinationClient = sendInInfo.destinationClient;
            destinationFloor = sendInInfo.destinationFloor;
            destinationPoint = sendInInfo.destinationPoint;
            LogUtil.info($"请求电梯成功:From: {sourceClient}[{sourceFloor}][{sourcePoint}] To: {destinationClient}[{destinationFloor}][{destinationPoint}]");
        }
        /// <summary>
        /// 清理任务信息
        /// </summary>
        public void Clear()
        {
            sourceClient = "";
            sourceFloor = -1;
            sourcePoint = "";
            destinationClient = "";
            destinationFloor = -1;
            destinationPoint = "";  
        }
    }
}