Пример #1
0
 /// <summary>
 /// 加载表格设置
 /// </summary>
 private void LoadDataGrid()
 {
     DAL.ZSql sql2 = new DAL.ZSql();
     sql2.Open("select * from T_Custom where CustomType=" + iCustomType.ToString() + " and CmdNum>0 order by CmdNum");
     dataGrid1.ItemsSource = sql2.m_table.DefaultView;
     sql2.Close();
 }
Пример #2
0
 /// <summary>
 /// 加载数据表格
 /// </summary>
 private void LoadDataGrid()
 {
     DAL.ZSql sql2 = new DAL.ZSql();
     sql2.Open("select * from T_Speed where CmdNum > 0");
     dataGrid1.ItemsSource = sql2.m_table.DefaultView;
     sql2.Close();
 }
Пример #3
0
 /// <summary>
 /// 加载表格数据
 /// </summary>
 private void LoadDataGrid()
 {
     DAL.ZSql sql2 = new DAL.ZSql();
     sql2.Open("select * from T_UserInfo");
     dataGrid1.ItemsSource = sql2.m_table.DefaultView;
     sql2.Close();
 }
Пример #4
0
 /// <summary>
 /// 加载表格设置
 /// </summary>
 private void LoadDataGrid()
 {
     DAL.ZSql sql2 = new DAL.ZSql();
     sql2.Open("select * from T_Custom where CustomType=" + iCustomType.ToString() + " and CmdNum>0 order by CmdNum");
     dataGrid1.ItemsSource = sql2.m_table.DefaultView;
     sql2.Close();
 }
Пример #5
0
 private void LoadDataGrid()
 {
     //表格初始化
     DAL.ZSql sqlGrid = new DAL.ZSql();
     sqlGrid.Open("SELECT * FROM T_CallSetting ORDER BY StationNum,MaterialNum");
     dataGrid1.ItemsSource = sqlGrid.m_table.DefaultView;
     sqlGrid.Close();
     //工位号下列框初始化
     DAL.ZSql sqlSN = new DAL.ZSql();
     sqlSN.Open("SELECT DISTINCT StationNum FROM T_CallSetting ORDER BY StationNum");
     cbStation.ItemsSource       = sqlSN.m_table.DefaultView;
     cbStation.DisplayMemberPath = "StationNum";
     cbStation.SelectedValuePath = "StationNum";
     cbStation.SelectedIndex     = 0;
     sqlSN.Close();
     //物料编号下列框初始化
     DAL.ZSql sqlMN = new DAL.ZSql();
     sqlMN.Open("SELECT DISTINCT MaterialNum FROM T_CallSetting ORDER BY MaterialNum");
     cbMaterialNum.ItemsSource       = sqlMN.m_table.DefaultView;
     cbMaterialNum.DisplayMemberPath = "MaterialNum";
     cbMaterialNum.SelectedValuePath = "MaterialNum";
     cbMaterialNum.SelectedIndex     = 0;
     sqlMN.Close();
     //线路加载初始化
     DAL.ZSql sqlRoute = new DAL.ZSql();
     sqlRoute.Open("SELECT DISTINCT LineNum FROM T_Line ORDER BY LineNum");
     cbRoute.ItemsSource       = sqlRoute.m_table.DefaultView;
     cbRoute.DisplayMemberPath = "LineNum";
     cbRoute.SelectedValuePath = "LineNum";
     cbRoute.SelectedIndex     = 0;
     sqlRoute.Close();
 }
Пример #6
0
        protected bool LineInit(int docknum)
        {
            bool flag = false;

            DAL.ZSql lineSql = new DAL.ZSql();
            if (docknum > 0)
            {
                lineSql.Open("Select RouteNum from T_ChargeSetting where ChargeNum=" + docknum + "Order by RouteNum");//升序
                if (lineSql.rowcount > 0)
                {
                    dockCount = lineSql.rowcount;   //确定停车位总数
                    dockLine  = new int[dockCount]; //确定停靠区每个车位的线路
                    for (int i = 0; i < lineSql.rowcount; i++)
                    {
                        if (!string.IsNullOrEmpty(lineSql.Rows[i]["RouteNum"].ToString()))
                        {
                            dockLine[i] = Convert.ToInt32(lineSql.Rows[i]["RouteNum"]);
                        }
                    }
                    flag = true;
                }
                lineSql.Close();
                lineSql.Dispose();
            }
            return(flag);
        }
Пример #7
0
 /// <summary>
 /// 加载数据表格
 /// </summary>
 private void LoadDataGrid()
 {
     DAL.ZSql sql2 = new DAL.ZSql();
     sql2.Open("select * from T_Speed where CmdNum > 0");
     dataGrid1.ItemsSource = sql2.m_table.DefaultView;
     sql2.Close();
 }
Пример #8
0
 /// <summary>
 /// 加载表格数据
 /// </summary>
 private void LoadDataGrid()
 {
     DAL.ZSql sql2 = new DAL.ZSql();
     sql2.Open("select * from T_UserInfo");
     dataGrid1.ItemsSource = sql2.m_table.DefaultView;
     sql2.Close();
 }
