Browse Source

需求单No.143137 白条发货、白条收货客户端调整。

master
yibo 6 years ago
parent
commit
536e869306
9 changed files with 169 additions and 60 deletions
  1. +1
    -0
      B3DealerClient/App.xaml
  2. +7
    -0
      B3DealerClient/B3DealerClient.csproj
  3. +70
    -0
      B3DealerClient/Control/SwitchCheckBox.xaml
  4. +72
    -0
      B3DealerClient/Control/SwitchCheckBox.xaml.cs
  5. +9
    -5
      B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml
  6. +4
    -1
      B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml.cs
  7. +3
    -0
      B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml
  8. +2
    -37
      B3DealerClient/Windows/Test.xaml
  9. +1
    -17
      B3DealerClient/Windows/Test.xaml.cs

+ 1
- 0
B3DealerClient/App.xaml View File

@ -13,6 +13,7 @@
<ResourceDictionary Source="Style/DataGrid.xaml"/>
<ResourceDictionary Source="Style/CheckBox.xaml"/>
<ResourceDictionary Source="Style/Border.xaml"/>
<ResourceDictionary Source="Control/SwitchCheckBox.xaml"/>
<!--<ResourceDictionary Source="pack://application:,,,/TSingSoft.WpfControls;component/Style/Colors.xaml"/>
<ResourceDictionary Source="pack://application:,,,/TSingSoft.WpfControls;component/Style/Global.xaml" />
<ResourceDictionary Source="pack://application:,,,/TSingSoft.WpfControls;component/Style/Themes/TSIcon.xaml" />


+ 7
- 0
B3DealerClient/B3DealerClient.csproj View File

@ -102,6 +102,9 @@
<Compile Include="Control\NumberPad.xaml.cs">
<DependentUpon>NumberPad.xaml</DependentUpon>
</Compile>
<Compile Include="Control\SwitchCheckBox.xaml.cs">
<DependentUpon>SwitchCheckBox.xaml</DependentUpon>
</Compile>
<Compile Include="Control\WeightConfig.cs" />
<Compile Include="Control\WeightControl.xaml.cs">
<DependentUpon>WeightControl.xaml</DependentUpon>
@ -193,6 +196,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Control\SwitchCheckBox.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Control\WeightControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>


+ 70
- 0
B3DealerClient/Control/SwitchCheckBox.xaml View File

@ -0,0 +1,70 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:B3DealerClient.Control">
<Style TargetType="{x:Type local:SwitchCheckBox}">
<Setter Property="Background" Value="#FF4A9E4A"></Setter>
<Setter Property="Foreground" Value="#DDE8E1"></Setter>
<Setter Property="CheckedForeground" Value="White"></Setter>
<Setter Property="CheckedBackground" Value="#FF0CC50C"></Setter>
<Setter Property="FontSize" Value="13"></Setter>
<Setter Property="Cursor" Value="Hand"></Setter>
<Setter Property="Margin" Value="1"></Setter>
<Setter Property="Template">
<Setter.Value>
<!--控件模板-->
<ControlTemplate TargetType="{x:Type local:SwitchCheckBox}">
<Viewbox Stretch="Uniform" VerticalAlignment="Center" HorizontalAlignment="Center">
<Border x:Name="border" Width="75" Height="28" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"
Margin="{TemplateBinding Margin}" CornerRadius="14">
<StackPanel Orientation="Horizontal">
<!--状态球-->
<Border x:Name="state" Width="24" Height="24" Margin="3,2,1,2" CornerRadius="12" SnapsToDevicePixels="True"
Background="{TemplateBinding Foreground}">
<Border.RenderTransform>
<TranslateTransform x:Name="transState" X="0"></TranslateTransform>
</Border.RenderTransform>
</Border>
<!--文本框-->
<TextBlock Width="40" Foreground="{TemplateBinding Foreground}" x:Name="txt" Text="{TemplateBinding Text}" VerticalAlignment="Center" TextAlignment="Center">
<TextBlock.RenderTransform>
<TranslateTransform x:Name="transTxt" X="0"></TranslateTransform>
</TextBlock.RenderTransform>
</TextBlock>
</StackPanel>
</Border>
</Viewbox>
<!--触发器:设置选中状态符号-->
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Text" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=CheckedText}" TargetName="txt"/>
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=CheckedForeground}" TargetName="state"/>
<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=CheckedForeground}" TargetName="txt"/>
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=CheckedBackground}" TargetName="border"/>
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="transState" Storyboard.TargetProperty="X" To="45" Duration="0:0:0.2" />
<DoubleAnimation Storyboard.TargetName="transTxt" Storyboard.TargetProperty="X" To="-24" Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="transState" Storyboard.TargetProperty="X" To="0" Duration="0:0:0.2" />
<DoubleAnimation Storyboard.TargetName="transTxt" Storyboard.TargetProperty="X" To="0" Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" Value="{StaticResource DisableOpacity}" TargetName="border"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

+ 72
- 0
B3DealerClient/Control/SwitchCheckBox.xaml.cs View File

