InOutParam.cs 5.2 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 static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        public InOutParam()
        { 
            this.WareCode = "";
            MoveP = null;   
        }
        /// <summary>
        /// 新建一个对象
        /// </summary>
        /// <param name="wareNo">物品二维码</param>
        /// <param name="position">仓位号</param>
        public InOutParam(string wareNo, string posId,string ShelfPosID)
        {
            this.ShelfPosID = ShelfPosID;
            WareCode = wareNo;
            PosID = posId;
            MoveP = null;
            IsSolderPaste = false;
        }
        public InOutParam(string wareNo, string posId,string plateH,string plateW, string ShelfPosID="")
        {
            this.ShelfPosID = ShelfPosID;
            WareCode = wareNo;
            PosID = posId;
            MoveP = null;
            this.PlateW = plateW;
            this.PlateH = plateH;
            IsSolderPaste = false;
        } 
        public InOutParam(string wareNo, string posId, LineMoveP linePosition )
        { 
            WareCode = wareNo;
            PosID = posId;
            MoveP = linePosition;
            IsSolderPaste = false;
        }  
        /// <summary>
        /// 物品二维码信息
        /// </summary>
        public string WareCode { get; set; }
        /// <summary>
        /// 位置坐标名(对应配置表的位置)
        /// </summary>
        public string PosID { get; set; }
        /// <summary>
        /// 料架对应的库位号
        /// </summary>
        public string ShelfPosID = "";
        public LineMoveP MoveP { get; set; }
        /// <summary>
        /// 料盘高度
        /// </summary>
        public string  PlateH { get; set; }
        /// <summary>
        /// 料盘宽度
        /// </summary>
        public string PlateW { get; set; }
        /// <summary>
        /// 是否是放入锡膏(在线料仓才需要此字段)
        /// </summary>
        public bool IsSolderPaste { get; set; }
        /// <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;
        }
        public string ToStr()
        {
            return " ShelfPosID=["+ ShelfPosID + "],WareCode=【" + WareCode + "】,PosID=【" + PosID + "】,PlateW=【" + PlateW + "】,PlateH=【" + PlateH + "】";
        }
    } 
    
    ///// <summary>
    //  /// 夹具编码信息(保存夹具检测到的IO数值,和对应的料仓位置)
    //  /// </summary>
    //public class FixtureCodeInfo
    //{

    //    public FixtureCodeInfo(string wareNum, string posId)
    //    {
    //        this.WareNum = wareNum;
    //        this.PosId = posId;
    //        this.plateH = "";
    //        this.plateW = "";
    //    }
    //    public FixtureCodeInfo(string wareNum, string posId, string platew, string plateh)
    //    {
    //        this.WareNum = wareNum;
    //        this.PosId = posId;
    //        this.plateW = platew;
    //        this.plateH = plateh;
    //    }

    //    /// <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 " 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;
    //    }
    //}
}