示例#1
0
        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult rr = MessageBox.Show("确定要删除当前数据吗?", "确定要删除提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
            int          tt = (int)rr;

            if (tt == 1)
            {
                string code = this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
                if (code != null && !"".Equals(code) && !"1".Equals(code))
                {
                    bool bl = hts.deleteHouseTypeById(code);
                    if (bl)
                    {   //删除库房数据的同时修改仪表表中的house_code
                        service.deviceInformationService dis = new service.deviceInformationService();
                        dis.updateIformationByHouseCode(code);
                        //刷新页面
                        queryhouseManage();
                        MessageBox.Show("删除成功!");
                    }
                }
                else
                {
                    MessageBox.Show("当前库房信息不能被删除,只能修改库房信息,因为软件系统使用中!");
                }
            }
        }
示例#2
0
        private void checkPointInfo()
        {
            service.deviceInformationService dis = new service.deviceInformationService();
            int       flag = 0;
            DataTable dt   = dis.checkPointInfo(flag);

            if (dt != null)
            {
                this.dataGridView1.DataSource                     = dt;
                this.dataGridView1.Columns[0].Visible             = false;
                this.dataGridView1.Columns[1].HeaderCell.Value    = "管理主机编号";
                this.dataGridView1.Columns[2].HeaderCell.Value    = "测点(仪表)编号";
                this.dataGridView1.Columns[3].HeaderCell.Value    = "测点(仪表)名称";
                this.dataGridView1.Columns[4].Visible             = false;
                this.dataGridView1.Columns[5].HeaderCell.Value    = "通信协议";
                this.dataGridView1.Columns[6].Visible             = false;
                this.dataGridView1.Columns[7].Visible             = false;
                this.dataGridView1.Columns[8].Visible             = false;
                this.dataGridView1.Columns[9].Visible             = false;
                this.dataGridView1.Columns[10].Visible            = false;
                this.dataGridView1.Columns[11].HeaderCell.Value   = "库房类型名称";
                this.dataGridView1.Columns[12].Visible            = false;
                this.dataGridView1.RowsDefaultCellStyle.ForeColor = Color.Black;
                this.dataGridView1.Columns[1].Width               = 150;
                this.dataGridView1.Columns[2].Width               = 130;
                this.dataGridView1.Columns[3].Width               = 150;
                this.dataGridView1.Columns[5].Width               = 220;
                this.dataGridView1.AllowUserToAddRows             = false;
            }
            else
            {
                this.dataGridView1.DataSource = null;
            }
        }
示例#3
0
        private void button4_Click(object sender, EventArgs e)
        {
            DialogResult rr = MessageBox.Show("确定要删除测点(仪表)数据吗?", "确定要删除提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
            int          tt = (int)rr;

            if (tt == 1)
            {
                string code  = this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
                string meter = this.dataGridView1.SelectedRows[0].Cells[2].Value.ToString();

                if (code != null && !"".Equals(code) && meter != null && !"".Equals(meter))
                {
                    bean.deviceInformation di = new bean.deviceInformation();
                    di.measureCode = code;
                    di.meterNo     = meter;
                    service.deviceInformationService dis = new service.deviceInformationService();
                    bool bl = dis.deletetDeviceInformation(di);
                    if (bl)
                    { //删除仪表数据的同时修改管理主机的仪表数量
                        service.manageHostService mhs = new service.manageHostService();
                        bean.manageHose           mh  = new bean.manageHose();
                        mh.measureCode = di.measureCode;
                        mhs.updateManageHostCdNum(mh);
                        //刷新仪表页面
                        checkPointInfo();
                        MessageBox.Show("删除成功!");
                        //刷新首页
                        if (this.RefreshEvent != null)
                        {
                            RefreshEvent(1, null);
                        }
                    }
                }
            }
        }
示例#4
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (flag)
            {
                foreach (Control ctr in this.pictureBox1.Controls)
                {
                    //判断该控件是不是Label
                    if (ctr is Label)
                    { //将ctr转换成Label并赋值给ck
                        Label    lb    = ctr as Label;
                        string[] code1 = lb.Name.Split('_');

                        Point tt = lb.Location;
                        bean.deviceInformation di = new bean.deviceInformation();
                        di.measureCode = code1[0].ToString();
                        di.meterNo     = code1[1].ToString();
                        di.pointX      = tt.X;
                        di.pointY      = tt.Y;
                        service.deviceInformationService dis = new service.deviceInformationService();
                        dis.updateIformationByPoint(di);
                    }
                }
                MessageBox.Show("平面图仪表位置信息保存成功!");
                string code = this.comboBox1.SelectedValue.ToString();
                imgWenshidu(code);
                flag = false;
            }
            else
            {
                MessageBox.Show("请先编辑测点位置,再点击保存!");
            }
        }
