change - 库位信息界面
parent
628d1dd9de
commit
cdecb20b3d
@ -0,0 +1,393 @@
|
||||
<Window x:Class="Sln.Wcs.UI.Page.BasicInfo.LocationInfo.LocationAddWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
Title="添加库位"
|
||||
Height="580" Width="600"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
ResizeMode="NoResize"
|
||||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
<Window.Resources>
|
||||
<Style x:Key="LabelStyle" TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="#B0B0B0"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="MinWidth" Value="80"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="FormTextBoxStyle" TargetType="TextBox">
|
||||
<Setter Property="Background" Value="#1A1A2E"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
<Setter Property="BorderBrush" Value="#3A3A4A"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="10,8"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TextBox">
|
||||
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4" Padding="{TemplateBinding Padding}">
|
||||
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsFocused" Value="True">
|
||||
<Setter Property="BorderBrush" Value="#2196F3"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 下拉框样式 -->
|
||||
<Style x:Key="FormComboBoxStyle" TargetType="ComboBox">
|
||||
<Setter Property="Background" Value="#0D0D18"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
<Setter Property="BorderBrush" Value="#3A3A4A"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="10,8"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBox">
|
||||
<Grid>
|
||||
<Border x:Name="Border" Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="30"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter Grid.Column="0" x:Name="ContentSite"
|
||||
Margin="10,0,30,0"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Content="{TemplateBinding SelectionBoxItem}"
|
||||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
<ToggleButton Grid.ColumnSpan="2" x:Name="ToggleButton" ClickMode="Press" Focusable="False"
|
||||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Background="Transparent" BorderThickness="0">
|
||||
<ToggleButton.Template>
|
||||
<ControlTemplate TargetType="ToggleButton">
|
||||
<Border Background="Transparent"/>
|
||||
</ControlTemplate>
|
||||
</ToggleButton.Template>
|
||||
</ToggleButton>
|
||||
<Path Grid.Column="1" x:Name="Arrow" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Data="M 0 0 L 6 6 L 12 0 Z" Fill="#B0B0B0"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Popup x:Name="Popup" AllowsTransparency="True" IsOpen="{TemplateBinding IsDropDownOpen}" PopupAnimation="Slide"
|
||||
Placement="Bottom" Focusable="False">
|
||||
<Border x:Name="DropDown" MinWidth="{TemplateBinding ActualWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
Background="#1A1A2E" BorderBrush="#3A3A4A" BorderThickness="1" CornerRadius="4" Margin="0,2,0,0">
|
||||
<ScrollViewer Margin="4">
|
||||
<StackPanel IsItemsHost="True"/>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="#2196F3"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsDropDownOpen" Value="True">
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="#2196F3"/>
|
||||
<Setter TargetName="Arrow" Property="Data" Value="M 0 6 L 6 0 L 12 6 Z"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 下拉项样式 -->
|
||||
<Style TargetType="ComboBoxItem">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
<Setter Property="Padding" Value="10,8"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBoxItem">
|
||||
<Border x:Name="Border" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" CornerRadius="2">
|
||||
<ContentPresenter/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="#252540"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="#2196F3"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ConfirmBtnStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="#2196F3"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="Padding" Value="28,10"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="6" Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#42A5F5"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#1976D2"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="CancelBtnStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="#3A3A4A"/>
|
||||
<Setter Property="Foreground" Value="#B0B0B0"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="Padding" Value="28,10"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="6" Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#4A4A5A"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="CloseBtnStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="#B0B0B0"/>
|
||||
<Setter Property="FontSize" Value="16"/>
|
||||
<Setter Property="Width" Value="30"/>
|
||||
<Setter Property="Height" Value="30"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="4">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#3D3D5C"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<Border Background="#1A1A2E" CornerRadius="8" Margin="10">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="20" ShadowDepth="3" Opacity="0.5"/>
|
||||
</Border.Effect>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Background="#252540" Margin="-1,-1,-1,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="添加库位" Foreground="#ECF0F1" FontSize="16" FontWeight="SemiBold"
|
||||
VerticalAlignment="Center" Margin="16,12"/>
|
||||
<Button Grid.Column="1" Content="X" Style="{StaticResource CloseBtnStyle}" Click="BtnClose_Click" Margin="0,0,8,0"/>
|
||||
</Grid>
|
||||
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="24,16,24,24" Width="520" HorizontalAlignment="Center">
|
||||
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="库位编号" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtLocationCode" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="库位名称" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="6" x:Name="TxtLocationName" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="库位区域" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtLocationArea" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="所属仓库" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="6" x:Name="TxtStoreCode" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="排" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtLocationRows" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="列" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="6" x:Name="TxtLocationColumns" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="层" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtLocationLayers" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="库位状态" Style="{StaticResource LabelStyle}"/>
|
||||
<ComboBox Grid.Column="6" x:Name="CmbLocationStatus" Style="{StaticResource FormComboBoxStyle}">
|
||||
<ComboBoxItem Content="未使用" Tag="0" IsSelected="True"/>
|
||||
<ComboBoxItem Content="已使用" Tag="1"/>
|
||||
<ComboBoxItem Content="锁库" Tag="2"/>
|
||||
<ComboBoxItem Content="异常" Tag="3"/>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="AGV定位" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtAgvPosition" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="关联设备" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="6" x:Name="TxtDeviceCode" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="物料编号" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtMaterialCode" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="托盘条码" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="6" x:Name="TxtPalletBarcode" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="库存数量" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtStackCount" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="是否标识" Style="{StaticResource LabelStyle}"/>
|
||||
<ComboBox Grid.Column="6" x:Name="CmbIsFlag" Style="{StaticResource FormComboBoxStyle}">
|
||||
<ComboBoxItem Content="否" Tag="0" IsSelected="True"/>
|
||||
<ComboBoxItem Content="是" Tag="1"/>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,0,0,24">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="备注" Style="{StaticResource LabelStyle}" VerticalAlignment="Top" Margin="0,8,0,0"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtRemark" Style="{StaticResource FormTextBoxStyle}" Height="60" TextWrapping="Wrap" AcceptsReturn="True" VerticalContentAlignment="Top"/>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Content="取消" Style="{StaticResource CancelBtnStyle}" Click="BtnCancel_Click" Margin="0,0,12,0"/>
|
||||
<Button Content="确认" Style="{StaticResource ConfirmBtnStyle}" Click="BtnConfirm_Click"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
@ -0,0 +1,94 @@
|
||||
using Sln.Wcs.Model.Domain;
|
||||
using Sln.Wcs.Repository.service;
|
||||
using Sln.Wcs.UI.Controls;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Sln.Wcs.UI.Page.BasicInfo.LocationInfo
|
||||
{
|
||||
public partial class LocationAddWindow : Window
|
||||
{
|
||||
private readonly IBaseLocationInfoService _locationService;
|
||||
|
||||
public LocationAddWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
_locationService = App.ServiceProvider.GetService<IBaseLocationInfoService>();
|
||||
}
|
||||
|
||||
private void BtnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void BtnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void BtnConfirm_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(TxtLocationCode.Text))
|
||||
{
|
||||
CustomMessageBox.Show("请输入库位编号", "提示");
|
||||
TxtLocationCode.Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var location = new BaseLocationInfo
|
||||
{
|
||||
locationCode = TxtLocationCode.Text.Trim(),
|
||||
locationName = TxtLocationName.Text.Trim(),
|
||||
locationArea = TxtLocationArea.Text.Trim(),
|
||||
storeCode = TxtStoreCode.Text.Trim(),
|
||||
locationRows = int.TryParse(TxtLocationRows.Text, out int rows) ? rows : null,
|
||||
locationColumns = int.TryParse(TxtLocationColumns.Text, out int cols) ? cols : null,
|
||||
locationLayers = int.TryParse(TxtLocationLayers.Text, out int layers) ? layers : null,
|
||||
locationStatus = GetSelectedStatus(CmbLocationStatus),
|
||||
agvPosition = TxtAgvPosition.Text.Trim(),
|
||||
deviceCode = TxtDeviceCode.Text.Trim(),
|
||||
materialCode = TxtMaterialCode.Text.Trim(),
|
||||
palletBarcode = TxtPalletBarcode.Text.Trim(),
|
||||
stackCount = TxtStackCount.Text.Trim(),
|
||||
isFlag = GetSelectedIsFlag(CmbIsFlag),
|
||||
remark = TxtRemark.Text.Trim(),
|
||||
createdBy = Environment.UserName,
|
||||
createdTime = DateTime.Now
|
||||
};
|
||||
|
||||
_locationService.Insert(location);
|
||||
CustomMessageBox.Show("添加成功", "提示");
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CustomMessageBox.Show($"添加失败: {ex.Message}", "错误");
|
||||
}
|
||||
}
|
||||
|
||||
private int GetSelectedStatus(ComboBox cmb)
|
||||
{
|
||||
if (cmb.SelectedItem is ComboBoxItem item && item.Tag != null)
|
||||
{
|
||||
return int.TryParse(item.Tag.ToString(), out int status) ? status : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int GetSelectedIsFlag(ComboBox cmb)
|
||||
{
|
||||
if (cmb.SelectedItem is ComboBoxItem item && item.Tag != null)
|
||||
{
|
||||
return int.TryParse(item.Tag.ToString(), out int flag) ? flag : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,393 @@
|
||||
<Window x:Class="Sln.Wcs.UI.Page.BasicInfo.LocationInfo.LocationEditWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
Title="编辑库位"
|
||||
Height="580" Width="600"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
ResizeMode="NoResize"
|
||||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
<Window.Resources>
|
||||
<Style x:Key="LabelStyle" TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="#B0B0B0"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="MinWidth" Value="80"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="FormTextBoxStyle" TargetType="TextBox">
|
||||
<Setter Property="Background" Value="#1A1A2E"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
<Setter Property="BorderBrush" Value="#3A3A4A"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="10,8"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TextBox">
|
||||
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4" Padding="{TemplateBinding Padding}">
|
||||
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsFocused" Value="True">
|
||||
<Setter Property="BorderBrush" Value="#2196F3"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 下拉框样式 -->
|
||||
<Style x:Key="FormComboBoxStyle" TargetType="ComboBox">
|
||||
<Setter Property="Background" Value="#0D0D18"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
<Setter Property="BorderBrush" Value="#3A3A4A"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="10,8"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBox">
|
||||
<Grid>
|
||||
<Border x:Name="Border" Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="30"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter Grid.Column="0" x:Name="ContentSite"
|
||||
Margin="10,0,30,0"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Content="{TemplateBinding SelectionBoxItem}"
|
||||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
<ToggleButton Grid.ColumnSpan="2" x:Name="ToggleButton" ClickMode="Press" Focusable="False"
|
||||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Background="Transparent" BorderThickness="0">
|
||||
<ToggleButton.Template>
|
||||
<ControlTemplate TargetType="ToggleButton">
|
||||
<Border Background="Transparent"/>
|
||||
</ControlTemplate>
|
||||
</ToggleButton.Template>
|
||||
</ToggleButton>
|
||||
<Path Grid.Column="1" x:Name="Arrow" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Data="M 0 0 L 6 6 L 12 0 Z" Fill="#B0B0B0"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Popup x:Name="Popup" AllowsTransparency="True" IsOpen="{TemplateBinding IsDropDownOpen}" PopupAnimation="Slide"
|
||||
Placement="Bottom" Focusable="False">
|
||||
<Border x:Name="DropDown" MinWidth="{TemplateBinding ActualWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
Background="#1A1A2E" BorderBrush="#3A3A4A" BorderThickness="1" CornerRadius="4" Margin="0,2,0,0">
|
||||
<ScrollViewer Margin="4">
|
||||
<StackPanel IsItemsHost="True"/>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="#2196F3"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsDropDownOpen" Value="True">
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="#2196F3"/>
|
||||
<Setter TargetName="Arrow" Property="Data" Value="M 0 6 L 6 0 L 12 6 Z"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 下拉项样式 -->
|
||||
<Style TargetType="ComboBoxItem">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
<Setter Property="Padding" Value="10,8"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBoxItem">
|
||||
<Border x:Name="Border" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" CornerRadius="2">
|
||||
<ContentPresenter/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="#252540"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="#2196F3"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ConfirmBtnStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="#2196F3"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="Padding" Value="28,10"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="6" Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#42A5F5"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#1976D2"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="CancelBtnStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="#3A3A4A"/>
|
||||
<Setter Property="Foreground" Value="#B0B0B0"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="Padding" Value="28,10"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="6" Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#4A4A5A"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="CloseBtnStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="#B0B0B0"/>
|
||||
<Setter Property="FontSize" Value="16"/>
|
||||
<Setter Property="Width" Value="30"/>
|
||||
<Setter Property="Height" Value="30"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="4">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#3D3D5C"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<Border Background="#1A1A2E" CornerRadius="8" Margin="10">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="20" ShadowDepth="3" Opacity="0.5"/>
|
||||
</Border.Effect>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Background="#252540" Margin="-1,-1,-1,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="编辑库位" Foreground="#ECF0F1" FontSize="16" FontWeight="SemiBold"
|
||||
VerticalAlignment="Center" Margin="16,12"/>
|
||||
<Button Grid.Column="1" Content="X" Style="{StaticResource CloseBtnStyle}" Click="BtnClose_Click" Margin="0,0,8,0"/>
|
||||
</Grid>
|
||||
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="24,16,24,24" Width="520" HorizontalAlignment="Center">
|
||||
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="库位编号" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtLocationCode" Style="{StaticResource FormTextBoxStyle}" IsReadOnly="True" Background="#252540"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="库位名称" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="6" x:Name="TxtLocationName" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="库位区域" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtLocationArea" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="所属仓库" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="6" x:Name="TxtStoreCode" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="排" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtLocationRows" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="列" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="6" x:Name="TxtLocationColumns" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="层" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtLocationLayers" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="库位状态" Style="{StaticResource LabelStyle}"/>
|
||||
<ComboBox Grid.Column="6" x:Name="CmbLocationStatus" Style="{StaticResource FormComboBoxStyle}">
|
||||
<ComboBoxItem Content="未使用" Tag="0"/>
|
||||
<ComboBoxItem Content="已使用" Tag="1"/>
|
||||
<ComboBoxItem Content="锁库" Tag="2"/>
|
||||
<ComboBoxItem Content="异常" Tag="3"/>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="AGV定位" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtAgvPosition" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="关联设备" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="6" x:Name="TxtDeviceCode" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="物料编号" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtMaterialCode" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="托盘条码" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="6" x:Name="TxtPalletBarcode" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="库存数量" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtStackCount" Style="{StaticResource FormTextBoxStyle}"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="是否标识" Style="{StaticResource LabelStyle}"/>
|
||||
<ComboBox Grid.Column="6" x:Name="CmbIsFlag" Style="{StaticResource FormComboBoxStyle}">
|
||||
<ComboBoxItem Content="否" Tag="0"/>
|
||||
<ComboBoxItem Content="是" Tag="1"/>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,0,0,24">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="备注" Style="{StaticResource LabelStyle}" VerticalAlignment="Top" Margin="0,8,0,0"/>
|
||||
<TextBox Grid.Column="2" x:Name="TxtRemark" Style="{StaticResource FormTextBoxStyle}" Height="60" TextWrapping="Wrap" AcceptsReturn="True" VerticalContentAlignment="Top"/>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Content="取消" Style="{StaticResource CancelBtnStyle}" Click="BtnCancel_Click" Margin="0,0,12,0"/>
|
||||
<Button Content="确认" Style="{StaticResource ConfirmBtnStyle}" Click="BtnConfirm_Click"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
@ -0,0 +1,132 @@
|
||||
using Sln.Wcs.Model.Domain;
|
||||
using Sln.Wcs.Repository.service;
|
||||
using Sln.Wcs.UI.Controls;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Sln.Wcs.UI.Page.BasicInfo.LocationInfo
|
||||
{
|
||||
public partial class LocationEditWindow : Window
|
||||
{
|
||||
private readonly IBaseLocationInfoService _locationService;
|
||||
private readonly BaseLocationInfo _location;
|
||||
|
||||
public LocationEditWindow(BaseLocationInfo location)
|
||||
{
|
||||
InitializeComponent();
|
||||
_locationService = App.ServiceProvider.GetService<IBaseLocationInfoService>();
|
||||
_location = location;
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
TxtLocationCode.Text = _location.locationCode;
|
||||
TxtLocationName.Text = _location.locationName;
|
||||
TxtLocationArea.Text = _location.locationArea;
|
||||
TxtStoreCode.Text = _location.storeCode;
|
||||
TxtLocationRows.Text = _location.locationRows?.ToString() ?? "";
|
||||
TxtLocationColumns.Text = _location.locationColumns?.ToString() ?? "";
|
||||
TxtLocationLayers.Text = _location.locationLayers?.ToString() ?? "";
|
||||
TxtAgvPosition.Text = _location.agvPosition;
|
||||
TxtDeviceCode.Text = _location.deviceCode;
|
||||
TxtMaterialCode.Text = _location.materialCode;
|
||||
TxtPalletBarcode.Text = _location.palletBarcode;
|
||||
TxtStackCount.Text = _location.stackCount;
|
||||
TxtRemark.Text = _location.remark;
|
||||
|
||||
SetSelectedStatus(_location.locationStatus ?? 0);
|
||||
SetSelectedIsFlag(_location.isFlag ?? 0);
|
||||
}
|
||||
|
||||
private void SetSelectedStatus(int status)
|
||||
{
|
||||
foreach (ComboBoxItem item in CmbLocationStatus.Items)
|
||||
{
|
||||
if (item.Tag != null && int.TryParse(item.Tag.ToString(), out int tagValue) && tagValue == status)
|
||||
{
|
||||
CmbLocationStatus.SelectedItem = item;
|
||||
return;
|
||||
}
|
||||
}
|
||||
CmbLocationStatus.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void SetSelectedIsFlag(int isFlag)
|
||||
{
|
||||
foreach (ComboBoxItem item in CmbIsFlag.Items)
|
||||
{
|
||||
if (item.Tag != null && int.TryParse(item.Tag.ToString(), out int tagValue) && tagValue == isFlag)
|
||||
{
|
||||
CmbIsFlag.SelectedItem = item;
|
||||
return;
|
||||
}
|
||||
}
|
||||
CmbIsFlag.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void BtnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void BtnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void BtnConfirm_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_location.locationName = TxtLocationName.Text.Trim();
|
||||
_location.locationArea = TxtLocationArea.Text.Trim();
|
||||
_location.storeCode = TxtStoreCode.Text.Trim();
|
||||
_location.locationRows = int.TryParse(TxtLocationRows.Text, out int rows) ? rows : null;
|
||||
_location.locationColumns = int.TryParse(TxtLocationColumns.Text, out int cols) ? cols : null;
|
||||
_location.locationLayers = int.TryParse(TxtLocationLayers.Text, out int layers) ? layers : null;
|
||||
_location.locationStatus = GetSelectedStatus(CmbLocationStatus);
|
||||
_location.agvPosition = TxtAgvPosition.Text.Trim();
|
||||
_location.deviceCode = TxtDeviceCode.Text.Trim();
|
||||
_location.materialCode = TxtMaterialCode.Text.Trim();
|
||||
_location.palletBarcode = TxtPalletBarcode.Text.Trim();
|
||||
_location.stackCount = TxtStackCount.Text.Trim();
|
||||
_location.isFlag = GetSelectedIsFlag(CmbIsFlag);
|
||||
_location.remark = TxtRemark.Text.Trim();
|
||||
_location.updatedBy = Environment.UserName;
|
||||
_location.updatedTime = DateTime.Now;
|
||||
|
||||
_locationService.Update(_location);
|
||||
CustomMessageBox.Show("更新成功", "提示");
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CustomMessageBox.Show($"更新失败: {ex.Message}", "错误");
|
||||
}
|
||||
}
|
||||
|
||||
private int GetSelectedStatus(ComboBox cmb)
|
||||
{
|
||||
if (cmb.SelectedItem is ComboBoxItem item && item.Tag != null)
|
||||
{
|
||||
return int.TryParse(item.Tag.ToString(), out int status) ? status : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int GetSelectedIsFlag(ComboBox cmb)
|
||||
{
|
||||
if (cmb.SelectedItem is ComboBoxItem item && item.Tag != null)
|
||||
{
|
||||
return int.TryParse(item.Tag.ToString(), out int flag) ? flag : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,472 @@
|
||||
<UserControl x:Class="Sln.Wcs.UI.Page.BasicInfo.LocationInfo.LocationInfoPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Sln.Wcs.UI.Page.BasicInfo.LocationInfo"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="600" d:DesignWidth="1000"
|
||||
Background="#0D0D18">
|
||||
<UserControl.Resources>
|
||||
<local:LocationStatusConverter x:Key="LocationStatusConverter"/>
|
||||
<local:IsFlagConverter x:Key="IsFlagConverter"/>
|
||||
|
||||
<Style x:Key="DataGridStyle" TargetType="DataGrid">
|
||||
<Setter Property="Background" Value="#1A1A2E"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
<Setter Property="BorderBrush" Value="#3A3A4A"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="RowBackground" Value="#1A1A2E"/>
|
||||
<Setter Property="AlternatingRowBackground" Value="#16162A"/>
|
||||
<Setter Property="GridLinesVisibility" Value="Horizontal"/>
|
||||
<Setter Property="HorizontalGridLinesBrush" Value="#2A2A35"/>
|
||||
<Setter Property="VerticalGridLinesBrush" Value="#2A2A35"/>
|
||||
<Setter Property="HeadersVisibility" Value="Column"/>
|
||||
<Setter Property="SelectionMode" Value="Single"/>
|
||||
<Setter Property="SelectionUnit" Value="FullRow"/>
|
||||
<Setter Property="CanUserAddRows" Value="False"/>
|
||||
<Setter Property="CanUserDeleteRows" Value="False"/>
|
||||
<Setter Property="AutoGenerateColumns" Value="False"/>
|
||||
<Setter Property="IsReadOnly" Value="True"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="#252540"/>
|
||||
<Setter Property="Foreground" Value="#B0B0B0"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="Padding" Value="12,10"/>
|
||||
<Setter Property="BorderBrush" Value="#3A3A4A"/>
|
||||
<Setter Property="BorderThickness" Value="0,0,1,1"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="DataGridCell">
|
||||
<Setter Property="Padding" Value="12,8"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="DataGridCell">
|
||||
<Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}">
|
||||
<ContentPresenter VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#3D3D5C"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#2A2A45"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#3D3D5C"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="OperateBtnStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
<Setter Property="Padding" Value="10,5"/>
|
||||
<Setter Property="Margin" Value="0,0,6,0"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="4" Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#3D3D5C"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="EditBtnStyle" TargetType="Button" BasedOn="{StaticResource OperateBtnStyle}">
|
||||
<Setter Property="Foreground" Value="#64B5F6"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="DeleteBtnStyle" TargetType="Button" BasedOn="{StaticResource OperateBtnStyle}">
|
||||
<Setter Property="Foreground" Value="#EF5350"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TitleStyle" TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="#ECF0F1"/>
|
||||
<Setter Property="FontSize" Value="24"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Setter Property="Margin" Value="0,0,16,16"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="AddBtnStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="#2196F3"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="Padding" Value="16,6"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="6" Padding="{TemplateBinding Padding}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="+" FontSize="16" FontWeight="Bold" Margin="0,0,6,0" VerticalAlignment="Center"/>
|
||||
<ContentPresenter VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#42A5F5"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#1976D2"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="QueryBtnStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="#3A3A4A"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="Padding" Value="16,6"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="6" Padding="{TemplateBinding Padding}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="🔍" FontSize="12" Margin="0,0,6,0" VerticalAlignment="Center"/>
|
||||
<ContentPresenter VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#4A4A5A"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#2A2A3A"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="FormLabelStyle" TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="#B0B0B0"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="FormTextBoxStyle" TargetType="TextBox">
|
||||
<Setter Property="Background" Value="#1A1A2E"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
<Setter Property="BorderBrush" Value="#3A3A4A"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="10,8"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TextBox">
|
||||
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4" Padding="{TemplateBinding Padding}">
|
||||
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsFocused" Value="True">
|
||||
<Setter Property="BorderBrush" Value="#2196F3"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 下拉框样式 -->
|
||||
<Style x:Key="FormComboBoxStyle" TargetType="ComboBox">
|
||||
<Setter Property="Background" Value="#0D0D18"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
<Setter Property="BorderBrush" Value="#3A3A4A"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="10,8"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBox">
|
||||
<Grid>
|
||||
<Border x:Name="Border" Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="30"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter Grid.Column="0" x:Name="ContentSite"
|
||||
Margin="10,0,30,0"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Content="{TemplateBinding SelectionBoxItem}"
|
||||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
<ToggleButton Grid.ColumnSpan="2" x:Name="ToggleButton" ClickMode="Press" Focusable="False"
|
||||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Background="Transparent" BorderThickness="0">
|
||||
<ToggleButton.Template>
|
||||
<ControlTemplate TargetType="ToggleButton">
|
||||
<Border Background="Transparent"/>
|
||||
</ControlTemplate>
|
||||
</ToggleButton.Template>
|
||||
</ToggleButton>
|
||||
<Path Grid.Column="1" x:Name="Arrow" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Data="M 0 0 L 6 6 L 12 0 Z" Fill="#B0B0B0"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Popup x:Name="Popup" AllowsTransparency="True" IsOpen="{TemplateBinding IsDropDownOpen}" PopupAnimation="Slide"
|
||||
Placement="Bottom" Focusable="False">
|
||||
<Border x:Name="DropDown" MinWidth="{TemplateBinding ActualWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
Background="#1A1A2E" BorderBrush="#3A3A4A" BorderThickness="1" CornerRadius="4" Margin="0,2,0,0">
|
||||
<ScrollViewer Margin="4">
|
||||
<StackPanel IsItemsHost="True"/>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="#2196F3"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsDropDownOpen" Value="True">
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="#2196F3"/>
|
||||
<Setter TargetName="Arrow" Property="Data" Value="M 0 6 L 6 0 L 12 6 Z"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 下拉项样式 -->
|
||||
<Style TargetType="ComboBoxItem">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="#E0E0E0"/>
|
||||
<Setter Property="Padding" Value="10,8"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBoxItem">
|
||||
<Border x:Name="Border" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" CornerRadius="2">
|
||||
<ContentPresenter/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="#252540"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="#2196F3"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid Margin="24">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Margin="0,0,0,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="8"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="8"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="8"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition Width="16"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="库位信息" Style="{StaticResource TitleStyle}" Margin="0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Text="库位编号" Style="{StaticResource FormLabelStyle}" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Column="4" x:Name="txtLocationCode" Style="{StaticResource FormTextBoxStyle}" Height="34" VerticalAlignment="Center"/>
|
||||
|
||||
<TextBlock Grid.Column="6" Text="库位名称" Style="{StaticResource FormLabelStyle}" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Column="8" x:Name="txtLocationName" Style="{StaticResource FormTextBoxStyle}" Height="34" VerticalAlignment="Center"/>
|
||||
|
||||
<TextBlock Grid.Column="10" Text="库位状态" Style="{StaticResource FormLabelStyle}" VerticalAlignment="Center"/>
|
||||
<ComboBox Grid.Column="12" x:Name="cmbLocationStatus" Style="{StaticResource FormComboBoxStyle}" Height="34" VerticalAlignment="Center">
|
||||
<ComboBoxItem Content="全部" Tag="" IsSelected="True"/>
|
||||
<ComboBoxItem Content="未使用" Tag="0"/>
|
||||
<ComboBoxItem Content="已使用" Tag="1"/>
|
||||
<ComboBoxItem Content="锁库" Tag="2"/>
|
||||
<ComboBoxItem Content="异常" Tag="3"/>
|
||||
</ComboBox>
|
||||
|
||||
<Button Grid.Column="14" Content="查询" Style="{StaticResource QueryBtnStyle}" Height="34" Click="BtnSearch_Click" VerticalAlignment="Center"/>
|
||||
<Button Grid.Column="16" Content="添加库位" Style="{StaticResource AddBtnStyle}" Click="BtnAdd_Click" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
|
||||
<DataGrid x:Name="dataGrid" Grid.Row="1" Style="{StaticResource DataGridStyle}" MouseDoubleClick="DataGrid_MouseDoubleClick">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="序号" Binding="{Binding RowIndex}" Width="60">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="库位编号" Binding="{Binding locationCode}" Width="120">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="库位名称" Binding="{Binding locationName}" Width="120">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="库位区域" Binding="{Binding locationArea}" Width="100">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="所属仓库" Binding="{Binding storeCode}" Width="100">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="排" Binding="{Binding locationRows}" Width="60">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="列" Binding="{Binding locationColumns}" Width="60">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="层" Binding="{Binding locationLayers}" Width="60">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="库位状态" Binding="{Binding locationStatus, Converter={StaticResource LocationStatusConverter}}" Width="90">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="是否标识" Binding="{Binding isFlag, Converter={StaticResource IsFlagConverter}}" Width="90">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="备注" Binding="{Binding remark}" Width="*">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="更新时间" Binding="{Binding updatedTime, StringFormat='{}{0:yyyy-MM-dd HH:mm}'}" Width="150">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="操作" Width="140">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<Button Content="编辑" Style="{StaticResource EditBtnStyle}" Click="BtnEdit_Click"/>
|
||||
<Button Content="删除" Style="{StaticResource DeleteBtnStyle}" Click="BtnDelete_Click"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -0,0 +1,188 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Sln.Wcs.Model.Domain;
|
||||
using Sln.Wcs.Repository.service;
|
||||
using Sln.Wcs.UI.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Sln.Wcs.UI.Page.BasicInfo.LocationInfo
|
||||
{
|
||||
public partial class LocationInfoPage : UserControl
|
||||
{
|
||||
private readonly IBaseLocationInfoService _locationService;
|
||||
private string _searchLocationCode = "";
|
||||
private string _searchLocationName = "";
|
||||
private int? _searchLocationStatus = null;
|
||||
|
||||
public LocationInfoPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
_locationService = App.ServiceProvider.GetService<IBaseLocationInfoService>();
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _locationService.Query()
|
||||
.Where(x => string.IsNullOrEmpty(_searchLocationCode) || (x.locationCode != null && x.locationCode.Contains(_searchLocationCode)))
|
||||
.Where(x => string.IsNullOrEmpty(_searchLocationName) || (x.locationName != null && x.locationName.Contains(_searchLocationName)))
|
||||
.Where(x => !_searchLocationStatus.HasValue || x.locationStatus == _searchLocationStatus)
|
||||
.OrderByDescending(x => x.updatedTime)
|
||||
.ToList();
|
||||
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
list[i].RowIndex = i + 1;
|
||||
}
|
||||
|
||||
dataGrid.ItemsSource = list;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CustomMessageBox.Show($"加载数据失败: {ex.Message}", "错误");
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnSearch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_searchLocationCode = txtLocationCode.Text.Trim();
|
||||
_searchLocationName = txtLocationName.Text.Trim();
|
||||
_searchLocationStatus = GetSelectedStatus();
|
||||
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private int? GetSelectedStatus()
|
||||
{
|
||||
if (cmbLocationStatus.SelectedItem is ComboBoxItem item && item.Tag != null)
|
||||
{
|
||||
if (int.TryParse(item.Tag.ToString(), out int status))
|
||||
{
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void BtnReset_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
txtLocationCode.Text = "";
|
||||
txtLocationName.Text = "";
|
||||
cmbLocationStatus.SelectedIndex = 0;
|
||||
|
||||
_searchLocationCode = "";
|
||||
_searchLocationName = "";
|
||||
_searchLocationStatus = null;
|
||||
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void BtnAdd_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var window = new LocationAddWindow
|
||||
{
|
||||
Owner = Window.GetWindow(this)
|
||||
};
|
||||
|
||||
if (window.ShowDialog() == true)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnEdit_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (dataGrid.SelectedItem is BaseLocationInfo location)
|
||||
{
|
||||
var window = new LocationEditWindow(location)
|
||||
{
|
||||
Owner = Window.GetWindow(this)
|
||||
};
|
||||
|
||||
if (window.ShowDialog() == true)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnDelete_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (dataGrid.SelectedItem is BaseLocationInfo location)
|
||||
{
|
||||
var result = CustomMessageBox.Show(
|
||||
$"确定要删除库位 \"{location.locationCode}\" 吗?",
|
||||
"确认删除",
|
||||
MessageBoxButton.YesNo
|
||||
);
|
||||
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
try
|
||||
{
|
||||
_locationService.Delete(location);
|
||||
CustomMessageBox.Show("删除成功", "提示");
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CustomMessageBox.Show($"删除失败: {ex.Message}", "错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DataGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
BtnEdit_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
public class LocationStatusConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is int status)
|
||||
{
|
||||
return status switch
|
||||
{
|
||||
0 => "未使用",
|
||||
1 => "已使用",
|
||||
2 => "锁库",
|
||||
3 => "异常",
|
||||
_ => "未知"
|
||||
};
|
||||
}
|
||||
return "未知";
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class IsFlagConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is int isFlag)
|
||||
{
|
||||
return isFlag == 1 ? "是" : "否";
|
||||
}
|
||||
return "否";
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue