private void btn_reset_Click(object sender, RoutedEventArgs e) { int i = 0; var routeItem = x_rtService.Get(a => a.IsValid == 1 && a.Isstart == 2 && a.HouseId == MainWindow.HouseId).FirstOrDefault(); string routecode = ""; if (routeItem != null) { routecode = routeItem.Routecode; } foreach (TruckInfo item in dataGrid1.Items) { if (item.IsChecked) { i += x_tService.Update(() => new TruckInfo() { Truckstatus = 0, TruckrouteCode = routecode }, a => a.Id == item.Id); } } MsgBox.Show("成功复位了" + i + "个叉车"); InitData(dataPager1.PageIndex); }
private void Window_Loaded(object sender, RoutedEventArgs e) { RouteService x_rService = new RouteService(); var list = x_rService.Get(a => a.IsValid == 1); cb_routelist.ItemsSource = list; cb_routelist.DisplayMemberPath = "Routecode"; var info = x_rkService.GetById(rackId); if (info != null) { tb_code.Text = info.Rackcode; tb_name.Text = info.Rackname; foreach (ComboBoxItem item in cb_routelist.Items) { if (item.Content.ToString() == info.RouteCode) { item.IsSelected = true; break; } } foreach (ComboBoxItem itemm in cb_layercount.Items) { if (itemm.Content.ToString() == info.RacklayerCount.ToString()) { itemm.IsSelected = true; break; } } } else { cb_routelist.SelectedIndex = 0; cb_routelist.SelectedIndex = 2; } }
void InitData() { var tList = x_tService.Get(a => a.Isvalid == 1 && a.HouseId == houseId).OrderBy(a => a.Truckcode).ToList(); cb_trucklist.ItemsSource = tList; cb_trucklist.DisplayMemberPath = "Truckcode"; routelist = x_rService.Get(a => a.IsValid == 1 && a.HouseId == houseId); cb_start_route.ItemsSource = routelist.OrderByDescending(a => a.Isstart).OrderBy(a => a.Routecode); cb_start_route.DisplayMemberPath = "Routecode"; if (tList.Count > 0) { string curoute = tList[0].TruckrouteCode; if (!string.IsNullOrEmpty(curoute)) { foreach (var ritem in routelist) { if (ritem.Routecode == curoute) { cb_start_route.Text = curoute; break; } } } } cb_trucklist.SelectedIndex = 0; rackList = x_rkService.Get(a => a.Isvalid == 1 && a.HouseId == houseId); cb_pack_route.ItemsSource = rackList.OrderBy(a => a.Rackcode); cb_pack_route.DisplayMemberPath = "Rackname"; cb_pack_route.SelectedValuePath = "Rackcode"; int r = 0, r2 = 0; Random rnd = new Random(); if (rackList.Count > 1) { r = rnd.Next(0, rackList.Count); } if (rackList.Count > 1) { r2 = rnd.Next(1, rackList.Count); } cb_pack_route.SelectedIndex = r; var rack_item = rackList.Where(a => a.Rackcode == cb_pack_route.SelectedValue.ToString()).FirstOrDefault(); var rlList = x_rlService.Get(a => a.RackId == rack_item.Id); cb_pack_layer.ItemsSource = rlList; cb_pack_layer.DisplayMemberPath = "RackLayerNum"; cb_pack_layer.SelectedValuePath = "RackLayerCode"; cb_pack_layer.SelectedIndex = 0; cb_downpack_route.ItemsSource = rackList.OrderBy(a => a.Rackcode); cb_downpack_route.DisplayMemberPath = "Rackname"; cb_downpack_route.SelectedValuePath = "Rackcode"; cb_downpack_route.SelectedIndex = r2; var rack_item2 = rackList.Where(a => a.Rackcode == cb_downpack_route.SelectedValue.ToString()).FirstOrDefault(); var rlList2 = x_rlService.Get(a => a.RackId == rack_item2.Id); cb_downpack_layer.ItemsSource = rlList2; cb_downpack_layer.DisplayMemberPath = "RackLayerNum"; cb_downpack_layer.SelectedValuePath = "RackLayerCode"; cb_downpack_layer.SelectedIndex = 0; cb_end_route.ItemsSource = routelist; cb_end_route.DisplayMemberPath = "Routecode"; cb_end_route.SelectedIndex = 0; var item = routelist.Where(a => a.Isstart == 2).FirstOrDefault(); if (item != null && !string.IsNullOrEmpty(item.Routecode)) { cb_end_route.Text = item.Routecode; } }
public IHttpActionResult Get(int id) { var route = _routeService.Get(id); return(Ok(_mapper.Map <RouteDTO>(route))); }
public void initData() { pathDict = new Dictionary <string, List <string> >(); foreach (ComboBoxItem item in cb_house.Items) { if (item.Content.ToString() == houseId.ToString()) { item.IsSelected = true; break; } } x_path_grid.Children.Clear(); tb_size.Text = pSize.ToString(); tb_x.Text = xPoint.ToString(); tb_y.Text = yPoint.ToString(); routeList = x_rService.Get(a => a.IsValid == 1 && a.HouseId == houseId).OrderBy(a => a.Routecode).ToList(); var first_item = routeList.Where(a => a.Isstart == 1).FirstOrDefault(); if (first_item == null) { return; } List <RouteInfo> singleList = new List <RouteInfo>(); //绘制路线 LineRouteList(singleList, first_item.Routecode); DrawLines(singleList); //绘制仓位点 rackList = x_rkService.GetListByHouse(houseId); foreach (var item in rackList) { int orgx = 0; int orgy = 0; var route_item = routeList.Where(a => a.Routecode == item.RouteCode).FirstOrDefault(); if (route_item != null) { orgx = route_item.X * pSize + xPoint; orgy = 0 - route_item.Y * pSize + yPoint; } double x = item.X * pSize + xPoint; double y = (0 - item.Y * pSize + yPoint); Path line_path = new Path() { Stroke = new SolidColorBrush() { Color = (Color)ColorConverter.ConvertFromString("#FF8C00"), Opacity = 0.4 } }; x_path_grid.Children.Add(line_path); PathGeometry pg = new PathGeometry(); var xlist = new List <PathSegment>(); xlist.Add(new LineSegment(new Point(x, y), true)); PathFigure pf = new PathFigure(new Point(orgx, orgy), xlist, false); pg.Figures.Add(pf); line_path.Data = pg; Path xPath = new Path() { Fill = new SolidColorBrush() { Color = (Color)ColorConverter.ConvertFromString("#00cc00") }, Tag = item.Rackcode }; xPath.Data = new RectangleGeometry() { Rect = new Rect(x - 10, y - 10, 20, 20) }; x_path_grid.Children.Add(xPath); Label lb = new Label() { Content = item.Rackname, Margin = new Thickness(x - 15, y + 4, 0, 0) }; x_path_grid.Children.Add(lb); } //绘制路径点 foreach (var item in routeList) { double x = item.X * pSize + xPoint; double y = (0 - item.Y * pSize + yPoint); Path xPath = new Path() { Fill = new SolidColorBrush() { Color = (Color)ColorConverter.ConvertFromString("#666") } }; xPath.Data = new EllipseGeometry() { Center = new Point(x, y), RadiusX = 12, RadiusY = 12 }; x_path_grid.Children.Add(xPath); Label lb = new Label() { Content = item.Routecode, Margin = new Thickness(x - 12, y - 13, 0, 0), Foreground = new SolidColorBrush() { Color = (Color)ColorConverter.ConvertFromString("#ffffff") } }; x_path_grid.Children.Add(lb); } //绘制叉车 truckList = x_tkService.Get(a => a.HouseId == houseId && a.Isvalid == 1); BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = new Uri("Resource/Image/truck.png", UriKind.RelativeOrAbsolute); bi.EndInit(); bi.Freeze(); foreach (var truckItem in truckList) { var routeItem = x_rService.Get(a => a.Routecode == truckItem.TruckrouteCode && a.HouseId == houseId).FirstOrDefault(); if (routeItem != null) { double x = routeItem.X * pSize + xPoint; double y = (0 - routeItem.Y * pSize + yPoint); Image image = new Image() { Width = 24, Height = 24 }; image.Source = bi; image.Margin = new Thickness(x + 5, y + 5, 0, 0); x_path_grid.Children.Add(image); } } }