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

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

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