InOutParam.cs 4.1 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()
        {
            ACStoreP = null;
            this.PosInfo = new InOutPosInfo("", "");
            MoveP = null;
        }

        public InOutParam(InOutPosInfo inoutInfo, LineMoveP linePosition = null)
        {
            ACStoreP = null; ;
            MoveP = linePosition;
            this.PosInfo = inoutInfo;
        }
        private XLRPosition ACStoreP = null;

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

        public InOutPosInfo PosInfo { get; set; }
        public LineMoveP MoveP { get; set; } 

        /// <summary>
        /// 入料机构从哪个料串取料,或出库放到哪个料串
        /// 0=未知,1=A侧料串,2=B侧料串
        /// </summary>
        public int ShelfType{ get; set; }=0;
} 
    /// <summary>
      /// 出入库料盘信息
      /// </summary>
    public class InOutPosInfo
    {
        public InOutPosInfo(string barcode, string posId, int platew = 0, int plateh = 0, bool urgentReel = false, bool cutReel = false, bool smallReel = false, string rfid = "", int rfidLoc = 0, bool singleOut = false)
        {
            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;
            this.singleOut = singleOut;
        }

        public static InOutPosInfo NewNgPos(string barcode, string posId, int platew , int plateh,  string ngMsg)
        {
            InOutPosInfo inOut = new InOutPosInfo(barcode, posId, platew, plateh);
            inOut.IsNG = true;
            inOut.NgMsg = ngMsg;
            return inOut;
        }

        /// <summary>
        /// 物品二维码
        /// </summary>
        public string barcode { get; set; }
        /// <summary>
        /// 库位号编码
        /// </summary>
        public string PosId { get; set; }
        /// <summary>
        /// 料盘宽
        /// </summary>
        public int PlateW { get; set; }
        /// <summary>
        /// 料盘高
        /// </summary>
        public int 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>
        /// 料架位置
        /// </summary>
        public int rfidLoc { get; set; }

        public bool singleOut = false;
        public string ToStr()
        {
            return "  [" + barcode + "] [" + PosId + "] [" + PlateW + "x" + PlateH + "],urgentReel [" + urgentReel
                + "],cutReel [" + cutReel + "],smallReel [" + smallReel + "],rfid [" + rfid + "],rfidLoc [" + rfidLoc + "],singleOut[" + singleOut + "]";
        }

        public bool IsNG { get; set; } = false;

        public string NgMsg { get; set; } = "";
    }
    /// <summary>
    /// 出入库位置信息
    /// </summary>
    public class LineMoveP
    {

    }
}