Esempio n. 1
0
        //选择回零轴
        private void button_home_Click(object sender, EventArgs e)
        {
            Global.WorkVar.tag_isFangDaiJieChu = false;
            if (!Work.IsMove(1))
            {
                return;
            }
            if (CBChoiceAxis.Text == "")
            {
                MessageBoxLog.Show("选择轴位不能为空");
                return;
            }
            AxisConfig acg;

            acg = StationManage.FindAxis(CBStnChioce.Text, CBChoiceAxis.Text);
            if (acg == null)
            {
                MessageBoxLog.Show("查找轴失败");
                return;
            }

            GoHomeParameterUI gohome = new GoHomeParameterUI(acg);

            gohome.ShowDialog();
        }
Esempio n. 2
0
        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {
            tag_manual.tag_Induction = checkBox2.Checked;
            StationModule sm = StationManage.FindStation(tag_workBase.tag_stationName);

            sm.tag_Enable = tag_manual.tag_Induction;
        }
Esempio n. 3
0
        /// <summary>
        /// 急停所有
        /// </summary>
        public void Stop()
        {
            object[] po = new object[1];
            StationManage.StopAllAxis();
            threadStop();
            Global.WorkVar.tag_StopState    = 1;
            Global.WorkVar.tag_SuspendState = 0;
            Global.WorkVar.tag_ResetState   = 0;
            Global.WorkVar.tag_workState    = 0;

            Global.WorkVar.InitCommunicateStatus();
            foreach (object o in tag_workObject)
            {
                Type t = o.GetType();
                System.Reflection.MethodInfo[]   methods      = t.GetMethods();
                System.Reflection.PropertyInfo[] PropertyInfo = t.GetProperties();
                System.Reflection.MemberInfo[]   MemberInfos  = t.GetMembers();
                for (int i = 0; i < methods.Length; i++)
                {
                    if (methods[i].Name == "Stop")
                    {
                        po[0] = o;
                        methods[i].Invoke(o, po);
                    }
                }
            }
        }
Esempio n. 4
0
 public bool Save()
 {
     try
     {
         PointAggregate.strName = textBox_Name.Text;
         StationModule sm   = StationManage.FindStation(PointAggregate.strStationName);
         int           eucf = 1000;
         for (int i = 0; i < PointAggregate.arrPoint.Length; i++)
         {
             NumericUpDown PonitSpeed = tag_list[i * 2];
             NumericUpDown PonitValue = tag_list[i * 2 + 1];
             if (sm != null)
             {
                 eucf = (int)sm.arrAxis[i].Eucf;
             }
             else
             {
                 eucf = (int)1000;;
             }
             PointAggregate.arrPoint[i].dblPonitSpeed = Convert.ToDouble(PonitSpeed.Value) * eucf;
             PointAggregate.arrPoint[i].dblPonitValue = Convert.ToDouble(PonitValue.Value);
         }
     }
     catch (System.Exception ex)
     {
         LogOutControl.OutLog(ex.Message, 0);
         Console.Write(ex.ToString());
         return(false);
     }
     return(true);
 }
Esempio n. 5
0
 /// <summary>
 /// 暂停
 /// </summary>
 /// <param name="o1"></param>
 /// <returns></returns>
 public short Suspend(object o1)
 {
     Global.WorkVar.tag_SuspendState = 1;
     object[] po = new object[1];
     po[0] = o1;
     if (_Config.tag_PrivateSave.tag_SuspendType == 0)
     {
         StationManage.StopAllAxis();
     }
     foreach (object o in tag_workObject)
     {
         Type t = o.GetType();
         System.Reflection.MethodInfo[]   methods      = t.GetMethods();
         System.Reflection.PropertyInfo[] PropertyInfo = t.GetProperties();
         System.Reflection.MemberInfo[]   MemberInfos  = t.GetMembers();
         for (int i = 0; i < methods.Length; i++)
         {
             if (methods[i].Name == "Suspend")
             {
                 methods[i].Invoke(o, po);
             }
         }
     }
     return(0);
 }
