Commit 0603f778 authored by 潘栩锋's avatar 潘栩锋 🚴

解决称重的bug, 1. 混料累计 显示内容出错。 2.下料指示灯不提示

parent ac6c8086
......@@ -14,19 +14,10 @@
<ResourceDictionary Source="pack://application:,,,/FLY.Weight.UI.Client;component/Themes/ABCTab.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight.UI.Client;component/UnitTests/UnitTests_Weights.xaml"/>
</ResourceDictionary.MergedDictionaries>
<ControlTemplate x:Key="picture_button" TargetType="Button">
<Border Name="border" BorderThickness="1" CornerRadius="5">
<ContentPresenter Content="{TemplateBinding Content}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="BorderBrush" Value="LightBlue"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="LightGray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style TargetType="DataGridCell" >
<Setter Property="FontSize" Value="16"/>
</Style>
</ResourceDictionary>
</Page.Resources>
<Grid >
......@@ -112,11 +103,6 @@
</Grid>
<DataGrid Grid.Row="1" x:Name="gridFlows" ItemsSource="{Binding Record}" AutoGenerateColumns="False" IsReadOnly="True"
AlternationCount="5" AlternatingRowBackground="LightGray">
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="FontSize" Value="20"/>
</Style>
</DataGrid.CellStyle>
</DataGrid>
</Grid>
</Grid>
......
......@@ -16,7 +16,7 @@
</ResourceDictionary.MergedDictionaries>
<Style TargetType="DataGridCell" x:Key="DataGridCellStyle_Base">
<Setter Property="FontSize" Value="20"/>
<Setter Property="FontSize" Value="16"/>
</Style>
<Style TargetType="DataGridCell" x:Key="DataGridCellStyle_Percent" BasedOn="{StaticResource DataGridCellStyle_Base}">
<Setter Property="Background" Value="Gray"/>
......@@ -106,6 +106,11 @@
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="kg" Margin="10,0" />
</StackPanel>
</DataGridTextColumn.Header>
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource DataGridCellStyle_Base}">
<Setter Property="Background" Value="LightBlue"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
</DataGrid.Columns>
......
......@@ -13,6 +13,13 @@
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="DataGridCell" x:Key="DataGridCellStyle_Base">
<Setter Property="FontSize" Value="16"/>
</Style>
<Style TargetType="DataGridCell" x:Key="DataGridCellStyle_Percent" BasedOn="{StaticResource DataGridCellStyle_Base}">
<Setter Property="Background" Value="Gray"/>
<Setter Property="Foreground" Value="White"/>
</Style>
</ResourceDictionary>
</Page.Resources>
<Grid >
......@@ -80,11 +87,6 @@
<DataGrid Grid.Row="1" x:Name="gridFlows" ItemsSource="{Binding Record}" AutoGenerateColumns="False" IsReadOnly="True"
AlternationCount="5" AlternatingRowBackground="LightGray">
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="FontSize" Value="20"/>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Time,StringFormat={}{0:MM/dd HH:mm}}" IsReadOnly="True">
......@@ -101,6 +103,11 @@
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="kg" Margin="10,0" />
</StackPanel>
</DataGridTextColumn.Header>
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource DataGridCellStyle_Base}">
<Setter Property="Background" Value="LightGray"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<!--<DataGridTextColumn Binding="{Binding Items[0].Disp,StringFormat={}{0:F1}}" >
<DataGridTextColumn.Header>
......
......@@ -58,7 +58,7 @@ namespace FLY.Weight.UI.Client
this.weightSystemService = weightSystemService;
mWeighter = w;
int item_idx = this.weightSystemService.Items.IndexOf(w);
this.buffer = mixBufferCollection.GetMix(item_idx);
this.buffer = mixBufferCollection.GetRollMix(item_idx);
//templateRoot.DataContext = w;
......@@ -131,6 +131,8 @@ namespace FLY.Weight.UI.Client
Margin = new Thickness(10, 0, 10, 0)
});
dgtc2.Header = sp2;
dgtc2.CellStyle = this.FindResource("DataGridCellStyle_Percent") as Style;
gridFlows.Columns.Add(dgtc2);
}
......
......@@ -49,7 +49,7 @@
<GroupBox Grid.Column="1" BorderBrush="{Binding Color}" BorderThickness="3" >
<StackPanel Orientation="Horizontal" Margin="5">
<StackPanel Orientation="Vertical" >
<StackPanel >
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="批次重量" Foreground="{Binding Color}"/>
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding MixSet,StringFormat={}{0:F1}}"/>
......@@ -69,13 +69,13 @@
<GroupBox.Header>
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="当前" Foreground="{Binding Color}"/>
</GroupBox.Header>
<StackPanel Orientation="Vertical">
<StackPanel>
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" >
<StackPanel >
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal" Margin="3" >
<Grid Margin="30,0"/>
......@@ -87,7 +87,7 @@
<ItemsControl ItemsSource="{Binding Ingredients}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
<StackPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
......@@ -96,20 +96,22 @@
<Border Background="{Binding Color}" >
<StackPanel Orientation="Horizontal" Margin="3" >
<Grid Margin="5">
<TextBlock Foreground="White" FontSize="40" VerticalAlignment="Center">
<TextBlock FontSize="40" VerticalAlignment="Center" Width="50">
<Run Text="{Binding Number}"/><Run Text="#"/>
<TextBlock.Style>
<Style BasedOn="{StaticResource TextBlockStyle_FieldContent_mm}" TargetType="TextBlock">
<Style BasedOn="{StaticResource TextBlockStyle_FieldContent_mm}" TargetType="TextBlock" >
<Setter Property="Foreground" Value="White" />
<Style.Triggers>
<DataTrigger Binding="{Binding MixLight}" Value="True">
<Setter Property="Foreground" Value="{StaticResource Color_theme_static}"/>
<Setter Property="Foreground" Value="{Binding Color}"/>
<Setter Property="Background" Value="White"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
<StackPanel Orientation="Vertical" Margin="10,0">
<StackPanel Margin="10,0">
<Border BorderThickness="1" BorderBrush="White" Margin="3" MinWidth="120">
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" FontSize="26" Text="{Binding MixPSet,StringFormat={}{0:F1}}" Foreground="White" Background="Transparent"/>
......@@ -120,7 +122,7 @@
<Run Text="{Binding MixSet,StringFormat={}{0:F4}}"/><Run Text="kg"/>
</TextBlock>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="10,0">
<StackPanel Margin="10,0">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent}" FontSize="26" Text="{Binding MixPDisp,StringFormat={}{0:F2}}" Foreground="White" Background="Transparent"/>
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="%" Foreground="White" />
......@@ -140,7 +142,7 @@
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Column="1">
<StackPanel Grid.Column="1">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeader}" Text="设置" />
<control:PieChart x:Name="picchart_set" Width="60" Height="60" Margin="10" HorizontalAlignment="Left"
ItemValueBinding="MixPSet" ItemColorBinding="Color" ItemsSource="{Binding Ingredients}"
......@@ -177,11 +179,11 @@
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical">
<StackPanel>
<ItemsControl ItemsSource="{Binding Ingredients}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
<StackPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
......@@ -210,12 +212,12 @@
</StackPanel>
</Button>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Column="1">
<StackPanel Grid.Column="1">
<control:PieChart x:Name="picchart_total" Width="200" Height="200" Margin="10"
ItemValueBinding="MixCum" ItemColorBinding="Color" ItemsSource="{Binding Ingredients}"
/>
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Vertical" Margin="5">
<StackPanel Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeader}" Text="累计产量" />
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" Text="{Binding CumulativeProduction,StringFormat={}{0:F1}}"/>
......@@ -223,7 +225,7 @@
</StackPanel>
</StackPanel>
<Button Style="{StaticResource ButtonStyle_empty}" Background="Transparent" Click="button_clear_Click" Margin="5" Width="50">
<StackPanel Orientation="Vertical">
<StackPanel>
<Image Source="Images/close.png" />
<TextBlock Text="清零" Style="{StaticResource TextBlockStyle_title}" HorizontalAlignment="Center"/>
</StackPanel>
......
......@@ -58,6 +58,7 @@ namespace FLY.Weight.UI.Client
for (int j = 0; j < weight.BinCnt; j++)
{
int no = j + 1;
props.Add("MixLight_" + no);
//props.Add("MixPSet_" + no);
//props.Add("MixPDisp_" + no);
props.Add("MixCumPercent_" + no);
......
......@@ -46,7 +46,7 @@ namespace FLY.Weight.Client
}
public IBuffer<Lc_Mix> GetRollMix(int index)
{
string name = $"mix{index}";
string name = $"rollMix{index}";
if (buffers.ContainsKey(name))
{
return buffers[name];
......
......@@ -948,6 +948,7 @@ namespace FLY.Weight.Common
int no = i + 1;
IngredientCell ingredient = new IngredientCell();
ingredient.Number = no.ToString();
Misc.BindingOperations.SetBinding(this, $"MixLight_{no}", ingredient, "MixLight");
Misc.BindingOperations.SetBinding(this, $"MixPSet_{no}", ingredient, "MixPSet", Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(this, $"MixPDisp_{no}", ingredient, "MixPDisp", Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(this, $"MixCumPercent_{no}", ingredient, "MixCumPercent", Misc.BindingOperations.BindingMode.TwoWay);
......@@ -1025,7 +1026,6 @@ namespace FLY.Weight.Common
/// </summary>
public bool MixLight { get; set; }
private float mixPSet;
/// <summary>
/// 比例设定
/// </summary>
......
Subproject commit 98912f441dd8a0e3d9b4b55e39134728b745e877
Subproject commit e1cebe185cd0c19319b90c435e26abe0f8e6c45a
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment