InOutParam.cs 2.6 KB
 
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;


namespace OnlineStore.DeviceLibrary
{
    public class InOutParam
    {
        public MoveType paramType = MoveType.None; 
        public InOutParam(MoveType type, string posId, string code = "", int plateH = 0, int plateW = 0)
        {
            position = null;
            PosCode = code;
            PosId = posId; 
            this.PlateW = plateW;
            this.PlateH = plateH;
            this.paramType = type; 
        }
        public InOutParam(MoveType type, string posId, VerticalPosition position)
        {
            this.position = position;
            PosCode = "";
            PosId = posId;
            this.PlateW = position.BagWidth;
            this.PlateH = position.BagHigh;
            this.paramType = type;
        }

        public string ToStr()
        { 
           if (paramType.Equals(MoveType.InStore))
            {
                return "【入库:" + PosId + " ,[" + PosCode + "][" + PlateW + "X" + PlateH + "]】";
            }
            else if (paramType.Equals(MoveType.OutStore))
            {
                return "【出库:" + PosId   + ",[" + PosCode + "][" + PlateW + "X" + PlateH + "]】";
            }

            return "[" + PosId + "][" + PosCode + "][" + PlateW + "X" + PlateH + "]";
        }
        private VerticalPosition position = null;

        public VerticalPosition Position
        {
            get
            { 
                if (position == null)
                {
                    position = CSVPositionReader<VerticalPosition>.GetPositon(PosId);
                } 
                return position;
            }
        }

        /// <summary>
        /// 物品二维码信息
        /// </summary>
        public string PosCode = "";
        /// <summary>
        /// 位置坐标名(对应配置表的位置)
        /// </summary>
        public string PosId = ""; 
        /// <summary>
        /// 料盘高度
        /// </summary>
        public int PlateH = 0;
        /// <summary>
        /// 料盘宽度
        /// </summary>
        public int PlateW = 0;

       
        public string LogName
        {
            get
            {  

               if (paramType.Equals(MoveType.InStore))
                {
                    return "【入库:" +   PosId + "】";
                }
                else if (paramType.Equals(MoveType.OutStore))
                {
                    return "【出库:" + PosId  + "】";
                }
                else
                {
                    return PosId;
                }
            }
        }
    }

    
}