WorkParam.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 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;
        }
         
        public string WareCode = "";

        /// <summary>
        /// 当前状态
        /// </summary>
        public int TrayStatus = -1;
         
        public int PlateH = 0;
 
        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;
 
        public bool IsNgReel = false;
        public string NgMsg = "";
        /// <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 + "]" + (IsNgReel ? "[NG料:" + NgMsg + "]" : "") + "";
        }
        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;
            this.IsNgReel = reel.IsNgReel;
            this.NgMsg = reel.NgMsg;
        }
        public ReelInfo GetReelInfo()
        {
            ReelInfo reel = new ReelInfo(WareCode, PlateW, PlateH, WareCount, IsNgReel, NgMsg); 
            return reel;
        }
    }


    public class ReelInfo
    {

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

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

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


        public int WareCount = 0;

        public bool IsNgReel = false;

        public string NgMsg = "";

        public string ToStr()
        {
            return "[" + WareCode + "] [" + PlateW + "X" + PlateH + "] ["+WareCount+"]"+(IsNgReel?"[NG料:"+NgMsg+"]":"")+"";

        }
        public ReelInfo GetReelInfo()
        {
            ReelInfo reel = new ReelInfo(WareCode, PlateW, PlateH, WareCount, IsNgReel, NgMsg);
            return reel;
        }
    }
}