Пример #1
0
        //public void timeStart()
        //{
        //    timerRead.Start();
        //}

        //public void timeStop()
        //{
        //    timerRead.Stop();
        //}

        public bool SetAnt(DeviceUsing ant1, DeviceUsing ant2, DeviceUsing ant3, DeviceUsing ant4)
        {
            bool blRet = false;

            try
            {
                byte ANT = 0;
                if (ant1 == DeviceUsing.启用)
                {
                    ANT = Convert.ToByte(ANT | 1);
                }
                if (ant2 == DeviceUsing.启用)
                {
                    ANT = Convert.ToByte(ANT | 2);
                }
                if (ant3 == DeviceUsing.启用)
                {
                    ANT = Convert.ToByte(ANT | 4);
                }
                if (ant4 == DeviceUsing.启用)
                {
                    ANT = Convert.ToByte(ANT | 8);
                }
                int iRet = StaticClassReaderB.SetAntennaMultiplexing(ref fComAdr, ANT, frmcomportindex);
                if (iRet == 0)
                {
                    blRet = true;
                }
                else
                {
                    blRet = false;
                }
            }
            catch (Exception ex)
            {
                if (frmMain.blDebug)
                {
                    MessageUtil.ShowTips(ex.Message);
                }
            }
            return(blRet);
        }
Пример #2
0
        private void frmPowerManage_Load(object sender, EventArgs e)
        {
            usingWg = frmMain.UsingDoor;
            if (wgControl == null)
            {
                wgControl = new clsWgInfo();
            }
            LoadWgInfo();


            xtraTabControl1.SelectedTabPage = xtraTabPage1;
            AddTreeView("0", (TreeNode)null);
            treeView1.ExpandAll();

            TableInit(dtQueryPower);
            TableInit(dtAddPower);
            TableInit(dtDeletePower);

            ShowDtQuery();
        }
