终端一体化运控平台
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

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