public void UpdateChannelsInfo(string devID, int moduleIndex)
        {
            lstTbTrigIDs.Clear();
            pnTrigs.Controls.Clear();
            JFDevCellNameManeger  mgr = JFHubCenter.Instance.MDCellNameMgr;
            IJFModule_CmprTrigger md  = null;
            IJFDevice_MotionDaq   dev = JFHubCenter.Instance.InitorManager.GetInitor(devID) as IJFDevice_MotionDaq;

            if (dev != null && dev.CompareTriggerCount > moduleIndex)
            {
                md = dev.GetCompareTrigger(moduleIndex);
            }
            int trigChannCount = mgr.GetCmpTrigCount(devID, moduleIndex);

            for (int i = 0; i < trigChannCount; i++)
            {
                Label lb = new Label();
                lb.Location = new Point(2, 2 + 5 + 33 * i);
                lb.Text     = "序号:" + i.ToString("D2") + "名称:";
                pnTrigs.Controls.Add(lb);
                TextBox tbID = new TextBox();
                tbID.Location  = new Point(lb.Right, 2 + 33 * i);
                tbID.Text      = mgr.GetCmpTrigName(devID, moduleIndex, i);
                tbID.BackColor = SystemColors.Control;
                tbID.ReadOnly  = true;
                tbID.Width     = 200;
                pnTrigs.Controls.Add(tbID);
                lstTbTrigIDs.Add(tbID);
                UcCmprTrgChn ucTrig = new UcCmprTrgChn();
                ucTrig.Location = new Point(tbID.Right, 2 + 33 * i);
                ucTrig.SetModuleChn(md, i, "", null);
                pnTrigs.Controls.Add(ucTrig);
            }
        }
Example #2
0
        /// <summary>
        /// 更新模块的通道信息
        /// </summary>
        /// <param name="nodeChannel"></param>
        void _UpdateChannelNode(TreeNode nodeChannel)
        {
            DevNodeInfo          nodeInfo = nodeChannel.Tag as DevNodeInfo;
            JFDevCellNameManeger mgr      = JFHubCenter.Instance.MDCellNameMgr;

            if (nodeInfo.Categoty == DevNodeCategory.DioModule)
            {
                nodeChannel.Text = "序号_" + nodeInfo.ModuleIndex + ",DI数:" + mgr.GetDiChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex) + ",DO数:" + mgr.GetDoChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                ucDioNames.UpdateChannelsInfo(nodeInfo.DevID, nodeInfo.ModuleIndex);
            }
            else if (nodeInfo.Categoty == DevNodeCategory.MotionModule)
            {
                nodeChannel.Text = "序号_" + nodeInfo.ModuleIndex + ",轴数:" + mgr.GetAxisCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                ucAxisNames.UpdateChannelsInfo(nodeInfo.DevID, nodeInfo.ModuleIndex);
            }
            else if (nodeInfo.Categoty == DevNodeCategory.CmpTrigModule)
            {
                nodeChannel.Text = "序号_" + nodeInfo.ModuleIndex + ",通道数:" + mgr.GetCmpTrigCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                ucCmpTrigNames.UpdateChannelsInfo(nodeInfo.DevID, nodeInfo.ModuleIndex);
            }
            else if (nodeInfo.Categoty == DevNodeCategory.AioModule)
            {
                nodeChannel.Text = "序号_" + nodeInfo.ModuleIndex + ",AI数:" + mgr.GetAiChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex) + ",AO数:" + mgr.GetAoChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                ucAioNames.UpdateChannelsInfo(nodeInfo.DevID, nodeInfo.ModuleIndex);
            }
        }
Example #3
0
        /// <summary>
        /// 修改Module所属的通道数量 轴/Dio/Aio/Trig等等
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolStripMenuItemResetChannelCount_Click(object sender, EventArgs e)
        {
            TreeNode              currNode = tvDevs.SelectedNode;
            DevNodeInfo           nodeInfo = currNode.Tag as DevNodeInfo;
            JFDevCellNameManeger  mgr      = JFHubCenter.Instance.MDCellNameMgr;
            FormSetModuleChnCount fm       = new FormSetModuleChnCount();

            if (nodeInfo.Categoty == DevNodeCategory.MotionModule)
            {
                fm.Category      = FormSetModuleChnCount.ModuleCategory.Motion;
                fm.ChannelCount1 = mgr.GetAxisCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    mgr.SetAxisCount(nodeInfo.DevID, nodeInfo.ModuleIndex, fm.ChannelCount1);
                    _UpdateChannelNode(currNode);//_UpdateCfg2UI();
                }
            }
            else if (nodeInfo.Categoty == DevNodeCategory.CmpTrigModule)
            {
                fm.Category      = FormSetModuleChnCount.ModuleCategory.Trig;
                fm.ChannelCount1 = mgr.GetCmpTrigCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    mgr.SetCmpTrigCount(nodeInfo.DevID, nodeInfo.ModuleIndex, fm.ChannelCount1);
                    _UpdateChannelNode(currNode);//_UpdateCfg2UI();
                }
            }
            else if (nodeInfo.Categoty == DevNodeCategory.DioModule)
            {
                fm.Category      = FormSetModuleChnCount.ModuleCategory.Dio;
                fm.ChannelCount1 = mgr.GetDiChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                fm.ChannelCount2 = mgr.GetDoChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    mgr.SetDiChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex, fm.ChannelCount1);
                    mgr.SetDoChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex, fm.ChannelCount2);
                    _UpdateChannelNode(currNode);////_UpdateCfg2UI();
                }
            }
            else if (nodeInfo.Categoty == DevNodeCategory.AioModule)
            {
                fm.Category      = FormSetModuleChnCount.ModuleCategory.Aio;
                fm.ChannelCount1 = mgr.GetAiChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                fm.ChannelCount2 = mgr.GetAoChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex);
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    mgr.SetAiChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex, fm.ChannelCount1);
                    mgr.SetAoChannelCount(nodeInfo.DevID, nodeInfo.ModuleIndex, fm.ChannelCount2);
                    _UpdateChannelNode(currNode);// _UpdateCfg2UI();
                }
            }
        }
