InOutParam.cs 4.4 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(int trayCode=0, string barcode="", string posId="", int plateH=0, int plateW=0,bool instoreNg=false, 
            bool urgentReel = false , bool cutReel = false, bool smallReel = false, string rfid = "", int rfidLoc = 0)
        {
            WareCode = barcode;
            PosId = posId;
            this.PlateW = plateW;
            this.PlateH = plateH;
            this.TrayNumber = trayCode;
            this.InStoreNg = instoreNg;

            this.urgentReel = urgentReel;
            this.cutReel = cutReel;
            this.smallReel = smallReel;
            this.rfid = rfid;
            this.rfidLoc = rfidLoc; 
        }
        public InOutParam Clone()
        {
            return (InOutParam)this.MemberwiseClone();
        }

        /// <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 NgMsg = "";
        public string ToStr()
        {
            return $" [{ TrayNumber }] [{ WareCode }] [{ PosId }] [{ PlateW }x{ PlateH }],InStoreNg [{ InStoreNg }],urgentReel [{ urgentReel }],cutReel [{ cutReel }],smallReel [{ smallReel }],rfid [{ rfid }],rfidLoc [{ rfidLoc }]";
        }
        public string ToShortStr()
        {
            return $" [{ rfid }][{ WareCode }] [{ PosId }] [{ PlateW }x{ PlateH }] {( urgentReel ? "[紧急料]" : "")} {( cutReel ? "[分盘料]" : "")}";
        }
        /// <summary>
        /// 根据PosId获取对应的料仓ID,若PosId=="",返回-1
        /// </summary>
        /// <returns></returns>
        public int GetStoreId()
        {
            if (!PosId.Equals(""))
            {
                try
                {
                    return int.Parse(PosId.Substring(2, 2));
                }
                catch (Exception ex)
                {

                }
            }
            return -1;
        }

        public static  int GetPosStoreId(string posId)
        {
            if (!posId.Equals(""))
            {
                try
                {
                    int index = posId.IndexOf("#");
                    if (index > 0)
                    {
                        string[] arr = posId.Split('#');
                        if (arr.Length >= 2)
                        {
                            return int.Parse(arr[0]);
                        }
                    }
                    return int.Parse(posId.Substring(2, 2));
                }
                catch (Exception ex)
                {

                }
            }
            return -1;
        }
        /// <summary>
        /// urgentReel: true 表示紧急料,需要出到料串上
        /// </summary>
        public bool urgentReel { get; set; }
        /// <summary>
        /// cutReel: true 表示分盘料,需要出到料串上
        /// </summary>
        public bool cutReel { get; set; }
        /// <summary>
        /// smallReel: true  小料(7x8),放置到小料架上
        /// </summary>
        public bool smallReel { get; set; }

        /// <summary>
        /// rfid: 分配的料架RFID
        /// </summary>
        public string rfid { get; set; }
        /// <summary>
        /// rfidLoc: 料架的架位,值为 - 1时,可以自由分配皮带线, 
        /// 小料时,架位为1 - 46优先走1 / 2号皮带线,47 - 92优先走3 / 4号皮带线, 
        /// 70,71,72时只能分配到3 / 4号皮带线; 
        /// 大料时,架位1 - 6优先走1 / 2号皮带线, 7 - 12优先走3/ 4号皮带线
        /// </summary>
        public int rfidLoc { get; set; }
      
    }
}