예제 #1
0
        void setRight()
        {
            if (_strUserCode!="0")
            {
                strRights = new Sys_OperatorPosition().GetOperatorPosition(_strUserCode);
                //strRights = strRights.Replace("s2302", "s2301").Replace("s2305", "s2301").Replace("s2306", "s2301");
                //strRights = strRights.Replace("s2304", "s2303");
                //strRights = strRights.Replace("s2208", "s2207");

                if (!(strRights.Contains(",s2302,") || strRights.Contains(",s2305,") || strRights.Contains(",s2306,")))
                {
                    //picCheckBang.Visible = true;
                    TabWeight.TabPages.Remove(tabLoadWeight);
                }

                //if (strRights.Contains(",s2304,"))
                //{
                //    PicCheckSpreadWeight.Visible = true;
                //}

                if (!strRights.Contains(",s2207,"))
                {
                    //PicOutWeight.Visible = true;
                    TabWeight.TabPages.Remove(TabOutWeight);
                }
            }
        }
        void SetRights()
        {
            Sys_OperatorPosition OP = new Sys_OperatorPosition();
            strRightList = OP.GetOperatorPosition(StaticParameter.UserCode);//
            if (StaticParameter.UserCode != "0")
            {
                //手动和自动都有
                if ((strRightList.Contains(",s2609,")) && (strRightList.Contains(",s2610,")))
                {
                    lblAuto.Enabled = true;
                    lblAuto.ForeColor = Color.Red;
                    lblHand.Enabled = true;
                    lblHand.ForeColor = Color.Black;

                    //lbllHandDigital.Enabled = true;
                    //lbllHandDigital.ForeColor = Color.Red;
                    //lbllNavicertCode.ForeColor = Color.Red;

                    strCurrentMenu = "自动过磅";

                }
                if ((strRightList.Contains(",s2609,")) && (!strRightList.Contains(",s2610,")))
                {
                    lblHand.Enabled = true;
                    lblAuto.Enabled = false;
                    lblHand.ForeColor = Color.Red;
                    lblAuto.ForeColor = Color.Black;

                    txtHandDigital.Enabled = true;
                    lbllHandDigital.ForeColor = Color.Red;
                    lbllNavicertCode.ForeColor = Color.Red;
                    txtNavicertCode.ReadOnly = false;
                    txtHandDigital.ReadOnly = false;
                    strCurrentMenu = "手动过磅";
                }
                if ((!strRightList.Contains(",s2609,")) && (strRightList.Contains(",s2610,")))  //手动过磅
                {
                    lblHand.Enabled = false;
                    lblAuto.Enabled = true;
                    lblHand.ForeColor = Color.Black;
                    lblAuto.ForeColor = Color.Red;

                    txtHandDigital.Enabled = false;
                    lbllHandDigital.ForeColor = Color.Black;
                    lbllNavicertCode.ForeColor = Color.Black;
                    txtNavicertCode.ReadOnly = true;
                    txtHandDigital.ReadOnly = true;
                    strCurrentMenu = "自动过磅";
                }
            }

            if (strCard == "ID")
            {
                this.txtNavicertCode.ReadOnly = false;
            }
        }
        void SetRights()
        {
            Sys_OperatorPosition OP = new Sys_OperatorPosition();

            ToolStripMenuItem autoItem = (ToolStripMenuItem)this.menuWeight.Items[0];
            ToolStripMenuItem manualItem = (ToolStripMenuItem)this.menuWeight.Items[1];
            ToolStripMenuItem PersonItem = (ToolStripMenuItem)this.menuWeight.Items[2];

            if (StaticParameter.UserCode != "0")
            {
                if (StaticParameter.RightList.Contains(",s2309,"))
                {
                    #region 重车人工过磅
                    autoItem.Visible = false;
                    manualItem.Visible = false;
                    PersonItem.Visible = true;
                    PersonItem.ForeColor = Color.Red;

                    this.Text = "散煤人工验票";
                    strBangType = "人工";
                    strCurrentMenu = "Person";

                    lblHandleUinit.Enabled = true;
                    lbllHandDigital.Enabled = true;
                    txtHandDigital.ReadOnly = false;
                    lbllHandDigital.ForeColor = Color.Red;

                    #endregion

                    if (StaticParameter.RightList.Contains(",s2303,"))
                    {
                        autoItem.Visible = true;
                    }

                    if (StaticParameter.RightList.Contains(",s2304,"))
                    {
                        manualItem.Visible = true;
                    }
                }
                else if (StaticParameter.RightList.Contains(",s2304,"))
                {
                    #region 重车手动过磅
                    autoItem.Visible = false;
                    manualItem.Visible = true;
                    PersonItem.Visible = false;
                    manualItem.ForeColor = Color.Red;

                    this.Text = "散煤手动验票";
                    strBangType = "手动";
                    strCurrentMenu = "Hand";

                    lblHandleUinit.Enabled = false;
                    lbllHandDigital.Enabled = false;
                    txtHandDigital.ReadOnly = true;
                    #endregion

                    if (StaticParameter.RightList.Contains(",s2303,"))
                    {
                        autoItem.Visible = true;
                    }
                }
                else
                {
                    #region 自动验票
                    autoItem.Visible = true;
                    manualItem.Visible = false;
                    PersonItem.Visible = false;

                    this.Text = "散煤自动验票";
                    autoItem.ForeColor = Color.Red;

                    strBangType = "自动";
                    strCurrentMenu = "Auto";
                    #endregion
                }
            }
            else
            {
                autoItem.Visible = true;
                manualItem.Visible = true;
                PersonItem.Visible = true;
                autoItem.ForeColor = Color.Red;

                this.Text = "散煤自动验票";
                strBangType = "自动";
                strCurrentMenu = "Auto";
            }
        }
 private void TwiceWeightPrint_Click(object sender, EventArgs e)
 {
     StaticParameter.IsMatchIp = "1";
     if (StaticParameter.IsMatchIp == "1")
     {
         if (StaticParameter.UserCode == "0")
         {
             new RoomSearch.LoadWeightSearch(this).ShowDialog();
         }
         else
         {
             string strrightlist = new Sys_OperatorPosition().GetOperatorPosition(_strUserCode);
             if (strrightlist.Contains("s2501"))
             {
                 new RoomSearch.LoadWeightSearch(this).ShowDialog();
             }
             else
             {
                 alSound.Alarm("你没有重车过磅二次打印权限");
             }
         }
     }
     else if (StaticParameter.IsMatchIp == "0")
     {
         alSound.Alarm("该站的IP地址与该站的名称不匹配");
     }
     else if (StaticParameter.IsMatchIp == "-1")
     {
         alSound.Alarm("该站的IP地址存在于多个磅房中");
     }
     else
     {
         alSound.Alarm("该站的IP地址不存在");
     }
 }
        void SetRights()
        {
            Sys_OperatorPosition OP = new Sys_OperatorPosition();
            strRightList = OP.GetOperatorPosition(StaticParameter.UserCode);//
            if (StaticParameter.UserCode != "0")
            {
                ToolStripMenuItem autoItem = (ToolStripMenuItem)this.menuWeight.Items[0];
                ToolStripMenuItem manualItem = (ToolStripMenuItem)this.menuWeight.Items[1];
                //只有自动过磅权限
                if ((strRightList.Contains(",s2207,")) && (strRightList.Contains(",s2208,")))
                {
                    #region 手动过磅
                    autoItem.Visible = true;
                    manualItem.Visible = true;
                    autoItem.ForeColor = Color.Black;
                    manualItem.ForeColor = Color.Red;
                    this.Text = "过境煤手动过磅";
                    strBangType = "手动";

                    lblHandleUinit.Enabled = true;
                    lbllHandDigital.Enabled = true;
                    lbllHandDigital.ForeColor = Color.Red;
                    lbllNavicertCode.ForeColor = Color.Red;

                    txtHandDigital.ReadOnly = false;
                    txtNavicert.ReadOnly = false;

                    strCurrentMenu = "Hand";
                    #endregion
                }
                else if ((strRightList.Contains(",s2207,")) && (!strRightList.Contains(",s2208,")))
                {

                    autoItem.Visible = true;
                    manualItem.Visible = false;
                    this.Text = "过境煤自动过磅";
                    autoItem.ForeColor = Color.Red;
                    strBangType = "自动";
                    strCurrentMenu = "Auto";
                }
                else if ((!strRightList.Contains(",s2207,")) && (strRightList.Contains(",s2208,")))  //手动过磅
                {
                    #region 手动过磅
                    autoItem.Visible = false;
                    manualItem.Visible = true;
                    manualItem.ForeColor = Color.Red;
                    this.Text = "过境煤手动过磅";
                    strBangType = "手动";

                    lblHandleUinit.Enabled = true;
                    lbllHandDigital.Enabled = true;
                    lbllHandDigital.ForeColor = Color.Red;
                    lbllNavicertCode.ForeColor = Color.Red;

                    txtHandDigital.ReadOnly = false;
                    txtNavicert.ReadOnly = false;

                    strCurrentMenu = "Hand";
                    #endregion
                }
            }
            else
            {
                ToolStripMenuItem autoItem = (ToolStripMenuItem)this.menuWeight.Items[0];
                autoItem.Visible = true;
                ToolStripMenuItem manualItem = (ToolStripMenuItem)this.menuWeight.Items[1];
                manualItem.ForeColor = Color.Black;
                manualItem.Visible = true;

                this.Text = "过境煤自动过磅";
                autoItem.ForeColor = Color.Red;
                strBangType = "自动";
                strCurrentMenu = "Auto";
            }

            if (strCard == "ID")
            {
                this.txtNavicert.ReadOnly = false;
            }
        }
 /// <summary>
 /// 重车二次打印
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TwiceWeightPrint_Click(object sender, EventArgs e)
 {
     if (StaticParameter.UserCode != "0")
     {
         if (StaticParameter.IsMatchIp == "1")//首先判断用户的ip地址是否匹配数据,如果匹配那么就判断用户编号是否为0(超级管理员),是就显示二次打印窗体,不是0那么就判断该用户下的权限是否含有“s2501”,如果有这个就显示二次打印,否则就语音报警
         {
             if (StaticParameter.UserCode == "0")
             {
                 new WeightBang.LoadWeightSearch(this).ShowDialog();
                 //new RoomSearch.LoadWeightSearch(this).ShowDialog();
                 //new RoomSearch.LoadWeightSearch(this, this.lblDepart.Text).ShowDialog();
             }
             else
             {
                 string strrightlist = new Sys_OperatorPosition().GetOperatorPosition(_strUserCode);
                 if (strrightlist.Contains("s2501"))
                 {
                     new WeightBang.LoadWeightSearch(this).ShowDialog();
                     //new RoomSearch.LoadWeightSearch(this).ShowDialog();
                     //new RoomSearch.LoadWeightSearch(this, this.lblDepart.Text).ShowDialog();
                 }
                 else
                 {
                     alSound.Alarm("你没有重车过磅二次打印权限");
                 }
             }
         }
         else if (StaticParameter.IsMatchIp == "0")
         {
             alSound.Alarm("该站的IP地址与该站的名称不匹配");
         }
         else if (StaticParameter.IsMatchIp == "-1")
         {
             alSound.Alarm("该站的IP地址存在于多个磅房中");
         }
         else
         {
             alSound.Alarm("该站的IP地址不存在");
         }
     }
     else
     {
         new WeightBang.LoadWeightSearch(this).ShowDialog();
         //new RoomSearch.LoadWeightSearch(this).ShowDialog();
     }
 }
        private void RMainForm_Load(object sender, EventArgs e)
        {
            #region 加载窗体背景
            this.BackgroundImage = Image.FromFile(StaticParameter.Skin + "rmbg.jpg");
            this.BackgroundImageLayout = ImageLayout.Stretch;
            #endregion

            #region 添加登录主界面标题显示联网或断网
            string strIp = ini.IniReadValue("Connection", "isConnection");
            if (strIp == "1")
            {
                this.Text += "   离线版";
            }
            else
            {
                this.Text += "   联网版";
            }
            #endregion

            timer.Interval = 20000;
            timer.Elapsed += new System.Timers.ElapsedEventHandler(PingIP);
            timer.Enabled = true;
            timer.Start();

            //this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);

            string strsql = "select RoomName,OrgCode,OrgName,UserCode,UserName from VSYS_Operator where UserCode=" + _strUserCode + "";

            DataSet dsOperatorInfo = DbHelperSQL.Query(strsql);
            lblDepart.Text = dsOperatorInfo.Tables[0].Rows[0]["OrgName"].ToString();
            lblUserName.Text = dsOperatorInfo.Tables[0].Rows[0]["UserName"].ToString();

            #region 权限
            if (_strUserCode != "0")
            {
                RightList = new Sys_OperatorPosition().GetOperatorPosition(_strUserCode);
                StaticParameter.RightList = RightList;
                string strRights = RightList;
                strRights = strRights.Replace("s2202", "s2201").Replace("s2210", "s2201").Replace("s2211", "s2201").Replace("s2215", "s2201").Replace("s2216", "s2201");
                strRights = strRights.Replace("s2204", "s2203").Replace("s2212", "s2203");
                strRights = strRights.Replace("s2206", "s2205").Replace("s2213", "s2205");
                SetRights(strRights);

                string strIsCheckPwdsql = "select IsChangePwd from Sys_Operator where UserCode =" + _strUserCode + "";

                string strIsCheckPwd = DbHelperSQL.GetSingle(strIsCheckPwdsql).ToString();

                if (strIsCheckPwd == "0")
                {
                    if (new ChangePasswd(false).ShowDialog() == DialogResult.OK)
                    {
                        this.Hide();
                        new UserLogin("0").ShowDialog();
                    }
                }
            }
            #endregion

            #region 判断该站点名称和IP是否匹配
            string strRoomCode = ini.IniReadValue("RoomSetting", "RoomCode");
            string strRoomIp = ini.IniReadValue("Connection", "LServer");
            string strsqlMacthIP = "select RoomCode from TT_Room where RoomIp ='" + strRoomIp + "' and IsForBid ='0'";

            DataSet dsRoomCode = DbHelperSQL.Query(strsqlMacthIP);
            DataRowCollection drc = dsRoomCode.Tables[0].Rows;

            if (drc.Count == 1)
            {
                if (drc[0]["RoomCode"].ToString().Trim() == strRoomCode.Trim())
                {
                    StaticParameter.IsMatchIp = "1";
                }
                else
                {
                    StaticParameter.IsMatchIp = "0";
                    alSound.Alarm("该站的IP地址与该站的名称不匹配");
                    MessageBox.Show("该站的IP地址与该站的名称不匹配", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            else
            {
                if (drc.Count == 0)
                {
                    alSound.Alarm("该站的IP地址不存在");
                    MessageBox.Show("该站的IP地址不存在", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    StaticParameter.IsMatchIp = "-1";
                    alSound.Alarm("该站的IP地址存在于多个磅房中");
                    MessageBox.Show("该站的IP地址存在于多个磅房中", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            #endregion

            #region 如果是磅房端用户
            //if (strRights.Contains(",s2202,") && !strRights.Contains(",s2203,"))
            //{
            //    this.Hide();
            //    if (new WeightBang.LoadWeight().ShowDialog() == DialogResult.OK)
            //    {
            //        this.Show();
            //    }
            //}
            #endregion

            //磅房ip和服务器存储的该磅房ip是否匹配:0-匹配;1-不匹配
            StaticParameter.IsMatchIp = "1";
        }
예제 #8
0
        private void TwiceEmptyPrint_Click(object sender, EventArgs e)
        {
            if (StaticParameter.IsMatchIp == "1")
            {
                if (StaticParameter.UserCode == "0")
                {
                    new EmptyBang.CarInfoSearch(this).ShowDialog();
                }
                else
                {
                    string strrightlist = new Sys_OperatorPosition().GetOperatorPosition(_strUserCode);
                    if (strrightlist.Contains("s2504"))
                    {
                        new EmptyBang.CarInfoSearch(this).ShowDialog();
                    }
                    else
                    {
                        alSound.Alarm("你没有车辆信息登记二次打印权限");
                    }
                }

            }
            else if (StaticParameter.IsMatchIp == "0")
            {
                alSound.Alarm("该站的IP地址与该站的名称不匹配");
            }
            else if (StaticParameter.IsMatchIp == "-1")
            {
                alSound.Alarm("该站的IP地址存在于多个磅房中");
            }
            else
            {
                alSound.Alarm("该站的IP地址不存在");
            }
        }
        private void RMainForm_Load(object sender, EventArgs e)
        {
            #region 加载窗体背景
            this.BackgroundImage = Image.FromFile(StaticParameter.Skin + "rmbg.jpg");
            this.BackgroundImageLayout = ImageLayout.Stretch;
            #endregion

            AutoScale(this);

            #region 窗体大小
            this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); //自动设置该软件的窗体大小是根据显示器自动设置
            #endregion

            #region 状态栏显示用户名和部门
            string strsql = "select RoomName,OrgCode,OrgName,UserCode,UserName from VSYS_Operator where UserCode=" + _strUserCode + "";//查找指定的用户编号下的用户信息

            DataSet dsOperatorInfo = DbHelperSQL.Query(strsql);

            lblDepart.Text = dsOperatorInfo.Tables[0].Rows[0]["OrgName"].ToString();//所属部门
            lblUserName.Text = dsOperatorInfo.Tables[0].Rows[0]["UserName"].ToString(); //登录名
            #endregion

            #region 根据用户权限动态设置窗体菜单和图标按钮,检测用户是否更改了密码
            if (_strUserCode != "0")
            {
                RightList = new Sys_OperatorPosition().GetOperatorPosition(_strUserCode);//获取该工作人员的职位----根据用户的编号查询该用下的角色权限下的菜单id
                StaticParameter.RightList = RightList;//再将它赋值给静态参数变量
                string strRights = RightList;
                strRights = strRights.Replace("s2202", "s2201").Replace("s2210", "s2201").Replace("s2211", "s2201").Replace("s2215", "s2201").Replace("s2216", "s2201");
                strRights = strRights.Replace("s2204", "s2203").Replace("s2212", "s2203");
                strRights = strRights.Replace("s2206", "s2205").Replace("s2213", "s2205");
                SetRights(strRights);//设置权限和菜单----没有看完!!!

                #region 检测用户是否更改了密码,如果没有就弹窗密码修改
                string strIsCheckPwdsql = "select IsChangePwd from Sys_Operator where UserCode =" + _strUserCode + "";

                string strIsCheckPwd = DbHelperSQL.GetSingle(strIsCheckPwdsql).ToString();

                if (strIsCheckPwd == "0")
                {
                    if (new ChangePasswd(false).ShowDialog() == DialogResult.OK)
                    {
                        this.Hide();
                        new UserLogin("0").ShowDialog();
                    }
                }
                #endregion

                #region 判断该站点名称和IP是否匹配
                string strRoomCode = ini.IniReadValue("RoomSetting", "RoomCode");
                //string strRoomIp = ini.IniReadValue("Connection", "LServer");
                string strRoomIp = ini.IniReadValue("RoomSetting", "LinIP");
                string strsqlMacthIP = "select RoomCode from TT_Room where RoomIp ='" + strRoomIp + "' and IsForBid ='0'";

                DataSet dsRoomCode = DbHelperSQL.Query(strsqlMacthIP);
                DataRowCollection drc = dsRoomCode.Tables[0].Rows;

                if (drc.Count == 1)
                {
                    if (drc[0]["RoomCode"].ToString().Trim() == strRoomCode.Trim())
                    {
                        StaticParameter.IsMatchIp = "1";//ip地址匹配的1,否则0
                    }
                    else
                    {
                        StaticParameter.IsMatchIp = "0";
                        alSound.Alarm("该站的IP地址与该站的名称不匹配");
                    }
                }
                else
                {
                    if (drc.Count == 0)
                    {
                        StaticParameter.IsMatchIp = "-2";
                        alSound.Alarm("该站的IP地址不存在");
                    }
                    else
                    {
                        StaticParameter.IsMatchIp = "-1";
                        alSound.Alarm("该站的IP地址存在于多个磅房中");
                    }
                }
                #endregion

                #region 如果是磅房端用户--改代码已经被注释
                //if (strRights.Contains(",s2202,") && !strRights.Contains(",s2203,"))
                //{
                //    this.Hide();
                //    if (new WeightBang.LoadWeight().ShowDialog() == DialogResult.OK)
                //    {
                //        this.Show();
                //    }
                //}
                #endregion
            }
            #endregion
        }
예제 #10
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     if (StaticParameter.IsMatchIp == "1")
     {
         if (StaticParameter.UserCode == "0")
         {
             new NavicertCard.NavicertSearch(this).ShowDialog();
         }
         else
         {
             string strrightlist = new Sys_OperatorPosition().GetOperatorPosition(_strUserCode);
             if (strrightlist.Contains("s2505"))
             {
                 new NavicertCard.NavicertSearch(this).ShowDialog();
             }
             else
             {
                 alSound.Alarm("你没有准运卡办理二次打印权限");
             }
         }
     }
     else if (StaticParameter.IsMatchIp == "0")
     {
         alSound.Alarm("该站的IP地址与该站的名称不匹配");
     }
     else if (StaticParameter.IsMatchIp == "-1")
     {
         alSound.Alarm("该站的IP地址存在于多个磅房中");
     }
     else
     {
         alSound.Alarm("该站的IP地址不存在");
     }
 }
예제 #11
0
        private void CMainForm_Load(object sender, EventArgs e)
        {
            #region 创建视频对象
            if (StaticParameter.IsVideo == "1")
            {
                PF = new WS.Video();
            }
            #endregion

            #region 加载窗体背景
            this.BackgroundImage = Image.FromFile(StaticParameter.Skin + "cmbg.jpg");
            this.BackgroundImageLayout = ImageLayout.Stretch;
            #endregion

            StaticParameter.IsMatchIp = "1";
            this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);

            string strsql = "select RoomName,OrgCode,OrgName,UserCode,UserName from VSYS_Operator where UserCode=" + _strUserCode + "";

            DataSet dsOperatorInfo = DbHelperSQL.Query(strsql);

            lblDepart.Text = dsOperatorInfo.Tables[0].Rows[0]["OrgName"].ToString();
            lblUserName.Text = dsOperatorInfo.Tables[0].Rows[0]["UserName"].ToString();

            if (_strUserCode != "0")
            {
                RightList = new Sys_OperatorPosition().GetOperatorPosition(_strUserCode);
                StaticParameter.RightList = RightList;
                string strRights = RightList;
                strRights = strRights.Replace("s2302", "s2301").Replace("s2305", "s2301").Replace("s2306", "s2301").Replace("s2307", "s2301").Replace("s2308", "s2301");
                strRights = strRights.Replace("s2212", "s2203");
                strRights = strRights.Replace("s2215", "s2201");
                strRights = strRights.Replace("s2304", "s2303").Replace("s2309", "s2303");
                strRights = strRights.Replace("s2208", "s2207").Replace("s2214", "s2207");
                SetRights(strRights);

                string strIsCheckPwdsql = "select IsChangePwd from Sys_Operator where UserCode =" + _strUserCode + "";

                string strIsCheckPwd = DbHelperSQL.GetSingle(strIsCheckPwdsql).ToString();

                if (strIsCheckPwd == "0")
                {
                    if (new ChangePasswd(false).ShowDialog() == DialogResult.OK)
                    {
                        this.Hide();
                        new UserLogin("0").ShowDialog();
                    }
                }
            }

            //#region 判断该站点名称和IP是否匹配
            //string strRoomCode = ini.IniReadValue("RoomSetting", "RoomCode");
            //string strRoomIp = ini.IniReadValue("Connection", "LServer");
            //string strsqlMacthIP = "select RoomCode from TT_Room where RoomIp ='" + strRoomIp + "' and IsForBid ='0'";

            //DataSet dsRoomCode = DbHelperSQL.Query(strsqlMacthIP);
            //DataRowCollection drc = dsRoomCode.Tables[0].Rows;

            //if (drc.Count == 1)
            //{
            //    if (drc[0]["RoomCode"].ToString().Trim() == strRoomCode.Trim())
            //    {
            //        StaticParameter.IsMatchIp = "1";
            //    }
            //    else
            //    {
            //        StaticParameter.IsMatchIp = "0";
            //        alSound.Alarm("该站的IP地址与该站的名称不匹配");
            //    }
            //}
            //else
            //{
            //    if (drc.Count == 0)
            //    {
            //        StaticParameter.IsMatchIp = "-2";
            //        alSound.Alarm("该站的IP地址不存在");
            //    }
            //    else
            //    {
            //        StaticParameter.IsMatchIp = "-1";
            //        alSound.Alarm("该站的IP地址存在于多个磅房中");
            //    }
            //}
            //#endregion
        }
        private void CMainForm_Load(object sender, EventArgs e)
        {
            #region 添加登录主界面标题显示联网或断网
            string strIp = ini.IniReadValue("Connection", "isConnection");
            if (strIp == "1")
            {
                this.Text += "   离线版";
            }
            else
            {
                this.Text += "   联网版";
            }
            #endregion

            #region 创建视频对象
            if (StaticParameter.IsVideo == "1")
            {
                PF = new WS.Video();
            }
            #endregion

            #region 加载窗体背景
            this.BackgroundImage = Image.FromFile(StaticParameter.Skin + "cmbg.jpg");
            this.BackgroundImageLayout = ImageLayout.Stretch;
            #endregion
            timer.Interval = 20000;
            timer.Elapsed += new System.Timers.ElapsedEventHandler(PingIP);
            timer.Enabled = true;
            timer.Start();
            //this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);

            string strsql = "select RoomName,OrgCode,OrgName,UserCode,UserName from VSYS_Operator where UserCode=" + _strUserCode + "";

            DataSet dsOperatorInfo = DbHelperSQL.Query(strsql);

            lblDepart.Text = dsOperatorInfo.Tables[0].Rows[0]["OrgName"].ToString();
            lblUserName.Text = dsOperatorInfo.Tables[0].Rows[0]["UserName"].ToString();

            if (_strUserCode != "0")
            {
                RightList = new Sys_OperatorPosition().GetOperatorPosition(_strUserCode);
                StaticParameter.RightList = RightList;
                string strRights = RightList;
                strRights = strRights.Replace("s2302", "s2301").Replace("s2305", "s2301").Replace("s2306", "s2301").Replace("s2307", "s2301").Replace("s2308", "s2301");
                strRights = strRights.Replace("s2204", "s2203").Replace("s2212", "s2203");
                strRights = strRights.Replace("s2304", "s2303").Replace("s2309", "s2303");
                strRights = strRights.Replace("s2208", "s2207").Replace("s2214", "s2207");
                SetRights(strRights);

                string strIsCheckPwdsql = "select IsChangePwd from Sys_Operator where UserCode =" + _strUserCode + "";

                string strIsCheckPwd = DbHelperSQL.GetSingle(strIsCheckPwdsql).ToString();

                if (strIsCheckPwd == "0")
                {
                    if (new ChangePasswd(false).ShowDialog() == DialogResult.OK)
                    {
                        this.Hide();
                        new UserLogin("0").ShowDialog();
                    }
                }
            }
            label1.Visible = pictureBox3.Visible;

            #region 判断该站点名称和IP是否匹配
            string strRoomCode = ini.IniReadValue("RoomSetting", "RoomCode");
            string strRoomIp = ini.IniReadValue("Connection", "LServer");
            string strsqlMacthIP = "select RoomCode from TT_Room where RoomIp ='" + strRoomIp + "' and IsForBid ='0'";

            DataSet dsRoomCode = DbHelperSQL.Query(strsqlMacthIP);
            DataRowCollection drc = dsRoomCode.Tables[0].Rows;

            if (drc.Count == 1)
            {
                //if (drc[0]["RoomCode"].ToString().Trim() == strRoomCode.Trim())
                {
                    StaticParameter.IsMatchIp = "1";
                }
                //else
                {
                    //StaticParameter.IsMatchIp = "0";
                    //alSound.Alarm("该站的IP地址与该站的名称不匹配");
                }
            }
            else
            {
                if (drc.Count == 0)
                {
                    StaticParameter.IsMatchIp = "-2";
                    alSound.Alarm("该站的IP地址不存在");
                }
                else
                {
                    StaticParameter.IsMatchIp = "-1";
                    alSound.Alarm("该站的IP地址存在于多个磅房中");
                }
            }
            #endregion

            OutWeightAlarm();
            //主窗体加载完成后运行实时磅秤数据传输
            //new RealtimeBang.RealTimeBang().ShowDialog();

            StaticParameter.IsMatchIp = "1";
        }
        void SetRights()
        {
            Sys_OperatorPosition OP = new Sys_OperatorPosition();
            strRightList = OP.GetOperatorPosition(StaticParameter.UserCode);//",s2202,s2203,";//

            ToolStripMenuItem autoItem = (ToolStripMenuItem)this.menuWeight.Items[0];
            ToolStripMenuItem manualItem = (ToolStripMenuItem)this.menuWeight.Items[1];

            if (StaticParameter.UserCode != "0")
            {
                if (strRightList.Contains(",s2302,"))
                {
                    #region 重车手动验票
                    autoItem.Visible = false;
                    manualItem.Visible = true;
                    manualItem.ForeColor = Color.Red;

                    this.Text = "重车手动验票";
                    strBangType = "手动";
                    strCurrentMenu = "Hand";

                    txtNavicertCard.ReadOnly = false;
                    #endregion

                    if (strRightList.Contains(",s2301,"))
                    {
                        autoItem.Visible = true;
                    }
                }
                else if (strRightList.Contains(",s2301,"))
                {
                    #region 重车自动验票
                    autoItem.Visible = true;
                    manualItem.Visible = false;
                    autoItem.ForeColor = Color.Red;

                    this.Text = "重车自动验票";
                    strBangType = "自动";
                    strCurrentMenu = "Auto";
                    #endregion
                }
            }
            else
            {
                #region 重车自动验票
                autoItem.Visible = true;
                manualItem.Visible = true;
                autoItem.ForeColor = Color.Red;

                this.Text = "重车自动验票";
                strBangType = "自动";
                strCurrentMenu = "Auto";
                #endregion
            }
            if (ini.IniReadValue("RoomSetting", "CardType") == "ID")
            {
                this.txtNavicertCard.ReadOnly = false;
            }
        }
        void SetRights()
        {
            Sys_OperatorPosition OP = new Sys_OperatorPosition();
            strRightList = OP.GetOperatorPosition(StaticParameter.UserCode);

            ToolStripMenuItem autoItem = (ToolStripMenuItem)this.menuWeight.Items[0];
            ToolStripMenuItem manualItem = (ToolStripMenuItem)this.menuWeight.Items[1];
            if (StaticParameter.UserCode != "0")
            {
                //ֻ���Զ�����Ȩ��
                if ((strRightList.Contains(",s2203,")) && (strRightList.Contains(",s2204,")))
                {
                    #region �س��˹�����
                    autoItem.Visible = true;
                    manualItem.Visible = true;
                    manualItem.ForeColor = Color.Red;
                    this.Text = "�س��ֶ�����";
                    strBangType = "�س��ֶ�����";
                    lblHandleUinit.Enabled = true;
                    lbllHandDigital.Enabled = true;
                    //�б�ʶ���IJſ��˹������ʶ��
                    if (strIsHaveMarkedCard == "1")
                    {
                        lbllMarkedCardNo.ForeColor = Color.Red;
                        txtMarkedCardCode.ReadOnly = false;
                    }
                    lbllNavicertCode.ForeColor = Color.Red;
                    lbllHandDigital.ForeColor = Color.Red;
                    txtNavicertCode.ReadOnly = false;
                    txtHandDigital.ReadOnly = false;
                    txtHandDigital.Text = "";
                    strCurrentMenu = "Hand";
                    #endregion
                }
                else if ((strRightList.Contains(",s2203,")) && (!strRightList.Contains(",s2204,")))
                {
                    autoItem.Visible = true;
                    manualItem.Visible = true;
                    this.Text = "�س��Զ�����";
                    autoItem.ForeColor = Color.Red;
                    strBangType = "�س��Զ�����";
                    strCurrentMenu = "Auto";
                }
                else if ((!strRightList.Contains(",s2203,")) && (strRightList.Contains(",s2204,")))  //�˹�����
                {
                    #region �س��˹�����

                    manualItem.Visible = true;
                    manualItem.ForeColor = Color.Red;
                    this.Text = "�س��ֶ�����";
                    strBangType = "�س��ֶ�����";
                    lblHandleUinit.Enabled = true;
                    lbllHandDigital.Enabled = true;
                    //�б�ʶ���IJſ��˹������ʶ��
                    if (strIsHaveMarkedCard == "1")
                    {
                        lbllMarkedCardNo.ForeColor = Color.Red;
                        txtMarkedCardCode.ReadOnly = false;
                    }
                    lbllNavicertCode.ForeColor = Color.Red;
                    lbllHandDigital.ForeColor = Color.Red;
                    txtNavicertCode.ReadOnly = false;
                    txtHandDigital.ReadOnly = false;
                    txtHandDigital.Text = "";
                    strCurrentMenu = "Hand";
                    #endregion
                }
            }
            else
            {

                autoItem.Visible = true;
                manualItem.ForeColor = Color.Black;
                manualItem.Visible = true;

                this.Text = "�س��Զ�����";
                autoItem.ForeColor = Color.Red;
                strBangType = "�س��Զ�����";
                strCurrentMenu = "Auto";
            }
            //���ΪID����ʹ׼�˿��������ɱ༭�����б�ʶ������ʶ�������Ҳ��ɿɱ༭��
            if (strCard == "ID")
            {
                this.txtNavicertCode.ReadOnly = false;
                if (strIsHaveMarkedCard == "1")
                    this.txtMarkedCardCode.ReadOnly = false;
            }
        }