Пример #3
0
        private void sbtnOk_Click(object sender, EventArgs e)
        {
            #region 门禁

            #region IC门禁

            DeviceUsing usingIc     = DeviceUsing.未启用;
            string      ofRfidDoor1 = DeviceUsing.未启用.ToString();
            string      ofRfidDoor2 = DeviceUsing.未启用.ToString();
            string      ofRfidDoor3 = DeviceUsing.未启用.ToString();
            string      ofRfidDoor4 = DeviceUsing.未启用.ToString();
            if (cboxOfRfid1.Checked)
            {
                ofRfidDoor1 = DeviceUsing.启用.ToString();
            }
            if (cboxOfRfid2.Checked)
            {
                ofRfidDoor2 = DeviceUsing.启用.ToString();
            }
            if (cboxOfRfid3.Checked)
            {
                ofRfidDoor3 = DeviceUsing.启用.ToString();
            }
            if (cboxOfRfid4.Checked)
            {
                ofRfidDoor4 = DeviceUsing.启用.ToString();
            }

            string strIcSn      = tbDoorSn.Text.Trim();
            string strIcIp      = tbDoorIP.Text.Trim();
            string strIcPort    = tbPortWg.Text.Trim();
            string strNameDoor1 = "";
            string strNameDoor2 = "";
            string strNameDoor3 = "";
            string strNameDoor4 = "";
            if (cboxName1.Checked)
            {
                strNameDoor1 = tbDoorName1.Text.Trim();
            }
            if (cboxName2.Checked)
            {
                strNameDoor2 = tbDoorName2.Text.Trim();
            }
            if (cboxName3.Checked)
            {
                strNameDoor3 = tbDoorName3.Text.Trim();
            }
            if (cboxName4.Checked)
            {
                strNameDoor4 = tbDoorName4.Text.Trim();
            }

            if (cboxIc.Checked)
            {
                usingIc = DeviceUsing.启用;

                if (string.IsNullOrEmpty(strIcSn))
                {
                    MessageUtil.ShowTips("IC门禁 SN不可为空");
                    return;
                }
                if (string.IsNullOrEmpty(strIcIp))
                {
                    MessageUtil.ShowTips("IC门禁 IP不可为空");
                    return;
                }
                if (string.IsNullOrEmpty(strIcPort))
                {
                    MessageUtil.ShowTips("IC门禁 端口号 不可为空");
                    return;
                }
                if (cboxName1.Checked)
                {
                    if (string.IsNullOrEmpty(strNameDoor1))
                    {
                        MessageUtil.ShowTips("IC门禁 1#门名称不可为空");
                        return;
                    }
                }
                if (cboxName2.Checked)
                {
                    if (string.IsNullOrEmpty(strNameDoor2))
                    {
                        MessageUtil.ShowTips("IC门禁 2#门名称不可为空");
                        return;
                    }
                }
                if (cboxName3.Checked)
                {
                    if (string.IsNullOrEmpty(strNameDoor3))
                    {
                        MessageUtil.ShowTips("IC门禁 3#门名称不可为空");
                        return;
                    }
                }
                if (cboxName4.Checked)
                {
                    if (string.IsNullOrEmpty(strNameDoor4))
                    {
                        MessageUtil.ShowTips("IC门禁 4#门名称不可为空");
                        return;
                    }
                }
            }

            #endregion

            #region  指纹 门禁

            DeviceUsing usingFinger = DeviceUsing.未启用;


            string ofRfidDoorFinger = DeviceUsing.未启用.ToString();
            if (cboxOfRfidFinger.Checked)
            {
                ofRfidDoorFinger = DeviceUsing.启用.ToString();
            }
            string strIpFinger   = tbIpFinger.Text.Trim();
            string strPortFinger = tbPortFinger.Text.Trim();
            string strNameFinger = tbDoorNameFinger.Text.Trim();
            if (cboxFinger.Checked)
            {
                usingFinger = DeviceUsing.启用;
                if (string.IsNullOrEmpty(strIpFinger))
                {
                    MessageUtil.ShowTips("请输入1#指纹门禁IP地址");
                    return;
                }
                if (string.IsNullOrEmpty(strPortFinger))
                {
                    MessageUtil.ShowTips("请输入1#指纹门禁端口号");
                    return;
                }
                if (string.IsNullOrEmpty(strNameFinger))
                {
                    MessageUtil.ShowTips("请输入1#指纹门禁门名称");
                    return;
                }
            }
            DeviceUsing usingFinger2      = DeviceUsing.未启用;
            string      ofRfidDoorFinger2 = DeviceUsing.未启用.ToString();
            if (cboxOfRfidFinger2.Checked)
            {
                ofRfidDoorFinger2 = DeviceUsing.启用.ToString();
            }
            string strIpFinger2   = tbIpFinger2.Text.Trim();
            string strProtFinger2 = tbPortFinger2.Text.Trim();
            string strNameFinger2 = tbDoorNameFinger2.Text.Trim();
            if (cboxFinger2.Checked)
            {
                usingFinger2 = DeviceUsing.启用;
                if (String.IsNullOrEmpty(strIpFinger2))
                {
                    MessageUtil.ShowTips("请输入2#指纹门禁IP地址");
                    return;
                }
                if (String.IsNullOrEmpty(strProtFinger2))
                {
                    MessageUtil.ShowTips("请输入2#指纹门禁端口号");
                    return;
                }
                if (String.IsNullOrEmpty(strNameFinger2))
                {
                    MessageUtil.ShowTips("请输入2#指纹门禁门名称");
                    return;
                }
            }

            #endregion

            #endregion

            #region  Rfid

            string strRfidIp1    = tbRfidIp1.Text.Trim();
            string strRfidIp2    = tbRfidIp2.Text.Trim();
            string strRfidPort1  = tbRfidPort1.Text.Trim();
            string strRfidPort2  = tbRfidPort2.Text.Trim();
            string strRfidUsing1 = "";
            string strRfidUsing2 = "";


            if (cboxRfid1.Checked)
            {
                if (string.IsNullOrEmpty(strRfidIp1))
                {
                    MessageUtil.ShowTips("RFID读写器1IP不可为空");
                    return;
                }
                if (string.IsNullOrEmpty(strRfidPort1))
                {
                    MessageUtil.ShowTips("RFID读写器1端口号不可为空");
                    return;
                }
                strRfidUsing1 = DeviceUsing.启用.ToString();
            }
            else
            {
                strRfidUsing1 = DeviceUsing.未启用.ToString();
            }
            if (cboxRfid2.Checked)
            {
                if (string.IsNullOrEmpty(strRfidIp2))
                {
                    MessageUtil.ShowTips("RFID读写器2IP不可为空");
                    return;
                }
                if (string.IsNullOrEmpty(strRfidPort2))
                {
                    MessageUtil.ShowTips("RFID读写器2端口号不可为空");
                    return;
                }
                strRfidUsing2 = DeviceUsing.启用.ToString();
            }
            else
            {
                strRfidUsing2 = DeviceUsing.未启用.ToString();
            }

            if (cboxRfid1.Checked && cboxRfid2.Checked)
            {
                if (strRfidIp1 == strRfidIp2)
                {
                    MessageUtil.ShowTips("RFID读写器IP不可相同");
                    return;
                }
                if (strRfidPort1 == strRfidPort2)
                {
                    MessageUtil.ShowTips("RFID读写器端口号不可相同");
                    return;
                }
            }

            #endregion

            #region  务上传

            string strUsingUp = "";
            string strAddr    = tbAddr.Text.Trim();
            if (cboxUp.Checked)
            {
                strUsingUp = DeviceUsing.启用.ToString();
                if (string.IsNullOrEmpty(strAddr))
                {
                    MessageUtil.ShowTips("本机服务地址不可为空");
                    return;
                }
            }
            else
            {
                strUsingUp = DeviceUsing.未启用.ToString();
            }

            #endregion

            #region  环境管理设置

            string strUsingEnvir = "";
            if (cboxEnvir.Checked)
            {
                frmMain.UsingEnvir = DeviceUsing.启用;
                strUsingEnvir      = DeviceUsing.启用.ToString();
            }
            else
            {
                frmMain.UsingEnvir = DeviceUsing.未启用;
                strUsingEnvir      = DeviceUsing.未启用.ToString();
            }

            #endregion

            #region RFID 工具柜

            #endregion

            #region  其他

            string strRfid1No  = DeviceUsing.未启用.ToString();
            string strRfid2No  = DeviceUsing.未启用.ToString();
            string strBorrOver = DeviceUsing.未启用.ToString();
            if (cboxRfid1No.Checked)
            {
                strRfid1No = DeviceUsing.启用.ToString();
            }
            if (cboxRfid2No.Checked)
            {
                strRfid2No = DeviceUsing.启用.ToString();
            }
            if (cboxBorrOver.Checked)
            {
                strBorrOver = DeviceUsing.启用.ToString();
            }
            string strErrInfo = DeviceUsing.未启用.ToString();
            if (cboxError.Checked)
            {
                strErrInfo = DeviceUsing.启用.ToString();
            }


            #endregion

            #region xml

            if (cboxPowReaderUser.Checked)
            {
                config.AppConfigSet("IsUserPowReader", DeviceUsing.启用.ToString());
                config.AppConfigSet("PowReaderIP", DeviceUsing.启用.ToString());
                if (string.IsNullOrEmpty(tbPowReadIp.Text))
                {
                    MessageUtil.ShowTips("半有源读写器 IP 不可为空");
                    return;
                }
                if (string.IsNullOrEmpty(tbPowReadToIp.Text))
                {
                    MessageUtil.ShowTips("半有源读写器 目标IP 不可为空");
                    return;
                }
                if (string.IsNullOrEmpty(tbPowReadToIp.Text))
                {
                    MessageUtil.ShowTips("半有源读写器 目标端口 不可为空");
                    return;
                }
                if (string.IsNullOrEmpty(tbOutId1.Text) && string.IsNullOrEmpty(tbOutId2.Text) && string.IsNullOrEmpty(tbOutId3.Text) && string.IsNullOrEmpty(tbOutId4.Text))
                {
                    MessageUtil.ShowTips("请填写室外 激活器ID");
                    return;
                }
                if (string.IsNullOrEmpty(tbInId1.Text) && string.IsNullOrEmpty(tbInId2.Text) && string.IsNullOrEmpty(tbInId3.Text) && string.IsNullOrEmpty(tbInId4.Text))
                {
                    MessageUtil.ShowTips("请填写室内 激活器ID");
                    return;
                }
                if (string.IsNullOrEmpty(tbMarkTime.Text))
                {
                    MessageUtil.ShowTips("盘库时长 不可为空");
                    return;
                }
            }

            else
            {
                config.AppConfigSet("IsUserPowReader", DeviceUsing.未启用.ToString());
            }

            config.AppConfigSet("PowReaderIP", tbPowReadIp.Text);
            config.AppConfigSet("PowReaderToIP", tbPowReadToIp.Text);
            config.AppConfigSet("PowReaderToPort", tbPowReadPort.Text);
            config.AppConfigSet("OutId1", tbOutId1.Text);
            config.AppConfigSet("OutId2", tbOutId2.Text);
            config.AppConfigSet("OutId3", tbOutId3.Text);
            config.AppConfigSet("OutId4", tbOutId4.Text);
            config.AppConfigSet("InId1", tbInId1.Text);
            config.AppConfigSet("InId2", tbInId2.Text);
            config.AppConfigSet("InId3", tbInId3.Text);
            config.AppConfigSet("InId4", tbInId4.Text);

            config.AppConfigSet("MarkTmie", tbMarkTime.Text);

            #endregion

            string    strSql = "select ID from tb_SysDevice ";
            DataTable dt     = datalogic.GetDataTable(strSql); //wgPort,WgDoorName3,WgDoorName4,UsingFinger,FingerDoorName
            if (dt.Rows.Count > 0)
            {                                                  //IcDoorOfRfid1,IcDoorOfRfid2,IcDoorOfRfid3,IcDoorOfRfid4,FingerDoorOfRfid  Rfid1No,Rfid2No,BorrOver
                strSql = "update tb_SysDevice set DoorUsing='" + usingIc.ToString() + "',DoorSN='" + strIcSn + "',DoorIP='" + strIcIp + "'," +
                         "DoorCount='" + "" + "',RfidUsing1='" + strRfidUsing1 + "',RfidUsing2='" + strRfidUsing2 + "',RfidIp1='" + strRfidIp1 + "'," +
                         "RfidIp2='" + strRfidIp2 + "',RfidPort1='" + strRfidPort1 + "',RfidPort2='" + strRfidPort2 + "',ServerAddr='" + strAddr + "'," +
                         "DoorName1='" + strNameDoor1 + "',DoorName2='" + strNameDoor2 + "',ServerUsing='" + strUsingUp + "',EnvirUsing='" + strUsingEnvir + "'" +
                         ",RfidBoxUsing='" + "" + "',DoorType='" + "" + "',FingerDoorIp='" + strIpFinger + "',RfidBoxTime='" + "" + "'," +
                         "FingerPort='" + strPortFinger + "',wgPort='" + strIcPort + "',WgDoorName3='" + strNameDoor3 + "',WgDoorName4='" + strNameDoor4 + "'" +
                         ",UsingFinger='" + usingFinger.ToString() + "',FingerDoorName='" + strNameFinger + "',IcDoorOfRfid1='" + ofRfidDoor1 + "'" +
                         ",IcDoorOfRfid2='" + ofRfidDoor2 + "',IcDoorOfRfid3='" + ofRfidDoor3 + "',IcDoorOfRfid4='" + ofRfidDoor4 + "'" +
                         ",FingerDoorOfRfid='" + ofRfidDoorFinger + "',Rfid1No='" + strRfid1No + "',Rfid2No='" + strRfid2No + "'" +
                         ",BorrOver='" + strBorrOver + "',ErrInfo='" + strErrInfo + "',UsingFinger2='" + usingFinger2 + "',FingerDoorIp2='" + strIpFinger2 + "',FingerPort2='" +
                         strProtFinger2 + "',FingerDoorName2='" + strNameFinger2 + "',FingerDoorOfRfid2='" + ofRfidDoorFinger2 + "' where ID='" + strId + "' ";
            }
            else
            {
                strSql = "insert into tb_SysDevice (DoorUsing,DoorSN,DoorIP,DoorCount,RfidUsing1,RfidUsing2,RfidIp1,RfidIp2,RfidPort1,RfidPort2," +
                         "DoorName1,DoorName2,ServerUsing,EnvirUsing,RfidBoxUsing,DoorType,FingerDoorIp,RfidBoxTime,FingerPort,wgPort,WgDoorName3" +
                         ",WgDoorName4,UsingFinger,FingerDoorName,IcDoorOfRfid1,IcDoorOfRfid2,IcDoorOfRfid3,IcDoorOfRfid4,FingerDoorOfRfid,Rfid1No" +
                         ",Rfid2No,BorrOver,ErrInfo,UsingFinger2,FingerDoorIp2,FingerPort2,FingerDoorName2,FingerDoorOfRfid2	)"+
                         "values ('" + usingIc.ToString() + "','" + strIcSn + "','" + strIcIp + "','" + "" + "','" + strRfidUsing1 + "'" +
                         ",'" + strRfidUsing2 + "','" + strRfidIp1 + "','" + strRfidIp2 + "','" + strRfidPort1 + "','" + strRfidPort2 + "','" + strNameDoor1 + "'" +
                         ",'" + strNameDoor2 + "','" + strUsingUp + "','" + strUsingEnvir + "','" + "" + "','" + "" + "','" + strIpFinger + "','" + "" + "'," +
                         "'" + strPortFinger + "','" + strIcPort + "','" + strNameDoor3 + "','" + strNameDoor4 + "','" + usingFinger.ToString() + "'" +
                         ",'" + strNameFinger + "' ,'" + ofRfidDoor1 + "','" + ofRfidDoor2 + "','" + ofRfidDoor3 + "','" + ofRfidDoor4 + "','" + ofRfidDoorFinger + "'" +
                         ",'" + strRfid1No + "','" + strRfid2No + "','" + strBorrOver + "','" + strErrInfo + "','" + usingFinger2.ToString() + "','" +
                         strIpFinger2 + "','" + strProtFinger2 + "','" + strNameFinger2 + "','" + ofRfidDoorFinger2 + "')";
            }
            int iRet = datalogic.SqlComNonQuery(strSql);
            if (iRet == 0)
            {
                MessageUtil.ShowError("设置失败");
            }
            else
            {
                MessageUtil.ShowTips("设置成功");
            }
        }
