Exemplo n.º 1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (MainControl.Weld_Sta != "")
            {
                lb_LeftStation.Text = MainControl.Weld_Sta;
            }
            //if (DateSave.Instance().Production.Door_Enable == true)
            //{
            //    DoorShow.Text = "门屏蔽";
            //}
            //else
            //{
            //    DoorShow.Text = "门未屏蔽";
            //}
            //if ()
            //{
            //    WeldSta = true;

            //}
            if (IOManage.INPUT("锁光出光").On)
            {
                锁光.Text      = "可出光";
                锁光.BackColor = Color.Green;
                IOManage.OUTPUT("外部锁光").SetOutBit(true);
            }
            else
            {
                锁光.Text      = "已锁光";
                锁光.BackColor = Color.Red;
                IOManage.OUTPUT("外部锁光").SetOutBit(false);
            }
            if (DateSave.Instance().Production.StationMaterial == true)
            {
                btn_LeftPosWelding.Text = "工位有料";
            }
            else
            {
                btn_LeftPosWelding.Text = "工位无料";
            }
            if ((mes.Instance().DataReceivedstrSN != "" && LeftSnshow.Text == "") || (LeftSnshow.Text != mes.Instance().DataReceivedstrSN))
            {
                LeftSnshow.Text = mes.Instance().DataReceivedstrSN;
            }
            try
            {
                if ((DateSave.Instance().Production.WeldDate.Average() != 0 && lb_LeftMarkPower.Text == "") || (lb_LeftMarkPower.Text != DateSave.Instance().Production.WeldDate.Average().ToString()))
                {
                    lb_LeftMarkPower.Text = Math.Round(DateSave.Instance().Production.WeldDate.Average(), 1).ToString();
                }
            }
            catch { }



            if ((DateSave.Instance().Production.OK_date != 0 && lb_LeftYield.Text == "") || (lb_LeftYield.Text != DateSave.Instance().Production.OK_date.ToString()))
            {
                lb_LeftYield.Text = DateSave.Instance().Production.OK_date.ToString();
            }
            if ((DateSave.Instance().Production.Weld_Speed != 0 && lb_LeftMarkSpeed.Text == "") || (lb_LeftMarkSpeed.Text != DateSave.Instance().Production.Weld_Speed.ToString()))
            {
                lb_LeftMarkSpeed.Text = DateSave.Instance().Production.Weld_Speed.ToString();
            }
            if (lb_LeftPos.Text != DateSave.Instance().Production.TheCurrentpoint.ToString())
            {
                lb_LeftPos.Text = DateSave.Instance().Production.TheCurrentpoint.ToString();
            }

            if ((DateSave.Instance().Production.CTtime != "" && lb_LeftCT.Text == "") || (lb_LeftCT.Text != DateSave.Instance().Production.CTtime))
            {
                lb_LeftCT.Text = DateSave.Instance().Production.CTtime;
            }
            if (DateSave.Instance().Production.ModelNo != "" && 当前机种号.Text == "NUM" || 当前机种号.Text != DateSave.Instance().Production.ModelNo)
            {
                当前机种号_.Text = DateSave.Instance().Production.ModelNo;
                当前机种号.Text  = DateSave.Instance().Production.ModelNo;
            }
            if (Socket_server.Instance().recvDate != "")
            {
                lb_RightMarkSpeed.Text = Socket_server.Instance().recvDate;
            }

            if ((DateSave.Instance().Production.Current_TIME != 0 && 清理铜嘴次数.Text == "") || (清理铜嘴次数.Text != DateSave.Instance().Production.Current_TIME.ToString()))
            {
                清理铜嘴次数.Text = DateSave.Instance().Production.Current_TIME.ToString();
            }
            if (DateSave.Instance().Production.Clear_TIME == DateSave.Instance().Production.Current_TIME)
            {
                MainControl.BIZZ("请清理铜嘴", "请清理铜嘴");
                DateSave.Instance().Production.Current_TIME++;
            }


            if (frist == 0 && LoginForm.landingFinish == true)
            {
                frist++;
                asc.AddControl(panel2);
            }
            if (frist == 1)
            {
                this.Top = 0;

                this.Left = 0;



                frist++;
                delay(1000);
                int Width  = Screen.PrimaryScreen.WorkingArea.Width;
                int Height = Screen.PrimaryScreen.WorkingArea.Height;
                int wih    = MainModule.FormMain.Width;
                int aq1e   = panel2.Width;
                int aqe    = panel2.Height;

                panel2.SetBounds(asc.oldCtrl[0].Top, asc.oldCtrl[0].Left, Width, aqe);
                Thread.Sleep(100);
                if (asc.oldCtrl.Count > 0)
                {
                    asc.controlAutoSize(panel2);
                }
            }
            double sd = 0.0;

            TableManage.TableDriver("运动平台")._GetAdc(1, out sd);
            if (startHoming || MainModule.FormMain.bAuto)
            {
            }
            else if (IOManage.INPUT("手轮X").On || IOManage.INPUT("手轮Y").On || IOManage.INPUT("手轮Z").On || IOManage.INPUT("手轮U").On)
            {
                if (IOManage.INPUT("手轮X").On&& setOk == false)
                {
                    if (IOManage.INPUT("手轮1").On)
                    {
                        setOk = true;
                        TableManage.TableDriver("运动平台").StartManualPulser(1, 1);
                    }
                    else if (IOManage.INPUT("手轮10").On)
                    {
                        setOk = true;
                        TableManage.TableDriver("运动平台").StartManualPulser(1, 10);
                    }
                    else if (IOManage.INPUT("手轮100").On)
                    {
                        setOk = true;
                        TableManage.TableDriver("运动平台").StartManualPulser(1, 50);
                    }
                }
                if (IOManage.INPUT("手轮Y").On&& setOk == false)
                {
                    if (IOManage.INPUT("手轮1").On)
                    {
                        setOk = true;
                        TableManage.TableDriver("运动平台").StartManualPulser(2, 1);
                    }
                    else if (IOManage.INPUT("手轮10").On)
                    {
                        setOk = true;
                        TableManage.TableDriver("运动平台").StartManualPulser(2, 10);
                    }
                    else if (IOManage.INPUT("手轮100").On)
                    {
                        setOk = true;
                        TableManage.TableDriver("运动平台").StartManualPulser(2, 50);
                    }
                }
                if (IOManage.INPUT("手轮Z").On&& setOk == false)
                {
                    if (IOManage.INPUT("手轮1").On)
                    {
                        setOk = true;
                        TableManage.TableDriver("运动平台").StartManualPulser(3, 1);
                    }
                    else if (IOManage.INPUT("手轮10").On)
                    {
                        setOk = true;
                        TableManage.TableDriver("运动平台").StartManualPulser(3, 10);
                    }
                    else if (IOManage.INPUT("手轮100").On)
                    {
                        setOk = true;
                        TableManage.TableDriver("运动平台").StartManualPulser(3, 50);
                    }
                }

                if (IOManage.INPUT("手轮U").On&& setOk == false)
                {
                    if (IOManage.INPUT("手轮1").On)
                    {
                        setOk = true;
                        TableManage.TableDriver("运动平台").StartManualPulser(4, 1);
                    }
                    else if (IOManage.INPUT("手轮10").On)
                    {
                        setOk = true;
                        TableManage.TableDriver("运动平台").StartManualPulser(4, 10);
                    }
                    else if (IOManage.INPUT("手轮100").On)
                    {
                        setOk = true;
                        TableManage.TableDriver("运动平台").StartManualPulser(4, 50);
                    }
                }
            }
            else if (IOManage.INPUT("手轮X").Off&& IOManage.INPUT("手轮Y").Off&& IOManage.INPUT("手轮Z").Off&& setOk == true)
            {
                setOk = false;
                TableManage.TableDriver("运动平台").StopManualPulser(0);
                TableManage.TableDriver("运动平台").StopManualPulser(1);
                TableManage.TableDriver("运动平台").StopManualPulser(2);
                TableManage.TableDriver("运动平台").StopManualPulser(3);
                TableManage.TableDriver("运动平台").StopManualPulser(4);
                TableManage.TableDriver("运动平台").StopManualPulser(5);
                TableManage.TableDriver("运动平台").StopManualPulser(6);
                TableManage.TableDriver("运动平台").StopManualPulser(7);
            }
            if (MainModule.FormMain.Parse == false && RunClass.Instance().parse == true)
            {
                RunClass.Instance().parse   = false;
                RunClass.Instance().GoOnRun = true;
            }

            // if (IOManage.INPUT("文档状态").On)
            //{
            //    RunClass.Instance(). WeldFinishSta = "StartWeld";

            //}
            //    if (IOManage.INPUT("文档状态").Off)
            //    {

            //    RunClass.Instance().WeldFinishSta = "WeldFinish";

            //    }


            //if (StartHome==true)
            //{
            //    MainModule.FormMain.bHomeReady = false;
            //    StartHome = false;
            //    MainModule.FormMain.bHomeReady = false;
            //    StartHome = false; HomeDoneZ = false;
            //    TableManage.TableDriver("运动平台").Home(TableAxisName.Z);


            //}

            //if (TableManage.TableDriver("运动平台").HomeDone(TableAxisName.Z) && HomeDoneZ == false)
            //{
            //    HomeDoneZ = true;
            //    HomeDoneXY = false;
            //}

            //if (HomeDoneXY == false)
            //{
            //    HomeDoneXY = true;
            //    TableManage.TableDriver("运动平台").Home(TableAxisName.X);
            //    TableManage.TableDriver("运动平台").Home(TableAxisName.Y);
            //}
            //if (TableManage.TableDriver("运动平台").HomeDone(TableAxisName.X) && TableManage.TableDriver("运动平台").HomeDone(TableAxisName.Y)&& HomeDoneXY == false)
            //{
            //    HomeDoneXY = true;
            //    MainModule.FormMain.bHomeReady = true;
            //}
            //string en = "";
            //string sendd = "";
            //sendd = Weld_Log.Instance().Dequeue(en);
            //if (sendd != "")
            //{
            //    Weld_Log.Instance().WriteLog(LOG_LEVEL.LEVEL_3, sendd, LOG_TYPE.INFO);

            //}
            //else
            //{

            //    // Thread.Sleep(200);
            //}
            if (MainModule.FormMain.bEstop == true)
            {
                DateSave.Instance().Production.EStop = true;
            }
            //else
            //{

            //    DateSave.Instance().Production.EStop = false;
            //}
        }