@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace B3DealerClient.Control
{
/// <summary>
/// SwitchCheckBox.xaml 的交互逻辑
/// </summary>
public partial class SwitchCheckBox : CheckBox
{
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
"Text", typeof(string), typeof(SwitchCheckBox), new PropertyMetadata("Off"));
/// <summary>
/// 默认文本(未选中)
/// </summary>
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
public static readonly DependencyProperty CheckedTextProperty = DependencyProperty.Register(
"CheckedText", typeof(string), typeof(SwitchCheckBox), new PropertyMetadata("On"));
/// <summary>
/// 选中状态文本
/// </summary>
public string CheckedText
{
get { return (string)GetValue(CheckedTextProperty); }
set { SetValue(CheckedTextProperty, value); }
}
public static readonly DependencyProperty CheckedForegroundProperty =
DependencyProperty.Register("CheckedForeground", typeof(Brush), typeof(SwitchCheckBox), new PropertyMetadata(Brushes.WhiteSmoke));
/// <summary>
/// 选中状态前景样式
/// </summary>
public Brush CheckedForeground
{
get { return (Brush)GetValue(CheckedForegroundProperty); }
set { SetValue(CheckedForegroundProperty, value); }
}
public static readonly DependencyProperty CheckedBackgroundProperty =
DependencyProperty.Register("CheckedBackground", typeof(Brush), typeof(SwitchCheckBox), new PropertyMetadata(Brushes.LimeGreen));
/// <summary>
/// 选中状态背景色
/// </summary>
public Brush CheckedBackground
{
get { return (Brush)GetValue(CheckedBackgroundProperty); }
set { SetValue(CheckedBackgroundProperty, value); }
}
static SwitchCheckBox()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(SwitchCheckBox), new FrameworkPropertyMetadata(typeof(SwitchCheckBox)));
}
}
}

+ 9
- 5
B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml View File

@ -47,13 +47,17 @@
<ColumnDefinition Width="0.8*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<local:WeightControl x:Name="weightControl" HorizontalAlignment="Left" Width="250" Margin="2,5,0,5"/>
<WrapPanel HorizontalAlignment="Right" Margin="0,10,10,0">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<local:WeightControl x:Name="weightControl" Grid.RowSpan="2" HorizontalAlignment="Left" Width="250" Margin="2,5,0,5"/>
<WrapPanel HorizontalAlignment="Right" Margin="0,5,10,0">
<TextBlock Text="扣钩重:"/>
<TextBox x:Name="hook" Text="{Binding HookWeight,StringFormat=\{0:0.######\}}" PreviewMouseDown="NumberBox_PreviewMouseDown"/>
</WrapPanel>
<WrapPanel Grid.Column="1" HorizontalAlignment="Center" Margin="0,10">
</WrapPanel>
<local:SwitchCheckBox x:Name="weightUnit" Grid.Row="1" HorizontalAlignment="Right" Text="头" CheckedText="片" Width="90" Margin="10,0"/>
<WrapPanel Grid.Column="1" HorizontalAlignment="Center" Margin="0,5">
<TextBlock Text="供应商:"/>
<TextBlock Text="{Binding Dmo.Supplier_Name}" Width="200" TextWrapping="Wrap" Margin="0,0,10,0" Foreground="Red"/>
<TextBlock Text="收货仓库:" Foreground="Red"/>


+ 4
- 1
B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml.cs View File

@ -235,7 +235,10 @@ namespace B3DealerClient.Windows.CarcassInStoreWindow_
record.Weight = context.Weight;
record.Pics = context.Pics.Value;
record.Discont = (context.HookWeight ?? 0) * Math.Ceiling(record.Pics);
record.NetWeight = record.Weight - record.Discont;
if (weightUnit.IsChecked == true)
record.NetWeight = Math.Ceiling(record.Pics / 2) * (context.HookWeight ?? 0);
else
record.NetWeight = record.Weight - record.Discont;
record.Date = DateTime.Now;
record.Selected = true;
CarcassInStoreBL.InsertRecord(record);


+ 3
- 0
B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml View File

@ -236,6 +236,9 @@
<Button Content="4"/>
<Button Content="5"/>
<Button Content="6"/>
<Button Content="7"/>
<Button Content="8"/>
<Button Content="9"/>
<Button Content="0" Width="200"/>
<Button Content="./点"/>
</WrapPanel>


+ 2
- 37
B3DealerClient/Windows/Test.xaml View File

@ -2,42 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Test" Height="300" Width="300">
<Grid>
<ListBox x:Name="lb">
<ListBox.Resources>
<Style TargetType="Button" BasedOn="{StaticResource RedButton}">
<EventSetter Event="PreviewMouseDown" Handler="BtnClick"/>
</Style>
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
<Button MinWidth="80" >
<Button.Content>
<TextBlock Text="{Binding Name}"/>
</Button.Content>
</Button>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!--<ListView x:Name="lv">
<ListView.Resources>
<Style TargetType="Button" BasedOn="{StaticResource RedButton}">
<EventSetter Event="PreviewMouseDown" Handler="BtnClick"/>
</Style>
</ListView.Resources>
<ListView.ItemTemplate>
<DataTemplate>
<Button MinWidth="80" >
<Button.Content>
<TextBlock Text="{Binding Name}"/>
</Button.Content>
</Button>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>-->
<Grid>
</Grid>
</Window>

+ 1
- 17
B3DealerClient/Windows/Test.xaml.cs View File

@ -20,25 +20,9 @@ namespace B3DealerClient.Windows
/// </summary>
public partial class Test : Window
{
List<NameIDPair> Items;
public Test()
{
{
InitializeComponent();
Items = new List<NameIDPair>();
Items.Add(new NameIDPair() { ID = 1, Name = "张三" });
Items.Add(new NameIDPair() { ID = 2, Name = "张1" });
Items.Add(new NameIDPair() { ID = 3, Name = "张2" });
Items.Add(new NameIDPair() { ID = 4, Name = "张4" });
Items.Add(new NameIDPair() { ID = 5, Name = "张5" });
Items.Add(new NameIDPair() { ID = 6, Name = "张6" });
lb .ItemsSource = Items;
}
private void BtnClick(object sender, MouseButtonEventArgs e)
{
var btn = sender as Button;
var tag = btn.Tag as NameIDPair;
MessageBox.Show(tag.ID.ToString());
}
}
}

Loading…
Cancel
Save