diff --git a/B3DealerClient/App.xaml b/B3DealerClient/App.xaml index 725a37f..70cfaaf 100644 --- a/B3DealerClient/App.xaml +++ b/B3DealerClient/App.xaml @@ -13,6 +13,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/B3DealerClient/Control/SwitchCheckBox.xaml.cs b/B3DealerClient/Control/SwitchCheckBox.xaml.cs new file mode 100644 index 0000000..3419c54 --- /dev/null +++ b/B3DealerClient/Control/SwitchCheckBox.xaml.cs @@ -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 +{ + /// + /// SwitchCheckBox.xaml 的交互逻辑 + /// + public partial class SwitchCheckBox : CheckBox + { + public static readonly DependencyProperty TextProperty = DependencyProperty.Register( + "Text", typeof(string), typeof(SwitchCheckBox), new PropertyMetadata("Off")); + /// + /// 默认文本(未选中) + /// + 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")); + /// + /// 选中状态文本 + /// + 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)); + /// + /// 选中状态前景样式 + /// + 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)); + /// + /// 选中状态背景色 + /// + public Brush CheckedBackground + { + get { return (Brush)GetValue(CheckedBackgroundProperty); } + set { SetValue(CheckedBackgroundProperty, value); } + } + + static SwitchCheckBox() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(SwitchCheckBox), new FrameworkPropertyMetadata(typeof(SwitchCheckBox))); + } + } +} diff --git a/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml b/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml index 23fc34d..a4b8914 100644 --- a/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml +++ b/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml @@ -47,13 +47,17 @@ - - + + + + + + - - - + + + diff --git a/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml.cs b/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml.cs index 0feacdf..9950c5f 100644 --- a/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml.cs +++ b/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml.cs @@ -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); diff --git a/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml b/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml index e7cf85a..db63692 100644 --- a/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml +++ b/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml @@ -236,6 +236,9 @@ - - - - + + diff --git a/B3DealerClient/Windows/Test.xaml.cs b/B3DealerClient/Windows/Test.xaml.cs index e2d61e1..61080df 100644 --- a/B3DealerClient/Windows/Test.xaml.cs +++ b/B3DealerClient/Windows/Test.xaml.cs @@ -20,25 +20,9 @@ namespace B3DealerClient.Windows /// public partial class Test : Window { - List Items; public Test() - { + { InitializeComponent(); - Items = new List(); - 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()); } } }