|
|
|
|
@ -39,6 +39,7 @@ using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Media.Media3D;
|
|
|
|
|
using System.Windows.Shapes;
|
|
|
|
|
using System.Windows.Threading;
|
|
|
|
|
using Z.EntityFramework.Plus;
|
|
|
|
|
using static HandyControl.Tools.Interop.InteropValues;
|
|
|
|
|
@ -5534,49 +5535,10 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
|
|
|
|
|
private void Refulsh_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
UpdateLocations(GetLocations());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void UpdateLocations(List<WmsBaseLocation> wmsBaseLocations)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
using var scope = _host.Services.CreateScope();
|
|
|
|
|
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
|
|
|
|
|
var baseEquips = dbContext.BaseEquip.Where(t => t.equipType == 20).OrderBy(t => t.agvPositionCode).ToList();
|
|
|
|
|
foreach (var item in this.LocaltionGrid.Children)
|
|
|
|
|
{
|
|
|
|
|
if (item is Grid grid)
|
|
|
|
|
{
|
|
|
|
|
foreach (var btn in grid.Children)
|
|
|
|
|
{
|
|
|
|
|
if (btn is Button button)
|
|
|
|
|
{
|
|
|
|
|
var location = wmsBaseLocations.Where(t => t.locationCode == button.Name.Replace("Location", "")).FirstOrDefault();
|
|
|
|
|
if (location != null)
|
|
|
|
|
{
|
|
|
|
|
button.Background = string.IsNullOrEmpty(location.containerCode) ? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4789AE")) : new SolidColorBrush((Color)ColorConverter.ConvertFromString("#75F76D"));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
BaseEquip? baseEquip = baseEquips.Where(t => t.agvPositionCode == button.Name).FirstOrDefault();
|
|
|
|
|
if (baseEquip != null)
|
|
|
|
|
{
|
|
|
|
|
button.Content = baseEquip.agvPositionCode + $"({baseEquip.emptyCount})";
|
|
|
|
|
button.Background = baseEquip.emptyCount > 0 ? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#75F76D")) : new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4789AE"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
DrawLocaitons();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<WmsBaseLocation> GetLocations()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
@ -5673,8 +5635,36 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
Tag = location.locationId,
|
|
|
|
|
Background = string.IsNullOrEmpty(location.containerCode) ? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4789AE")) : new SolidColorBrush((Color)ColorConverter.ConvertFromString("#75F76D"))
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 添加小红点逻辑
|
|
|
|
|
if (location.locationStatus != "1")
|
|
|
|
|
{
|
|
|
|
|
var redDot = new Ellipse()
|
|
|
|
|
{
|
|
|
|
|
Width = 7,
|
|
|
|
|
Height = 7,
|
|
|
|
|
Fill = Brushes.Red,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Top,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Right,
|
|
|
|
|
Margin = new Thickness(0, -5, 0, 2) // 调整位置使其在右上角
|
|
|
|
|
};
|
|
|
|
|
button.Content = new Grid()
|
|
|
|
|
{
|
|
|
|
|
Children =
|
|
|
|
|
{
|
|
|
|
|
new TextBlock() { Text = location.locationCode },
|
|
|
|
|
redDot
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
button.Click += OnLocationButton_Click;
|
|
|
|
|
Grid.SetColumn(button, location.locColumn.Value - 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (list[0] == 231)
|
|
|
|
|
{
|
|
|
|
|
Grid.SetRow(button, -(location.locRow.Value - row.Value) + 2);
|
|
|
|
|
@ -5698,6 +5688,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Grid.SetRow(button, -(location.locRow.Value - row.Value));
|
|
|
|
|
if (list[0] == 311)
|
|
|
|
|
{
|
|
|
|
|
|