Esempio n. 6
0
        //手动调试界面加载
        private void FrmDebug_Load(object sender, EventArgs e)
        {
            TabPagManual_Enter(sender, e);
            CBSpeedLevel.Text = "常速";
            StnChioceCB_Show(sender, e);

            if (StationManage.OpenSevroAllAxis() != 0)
            {
                MessageBoxLog.Show("使能失败");
                return;
            }
            if (worker != null && worker._Config != null)
            {
                checkBox3_safeLight.Checked = worker._Config.tag_PrivateSave.tag_safeLightOffOn;
                checkBox5.Checked           = worker._Config.tag_PrivateSave.tag_safeGateOffOn;
                if (worker._Config.tag_PrivateSave.tag_SuspendType == 0)
                {
                    checkBox_sup.Checked = true;
                }
                else
                {
                    checkBox_sup.Checked = false;
                }
            }
            TB_LeftStationLog.Text  = worker._Config.tag_LeftStationLogIndex.ToString();
            TB_RightStationLog.Text = worker._Config.tag_RightStationLogIndex.ToString();
        }
Esempio n. 7
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            //IOinput组件加载到界面
            int m = 0;

            plIOmessage.Controls.Clear();
            StationModule sm = StationManage.FindStation(comboBox_IO.Text);

            for (int i = 0; i < sm.intUseInputIoCount && i < sm.arrInputIo.Count; i++)
            {
                IOInputStatusControl ioinput = new IOInputStatusControl(sm.arrInputIo[i]);
                {
                    ioinput.Location = new Point(5, 24 + 28 * i);
                    plIOmessage.Controls.Add(ioinput);
                }
                arrInputIo = sm.arrInputIo[i];
                m          = i + 1;
            }
            int n = 0;

            //IOoutput组件加载到界面
            for (int i = 0; i < sm.intUseOutputIoCount && i < sm.arrOutputIo.Count; i++)
            {
                IOOutputStatusControl iooutput = new IOOutputStatusControl(sm.arrOutputIo[i], OutIOStationSelect);
                iooutput.Location = new Point(200, 24 + 40 * i);
                plIOmessage.Controls.Add(iooutput);
                arrOutputIo = sm.arrOutputIo[i];
                n           = i + 1;
            }
            NewCtrlCardIO.tag_IO_refresh = 10;
        }
Esempio n. 8
0
        /// <summary>
        /// 构造初始化函数
        /// </summary>
        /// <param name="classname"></param>
        /// <returns></returns>
        public string InitCreateN3()
        {
            string        content0 = "\tpublic short Init()\r\n\t{\r\n";
            StationModule sm       = StationManage.FindStation(tag_stationName);
            int           endStep  = sm.intUsePointCount - 1;

            string stepN = null;

            for (int i = 0; i < endStep + 1; i++)
            {
                string content1 = "\t\tPointAggregate _Step" + i + " = pointMotion.FindPoint(tag_stationName, \"" + sm.arrPoint[i].strName + "\"," + i + ");\r\n";
                string content2 = "\t\tif (_Step" + i + "  == null)\r\n";
                string content3 = "\t\t{\r\n";
                string content4 = "\t\t\treturn -1;\r\n\t\t}\r\n";
                string content5 = null;
                if (i > 0 && i < endStep)
                {
                    content5 = "\t\t_Step" + i + " .tag_BeginFun = Step1 ;\r\n";
                }
                else
                {
                    content5 = "\t\t_Step" + i + " .tag_BeginFun = Step" + i + " ;\r\n";
                }
                stepN = stepN + content1 + content2 + content3 + content4 + content5;
            }

            string content11 = "\t\treturn 0;\r\n\t}\r\n";

            return(annotateCreate("init", "初始化函数,初始化流程嵌入的代码,返回0 表示成功") + content0 + stepN + content11);
        }
