Exemplo n.º 1
0
//             public LineDevice.CNC m_cnc;
            public override bool GatherData(ChannelData chData, short clientNo)
            {
                int ret     = 0;
                int partNum = 0;

                ret = CollectShare.Instance().HNC_ChannelGetValue((int)HncChannel.HNC_CHAN_PART_CNTR, chData.chNo, 0, ref partNum, clientNo);
                if (ret == 0)
                {
//                     if (chData.partNum != partNum && m_cnc != null && m_cnc.CNCchanDataEventHandler != null)
//                     {
//                         int[] senddata = new int[2];
//                         senddata[0] = (int)LineDevice.CNC.CNCchanDataEventType.CNCReport;
//                         senddata[1] = partNum;
//                         m_cnc.CNCchanDataEventHandler.BeginInvoke(this, senddata, null, null);
//                     }
                    chData.partNum = partNum;
                }
                else
                {
                    SCADA.LogData.EventHandlerSendParm SendParm = new SCADA.LogData.EventHandlerSendParm();
                    SendParm.Node1NameIndex = (int)SCADA.LogData.Node1Name.Equipment_CNC;
                    SendParm.LevelIndex     = (int)SCADA.LogData.Node2Level.MESSAGE;
                    SendParm.EventID        = ((int)SCADA.LogData.Node2Level.MESSAGE).ToString();
                    SendParm.Keywords       = "NCN采集数据失败";
                    SendParm.EventData      = clientNo.ToString() + "  采集加工完成数失败!";
                    SCADA.MainForm.m_Log.AddLogMsgHandler.BeginInvoke(this, SendParm, null, null);
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 2
0
        /// <summary>
        /// 获取轴号掩码
        /// </summary>
        /// <param name="clientNo"></param>
        /// <returns></returns>
        private Int32 GetClientAxMask(Int16 clientNo)
        {
            Int32 mask = 0;

            Int32 axisMask = 0;
            Int32 chNo     = 0;
            Int32 chanNum  = 0;
            Int32 ret      = 0;

            ret = CollectShare.Instance().HNC_SystemGetValue((int)HncSystem.HNC_SYS_CHAN_NUM, ref chanNum, clientNo);
            if (ret != 0)
            {
                return(mask);
            }

            for (chNo = 0; chNo < chanNum; chNo++)
            {
                ret = CollectShare.Instance().HNC_ChannelGetValue((int)HncChannel.HNC_CHAN_AXES_MASK, chNo, 0, ref axisMask, clientNo);
                if (ret == 0)
                {
                    mask |= axisMask;
                }
            }

            return(mask);
        }
Exemplo n.º 3
0
            public override bool GatherData(ChannelData chData, short clientNo)
            {
                int    ret       = 0;
                Double spdlSpeed = 0;

                ret = CollectShare.Instance().HNC_ChannelGetValue((int)HncChannel.HNC_CHAN_ACT_SPDL_SPEED, chData.chNo, 0, ref spdlSpeed, clientNo);
                if (ret == 0)
                {
                    chData.spdlSpeed = spdlSpeed;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 4
0
            public override bool GatherData(ChannelData chData, short clientNo)
            {
                int ret     = 0;
                int toolUse = 0;

                ret = CollectShare.Instance().HNC_ChannelGetValue((int)HncChannel.HNC_CHAN_TOOL_USE, chData.chNo, 0, ref toolUse, clientNo);
                if (ret == 0)
                {
                    chData.toolUse = toolUse;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 5
0
            public override bool GatherData(AxisData axdata, short clientNo)
            {
                int ret      = 0;
                int axisType = 0;

                ret = CollectShare.Instance().HNC_AxisGetValue((int)HncAxis.HNC_AXIS_TYPE, axdata.axisNo, ref axisType, clientNo);
                if (ret == 0)
                {
                    axdata.axisType = axisType;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 6
0
            public override bool GatherData(ChannelData chData, short clientNo)
            {
                int    ret       = 0;
                string gCodeName = "";

                ret = CollectShare.Instance().HNC_FprogGetFullName(chData.chNo, ref gCodeName, clientNo);
                if (ret == 0)
                {
                    chData.gCodeName = gCodeName;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 7
0
            public override bool GatherData(AxisData axdata, short clientNo)
            {
                int    ret    = 0;
                string drvVer = "";

                ret = CollectShare.Instance().HNC_AxisGetValue((int)HncAxis.HNC_AXIS_DRIVE_VER, axdata.axisNo, ref drvVer, clientNo);
                if (ret == 0)
                {
                    axdata.drvVer = drvVer;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 8
0
            public override bool GatherData(ChannelData chData, short clientNo)
            {
                int ret        = 0;
                int isReseting = 0;

                ret = CollectShare.Instance().HNC_ChannelGetValue((int)HncChannel.HNC_CHAN_IS_RESETTING, chData.chNo, 0, ref isReseting, clientNo);
                if (ret == 0)
                {
                    chData.isReseting = isReseting;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 9
0
            public override bool GatherData(ChannelData chData, short clientNo)
            {
                int ret     = 0;
                int runLine = 0;

                ret = CollectShare.Instance().HNC_ChannelGetValue((int)HncChannel.HNC_CHAN_RUN_ROW, chData.chNo, 0, ref runLine, clientNo);
                if (ret == 0)
                {
                    chData.runLine = runLine;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 10
0
            public override bool GatherData(ChannelData chData, short clientNo)
            {
                int ret      = 0;
                int axisMask = 0;

                ret = CollectShare.Instance().HNC_ChannelGetValue((int)HncChannel.HNC_CHAN_AXES_MASK, chData.chNo, 0, ref axisMask, clientNo);
                if (ret == 0)
                {
                    chData.axisMask = axisMask;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 11
0
            public override bool GatherData(ChannelData chData, short clientNo)
            {
                int ret       = 0;
                int isProgEnd = 0;

                ret = CollectShare.Instance().HNC_ChannelGetValue((int)HncChannel.HNC_CHAN_IS_PROGEND, chData.chNo, 0, ref isProgEnd, clientNo);
                if (ret == 0)
                {
                    chData.isProgEnd = isProgEnd;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 12
0
            public override bool GatherData(ChannelData chData, short clientNo)
            {
                int ret     = 0;
                int macType = 0;

                ret = CollectShare.Instance().HNC_ChannelGetValue((int)HncChannel.HNC_CHAN_MAC_TYPE, chData.chNo, 0, ref macType, clientNo);
                if (ret == 0)
                {
                    chData.macType = macType;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 13
0
            public override bool GatherData(ChannelData chData, short clientNo)
            {
                int    ret     = 0;
                Double TOOL_NO = 0;

                ret = CollectShare.Instance().HNC_ToolGetToolPara(chData.toolUse, (int)ToolParaIndex.INFTOOL_ID, ref TOOL_NO, clientNo);
                if (ret == 0)
                {
                    chData.TOOL_NO = (long)TOOL_NO;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 14
0
            public override bool GatherData(AxisData axdata, short clientNo)
            {
                int    ret         = 0;
                double loadCurrent = 0;

                ret = CollectShare.Instance().HNC_AxisGetValue((int)HncAxis.HNC_AXIS_LOAD_CUR, axdata.axisNo, ref loadCurrent, clientNo);
                if (ret == 0)
                {
                    axdata.loadCurrent = loadCurrent;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 15
0
            public override bool GatherData(ChannelData chData, short clientNo)
            {
                int    ret    = 0;
                string chName = "";

                ret = CollectShare.Instance().HNC_ChannelGetValue((int)HncChannel.HNC_CHAN_NAME, chData.chNo, 0, ref chName, clientNo);
                if (ret == 0)
                {
                    chData.chName = chName;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 16
0
            public override bool GatherData(AxisData axdata, short clientNo)
            {
                Int32 ret = 0;

                ret = CollectShare.Instance().HNC_AxisGetValue((int)HncAxis.HNC_AXIS_FOLLOW_ERR, axdata.axisNo, ref axdata.followErr, clientNo);
                if (ret != 0)
                {
                    return(false);
                }

                return(true);
            }
Exemplo n.º 17
0
            public override bool GatherData(ChannelData chData, short clientNo)
            {
                int    ret         = 0;
                double actFeedrate = 0;

                ret = CollectShare.Instance().HNC_ChannelGetValue((int)HncChannel.HNC_CHAN_ACT_FEEDRATE, chData.chNo, 0, ref actFeedrate, clientNo);
                if (ret == 0)
                {
                    chData.actFeedrate = actFeedrate;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 18
0
            public override bool GatherData(ChannelData chData, short clientNo)
            {
                int ret          = 0;
                int feedOverride = 0;

                ret = CollectShare.Instance().HNC_ChannelGetValue((int)HncChannel.HNC_CHAN_FEED_OVERRIDE, chData.chNo, 0, ref feedOverride, clientNo);
                if (ret == 0)
                {
                    chData.feedOverride = feedOverride;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 19
0
            public override bool GatherData(SystemData sysdata)
            {
                short clientNo = sysdata.clientNo;
                int   ret      = 0;
                Addr  addr     = new Addr();

                ret = CollectShare.Instance().HNC_NetGetIpaddr(ref addr.ip, ref addr.port, clientNo);
                if (ret == 0)
                {
                    sysdata.addr = addr;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 20
0
            public override bool GatherData(SystemData sysdata)
            {
                short clientNo = sysdata.clientNo;
                int   ret      = 0;
                int   moveUnit = 0;

                ret = CollectShare.Instance().HNC_SystemGetValue((int)HncSystem.HNC_SYS_MOVE_UNIT, ref moveUnit, clientNo);
                if (ret == 0)
                {
                    sysdata.moveUnit = moveUnit;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 21
0
            public override bool GatherData(SystemData sysdata)
            {
                short clientNo    = sysdata.clientNo;
                int   ret         = 0;
                int   accessLevel = 0;

                ret = CollectShare.Instance().HNC_SystemGetValue((int)HncSystem.HNC_SYS_ACCESS_LEVEL, ref accessLevel, clientNo);
                if (ret == 0)
                {
                    sysdata.accessLevel = accessLevel;
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 22
0
            public override bool GatherData(AxisData axdata, short clientNo)
            {
                Int32 ret = 0;
                Int32 pos = 0;

                ret = CollectShare.Instance().HNC_AxisGetValue((int)HncAxis.HNC_AXIS_ACT_POS, axdata.axisNo, ref pos, clientNo);
                if (ret != 0)
                {
                    return(false);
                }
                axdata.actPos = (Double)pos;
                return(true);
            }
Exemplo n.º 23
0
            public override bool GatherData(AxisData axdata, short clientNo)
            {
                Int32       ret             = 0;
                const Int32 PAR_AX_PM_PULSE = 5;// 坐标轴参数

                ret = CollectShare.Instance().HNC_ParamanGetI32((Int32)HNCDATADEF.PARAMAN_FILE_AXIS, axdata.axisNo, PAR_AX_PM_PULSE, ref axdata.pulse, clientNo);
                if (ret != 0)
                {
                    return(false);
                }

                return(ret == 0 ? true : false);
            }
Exemplo n.º 24
0
            public override bool GatherData(SystemData sysdata)
            {
                short  clientNo = sysdata.clientNo;
                int    ret      = 0;
                string macSN    = "";

                ret = CollectShare.Instance().HNC_SystemGetValue((int)HncSystem.HNC_SYS_SN_NUM, ref macSN, clientNo);
                if (ret == 0)
                {
                    sysdata.macSN = macSN;
                    if (macSN.Length == 0)
                    {
                        ret = -1;
                    }
                }
                return(ret == 0 ? true : false);
            }
Exemplo n.º 25
0
            public override bool GatherData(SystemData sysdata)
            {
                short  clientNo = sysdata.clientNo;
                int    ret      = 0;
                SysVer sysver   = new SysVer();

                ret += CollectShare.Instance().HNC_SystemGetValue((int)HncSystem.HNC_SYS_NCK_VER, ref sysver.ncu, clientNo);
                ret += CollectShare.Instance().HNC_SystemGetValue((int)HncSystem.HNC_SYS_DRV_VER, ref sysver.drv, clientNo);
                ret += CollectShare.Instance().HNC_SystemGetValue((int)HncSystem.HNC_SYS_PLC_VER, ref sysver.plc, clientNo);
                ret += CollectShare.Instance().HNC_SystemGetValue((int)HncSystem.HNC_SYS_CNC_VER, ref sysver.cnc, clientNo);
                ret += CollectShare.Instance().HNC_SystemGetValue((int)HncSystem.HNC_SYS_NC_VER, ref sysver.nc, clientNo);
                if (ret == 0)
                {
                    sysdata.sysver = sysver;
                }

                return(ret == 0 ? true : false);
            }
Exemplo n.º 26
0
        /// <summary>
        /// 获取通道掩码
        /// </summary>
        /// <param name="clientNo"></param>
        /// <returns></returns>
        private Int32 GetClientChMask(Int16 clientNo)
        {
            Int32 mask = 0;

            Int32 ret         = 0;
            Int32 ch          = 0;
            Int32 chanIsExist = 0;

            for (ch = 0; ch < HNCDATADEF.SYS_CHAN_NUM; ch++)
            {
                ret = CollectShare.Instance().HNC_ChannelGetValue((int)HncChannel.HNC_CHAN_IS_EXIST, ch, 0, ref chanIsExist, clientNo);
                if ((chanIsExist == 1) && (ret == 0))
                {
                    mask |= (1 << ch);
                }
            }

            return(mask);
        }
Exemplo n.º 27
0
        public void DataCollectThread()
        {
            int iiiii = 0;

            while (bCollect)
            {
                if (threaFucRuningF_OK)
                {
                    string macSN = "";
                    if (CollectShare.Instance().HNC_SystemGetValue((int)HncSystem.HNC_SYS_SN_NUM, ref macSN, hncdata.sysData.clientNo) == 0)
                    {
                        iiiii = 0;
                        if (macSN != hncdata.sysData.macSN)
                        {
                            hncdata.sysData.isConnect = false;
                            threaFucRuningF_OK        = false;
                            CollectShare.threaFucEvent.Set();

                            if (m_cnc.CNCchanDataEventHandler != null)
                            {
                                int[] senddata = new int[2];
                                senddata[0] = (int)LineDevice.CNC.CNCchanDataEventType.CNCStateChage;
                                senddata[1] = (int)LineDevice.CNC.CNCState.DISCON;
                                m_cnc.CNCchanDataEventHandler.BeginInvoke(this, senddata, null, null);
                            }

                            SCADA.LogData.EventHandlerSendParm SendParm = new SCADA.LogData.EventHandlerSendParm();
                            SendParm.Node1NameIndex = (int)SCADA.LogData.Node1Name.Equipment_CNC;
                            SendParm.LevelIndex     = (int)SCADA.LogData.Node2Level.MESSAGE;
                            SendParm.EventID        = ((int)SCADA.LogData.Node2Level.MESSAGE).ToString();
                            SendParm.Keywords       = "CNC采集器关闭";
                            SendParm.EventData      = hncdata.sysData.addr.ip + ":本次获取SN=" + macSN + ";上周期SN=" + hncdata.sysData.macSN;
                            SCADA.MainForm.m_Log.AddLogMsgHandler.BeginInvoke(this, SendParm, null, null);
                        }
                    }
                    else
                    {
                        iiiii++;
                        if (iiiii >= 10)
                        {
                            hncdata.sysData.isConnect = false;
                            threaFucRuningF_OK        = false;
                            CollectShare.threaFucEvent.Set();

                            if (m_cnc.CNCchanDataEventHandler != null)
                            {
                                int[] senddata = new int[2];
                                senddata[0] = (int)LineDevice.CNC.CNCchanDataEventType.CNCStateChage;
                                senddata[1] = (int)LineDevice.CNC.CNCState.DISCON;
                                m_cnc.CNCchanDataEventHandler.BeginInvoke(this, senddata, null, null);
                            }

                            SCADA.LogData.EventHandlerSendParm SendParm = new SCADA.LogData.EventHandlerSendParm();
                            SendParm.Node1NameIndex = (int)SCADA.LogData.Node1Name.Equipment_CNC;
                            SendParm.LevelIndex     = (int)SCADA.LogData.Node2Level.MESSAGE;
                            SendParm.EventID        = ((int)SCADA.LogData.Node2Level.MESSAGE).ToString();
                            SendParm.Keywords       = "CNC采集器关闭";
                            SendParm.EventData      = hncdata.sysData.addr.ip + ":累计连续10次调用网络接口失败!";
                            SCADA.MainForm.m_Log.AddLogMsgHandler.BeginInvoke(this, SendParm, null, null);
                        }
                    }
                    GatherData();

                    LineDevice.CNC.CNCState CNCStatei = LineDevice.CNC.CNCState.DISCON;
                    if (m_cnc != null && m_cnc.Checkcnc_state(ref CNCStatei) && m_cnc.CNCchanDataEventHandler != null)
                    {
                        int[] senddata = new int[2];
                        senddata[0] = (int)LineDevice.CNC.CNCchanDataEventType.CNCStateChage;
                        senddata[1] = (int)CNCStatei;
                        m_cnc.CNCchanDataEventHandler.BeginInvoke(this, senddata, null, null);
                    }
                    if (m_cnc != null && baogongold != m_cnc.HCNCShareData.chanDataLst[m_cnc.NC8_chang].partNum && m_cnc.CNCchanDataEventHandler != null)
                    {
                        int[] senddata = new int[2];
                        senddata[0] = (int)LineDevice.CNC.CNCchanDataEventType.CNCReport;
                        senddata[1] = m_cnc.HCNCShareData.chanDataLst[m_cnc.NC8_chang].partNum;
                        m_cnc.CNCchanDataEventHandler.BeginInvoke(this, senddata, null, null);
                        baogongold = m_cnc.HCNCShareData.chanDataLst[m_cnc.NC8_chang].partNum;
                    }

                    System.Threading.Thread.Sleep(50);
                }
                else
                {
                    Get_Reg_threaFucEvent.WaitOne();
                    iiiii = 0;
                }
            }
        }