Пример #9
0
        /// <summary>
        /// 添加按钮消息响应
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            string strcmdnum      = tbCmdNum.Text.ToString().Trim();
            string strcmdfunction = tbCmdFunction.Text.ToString().Trim();

            if (string.IsNullOrEmpty(strcmdnum) || string.IsNullOrEmpty(strcmdfunction))
            {
                MessageBox.Show("对不起,请同时输入指令和指令功能!");
                return;
            }
            if (Convert.ToInt16(strcmdnum) <= 0 || Convert.ToInt16(strcmdnum) >= 64)
            {
                MessageBox.Show("对不起,请输入指令必须大于0小于64!");
                return;
            }
            sql1.Open("select * from T_Custom where CmdFunction='" + strcmdfunction + "' and CustomType=" + iCustomType.ToString());
            if (sql1.Rows.Count > 0)
            {
                MessageBox.Show("此功能已经存在!");
                return;
            }
            else
            {
                sql1.Open("SELECT MAX(CmdNum) AS MaxNum FROM T_Custom where CustomType=" + iCustomType.ToString());
                if (sql1.Rows.Count > 0)
                {
                    if (!string.IsNullOrEmpty(sql1.Rows[0]["MaxNum"].ToString()))
                    {
                        if ((Convert.ToInt32(sql1.Rows[0]["MaxNum"]) + 1) < Convert.ToInt32(strcmdnum))
                        {
                            MessageBox.Show("对不起,请按顺序输入指令!");
                            return;
                        }
                    }
                }

                sql1.Open("update T_Custom set CmdNum=CmdNum+1 from T_Custom where CustomType=" + iCustomType.ToString() + " and CmdNum>=" + strcmdnum);
                sql1.Open("insert into T_Custom (CmdFunction,CmdNum,CustomType) Values ('" + strcmdfunction + "'," + strcmdnum + "," + iCustomType.ToString() + ")");
                MessageBox.Show("添加指令成功!");
            }
            sql1.Close();
            LoadDataGrid();
            tbCmdNum.Text = (Convert.ToInt32(strcmdnum) + 1).ToString();
            IsModify      = true;
        }
Пример #10
0
 /// <summary>
 /// 增加
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDockAdd_Click(object sender, RoutedEventArgs e)
 {
     if (!Vertify_Input())
     {
         return;
     }
     try
     {
         //验证是否已存在相同的停靠区
         sql.Open("Select * from T_ChargeArea Where ChargeNum=1");
         if (sql.rowcount > 0)
         {
             MessageBox.Show("充电区已存在!");
             return;
         }
         sql.Open("insert into T_ChargeArea (ChargeNum,ChargeSSNum,ChargeSSLine,ChargeESNum,ChargeESLine) Values (1,@chargessnum,@chargessline,@chargeesnum,@chargeesline)",
                  new SqlParameter[] {
             new SqlParameter("chargessnum", cbSMark.Text.Trim()),
             new SqlParameter("chargessline", cbSWorkLine.Text.Trim()),
             new SqlParameter("chargeesnum", cbEMark.Text.Trim()),
             new SqlParameter("chargeesline", cbEWorkLine.Text.Trim())
         });
         sql.Close();
         MessageBox.Show("添加成功!");
         BindParkingNumComboBox(1);
         LoadDataGrid(1);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #11
0
 /// <summary>
 /// 停靠区编号绑定
 /// </summary>
 private void InitDockNum()
 {
     DAL.ZSql sql1 = new DAL.ZSql();
     sql1.Open("select DISTINCT DockNum from T_DockArea order by DockNum");
     cbDockNum.ItemsSource       = sql1.m_table.DefaultView;
     cbDockNum.DisplayMemberPath = "DockNum";
     cbDockNum.SelectedValuePath = "DockNum";
     sql1.Close();
 }
Пример #12
0
 //修改日期:2013-12-1
 /// <summary>
 /// 生产区下拉框绑定
 /// </summary>
 private void BindWorkLineCombox()
 {
     DAL.ZSql sql1 = new DAL.ZSql();
     sql1.Open("Select DISTINCT WorkLine from T_Mark");
     cbWorkLine.ItemsSource       = sql1.m_table.DefaultView;
     cbWorkLine.DisplayMemberPath = "WorkLine";
     cbWorkLine.SelectedValuePath = "WorkLine";
     sql1.Close();
 }
Пример #13
0
 /// <summary>
 /// 交通管制区号绑定
 /// </summary>
 private void BindLineCombox()
 {
     DAL.ZSql sql1 = new DAL.ZSql();
     sql1.Open("select DISTINCT TrafficNum from T_Traffic order by TrafficNum");
     cbTraffic.ItemsSource       = sql1.m_table.DefaultView;
     cbTraffic.DisplayMemberPath = "TrafficNum";
     cbTraffic.SelectedValuePath = "TrafficNum";
     sql1.Close();
 }
Пример #14
0
 /// <summary>
 /// 加载数据表格
 /// </summary>
 /// <param name="paracarid"></param>
 /// <param name="strdate"></param>
 private void LoadDataGrid(int paracarid, string strdate)
 {
     if (paracarid > 0)
     {
         DAL.ZSql sql2 = new DAL.ZSql();
         sql2.Open("select * from T_Ex where CarID=" + paracarid.ToString() + " and ExTimer like '" + strdate + "%' order by ExTimer");
         dataGrid1.ItemsSource = sql2.m_table.DefaultView;
         sql2.Close();
     }
 }
Пример #15
0
 /// <summary>
 /// 路线下拉列表绑定
 /// </summary>
 private void BindRouteComboBox()
 {
     //线路加载初始化
     DAL.ZSql sql1 = new DAL.ZSql();
     sql1.Open("select DISTINCT LineNum from T_Line order by LineNum");
     cbRouteNum.ItemsSource       = sql1.m_table.DefaultView;
     cbRouteNum.DisplayMemberPath = "LineNum";
     cbRouteNum.SelectedValuePath = "LineNum";
     sql1.Close();
 }
Пример #16
0
 /// <summary>
 /// 全部删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDeleteAll_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("确认要删除此全部记录?", "警告", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
     {
         DAL.ZSql sql1 = new DAL.ZSql();
         sql1.Open("delete from T_Ex where CarID=" + carid.ToString() + " and ExTimer like '" + strdate + "%'");
         sql1.Close();
         LoadDataGrid(carid, strdate);
     }
 }
Пример #17
0
 /// <summary>
 /// 路线下拉列表绑定
 /// </summary>
 private void BindRouteComboBox()
 {
     //线路加载初始化
     DAL.ZSql sql1 = new DAL.ZSql();
     sql1.Open("select DISTINCT LineNum from T_Line order by LineNum");
     cbRouteNum.ItemsSource = sql1.m_table.DefaultView;
     cbRouteNum.DisplayMemberPath = "LineNum";
     cbRouteNum.SelectedValuePath = "LineNum";
     sql1.Close();
 }
Пример #18
0
 /// <summary>
 /// 全部删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDeleteAll_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("确认要删除此全部记录?", "警告", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
     {
         DAL.ZSql sql1 = new DAL.ZSql();
         sql1.Open("delete from T_Ex where CarID=" + carid.ToString() + " and ExTimer like '" + strdate + "%'");
         sql1.Close();
         LoadDataGrid(carid, strdate);
     }
 }