Esempio n. 9
0
 private void MenuPause_Click(object sender, EventArgs e)
 {
     if (Global.WorkVar.tag_SuspendState == 1)
     {
         if (Global.WorkVar.tag_ResetState != 1)
         {
             IOParameter redlight    = StationManage.FindOutputIo("主控系统", "三色灯_红");
             IOParameter yellowlight = StationManage.FindOutputIo("主控系统", "三色灯_黄");
             IOParameter greenlight  = StationManage.FindOutputIo("主控系统", "三色灯_绿");
             NewCtrlCardV0.SetOutputIoBit(redlight, 0);
             NewCtrlCardV0.SetOutputIoBit(yellowlight, 0);
             NewCtrlCardV0.SetOutputIoBit(greenlight, 1);
         }
         tag_Work.Continue(null);
     }
     else
     {
         if (Global.WorkVar.tag_ResetState != 1)
         {
             IOParameter redlight    = StationManage.FindOutputIo("主控系统", "三色灯_红");
             IOParameter yellowlight = StationManage.FindOutputIo("主控系统", "三色灯_黄");
             IOParameter greenlight  = StationManage.FindOutputIo("主控系统", "三色灯_绿");
             NewCtrlCardV0.SetOutputIoBit(redlight, 0);
             NewCtrlCardV0.SetOutputIoBit(yellowlight, 1);
             NewCtrlCardV0.SetOutputIoBit(greenlight, 0);
         }
         tag_Work.Suspend(null);
     }
 }
Esempio n. 10
0
        private void comboBox_FlowName_SelectedIndexChanged(object sender, EventArgs e)
        {
            // 获取节点信息
            // push 到 terrview上
            // Tree view 可拖拽
            // 节点选中 获得参数

            tag_StationModule = StationManage.FindStation(comboBox_FlowName.Text);
            if (tag_StationModule != null)
            {
                node.Nodes.Clear();
                node.Remove();
                treeView_FlowStruct.Nodes.Clear();
                node.Text = comboBox_FlowName.Text;
            }
            for (int i = 0; i < tag_StationModule.arrPoint.Count; i++)
            {
                // 工位名称
                chlid      = new TreeNode();
                chlid.Text = tag_StationModule.arrPoint[i].strName;
                // 绑定选中事件
                node.Nodes.Add(chlid);
            }
            treeView_FlowStruct.Nodes.Add(node);
        }
Esempio n. 11
0
        public void LightandBuzzer(string lightColor, bool bBuzzer = false)
        {
            IOParameter redlight    = StationManage.FindOutputIo("主控系统", "三色灯_红");
            IOParameter yellowlight = StationManage.FindOutputIo("主控系统", "三色灯_黄");
            IOParameter greenlight  = StationManage.FindOutputIo("主控系统", "三色灯_绿");
            IOParameter buzzer      = StationManage.FindOutputIo("主控系统", "蜂鸣器");

            NewCtrlCardV0.SetOutputIoBit(redlight, 0);
            NewCtrlCardV0.SetOutputIoBit(yellowlight, 0);
            NewCtrlCardV0.SetOutputIoBit(greenlight, 0);
            if (bBuzzer)
            {
                NewCtrlCardV0.SetOutputIoBit(buzzer, 1);
            }
            if (lightColor == "红灯")
            {
                NewCtrlCardV0.SetOutputIoBit(redlight, 1);
            }
            else if (lightColor == "黄灯")
            {
                NewCtrlCardV0.SetOutputIoBit(yellowlight, 1);
            }
            else if (lightColor == "绿灯")
            {
                NewCtrlCardV0.SetOutputIoBit(greenlight, 1);
            }
        }
Esempio n. 12
0
 private void button_Axis_ImportOut_Click(object sender, EventArgs e)
 {
     if (DialogResult.OK == saveFileDialog1.ShowDialog())
     {
         string filename = saveFileDialog1.FileName;
         StationManage.GetAllAxis(filename);
     }
 }
Esempio n. 13
0
 private void button_Output_IO_ImportIn_Click(object sender, EventArgs e)
 {
     if (DialogResult.OK == openFileDialog1.ShowDialog())
     {
         string filename = openFileDialog1.FileName;
         string fcontent = StationManage.ReadFile(filename);
         StationManage.OutIoCardImport(fcontent);
     }
 }
