예제 #1
0
        /// <summary>
        /// strDevName device subnet id and device id
        /// </summary>
        /// <param name="strDevName"></param>
        public override void DownLoadInformationFrmDevice(string strDevName, int intDeviceType, int intActivePage, int num1, int num2)// 0 mean all, else that tab only
        {
            Boolean BlnIsSuccess = false;

            if (strDevName == null)
            {
                return;
            }
            string strMainRemark = strDevName.Split('\\')[1].Trim();

            DeviceName = strDevName.Split('\\')[0].Trim();

            byte bytSubID = byte.Parse(DeviceName.Split('-')[0].ToString());
            byte bytDevID = byte.Parse(DeviceName.Split('-')[1].ToString());

            byte[] ArayTmp = null;

            base.DownLoadInformationFrmDevice(strDevName, intDeviceType, intActivePage, 0, 0);

            // 读取回路信息
            Chans = new BasicCurtain();
            Chans.ReadCurtainSetupInformation(bytSubID, bytDevID, 1, intDeviceType);
            MyRead2UpFlags[0] = true;
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(100, null);
            }
            BlnIsSuccess = true;
            return;
        }
예제 #2
0
파일: Curtain.cs 프로젝트: Test0222/Test02
        //<summary>
        //读取数据库面板设置,将所有数据读至缓存
        //</summary>
        public void ReadCurtainFrmDBTobuf(int intDIndex)
        {
            try
            {
                #region
                string          strsql = string.Format("select * from dbClassInfomation where DIndex={0} and ClassID={1} order by SenNum", DIndex, 0);
                OleDbDataReader dr     = DataModule.SearchAResultSQLDB(strsql, CsConst.mstrCurPath);
                if (dr != null)
                {
                    while (dr.Read())
                    {
                        string str = dr.GetValue(5).ToString();
                        bytCurType     = Convert.ToByte(str.Split('-')[0].ToString());
                        intJogTime     = Convert.ToByte(str.Split('-')[1].ToString());
                        intJogTime1    = Convert.ToByte(str.Split('-')[2].ToString());
                        bytInvert      = Convert.ToByte(str.Split('-')[3].ToString());
                        bytAutoMeasure = Convert.ToByte(str.Split('-')[4].ToString());
                        bytDragMode    = Convert.ToByte(str.Split('-')[5].ToString());
                        intDragLong    = Convert.ToByte(str.Split('-')[6].ToString());
                        intDragShort   = Convert.ToByte(str.Split('-')[7].ToString());
                        intDragSafe    = Convert.ToByte(str.Split('-')[8].ToString());
                    }
                    dr.Close();
                }
                #endregion

                #region
                Curtains = new List <BasicCurtain>();
                strsql   = string.Format("select * from dbClassInfomation where DIndex={0} and ClassID={1} order by SenNum", DIndex, 1);
                dr       = DataModule.SearchAResultSQLDB(strsql, CsConst.mstrCurPath);
                if (dr != null)
                {
                    while (dr.Read())
                    {
                        BasicCurtain temp = new BasicCurtain();
                        string       str  = dr.GetValue(5).ToString();
                        temp.runTime  = Convert.ToByte(str.Split('-')[0].ToString());
                        temp.onDelay  = Convert.ToByte(str.Split('-')[1].ToString());
                        temp.offDelay = Convert.ToByte(str.Split('-')[2].ToString());
                        temp.remark   = dr.GetValue(4).ToString();
                        Curtains.Add(temp);
                    }
                    dr.Close();
                }
                #endregion
            }
            catch
            {
            }
        }
예제 #3
0
파일: Curtain.cs 프로젝트: Test0222/Test02
        //<summary>
        //保存数据库面板设置,将所有数据保存
        //</summary>
        public void SaveCurtainToDB()
        {
            try
            {
                #region
                string strsql = string.Format("delete * from dbClassInfomation where DIndex={0}", DIndex);
                DataModule.ExecuteSQLDatabase(strsql);

                string strDeviceRemark = "";
                if (DeviceName.Contains("\\"))
                {
                    strDeviceRemark = DeviceName.Split('\\')[1].ToString();
                }
                string strParam = bytCurType.ToString() + "-" + intJogTime.ToString()
                                  + "-" + intJogTime1.ToString() + "-" + bytInvert.ToString()
                                  + "-" + bytAutoMeasure.ToString() + "-" + bytDragMode.ToString()
                                  + "-" + intDragLong.ToString() + "-" + intDragShort.ToString()
                                  + "-" + intDragSafe.ToString();
                strsql = string.Format("Insert into dbClassInfomation(DIndex,ClassID,ObjectID,SenNum,Remark,strParam1) values ({0},{1},{2},{3},'{4}','{5}')",
                                       DIndex, 0, 0, 0, strDeviceRemark, strParam);
                DataModule.ExecuteSQLDatabase(strsql);
                #endregion

                #region
                if (Curtains != null)
                {
                    for (int i = 0; i < Curtains.Count; i++)
                    {
                        BasicCurtain temp = Curtains[i];
                        strParam = temp.runTime.ToString() + "-" + temp.onDelay.ToString()
                                   + "-" + temp.offDelay.ToString();
                        strsql = string.Format("Insert into dbClassInfomation(DIndex,ClassID,ObjectID,SenNum,Remark,strParam1) values ({0},{1},{2},{3},'{4}','{5}')",
                                               DIndex, 1, 0, 0, temp.remark, strParam);
                        DataModule.ExecuteSQLDatabase(strsql);
                    }
                }
                #endregion
            }
            catch
            {
            }
        }