Пример #19
0
 /// <summary>
 /// 停车位下拉列表绑定
 /// </summary>
 private void BindParkingNumComboBox(int docknum)
 {
     //停车位编号加载初始化
     DAL.ZSql sql1 = new DAL.ZSql();
     sql1.Open("select DISTINCT ParkingNum from T_DockSetting Where DockNum=@docknum order by ParkingNum",
               new SqlParameter[] { new SqlParameter("@docknum", docknum) });
     cbParkingNum.ItemsSource       = sql1.m_table.DefaultView;
     cbParkingNum.DisplayMemberPath = "ParkingNum";
     cbParkingNum.SelectedValuePath = "ParkingNum";
     sql1.Close();
 }
Пример #20
0
 /// <summary>
 /// 下拉框绑定
 /// </summary>
 private void BindCombox()
 {
     //绑定AGV小车编号
     DAL.ZSql sql1 = new DAL.ZSql();
     sql1.Open("select DISTINCT CarID from T_Ex order by CarID");
     cbCarid.ItemsSource = sql1.m_table.DefaultView;
     cbCarid.DisplayMemberPath = "CarID";
     cbCarid.SelectedValuePath = "CarID";
     sql1.Close();
     //日期绑定到今天的
     cbYear.Text = DateTime.Now.Year.ToString();        //获取年份
 }
Пример #21
0
 /// <summary>
 /// 生产区下拉列表绑定
 /// </summary>
 private void BindWorkLineComboBox()
 {
     DAL.ZSql sql1 = new DAL.ZSql();
     sql1.Open("Select DISTINCT WorkLine from T_Mark");
     cbSWorkLine.ItemsSource = sql1.m_table.DefaultView;
     cbSWorkLine.DisplayMemberPath = "WorkLine";
     cbSWorkLine.SelectedValuePath = "WorkLine";
     cbEWorkLine.ItemsSource = sql1.m_table.DefaultView;
     cbEWorkLine.DisplayMemberPath = "WorkLine";
     cbEWorkLine.SelectedValuePath = "WorkLine";
     sql1.Close();
 }
Пример #22
0
 /// <summary>
 /// 下拉框绑定
 /// </summary>
 private void BindCombox()
 {
     //绑定AGV小车编号
     DAL.ZSql sql1 = new DAL.ZSql();
     sql1.Open("select DISTINCT CarID from T_Ex order by CarID");
     cbCarid.ItemsSource       = sql1.m_table.DefaultView;
     cbCarid.DisplayMemberPath = "CarID";
     cbCarid.SelectedValuePath = "CarID";
     sql1.Close();
     //日期绑定到今天的
     cbYear.Text = DateTime.Now.Year.ToString();        //获取年份
 }
Пример #23
0
 /// <summary>
 /// 增加
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDockAdd_Click(object sender, RoutedEventArgs e)
 {
     if (!Vertify_Input())
     {
         return;
     }
     //验证是否已存在相同的停靠区
     sql.Open("select * from T_DockArea where DockNum=" + cbDockNum.Text.Trim());
     if (sql.rowcount > 0)
     {
         MessageBox.Show("输入的停靠区编号已存在!");
         cbDockNum.Focus();
         return;
     }
     sql.Open("insert into T_DockArea (DockNum,DockSSNum,DockSSLine,DockESNum,DockESLine) Values (@docknum,@dockssnum,@dockssline,@dockesnum,@dockesline)",
              new SqlParameter[] {
         new SqlParameter("docknum", cbDockNum.Text.Trim()),
         new SqlParameter("dockssnum", cbSMark.Text.Trim()),
         new SqlParameter("dockssline", cbSWorkLine.Text.Trim()),
         new SqlParameter("dockesnum", cbEMark.Text.Trim()),
         new SqlParameter("dockesline", cbEWorkLine.Text.Trim())
     });
     sql.Close();
     MessageBox.Show("添加成功!");
     docknum = Convert.ToInt32(cbDockNum.Text.Trim());
     InitDockNum();
     BindParkingNumComboBox(docknum);
     LoadDataGrid(docknum);
 }
Пример #24
0
        private void Loginbutton_Click(object sender, RoutedEventArgs e)
        {
            string UserName = this.UserNametextBox.Text.ToLower().Trim();
            string PassWord = this.passwordBox.Password.ToLower().Trim();

            DAL.ZSql sql = new DAL.ZSql();
            int      i   = sql.Open("select * from T_UserInfo where UserName=@username and Pwd=@password", new SqlParameter[] { new SqlParameter("username", UserName), new SqlParameter("password", PassWord) });

            if (i < 0)
            {
                sql.Close();
                return;
            }
            if (sql.Rows.Count > 0)
            {
                if (sql.Rows[0]["IsManager"].ToString() == "True")
                {
                    GlobalPara.IsManager = true;
                }
                else
                {
                    GlobalPara.IsManager = false;
                }
                GlobalPara.strName = UserName;
                GlobalPara.userid  = sql.Rows[0]["ID"].ToString();
                sql.Close();
                MainWindow mn = new MainWindow();
                mn.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("用户名或密码错误,请检查", "警告");
                this.UserNametextBox.Clear();
                this.passwordBox.Clear();
                this.UserNametextBox.Focus();
            }
            sql.Close();
        }
