change-隐藏库存信息界面,完善可视化库位界面,添加锁定解锁库位按钮

master
liuwf 1 year ago
parent 7bc52796e4
commit 4eeae895c5

@ -1021,7 +1021,7 @@
<Label Content="Label"/>
</StackPanel>
</TabItem>
<TabItem x:Name="LocationManager" Header="库存信息" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" Background="#213269" VerticalContentAlignment="Center" Foreground="White" Width="160" Height="80" Margin="5" >
<TabItem x:Name="LocationManager" Header="库存信息" Visibility="Collapsed" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" Background="#213269" VerticalContentAlignment="Center" Foreground="White" Width="160" Height="80" Margin="5" >
<StackPanel
x:Name="orderControl"
Canvas.Left="174"
@ -1325,7 +1325,7 @@
</Grid>
</Grid>
</TabItem>
<TabItem Header="库位状态" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" Background="#213269" VerticalContentAlignment="Center" Foreground="White" Width="160" Height="80" Margin="5">
<TabItem Header="库位状态" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" Background="#213269" VerticalContentAlignment="Center" Foreground="White" Width="160" Height="80" Margin="5">
<Grid Margin="0 10 10 0" Height="1080" Width="1680">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
@ -1344,7 +1344,7 @@
</Button.Template>
</Button>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="900 0 0 0">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="700 0 0 0">
<Rectangle Width="50" Height="50" Fill="#75F76D" />
<TextBlock Text=" 有库存" FontSize="30"/>
</StackPanel>
@ -1353,6 +1353,19 @@
<Rectangle Width="50" Height="50" Fill="#4789AE" />
<TextBlock Text=" 空库位" FontSize="30"/>
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="30 0 0 0">
<!-- 包含透明正方形和红点的 Canvas -->
<Canvas Width="50" Height="50" VerticalAlignment="Center" HorizontalAlignment="Center">
<!-- 透明的正方形 -->
<Rectangle Width="50" Height="50" Fill="Transparent" Stroke="Black" StrokeThickness="1"/>
<!-- 中间的红点 -->
<Ellipse Width="10" Height="10" Fill="Red" Canvas.Left="20" Canvas.Top="20" />
</Canvas>
<TextBlock Text=" 库位锁定" FontSize="30"/>
</StackPanel>
</StackPanel>
<Grid Grid.Row="1" x:Name="LocaltionGrid">

