终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

221 lines
15 KiB

  1. <UserControl x:Class="BPASmartClient.MilkWithTea.View.LocalConfigureView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:BPASmartClient.MilkWithTea.View"
  7. xmlns:vm="clr-namespace:BPASmartClient.MilkWithTea.ViewModel"
  8. mc:Ignorable="d"
  9. d:DesignHeight="800" d:DesignWidth="1400" Background="Transparent">
  10. <UserControl.DataContext>
  11. <vm:LocalConfigureViewModel/>
  12. </UserControl.DataContext>
  13. <UserControl.Resources>
  14. <Style TargetType="Button">
  15. <Setter Property="Width" Value="90"/>
  16. <Setter Property="Height" Value="20"/>
  17. <Setter Property="Foreground" Value="White"/>
  18. <Setter Property="BorderThickness" Value="0"/>
  19. <Setter Property="Background" Value="#43a9c7"/>
  20. <Setter Property="FontSize" Value="16"/>
  21. <Setter Property="Template">
  22. <Setter.Value>
  23. <ControlTemplate TargetType="Button">
  24. <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
  25. <TextBlock Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
  26. </Border>
  27. <ControlTemplate.Triggers>
  28. <Trigger Property="IsMouseOver" Value="True">
  29. <Setter TargetName="border" Property="Background" Value="#2f96b4"/>
  30. </Trigger>
  31. <Trigger Property="IsPressed" Value="True">
  32. <Setter TargetName="border" Property="Background" Value="#2a89a4"/>
  33. </Trigger>
  34. </ControlTemplate.Triggers>
  35. </ControlTemplate>
  36. </Setter.Value>
  37. </Setter>
  38. </Style>
  39. <Style TargetType="ListViewItem" >
  40. <Setter Property="Margin" Value="60,20"/>
  41. <Setter Property="Template">
  42. <Setter.Value>
  43. <ControlTemplate TargetType="ListViewItem">
  44. <Border Padding="4" x:Name="mborder" BorderBrush="Transparent" BorderThickness="1">
  45. <Border >
  46. <Grid Width="250" >
  47. <Grid.ColumnDefinitions>
  48. <ColumnDefinition Width="auto"/>
  49. <ColumnDefinition Width="*"/>
  50. </Grid.ColumnDefinitions>
  51. <TextBlock Text="{Binding MaterialPosition}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10,0"/>
  52. <TextBox Text="{Binding MaterialName}" Grid.Column="1" Width="140"
  53. HorizontalAlignment="Center" VerticalAlignment="Center"></TextBox>
  54. </Grid>
  55. </Border>
  56. </Border>
  57. <ControlTemplate.Triggers>
  58. <Trigger Property="IsMouseOver" Value="True">
  59. </Trigger>
  60. </ControlTemplate.Triggers>
  61. </ControlTemplate>
  62. </Setter.Value>
  63. </Setter>
  64. </Style>
  65. </UserControl.Resources>
  66. <Grid Background="#F3F6F9" Margin="20">
  67. <Grid>
  68. <Grid.RowDefinitions>
  69. <RowDefinition Height="40"/>
  70. <RowDefinition Height="*"/>
  71. </Grid.RowDefinitions>
  72. <Button Content="奶茶配方录入" HorizontalAlignment="Right" VerticalAlignment="Center" Width="150" Click="Button_Click"/>
  73. <ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible" Grid.Row="1">
  74. <StackPanel>
  75. <!--奶茶配方录入-->
  76. <!--<Expander Style="{StaticResource ExpanderStyle}">
  77. <Expander.Header>
  78. <TextBlock Text="奶茶配方录入" />
  79. </Expander.Header>
  80. <Expander.Content>
  81. <Grid>
  82. <Grid.RowDefinitions>
  83. <RowDefinition Height="80"/>
  84. <RowDefinition Height="*"/>
  85. </Grid.RowDefinitions>
  86. <StackPanel Orientation="Horizontal" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="40,0">
  87. <TextBlock Text="奶茶名称:" Foreground="DarkSlateGray" FontSize="20" Margin="10,0" VerticalAlignment="Center" />
  88. <TextBox Text="{Binding LocalGoodName}" Width="120" FontSize="16" Margin="10,0" VerticalContentAlignment="Center" Padding="2"/>
  89. <Button Content="添加配方" Margin="10,0" Width="120" Command="{Binding AddRecipeCommand}" Style="{StaticResource buttonNormal}"/>
  90. <Button Content="保存" Margin="10,0" Width="80" Command="{Binding SaveRecipeCommand}" Style="{StaticResource buttonNormal}"/>
  91. <Button Content="清空" Margin="10,0" Width="80" Command="{Binding RecipeCancelCommand}" Style="{StaticResource buttonNormal}"/>
  92. </StackPanel>
  93. <DataGrid Grid.Row="1" Margin="100,5,100,20" AutoGenerateColumns="False" RowHeight="32" ItemsSource="{Binding materialRecipes}"
  94. x:Name="recipeDataGrid"
  95. FrozenColumnCount="1"
  96. VerticalAlignment="Center" HorizontalAlignment="Center"
  97. Background="#F3F6F9"
  98. IsReadOnly="True"
  99. CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
  100. CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False" >
  101. <DataGrid.Columns >
  102. <DataGridTemplateColumn Header="ID" Width="40">
  103. <DataGridTemplateColumn.CellTemplate >
  104. <DataTemplate>
  105. <TextBlock Text="{ Binding MaterialID}" Foreground="Black"
  106. VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5"/>
  107. </DataTemplate>
  108. </DataGridTemplateColumn.CellTemplate>
  109. </DataGridTemplateColumn>
  110. <DataGridTemplateColumn Header="配料" Width="200">
  111. <DataGridTemplateColumn.CellTemplate >
  112. <DataTemplate>
  113. <ComboBox x:Name="combox" FontSize="16" Width="100" VerticalContentAlignment="Top"
  114. ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.MaterailList}"
  115. IsReadOnly="True" Style="{StaticResource cmbstyle}" Height="30"
  116. SelectedIndex="1"
  117. SelectedValue="{Binding Material ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
  118. </DataTemplate>
  119. </DataGridTemplateColumn.CellTemplate>
  120. </DataGridTemplateColumn>
  121. <DataGridTemplateColumn Header="配料量" Width="175" >
  122. <DataGridTemplateColumn.CellTemplate>
  123. <DataTemplate>
  124. <StackPanel Orientation="Horizontal" Margin="3" >
  125. <TextBox Text="{Binding MaterialWeight}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="50" FontSize="16"/>
  126. <TextBlock Text="g" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0" FontSize="16" Foreground="Black"/>
  127. </StackPanel>
  128. </DataTemplate>
  129. </DataGridTemplateColumn.CellTemplate>
  130. </DataGridTemplateColumn>
  131. <DataGridTemplateColumn Header="操作" Width="300">
  132. <DataGridTemplateColumn.CellTemplate>
  133. <DataTemplate>
  134. <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
  135. <Button Margin="4"
  136. Content="删除" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.RemoveRecipeCommand}"
  137. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}" />
  138. </StackPanel>
  139. </DataTemplate>
  140. </DataGridTemplateColumn.CellTemplate>
  141. </DataGridTemplateColumn>
  142. </DataGrid.Columns>
  143. </DataGrid>
  144. </Grid>
  145. </Expander.Content>
  146. </Expander>-->
  147. <!--配料录入-->
  148. <Expander Grid.Row="1" Style="{StaticResource ExpanderStyle}">
  149. <Expander.Header>
  150. <TextBlock Text="本地配料录入" />
  151. </Expander.Header>
  152. <Expander.Content>
  153. <Grid>
  154. <Grid.RowDefinitions>
  155. <RowDefinition Height="70"/>
  156. <RowDefinition Height="*"/>
  157. </Grid.RowDefinitions>
  158. <Button Content="保存物料位置名称" Grid.ColumnSpan="2" Style="{StaticResource buttonNormal}" Height="34" Width="200"
  159. Command="{Binding UpdateMaterialPosionCommand}"/>
  160. <ListView ItemsSource="{Binding localMaterails}" Grid.Row="1"
  161. Width="800" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  162. HorizontalAlignment="Center" VerticalAlignment="Center">
  163. <ListView.ItemsPanel>
  164. <ItemsPanelTemplate>
  165. <WrapPanel Margin="10"/>
  166. </ItemsPanelTemplate>
  167. </ListView.ItemsPanel>
  168. </ListView>
  169. </Grid>
  170. </Expander.Content>
  171. </Expander>
  172. <!--奶茶清单-->
  173. <Expander Grid.Row="2" Style="{StaticResource ExpanderStyle}" >
  174. <Expander.Header>
  175. <TextBlock Text="本地奶茶配方"/>
  176. </Expander.Header>
  177. <Expander.Content>
  178. <DataGrid Grid.Row="4" Margin="100,5" AutoGenerateColumns="False" RowHeight="32" ItemsSource="{Binding localMaterialRecipes}" Width="500"
  179. FrozenColumnCount="1"
  180. VerticalAlignment="Top"
  181. IsReadOnly="True"
  182. CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
  183. CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
  184. <DataGrid.Columns>
  185. <DataGridTemplateColumn Header="奶茶" Width="200">
  186. <DataGridTemplateColumn.CellTemplate>
  187. <DataTemplate>
  188. <StackPanel Orientation="Horizontal" >
  189. <TextBlock Text="{Binding RecipeName}" Foreground="Black"
  190. VerticalAlignment="Center" HorizontalAlignment="Center"
  191. Margin="5,2" FontSize="16"/>
  192. </StackPanel>
  193. </DataTemplate>
  194. </DataGridTemplateColumn.CellTemplate>
  195. </DataGridTemplateColumn>
  196. <DataGridTemplateColumn Header="操作" Width="*">
  197. <DataGridTemplateColumn.CellTemplate>
  198. <DataTemplate>
  199. <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
  200. <Button Content="删除" Margin="2"
  201. Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.DeleteRecipeCommand}"
  202. CommandParameter="{Binding RecipeID}"/>
  203. </StackPanel>
  204. </DataTemplate>
  205. </DataGridTemplateColumn.CellTemplate>
  206. </DataGridTemplateColumn>
  207. </DataGrid.Columns>
  208. </DataGrid>
  209. </Expander.Content>
  210. </Expander>
  211. </StackPanel>
  212. </ScrollViewer>
  213. </Grid>
  214. </Grid>
  215. </UserControl>