Пример #25
0
 private void btnAdd_Click(object sender, RoutedEventArgs e)
 {
     GetAllInfo();
     if (!VertifyInput(new String[] { strstation, strmaterialnum, strroute, streachnum, strinfo }))
     {
         MessageBox.Show("对不起,您输入的信息不全,添加失败!");
         return;
     }
     sql1.Open("select * from T_CallSetting where StationNum=@stationnum and MaterialNum=@materialnum", new SqlParameter[] {
         new SqlParameter("@stationnum", strstation),
         new SqlParameter("@materialnum", strmaterialnum)
     });
     if (sql1.Rows.Count > 0)
     {
         MessageBox.Show("该工位物料编号已经存在!请重新输入。");
     }
     else
     {
         try
         {
             sql1.Open("insert into T_CallSetting (StationNum, MaterialNum, LineNum, EachNum, MaterialName) Values (@stationnum,@materialnum,@linenum,@eachnum,@materialname)",
                       new SqlParameter[] {
                 new SqlParameter("@stationnum", strstation),
                 new SqlParameter("@materialnum", strmaterialnum),
                 new SqlParameter("@linenum", strroute),
                 new SqlParameter("@eachnum", streachnum),
                 new SqlParameter("@materialname", strinfo)
             });
             MessageBox.Show("添加记录成功!");
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     sql1.Close();
     LoadDataGrid();
 }
Пример #26
0
 private void Loginbutton_Click(object sender, RoutedEventArgs e)
 {
     string UserName = this.UserNametextBox.Text.ToLower().Trim();
     string PassWord = this.passwordBox.Password.ToLower().Trim();
     DAL.ZSql sql = new DAL.ZSql();
     int i = sql.Open("select * from T_UserInfo where UserName=@username and Pwd=@password", new SqlParameter[] { new SqlParameter("username", UserName), new SqlParameter("password", PassWord) });
     if (i < 0)
     {
         sql.Close();
         return;
     }
     if (sql.Rows.Count > 0)
     {
         if (sql.Rows[0]["IsManager"].ToString() == "True")
         {
             GlobalPara.IsManager = true;
         }
         else
         {
             GlobalPara.IsManager = false;
         }
         GlobalPara.strName = UserName;
         GlobalPara.userid = sql.Rows[0]["ID"].ToString();
         sql.Close();
         MainWindow mn = new MainWindow();
         mn.Show();
         this.Close();
     }
     else
     {
         MessageBox.Show("用户名或密码错误,请检查", "警告");
         this.UserNametextBox.Clear();
         this.passwordBox.Clear();
         this.UserNametextBox.Focus();
     }
     sql.Close();
 }
Пример #27
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            string strcarid    = tbCarID.Text.ToString().Trim();
            string strworkline = tbWorkline.Text.ToString().Trim();

            if (string.IsNullOrEmpty(strworkline) || string.IsNullOrEmpty(strcarid))
            {
                MessageBox.Show("对不起,请同时输入生产区和小车编号!");
                return;
            }
            sql1.Open("select * from T_WorkLine where CarID=" + strcarid);
            if (sql1.Rows.Count > 0)
            {
                MessageBox.Show("此AGV已经存在!");
                return;
            }
            else
            {
                sql1.Open("insert into T_WorkLine (CarID,WorkLine) Values (" + strcarid + "," + strworkline + ")");
                MessageBox.Show("添加AGV生产区成功!");
            }
            sql1.Close();
            LoadDataGrid();
        }
Пример #28
0
        /// <summary>
        /// 删除交通管制区
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDeleteTraffic_Click(object sender, RoutedEventArgs e)
        {
            string trafficnum = cbTraffic.Text.ToString().Trim();

            if (string.IsNullOrEmpty(trafficnum))
            {
                MessageBox.Show("请输要删除的交通管制区号!");
                cbTraffic.Focus();
                return;
            }
            sql1.Open("select * from T_Traffic where TrafficNum=" + trafficnum);
            if (sql1.Rows.Count <= 0)
            {
                MessageBox.Show("不存在此交通管制区号!");
                return;
            }
            if (MessageBox.Show("确认要删除此管制区?", "警告", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
            {
                sql1.Open("delete T_Traffic where TrafficNum=" + trafficnum);
                MessageBox.Show("删除交通管制区号成功!");
                BindLineCombox();
            }
            sql1.Close();
        }
Пример #29
0
 private void BindComboBox()
 {
     //修改日期:2013-12-1        
     for (int i = 0; i < AGVNUM_MAX; i++)
     {
         tbCarID.Items.Add((i+1).ToString());
     }
     //修改日期:2013-12-1
     DAL.ZSql sql2 = new DAL.ZSql();
     sql2.Open("Select DISTINCT WorkLine from T_Mark");
     tbWorkline.ItemsSource = sql2.m_table.DefaultView;
     tbWorkline.DisplayMemberPath = "WorkLine";
     tbWorkline.SelectedValuePath = "WorkLine";
     sql2.Close();
 }
Пример #30
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            string strspeedgrade = tbSpeedgrade.Text.ToString().Trim();
            string strspeed      = tbSpeed.Text.ToString().Trim();

            if (string.IsNullOrEmpty(strspeedgrade) || string.IsNullOrEmpty(strspeed))
            {
                MessageBox.Show("对不起,请同时输入速度等级和速度!");
                return;
            }
            sql1.Open("select * from T_Speed where SpeedGrade='" + strspeedgrade + "'");
            if (sql1.Rows.Count > 0)
            {
                MessageBox.Show("此速度等级已经存在!");
                return;
            }
            else
            {
                sql1.Open("insert into T_Speed (SpeedGrade,Speed) Values ('" + strspeedgrade + "'," + strspeed + ")");
                MessageBox.Show("添加速度等级成功!");
            }
            sql1.Close();
            LoadDataGrid();
        }
Пример #31
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnModify_Click(object sender, RoutedEventArgs e)
        {
            string strusername = tbUserName.Text.ToString().Trim().ToLower();
            string strpwd      = tbPwd.Text.ToString().Trim().ToLower();
            int    bismanage   = cbUserType.Text.Trim() == "管理员" ? 1 : 0;

            if (string.IsNullOrEmpty(strusername) || string.IsNullOrEmpty(strpwd))
            {
                MessageBox.Show("对不起,请同时输入用户名和密码!");
                return;
            }
            sql1.Open("select * from T_UserInfo where UserName='******'");
            if (sql1.Rows.Count == 0)
            {
                MessageBox.Show("此用户名不存在!");
            }
            else
            {
                sql1.Open("update T_UserInfo set Pwd='" + strpwd + "',IsManager=" + bismanage.ToString() + " where ID=" + id.ToString());
                MessageBox.Show("修改成功!");
            }
            sql1.Close();
            LoadDataGrid();
        }
Пример #32
0
 private void BindComboBox()
 {
     //修改日期:2013-12-1
     for (int i = 0; i < AGVNUM_MAX; i++)
     {
         tbCarID.Items.Add((i + 1).ToString());
     }
     //修改日期:2013-12-1
     DAL.ZSql sql2 = new DAL.ZSql();
     sql2.Open("Select DISTINCT WorkLine from T_Mark");
     tbWorkline.ItemsSource       = sql2.m_table.DefaultView;
     tbWorkline.DisplayMemberPath = "WorkLine";
     tbWorkline.SelectedValuePath = "WorkLine";
     sql2.Close();
 }
Пример #33
0
 /// <summary>
 /// 加载表格
 /// </summary>
 /// <param name="paradocknum">停靠区编号</param>
 private void LoadDataGrid(int paradocknum)
 {
     if (paradocknum > 0)
     {
         DAL.ZSql sql1 = new DAL.ZSql();
         sql1.Open("select * from T_DockSetting where DockNum=" + Convert.ToString(paradocknum) + " order by ParkingNum");
         dataGrid1.ItemsSource = sql1.m_table.DefaultView;
         sql1.Close();
         DAL.ZSql sql2 = new DAL.ZSql();
         sql2.Open("select * from T_DockArea where DockNum=" + Convert.ToString(paradocknum));
         dataGrid2.ItemsSource = sql2.m_table.DefaultView;
         sql2.Close();
         docknum = paradocknum;
     }
     else
     {
         dataGrid1.ItemsSource = null;
         dataGrid2.ItemsSource = null;
     }
 }
Пример #34
0
        //private delegate void AddCallMemberEvent(AGV_CALLMember si);
        //private delegate void DeleteCallMemberEvent(AGV_CALLMember si);

        public bool Add(int stationnum, int materialnum)
        {
            bool flag = false;

            if (stationnum > 0 && materialnum > 0)
            {
                DAL.ZSql callSql = new DAL.ZSql();
                bool     bFind   = memberData.Any <AGV_CALLMember>(p => p.iStationNum == stationnum && p.iMaterialNum == materialnum);
                if (!bFind)
                {
                    AGV_CALLMember DisMember = new AGV_CALLMember();
                    DisMember.iNO          = memberData.Count + 1;
                    DisMember.dtTime       = new DateTime();
                    DisMember.iStationNum  = stationnum;
                    DisMember.iMaterialNum = materialnum;
                    callSql.Open("Select * from T_CallSetting where StationNum=" + stationnum.ToString() + " and MaterialNum=" + materialnum);
                    if (callSql.rowcount > 0)
                    {
                        DisMember.sMaterialName = callSql.Rows[0]["MaterialName"].ToString();
                        DisMember.iLineNum      = Convert.ToInt16(callSql.Rows[0]["LineNum"]);
                        lineNum.Add(DisMember.iLineNum);
                        flag = true;
                    }
                    callSql.Close();

                    /*********************************
                     * http://blog.csdn.net/luminji/article/details/5353644
                     * 典型应用场景:WPF页面程序中,ListView的ItemsSource是一个ObservableCollection<StudentInfo>;
                     * 操作:另起一个线程,为ListView动态更新数据,也就是给ObservableCollection<StudentInfo>添加记录。
                     * 这类操作,就是跨线程访问线程安全的数据,如果不使用Dispatcher,就会导致出错“该类型的CollectionView
                     * 不支持从调度程序线程以外的线程对其SourceCollection”。
                     **********************************/
                    //Dispatcher.Invoke(new AddCallMemberEvent(this.AddCallMember), DisMember);
                    AddCallMember(DisMember);
                }
            }
            return(flag);
        }
Пример #35
0
        /// <summary>
        /// 加载地标
        /// </summary>
        private void LoadAllMark()
        {
            DAL.ZSql sql1 = new DAL.ZSql();
            sql1.Open("select * from T_Mark Order by WorkLine,Mark");
            //加载地图中地标
            canvas.Children.Clear();
            double x = 0, y = 0;

            for (int i = 0; i < sql1.Rows.Count; i++)
            {
                x = Convert.ToDouble(sql1.Rows[i]["XPos"]);
                y = Convert.ToDouble(sql1.Rows[i]["YPos"]);
                Ellipse markellipse = new Ellipse();
                markellipse.Height  = MarkDiameter;
                markellipse.Width   = MarkDiameter;
                markellipse.ToolTip = sql1.Rows[i]["ID"].ToString() + "\r\nWorkLine:" + sql1.Rows[i]["WorkLine"].ToString() + "  Mark:" + sql1.Rows[i]["Mark"];
                Canvas.SetLeft(markellipse, x - MarkDiameter / 2);
                Canvas.SetTop(markellipse, y - MarkDiameter / 2);
                //设置虚拟点颜色
                if (Convert.ToBoolean(sql1.Rows[i]["VirtualMark"]))
                {
                    markellipse.Fill = IsVirtualMark;
                }
                else
                {
                    markellipse.Fill = NotVirtualMark;
                    Label marklable = new Label();
                    marklable.FontSize   = 10;
                    marklable.Foreground = Brushes.Black;
                    marklable.Content    = sql1.Rows[i]["ID"].ToString();
                    Canvas.SetLeft(marklable, x - 14);
                    Canvas.SetTop(marklable, y - 20);
                    canvas.Children.Add(marklable);
                }
                canvas.Children.Add(markellipse);
            }
            sql1.Close();
        }
Пример #36
0
        protected bool DockInit(int docknum)
        {
            bool flag = false;

            DAL.ZSql dockSql = new DAL.ZSql();
            if (docknum > 0)
            {
                dockSql.Open("Select * from T_DockArea where DockNum=" + docknum.ToString());
                if (dockSql.rowcount > 0)
                {
                    dockNum            = docknum;
                    dockName           = dockSql.Rows[0]["DockName"].ToString();
                    dockStartStop.Num  = Convert.ToInt32(dockSql.Rows[0]["DockSSNum"]);
                    dockEndStop.Num    = Convert.ToInt32(dockSql.Rows[0]["DockESNum"]);
                    dockStartStop.Line = Convert.ToInt32(dockSql.Rows[0]["DockSSLine"]);
                    dockEndStop.Line   = Convert.ToInt32(dockSql.Rows[0]["DockESLine"]);
                    flag = true;
                }
                dockSql.Close();
                dockSql.Dispose();
            }
            return(flag);
        }
Пример #37
0
        /// <summary>
        /// 加载数据表格
        /// </summary>
        /// <param name="paratrafficnum">交通管制编号</param>
        private void LoadDataGrid(string paratrafficnum)
        {
            DAL.ZSql sql2 = new DAL.ZSql();
            sql2.Open("select T_Traffic.ID,T_Traffic.TrafficNum,T_Traffic.MarkID,T_Mark.XPos,T_Mark.YPos,T_Mark.ID,T_Mark.WorkLine,T_Mark.Mark from T_Traffic left join T_Mark on T_Mark.ID=T_Traffic.MarkID where TrafficNum=" + paratrafficnum);
            canvas.Children.Clear();
            LoadAllMark();
            double x, y;

            for (int i = 0; i < sql2.Rows.Count; i++)
            {
                if (!string.IsNullOrEmpty(sql2.Rows[i]["MarkID"].ToString()) && !string.IsNullOrEmpty(sql2.Rows[i]["XPos"].ToString()) && !string.IsNullOrEmpty(sql2.Rows[i]["YPos"].ToString()))
                {
                    x = Convert.ToDouble(sql2.Rows[i]["XPos"]);
                    y = Convert.ToDouble(sql2.Rows[i]["YPos"]);
                    Ellipse markellipse = new Ellipse();
                    markellipse.Height  = MarkDiameter + 2;
                    markellipse.Width   = MarkDiameter + 2;
                    markellipse.Fill    = TrafficColor;
                    markellipse.ToolTip = "MarkID:" + sql2.Rows[i]["MarkID"].ToString() + "\r\nWorkLine:" + sql2.Rows[i]["WorkLine"].ToString() + "  Mark:" + sql2.Rows[i]["Mark"];
                    Canvas.SetLeft(markellipse, x - MarkDiameter / 2);
                    Canvas.SetTop(markellipse, y - MarkDiameter / 2);

                    Label marklable = new Label();
                    marklable.FontSize   = 10;
                    marklable.Foreground = TrafficColor;
                    marklable.Content    = sql2.Rows[i]["MarkID"].ToString();
                    Canvas.SetLeft(marklable, x - 14);
                    Canvas.SetTop(marklable, y - 20);

                    canvas.Children.Add(markellipse);
                    canvas.Children.Add(marklable);
                }
            }
            dataGrid1.ItemsSource = sql2.m_table.DefaultView;
            sql2.Close();
        }
Пример #38
0
        //private delegate void AddCallMemberEvent(AGV_CALLMember si);
        //private delegate void DeleteCallMemberEvent(AGV_CALLMember si);

        public bool Add(int stationnum, int materialnum)
        {
            bool flag = false;
            if (stationnum > 0 && materialnum > 0)
            {
                DAL.ZSql callSql = new DAL.ZSql();
                bool bFind = memberData.Any<AGV_CALLMember>(p => p.iStationNum == stationnum && p.iMaterialNum == materialnum);
                if (!bFind)
                {
                    AGV_CALLMember DisMember = new AGV_CALLMember();
                    DisMember.iNO = memberData.Count + 1;
                    DisMember.dtTime = new DateTime();
                    DisMember.iStationNum = stationnum;
                    DisMember.iMaterialNum = materialnum;
                    callSql.Open("Select * from T_CallSetting where StationNum=" + stationnum.ToString() + " and MaterialNum=" + materialnum);
                    if (callSql.rowcount > 0)
                    {
                        DisMember.sMaterialName = callSql.Rows[0]["MaterialName"].ToString();
                        DisMember.iLineNum = Convert.ToInt16(callSql.Rows[0]["LineNum"]);
                        lineNum.Add(DisMember.iLineNum);
                        flag = true;
                    }
                    callSql.Close();
                    /*********************************
                     http://blog.csdn.net/luminji/article/details/5353644
                    典型应用场景:WPF页面程序中,ListView的ItemsSource是一个ObservableCollection<StudentInfo>;
                    操作:另起一个线程,为ListView动态更新数据,也就是给ObservableCollection<StudentInfo>添加记录。
                    这类操作,就是跨线程访问线程安全的数据,如果不使用Dispatcher,就会导致出错“该类型的CollectionView
                    不支持从调度程序线程以外的线程对其SourceCollection”。
                    **********************************/
                    //Dispatcher.Invoke(new AddCallMemberEvent(this.AddCallMember), DisMember);
                    AddCallMember(DisMember);
                }
            }
            return flag;
        }
Пример #39
0
        /// <summary>
        /// 加载数据表格
        /// </summary>
        /// <param name="paratrafficnum">交通管制编号</param>
        private void LoadDataGrid(string paratrafficnum)
        {
            DAL.ZSql sql2 = new DAL.ZSql();
            sql2.Open("select T_Traffic.ID,T_Traffic.TrafficNum,T_Traffic.MarkID,T_Mark.XPos,T_Mark.YPos,T_Mark.ID,T_Mark.WorkLine,T_Mark.Mark from T_Traffic left join T_Mark on T_Mark.ID=T_Traffic.MarkID where TrafficNum=" + paratrafficnum);
            canvas.Children.Clear();
            LoadAllMark();
            double x, y;
            for (int i = 0; i < sql2.Rows.Count; i++)
            {
                if (!string.IsNullOrEmpty(sql2.Rows[i]["MarkID"].ToString()) && !string.IsNullOrEmpty(sql2.Rows[i]["XPos"].ToString()) && !string.IsNullOrEmpty(sql2.Rows[i]["YPos"].ToString()))
                {
                    x = Convert.ToDouble(sql2.Rows[i]["XPos"]);
                    y = Convert.ToDouble(sql2.Rows[i]["YPos"]);
                    Ellipse markellipse = new Ellipse();
                    markellipse.Height = MarkDiameter + 2;
                    markellipse.Width = MarkDiameter + 2;
                    markellipse.Fill = TrafficColor;
                    markellipse.ToolTip = "MarkID:" + sql2.Rows[i]["MarkID"].ToString() + "\r\nWorkLine:" + sql2.Rows[i]["WorkLine"].ToString() + "  Mark:" + sql2.Rows[i]["Mark"];
                    Canvas.SetLeft(markellipse, x - MarkDiameter/2);
                    Canvas.SetTop(markellipse, y - MarkDiameter/2);

                    Label marklable = new Label();
                    marklable.FontSize = 10;
                    marklable.Foreground = TrafficColor;
                    marklable.Content = sql2.Rows[i]["MarkID"].ToString();
                    Canvas.SetLeft(marklable, x - 14);
                    Canvas.SetTop(marklable, y - 20);

                    canvas.Children.Add(markellipse);
                    canvas.Children.Add(marklable);
                }
            }
            dataGrid1.ItemsSource = sql2.m_table.DefaultView;
            sql2.Close();
        }
Пример #40
0
 /// <summary>
 /// 停靠区编号绑定
 /// </summary>
 private void InitDockNum()
 {
     DAL.ZSql sql1 = new DAL.ZSql();
     sql1.Open("select DISTINCT DockNum from T_DockArea order by DockNum");
     cbDockNum.ItemsSource = sql1.m_table.DefaultView;
     cbDockNum.DisplayMemberPath = "DockNum";
     cbDockNum.SelectedValuePath = "DockNum";
     sql1.Close();
 }
Пример #41
0
 /// <summary>
 /// 停车位下拉列表绑定
 /// </summary>
 private void BindParkingNumComboBox(int docknum)
 {
     //停车位编号加载初始化
     DAL.ZSql sql1 = new DAL.ZSql();
     sql1.Open("select DISTINCT ParkingNum from T_DockSetting Where DockNum=@docknum order by ParkingNum",
         new SqlParameter[] { new SqlParameter("@docknum", docknum) });
     cbParkingNum.ItemsSource = sql1.m_table.DefaultView;
     cbParkingNum.DisplayMemberPath = "ParkingNum";
     cbParkingNum.SelectedValuePath = "ParkingNum";
     sql1.Close();
 }
Пример #42
0
 /// <summary>
 /// 交通管制区号绑定
 /// </summary>
 private void BindLineCombox()
 {
     DAL.ZSql sql1 = new DAL.ZSql();
     sql1.Open("select DISTINCT TrafficNum from T_Traffic order by TrafficNum");
     cbTraffic.ItemsSource = sql1.m_table.DefaultView;
     cbTraffic.DisplayMemberPath = "TrafficNum";
     cbTraffic.SelectedValuePath = "TrafficNum";
     sql1.Close();
 }
Пример #43
0
 private void LoadDataGrid()
 {
     //表格初始化
     DAL.ZSql sqlGrid = new DAL.ZSql();
     sqlGrid.Open("SELECT * FROM T_CallSetting ORDER BY StationNum,MaterialNum");
     dataGrid1.ItemsSource = sqlGrid.m_table.DefaultView;
     sqlGrid.Close();
     //工位号下列框初始化
     DAL.ZSql sqlSN = new DAL.ZSql();
     sqlSN.Open("SELECT DISTINCT StationNum FROM T_CallSetting ORDER BY StationNum");
     cbStation.ItemsSource = sqlSN.m_table.DefaultView;
     cbStation.DisplayMemberPath = "StationNum";
     cbStation.SelectedValuePath = "StationNum";
     cbStation.SelectedIndex = 0;
     sqlSN.Close();
     //物料编号下列框初始化
     DAL.ZSql sqlMN = new DAL.ZSql();
     sqlMN.Open("SELECT DISTINCT MaterialNum FROM T_CallSetting ORDER BY MaterialNum");
     cbMaterialNum.ItemsSource = sqlMN.m_table.DefaultView;
     cbMaterialNum.DisplayMemberPath = "MaterialNum";
     cbMaterialNum.SelectedValuePath = "MaterialNum";
     cbMaterialNum.SelectedIndex = 0;
     sqlMN.Close();
     //线路加载初始化
     DAL.ZSql sqlRoute = new DAL.ZSql();
     sqlRoute.Open("SELECT DISTINCT LineNum FROM T_Line ORDER BY LineNum");
     cbRoute.ItemsSource = sqlRoute.m_table.DefaultView;
     cbRoute.DisplayMemberPath = "LineNum";
     cbRoute.SelectedValuePath = "LineNum";
     cbRoute.SelectedIndex = 0;
     sqlRoute.Close();
 }
Пример #44
0
 /// <summary>
 /// 加载表格
 /// </summary>
 /// <param name="paradocknum">停靠区编号</param>
 private void LoadDataGrid(int paradocknum)
 {
     if (paradocknum > 0)
     {
         DAL.ZSql sql1 = new DAL.ZSql();
         sql1.Open("select * from T_DockSetting where DockNum=" + Convert.ToString(paradocknum) + " order by ParkingNum");
         dataGrid1.ItemsSource = sql1.m_table.DefaultView;
         sql1.Close();
         DAL.ZSql sql2 = new DAL.ZSql();
         sql2.Open("select * from T_DockArea where DockNum=" + Convert.ToString(paradocknum));
         dataGrid2.ItemsSource = sql2.m_table.DefaultView;
         sql2.Close();
         docknum = paradocknum;
     }
     else
     {
         dataGrid1.ItemsSource = null; 
         dataGrid2.ItemsSource = null;
     }
 }
Пример #45
0
 /// <summary>
 /// 加载数据表格
 /// </summary>
 /// <param name="paracarid"></param>
 /// <param name="strdate"></param>
 private void LoadDataGrid(int paracarid, string strdate)
 {
     if (paracarid > 0)
     {
         DAL.ZSql sql2 = new DAL.ZSql();
         sql2.Open("select * from T_Ex where CarID=" + paracarid.ToString() + " and ExTimer like '" + strdate + "%' order by ExTimer");
         dataGrid1.ItemsSource = sql2.m_table.DefaultView;
         sql2.Close();
     }
 }
Пример #46
0
 protected bool LineInit(int docknum)
 {
     bool flag = false;
     DAL.ZSql lineSql = new DAL.ZSql();
     if (docknum > 0)
     {
         lineSql.Open("Select RouteNum from T_DockSetting where DockNum=" + docknum + "Order by RouteNum");//升序
         if (lineSql.rowcount > 0)
         {
             dockCount = lineSql.rowcount;//确定停车位总数
             dockLine = new int[dockCount];//确定停靠区每个车位的线路
             outDockLine = new int[dockCount];
             for (int i = 0; i < lineSql.rowcount; i++)
             {
                 if (!string.IsNullOrEmpty(lineSql.Rows[i]["RouteNum"].ToString()))
                 {
                     dockLine[i] = Convert.ToInt32(lineSql.Rows[i]["RouteNum"]);
                 }
             }
             flag = true;
         }
         lineSql.Close();
         lineSql.Dispose();
     }
     return flag;
 }
Пример #47
0
 protected bool DockInit(int docknum)
 {
     bool flag = false;
     DAL.ZSql dockSql = new DAL.ZSql();
     if (docknum > 0)
     {
         dockSql.Open("Select * from T_DockArea where DockNum=" + docknum.ToString());
         if (dockSql.rowcount > 0)
         {
             dockNum = docknum;
             dockName = dockSql.Rows[0]["DockName"].ToString();
             dockStartStop.Num = Convert.ToInt32(dockSql.Rows[0]["DockSSNum"]);
             dockEndStop.Num = Convert.ToInt32(dockSql.Rows[0]["DockESNum"]);
             dockStartStop.Line = Convert.ToInt32(dockSql.Rows[0]["DockSSLine"]);
             dockEndStop.Line = Convert.ToInt32(dockSql.Rows[0]["DockESLine"]);
             flag = true;
         }
         dockSql.Close();
         dockSql.Dispose();
     }
     return flag;
 }
Пример #48
0
 /// <summary>
 /// 加载地标
 /// </summary>
 private void LoadAllMark()
 {
     DAL.ZSql sql1 = new DAL.ZSql();
     sql1.Open("select * from T_Mark Order by WorkLine,Mark");
     //加载地图中地标
     canvas.Children.Clear();
     double x = 0, y = 0;
     for (int i = 0; i < sql1.Rows.Count; i++)
     {
         x = Convert.ToDouble(sql1.Rows[i]["XPos"]);
         y = Convert.ToDouble(sql1.Rows[i]["YPos"]);
         Ellipse markellipse = new Ellipse();
         markellipse.Height = MarkDiameter;
         markellipse.Width = MarkDiameter;
         markellipse.ToolTip = sql1.Rows[i]["ID"].ToString() + "\r\nWorkLine:" + sql1.Rows[i]["WorkLine"].ToString() + "  Mark:" + sql1.Rows[i]["Mark"];
         Canvas.SetLeft(markellipse, x - MarkDiameter/2);
         Canvas.SetTop(markellipse, y - MarkDiameter/2);
         //设置虚拟点颜色
         if (Convert.ToBoolean(sql1.Rows[i]["VirtualMark"]))
         {
             markellipse.Fill = IsVirtualMark;
         }
         else
         {
             markellipse.Fill = NotVirtualMark;
             Label marklable = new Label();
             marklable.FontSize = 10;
             marklable.Foreground = Brushes.Black;
             marklable.Content = sql1.Rows[i]["ID"].ToString();
             Canvas.SetLeft(marklable, x - 14);
             Canvas.SetTop(marklable, y - 20);
             canvas.Children.Add(marklable);
         }
         canvas.Children.Add(markellipse);
     }
      sql1.Close();
 }