@ -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)
{

@ -29,26 +29,55 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="8*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
<TextBox x:Name="positionRowTxt" FontSize="25" Margin="0 0 10 0" Width="100"/>
<TextBlock Text="行" Foreground="White" FontSize="25" Margin="0 0 25 0"/>
<TextBox x:Name="positionColumnTxt" FontSize="25" Margin="0 0 10 0" Width="100"/>
<TextBlock Text="列" Foreground="White" FontSize="25" Margin="0 0 25 0"/>
<TextBox x:Name="positionLayerTxt" FontSize="25" Margin="0 0 10 0" Width="80"/>
<TextBlock Text="层" Foreground="White" FontSize="25" Margin="0 0 150 0"/>
<TextBlock Text="库位编号:" Foreground="White" FontSize="25" Margin="0 0 8 0"/>
<TextBlock x:Name="locationTxt" Foreground="White" FontSize="25" Margin="0 0 58 0" Width="250"/>
<TextBlock Text="托盘编号:" Foreground="White" FontSize="25" Margin="0 0 8 0"/>
<TextBlock x:Name="palletTxt" Foreground="White" FontSize="25"/>
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
<TextBox x:Name="positionRowTxt" FontSize="25" Margin="0 0 10 0" Width="100" Height="40"/>
<TextBlock Text="行" Foreground="White" FontSize="25" Margin="0 0 25 0" Height="40"/>
<TextBox x:Name="positionColumnTxt" FontSize="25" Margin="0 0 10 0" Width="100" Height="40"/>
<TextBlock Text="列" Foreground="White" FontSize="25" Margin="0 0 25 0" Height="40"/>
<TextBox x:Name="positionLayerTxt" FontSize="25" Margin="0 0 10 0" Width="80" Height="40"/>
<TextBlock Text="层" Foreground="White" FontSize="25" Margin="0 0 150 0" Height="40"/>
<Button Content="锁定库位" FontSize="25" Margin="10" Foreground="White" Height="50" Width="132" Click="LockLocation_Click">
<Button.Template >
<ControlTemplate TargetType="{x:Type Button}" >
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="4,4,4,4">
<Border.Background>#346DFF</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" ></ContentPresenter>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
<Button Content="解锁库位" FontSize="25" Margin="10" Foreground="White" Height="50" Width="132" Click="UnLockLocation_Click">
<Button.Template >
<ControlTemplate TargetType="{x:Type Button}" >
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="4,4,4,4">
<Border.Background>#346DFF</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" ></ContentPresenter>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal">
<TextBlock Text="库位编号:" Foreground="White" FontSize="25" Margin="0 0 8 0"/>
<TextBlock x:Name="locationTxt" Foreground="White" FontSize="25" Margin="0 0 58 0" Width="250"/>
<TextBlock Text="托盘编号:" Foreground="White" FontSize="25" Margin="0 0 8 0"/>
<TextBlock x:Name="palletTxt" Foreground="White" FontSize="25" Margin="0 0 58 0" Width="250"/>
<TextBlock Text="库位状态" Foreground="White" FontSize="25" Margin="0 0 25 0"/>
<TextBlock x:Name="txtStatus" Foreground="White" FontSize="25" Margin="0 0 10 0" Width="250"/>
</StackPanel>
</Grid>
<Grid Grid.Row="2">
<DataGrid
Style="{StaticResource DataGridStyle}"
Grid.Row="2" AlternationCount="2"

@ -25,10 +25,12 @@ namespace Khd.Core.Wpf.WindowPage
public partial class StockWindow : Window
{
private IHost host = null;
private long LocationId = 0;
public StockWindow(IHost _host, long locationId)
{
host = _host;
InitializeComponent();
LocationId = locationId;
Init(locationId);
}
@ -42,6 +44,7 @@ namespace Khd.Core.Wpf.WindowPage
positionLayerTxt.Text = location.layerNum.ToString();
locationTxt.Text = location.locationCode;
palletTxt.Text = location.containerCode;
txtStatus.Text = getStatus(location.locationStatus);
if (location.warehouseId == 512 || location.warehouseId == 311 || location.warehouseId == 511)
{
@ -104,5 +107,43 @@ namespace Khd.Core.Wpf.WindowPage
}
}
public string getStatus(string status)
{
switch (status)
{
case "1": return "正常";
case "2": return "自动锁定";
case "3": return "人工锁定";
case "4": return "移库锁定";
case "5": return "合库锁定";
case "6": return "出库锁定";
case "8": return "因外侧库位异常导致内侧库位无法使用";
case "9": return "异常库位";
default : return "未知";
}
}
private void LockLocation_Click(object sender, RoutedEventArgs e)
{
using var scope = host.Services.CreateScope();
var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
var record = dbContext.WmsBaseLocation.Where(x => x.locationId == LocationId).First();
record.locationStatus = "3";
dbContext.WmsBaseLocation.Update(record);
dbContext.SaveChanges();
Init(LocationId);
}
private void UnLockLocation_Click(object sender, RoutedEventArgs e)
{
using var scope = host.Services.CreateScope();
var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
var record = dbContext.WmsBaseLocation.Where(x => x.locationId == LocationId).First();
record.locationStatus = "1";
dbContext.WmsBaseLocation.Update(record);
dbContext.SaveChanges();
Init(LocationId);
}
}
}

@ -52,7 +52,7 @@
},
"MenuList": [
"任务管理",
"库存信息",
// "库存信息",
"辅料库位",
"库位状态",
"人工叫料",

Loading…
Cancel
Save