Пример #4
0
        private void sbtnBoxOk_Click(object sender, EventArgs e)
        {
            #region 输入判断

            string strName = tbBoxName.Text.Trim();
            if (string.IsNullOrEmpty(strName))
            {
                MessageUtil.ShowTips("工具柜名称不能为空");
                return;
            }

            string strSame = "";
            if (EditType == TagType.添加)
            {
                strSame = "Select ID From tb_Tools where PlaceName='" + strName + "' and IsArea='" + ToolAreaType.工具柜.ToString() + "' ";
            }
            else if (EditType == TagType.修改)
            {
                strSame = "Select ID From tb_Tools where PlaceName='" + strName + "' and IsArea='" + ToolAreaType.工具柜.ToString() + "' and tvChildId<>'" + strAlterChildId + "' ";
            }
            if (!string.IsNullOrEmpty(strSame))
            {
                if (operatedata.blCheckHas(strSame))
                {
                    MessageUtil.ShowTips("存放点名称重复,请重新输入");
                    return;
                }
            }

            if (strName.Length > 50)
            {
                strName = strName.Substring(0, 50);
            }

            #region  门禁

            DeviceUsing DoorUsing = DeviceUsing.未启用;
            string      strDoorIp = tbDoorIP.Text.Trim();
            string      strDoorSn = tbDoorSn.Text.Trim();
            string      strWgPort = tbDooPort.Text.Trim();
            if (rbtnDoorHas.Checked)
            {
                DoorUsing = DeviceUsing.启用;
                if (string.IsNullOrEmpty(strDoorIp))
                {
                    MessageUtil.ShowTips("工具柜门禁IP不能为空");
                    return;
                }
                if (string.IsNullOrEmpty(strDoorSn))
                {
                    MessageUtil.ShowTips("工具柜门禁SN不能为空");
                    return;
                }
                if (string.IsNullOrEmpty(strWgPort))
                {
                    MessageUtil.ShowTips("工具柜门禁 端口号 不能为空");
                    return;
                }
            }
            else
            {
                DoorUsing = DeviceUsing.未启用;
            }

            #endregion

            #region

            //#region  RFID

            //DeviceUsing RfidUsing = DeviceUsing.未启用;
            //DeviceUsing Ant1Using = DeviceUsing.未启用;
            //DeviceUsing Ant2Using = DeviceUsing.未启用;
            //DeviceUsing Ant3Using = DeviceUsing.未启用;
            //DeviceUsing Ant4Using = DeviceUsing.未启用;
            //BoxRfidMain boxRfidMain = BoxRfidMain.未配置;

            //string strRfifIp = tbRfidIp.Text.Trim();
            //string strRfidPort = tbRfidPort.Text.Trim();


            //if (rbtnMain.Checked)
            //{
            //    boxRfidMain = BoxRfidMain.主机;
            //    if (cboxAnt3.Checked || cboxAnt4.Checked)
            //    {
            //        MessageUtil.ShowTips("RFID读写器作为主机模式时,应选择天线1或天线2");
            //        return;
            //    }
            //}
            //else
            //{
            //    boxRfidMain = BoxRfidMain.从机;
            //    if (cboxAnt1.Checked || cboxAnt2.Checked)
            //    {
            //        MessageUtil.ShowTips("RFID读写器作为从机模式时,应选择天线3或天线4");
            //        return;
            //    }
            //}


            //if (rbtnRfidHas.Checked)
            //{
            //    RfidUsing = DeviceUsing.启用;
            //    if (string.IsNullOrEmpty(strRfifIp))
            //    {
            //        MessageUtil.ShowTips("RFID读写器IP不能为空");
            //        return;
            //    }
            //    if (string.IsNullOrEmpty(strRfidPort))
            //    {
            //        MessageUtil.ShowTips("RFID读写器端口号不能为空");
            //        return;
            //    }
            //    if (!cboxAnt1.Checked && !cboxAnt2.Checked && !cboxAnt3.Checked && !cboxAnt4.Checked)
            //    {
            //        MessageUtil.ShowTips("请选择RFID读写器天线");
            //        return;
            //    }
            //    int iAntCount = 0;
            //    if (cboxAnt1.Checked)
            //    {
            //        iAntCount++;
            //        Ant1Using = DeviceUsing.启用;
            //    }
            //    if (cboxAnt2.Checked)
            //    {
            //        iAntCount++;
            //        Ant2Using = DeviceUsing.启用;
            //    }
            //    if (cboxAnt3.Checked)
            //    {
            //        iAntCount++;
            //        Ant3Using = DeviceUsing.启用;
            //    }
            //    if (cboxAnt4.Checked)
            //    {
            //        iAntCount++;
            //        Ant4Using = DeviceUsing.启用;
            //    }
            //    if (iAntCount > 2)
            //    {
            //        MessageUtil.ShowTips("RFID读写器天线数量大于2,请重新选择");
            //        return;
            //    }
            //    // BoxHasRfid,BoxRfidIp,BoxRfidPort
            //    string strSql = "";
            //    if (EditType == TagType.添加)
            //    {
            //        strSql = "select PlaceName,BoxRfidAnt1,BoxRfidAnt2,BoxRfidAnt3,BoxRfidAnt4 from tb_Tools where IsArea='" + ToolAreaType.工具柜.ToString() + "' and " +
            //        "(BoxRfidIp='" + strRfifIp + "' or BoxRfidPort='" + strRfidPort + "')";
            //    }
            //    else
            //    {
            //        strSql = "select PlaceName,BoxRfidAnt1,BoxRfidAnt2,BoxRfidAnt3,BoxRfidAnt4 from tb_Tools where IsArea='" + ToolAreaType.工具柜.ToString() + "' and " +
            //         "(BoxRfidIp='" + strRfifIp + "' or BoxRfidPort='" + strRfidPort + "') and tvChildId<>'" + strAlterChildId + "'";
            //    }
            //    DataTable dt = datalogic.GetDataTable(strSql);
            //    if (dt.Rows.Count > 0)
            //    {
            //        string name = dt.Rows[0]["PlaceName"].ToString();
            //        if (dt.Rows.Count == 1)
            //        {
            //            string str = dt.Rows[0]["BoxRfidAnt1"].ToString();
            //            if (Ant1Using == DeviceUsing.启用)
            //            {
            //                if (str == DeviceUsing.启用.ToString())
            //                {
            //                    MessageUtil.ShowTips(name + " 工具柜已设置天线1,请重新设置");
            //                    return;
            //                }
            //            }
            //            str = dt.Rows[0]["BoxRfidAnt2"].ToString();
            //            if (Ant2Using == DeviceUsing.启用)
            //            {
            //                if (str == DeviceUsing.启用.ToString())
            //                {
            //                    MessageUtil.ShowTips(name + " 工具柜已设置天线2,请重新设置");
            //                    return;
            //                }
            //            }
            //            str = dt.Rows[0]["BoxRfidAnt3"].ToString();
            //            if (Ant3Using == DeviceUsing.启用)
            //            {
            //                if (str == DeviceUsing.启用.ToString())
            //                {
            //                    MessageUtil.ShowTips(name + " 工具柜已设置天线3,请重新设置");
            //                    return;
            //                }
            //            }
            //            str = dt.Rows[0]["BoxRfidAnt4"].ToString();
            //            if (Ant4Using == DeviceUsing.启用)
            //            {
            //                if (str == DeviceUsing.启用.ToString())
            //                {
            //                    MessageUtil.ShowTips(name + " 工具柜已设置天线4,请重新设置");
            //                    return;
            //                }
            //            }
            //        }
            //        if (dt.Rows.Count > 1)
            //        {
            //            MessageUtil.ShowTips(name + " 工具柜已设置该IP或端口号,请重新设置");
            //            return;
            //        }
            //    }

            //}
            //else
            //{
            //    RfidUsing = DeviceUsing.未启用;
            //}

            //#endregion

            #endregion

            #endregion

            string strParent   = "";
            string strChild    = "";
            string strAreaName = "";
            if (EditType == TagType.添加)
            {
                TreeNode node = new TreeNode();
                if (treeView1.SelectedNode == null)
                {
                    MessageUtil.ShowTips("请选择工具柜的区域");
                    return;
                }
                else
                {
                    if (treeView1.SelectedNode.ImageIndex == 2)
                    {
                        MessageUtil.ShowTips("存放点下不可添加工具柜");
                        return;
                    }
                    else if (treeView1.SelectedNode.ImageIndex == 3)
                    {
                        MessageUtil.ShowTips("工具节点下不可添加工具柜");
                        return;
                    }
                    else if (treeView1.SelectedNode.ImageIndex == 4)
                    {
                        MessageUtil.ShowTips("工具柜节点下不可添加工具柜");
                        return;
                    }
                    else
                    {
                        strChild                = operatedata.GetChildId("tb_Tools", "tvChildId");
                        node.Name               = strChild;// node.Name 为本节点的编号
                        strParent               = treeView1.SelectedNode.Name.ToString();
                        strAreaName             = treeView1.SelectedNode.Text.ToString();
                        node.Tag                = strParent;
                        node.Text               = strName;
                        node.ImageIndex         = 4;
                        node.SelectedImageIndex = 4;
                        treeView1.SelectedNode.Nodes.Add(node);//HasDoor,DoorIp,DoorSn,BoxHasRfid,BoxRfidIp,BoxRfidPort,BoxRfidAnt1,BoxRfidAnt2,BoxRfidAnt3,BoxRfidAnt4 BoxRfidMain
                        string strSql = "insert into tb_Tools (tvParent,tvChildId,IsArea,AreaName,PlaceName,HasDoor,DoorIp,DoorSn,wgPort) values " +
                                        "('" + strParent + "','" + strChild + "','" + ToolAreaType.工具柜.ToString() + "','" + strAreaName + "','" + strName + "'" +
                                        ",'" + DoorUsing.ToString() + "','" + strDoorIp + "','" + strDoorSn + "','" + strWgPort + "')";
                        datalogic.SqlComNonQuery(strSql);
                        treeView1.ExpandAll();
                    }
                }
            }
            else if (EditType == TagType.修改)
            {
                treeView1.SelectedNode.Text = strName;//,,,,,BoxRfidAnt2,BoxRfidAnt3,BoxRfidAnt4
                string strSql = "update tb_Tools set PlaceName='" + strName + "',HasDoor='" + DoorUsing.ToString() + "',DoorIp='" + strDoorIp + "'," +
                                "DoorSn='" + strDoorSn + "',wgPort='" + strWgPort + "' where tvChildId='" + strAlterChildId + "' ";
                datalogic.SqlComNonQuery(strSql);

                if (treeView1.SelectedNode.FirstNode != null)
                {
                    if (treeView1.SelectedNode.FirstNode.ImageIndex == 4)
                    {
                        strSql = "update tb_Tools set StoragePlace='" + strName + "' where tvParent='" + strAlterChildId + "' ";
                        datalogic.SqlComNonQuery(strSql);
                    }
                }
                ShowNew();

                strSql = "update tb_BoxIcPower set BoxName='" + strName + "' where BoxChildId='" + strAlterChildId + "' ";
                datalogic.SqlComNonQuery(strSql);
            }
        }