WorkParam.cs 4.8 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 WorkParam
    {
        public WorkParam(int inPosType = 1, int tPosType = 0, string barcode = "", int plateH = 0, int plateW = 0, bool test = false )
        {
            this.InPosType = inPosType;
            this.TargetPosType = tPosType;

            WareCode = barcode;
            //      PosId = posId;
            this.PlateW = plateW;
            this.PlateH = plateH;
            this.IsTest = test;
        }

        /// <summary>
        /// 物品二维码信息
        /// </summary>
        public string WareCode = "";

        /// <summary>
        /// 当前状态
        /// </summary>
        public int TrayStatus = -1;

        /// <summary>
        /// 料盘高度
        /// </summary>
        public int PlateH = 0;
        /// <summary>
        /// 料盘宽度
        /// </summary>
        public int PlateW = 0;

        /// <summary>
        /// 点料结果:数量
        /// </summary>
        public int WareCount = 0;

        /// <summary>
        ///  入口位置:1=左侧入口,2=右侧入口
        /// </summary>
        public int InPosType = 0;

        /// <summary>
        ///  目标位置:1=XRay入口,2=人工工位上层,3=人工工位下层
        /// </summary>
        public int TargetPosType = 0;

        /// <summary>
        /// 取料时判断是否是NG料
        /// </summary>
        public bool IsNgReel = false;
        /// <summary>
        /// 是否是测试步骤
        /// </summary>
        public bool IsTest = false;

        public string ToStr()
        {
            string tP = "";
            if (TargetPosType.Equals(1))
            {
                tP = "[XRay入口]";
            }
            else if (TargetPosType.Equals(2))
            {
                tP = "[工位上层]";
            }
            else if (TargetPosType.Equals(3))
            {
                tP = "[工位下层]";
            }
            return "  [" + WareCode + "] " + "[" + PlateW + " X " + PlateH + "] " + "[" + (InPosType.Equals(1) ? "左侧入口" : "右侧入口") + "]-->" + tP;
        }
        public string  OutStr()
        {
            return "[" + WareCode + "]:[" + PlateW + "]X[" + PlateH + "][" + WareCount + "]";
        }
        public int Get_Inout_P2(InputEquip_Config config)
        {
            if (InPosType.Equals(1))
            {
                return config.InoutAxis_P2_L;
            }
            else
            {
                return config.InoutAxis_P2_R;
            }
        }
        public int Get_Middle_P2(InputEquip_Config config)
        {
            if (InPosType.Equals(1))
            {
                return config.MiddleAxis_P2_L;
            }
            else
            {
                return config.MiddleAxis_P2_R;
            }
        }
        public int Get_Updown_P2(InputEquip_Config config)
        {
            if (InPosType.Equals(1))
            {
                return config.UpdownAxis_P2_L;
            }
            else
            {
                return config.UpdownAxis_P2_R;
            }
        }
        public int Get_Updown_PutP(InputEquip_Config config)
        {
            if (TargetPosType.Equals(1))
            {
                return config.UpdownAxis_P3;
            }
            else if (TargetPosType.Equals(2))
            {
                return config.UpdownAxis_P4_H;
            }
            else if (TargetPosType.Equals(3))
            {
                return config.UpdownAxis_P4_L;
            }
            return config.UpdownAxis_P1;
        }
        public void SetReelInfo(ReelInfo reel)
        {
            this.PlateH = reel.PlateH;
            this.PlateW = reel.PlateW;
            this.WareCode = reel.WareCode;
            this.WareCount = reel.WareCount;
        }
    }


    public class ReelInfo
    {

        public ReelInfo(string code = "", int plateW = 7, int plateH = 8,int count=0)
        {
            this.WareCode = code;
            this.PlateH = plateH;
            this.PlateW = plateW;
            this.WareCount = count;
        }
        /// <summary>
        /// 物品二维码信息
        /// </summary>
        public string WareCode = "";

        /// <summary>
        /// 料盘高度
        /// </summary>
        public int PlateH = 0;

        /// <summary>
        /// 料盘宽度
        /// </summary>
        public int PlateW = 0;


        public int WareCount = 0;

        public string ToStr()
        {
            return "[" + WareCode + "] [ " + PlateW + "X" + PlateH + " ] ["+WareCount+"]";

        }
    }
}