Example #1
0
        private void InfoViewCar_Load(object sender, EventArgs e)
        {
            //设置自己的未知
            this.Location = new Point(480 * 2, 0);

            //查询所有站
            BaseOperate op = new BaseOperate();

            String sql = @"SELECT StationID,Name FROM [db_rfidtest].[rfidtest].[dbo.Station]";
            stations = op.getds(sql, "[db_rfidtest].[rfidtest].[dbo.Station]");

            loadData();
        }
Example #2
0
        private void InfoViewSumMain_Load(object sender, EventArgs e)
        {
            try
            {
                this.Location = Screen.AllScreens[MainWindow.locations[4]].WorkingArea.Location;
                this.Size = Screen.AllScreens[MainWindow.locations[4]].WorkingArea.Size;
            }
            catch { }
            try
            {
                int station = 46;
                int car;
                double size = 50.7;
                int people = 1243000;
                double sum = 0;
                double argSize;
                double argPeople;
                ChartData chartdata = new ChartData();
                BaseOperate op = new BaseOperate();
                chartdata.updateData(2, DateTime.Now, 0);

                foreach (double item in chartdata.lastyear)
                {
                    sum += item;
                }
                sum = 344602.75;
                argSize = sum / size;
                argPeople = sum / people;

                String sql = @"SELECT COUNT(*) FROM [db_rfidtest].[rfidtest].[dbo.Driver]";
                DataSet ds = op.getds(sql, "[db_rfidtest].[rfidtest].[dbo.Driver]");
                if (ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0)
                    return;
                car = int.Parse(ds.Tables[0].Rows[0][0].ToString());
                sql = @"SELECT COUNT(*) FROM [db_rfidtest].[rfidtest].[dbo.Station]";
                ds = op.getds(sql, "[db_rfidtest].[rfidtest].[dbo.Station]");
                if (ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0)
                    return;
                station = int.Parse(ds.Tables[0].Rows[0][0].ToString())-2;

                lblStation.Text = "" + station + "个";
                lblCar.Text = "" + car + "辆";
                lblSize.Text = "" + size + "平方公里";
                lblPeople.Text = "" + people + "人";
                lblSum.Text = "" + sum + "吨垃圾";
                lblArgSize.Text = "" + argSize.ToString("f2") + "吨垃圾";
                lblArgPeople.Text = "" + argPeople.ToString("f2") + "吨垃圾";
            }
            catch { }
        }
Example #3
0
        private void InfoViewStateMain_Load(object sender, EventArgs e)
        {
            try
            {
                this.Location = Screen.AllScreens[MainWindow.locations[3]].WorkingArea.Location;
                this.Size = Screen.AllScreens[MainWindow.locations[3]].WorkingArea.Size;

            }
            catch { }
            try
            {
                string sql = "Select name from [dbo.Station] where stationid > 29";
                InfoView.Classes.BaseOperate op = new InfoView.Classes.BaseOperate();
                stations = op.getds(sql, "[dbo.Station]").Tables[0];
            }
            catch { }
            tmrState_Tick(null, null);

            //
        }
Example #4
0
        private void InfoViewCarMain_Load(object sender, EventArgs e)
        {
            this.lblStartTime2.Text = "无";
            this.lblEndTime2.Text = "无";
            //查询所有站
            BaseOperate op = new BaseOperate();

            String sql = @"SELECT StationID,Name FROM [db_rfidtest].[rfidtest].[dbo.Station]";
            stations = op.getds(sql, "[db_rfidtest].[rfidtest].[dbo.Station]");
            curStation = 0;

            loadData();
            loadStationCar();
            try
            {
                this.Location = Screen.AllScreens[MainWindow.locations[0]].WorkingArea.Location;
                Size s = new Size();
                s.Width = Screen.AllScreens[MainWindow.locations[0]].WorkingArea.Size.Width;
                s.Height = Screen.AllScreens[MainWindow.locations[0]].WorkingArea.Size.Height / 2;
                this.Size = s;

            }
            catch
            { }
        }
