InOutParam.cs 2.5 KB
using log4net;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;


namespace OnlineStore.DeviceLibrary
{
    /// <summary>
    /// 出入仓参数(出入库操作时传入的参数类)
    /// </summary>
    public class InOutParam
    {

        public InOutParam()
        {
            this.WareCode = "";
        } 
        public InOutParam(int trayCode)
        {
            WareCode = "";
            PosId = "";
            PlateH = 12;
            PlateW =7;
            TrayNumber = trayCode;
        }
        public InOutParam(int trayCode, string wareNum, string posId, int plateH, int plateW,bool instoreNg=false)
        {
            WareCode = wareNum;
            PosId = posId;
            this.PlateW = plateW;
            this.PlateH = plateH;
            this.TrayNumber = trayCode;
            this.InStoreNg = instoreNg;
        }

        /// <summary>
        /// 物品二维码信息
        /// </summary>
        public string WareCode = "";
        /// <summary>
        /// 位置坐标名(对应配置表的位置)
        /// </summary>
        public string PosId = "";
        /// <summary>
        /// 托盘号
        /// </summary>
        public int TrayNumber = -1;

        /// <summary>
        /// 料盘高度
        /// </summary>
        public int PlateH = 0;
        /// <summary>
        /// 料盘宽度
        /// </summary>
        public int PlateW = 0;

        /// <summary>
        /// 是否是入库NG的料盘
        /// </summary>
        public bool InStoreNg = false;

        public string ToStr()
        {
            return "TrayNumber[" + TrayNumber + "],WareCode[" + WareCode + "],PosId[" + PosId + "],plateW[" + PlateW + "],plateH[" + PlateH + "],InStoreNg["+InStoreNg+"]";
        }
        /// <summary>
        /// 根据PosId获取对应的料仓ID,若PosId=="",返回-1
        /// </summary>
        /// <returns></returns>
        public int GetStoreId()
        {
            if (!PosId.Equals(""))
            {
                string[] arr = PosId.Split('#');
                if (arr.Length >= 2)
                {
                    try
                    {
                        return int.Parse(arr[0]);
                    }
                    catch (Exception ex)
                    {

                    }
                }
            }
            return -1;
        } 
    }
}