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

282 regels
19 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="{x:Type DataGridCell}">
  15. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  16. <Setter Property="TextBlock.FontSize" Value="13" />
  17. <Setter Property="Background" Value="Transparent"/>
  18. <Setter Property="BorderBrush" Value="Transparent"/>
  19. <Setter Property="BorderThickness" Value="0"/>
  20. <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self},Path=Content.Text}" />
  21. <Setter Property="Template">
  22. <Setter.Value>
  23. <ControlTemplate TargetType="{x:Type DataGridCell}">
  24. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
  25. <!--HorizontalAlignment 可以设置内容展示位置-->
  26. <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" HorizontalAlignment="Center"
  27. Margin="{TemplateBinding Padding}"/>
  28. </Border>
  29. </ControlTemplate>
  30. </Setter.Value>
  31. </Setter>
  32. <Style.Triggers>
  33. <Trigger Property="IsEnabled" Value="False">
  34. <Setter Property="Opacity" Value=".56"/>
  35. </Trigger>
  36. </Style.Triggers>
  37. </Style>
  38. <Style TargetType="DataGridRow">
  39. <Setter Property="FontSize" Value="16"/>
  40. <Setter Property="VerticalAlignment" Value="Center"/>
  41. <Setter Property="Margin" Value="0,5"/>
  42. <Style.Triggers>
  43. <!-- 隔行换色 -->
  44. <Trigger Property="AlternationIndex" Value="0">
  45. <Setter Property="Background" Value="#FFFAFAFA" />
  46. </Trigger>
  47. <Trigger Property="AlternationIndex" Value="1">
  48. <Setter Property="Background" Value="#FFF5F5F7" />
  49. </Trigger>
  50. <Trigger Property="IsMouseOver" Value="True">
  51. <Setter Property="Background" Value="#87CEFA" />
  52. </Trigger>
  53. </Style.Triggers>
  54. </Style>
  55. <Style TargetType="Button">
  56. <Setter Property="Width" Value="90"/>
  57. <Setter Property="Height" Value="20"/>
  58. <Setter Property="Foreground" Value="White"/>
  59. <Setter Property="BorderThickness" Value="0"/>
  60. <Setter Property="Background" Value="#43a9c7"/>
  61. <Setter Property="FontSize" Value="16"/>
  62. <Setter Property="Template">
  63. <Setter.Value>
  64. <ControlTemplate TargetType="Button">
  65. <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
  66. <TextBlock Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
  67. </Border>
  68. <ControlTemplate.Triggers>
  69. <Trigger Property="IsMouseOver" Value="True">
  70. <Setter TargetName="border" Property="Background" Value="#2f96b4"/>
  71. </Trigger>
  72. <Trigger Property="IsPressed" Value="True">
  73. <Setter TargetName="border" Property="Background" Value="#2a89a4"/>
  74. </Trigger>
  75. </ControlTemplate.Triggers>
  76. </ControlTemplate>
  77. </Setter.Value>
  78. </Setter>
  79. </Style>
  80. </UserControl.Resources>
  81. <Grid Background="#F3F6F9" Margin="20">
  82. <ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible">
  83. <StackPanel>
  84. <!--奶茶配方录入-->
  85. <Expander Style="{StaticResource ExpanderStyle}">
  86. <Expander.Header>
  87. <TextBlock Text="奶茶配方录入" />
  88. </Expander.Header>
  89. <Expander.Content>
  90. <Grid>
  91. <Grid.RowDefinitions>
  92. <RowDefinition Height="80"/>
  93. <RowDefinition Height="*"/>
  94. </Grid.RowDefinitions>
  95. <StackPanel Orientation="Horizontal" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="40,0">
  96. <TextBlock Text="奶茶名称:" Foreground="DarkSlateGray" FontSize="20" Margin="10,0" VerticalAlignment="Center" />
  97. <TextBox Text="{Binding LocalGoodName}" Width="120" FontSize="16" Margin="10,0" VerticalContentAlignment="Center" Padding="2"/>
  98. <Button Content="添加配方" Margin="10,0" Width="120" Command="{Binding AddRecipeCommand}" Style="{StaticResource buttonNormal}"/>
  99. <Button Content="保存" Margin="10,0" Width="80" Command="{Binding SaveRecipeCommand}" Style="{StaticResource buttonNormal}"/>
  100. <Button Content="清空" Margin="10,0" Width="80" Command="{Binding RecipeCancelCommand}" Style="{StaticResource buttonNormal}"/>
  101. </StackPanel>
  102. <DataGrid Grid.Row="1" Margin="100,5,100,20" AutoGenerateColumns="False" RowHeight="32" ItemsSource="{Binding materialRecipes}"
  103. x:Name="recipeDataGrid"
  104. FrozenColumnCount="1"
  105. VerticalAlignment="Center" HorizontalAlignment="Center"
  106. Background="#F3F6F9"
  107. IsReadOnly="True"
  108. CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
  109. CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False" >
  110. <DataGrid.Columns >
  111. <DataGridTemplateColumn Header="ID" Width="40">
  112. <DataGridTemplateColumn.CellTemplate >
  113. <DataTemplate>
  114. <TextBlock Text="{ Binding MaterialID}" Foreground="Black"
  115. VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5"/>
  116. </DataTemplate>
  117. </DataGridTemplateColumn.CellTemplate>
  118. </DataGridTemplateColumn>
  119. <DataGridTemplateColumn Header="配料" Width="200">
  120. <DataGridTemplateColumn.CellTemplate >
  121. <DataTemplate>
  122. <ComboBox x:Name="combox" FontSize="16" Width="100" VerticalContentAlignment="Top"
  123. ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.MaterailList}"
  124. IsReadOnly="True" Style="{StaticResource cmbstyle}" Height="30"
  125. SelectedIndex="1"
  126. SelectedValue="{Binding Material ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
  127. </DataTemplate>
  128. </DataGridTemplateColumn.CellTemplate>
  129. </DataGridTemplateColumn>
  130. <DataGridTemplateColumn Header="配料量" Width="175" >
  131. <DataGridTemplateColumn.CellTemplate>
  132. <DataTemplate>
  133. <StackPanel Orientation="Horizontal" Margin="3" >
  134. <TextBox Text="{Binding MaterialWeight}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="50" FontSize="16"/>
  135. <TextBlock Text="g" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0" FontSize="16" Foreground="Black"/>
  136. </StackPanel>
  137. </DataTemplate>
  138. </DataGridTemplateColumn.CellTemplate>
  139. </DataGridTemplateColumn>
  140. <DataGridTemplateColumn Header="操作" Width="300">
  141. <DataGridTemplateColumn.CellTemplate>
  142. <DataTemplate>
  143. <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
  144. <Button Margin="4"
  145. Content="删除" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.RemoveRecipeCommand}"
  146. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}" />
  147. </StackPanel>
  148. </DataTemplate>
  149. </DataGridTemplateColumn.CellTemplate>
  150. </DataGridTemplateColumn>
  151. </DataGrid.Columns>
  152. </DataGrid>
  153. </Grid>
  154. </Expander.Content>
  155. </Expander>
  156. <!--配料录入-->
  157. <Expander Grid.Row="1" Style="{StaticResource ExpanderStyle}">
  158. <Expander.Header>
  159. <TextBlock Text="本地配料录入" />
  160. </Expander.Header>
  161. <Expander.Content>
  162. <Grid>
  163. <Grid.RowDefinitions>
  164. <RowDefinition Height="70"/>
  165. <RowDefinition Height="*"/>
  166. </Grid.RowDefinitions>
  167. <Grid.ColumnDefinitions>
  168. <ColumnDefinition Width="*"/>
  169. <ColumnDefinition Width="*"/>
  170. </Grid.ColumnDefinitions>
  171. <Button Content="保存物料位置名称" Grid.ColumnSpan="2" Style="{StaticResource buttonNormal}" Height="34" Width="200" Command="{Binding UpdateMaterialPosionCommand}"/>
  172. <DataGrid Grid.Row="1" Margin="50,5" AutoGenerateColumns="False" ItemsSource="{Binding materail1,Mode=TwoWay}"
  173. FrozenColumnCount="1" RowHeight="34"
  174. VerticalAlignment="Top" HorizontalAlignment="Right"
  175. IsReadOnly="True"
  176. CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
  177. CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
  178. <DataGrid.Columns>
  179. <DataGridTemplateColumn Header="物料位置" Width="170">
  180. <DataGridTemplateColumn.CellTemplate>
  181. <DataTemplate>
  182. <StackPanel Orientation="Horizontal" >
  183. <TextBlock Foreground="Black" Text="{Binding MaterialPosion}"
  184. VerticalAlignment="Center" HorizontalAlignment="Left"
  185. Margin="5,0" FontSize="16"/>
  186. </StackPanel>
  187. </DataTemplate>
  188. </DataGridTemplateColumn.CellTemplate>
  189. </DataGridTemplateColumn>
  190. <DataGridTemplateColumn Header="物料" Width="250">
  191. <DataGridTemplateColumn.CellTemplate>
  192. <DataTemplate>
  193. <TextBox Text="{Binding MaterialName ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
  194. VerticalAlignment="Center" HorizontalContentAlignment="Center"
  195. VerticalContentAlignment="Center"
  196. Margin="2" FontSize="16"
  197. Width="160" Height="28" />
  198. </DataTemplate>
  199. </DataGridTemplateColumn.CellTemplate>
  200. </DataGridTemplateColumn>
  201. </DataGrid.Columns>
  202. </DataGrid>
  203. <DataGrid Grid.Row="1" Grid.Column="1" Margin="50,5" AutoGenerateColumns="False" ItemsSource="{Binding materail2,Mode=TwoWay}"
  204. FrozenColumnCount="1" RowHeight="34"
  205. VerticalAlignment="Top" HorizontalAlignment="Left"
  206. IsReadOnly="True"
  207. CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
  208. CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
  209. <DataGrid.Columns>
  210. <DataGridTemplateColumn Header="物料位置" Width="170">
  211. <DataGridTemplateColumn.CellTemplate>
  212. <DataTemplate>
  213. <StackPanel Orientation="Horizontal" >
  214. <TextBlock Foreground="Black" Text="{Binding MaterialPosion}"
  215. VerticalAlignment="Center" HorizontalAlignment="Left"
  216. Margin="5,0" FontSize="16"/>
  217. </StackPanel>
  218. </DataTemplate>
  219. </DataGridTemplateColumn.CellTemplate>
  220. </DataGridTemplateColumn>
  221. <DataGridTemplateColumn Header="物料" Width="250">
  222. <DataGridTemplateColumn.CellTemplate>
  223. <DataTemplate>
  224. <TextBox Text="{Binding MaterialName ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
  225. VerticalAlignment="Center" HorizontalContentAlignment="Center"
  226. VerticalContentAlignment="Center"
  227. Margin="2" Height="28"
  228. Width="160" FontSize="16"/>
  229. </DataTemplate>
  230. </DataGridTemplateColumn.CellTemplate>
  231. </DataGridTemplateColumn>
  232. </DataGrid.Columns>
  233. </DataGrid>
  234. </Grid>
  235. </Expander.Content>
  236. </Expander>
  237. <!--奶茶清单-->
  238. <Expander Grid.Row="2" Style="{StaticResource ExpanderStyle}" >
  239. <Expander.Header>
  240. <TextBlock Text="本地奶茶配方"/>
  241. </Expander.Header>
  242. <Expander.Content>
  243. <DataGrid Grid.Row="4" Margin="100,5" AutoGenerateColumns="False" RowHeight="32" ItemsSource="{Binding localMaterialRecipes}" Width="500"
  244. FrozenColumnCount="1"
  245. VerticalAlignment="Top"
  246. IsReadOnly="True"
  247. CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
  248. CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
  249. <DataGrid.Columns>
  250. <DataGridTemplateColumn Header="奶茶" Width="200">
  251. <DataGridTemplateColumn.CellTemplate>
  252. <DataTemplate>
  253. <StackPanel Orientation="Horizontal" >
  254. <TextBlock Text="{Binding GoodNames}" Foreground="Black"
  255. VerticalAlignment="Center" HorizontalAlignment="Center"
  256. Margin="5,2" FontSize="16"/>
  257. </StackPanel>
  258. </DataTemplate>
  259. </DataGridTemplateColumn.CellTemplate>
  260. </DataGridTemplateColumn>
  261. <DataGridTemplateColumn Header="操作" Width="*">
  262. <DataGridTemplateColumn.CellTemplate>
  263. <DataTemplate>
  264. <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
  265. <Button Content="删除" Margin="2"
  266. Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.DeleteRecipeCommand}"
  267. CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}" />
  268. </StackPanel>
  269. </DataTemplate>
  270. </DataGridTemplateColumn.CellTemplate>
  271. </DataGridTemplateColumn>
  272. </DataGrid.Columns>
  273. </DataGrid>
  274. </Expander.Content>
  275. </Expander>
  276. </StackPanel>
  277. </ScrollViewer>
  278. </Grid>
  279. </UserControl>