InOutParam.cs 5.3 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()
        {
            ACStoreP = null;
            this.PosInfo = new InOutPosInfo("", "");
            MoveP = null;   
        }
        
        public InOutParam(InOutPosInfo inoutInfo, LineMoveP linePosition = null)
        {
            ACStoreP = null; ;
            MoveP = linePosition;
            //WareNumber = wareNo;
            //PositionNum = posId;
            //this.PlateW = plateW;
            //this.PlateH = plateH
            this.PosInfo = inoutInfo;
        }
     

        //public InOutParam(inoup, LineMoveP linePosition=null)
        //{
        //    ACStoreP = null;
        //    WareNumber = wareNo;
        //    PositionNum = posId;
        //    MoveP = linePosition; 
        //    ACStorePosition p = GetACPosition();
        //    if (p != null)
        //    {
        //        PlateH = p.BagHigh.ToString();
        //        PlateW = p.BagWidth.ToString();
        //    }
        //}
        //public InOutStoreParam(string wareNo, string posId, ACStorePosition movep)
        //{
        //    ACStoreP = movep; 
        //    WareNumber = wareNo;
        //    PositionNum = posId;
        //    MoveP = null; 
        //    IsSolderPaste = false;
        //}
     
        private ACStorePosition ACStoreP = null;

        public ACStorePosition GetACPosition()
        {
            try
            {
                if (ACStoreP == null)
                {
                    string posId = PosInfo != null ? PosInfo.PosId : "";
                    ACStoreP = CSVPositionReader<ACStorePosition>.GetPositon(posId);
                }
            }
            catch (Exception ex)
            {
                LogUtil.error(log, "出入库获取库位信息GetKTKPosition出错:" + ex.ToString());
            }
            return ACStoreP;
        }

        ///// <summary>
        ///// 物品二维码信息
        ///// </summary>
        //public string WareNumber { get; set; }
        ///// <summary>
        ///// 位置坐标名(对应配置表的位置)
        ///// </summary>
        //public string PositionNum { get; set; }

        public InOutPosInfo PosInfo { get; set; }
        public LineMoveP MoveP { get; set; }
        ///// <summary>
        ///// 料盘高度
        ///// </summary>
        //public string  PlateH { get; set; }
        ///// <summary>
        ///// 料盘宽度
        ///// </summary>
        //public string PlateW { get; set; }


    } /// <summary>
      /// 夹具编码信息(保存夹具检测到的IO数值,和对应的料仓位置)
      /// </summary>
    public class InOutPosInfo
    {
        public InOutPosInfo(string barcode, string posId, string platew = "", string plateh = "", bool urgentReel = false , bool cutReel = false, bool smallReel = false, string rfid = "", int rfidLoc = 0)
        {
            this.barcode = barcode;
            this.PosId = posId;
            this.PlateW = platew;
            this.PlateH = plateh;
            this.urgentReel = urgentReel;
            this.cutReel = cutReel;
            this.smallReel = smallReel;
            this.rfid = rfid;
            this.rfidLoc = rfidLoc;
        }

        /// <summary>
        /// 物品二维码
        /// </summary>
        public string barcode { get; set; }
        /// <summary>
        /// 库位号编码
        /// </summary>
        public string PosId { get; set; }
        /// <summary>
        /// 料盘宽
        /// </summary>
        public string PlateW { get; set; }
        /// <summary>
        /// 料盘高
        /// </summary>
        public string PlateH { get; set; }

        /// <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; }
        public string ToStr()
        {
            return " barcode[" + barcode + "],PosId [" + PosId + "],plateW [" + PlateW + "],plateH [" + PlateH + "],urgentReel [" + urgentReel
                + "],cutReel [" + cutReel + "],smallReel [" + smallReel + "],rfid [" + rfid + "],rfidLoc [" + rfidLoc + "]";
        }

    }
}