示例#5
0
        private void readHistoryData_Load(object sender, EventArgs e)
        {
            string str = Application.StartupPath;//项目路径

            this.button1_click.BackgroundImage = Image.FromFile(@str + "/images/read.png");
            this.button4.BackgroundImage       = Image.FromFile(@str + "/images/stop.png");
            this.button2.BackgroundImage       = Image.FromFile(@str + "/images/clear.png");
            this.button3.BackgroundImage       = Image.FromFile(@str + "/images/close.png");
            service.deviceInformationService dis = new service.deviceInformationService();
            int flag = 0;

            dtcdinfo = dis.checkPointInfo(flag);
        }
示例#6
0
        private void button1_Click(object sender, EventArgs e)
        {
            string name      = this.textBox3.Text;
            string codemeter = this.textBox4.Text;
            string t_high    = this.numericUpDown4.Value.ToString();
            string t_low     = this.numericUpDown2.Value.ToString();
            string h_high    = this.numericUpDown1.Value.ToString();
            string h_low     = this.numericUpDown5.Value.ToString();

            if (name != null && double.Parse(t_high) > double.Parse(t_low))
            {
                bean.deviceInformation di = new bean.deviceInformation();
                string[] mm = codemeter.Split('-');
                di.measureCode  = mm[0];
                di.meterNo      = mm[1];
                di.terminalname = name;
                di.t_high       = float.Parse(t_high);
                di.t_low        = float.Parse(t_low);
                di.h_high       = float.Parse(h_high);
                di.h_low        = float.Parse(h_low);
                if (this.checkBox1.Checked)
                {
                    di.powerflag = Int32.Parse(this.checkBox1.Tag.ToString());
                }
                else
                {
                    di.powerflag = 1;
                };
                service.deviceInformationService dis = new service.deviceInformationService();
                bool isok = dis.updateIformation(di);
                if (isok)
                {
                    this.DialogResult = DialogResult.OK;
                }
            }
            else
            {
                MessageBox.Show("测点名称不能为空,温度上限应大于温度下限!");
            }
        }
示例#7
0
        private void button1_Click(object sender, EventArgs e)
        {
            time1 = this.dateTimePicker1.Text.ToString();
            time2 = this.dateTimePicker2.Text.ToString();
            service.warningCheckService wcs = new service.warningCheckService();

            dt = wcs.warningHandlecheck(time1, time2);
            service.deviceInformationService ds = new service.deviceInformationService();
            DataTable dts = ds.selectHouseTypeK();

            if (dts.Rows.Count > 0)
            {
                for (int i = 0; i < dts.Rows.Count; i++)
                {
                    for (int j = 0; j < dt.Rows.Count; j++)
                    {
                        if (dts.Rows[i]["measureMeterCode"].ToString() == dt.Rows[j]["measureMeterCode"].ToString())
                        {
                            dt.Rows[i].Delete();
                        }
                    }
                }
                dt.AcceptChanges();
            }
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string a = Convert.ToDateTime(dt.Rows[i]["handleTime"]).ToString("yyyy/MM/dd HH:mm:ss"); //格式转换
                    dt.Rows[i]["handleTime"] = a;                                                            //dt.Rows[i]["warningTime"] =                                                                                      //dt.Rows[i]["warningTime"] =
                }

                dt.Columns["warningTime"].SetOrdinal(6);
                this.dataGridView1.DataSource                     = dt;
                this.dataGridView1.Columns[0].Visible             = false;
                this.dataGridView1.Columns[1].HeaderCell.Value    = "处理人员";
                this.dataGridView1.Columns[2].HeaderCell.Value    = "处理时间";
                this.dataGridView1.Columns[3].HeaderCell.Value    = "处理方式";
                this.dataGridView1.Columns[4].HeaderCell.Value    = "处理结果";
                this.dataGridView1.Columns[5].HeaderCell.Value    = "详细描述";
                this.dataGridView1.Columns[6].HeaderCell.Value    = "报警时间";
                this.dataGridView1.Columns[7].Visible             = false;
                this.dataGridView1.Columns[8].Visible             = false;
                this.dataGridView1.Columns[9].HeaderCell.Value    = "测点名称";
                this.dataGridView1.Columns[1].Width               = 90;
                this.dataGridView1.Columns[2].Width               = 180;
                this.dataGridView1.Columns[3].Width               = 150;
                this.dataGridView1.Columns[4].Width               = 150;
                this.dataGridView1.Columns[5].Width               = 270;
                this.dataGridView1.Columns[6].Width               = 150;
                this.dataGridView1.Columns[9].Width               = 250;
                this.dataGridView1.RowsDefaultCellStyle.ForeColor = Color.Black;
                for (int count = 0; (count <= (this.dataGridView1.Rows.Count - 2)); count++)
                {
                    this.dataGridView1.Rows[count].HeaderCell.Value = String.Format("{0}", count + 1);
                }
                this.dataGridView1.AllowUserToAddRows = false;
            }
            else
            {
                MessageBox.Show("当前时间段无查询结果!");
            }
        }
