Ejemplo n.º 1
0
 void theSaddleVisual_Saddle_Selected(SaddleBase theSaddleInfo)
 {
     try
     {
         if (Saddle_Selected != null)
         {
             Saddle_Selected(theSaddleInfo.Clone());
         }
     }
     catch (Exception ex)
     {}
 }
Ejemplo n.º 2
0
        public void refreshControl(SaddleBase theSaddle, long baySpaceX, long baySpaceY, int panelWidth, int panelHeight, bool xAxisRight, bool yAxisDown)
        {
            try
            {
                //计算X方向上的比例关系
                double xScale = Convert.ToDouble(panelWidth) / Convert.ToDouble(baySpaceX);

                double location_X = 0;
                if (xAxisRight == true)
                {
                    location_X = Convert.ToDouble(theSaddle.X_Center - theSaddle.SaddleLength / 2) * xScale;
                }
                else
                {
                    location_X = Convert.ToDouble(baySpaceX - (theSaddle.X_Center + theSaddle.SaddleLength / 2)) * xScale;
                }


                //计算Y方向的比例关系
                double yScale = Convert.ToDouble(panelHeight) / Convert.ToDouble(baySpaceY);

                double location_Y = 0;
                if (yAxisDown == true)
                {
                    location_Y = (theSaddle.Y_Center - theSaddle.SaddleWidth / 2) * yScale;
                }
                else
                {
                    location_Y = (baySpaceY - (theSaddle.Y_Center + theSaddle.SaddleWidth / 2)) * yScale;
                }

                //修改鞍座控件的宽度和高度
                this.Width  = Convert.ToInt32(theSaddle.SaddleWidth * xScale);
                this.Height = Convert.ToInt32(theSaddle.SaddleLength * yScale);

                //定位库位鞍座的坐标
                this.Location = new Point(Convert.ToInt32(location_X), Convert.ToInt32(location_Y));

                toolTip1.IsBalloon   = true;
                toolTip1.ReshowDelay = 0;
                toolTip1.SetToolTip(this, "鞍座号:" + theSaddle.SaddleNo.ToString() + "\r"
                                    + "钢卷号:" + theSaddle.CoilNO + "\r"
                                    + "占位值:" + theSaddle.TagVal_IsOccupied + "\r"
                                    + "锁定请求:" + theSaddle.Tag_Lock_Request_Value + "\r"
                                    + "坐标:" + "\r"
                                    + "X = " + theSaddle.X_Center + "\r"
                                    + "Y = " + theSaddle.Y_Center + "\r"
                                    + "------------------------" + "\r"
                                    + "出口占位为1,入口占位为0" + "\r"
                                    + "黑色代表有占位有卷号" + "\r"
                                    + "橙色代表占位、卷号只有其中一个" + "\r"
                                    + "红色代表机组鞍座已锁定" + "\r"
                                    );

                //出口机组占位值
                if (theSaddle.SaddleNo.IndexOf("C") > -1)
                {
                    if (!string.IsNullOrEmpty(theSaddle.CoilNO.Trim()))
                    {
                        if (theSaddle.TagVal_IsOccupied == 1)
                        {
                            this.BackColor = Color.Black;
                        }
                        else
                        {
                            this.BackColor = Color.Blue;
                        }
                    }
                    else
                    {
                        if (theSaddle.TagVal_IsOccupied == 1)
                        {
                            this.BackColor = Color.Blue;
                        }
                        else
                        {
                            this.BackColor = Color.White;
                        }
                    }
                }
                else if (theSaddle.SaddleNo.IndexOf("R") > -1)  //入口机组占位值
                {
                    //钢卷不为空
                    if (!string.IsNullOrEmpty(theSaddle.CoilNO.Trim()))
                    {
                        //特殊情况(鞍座没有占位)
                        if (theSaddle.SaddleNo.Trim() == "D413SR1A00")
                        {
                            this.BackColor = Color.Black;
                        }
                        else
                        {
                            // 鞍座有占位
                            if (theSaddle.TagVal_IsOccupied == 0)
                            {
                                this.BackColor = Color.Black;
                            }
                            else
                            {
                                this.BackColor = Color.Blue;
                            }
                        }
                    }
                    else
                    {
                        if (theSaddle.TagVal_IsOccupied == 0)
                        {
                            ////特殊情况(鞍座没有占位)
                            if (theSaddle.SaddleNo.Trim() == "D308WR1A05")   //特殊情况
                            {
                                this.BackColor = Color.White;
                            }
                            else
                            {
                                this.BackColor = Color.Blue;
                            }
                        }
                        else
                        {
                            this.BackColor = Color.White;
                        }
                    }
                }

                //已锁定机组鞍座
                if (theSaddle.Tag_IsLocked_Value == 1)
                {
                    this.BackColor = Color.Red;
                }

                //X或Y等于小于 0时,不显示
                if (theSaddle.X_Center == 0 || theSaddle.Y_Center == 0)
                {
                    this.Visible = false;
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteProgramLog(ex.Message);
                LogManager.WriteProgramLog(ex.StackTrace);
            }
        }
Ejemplo n.º 3
0
        public void refreshControl(SaddleBase theSaddle, long baySpaceX, long baySpaceY, int panelWidth, int panelHeight, bool xAxisRight, bool yAxisDown)
        {
            try
            {
                //计算X方向上的比例关系
                double xScale = Convert.ToDouble(panelWidth) / Convert.ToDouble(baySpaceX);

                //计算控件行车中心X,区分为X坐标轴向左或者向右
                double location_X = 0;
                if (xAxisRight == true)
                {
                    location_X = Convert.ToDouble(theSaddle.X_Center - theSaddle.SaddleLength / 2) * xScale;
                }
                else
                {
                    location_X = Convert.ToDouble(baySpaceX - (theSaddle.X_Center + theSaddle.SaddleLength / 2)) * xScale;
                }


                //计算Y方向的比例关系
                double yScale = Convert.ToDouble(panelHeight) / Convert.ToDouble(baySpaceY);

                //计算行车中心Y 区分Y坐标轴向上或者向下
                double location_Y = 0;
                if (yAxisDown == true)
                {
                    location_Y = (theSaddle.Y_Center - theSaddle.SaddleWidth / 2) * yScale;
                }
                else
                {
                    location_Y = (baySpaceY - (theSaddle.Y_Center + theSaddle.SaddleWidth / 2)) * yScale;
                }

                //修改鞍座控件的宽度和高度
                this.Width  = Convert.ToInt32(theSaddle.SaddleWidth * xScale);
                this.Height = Convert.ToInt32(theSaddle.SaddleLength * yScale);

                if (theSaddle.Stock_Status == 0 && theSaddle.Lock_Flag == 0) //无卷可用
                {
                    this.BackColor = Color.White;
                }
                else if (theSaddle.Stock_Status == 2 && theSaddle.Lock_Flag == 0) //有卷可用
                {
                    this.BackColor = Color.Black;
                }
                else
                {
                    this.BackColor = Color.Red;
                }


                //定位库位鞍座的坐标
                this.Location = new Point(Convert.ToInt32(location_X), Convert.ToInt32(location_Y));


                toolTip1.IsBalloon   = true;
                toolTip1.ReshowDelay = 0;
                toolTip1.SetToolTip(this, "材料号:" + theSaddle.Mat_No + "\r"
                                    + "库位:    " + theSaddle.SaddleNo.ToString()
                                    + "\r" + theSaddle.Row_No.ToString() + "行" + "-" + theSaddle.Col_No.ToString() + "列," + "\r"
                                    + "坐标:" + "\r"
                                    + "X = " + theSaddle.X_Center + "\r"
                                    + "Y = " + theSaddle.Y_Center + "\r"
                                    + "下道机组: " + theSaddle.Next_Unit_No + "\r");
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 4
0
        public void refreshControl(SaddleBase theSaddle, long baySpaceX, long baySpaceY, int panelWidth, int panelHeight, bool xAxisRight, bool yAxisDown)
        {
            try
            {
                //计算X方向上的比例关系
                double xScale = Convert.ToDouble(panelWidth) / Convert.ToDouble(baySpaceX);

                double location_X = 0;
                if (xAxisRight == true)
                {
                    location_X = Convert.ToDouble(theSaddle.XCENTER - theSaddle.STOCK_LENGTH / 2) * xScale;
                }
                else
                {
                    location_X = Convert.ToDouble(baySpaceX - (theSaddle.XCENTER + theSaddle.STOCK_LENGTH / 2)) * xScale;
                }


                //计算Y方向的比例关系
                double yScale = Convert.ToDouble(panelHeight) / Convert.ToDouble(baySpaceY);

                double location_Y = 0;
                if (yAxisDown == true)
                {
                    location_Y = (theSaddle.YCENTER - theSaddle.SaddleWidth) * yScale;
                }
                else
                {
                    location_Y = (baySpaceY - (theSaddle.YCENTER + theSaddle.SaddleWidth)) * yScale;
                }

                //修改鞍座控件的宽度和高度
                this.Width  = Convert.ToInt32(theSaddle.STOCK_LENGTH * xScale);
                this.Height = Convert.ToInt32(800 * yScale);

                //定位库位鞍座的坐标
                this.Location = new Point(Convert.ToInt32(location_X), Convert.ToInt32(location_Y));

                if (theSaddle.CoilNO == "" && theSaddle.CoilNO1 == "")
                {
                    lblMatNo2.Visible = false;
                    lblMatNo1.Visible = false;
                }
                else if (theSaddle.CoilNO == "" || theSaddle.CoilNO1 == "")
                {
                    lblMatNo2.Visible     = false;
                    toolTip1.IsBalloon    = true;
                    toolTip1.ReshowDelay  = 0;
                    toolTip1.AutoPopDelay = 5000;
                    toolTip1.InitialDelay = 0;
                    toolTip1.ShowAlways   = true;
                    toolTip1.SetToolTip(lblMatNo1, "鞍座号:" + theSaddle.STOCK_NO.ToString() + "\r"
                                        + "方坯号1:" + theSaddle.CoilNO + "\r"
                                        + "方坯号2:" + theSaddle.CoilNO1 + "\r"
                                        //+ "占位值:" + theSaddle.TagVal_IsOccupied + "\r"
                                        //+ "锁定请求:" + theSaddle.Tag_Lock_Request_Value + "\r"
                                        + "坐标:" + "\r"
                                        + "X = " + theSaddle.XCENTER + "\r"
                                        + "Y = " + theSaddle.YCENTER + "\r"
                                        //+ "------------------------" + "\r"
                                        //+ "出口占位为1,入口占位为0" + "\r"
                                        //+ "黑色代表有占位有卷号" + "\r"
                                        //+ "橙色代表占位、卷号只有其中一个" + "\r"
                                        //+ "红色代表机组鞍座已锁定" + "\r"
                                        );
                }
                else
                {
                    toolTip1.IsBalloon    = true;
                    toolTip1.ReshowDelay  = 0;
                    toolTip1.AutoPopDelay = 5000;
                    toolTip1.InitialDelay = 0;
                    toolTip1.ShowAlways   = true;
                    toolTip1.SetToolTip(lblMatNo1, "鞍座号:" + theSaddle.STOCK_NO.ToString() + "\r"
                                        + "方坯号1:" + theSaddle.CoilNO + "\r"
                                        + "方坯号2:" + theSaddle.CoilNO1 + "\r"
                                        //+ "占位值:" + theSaddle.TagVal_IsOccupied + "\r"
                                        //+ "锁定请求:" + theSaddle.Tag_Lock_Request_Value + "\r"
                                        + "坐标:" + "\r"
                                        + "X = " + theSaddle.XCENTER + "\r"
                                        + "Y = " + theSaddle.YCENTER + "\r"
                                        //+ "------------------------" + "\r"
                                        //+ "出口占位为1,入口占位为0" + "\r"
                                        //+ "黑色代表有占位有卷号" + "\r"
                                        //+ "橙色代表占位、卷号只有其中一个" + "\r"
                                        //+ "红色代表机组鞍座已锁定" + "\r"
                                        );
                    toolTip1.SetToolTip(lblMatNo2, "鞍座号:" + theSaddle.STOCK_NO.ToString() + "\r"
                                        + "方坯号1:" + theSaddle.CoilNO + "\r"
                                        + "方坯号2:" + theSaddle.CoilNO1 + "\r"
                                        //+ "占位值:" + theSaddle.TagVal_IsOccupied + "\r"
                                        //+ "锁定请求:" + theSaddle.Tag_Lock_Request_Value + "\r"
                                        + "坐标:" + "\r"
                                        + "X = " + theSaddle.XCENTER + "\r"
                                        + "Y = " + theSaddle.YCENTER + "\r"
                                        //+ "------------------------" + "\r"
                                        //+ "出口占位为1,入口占位为0" + "\r"
                                        //+ "黑色代表有占位有卷号" + "\r"
                                        //+ "橙色代表占位、卷号只有其中一个" + "\r"
                                        //+ "红色代表机组鞍座已锁定" + "\r"
                                        );
                };
                ////出口机组占位值
                //if (theSaddle.SaddleNo.IndexOf("C") > -1)
                //{
                //    if (!string.IsNullOrEmpty(theSaddle.CoilNO.Trim()))
                //    {
                //        if (theSaddle.TagVal_IsOccupied == 1)
                //        {
                //            this.BackColor = Color.Black;
                //        }
                //        else
                //        {
                //            this.BackColor = Color.LightSalmon;
                //        }
                //    }
                //    else
                //    {
                //        if (theSaddle.TagVal_IsOccupied == 1)
                //        {
                //            this.BackColor = Color.LightSalmon;
                //        }
                //        else
                //        {
                //            this.BackColor = Color.White;
                //        }
                //    }
                //}
                //else if (theSaddle.SaddleNo.IndexOf("R") > -1)  //入口机组占位值
                //{
                //    //钢卷不为空
                //    if (!string.IsNullOrEmpty(theSaddle.CoilNO.Trim()))
                //    {
                //        //特殊情况(鞍座没有占位)
                //        if (theSaddle.SaddleNo.Trim() == "D413SR1A00" || theSaddle.SaddleNo.Trim() == "D413SR1A01" || theSaddle.SaddleNo.Trim() == "D413SR1A02" || theSaddle.SaddleNo.Trim() == "D413SR1A03" ||
                //            theSaddle.SaddleNo.Trim() == "D413SR1A04" || theSaddle.SaddleNo.Trim() == "D413SR1A06" || theSaddle.SaddleNo.Trim() == "D413SR1A07" || theSaddle.SaddleNo.Trim() == "D413SR1A08" ||
                //            theSaddle.SaddleNo.Trim() == "D413SR1A09")
                //        {
                //            this.BackColor = Color.Black;
                //        }
                //        else
                //        {
                //            // 鞍座有占位
                //            if (theSaddle.TagVal_IsOccupied == 0)
                //            {
                //                this.BackColor = Color.Black;
                //            }
                //            else
                //            {
                //                this.BackColor = Color.LightSalmon;
                //            }
                //        }

                //    }
                //    else
                //    {
                //        if (theSaddle.TagVal_IsOccupied == 0)
                //        {
                //            ////特殊情况(鞍座没有占位)
                //            if (theSaddle.SaddleNo.Trim() == "D308WR1A05" || theSaddle.SaddleNo.Trim() == "D413SR1A00" || theSaddle.SaddleNo.Trim() == "D413SR1A01" || theSaddle.SaddleNo.Trim() == "D413SR1A02" || theSaddle.SaddleNo.Trim() == "D413SR1A03" ||
                //            theSaddle.SaddleNo.Trim() == "D413SR1A04" || theSaddle.SaddleNo.Trim() == "D413SR1A06" || theSaddle.SaddleNo.Trim() == "D413SR1A07" || theSaddle.SaddleNo.Trim() == "D413SR1A08" ||
                //            theSaddle.SaddleNo.Trim() == "D413SR1A09")  //特殊情况
                //                this.BackColor = Color.White;
                //            else
                //                this.BackColor = Color.LightSalmon;
                //        }
                //        else
                //        {
                //            this.BackColor = Color.White;
                //        }
                //    }
                //}

                ////已锁定机组鞍座
                //if (theSaddle.Tag_IsLocked_Value == 1)
                //{
                //    this.BackColor = Color.Red;
                //}

                //X或Y等于小于 0时,不显示
                // || theSaddle.XCENTER == 999999 || theSaddle.YCENTER == 999999
                if (theSaddle.XCENTER == 0 || theSaddle.YCENTER == 0)
                {
                    this.Visible = false;
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteProgramLog(ex.Message);
                LogManager.WriteProgramLog(ex.StackTrace);
            }
        }
Ejemplo n.º 5
0
        public void refreshControl(SaddleBase theSaddle, double X_Width, double Y_Height, AreaBase theArea, int panelWidth, int panelHeight, bool xAxisRight, bool yAxisDown, Panel panel, long baySpaceX, long baySpaceY)
        {
            try
            {
                //附对象
                mySaddleInfo = theSaddle;
                width        = panelWidth;
                height       = panelHeight;

                //计算X方向上的比例关系
                double xScale;
                if (theArea.AreaNo == "EY1" || theArea.AreaNo == "EY2" || theArea.AreaNo == "EY3")
                {
                    xScale = Convert.ToDouble(panelWidth - 150) / Convert.ToDouble(X_Width);
                }
                else
                {
                    xScale = Convert.ToDouble(panelWidth - 10) / Convert.ToDouble(X_Width);
                }

                double location_X = 0;
                if (xAxisRight == true)
                {
                    location_X = Convert.ToDouble((theSaddle.X_Center - theSaddle.SaddleLength / 2) - theArea.X_Start) * xScale;
                }
                else
                {
                    location_X = Convert.ToDouble(Math.Abs((theArea.X_End - (theSaddle.X_Center - theSaddle.SaddleLength / 2)))) * xScale;
                }

                //计算Y方向的比例关系
                double yScale;
                if (theArea.AreaNo == "EY1" || theArea.AreaNo == "EY2" || theArea.AreaNo == "EY3")
                {
                    yScale = Convert.ToDouble(panelHeight - 90) / Convert.ToDouble(Y_Height);
                }
                else
                {
                    yScale = Convert.ToDouble(panelHeight) / Convert.ToDouble(Y_Height);
                }

                double location_Y = 0;
                if (yAxisDown == true)
                {
                    location_Y = ((theSaddle.Y_Center - theSaddle.SaddleWidth / 2) - theArea.Y_Start) * yScale;
                }
                else
                {
                    location_Y = Convert.ToDouble(theArea.Y_End - (theSaddle.Y_Center - theSaddle.SaddleWidth / 2)) * yScale;
                }


                Location_X = (int)location_X;
                Location_Y = (int)location_Y;

                if (theSaddle.Stock_Status == 0 && theSaddle.Lock_Flag == 0)  //无卷可用
                {
                    this.BackColor = Color.White;
                }
                else if (theSaddle.Stock_Status == 2 && theSaddle.Lock_Flag == 0)  //有卷可用
                {
                    //区分机组
                    if (theSaddle.Next_Unit_No == "D118" || theSaddle.Next_Unit_No == "D218")
                    {
                        this.BackColor = Color.Yellow;
                    }
                    else if (theSaddle.Next_Unit_No == "D308" || theSaddle.Next_Unit_No == "D212")
                    {
                        this.BackColor = Color.Green;
                    }
                    else
                    {
                        this.BackColor = Color.Black;
                    }
                }
                else
                {
                    this.BackColor = Color.Red;
                }

                //修改鞍座控件的宽度和高度
                this.Width  = Convert.ToInt32(theSaddle.SaddleWidth * xScale);
                this.Height = Convert.ToInt32(theSaddle.SaddleLength * yScale);

                //定位库位鞍座的坐标
                if (theSaddle.Layer_Num == 2)
                {
                    this.Location = new Point(Convert.ToInt32(location_X), Convert.ToInt32(location_Y) - 20);
                }
                else
                {
                    this.Location = new Point(Convert.ToInt32(location_X), Convert.ToInt32(location_Y));
                }


                this.BringToFront();

                //if (theSaddle.SaddleNo.Substring( Convert.ToInt32( theSaddle.SaddleNo.Length.ToString()) - 1,1) == "2")
                //    this.BorderStyle = BorderStyle.Fixed3D;
                //else
                this.BorderStyle = BorderStyle.None;

                gr           = panel.CreateGraphics();
                panel.Paint += panel_Paint;

                this.panel1.Paint += conStockSaddle_Paint;

                toolTip1.IsBalloon   = true;
                toolTip1.ReshowDelay = 0;
                toolTip1.SetToolTip(this.panel1, "材料号:" + theSaddle.Mat_No + "\r"
                                    + "库位:    " + theSaddle.SaddleNo.ToString()
                                    + "\r" + theSaddle.Row_No.ToString() + "行" + "-" + theSaddle.Col_No.ToString() + "列," + "\r"
                                    + "坐标:" + "\r"
                                    + "X = " + theSaddle.X_Center + "\r"
                                    + "Y = " + theSaddle.Y_Center + "\r"
                                    + "Z = " + theSaddle.Z_Center + "\r"
                                    + "下道机组: " + theSaddle.Next_Unit_No + "\r"
                                    );
            }
            catch (Exception er)
            {
                throw;
            }
        }