Esempio n. 14
0
        /// <summary>
        ///  线程回原
        /// </summary>
        /// <param name="stationName"></param>
        /// <param name="axisName"></param>
        /// <returns></returns>
        public GoHome(string stationname, string AxisName)
        {
            StationModule stationM = StationManage.FindStation(tag_AxisName);

            tag_stationName = stationname;
            tag_AxisName    = AxisName;
            Thread homeThread = new Thread(new ParameterizedThreadStart(GoHomeRun));

            homeThread.Start();
            homeThread.IsBackground = true;
        }
Esempio n. 15
0
 //Combox选中工位后自动刷新工位参数
 private void StnChioceCB_SelectedIndexChanged(object sender, EventArgs e)
 {
     tag_StationModule  = StationManage.FindStation(CBStnChioce.Text);
     tag_PointAggregate = null;
     SetIndexPointAggregate();
     RefreshStation();
     tag_UserControl_ShowAllPoint.UserControl_ShowAllPoint_HeightLight(null, null);
     comboBox_IO.Focus();
     comboBox_IO.Text = CBStnChioce.Text;
     comboBox1_SelectedIndexChanged(sender, e);
     NewCtrlCardIO.tag_IO_refresh = 10;
 }
Esempio n. 16
0
        private void StationTrialRunControl_Load(object sender, EventArgs e)
        {
            button_LineCheck.Text = tag_titleName;
            StationModule sm = StationManage.FindStation(tag_workBase.tag_stationName);

            if (sm == null)
            {
                return;
            }
            tag_manual.tag_Induction = sm.tag_Enable;
            checkBox2.Checked        = sm.tag_Enable;
        }
Esempio n. 17
0
        private void MenuEmg_Click(object sender, EventArgs e)
        {
            IOParameter redlight    = StationManage.FindOutputIo("主控系统", "三色灯_红");
            IOParameter yellowlight = StationManage.FindOutputIo("主控系统", "三色灯_黄");
            IOParameter greenlight  = StationManage.FindOutputIo("主控系统", "三色灯_绿");

            NewCtrlCardV0.SetOutputIoBit(redlight, 1);
            NewCtrlCardV0.SetOutputIoBit(yellowlight, 0);
            NewCtrlCardV0.SetOutputIoBit(greenlight, 0);
            Global.WorkVar.tag_ButtonStopState = 1;

            tag_Work.Stop();
        }