示例#8
0
        private void button1_Click(object sender, EventArgs e)
        {
            string name   = this.textBox1.Text;
            string t_high = this.numericUpDown1.Value.ToString();
            string t_low  = this.numericUpDown2.Value.ToString();
            string h_high = this.numericUpDown3.Value.ToString();
            string h_low  = this.numericUpDown4.Value.ToString();
            string id     = this.textBox2.Text.ToString();

            if (name != null && !"".Equals(name) && id != null && !"".Equals(id))
            {
                bean.houseInfo di = new bean.houseInfo();
                di.name   = name;
                di.t_high = float.Parse(t_high);
                di.t_low  = float.Parse(t_low);
                di.h_high = float.Parse(h_high);
                di.h_low  = float.Parse(h_low);
                di.id     = id;
                if (this.checkBox2.Checked)
                {
                    di.isUsed = 1;
                }
                else
                {
                    di.isUsed = 0;
                }
                service.houseTypeService his = new service.houseTypeService();
                bool isok = his.updateHouseInfoById(di);
                if (isok)
                {
                    service.deviceInformationService dis = new service.deviceInformationService();

                    if (this.checkBox1.Checked)
                    {
                        bool bl = dis.updateWsdByHouseCode(di);
                        if (bl)
                        {
                            if (di.isUsed == 1)
                            {
                                MessageBox.Show(di.name + "  库房下所有的测点(仪表)都已修改为空库测点!");
                            }
                            MessageBox.Show(di.name + "  库房下所有的测点(仪表)温湿度上下限已同步修改成功!");
                        }
                    }
                    else
                    {
                        bool bl = dis.updateWsdByHouseKong(di);
                        if (bl)
                        {
                            if (di.isUsed == 1)
                            {
                                MessageBox.Show(di.name + "  库房下所有的测点(仪表)都已修改为空库测点!");
                            }
                            else
                            {
                                MessageBox.Show(di.name + "  库房下所有的测点(仪表)都已取消空库设定!");
                            }
                        }
                    }
                    this.DialogResult = DialogResult.OK;
                }
            }
        }