Example #4
0
        /// <summary>
        /// 更新控制卡的模块数量信息
        /// </summary>
        /// <param name="nodeModule"></param>
        void _UpdateModuleNode(TreeNode nodeModule)
        {
            JFDevCellNameManeger mgr      = JFHubCenter.Instance.MDCellNameMgr;
            DevNodeInfo          nodeInfo = nodeModule.Tag as DevNodeInfo;

            if (nodeInfo.Categoty == DevNodeCategory.MotionDaqDev) //更新运动控制设备节点
            {
                nodeModule.Nodes.Clear();
                int motionModuleCount = mgr.GetAxisModuleCount(nodeInfo.DevID);//轴模块
                if (motionModuleCount > 0)
                {
                    TreeNode motionsNode = new TreeNode("轴模块");
                    motionsNode.Tag = new DevNodeInfo(nodeInfo.DevID, DevNodeCategory.Module, 0);
                    nodeModule.Nodes.Add(motionsNode);
                    for (int i = 0; i < motionModuleCount; i++)
                    {
                        TreeNode motionNode = new TreeNode("序号_" + i + ",轴数:" + mgr.GetAxisCount(nodeInfo.DevID, i));
                        motionNode.Tag = new DevNodeInfo(nodeInfo.DevID, DevNodeCategory.MotionModule, i);
                        motionsNode.Nodes.Add(motionNode);
                        motionNode.ContextMenuStrip = contextMenuModule;
                    }
                }
                int dioModuleCount = mgr.GetDioModuleCount(nodeInfo.DevID);//数字IO模块
                if (dioModuleCount > 0)
                {
                    TreeNode diosNode = new TreeNode("Dio模块");
                    diosNode.Tag = new DevNodeInfo(nodeInfo.DevID, DevNodeCategory.Module, 0);
                    nodeModule.Nodes.Add(diosNode);
                    for (int i = 0; i < dioModuleCount; i++)
                    {
                        TreeNode dioNode = new TreeNode("序号_" + i + ",DI数:" + mgr.GetDiChannelCount(nodeInfo.DevID, i) + ",DO数:" + mgr.GetDoChannelCount(nodeInfo.DevID, i));
                        dioNode.Tag = new DevNodeInfo(nodeInfo.DevID, DevNodeCategory.DioModule, i);
                        diosNode.Nodes.Add(dioNode);
                        dioNode.ContextMenuStrip = contextMenuModule;
                    }
                }
                int trigModuleCount = mgr.GetCmpTrigModuleCount(nodeInfo.DevID);//位置比较触发
                if (trigModuleCount > 0)
                {
                    TreeNode trigsNode = new TreeNode("位置比较触发模块");
                    trigsNode.Tag = new DevNodeInfo(nodeInfo.DevID, DevNodeCategory.Module, 0);
                    nodeModule.Nodes.Add(trigsNode);
                    for (int i = 0; i < trigModuleCount; i++)
                    {
                        TreeNode trigNode = new TreeNode("序号_" + i + ",通道数:" + mgr.GetCmpTrigCount(nodeInfo.DevID, i));
                        trigNode.Tag = new DevNodeInfo(nodeInfo.DevID, DevNodeCategory.CmpTrigModule, i);
                        trigsNode.Nodes.Add(trigNode);
                        trigNode.ContextMenuStrip = contextMenuModule;
                    }
                }
                int aioModuleCount = mgr.GetAioModuleCount(nodeInfo.DevID);
                if (aioModuleCount > 0)
                {
                    TreeNode aiosNode = new TreeNode("Aio模块");
                    aiosNode.Tag = new DevNodeInfo(nodeInfo.DevID, DevNodeCategory.Module, 0);
                    nodeModule.Nodes.Add(aiosNode);
                    for (int i = 0; i < aioModuleCount; i++)
                    {
                        TreeNode aioNode = new TreeNode("序号_" + i + ",AI数:" + mgr.GetAiChannelCount(nodeInfo.DevID, i) + ",AO数:" + mgr.GetAoChannelCount(nodeInfo.DevID, i));
                        aioNode.Tag = new DevNodeInfo(nodeInfo.DevID, DevNodeCategory.AioModule, i);
                        aiosNode.Nodes.Add(aioNode);
                        aioNode.ContextMenuStrip = contextMenuModule;
                    }
                }
            }
            else if (nodeInfo.Categoty == DevNodeCategory.LightCtrlTDev) //光源控制器设备节点
            {
                ucLightCtrlNames.UpdateChannelsInfo(nodeInfo.DevID);
            }
            else if (nodeInfo.Categoty == DevNodeCategory.TrigCtrlDev) //触发控制器设备节点
            {
                ucTrigCtrlNames.UpdateChannelsInfo(nodeInfo.DevID);
            }
        }