using iWareCommon.Common.EnumType;
using System;
namespace iWareCommon
{
    [Serializable]
    public class SrmInfo
    {
        /// 
        /// 堆垛机名称
        /// 
        public string SrmName { get; set; }
        /// 
        /// 根据心跳判断堆垛机是否在线
        /// 
        public string IsOnline { get; set; }
        public string WHandShake { get; set; }
        public string WSrmNo { get; set; }
        public string WCallBack { get; set; }
        public string WCancelTask { get; set; }
        public string WEstop { get; set; }
        public string WFromCol { get; set; }
        public string WFromLayer { get; set; }
        public string WFromRow { get; set; }
        public string WToCol { get; set; }
        public string WToLayer { get; set; }
        public string WToRow { get; set; }
        public string WTaskId { get; set; }
        public string WNewTask { get; set; }
        public string WAckTaskFinish { get; set; }
       
        /// ///////////////////////////////////////////
       
        public string RHandShake { get; set; }
        public string RPickFinish { get; set; }
        public string RPutFinish { get; set; }
        public string RAuto { get; set; }
        public string RAlarm { get; set; }
        public string RTaskFinish { get; set; }
        public string RLoaded { get; set; }
        public string RForkIni { get; set; }
        public string RSrmNo { get; set; }
        public string RAlarmCode { get; set; }
        public string RState { get; set; }
        public string RCol { get; set; }
        public string RLayer { get; set; }
        public string RPosX { get; set; }
        public string RPosY { get; set; }
        public string RForkPos { get; set; }
        public string RTaskId { get; set; }
        public SrmInfo() { }
        public SrmInfo(SrmEntity srm)
        {
            this.SrmName = srm.SrmName;
            this.IsOnline = srm.IsOnline ? "在线" : "已离线";
            this.WHandShake = srm.WHandShake.ToString();
            this.WSrmNo = srm.WSrmNo.ToString();
            this.WCallBack = srm.WCallBack == (int)EYesOrNo.是 ? "召回" : "";
            this.WCancelTask = srm.WCancelTask == (int)EYesOrNo.是 ? "取消任务" : "";
            this.WEstop = srm.WEstop == (int)EYesOrNo.是 ? "急停" : "";
            this.WFromCol = srm.WFromCol.ToString();
            this.WFromLayer = srm.WFromLayer.ToString();
            this.WFromRow = srm.WFromRow.ToString();
            this.WToCol = srm.WToCol.ToString();
            this.WToRow = srm.WToRow.ToString();
            this.WToLayer = srm.WToLayer.ToString();
            this.WTaskId = srm.WTaskId.ToString();
            this.WNewTask = srm.WNewTask.ToString();
            this.WAckTaskFinish = srm.WAckTaskFinish.ToString();
            this.RHandShake = srm.RHandShake.ToString();
            this.RPickFinish = srm.RPickFinish ? "取货完成" : "";
            this.RPutFinish = srm.RPutFinish ? "放货完成" : "";
            this.RAuto = srm.RAuto ? "自动" : "非自动";
            this.RAlarm = srm.RAlarm ? "报警" : "正常";
            this.RTaskFinish = srm.RTaskFinish ? "任务完成" : "";
            this.RLoaded = srm.RLoaded ? "叉齿有货" : "叉齿无货";
            this.RForkIni = srm.RForkIni ? "叉齿在原位" : "叉齿不在原位";
            this.RSrmNo = srm.RSrmNo.ToString();
            this.RAlarmCode = srm.RAlarmCode == 0 ? "" : ((ESrmAlarm)srm.RAlarmCode).ToString();
            this.RState = ((ESrmState)srm.RState).ToString();
            this.RCol = srm.RCol.ToString();
            this.RLayer = srm.RLayer.ToString();
            this.RPosX = srm.RPosX.ToString();
            this.RPosY = srm.RPosY.ToString();
            this.RForkPos = srm.RForkPos.ToString();
            this.RTaskId = srm.RTaskId.ToString();
            
        }
    }
}