Exemplo n.º 1
0
        /// <summary>
        /// 强制移动3D中心坐标
        /// </summary>
        /// <param name="hitPoint"></param>
        //private void MoveControl(Point3D hitPoint)
        //{
        //    ////相机位置
        //    var cameraPostion = this.camera.Position;

        //    ////相机看的方向
        //    var lookDirection = this.camera.LookDirection;

        //    //setCameraPosition(this.camera,
        //    //    new System.Windows.Media.Media3D.Point3D(this.camera.Position.X - hitPoint.X,
        //    //        this.camera.Position.Y - hitPoint.Y, this.camera.Position.Z - hitPoint.Z));

        //    /// 获取相机在3D投影的点
        //    var x = cameraPostion.X + lookDirection.X;
        //    var y = cameraPostion.Y + lookDirection.Y;
        //    var z = cameraPostion.Z + lookDirection.Z;
        //    DoubleAnimation doubleAnimationX = new DoubleAnimation();
        //    doubleAnimationX.BeginTime = new TimeSpan(0, 0, 0);
        //    doubleAnimationX.Duration = TimeSpan.FromMilliseconds(500);
        //    doubleAnimationX.From = this.transform.OffsetX;
        //    doubleAnimationX.To = x - hitPoint.X;

        //    DoubleAnimation doubleAnimationY = new DoubleAnimation();
        //    doubleAnimationY.BeginTime = new TimeSpan(0, 0, 0);
        //    doubleAnimationY.Duration = TimeSpan.FromMilliseconds(500);
        //    doubleAnimationY.From = transform.OffsetY;
        //    doubleAnimationY.To = y - hitPoint.Y;

        //    //DoubleAnimation doubleAnimationZ = new DoubleAnimation();
        //    //doubleAnimationZ.BeginTime = new TimeSpan(0, 0, 0);
        //    //doubleAnimationZ.Duration = TimeSpan.FromMilliseconds(500);
        //    //doubleAnimationZ.From = transform.OffsetZ;
        //    //doubleAnimationZ.To = Math.Abs(hitPoint.Z);

        //    transform.BeginAnimation(TranslateTransform3D.OffsetXProperty, doubleAnimationX);
        //    transform.BeginAnimation(TranslateTransform3D.OffsetYProperty, doubleAnimationY);
        //    //transform.BeginAnimation(TranslateTransform3D.OffsetZProperty, doubleAnimationZ);
        //}

        /// <summary>
        /// 计时器处理事件  抓取库位状态--根据状态维护展示效果  此处暂时提供测试
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer_Tick(object sender, EventArgs e)
        {
            IList <Location> locations = BusinessControler.GetLocations();
            GeometryModel3D  obj       = null;

            if (device3D == null || device3D.Content == null)
            {
                return;
            }
            Model3DGroup m = device3D.Content as Model3DGroup;

            if (m != null && m.Children.Count > 0)
            {
                foreach (Location loc in locations)
                {
                    if (string.IsNullOrEmpty(loc.LocationBind))
                    {
                        continue;
                    }
                    if (m.Children.Where(s => s.GetName() == loc.LocationBind).Count() <= 0)
                    {
                        continue;
                    }
                    obj = m.Children.First(s => s.GetName() == loc.LocationBind) as GeometryModel3D;
                    if (obj != null)
                    {
                        //控制颜色展示
                        Brush b = loc.LocationStatus == "0" ? Brushes.Green : (loc.LocationStatus == "1" ? Brushes.Red : Brushes.Orange);
                        setModelColor(obj, b);
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据当前点击模型  初始化库位展示信息
        /// </summary>
        /// <param name="bindStr"></param>
        public bool InitShow(string bindStr)
        {
            bool initSuccess = true;

            try
            {
                Location loc = BusinessControler.GetLocationInfo(bindStr);
                if (loc == null)
                {
                    throw new Exception("Failed to get location info");
                }
                strListy.Add(loc.HasIn);
                strListy.Add(loc.CanIn);
                pieShow.Children.Clear();
                CreateChartPie("Location:" + loc.LocationNum, strListx, strListy);
                int    i       = 1;
                string showStr = "";
                foreach (Pallet p in loc.LocationMater)
                {
                    showStr += "【" + i.ToString() + "】" + p.PalletNum + ":" + p.PalletMater + "(" + p.PalletQuantiy + ")"
                               + "\r\n" + p.PalletSpec;
                    i++;
                }
                this.showText.Text = showStr;
            }
            catch (Exception)
            {
                initSuccess = false;
            }
            return(initSuccess);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 初始化界面显示
 /// </summary>
 public void InitShow(string id)
 {
     this.textBoxSet.Text = BusinessControler.GetLoctionBind(id);
     if (!string.IsNullOrEmpty(this.textBoxSet.Text.Trim()))
     {
         currLoc = this.textBoxSet.Text;
         flag    = true;
     }
 }
Exemplo n.º 4
0
        private void Set_Click(object sender, RoutedEventArgs e)
        {
            this.viewM.IsChecked = false;
            this.setM.IsChecked  = true;
            mode = ControlMode.Set;
            IList <string>  locs = BusinessControler.GetHasSetList();
            GeometryModel3D obj  = null;

            if (device3D == null || device3D.Content == null)
            {
                return;
            }
            Model3DGroup m = device3D.Content as Model3DGroup;

            if (m != null && m.Children.Count > 0)
            {
                foreach (Object o in m.Children)
                {
                    obj = o as GeometryModel3D;
                    if (obj != null)
                    {
                        if (locs.Contains(obj.GetName()))
                        {
                            setModelColor(obj, Brushes.Red);
                        }
                        else
                        {
                            setModelColor(obj, Brushes.CornflowerBlue);
                        }
                    }
                }
            }
            //foreach (string loc in locs)
            //{
            //    if (string.IsNullOrEmpty(loc))
            //    {
            //        continue;
            //    }
            //    obj = this.viewport.FindName(loc) as GeometryModel3D;
            //    if (obj != null)
            //    {
            //        setModelColor(obj, Brushes.Red);
            //    }
            //}
            //Close();
        }
Exemplo n.º 5
0
        private void ChartColumnShow(object sender, RoutedEventArgs e)
        {
            MenuItem m = sender as MenuItem;

            if (m.IsChecked)
            {
                colShow.Children.Clear();
                //List<string> strListx = new List<string> { "enpty", "partly", "full" };
                //List<string> strListy = new List<string> { "20", "100", "40" }; ;
                List <string> strListx = null;
                List <string> strListy = null;;
                BusinessControler.GetLocationDistribution(out strListx, out strListy);
                CreateChartColumn("Location Analysis", strListx, strListy);
                chartCan.Visibility = Visibility.Visible;
            }
            else
            {
                chartCan.Visibility = Visibility.Collapsed;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 确认事件  为指定图形节点绑定实际库位
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnConfirm_Click(object sender, RoutedEventArgs e)
        {
            if (flag)
            {
                MessageBoxResult result = MessageBox.Show("Sure to change?\r\n" +
                                                          currLoc + "->" + this.textBoxSet.Text.ToUpper(), "SystemPromt",
                                                          MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);
                if (result != MessageBoxResult.Yes)
                {
                    return;
                }
            }
            string tempStr = BusinessControler.SetLoctionBind(this.textBoxSet.Text.ToUpper(), parentStr);

            if (tempStr != "S")
            {
                MessageBox.Show(tempStr);
                return;
            }
            this.Close();
        }