예제 #4
0
        //<summary>
        //读取数据库面板设置,将所有数据读至缓存
        //</summary>
        public override void ReadMS04FrmDBTobuf(int DIndex, int wdMaxValue)
        {
            base.ReadMS04FrmDBTobuf(DIndex, wdMaxValue);

            Chans = new BasicCurtain();
            #region
            String          strsql = string.Format("select * from dbClassInfomation where DIndex={0} and ClassID={1} order by SenNum", DIndex, 1);
            OleDbDataReader dr     = DataModule.SearchAResultSQLDB(strsql, CsConst.mstrCurPath);
            if (dr != null)
            {
                while (dr.Read())
                {
                    string str = dr.GetValue(5).ToString();
                    Chans.runTime  = Convert.ToByte(str.Split('-')[0].ToString());
                    Chans.onDelay  = Convert.ToByte(str.Split('-')[1].ToString());
                    Chans.offDelay = Convert.ToByte(str.Split('-')[2].ToString());
                    Chans.remark   = dr.GetValue(4).ToString();
                }
                dr.Close();
            }
            #endregion
        }
예제 #5
0
        internal BasicCurtain Chans; //12个回路

        //<summary>
        //读取默认的MHIOU设置,将所有数据读取缓存
        //</summary>
        public override void ReadDefaultInfo(int intDeviceType)
        {
            base.ReadDefaultInfo(intDeviceType);

            Chans = new BasicCurtain();
        }
예제 #6
0
파일: Curtain.cs 프로젝트: Test0222/Test02
        /// <summary>
        /// devname device name
        /// </summary>
        /// <param name="DevName"></param>
        public void DownLoadInformationFrmDevice(string DevName, int wdDeviceType)
        {
            string strMainRemark = DevName.Split('\\')[1].Trim();

            DevName = DevName.Split('\\')[0].Trim();

            //保存basic informations网络信息
            byte bytSubID = byte.Parse(DevName.Split('-')[0].ToString());
            byte bytDevID = byte.Parse(DevName.Split('-')[1].ToString());

            byte[] ArayTmp = new byte[0];
            DeviceName = bytSubID.ToString() + "-" + bytDevID.ToString() + "\\" + HDLSysPF.ReadDeviceMainRemark(bytSubID, bytDevID);
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(5, null);
            }

            int MaxValue = DeviceTypeList.GetMaxValueFromPublicModeGroup(wdDeviceType);

            ArayTmp  = new byte[1];
            Curtains = new List <BasicCurtain>();
            // read curtain paramters
            #region
            if (CurtainDeviceType.NormalCurtainG1DeviceType.Contains(wdDeviceType) || CurtainDeviceType.CurtainG2DeviceType.Contains(wdDeviceType))
            {
                for (byte bytI = 1; bytI <= MaxValue * 2; bytI++)
                {
                    ArayTmp[0] = bytI;
                    BasicCurtain oTmp = new BasicCurtain();
                    oTmp.ReadCurtainSetupInformation(bytSubID, bytDevID, bytI, wdDeviceType);
                    Curtains.Add(oTmp);
                    if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                    {
                        CsConst.calculationWorker.ReportProgress(bytI * 45 / MaxValue, null);
                    }
                }
            }
            #endregion
            // read joggle time
            if (CurtainDeviceType.CurtainG2DeviceType.Contains(wdDeviceType))
            {
                bytCurType = 1;
            }
            else if (CurtainDeviceType.RollerCurtainDeviceType.Contains(wdDeviceType))
            {
                bytCurType = 2;
            }
            else if (CurtainDeviceType.NormalMotorCurtainDeviceType.Contains(wdDeviceType))
            {
                bytCurType = 2;
            }

            if (bytCurType == 1)
            {
                for (byte bytI = 1; bytI <= 4; bytI++)
                {
                    ArayTmp[0] = bytI;
                    BasicCurtain oTmp = new BasicCurtain();
                    if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1C76, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(wdDeviceType)) == true)
                    {
                        switch (bytI)
                        {
                        case 1: intJogTime = CsConst.myRevBuf[26] * 256 + CsConst.myRevBuf[27]; break;

                        case 2: intJogTime1 = CsConst.myRevBuf[26] * 256 + CsConst.myRevBuf[27]; break;

                        case 3: intJogTime2 = CsConst.myRevBuf[26] * 256 + CsConst.myRevBuf[27]; break;

                        case 4: intJogTime3 = CsConst.myRevBuf[26] * 256 + CsConst.myRevBuf[27]; break;
                        }
                        CsConst.myRevBuf = new byte[1200];
                    }
                    else
                    {
                        return;
                    }
                    if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                    {
                        CsConst.calculationWorker.ReportProgress(80 + bytI, null);
                    }
                }
            }
            else if (bytCurType == 2)
            {
                if (CsConst.mySends.AddBufToSndList(ArayTmp, 0x1F02, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(wdDeviceType)) == true)
                {
                    bytInvert      = CsConst.myRevBuf[25]; // forward and backwork   or Backward forward
                    bytAutoMeasure = CsConst.myRevBuf[26]; // 上电自动测速
                    bytDragMode    = CsConst.myRevBuf[27]; // 0 : no action, 1 long drag ; 2 short drag
                    intDragLong    = (CsConst.myRevBuf[28] * 256 + CsConst.myRevBuf[29]) / 100;
                    intDragShort   = (CsConst.myRevBuf[30] * 256 + CsConst.myRevBuf[31]) / 100;
                    intDragSafe    = (CsConst.myRevBuf[32] * 256 + CsConst.myRevBuf[33]) / 100;
                }
                else
                {
                    return;
                }
                CsConst.myRevBuf = new byte[1200];
                if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                {
                    CsConst.calculationWorker.ReportProgress(95, null);
                }
            }
            MyRead2UpFlags[0] = true;
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(100, null);
            }
        }