FixtureCodeInfo.cs 2.2 KB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 

namespace OnlineStore.DeviceLibrary
{
    /// <summary>
    /// 夹具编码信息(保存夹具检测到的IO数值,和对应的料仓位置)
    /// </summary>
    public class FixtureCodeInfo
    {

        public FixtureCodeInfo(int trayCode, string wareNum, string posId)
        {
            this.TrayCode = trayCode;
            this.WareNum = wareNum;
            this.PosId = posId;
            this.plateH = "";
            this.plateW = "";
        }
        public FixtureCodeInfo(int trayCode, string wareNum, string posId,string platew,string plateh)
        {
            this.TrayCode = trayCode;
            this.WareNum = wareNum;
            this.PosId = posId;
            this.plateW = platew;
            this.plateH = plateh;
        }
        /// <summary>
        /// 夹具编码值(1-6)
        /// </summary>
        public int TrayCode { get; set; }
        /// <summary>
        /// 物品二维码
        /// </summary>
        public string WareNum { get; set; }
        /// <summary>
        /// 库位号编码
        /// </summary>
        public string PosId { get; set; }
        /// <summary>
        /// 料盘宽
        /// </summary>
        public string plateW { get; set; }
        /// <summary>
        /// 料盘高
        /// </summary>
        public string plateH { get; set; }


        public string ToStr()
        {
            return "TrayCode【" + TrayCode + "】,WareNum=【" + WareNum + "】,PosId=【" + PosId + "】,plateW=【" + plateW + "】,plateH=【" + plateH + "】";
        }
        /// <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;
        }
    }
}