示例#9
0
        private void button1_Click(object sender, EventArgs e)
        {
            string name = this.textBox1.Text;

            //验证主机名称是否重复
            service.manageHostService mhs = new service.manageHostService();
            DataTable dt = mhs.queryManageHost();

            DataRow[] drr = dt.Select("hostName = '" + name + "'");
            if (drr.Length > 0)
            {
                MessageBox.Show("主机名称已存在,请重新输入!");
                return;
            }
            string cdnum  = this.numericUpDown1.Value.ToString();
            string cktype = this.comboBox3.SelectedItem.ToString();
            string txxy   = this.comboBox2.SelectedItem.ToString();
            string kflx   = this.comboBox1.SelectedValue.ToString();
            /////////////////////////设置主机信息
            int    RecordM  = int.Parse(this.numericUpDown7.Value.ToString());
            int    WarningM = int.Parse(this.numericUpDown6.Value.ToString());
            string PhoneNo  = this.textBox5.Text.ToString();
            int    State    = 1;

            if (PhoneNo == "" || PhoneNo.Length != 11)
            {
                MessageBox.Show("请输入正确的手机号码!"); return;
            }
            ////////////////////////////////

            if (name != null && !"".Equals(name) && cdnum != null && cktype != null && txxy != null && kflx != null)
            {
                mh = new bean.manageHose();

                bool istrue = false;
                mh.hostName          = name;
                mh.CommunicationType = txxy;
                mh.portNumber        = cdnum;
                mh.storeType         = cktype;
                mh.houseType         = kflx;
                /////////////////////////设置主机信息
                mh.RecordM  = RecordM;
                mh.WarningM = WarningM;
                mh.PhoneNo  = PhoneNo;
                mh.State    = State;
                ////////////////////////////////
                if (this.radioButton1.Checked)
                {
                    mh.hostAddress = this.numericUpDown2.Value.ToString();
                    mh.serialPort  = this.comboBox5.Text;
                    mh.tcp_ip_Port = "";
                    mh.networkType = "COM";
                }
                else if (this.radioButton2.Checked)
                {
                    mh.hostAddress = this.numericUpDown5.Value.ToString();
                    mh.serialPort  = "";
                    mh.tcp_ip_Port = this.textBox3.Text + ":" + this.numericUpDown3.Value.ToString();
                    mh.networkType = "TCP";
                }
                else if (this.radioButton4.Checked)
                {
                    mh.hostAddress = "";
                    mh.serialPort  = "";
                    mh.tcp_ip_Port = "";
                    mh.networkType = "YUN";
                }
                else
                {
                    MessageBox.Show("请选择通讯方式");
                    return;
                }

                if (this.textBox2.Text != null && !"".Equals(this.textBox2.Text))
                {
                    mh.measureCode = this.textBox2.Text;
                    //验证主机主机编号是否重复
                    DataRow[] drr0 = dt.Select("measureCode = '" + mh.measureCode + "'");
                    if (drr0.Length > 0)
                    {
                        MessageBox.Show("主机编号已存在,请重新输入!");
                        return;
                    }
                    //添加主机
                    istrue = mhs.addManageHost(mh);
                }
                else
                {
                    MessageBox.Show("管理主机编号为空,请输入...");
                }
                if (istrue)
                {
                    service.deviceInformationService ds = new service.deviceInformationService();
                    bool isfalse = ds.addDeviceInformation(mh);
                    if (isfalse)
                    {
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
            else
            {
                MessageBox.Show("信息填写不完整,请重新填写!");
            }
        }
示例#10
0
        private void button3_Click(object sender, EventArgs e)
        {
            this.timer1.Stop();
            this.pictureBox1.Controls.Clear();
            string code = this.comboBox1.SelectedValue.ToString();

            service.deviceInformationService dis = new service.deviceInformationService();
            DataTable dt    = dis.queryDeviceByHouseTypeCode(code);
            int       count = dt.Rows.Count;

            if (count > 0)
            {
                labels = new Label[count];//例如10个
                int p = 10;
                for (int x = 0; x < count; x++)
                {
                    string pointx = dt.Rows[x]["pointX"].ToString();
                    string pointy = dt.Rows[x]["pointY"].ToString();
                    labels[x]             = new Label();
                    labels[x].AutoSize    = true;
                    labels[x].Name        = dt.Rows[x]["measureCode"].ToString() + "_" + dt.Rows[x]["meterNo"].ToString();
                    labels[x].Text        = dt.Rows[x]["terminalname"].ToString();
                    labels[x].BorderStyle = BorderStyle.None;
                    labels[x].Font        = new Font(privateFonts.Families[0], 10.0F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(134)));
                    if (pointx != null && !"".Equals(pointx) && pointy != null && !"".Equals(pointy))
                    {
                        labels[x].Location = new Point(Int32.Parse(pointx), Int32.Parse(pointy));
                    }
                    else
                    {
                        if (x < 20)
                        {
                            labels[x].Location = new Point(10, p);
                            p += 45;
                        }
                        else if (x >= 20 && x < 40)
                        {
                            if (x == 20)
                            {
                                p = 10;
                            }
                            ;
                            labels[x].Location = new Point(160, p);
                            p += 45;
                        }
                        else if (x >= 40 && x < 60)
                        {
                            if (x == 40)
                            {
                                p = 10;
                            }
                            ;
                            labels[x].Location = new Point(310, p);
                            p += 45;
                        }
                        else if (x >= 60 && x < 80)
                        {
                            if (x == 60)
                            {
                                p = 10;
                            }
                            ;
                            labels[x].Location = new Point(460, p);
                            p += 45;
                        }
                        else if (x >= 80 && x < 100)
                        {
                            if (x == 80)
                            {
                                p = 10;
                            }
                            ;
                            labels[x].Location = new Point(610, p);
                            p += 45;
                        }
                        else if (x >= 100 && x < 120)
                        {
                            if (x == 100)
                            {
                                p = 10;
                            }
                            ;
                            labels[x].Location = new Point(760, p);
                            p += 45;
                        }
                        else if (x >= 120 && x < 140)
                        {
                            if (x == 120)
                            {
                                p = 10;
                            }
                            ;
                            labels[x].Location = new Point(910, p);
                            p += 45;
                        }
                        else if (x >= 140 && x < 160)
                        {
                            if (x == 140)
                            {
                                p = 10;
                            }
                            ;
                            labels[x].Location = new Point(1060, p);
                            p += 45;
                        }
                        else if (x >= 160 && x < 180)
                        {
                            if (x == 160)
                            {
                                p = 10;
                            }
                            ;
                            labels[x].Location = new Point(1210, p);
                            p += 45;
                        }
                        else if (x >= 180 && x < 200)
                        {
                            if (x == 180)
                            {
                                p = 10;
                            }
                            ;
                            labels[x].Location = new Point(1360, p);
                            p += 45;
                        }
                    }
                    labels[x].MouseMove += new MouseEventHandler(this.label_MouseMove);
                    labels[x].MouseDown += new MouseEventHandler(this.label_MouseDown);
                    this.pictureBox1.Controls.Add(labels[x]);
                }
                flag = true;
            }
            else
            {
                MessageBox.Show("此库房没有对应的测点(仪表),请去测点管理功能中添加或修改测点(仪表)数据!");
            }
        }