Example #5
0
        private void loadStationCar()
        {
            try
            {
                if (stations == null || stations.Tables.Count <= 0)
                    return;
                String sql = @"SELECT * FROM [db_rfidtest].[rfidtest].[dbo.goods] WHERE StartStationID = "
                                    + stations.Tables[0].Rows[curStation]["StationID"].ToString() +
                                    " AND ((StartTime > '" + DateTime.Now.ToString("yy-MM-dd") + "' AND StartTime<'" + DateTime.Now.AddDays(1).ToString("yy-MM-dd 00:00") + "') OR (EndTime > '" + DateTime.Now.ToString("yy-MM-dd") + "' AND EndTime<'" + DateTime.Now.AddDays(1).ToString("yy-MM-dd 00:00") + "'))";

                BaseOperate op = new BaseOperate();
                cars = op.getds(sql, "[db_rfidtest].[rfidtest].[dbo.goods]");
                panel2.Invalidate();
                groupBox1.Text = stations.Tables[0].Rows[curStation]["Name"].ToString();
                curStation++;
                if (curStation >= stations.Tables[0].Rows.Count)
                    curStation = 0;
            }
            catch { }
        }
Example #6
0
        private void loadData()
        {
            //第一次查询,查询出最近的一条已到车辆
            String sqlStart = @"SELECT TOP 1 * FROM [db_rfidtest].[rfidtest].[dbo.goods] WHERE
                                    [db_rfidtest].[rfidtest].[dbo.goods].[ENDTIME] is not null ORDER BY ENDTIME DESC";
            BaseOperate operate = new BaseOperate();
            DataSet ds2 = null;
            try
            {
                ds2 = operate.getds(sqlStart, "[db_rfidtest].[rfidtest].[dbo.goods]");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return;
            }
            //第二次查询,查询出最后一次未到车辆
            sqlStart = @"SELECT TOP 1 * FROM [db_rfidtest].[rfidtest].[dbo.goods] WHERE
                              [db_rfidtest].[rfidtest].[dbo.goods].[ENDTIME] is null ORDER BY STARTTIME DESC";
            DataSet ds1 = null;
            try
            {
                ds1 = operate.getds(sqlStart, "[db_rfidtest].[rfidtest].[dbo.goods]");
            }
            catch (Exception e)
            {
                //MessageBox.Show(e.Message);
                return;
            }

            if (ds1.Tables.Count <= 0 || ds1.Tables[0].Rows.Count<=0)
                return;
            if (ds2.Tables.Count <= 0 || ds2.Tables[0].Rows.Count <= 0)
                return;

            //判断上次查询到的数据是否和本次一样
            if (id1 != int.Parse(ds1.Tables[0].Rows[0]["ID"].ToString()))
            {
                try
                {
                    //如果不一样则更改当前数据
                    id1 = int.Parse(ds1.Tables[0].Rows[0]["ID"].ToString());
                    lblCarNo1.Text = ds1.Tables[0].Rows[0]["TruckNo"].ToString();
                    lblStartTime1.Text = DateTime.Parse(ds1.Tables[0].Rows[0]["StartTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                    lblSStation1.Text = getNameById(ds1.Tables[0].Rows[0]["StartStationID"].ToString());
                    lblEStation1.Text = getNameById(ds1.Tables[0].Rows[0]["EndStationID"].ToString()) ;
                    //20121017
                    //lblEStation1.Text = "大屯";
                    Thread t = new Thread(new ParameterizedThreadStart(changeData));
                    t.Start("1");
                }
                catch { }
            }

            if (id2 != int.Parse(ds2.Tables[0].Rows[0]["ID"].ToString()))
            {
                try
                {
                    //如果不一样则更改当前数据
                    id2 = int.Parse(ds2.Tables[0].Rows[0]["ID"].ToString());
                    lblCarNo2.Text = ds2.Tables[0].Rows[0]["TruckNo"].ToString();
                    lblStartTime2.Text = DateTime.Parse(ds2.Tables[0].Rows[0]["StartTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                    lblEndTime2.Text = DateTime.Parse(ds2.Tables[0].Rows[0]["EndTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                    lblSStation2.Text = getNameById(ds2.Tables[0].Rows[0]["StartStationID"].ToString());
                    lblEStation2.Text = getNameById(ds2.Tables[0].Rows[0]["EndStationID"].ToString());
                    lblWeight.Text = ds2.Tables[0].Rows[0]["Weight"].ToString();
                    Thread t = new Thread(new ParameterizedThreadStart(changeData));
                    t.Start("2");
                }
                catch
                { }
            }
        }
Example #7
0
        private void loadData()
        {
            //第一次查询,查询出最近的一条已到车辆
            String sqlStart = @"SELECT TOP 1 * FROM [db_rfidtest].[rfidtest].[dbo.goods] WHERE
                                    [db_rfidtest].[rfidtest].[dbo.goods].[ENDTIME] is not null ORDER BY ENDTIME DESC";
            BaseOperate operate = new BaseOperate();
            DataSet ds2 = null;
            try
            {
                ds2 = operate.getds(sqlStart, "[db_rfidtest].[rfidtest].[dbo.goods]");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return;
            }
            //第二次查询,查询出最后一次未到车辆
            sqlStart = @"SELECT TOP 1 * FROM [db_rfidtest].[rfidtest].[dbo.goods] WHERE
                              [db_rfidtest].[rfidtest].[dbo.goods].[ENDTIME] is null ORDER BY STARTTIME DESC";
            DataSet ds1 = null;
            try
            {
                ds1 = operate.getds(sqlStart, "[db_rfidtest].[rfidtest].[dbo.goods]");
            }
            catch (Exception e)
            {
                //MessageBox.Show(e.Message);
                return;
            }

            if (ds1.Tables.Count <= 0 || ds1.Tables[0].Rows.Count <= 0)
                return;
            if (ds2.Tables.Count <= 0 || ds2.Tables[0].Rows.Count <= 0)
                return;

            //判断上次查询到的数据是否和本次一样
            if (id2 != int.Parse(ds1.Tables[0].Rows[0]["ID"].ToString()))
            {
                try
                {
                    //如果不一样则更改当前数据
                    id1 = int.Parse(ds1.Tables[0].Rows[0]["ID"].ToString().Trim());
                    TruckNo1.Text = ds1.Tables[0].Rows[0]["TruckNo"].ToString().Trim();
                    StartTime1.Text = DateTime.Parse(ds1.Tables[0].Rows[0]["StartTime"].ToString()).ToString("HH:mm");
                    StartStation1.Text = getNameById(ds1.Tables[0].Rows[0]["StartStationID"].ToString());
                    EndStation1.Text = getNameById(ds1.Tables[0].Rows[0]["EndStationID"].ToString());
                    if (EndStation1.Text.Trim() == "大屯")
                        EndStation1.Text = "马家楼";
                    else
                        EndStation1.Text = "大屯";
                }
                catch { }
            }

            if (id1 != int.Parse(ds2.Tables[0].Rows[0]["ID"].ToString()))
            {
                try
                {
                    //如果不一样则更改当前数据
                    id2 = int.Parse(ds2.Tables[0].Rows[0]["ID"].ToString());
                    TruckNo2.Text = ds2.Tables[0].Rows[0]["TruckNo"].ToString().Trim();
                    StartTime2.Text = DateTime.Parse(ds2.Tables[0].Rows[0]["StartTime"].ToString()).ToString("HH:mm");
                    EndTime2.Text = DateTime.Parse(ds2.Tables[0].Rows[0]["EndTime"].ToString()).ToString("HH:mm");
                    StartStation2.Text = getNameById(ds2.Tables[0].Rows[0]["StartStationID"].ToString());
                    EndStation2.Text = getNameById(ds2.Tables[0].Rows[0]["EndStationID"].ToString());
                    Weight2.Text = ds2.Tables[0].Rows[0]["Weight"].ToString();
                }
                catch
                { }
            }
        }