|
|
|
|
@ -33,6 +33,7 @@ using System.Threading.Tasks;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Media.Media3D;
|
|
|
|
|
using System.Windows.Threading;
|
|
|
|
|
using Z.EntityFramework.Plus;
|
|
|
|
|
@ -112,8 +113,8 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
// public static int WeekNo = CommonHelper.WeekOfYear(DateTime.Now, new System.Globalization.CultureInfo("zh-CN"));
|
|
|
|
|
public FormBoardT(IHost host)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
this._host = host;
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
InventoryMaterialWindow.RefreshInventoryListEvent += GetInvertoryData;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
@ -125,6 +126,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
{
|
|
|
|
|
CheckVersion();
|
|
|
|
|
InitializeData(1);
|
|
|
|
|
Refulsh_Click(null,null);
|
|
|
|
|
foreach (var item in this.TabControl.Items)
|
|
|
|
|
{
|
|
|
|
|
if (item is TabItem tabItem)
|
|
|
|
|
@ -5003,6 +5005,97 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
MessageBox.Show($"取消预调度失败!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Refulsh_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var wareHouse = WareHouseId.SelectionBoxItem.ToString();
|
|
|
|
|
var warehouseId = new List<long>();
|
|
|
|
|
if (wareHouse == "二楼仓库")
|
|
|
|
|
{
|
|
|
|
|
warehouseId.Add(231);
|
|
|
|
|
}
|
|
|
|
|
else if (wareHouse == "三楼仓库")
|
|
|
|
|
{
|
|
|
|
|
warehouseId.Add(311);
|
|
|
|
|
}
|
|
|
|
|
else if (wareHouse == "五楼仓库")
|
|
|
|
|
{
|
|
|
|
|
warehouseId.Add(511);
|
|
|
|
|
warehouseId.Add(521);
|
|
|
|
|
warehouseId.Add(531);
|
|
|
|
|
}
|
|
|
|
|
var scope = _host.Services.CreateScope();
|
|
|
|
|
var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
|
|
|
|
|
var wmsBaseLocations = dbContext.WmsBaseLocation.Where(t => warehouseId.Contains(t.warehouseId)).ToList();
|
|
|
|
|
loadLocations(wmsBaseLocations);
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void loadLocations(List<WmsBaseLocation> wmsBaseLocations)
|
|
|
|
|
{
|
|
|
|
|
Dispatcher.Invoke(() =>
|
|
|
|
|
{
|
|
|
|
|
this.LocaltionGrid.Children.Clear();
|
|
|
|
|
this.LocaltionGrid.RowDefinitions.Clear();
|
|
|
|
|
this.LocaltionGrid.ColumnDefinitions.Clear();
|
|
|
|
|
List<long> list = wmsBaseLocations.Select(t => t.warehouseId).Distinct().ToList();
|
|
|
|
|
for (var i = 0; i < list.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
this.LocaltionGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1.0, GridUnitType.Star) });
|
|
|
|
|
var grid = new Grid();
|
|
|
|
|
List<WmsBaseLocation> locations = wmsBaseLocations.Where(t => t.warehouseId == list[i]).ToList();
|
|
|
|
|
var row = locations.Max(t => t.locRow);
|
|
|
|
|
var column = locations.Max(t => t.locColumn);
|
|
|
|
|
|
|
|
|
|
for (var j = 0; j < row; j++)
|
|
|
|
|
{
|
|
|
|
|
grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1.0, GridUnitType.Star) });
|
|
|
|
|
}
|
|
|
|
|
for (var j = 0; j < column; j++)
|
|
|
|
|
{
|
|
|
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1.0, GridUnitType.Star) });
|
|
|
|
|
}
|
|
|
|
|
foreach (var location in locations)
|
|
|
|
|
{
|
|
|
|
|
var button = new Button()
|
|
|
|
|
{
|
|
|
|
|
Name = $"Location{location.locationCode}",
|
|
|
|
|
Content = location.locationCode,
|
|
|
|
|
Width = 50,
|
|
|
|
|
Height = 50,
|
|
|
|
|
Margin = new Thickness(5, 5, 5, 5),
|
|
|
|
|
Tag=location.locationId,
|
|
|
|
|
Background = string.IsNullOrEmpty(location.containerCode) ? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4789AE")) : new SolidColorBrush((Color)ColorConverter.ConvertFromString("#75F76D"))
|
|
|
|
|
};
|
|
|
|
|
button.Click += OnLocationButton_Click;
|
|
|
|
|
Grid.SetColumn(button, location.locColumn.Value - 1);
|
|
|
|
|
Grid.SetRow(button, -(location.locRow.Value - row.Value));
|
|
|
|
|
grid.Children.Add(button);
|
|
|
|
|
}
|
|
|
|
|
Grid.SetRow(grid, i);
|
|
|
|
|
this.LocaltionGrid.Children.Add(grid);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnLocationButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (sender is Button button)
|
|
|
|
|
{
|
|
|
|
|
if (button.Tag is long locationId)
|
|
|
|
|
{
|
|
|
|
|
StockWindow stockWindow = new StockWindow(_host,locationId);
|
|
|
|
|
stockWindow.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|