示例#1
0
        private void timer1_Tick(object sender, EventArgs e)//定时器
        {
            CTran.CommTimerCall();
            if (bRefresh())
            {
                this.Invalidate();
            }
            if (DI076.GetBoolValue())
            {
                button141.Enabled = true;
                button142.Enabled = false;
            }
            else
            {
                button141.Enabled = false;
                if (SPLC.System[0] == 7)
                {
                    button142.Enabled = false;//配方运行是水冷套下不能点击
                }
                else
                {
                    button142.Enabled = true;
                }
            }

            if (SPLC.System[0] == 18)
            {
                button018.Enabled = false;
            }
            else
            {
                button018.Enabled = true;
            }

            if (SPLC.System[0] == 7)
            {
                button074.Enabled = false;
            }
            else
            {
                button074.Enabled = true;
            }

            if (DI074.GetBoolValue())
            {
                button074.BackColor = Color.LimeGreen;
                button074.Text      = "生长室门阀关闭";
            }
            else if (DI075.GetBoolValue())
            {
                button074.BackColor = Color.Red;
                button074.Text      = "生长室门阀开启";
            }
            else
            {
                button074.BackColor = Color.Gray;
                button074.Text      = "生长室门阀";
            }

            if (DI110.GetBoolValue())
            {
                button110.BackColor = Color.LimeGreen;
                button110.Text      = "进样室门阀关闭";
            }
            else if (DI111.GetBoolValue())
            {
                button110.BackColor = Color.Red;
                button110.Text      = "进样室门阀开启";
            }
            else
            {
                button110.BackColor = Color.Gray;
                button110.Text      = "进样室门阀";
            }
            this.Invalidate();
            //Rectangle rc = new Rectangle(new Point(158, 13), new Size(203, 93));
            //this.Invalidate(rc,true);
        }
示例#2
0
        private void buttonSend1002(object sender, EventArgs e)//下发程序控制
        {
            Button nCon = (Button)sender;

            switch (nCon.Name)
            {
            case "button074":
                if (DI074.GetBoolValue())
                {
                    if (bMsgBoxShowYN("是否进行生长室门阀关闭程序?", "关闭"))
                    {
                        SPLC.SendAODO("1002", 12, "SY");    //12:生长室门阀关闭
                    }
                }
                else if (DI075.GetBoolValue())
                {
                    if (SPLC.System[0] == 7)
                    {
                        return;
                    }
                    if (bMsgBoxShowYN("是否进行生长室门阀开启程序?", "开启"))
                    {
                        SPLC.SendAODO("1002", 11, "SY");    //11:生长室门阀开启
                    }
                }
                break;

            case "button110":    //进样室门阀
                if (DI110.GetBoolValue())
                {
                    if (bMsgBoxShowYN("是否进行进样室门阀关闭程序?", "关闭"))
                    {
                        if (SPLC.System[0] == 7)
                        {
                            SPLC.SendAODO("1046", 17, "SY");    //17:进样室门阀关闭
                        }
                        else
                        {
                            SPLC.SendAODO("1002", 17, "SY");    //17:进样室门阀关闭
                        }
                    }
                }
                else if (DI111.GetBoolValue())
                {
                    if (bMsgBoxShowYN("是否进行进样室门阀开启程序?", "开启"))
                    {
                        if (SPLC.System[0] == 7)
                        {
                            SPLC.SendAODO("1046", 16, "SY");    //16:进样室门阀开启
                        }
                        else
                        {
                            SPLC.SendAODO("1002", 16, "SY");    //16:进样室门阀开启
                        }
                    }
                }
                break;

            case "button018":
                if (bMsgBoxShowYN("是否进行进样室吹扫程序?", "吹扫"))
                {
                    SPLC.SendAODO("1002", 18, "SY");    //18:进样室吹扫
                }
                break;

            case "button147":
                if (bMsgBoxShowYN("是否打开进样室抽气门阀?", "抽气"))
                {
                    SPLC.SendAODO("AV147", 0, "DO");
                }
                break;

            case "button145":
                if (bMsgBoxShowYN("是否打开进样室充气门阀?", "充气"))
                {
                    SPLC.SendAODO("AV145", 0, "DO");
                }
                break;

            case "button141":
                if (bMsgBoxShowYN("是否关闭水冷套?", "关闭"))
                {
                    SPLC.SendAODO("AV141", 1, "DO2");
                    SPLC.SendAODO("AV142", 0, "DO2");
                }
                break;

            case "button142":
                if (bMsgBoxShowYN("是否开启水冷套?", "开启"))
                {
                    SPLC.SendAODO("AV141", 0, "DO2");
                    SPLC.SendAODO("AV142", 1, "DO2");
                }
                break;
            }
        }
示例#3
0
        private void DrawRing(Graphics g)//画阀门和进样室上下位
        {
            RectangleF rect1 = new RectangleF(CMach.PFCenter.X - 147, CMach.PFCenter.Y - 70, 14, 140);
            RectangleF rect2 = new RectangleF(CMach.PFCenter.X + 117, CMach.PFCenter.Y - 70, 14, 140);

            if (DI074.GetBoolValue())
            {
                g.FillRectangle(Brushes.Lime, rect1);
            }
            else if (DI075.GetBoolValue())
            {
                g.FillRectangle(Brushes.Red, rect1);
            }
            else
            {
                g.FillRectangle(Brushes.Gray, rect1);
            }

            if (DI110.GetBoolValue())
            {
                g.FillRectangle(Brushes.Lime, rect2);
            }
            else if (DI111.GetBoolValue())
            {
                g.FillRectangle(Brushes.Red, rect2);
            }
            else
            {
                g.FillRectangle(Brushes.Gray, rect2);
            }

            Single     iL        = 300;
            Single     iH        = 40;
            Single     iW        = 30;
            RectangleF rect3     = new RectangleF(CMach.PFCenter.X - iH, CMach.PFCenter.Y - iL - iW, iH / 2, iW * 2);
            RectangleF rect4     = new RectangleF(CMach.PFCenter.X + iH / 2, CMach.PFCenter.Y - iL - iW, iH / 2, iW * 2);
            bool       B2        = false;
            bool       B3        = false;
            SolidBrush FontBrush = new SolidBrush(System.Drawing.Color.DeepSkyBlue);

            FontBrush.Color = Color.White;
            StringFormat format1 = new StringFormat(StringFormatFlags.LineLimit);

            format1.Alignment     = StringAlignment.Center;
            format1.LineAlignment = StringAlignment.Center;
            for (int i = 0; i < CMach.TuoPanNum; i++)
            {
                if (CMach.TuoPan[i] == 2)//进样室高位
                {
                    B2 = true;
                }
                else if (CMach.TuoPan[i] == 3)//进样室高位
                {
                    B3 = true;
                }
            }
            if (B2)//进样室高位
            {
                g.FillRectangle(Brushes.Red, rect3);
                g.DrawString("上", new Font("宋体", 16, GraphicsUnit.World), FontBrush, rect3, format1);
            }
            else
            {
                g.FillRectangle(Brushes.Gray, rect3);
                g.DrawString("上", new Font("宋体", 16, GraphicsUnit.World), FontBrush, rect3, format1);
            }
            if (B3)//进样室高位
            {
                g.FillRectangle(Brushes.Red, rect4);
                g.DrawString("下", new Font("宋体", 16, GraphicsUnit.World), FontBrush, rect4, format1);
            }
            else
            {
                g.FillRectangle(Brushes.Gray, rect4);
                g.DrawString("下", new Font("宋体", 16, GraphicsUnit.World), FontBrush, rect4, format1);
            }
        }