Exemple #1
0
        /// <summary>
        /// 查找关联Tag
        /// </summary>
        /// <param name="Time"></param>
        /// <param name="TagNu"></param>
        public void TagClick(long Time, int TagNu, DataGrid grid, DataTable dt, bool type)
        {
            bool exists = false;

            if (GetTags != null)
            {
                foreach (string item in GetTags)
                {
                    if (!item.Equals("N/A"))//排除第一个空值(N/A)
                    {
                        if (Convert.ToInt32(item).Equals(TagNu))
                        {
                            exists = true;
                        }
                    }
                }
            }
            if (exists || GetTags == null)
            {
                map.TagFormer();                                                     //所有Tag还原为原色
                OperateDBBLL operate = new OperateDBBLL();
                string[]     taglis  = operate.SelectTagArr(Time, TagNu.ToString()); //查询关联Tag
                GetTags = taglis;
                AddTagInfo(grid, dt, TagNu, taglis, type);
            }
        }
        /// <summary>
        /// 加载初始数据
        /// </summary>
        private void TagLoad()
        {
            map.TagFormer();//所有Tag还原为原色
            OperateDBBLL operate = new OperateDBBLL();
            Label        label   = MapInstrument.valuePairs[Convert.ToInt32(arrlist[0].ToString())];

            label.Background = new SolidColorBrush(Colors.Red);                   //选中Tag标记为红色
            string[] taglis = operate.SelectTagArr(Times, arrlist[0].ToString()); //查询关联Tag
            for (int i = 0; i < taglis.Length; i++)                               //关联Tag标记绿色
            {
                if (!i.Equals(0))                                                 //排除第一个空值(N/A)
                {
                    MapInstrument.valuePairs[Convert.ToInt32(taglis[i].ToString())].Background = new SolidColorBrush(Colors.Green);
                }
            }

            #region 赋初始值
            TagName.Text                 = "Tag" + arrlist[0].ToString();
            PreTagList.ItemsSource       = taglis;
            PreLeftTagList.ItemsSource   = taglis;
            PreRightTagList.ItemsSource  = taglis;
            NextTagList.ItemsSource      = taglis;
            NextLeftTagList.ItemsSource  = taglis;
            NextRightTagList.ItemsSource = taglis;
            SpeedLIst.ItemsSource        = TagCompile.agvSpeed;
            SpeedRevLis.ItemsSource      = TagCompile.agvSpeed;
            StopTime.Text                = arrlist[9].ToString();
            Pbslist.ItemsSource          = TagCompile.agvPbs;
            PbsRevlist.ItemsSource       = TagCompile.agvPbs;
            TagTerminal.Text             = arrlist[12].ToString();
            #endregion


            #region 更新值
            PreTagList.Text       = arrlist[1].ToString();
            PreLeftTagList.Text   = arrlist[2].ToString();
            PreRightTagList.Text  = arrlist[3].ToString();
            NextTagList.Text      = arrlist[4].ToString();
            NextLeftTagList.Text  = arrlist[5].ToString();
            NextRightTagList.Text = arrlist[6].ToString();
            SpeedLIst.Text        = arrlist[7].ToString();
            SpeedRevLis.Text      = arrlist[8].ToString();
            Pbslist.Text          = arrlist[10].ToString();
            PbsRevlist.Text       = arrlist[11].ToString();
            #endregion

            GetScroll.ScrollToHorizontalOffset(label.Margin.Left - 600); //滚动条X轴跟随移动
            GetScroll.ScrollToVerticalOffset(label.Margin.Top - 500);    ///滚动条Y轴等随移动
        }
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            OperateDBBLL operate = new OperateDBBLL();

            DataTable dr = new DataTable();

            for (int i = 0; i < Beacon.Columns.Count; i++)
            {
                DataColumn dc = new DataColumn();
                dr.Columns.Add(dc);
            }
            for (int i = 0; i < Beacon.Items.Count; i++)
            {
                DataRow dt = dr.NewRow();
                for (int j = 0; j < Beacon.Columns.Count; j++)
                {
                    if (j == 7 || j == 8)
                    {
                        dt[j] = tag.agvSpeedIndex(((DataRowView)Beacon.Items[i])[j].ToString().Trim());
                    }
                    else if (j == 10 || j == 11)
                    {
                        dt[j] = tag.agvPbsIndex(((DataRowView)Beacon.Items[i])[j].ToString().Trim());
                    }
                    else
                    {
                        dt[j] = ((DataRowView)Beacon.Items[i])[j].ToString().Trim();
                    }
                }
                dr.Rows.Add(dt);
            }
            if (operate.UpdateTagDtat(Times, dr))
            {
                MessageBox.Show("保存成功");
            }
            else
            {
                MessageBox.Show("保存失败");
            }
        }
Exemple #4
0
        public void LoadLineTag(List <object> lst, long Times, bool typ, int TagUnm)
        {
            OperateDBBLL operate = new OperateDBBLL();

            if (!typ)
            {
                taglis             = operate.SelectTagArr(Times, TagUnm.ToString()).Where(x => x != "N/A").ToArray();//查询关联Tag
                TagNum.ItemsSource = taglis;
                TagNum.Text        = lst[0].ToString();
            }
            else
            {
                List <string> ls = new List <string>();
                foreach (int item in MapInstrument.valuePairs.Keys)
                {
                    ls.Add(item.ToString());
                }
                TagNum.ItemsSource = ls;
                TagNum.Text        = lst[0].ToString();
            }
            speed.ItemsSource     = TagCompile.agvSpeed;
            PBS.ItemsSource       = TagCompile.agvPbs;
            Turn.ItemsSource      = TagCompile.agvTurn;
            Direction.ItemsSource = TagCompile.agvDire;
            Hook.ItemsSource      = TagCompile.agvHook;
            Time.ItemsSource      = TagCompile.agvTime;


            speed.Text         = lst[1].ToString();
            PBS.Text           = lst[2].ToString();
            Turn.Text          = lst[3].ToString();
            Direction.Text     = lst[4].ToString();
            Hook.Text          = lst[5].ToString();
            Time.Text          = lst[6].ToString();
            ChangeProgram.Text = lst[7].ToString();
        }