终端一体化运控平台
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.
 
 
 

285 line
17 KiB

  1. <UserControl x:Class="View.RecipeView"
  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:View"
  7. xmlns:vm ="clr-namespace:ViewModel"
  8. mc:Ignorable="d"
  9. Name="参数设置界面"
  10. d:DesignHeight="600" d:DesignWidth="800">
  11. <UserControl.DataContext>
  12. <vm:RecipeViewModel/>
  13. </UserControl.DataContext>
  14. <UserControl.Resources>
  15. <ResourceDictionary>
  16. <ResourceDictionary.MergedDictionaries>
  17. <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
  18. </ResourceDictionary.MergedDictionaries>
  19. <Style x:Key="button_Style" TargetType="Button">
  20. <Setter Property="VerticalContentAlignment" Value="Center" />
  21. <Setter Property="Cursor" Value="Hand" />
  22. <Setter Property="Foreground" Value="#a2c2e8" />
  23. <Setter Property="Width" Value="80" />
  24. <Setter Property="Height" Value="25" />
  25. <Setter Property="Template">
  26. <Setter.Value>
  27. <ControlTemplate TargetType="Button">
  28. <ControlTemplate.Resources>
  29. <Storyboard x:Key="OnMouseEnter1">
  30. <ColorAnimationUsingKeyFrames Storyboard.TargetName="BD" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
  31. <EasingColorKeyFrame KeyTime="0:0:0.1" Value="#FF139DDB" />
  32. </ColorAnimationUsingKeyFrames>
  33. <ColorAnimationUsingKeyFrames Storyboard.TargetName="BD" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
  34. <EasingColorKeyFrame KeyTime="0:0:0.1" Value="#FF135EC2" />
  35. </ColorAnimationUsingKeyFrames>
  36. </Storyboard>
  37. </ControlTemplate.Resources>
  38. <Border
  39. x:Name="BD"
  40. Background="Transparent"
  41. BorderBrush="#05408a"
  42. BorderThickness="1"
  43. CornerRadius="12">
  44. <TextBlock
  45. x:Name="textBlock"
  46. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  47. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  48. FontSize="16"
  49. Foreground="#a2c2e8"
  50. Text="{TemplateBinding Content}" />
  51. </Border>
  52. <ControlTemplate.Triggers>
  53. <Trigger Property="IsMouseOver" Value="true">
  54. <Setter TargetName="BD" Property="Background" Value="#009dff" />
  55. <Setter TargetName="textBlock" Property="Foreground" Value="#a2c2e8" />
  56. </Trigger>
  57. <Trigger Property="IsEnabled" Value="False">
  58. <Setter TargetName="BD" Property="Background" Value="#ff55" />
  59. </Trigger>
  60. </ControlTemplate.Triggers>
  61. </ControlTemplate>
  62. </Setter.Value>
  63. </Setter>
  64. </Style>
  65. <Style TargetType="DataGrid">
  66. <Setter Property="CanUserResizeColumns" Value="false" />
  67. <Setter Property="Background" Value="Transparent" />
  68. <Setter Property="HorizontalGridLinesBrush">
  69. <Setter.Value>
  70. <SolidColorBrush Color="#4fade8" />
  71. </Setter.Value>
  72. </Setter>
  73. <Setter Property="VerticalGridLinesBrush">
  74. <Setter.Value>
  75. <SolidColorBrush Color="#4fade8" />
  76. </Setter.Value>
  77. </Setter>
  78. </Style>
  79. <!--标题栏样式-->
  80. <Style TargetType="DataGridColumnHeader">
  81. <Setter Property="SnapsToDevicePixels" Value="True" />
  82. <Setter Property="MinWidth" Value="0" />
  83. <Setter Property="MinHeight" Value="25" />
  84. <Setter Property="Foreground" Value="#FF00EEF3" />
  85. <Setter Property="FontSize" Value="16" />
  86. <Setter Property="Cursor" Value="Hand" />
  87. <Setter Property="Template">
  88. <Setter.Value>
  89. <ControlTemplate TargetType="DataGridColumnHeader">
  90. <Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1"
  91. BorderBrush="#FF074B92"
  92. Width="Auto">
  93. <Grid>
  94. <Grid.ColumnDefinitions>
  95. <ColumnDefinition Width="*" />
  96. </Grid.ColumnDefinitions>
  97. <ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center"
  98. HorizontalAlignment="Center" />
  99. <Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill"
  100. Grid.Column="0" Width="8" Height="6" Fill="White" Margin="0,0,50,0"
  101. VerticalAlignment="Center" RenderTransformOrigin="1,1" />
  102. <Rectangle Width="1" Fill="#FF074B92" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
  103. </Grid>
  104. </Border>
  105. </ControlTemplate>
  106. </Setter.Value>
  107. </Setter>
  108. <Setter Property="Height" Value="25" />
  109. </Style>
  110. <!--行样式触发-->
  111. <!--背景色改变必须先设置cellStyle 因为cellStyle会覆盖rowStyle样式-->
  112. <Style TargetType="DataGridRow">
  113. <Setter Property="Background" Value="Transparent" />
  114. <Setter Property="Height" Value="30" />
  115. <Setter Property="Foreground" Value="#a2c2e8" />
  116. <Setter Property="VerticalContentAlignment" Value="Center"/>
  117. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  118. </Style>
  119. <!--单元格样式触发-->
  120. <Style TargetType="DataGridCell">
  121. <Setter Property="Template">
  122. <Setter.Value>
  123. <ControlTemplate TargetType="DataGridCell">
  124. <TextBlock HorizontalAlignment="Center" VerticalAlignment="Top" Height="30" >
  125. <ContentPresenter Height="28" />
  126. </TextBlock>
  127. </ControlTemplate>
  128. </Setter.Value>
  129. </Setter>
  130. <Style.Triggers>
  131. <Trigger Property="IsSelected" Value="True">
  132. <Setter Property="Background" Value="#4fade8" />
  133. <Setter Property="BorderThickness" Value="0" />
  134. <Setter Property="Foreground" Value="White" />
  135. </Trigger>
  136. </Style.Triggers>
  137. </Style>
  138. </ResourceDictionary>
  139. </UserControl.Resources>
  140. <Grid >
  141. <Grid Margin="50" >
  142. <Grid.RowDefinitions>
  143. <RowDefinition Height="40"/>
  144. <RowDefinition Height="40"/>
  145. <RowDefinition Height="*"/>
  146. <RowDefinition Height="40"/>
  147. <RowDefinition Height="*"/>
  148. </Grid.RowDefinitions>
  149. <TextBlock Text="奶茶配方录入" Foreground="Wheat" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
  150. <StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="40,0">
  151. <TextBlock Text="奶茶名称:" Foreground="#409EFF" FontSize="16" Margin="10,0" VerticalAlignment="Center"/>
  152. <TextBox Text="{Binding LocalGoodName}" Width="120" FontSize="16" Margin="10,0"/>
  153. <Button Content="添加配方" Style="{StaticResource button_Style}" Margin="10,0" Command="{Binding AddRecipeCommand}"/>
  154. <Button Content="保存" Style="{StaticResource button_Style}" Margin="10,0" Command="{Binding SaveRecipeCommand}"/>
  155. <Button Content="取消" Style="{StaticResource button_Style}" Margin="10,0" Command="{Binding RecipeCancelCommand}"/>
  156. </StackPanel>
  157. <DataGrid Grid.Row="2" Margin="100,5" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding materialRecipes}"
  158. x:Name="recipeDataGrid"
  159. FrozenColumnCount="1"
  160. VerticalAlignment="Top"
  161. IsReadOnly="True"
  162. CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
  163. CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False" >
  164. <DataGrid.Columns >
  165. <DataGridTemplateColumn Header="ID" Width="30">
  166. <DataGridTemplateColumn.CellTemplate >
  167. <DataTemplate>
  168. <TextBlock Text="{ Binding MaterialID}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
  169. </DataTemplate>
  170. </DataGridTemplateColumn.CellTemplate>
  171. </DataGridTemplateColumn>
  172. <DataGridTemplateColumn Header="配料" Width="*">
  173. <DataGridTemplateColumn.CellTemplate >
  174. <DataTemplate>
  175. <ComboBox x:Name="combox" FontSize="16" Width="100"
  176. ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.MaterailList}"
  177. IsReadOnly="True"
  178. SelectedValue="{Binding Material ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
  179. />
  180. </DataTemplate>
  181. </DataGridTemplateColumn.CellTemplate>
  182. </DataGridTemplateColumn>
  183. <DataGridTemplateColumn Header="配料量" Width="175">
  184. <DataGridTemplateColumn.CellTemplate>
  185. <DataTemplate>
  186. <StackPanel Orientation="Horizontal" >
  187. <TextBox Text="{Binding MaterialWeight}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="50" FontSize="16"/>
  188. <TextBlock Text="g" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0" FontSize="16"/>
  189. </StackPanel>
  190. </DataTemplate>
  191. </DataGridTemplateColumn.CellTemplate>
  192. </DataGridTemplateColumn>
  193. <DataGridTemplateColumn Header="操作" Width="*">
  194. <DataGridTemplateColumn.CellTemplate>
  195. <DataTemplate>
  196. <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
  197. <Button Content="删除" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.RemoveRecipeCommand}"
  198. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}"
  199. Style="{StaticResource button_Style}"/>
  200. </StackPanel>
  201. </DataTemplate>
  202. </DataGridTemplateColumn.CellTemplate>
  203. </DataGridTemplateColumn>
  204. </DataGrid.Columns>
  205. </DataGrid>
  206. <TextBlock Text="本地奶茶配方" Grid.Row="3" Foreground="Wheat" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
  207. <DataGrid Grid.Row="4" Margin="100,5" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding localMaterialRecipes}" Width="500"
  208. FrozenColumnCount="1"
  209. VerticalAlignment="Top"
  210. IsReadOnly="True"
  211. CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
  212. CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
  213. <DataGrid.Columns>
  214. <DataGridTemplateColumn Header="奶茶" Width="200">
  215. <DataGridTemplateColumn.CellTemplate>
  216. <DataTemplate>
  217. <StackPanel Orientation="Horizontal" >
  218. <TextBlock Text="{Binding RecipeName}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0" FontSize="16"/>
  219. </StackPanel>
  220. </DataTemplate>
  221. </DataGridTemplateColumn.CellTemplate>
  222. </DataGridTemplateColumn>
  223. <DataGridTemplateColumn Header="操作" Width="*">
  224. <DataGridTemplateColumn.CellTemplate>
  225. <DataTemplate>
  226. <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
  227. <Button Content="删除" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.DeleteRecipeCommand}"
  228. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}"
  229. Style="{StaticResource button_Style}"/>
  230. </StackPanel>
  231. </DataTemplate>
  232. </DataGridTemplateColumn.CellTemplate>
  233. </DataGridTemplateColumn>
  234. </DataGrid.Columns>
  235. </DataGrid>
  236. </Grid>
  237. <Grid >
  238. <Grid.RowDefinitions>
  239. <RowDefinition Height="40"/>
  240. <RowDefinition Height="40"/>
  241. <RowDefinition Height="*"/>
  242. <RowDefinition Height="40"/>
  243. <RowDefinition Height="*"/>
  244. </Grid.RowDefinitions>
  245. <TextBlock Text="配料名称修改" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Wheat" FontSize="18"/>
  246. <Button Content="更新物料位置名称" Grid.Column="2" Grid.Row="1" Style="{StaticResource button_Style}" Width="150" Command="{Binding UpdateMaterialPosionCommand}"/>
  247. <DataGrid Grid.Row="2" Grid.RowSpan="3" Grid.Column="2" Margin="100,5" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding materailNameAndPosions}"
  248. FrozenColumnCount="1"
  249. VerticalAlignment="Top"
  250. IsReadOnly="True"
  251. CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
  252. CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
  253. <DataGrid.Columns>
  254. <DataGridTemplateColumn Header="物料位置" Width="170">
  255. <DataGridTemplateColumn.CellTemplate>
  256. <DataTemplate>
  257. <StackPanel Orientation="Horizontal" >
  258. <TextBlock Text="{Binding MaterialPosion}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0" FontSize="16"/>
  259. </StackPanel>
  260. </DataTemplate>
  261. </DataGridTemplateColumn.CellTemplate>
  262. </DataGridTemplateColumn>
  263. <DataGridTemplateColumn Header="物料" Width="*">
  264. <DataGridTemplateColumn.CellTemplate>
  265. <DataTemplate>
  266. <TextBox Text="{Binding MaterialName ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalContentAlignment="Center" Width="80" FontSize="16"/>
  267. </DataTemplate>
  268. </DataGridTemplateColumn.CellTemplate>
  269. </DataGridTemplateColumn>
  270. </DataGrid.Columns>
  271. </DataGrid>
  272. </Grid>
  273. </Grid>
  274. </UserControl>