Esempio n. 18
0
 private void button_DelAllPoint_Click(object sender, EventArgs e)
 {
     if (Global.CConst.UserLevel != Global.CConst.USER_SUPERADMIN)
     {
         MessageBoxLog.Show("无权限");
         return;
     }
     if (MessageBoxLog.Show("是否删除所有?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
     {
         return;
     }
     StationManage.StepDellAll();
 }
Esempio n. 19
0
 /// <summary>
 /// 使能所有轴
 /// </summary>
 /// <returns></returns>
 public static short OpenSevroAllAxis()
 {
     foreach (StationModule sm in _Config.arrWorkStation)
     {
         foreach (AxisConfig af in sm.arrAxis)
         {
             if (!StationManage.OpenSevro(sm.strStationName, af.AxisName, true))
             {
                 return(-1);
             }
         }
     }
     return(0);
 }
Esempio n. 20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="point"></param>
        public AxisSafeManage(PointAggregate point)
        {
            tag_AxisSafeList = new List <AxisSafe>();
            StationModule sm = StationManage.FindStation(point.strStationName);

            if (sm == null)
            {
                LogOutControl.OutLog("无" + point.strStationName, 0);
                return;
            }
            foreach (AxisConfig ac in sm.arrAxis)
            {
                Add((short)ac.tag_MotionCardManufacturer, ac.CardNum, ac.AxisNum);
            }
        }
Esempio n. 21
0
        /// <summary>
        /// 伺服电机回原函数
        /// </summary>
        /// <param name="stationName"></param>
        /// <param name="axisName"></param>
        /// <returns></returns>
        public static short GoHome(string stationName, string axisName)
        {
            AxisConfig      axisC = StationManage.FindAxis(stationName, axisName);
            NewCtrlCardBase Base_ = tag_NewCtrlCardBase[(int)axisC.tag_MotionCardManufacturer];

            if (Base_ == null)
            {
                MessageBoxLog.Show(NewCtrlCardBase.GetManufacturerName((int)axisC.tag_MotionCardManufacturer) + "控制卡初始化失败!");
                return(shrFail);
            }
            short ret = 0;

            if (axisC == null)
            {
                return(shrFail);
            }
            short shrResult = -1;

            switch (axisC.GoHomeType)
            {
            case 0:
                shrResult = Base_.SR_GoHome(axisC);
                break;

            case 1:
                shrResult = Base_.SR_GoHome(axisC);
                break;

            case 2:
                shrResult = Base_.SR_GoOneHome(axisC);
                break;

            case 3:
                shrResult = Base_.SR_GoOneHomeOrg(axisC);
                break;

            default:
                shrResult = Base_.SR_GoHome(axisC);
                break;
            }


            if (shrResult != shrSuccess)
            {
                return(shrFail);
            }
            return(shrResult);
        }
Esempio n. 22
0
        private void FrameUI_Load(object sender, EventArgs e)
        {
            //////////////////////////////////////////////////////////////////////////
            mainUI          = new MainUI(this, tag_Work);
            mainUI.TopLevel = false;
            mainUI.Parent   = this.PanelForm;

            debugUI          = new DebugUI(this, tag_Work);
            debugUI.TopLevel = false;
            debugUI.Parent   = this.PanelForm;
            alarmUI          = new AlarmUI();
            alarmUI.TopLevel = false;
            alarmUI.Parent   = this.PanelForm;
            formAdaptive.RecordOldSizeScale(this.PanelForm);
            timer_Main.Start();
            label_Version.Text = "版本号:" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            portShowControl.tag_Work = tag_Work;
            portShowControl.Location = new Point(label_User.Location.X + label_User.Size.Width - 20, label_User.Location.Y - 8);
            portShowControl.Size     = new Size((label_Version.Location.X - portShowControl.Location.X - 10) / 5, panel_MainInfo.Size.Height - 5);
            panel_MainInfo.Controls.Add(portShowControl);

            modeSelectControl.tag_Work = tag_Work;
            modeSelectControl.Location = new Point(portShowControl.Location.X + portShowControl.Size.Width - 40, portShowControl.Location.Y);
            modeSelectControl.Size     = new Size((label_Version.Location.X - modeSelectControl.Location.X - 10) / 4, panel_MainInfo.Size.Height - 5);
            panel_MainInfo.Controls.Add(modeSelectControl);

            ShowSubWindow(Global.CConst.FRM_MAIN);

            //////////////////////////////////////////////////////////////////////////
            if (Global.WorkVar.tag_StopState == 1)
            {
                IOParameter redlight    = StationManage.FindOutputIo("主控系统", "三色灯_红");
                IOParameter yellowlight = StationManage.FindOutputIo("主控系统", "三色灯_黄");
                IOParameter greenlight  = StationManage.FindOutputIo("主控系统", "三色灯_绿");
                NewCtrlCardV0.SetOutputIoBit(redlight, 1);
                NewCtrlCardV0.SetOutputIoBit(yellowlight, 0);
                NewCtrlCardV0.SetOutputIoBit(greenlight, 0);
            }
            IOParameter servoOnSwith = StationManage.FindOutputIo("总复位", "使能");

            if (servoOnSwith != null)
            {
                NewCtrlCardV0.SetOutputIoBit(servoOnSwith, 1);
            }
        }
Esempio n. 23
0
        /// <summary>
        /// 构造3步函数
        /// </summary>
        /// <param name="classname"></param>
        /// <returns></returns>
        public string StepCreateN3()
        {
            StationModule sm = StationManage.FindStation(tag_stationName);

            if (sm != null && sm.intUsePointCount > 0 && sm.intUsePointCount >= 3)
            {
                int    endStep = sm.intUsePointCount - 1;
                string ret     = null;

                ret = ret + StepCreateN(0, sm.arrPoint[0].strName);
                ret = ret + StepCreateN(1, sm.arrPoint[1].strName);

                ret = ret + StepCreateN(endStep, sm.arrPoint[endStep].strName);
                return(ret);
            }
            return("");
        }
Esempio n. 24
0
        private void  除所有ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Global.CConst.UserLevel != Global.CConst.USER_SUPERADMIN)
            {
                MessageBoxLog.Show("无权限");
                return;
            }
            if (MessageBoxLog.Show("是否删除?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
            {
                return;
            }
            StationModule sm = StationManage.FindStation(trVStation.SelectedNode.Text);

            tag_work.Config.arrWorkStation.Clear();
            tag_work.Config.intUseStationCount = 0;
            tag_work.Config.Save();
            FrmStationMange_Load(null, null);
        }
Esempio n. 25
0
        /// <summary>
        /// 构造第N步函数
        /// </summary>
        /// <param name="classname"></param>
        /// <returns></returns>
        public string StepCreateN()
        {
            StationModule sm = StationManage.FindStation(tag_stationName);

            if (sm != null && sm.intUsePointCount > 0)
            {
                int    endStep = sm.intUsePointCount - 1;
                string ret     = null;


                for (int i = 0; i < endStep + 1; i++)
                {
                    ret = ret + StepCreateN(i, sm.arrPoint[i].strName);
                }
                return(ret);
            }
            return("");
        }
Esempio n. 26
0
        /// <summary>
        /// 获取单通道(Bit)输入IO状态,函数执行成功 判断status参数值 TRUE 有信号输入  FALSE无信号输入
        /// </summary>
        /// <param name="stationName"></param>
        /// <param name="ioName"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public static short GetInputIoBitStatus(string stationName, string ioName, out bool status)
        {
            short shrResult;

            status = false;
            if (ioName == null)
            {
                status = true;
                return(0);
            }
            IOParameter     ioP   = StationManage.FindInputIo(ioName);
            NewCtrlCardBase Base_ = tag_NewCtrlCardBase[(int)ioP.tag_MotionCardManufacturer];

            if (Base_ == null)
            {
                MessageBoxLog.Show(NewCtrlCardBase.GetManufacturerName((int)ioP.tag_MotionCardManufacturer) + "控制卡初始化失败!");
                return(shrFail);
            }
            if (ioP == null)
            {
                MessageBoxLog.Show(stationName + "\r\nIO:<" + ioName + ">没有找到,请配置");
                return(shrFail);
            }

            shrResult = Base_.SR_GetInputBit(ioP.CardNum, ioP.IOBit, out status);
            if (ioP.Logic == 0)
            {
                if (status)
                {
                    status = false;
                }
                else
                {
                    status = true;
                }
            }
            if (shrResult
                == -1)
            {
                return(shrFail);
            }

            return(shrSuccess);
        }
Esempio n. 27
0
 private void FrameUI_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (MessageBoxLog.Show("确定要退出程序吗?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
     {
         IOParameter redlight    = StationManage.FindOutputIo("主控系统", "三色灯_红");
         IOParameter yellowlight = StationManage.FindOutputIo("主控系统", "三色灯_黄");
         IOParameter greenlight  = StationManage.FindOutputIo("主控系统", "三色灯_绿");
         NewCtrlCardV0.SetOutputIoBit(redlight, 0);
         NewCtrlCardV0.SetOutputIoBit(yellowlight, 0);
         NewCtrlCardV0.SetOutputIoBit(greenlight, 0);
         Global.WorkVar.tag_ButtonStopState = 1;
         tag_Work.Stop();
         NewCtrlCardV0.CloseCard(tag_Work.tag_CardHave);
     }
     else
     {
         e.Cancel = true;
     }
 }
Esempio n. 28
0
        /// <summary>
        /// 构造初始化函数
        /// </summary>
        /// <param name="classname"></param>
        /// <returns></returns>
        public string InitCreate()
        {
            string        content0  = "\tpublic short Init()\r\n\t{\r\n";
            StationModule sm        = StationManage.FindStation(tag_stationName);
            int           endStep   = sm.intUsePointCount - 1;
            string        content1  = "\t\tPointAggregate startStep = pointMotion.FindPoint(tag_stationName, \"" + sm.arrPoint[0].strName + "\",0);\r\n";
            string        content2  = "\t\tif (startStep == null)\r\n";
            string        content3  = "\t\t{\r\n";
            string        content4  = "\t\t\treturn -1;\r\n\t\t}\r\n";
            string        content5  = "\t\tstartStep.tag_BeginFun = FirstStep;\r\n";
            string        content6  = "\t\tPointAggregate endStep = pointMotion.FindPoint(tag_stationName, \"" + sm.arrPoint[sm.intUsePointCount - 1].strName + "\");\r\n";
            string        content7  = "\t\tif (endStep == null)\r\n";
            string        content8  = "\t\t{\r\n";
            string        content9  = "\t\t\treturn -1;\r\n\t\t}\r\n";
            string        content10 = "\t\tendStep.tag_EndFun = LastStep;\r\n";
            string        content11 = "\t\treturn 0;\r\n\t}\r\n";

            return(annotateCreate("init", "初始化函数,初始化流程嵌入的代码,返回0 表示成功") + content0 + content1 + content2 + content3 + content4 + content5 + content6 + content7 + content8 + content9 + content10 + content11);
        }
Esempio n. 29
0
        /// <summary>
        /// 轴绝对运动
        /// </summary>
        /// <param name="stationName"></param>
        /// <param name="axisName"></param>
        /// <param name="pointName"></param>
        /// <returns></returns>
        public static short AxisAbsoluteMove(string stationName, string axisName, string pointName, int asxisIndex)
        {
            StationModule stationM = StationManage.FindStation(stationName);

            if (stationM == null)
            {
                return(shrFail);
            }
            AxisConfig axisC = StationManage.FindAxis(stationM, axisName);

            if (axisC == null)
            {
                return(shrFail);
            }
            PointAggregate pointA = StationManage.FindPoint(stationM, pointName);

            if (pointA == null)
            {
                return(shrFail);
            }
            NewCtrlCardBase Base_ = tag_NewCtrlCardBase[(int)axisC.tag_MotionCardManufacturer];

            if (Base_ == null)
            {
                MessageBoxLog.Show(NewCtrlCardBase.GetManufacturerName((int)axisC.tag_MotionCardManufacturer) + "控制卡初始化失败!");
                return(shrFail);
            }
            short shrResult = 0;

            if (pointA.tag_motionType == 0)
            {
                shrResult = Base_.SR_AbsoluteMove(axisC, pointA.arrPoint[asxisIndex]);
            }
            else
            {
                shrResult = Base_.SR_RelativeMove(axisC, pointA.arrPoint[asxisIndex]);
            }
            if (shrResult != shrSuccess)
            {
                return(shrFail);
            }
            return(shrSuccess);
        }
Esempio n. 30
0
        /// <summary>
        /// 卡初始化
        /// </summary>
        /// <param name="card"></param>
        /// <param name="axisCount"></param>
        /// <param name="configFileName"></param>
        /// <returns></returns>
        public short _SR_InitCard()
        {
            short returnValue;

            returnValue = (short)adt8960m.adt8960_initial();
            if (returnValue <= 0)
            {
                string str = "8960控制卡初始化失败!";


                if (returnValue == 0)
                {
                    str = str + "\r\n没有安装ADT卡";
                }
                if (returnValue == -1)
                {
                    str = str + "没有安装端口驱动程序!";
                }
                if (returnValue == -2)
                {
                    str = str + "PCI桥故障!";
                }

                MessageBoxLog.Show(str);
                return(-1);
            }

            IOParameter diancifaLeft  = StationManage.FindOutputIo("左工位", "左载具电磁阀");
            IOParameter diancifaRight = StationManage.FindOutputIo("右工位", "右载具电磁阀");

            NewCtrlCardV0.SetOutputIoBit(diancifaLeft, 1);
            NewCtrlCardV0.SetOutputIoBit(diancifaRight, 1);

            //int aaa = _SR_set_io_mode(0, 0, 0);
            //if (aaa != 0)
            //{
            //    return -1;
            //}

            return(returnValue);
        }