EquipControl.cs 4.6 KB
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using OnlineStore.DeviceLibrary;

namespace OnlineStore.XLRStore
{
    public partial class EquipControl : UserControl
    { 
     
        public string EquipText
        {
            get { return lblText.Text; }
            set { lblText.Text = value; }
        }
        public string WorkStatus
        {
            get { return lblStatus.Text; }
            set { lblStatus.Text = value; }
        }
        public string MoveInfo  
        {
            get { return lblMoveInfo.Text; }
            set { lblMoveInfo.Text = value; }
        }

        public Color ColorStatus
        {
            get { return this.BackColor; } 
            set
            {
                this.BackColor = value;
            }
        } 
        public void SelectStyle()
        { 
            panName.BackColor = Color.DeepSkyBlue;
        }
        public void UnSelectStyle()
        { 
            panName.BackColor = Color.Transparent;
        }
        public void InitData(string text)
        { 
            lblText.Text = text;
        }

        public  int DeviceId = 0;
        public void ShowData(bool isDebug, string runStr, string warnMsg, DeviceMoveInfo MoveInfo, Color backColor,string shelfStr="")
        {
            //lblTrayNum.Text = "托盘:" +  currTrayNum;
            lblStatus.Text = runStr;
            toolTip1.ToolTipTitle = "" + EquipText + ":双击进入";
            lblDebug.Text = "启用" + (isDebug ? "✘" : "✔");
            lblWarn.Text = warnMsg;
            lblShelf.Text = shelfStr;
            string str = "";
            if (MoveInfo.MoveType.Equals(MoveType.InStore))
            {
                str = "入库中:";
                InOutPosInfo pos = MoveInfo.MoveParam.PosInfo;
                if (pos != null)
                {
                    if (pos.IsNG)
                    {
                        str = "NG料:" + pos.PosId + "_" + pos.barcode;
                    }
                    else
                    {

                        str = "入库中:" + pos.PosId + "_" + pos.barcode;
                    }
                }
            }
            else if (MoveInfo.MoveType.Equals(MoveType.OutStore))
            {
                str = "出库中:";
                InOutPosInfo pos = MoveInfo.MoveParam.PosInfo;
                if (pos != null)
                {
                    if (pos.urgentReel)
                    {
                        str = "紧急料出库:" + pos.PosId + "_" + pos.barcode;
                    }
                    else if (pos.cutReel)
                    {
                        str = "分盘料出库:" + pos.PosId + "_" + pos.barcode;
                    }
                    else if (pos.cutReel)
                    {
                        str = "出库中:" + pos.PosId + "_" + pos.barcode;
                    } 
                }
            }
            lblMoveInfo.Text = str;
            
            this.BackColor = backColor;
        }
        public EquipControl()
        {
            InitializeComponent();
        } 
        private void EquipControl_Load(object sender, EventArgs e)
        { 
        }

        private void lblName_DoubleClick(object sender, EventArgs e)
        {
            this.OnDoubleClick(e);
        }

        private void lblName_MouseEnter(object sender, EventArgs e)
        {
            this.OnMouseEnter(e);
        }

        private void panName_MouseEnter(object sender, EventArgs e)
        { 
            this.OnMouseEnter(e);
        }

        private void panName_DoubleClick(object sender, EventArgs e)
        {
            this.OnDoubleClick(e);
        }

        private void lblStatus_DoubleClick(object sender, EventArgs e)
        {
            this.OnDoubleClick(e);
        }

        private void lblStatus_MouseEnter(object sender, EventArgs e)
        {
            this.OnMouseEnter(e);
        }

        private void lblBox_MouseEnter(object sender, EventArgs e)
        {
            this.OnMouseEnter(e);
        }

        private void lblDebug_MouseEnter(object sender, EventArgs e)
        {

            SelectStyle();
        }

        private void lblDebug_MouseLeave(object sender, EventArgs e)
        {
            UnSelectStyle();
        }

        private void EquipControl_MouseLeave(object sender, EventArgs e)
        {
            UnSelectStyle();

        }

        private void EquipControl_MouseEnter(object sender, EventArgs e)
        {
            SelectStyle();
        }
    }
}