InOrOutStoreParam.cs 4.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 InOutStoreParam
    {
        public static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        public InOutStoreParam()
        {
            ACStoreP = null;
            this.WareNumber = "";
            MoveP = null;   
        }
        /// <summary>
        /// 新建一个对象
        /// </summary>
        /// <param name="wareNo">物品二维码</param>
        /// <param name="position">仓位号</param>
        public InOutStoreParam(string wareNo, string posId)
        {
            ACStoreP = null;
            WareNumber = wareNo;
            PositionNum = posId;
            MoveP = null;
            IsSolderPaste = false;
            SetSize();
        }
        public InOutStoreParam(string wareNo, string posId, int plateH, int plateW)
        {
            ACStoreP = null;
            WareNumber = wareNo;
            PositionNum = posId;
            MoveP = null;
            this.PlagtW = plateW;
            this.PlateH = plateH;
            IsSolderPaste = false;
        }
        //public InOutStoreParam(string wareNo, string posId, int plateH, int plateW,int trayCode)
        //{
        //    ACStoreP = null;
        //    WareNumber = wareNo;
        //    PositionNum = posId;
        //    MoveP = null;
        //    this.PlagtW = plateW;
        //    this.PlateH = plateH;
        //    this.TrayCode = trayCode;
        //    IsSolderPaste = false;
        //}

        public InOutStoreParam(string wareNo, string posId, LineMoveP linePosition)
        {
            ACStoreP = null;
            WareNumber = wareNo;
            PositionNum = posId;
            MoveP = linePosition;
            IsSolderPaste = false;
            SetSize();
        }
        //public InOutStoreParam(string wareNo, string posId, AutoStorePosition movep)
        //{
        //    ACStoreP = movep; 
        //    WareNumber = wareNo;
        //    PositionNum = posId;
        //    MoveP = null; 
        //    IsSolderPaste = false;
        //}
        public void SetSize()
        {
            AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(PositionNum);
            if (!(position == null))
            {
                this.PlateH = position.BagHeight;
                this.PlagtW = position.BagWidth;
            }
            else
            {
                this.PlagtW = StoreManager.Config.Default_TrayWidth;
                if (this.PlagtW.Equals(0)) { this.PlagtW = 13; }
                this.PlateH = StoreManager.Config.GetDefaultHeight(); 
            }
        }
        private AutoStorePosition ACStoreP = null;

        public AutoStorePosition GetPosition()
        {
            try
            {
                if (ACStoreP == null)
                {
                    ACStoreP = CSVPositionReader<AutoStorePosition>.GetPositon(PositionNum);
                }
            }
            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; }
        /// <summary>
        /// 托盘号
        /// </summary>
        public int TrayCode { get; set; }

        public LineMoveP MoveP { get; set; }
        /// <summary>
        /// 料盘高度
        /// </summary>
        public int PlateH { get; set; }
        /// <summary>
        /// 料盘宽度
        /// </summary>
        public int PlagtW { get; set; }
        /// <summary>
        /// 是否是放入锡膏(在线料仓才需要此字段)
        /// </summary>
        public bool IsSolderPaste { get; set; }
        
         
    }
}