@@ -29,6 +29,7 @@ | |||||
<None Remove="Fonts\MT\iconfont.ttf" /> | <None Remove="Fonts\MT\iconfont.ttf" /> | ||||
<None Remove="Fonts\naicha.ttf" /> | <None Remove="Fonts\naicha.ttf" /> | ||||
<None Remove="Fonts\new\iconfont.ttf" /> | <None Remove="Fonts\new\iconfont.ttf" /> | ||||
<None Remove="Fonts\pic\iconfont.ttf" /> | |||||
<None Remove="Fonts\Quartz Regular.ttf" /> | <None Remove="Fonts\Quartz Regular.ttf" /> | ||||
<None Remove="Image\AGV\agv.png" /> | <None Remove="Image\AGV\agv.png" /> | ||||
<None Remove="Image\AGV\AGV小车.png" /> | <None Remove="Image\AGV\AGV小车.png" /> | ||||
@@ -321,6 +322,7 @@ | |||||
<Resource Include="Fonts\MT\iconfont.ttf" /> | <Resource Include="Fonts\MT\iconfont.ttf" /> | ||||
<Resource Include="Fonts\naicha.ttf" /> | <Resource Include="Fonts\naicha.ttf" /> | ||||
<Resource Include="Fonts\new\iconfont.ttf" /> | <Resource Include="Fonts\new\iconfont.ttf" /> | ||||
<Resource Include="Fonts\pic\iconfont.ttf" /> | |||||
<Resource Include="Fonts\Quartz Regular.ttf" /> | <Resource Include="Fonts\Quartz Regular.ttf" /> | ||||
<Resource Include="Image\AGV\agv.png" /> | <Resource Include="Image\AGV\agv.png" /> | ||||
<Resource Include="Image\AGV\AGV小车.png" /> | <Resource Include="Image\AGV\AGV小车.png" /> | ||||
@@ -34,12 +34,12 @@ | |||||
</ControlTemplate> | </ControlTemplate> | ||||
<Style x:Key="IcoButtonStyle" TargetType="local:IcoButton"> | <Style x:Key="IcoButtonStyle" TargetType="local:IcoButton"> | ||||
<Setter Property="FontFamily" Value="../Fonts/#iconfont" /> | |||||
<Setter Property="FontFamily" Value="../Fonts/pic/#iconfont"/> | |||||
<Setter Property="FontSize" Value="14" /> | <Setter Property="FontSize" Value="14" /> | ||||
<Setter Property="Background" Value="#2219b7ec" /> | |||||
<!--<Setter Property="Background" Value="#2219b7ec" /> | |||||
<Setter Property="BorderBrush" Value="#ff19b7ec" /> | <Setter Property="BorderBrush" Value="#ff19b7ec" /> | ||||
<Setter Property="BorderThickness" Value="2" /> | <Setter Property="BorderThickness" Value="2" /> | ||||
<Setter Property="EnterBackground" Value="#8819b7ec" /> | |||||
<Setter Property="EnterBackground" Value="#8819b7ec" />--> | |||||
</Style> | </Style> | ||||
<Style x:Key="IcoTitleBarStyle" TargetType="local:IcoButton"> | <Style x:Key="IcoTitleBarStyle" TargetType="local:IcoButton"> | ||||
@@ -119,7 +119,7 @@ namespace BPASmartClient.CustomResource.UserControls | |||||
} | } | ||||
public static readonly DependencyProperty EnterBackgroundProperty = | public static readonly DependencyProperty EnterBackgroundProperty = | ||||
DependencyProperty.Register("EnterBackground", typeof(Brush), typeof(IcoButton), | DependencyProperty.Register("EnterBackground", typeof(Brush), typeof(IcoButton), | ||||
new PropertyMetadata(Brushes.DarkGray, new PropertyChangedCallback(OnPropertyChanged))); | |||||
new PropertyMetadata(Brushes.Transparent, new PropertyChangedCallback(OnPropertyChanged))); | |||||
public Brush PressedBackground | public Brush PressedBackground | ||||
@@ -212,7 +212,7 @@ namespace BPASmartClient.CustomResource.UserControls | |||||
private void Gr_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | private void Gr_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | ||||
{ | { | ||||
//Command?.Invoke(); | |||||
Command?.Execute(null); | |||||
//this.Background = PressedBackground; | //this.Background = PressedBackground; | ||||
} | } | ||||
@@ -326,77 +326,80 @@ namespace BPASmartClient.MorkS | |||||
/// </summary> | /// </summary> | ||||
private void DataParse() | private void DataParse() | ||||
{ | { | ||||
EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle) | |||||
{ | |||||
if (@event == null) return; | |||||
if (@event is DoOrderEvent order) | |||||
{ | |||||
mORKS.doOrderEvents.Add(order); | |||||
//mORKS.doe.TryAdd(order.MorkOrder.SuborderId, order); | |||||
DeviceProcessLogShow($"接收到{order.MorkOrder.SortNum}号订单"); | |||||
if (order.MorkOrder.GoodBatchings == null) return; | |||||
if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return; | |||||
OrderCount++; | |||||
if (DateTime.Now.Subtract(Json<OrderStatistics>.Data.StatisticsTime).Days != 0) | |||||
Json<OrderStatistics>.Data.Count = 0; | |||||
Json<OrderStatistics>.Data.StatisticsTime = DateTime.Now; | |||||
Json<OrderStatistics>.Data.Count++; | |||||
Json<OrderStatistics>.Save(); | |||||
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT); | |||||
if (order.MorkOrder.GoodBatchings.Count <= 1) | |||||
{ | |||||
DeviceProcessLogShow($"数据解析失败,商品物料信息为空,请检查后台配置!"); | |||||
return; | |||||
} | |||||
DeviceProcessLogShow($"接收到{OrderCount}次订单,订单ID:{order.MorkOrder.SuborderId}"); | |||||
mORKS.HistorySuborderId.Add(order.MorkOrder.SuborderId); | |||||
foreach (var item in order.MorkOrder.GoodBatchings) | |||||
{ | |||||
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); | |||||
if (res != null) | |||||
{ | |||||
if (ushort.TryParse(res.BatchingLoc, out ushort loc)) | |||||
{ | |||||
if (loc >= 1 && loc <= 5) | |||||
{ | |||||
if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() | |||||
{ | |||||
GoodName = order.MorkOrder.GoodsName, | |||||
Loc = ushort.Parse(res.BatchingLoc), | |||||
SuborderId = order.MorkOrder.SuborderId, | |||||
SortNum = order.MorkOrder.SortNum, | |||||
BatchingId = res.BatchingId | |||||
}); | |||||
} | |||||
else if (loc >= 10 && loc <= 11) | |||||
{ | |||||
int index = 0; | |||||
if (recipeBoms != null) | |||||
{ | |||||
index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId); | |||||
index++; | |||||
} | |||||
if (mORKS.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() | |||||
{ | |||||
BatchingId = res.BatchingId, | |||||
GoodName = order.MorkOrder.GoodsName, | |||||
Loc = ushort.Parse(res.BatchingLoc), | |||||
SuborderId = order.MorkOrder.SuborderId, | |||||
SortNum = order.MorkOrder.SortNum, | |||||
RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0 | |||||
}); | |||||
} | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
DeviceProcessLogShow($"数据解析失败,未找到商品信息,请检查后台配置!"); | |||||
} | |||||
} | |||||
} | |||||
}); | |||||
if (!Global.LocalOrderModel)//小程序下单 | |||||
{ | |||||
EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle) | |||||
{ | |||||
if (@event == null) return; | |||||
if (@event is DoOrderEvent order) | |||||
{ | |||||
mORKS.doOrderEvents.Add(order); | |||||
//mORKS.doe.TryAdd(order.MorkOrder.SuborderId, order); | |||||
DeviceProcessLogShow($"接收到{order.MorkOrder.SortNum}号订单"); | |||||
if (order.MorkOrder.GoodBatchings == null) return; | |||||
if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return; | |||||
OrderCount++; | |||||
if (DateTime.Now.Subtract(Json<OrderStatistics>.Data.StatisticsTime).Days != 0) | |||||
Json<OrderStatistics>.Data.Count = 0; | |||||
Json<OrderStatistics>.Data.StatisticsTime = DateTime.Now; | |||||
Json<OrderStatistics>.Data.Count++; | |||||
Json<OrderStatistics>.Save(); | |||||
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT); | |||||
if (order.MorkOrder.GoodBatchings.Count <= 1) | |||||
{ | |||||
DeviceProcessLogShow($"数据解析失败,商品物料信息为空,请检查后台配置!"); | |||||
return; | |||||
} | |||||
DeviceProcessLogShow($"接收到{OrderCount}次订单,订单ID:{order.MorkOrder.SuborderId}"); | |||||
mORKS.HistorySuborderId.Add(order.MorkOrder.SuborderId); | |||||
foreach (var item in order.MorkOrder.GoodBatchings) | |||||
{ | |||||
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); | |||||
if (res != null) | |||||
{ | |||||
if (ushort.TryParse(res.BatchingLoc, out ushort loc)) | |||||
{ | |||||
if (loc >= 1 && loc <= 5) | |||||
{ | |||||
if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() | |||||
{ | |||||
GoodName = order.MorkOrder.GoodsName, | |||||
Loc = ushort.Parse(res.BatchingLoc), | |||||
SuborderId = order.MorkOrder.SuborderId, | |||||
SortNum = order.MorkOrder.SortNum, | |||||
BatchingId = res.BatchingId | |||||
}); | |||||
} | |||||
else if (loc >= 10 && loc <= 11) | |||||
{ | |||||
int index = 0; | |||||
if (recipeBoms != null) | |||||
{ | |||||
index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId); | |||||
index++; | |||||
} | |||||
if (mORKS.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() | |||||
{ | |||||
BatchingId = res.BatchingId, | |||||
GoodName = order.MorkOrder.GoodsName, | |||||
Loc = ushort.Parse(res.BatchingLoc), | |||||
SuborderId = order.MorkOrder.SuborderId, | |||||
SortNum = order.MorkOrder.SortNum, | |||||
RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0 | |||||
}); | |||||
} | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
DeviceProcessLogShow($"数据解析失败,未找到商品信息,请检查后台配置!"); | |||||
} | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
} | } | ||||
public override void MainTask() | public override void MainTask() | ||||
@@ -452,9 +455,23 @@ namespace BPASmartClient.MorkS | |||||
DeviceProcessLogShow("开始取碗流程"); | DeviceProcessLogShow("开始取碗流程"); | ||||
ushort BowLoc = 0; | ushort BowLoc = 0; | ||||
var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKS.TakeBowlTask.ElementAt(0).BatchingId).ToList(); | var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKS.TakeBowlTask.ElementAt(0).BatchingId).ToList(); | ||||
if (res == null || res?.Count == 0) | |||||
if (res == null || res?.Count == 0)//本地或者模拟订单 | |||||
{ | { | ||||
if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo)) BowlControl(orderLocInfo); | |||||
var bowlLoc= mORKS.TakeBowlTask.ElementAt(0).Loc; | |||||
if (bowlLoc == 10 && !alarm.Supply1_LossBowl) | |||||
{ | |||||
BowLoc = bowlLoc; | |||||
} | |||||
else if (bowlLoc == 11 && !alarm.Supply2_LossBowl) | |||||
{ | |||||
BowLoc = bowlLoc; | |||||
} | |||||
if (BowLoc >= 10 && BowLoc <= 11&&mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo)) | |||||
{ | |||||
BowlControl(orderLocInfo); | |||||
} | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -493,7 +510,7 @@ namespace BPASmartClient.MorkS | |||||
/// </summary> | /// </summary> | ||||
private void TurntableControl() | private void TurntableControl() | ||||
{ | { | ||||
if (Global.EnableLocalSimOrder) | |||||
if (Global.EnableLocalSimOrder|| Global.LocalOrderModel) | |||||
{ | { | ||||
//不做轮询,直接取面,模拟订单使用 | //不做轮询,直接取面,模拟订单使用 | ||||
if (mORKS.TurntableMoveInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0) | if (mORKS.TurntableMoveInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0) | ||||
@@ -8,6 +8,14 @@ namespace BPASmartClient.MorkS.Model | |||||
{ | { | ||||
public class Global | public class Global | ||||
{ | { | ||||
/// <summary> | |||||
/// 本地模拟订单 | |||||
/// </summary> | |||||
public static bool EnableLocalSimOrder { get; set; } | public static bool EnableLocalSimOrder { get; set; } | ||||
/// <summary> | |||||
/// 本地订单模式 | |||||
/// </summary> | |||||
public static bool LocalOrderModel { get; set; } | |||||
} | } | ||||
} | } |
@@ -0,0 +1,25 @@ | |||||
using BPA.Helper; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.MorkS.Model | |||||
{ | |||||
internal class GoodsModel: NotifyBase | |||||
{ | |||||
private string _orderNum { get; set; } | |||||
public string OrderNum { get { return _orderNum; } set { _orderNum = value;OnPropertyChanged(); } } | |||||
private string _goodsName; | |||||
public string GoodsName { get { return _goodsName; } set { _goodsName = value;OnPropertyChanged(); } } | |||||
private int _bowlLoc; | |||||
public int BowlLoc { get { return _bowlLoc; } set { _bowlLoc = value; OnPropertyChanged(); } } | |||||
private int _noodlesLoc; | |||||
public int NoodlesLoc { get { return _noodlesLoc; } set { _noodlesLoc = value; OnPropertyChanged(); } } | |||||
} | |||||
} |
@@ -0,0 +1,14 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Collections.ObjectModel; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.MorkS.Model | |||||
{ | |||||
internal class Recipes | |||||
{ | |||||
public ObservableCollection<GoodsModel> GoodsModels { get; set; } = new ObservableCollection<GoodsModel>() ; | |||||
} | |||||
} |
@@ -0,0 +1,69 @@ | |||||
<Window x:Class="BPASmartClient.MorkS.View.GoodsEditView" | |||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||||
xmlns:vm="clr-namespace:BPASmartClient.MorkS.ViewModel" | |||||
xmlns:local="clr-namespace:BPASmartClient.MorkS.View" | |||||
mc:Ignorable="d" | |||||
Title="GoodsEditView" Height="450" Width="600" Background="Transparent" WindowStartupLocation="CenterScreen" WindowStyle="None" ResizeMode="CanMinimize"> | |||||
<WindowChrome.WindowChrome> | |||||
<WindowChrome GlassFrameThickness="-1"/> | |||||
</WindowChrome.WindowChrome> | |||||
<Window.DataContext> | |||||
<vm:GoodsEditViewModel/> | |||||
</Window.DataContext> | |||||
<Window.Resources> | |||||
<Style x:Key="TextboxStyle" TargetType="TextBox"> | |||||
<Setter Property="FontSize" Value="18" /> | |||||
<Setter Property="Background" Value="Transparent" /> | |||||
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" /> | |||||
<Setter Property="Width" Value="150" /> | |||||
<Setter Property="BorderBrush" Value="{StaticResource TitleBorderColor}" /> | |||||
<Setter Property="BorderThickness" Value="1" /> | |||||
<Setter Property="CaretBrush" Value="Aqua" /> | |||||
</Style> | |||||
</Window.Resources> | |||||
<Border Background="#ff0C255F" CornerRadius="10"> | |||||
<Grid> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="60"/> | |||||
<RowDefinition/> | |||||
<RowDefinition/> | |||||
<RowDefinition/> | |||||
<RowDefinition/> | |||||
</Grid.RowDefinitions> | |||||
<Border BorderBrush="Aqua" BorderThickness="0,0,0,1"> | |||||
<TextBlock Text="订单DIY" FontSize="30" Foreground="#FF2AB2E7" VerticalAlignment="Center" HorizontalAlignment="Center" /> | |||||
</Border> | |||||
<Canvas Grid.Row="1"> | |||||
<TextBlock Canvas.Top="5" Text="商品名称:" Foreground=" #FF2AB2E7" VerticalAlignment="Center" FontSize="20" Margin="10,0"/> | |||||
<TextBox Canvas.Left="200" Canvas.Top="30" Height="45" Width="200" Text="{Binding GoodsName}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Style="{StaticResource TextboxStyle}"/> | |||||
</Canvas> | |||||
<Canvas Grid.Row="2"> | |||||
<TextBlock Canvas.Top="5" Text="面条位置:" Foreground=" #FF2AB2E7" VerticalAlignment="Center" FontSize="20" Margin="10,0"/> | |||||
<UniformGrid Canvas.Top="55" Canvas.Left="80" Columns="5"> | |||||
<RadioButton VerticalContentAlignment="Center" IsChecked="{Binding noodlesLocs[0]}" Content="转盘1" Margin="10,0" FontSize="22" Foreground="#FF2AB2E7"/> | |||||
<RadioButton VerticalContentAlignment="Center" IsChecked="{Binding noodlesLocs[1]}" Content="转盘2" Margin="10,0" FontSize="22" Foreground="#FF2AB2E7"/> | |||||
<RadioButton VerticalContentAlignment="Center" IsChecked="{Binding noodlesLocs[2]}" Content="转盘3" Margin="10,0" FontSize="22" Foreground="#FF2AB2E7"/> | |||||
<RadioButton VerticalContentAlignment="Center" IsChecked="{Binding noodlesLocs[3]}" Content="转盘4" Margin="10,0" FontSize="22" Foreground="#FF2AB2E7"/> | |||||
<RadioButton VerticalContentAlignment="Center" IsChecked="{Binding noodlesLocs[4]}" Content="转盘5" Margin="10,0" FontSize="22" Foreground="#FF2AB2E7"/> | |||||
</UniformGrid> | |||||
</Canvas> | |||||
<Canvas Grid.Row="3"> | |||||
<TextBlock Canvas.Top="5" Text="碗类型:" Foreground=" #FF2AB2E7" VerticalAlignment="Center" FontSize="20" Margin="10,0"/> | |||||
<UniformGrid Canvas.Top="55" Canvas.Left="170" Columns="2"> | |||||
<RadioButton VerticalContentAlignment="Center" IsChecked="{Binding bowlLocs[0]}" Content="大碗" Margin="50,0" FontSize="22" Foreground="#FF2AB2E7"/> | |||||
<RadioButton VerticalContentAlignment="Center" IsChecked="{Binding bowlLocs[1]}" Content="小碗" FontSize="22" Foreground="#FF2AB2E7"/> | |||||
</UniformGrid> | |||||
</Canvas> | |||||
<Canvas Grid.Row="4"> | |||||
<Button Canvas.Top="30" Command="{Binding ConfirmCommand}" Canvas.Left="150" Style="{StaticResource ButtonStyle}" Width="100" Height="40" Content="确定" Foreground=" #FF2AB2E7" VerticalAlignment="Center" FontSize="20" Margin="10,0"/> | |||||
<Button Canvas.Top="30" Canvas.Left="330" Width="100" Height="40" Content="取消" Style="{StaticResource ButtonStyle}" Click="Button_Click" Foreground=" #FF2AB2E7" VerticalAlignment="Center" FontSize="20" Margin="10,0"/> | |||||
</Canvas> | |||||
</Grid> | |||||
</Border> | |||||
</Window> |
@@ -0,0 +1,39 @@ | |||||
using BPA.Helper; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using System.Windows; | |||||
using System.Windows.Controls; | |||||
using System.Windows.Data; | |||||
using System.Windows.Documents; | |||||
using System.Windows.Input; | |||||
using System.Windows.Media; | |||||
using System.Windows.Media.Imaging; | |||||
using System.Windows.Shapes; | |||||
namespace BPASmartClient.MorkS.View | |||||
{ | |||||
/// <summary> | |||||
/// GoodsEditView.xaml 的交互逻辑 | |||||
/// </summary> | |||||
public partial class GoodsEditView : Window | |||||
{ | |||||
public GoodsEditView() | |||||
{ | |||||
InitializeComponent(); | |||||
ActionManage.GetInstance.CancelRegister("CloseEditWindow"); | |||||
ActionManage.GetInstance.Register(() => { | |||||
this.Close(); | |||||
}, "CloseEditWindow"); | |||||
} | |||||
private void Button_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
this.Close(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,195 @@ | |||||
<UserControl x:Class="BPASmartClient.MorkS.View.GoodsMakeView" | |||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||||
xmlns:local="clr-namespace:BPASmartClient.MorkS.View" | |||||
xmlns:vm="clr-namespace:BPASmartClient.MorkS.ViewModel" | |||||
mc:Ignorable="d" | |||||
Name="制作界面" | |||||
d:DesignHeight="450" d:DesignWidth="800"> | |||||
<UserControl.DataContext> | |||||
<vm:GoodsMakeViewModel/> | |||||
</UserControl.DataContext> | |||||
<UserControl.Resources> | |||||
<Style x:Key="BtnStyle" TargetType="Button"> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="{x:Type Button}" > | |||||
<Border x:Name="border" CornerRadius="3" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true"> | |||||
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> | |||||
</Border> | |||||
<ControlTemplate.Triggers> | |||||
<!--<Trigger Property="IsMouseOver" Value="True"> | |||||
<Setter Property="Background" TargetName="border" Value="#FF3225"/> | |||||
</Trigger> | |||||
<Trigger Property="IsPressed" Value="true"> | |||||
<Setter Property="Background" TargetName="border" Value="IndianRed"/> | |||||
</Trigger>--> | |||||
</ControlTemplate.Triggers> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
<Style.Triggers> | |||||
</Style.Triggers> | |||||
</Style> | |||||
<Style x:Key="SwitchToggleButtonStyle1" TargetType="{x:Type ToggleButton}"> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="{x:Type ToggleButton}"> | |||||
<Viewbox> | |||||
<Grid x:Name="gr" Opacity="0.8"> | |||||
<Border | |||||
x:Name="border2" | |||||
Width="{TemplateBinding Width}" | |||||
Height="{TemplateBinding Height}" | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||||
Background="Red" | |||||
BorderBrush="{TemplateBinding BorderBrush}" | |||||
CornerRadius="15"> | |||||
<ContentPresenter | |||||
Margin="{TemplateBinding Padding}" | |||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||||
RecognizesAccessKey="True" | |||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" | |||||
Visibility="Collapsed" /> | |||||
</Border> | |||||
<Ellipse | |||||
Name="ell" | |||||
Width="{TemplateBinding Height}" | |||||
Height="{TemplateBinding Height}" | |||||
Margin="0" | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="Center" | |||||
Fill="#ddd" /> | |||||
<TextBlock | |||||
Name="tb" | |||||
Margin="34,0,10,0" | |||||
HorizontalAlignment="Right" | |||||
VerticalAlignment="Center" | |||||
Foreground="White" | |||||
Text="{TemplateBinding Content}" /> | |||||
</Grid> | |||||
</Viewbox> | |||||
<ControlTemplate.Triggers> | |||||
<!-- 控件选中 --> | |||||
<Trigger Property="IsChecked" Value="true"> | |||||
<Setter TargetName="ell" Property="HorizontalAlignment" Value="Right" /> | |||||
<Setter TargetName="border2" Property="Background" Value="#FF2AB2E7" /> | |||||
<Setter TargetName="tb" Property="Margin" Value="0,0,45,0" /> | |||||
</Trigger> | |||||
<!-- 控件未选中 --> | |||||
<Trigger Property="IsChecked" Value="false"> | |||||
<Setter TargetName="border2" Property="Background" Value="gray" /> | |||||
<Setter TargetName="tb" Property="HorizontalAlignment" Value="Right" /> | |||||
</Trigger> | |||||
<!-- 鼠标进入 --> | |||||
<Trigger Property="IsMouseOver" Value="True"> | |||||
<Setter TargetName="gr" Property="Opacity" Value="1" /> | |||||
</Trigger> | |||||
<!-- 控件禁用 --> | |||||
<Trigger Property="IsEnabled" Value="false"> | |||||
<Setter TargetName="gr" Property="Opacity" Value="0.5" /> | |||||
</Trigger> | |||||
<!-- 控件启用 --> | |||||
<Trigger Property="IsEnabled" Value="True"> | |||||
<Setter TargetName="gr" Property="Opacity" Value="0.8" /> | |||||
</Trigger> | |||||
</ControlTemplate.Triggers> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</Style> | |||||
</UserControl.Resources> | |||||
<Grid> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="50"/> | |||||
<RowDefinition Height="30"/> | |||||
<RowDefinition/> | |||||
</Grid.RowDefinitions> | |||||
<UniformGrid Columns="2" HorizontalAlignment="Right" VerticalAlignment="Center"> | |||||
<Button Content="新增订单" Command="{Binding EditCommand}" Style="{StaticResource ButtonStyle}" FontSize="22" /> | |||||
<ToggleButton | |||||
x:Name="togFire" | |||||
Width="90" | |||||
Height="30" | |||||
Margin="0,6,5.5,3.5" | |||||
Background="Transparent" | |||||
Click="togFire_Click" | |||||
Content="小程序" | |||||
FontSize="18" | |||||
Style="{StaticResource SwitchToggleButtonStyle1}" /> | |||||
</UniformGrid> | |||||
<Grid Background="#FF2AB2E7" Name="formHead" Grid.Row="1"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition/> | |||||
<ColumnDefinition/> | |||||
<ColumnDefinition/> | |||||
<ColumnDefinition/> | |||||
</Grid.ColumnDefinitions> | |||||
<TextBlock Text="商品" Margin="3,0,4,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18" FontFamily="微软雅黑" Foreground="White" /> | |||||
<GridSplitter Background="Transparent" Width="1" /> | |||||
<TextBlock Grid.Column="1" Margin="3,0,4,0" Text="面条位置" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18" FontFamily="微软雅黑" Foreground="White"/> | |||||
<GridSplitter Grid.Column="1" Background="Transparent" Width="1"/> | |||||
<TextBlock Grid.Column="2" Margin="3,0,4,0" Text="碗位置" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18" FontFamily="微软雅黑" Foreground="White"/> | |||||
<GridSplitter Grid.Column="2" Background="Transparent" Width="1"/> | |||||
<TextBlock Grid.Column="3" Margin="3,0,4,0" Text="操作" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18" FontFamily="微软雅黑" Foreground="White"/> | |||||
</Grid> | |||||
<ItemsControl Grid.Row="2" ItemsSource="{Binding GoodsModels}"> | |||||
<ItemsControl.ItemsPanel> | |||||
<ItemsPanelTemplate> | |||||
<StackPanel/> | |||||
</ItemsPanelTemplate> | |||||
</ItemsControl.ItemsPanel> | |||||
<ItemsControl.ItemTemplate> | |||||
<DataTemplate> | |||||
<Border BorderThickness="0,0,0,1" BorderBrush="#FF2AB2E7"> | |||||
<Grid> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition/> | |||||
<ColumnDefinition/> | |||||
<ColumnDefinition/> | |||||
<ColumnDefinition/> | |||||
</Grid.ColumnDefinitions> | |||||
<TextBlock Margin="0,8" Foreground="#2AB2E7" Text="{Binding GoodsName}" FontSize="18" HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||||
<TextBlock Grid.Column="1" Foreground="#2AB2E7" Text="{Binding NoodlesLoc}" FontSize="18" HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||||
<TextBlock Grid.Column="2" Foreground="#2AB2E7" Text="{Binding BowlLoc}" FontSize="18" HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||||
<UniformGrid Columns="2" Grid.Column="3"> | |||||
<Button IsEnabled="{Binding ElementName=togFire,Path=IsChecked}" Command="{Binding DataContext.SendOrderCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}" CommandParameter="{Binding OrderNum}" HorizontalAlignment="Center" Background="Transparent" | |||||
VerticalAlignment="Center" BorderThickness="0" Content="点击下单" FontSize="16" Cursor="Hand" Style="{StaticResource BtnStyle}"> | |||||
<Button.Foreground> | |||||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||||
<GradientStop Color="Orange" /> | |||||
<GradientStop Offset="1.2" Color="White" /> | |||||
</LinearGradientBrush> | |||||
</Button.Foreground> | |||||
</Button> | |||||
<Button Command="{Binding DataContext.DeleteOrderCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}" CommandParameter="{Binding OrderNum}" HorizontalAlignment="Center" Background="Transparent" | |||||
VerticalAlignment="Center" BorderThickness="0" Content="删除订单" FontSize="16" Cursor="Hand" Style="{StaticResource BtnStyle}"> | |||||
<Button.Foreground> | |||||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||||
<GradientStop Color="Orange" /> | |||||
<GradientStop Offset="1.2" Color="White" /> | |||||
</LinearGradientBrush> | |||||
</Button.Foreground> | |||||
</Button> | |||||
</UniformGrid> | |||||
</Grid> | |||||
</Border> | |||||
</DataTemplate> | |||||
</ItemsControl.ItemTemplate> | |||||
</ItemsControl> | |||||
</Grid> | |||||
</UserControl> |
@@ -0,0 +1,52 @@ | |||||
//using BPASmartClient.CustomResource.Pages.Model; | |||||
using BPASmartClient.MorkS.Model; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using System.Windows; | |||||
using System.Windows.Controls; | |||||
using System.Windows.Controls.Primitives; | |||||
using System.Windows.Data; | |||||
using System.Windows.Documents; | |||||
using System.Windows.Input; | |||||
using System.Windows.Media; | |||||
using System.Windows.Media.Imaging; | |||||
using System.Windows.Navigation; | |||||
using System.Windows.Shapes; | |||||
namespace BPASmartClient.MorkS.View | |||||
{ | |||||
/// <summary> | |||||
/// GoodsMakeView.xaml 的交互逻辑 | |||||
/// </summary> | |||||
public partial class GoodsMakeView : UserControl | |||||
{ | |||||
public GoodsMakeView() | |||||
{ | |||||
InitializeComponent(); | |||||
} | |||||
private void togFire_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
if (sender is ToggleButton btn) | |||||
{ | |||||
if (btn.IsChecked!=null) | |||||
{ | |||||
btn.Content=(bool)btn.IsChecked ? "本地" : "小程序"; | |||||
if ((bool)btn.IsChecked) | |||||
{ | |||||
btn.HorizontalContentAlignment = HorizontalAlignment.Left; | |||||
} | |||||
else | |||||
{ | |||||
btn.HorizontalContentAlignment = HorizontalAlignment.Right; | |||||
} | |||||
Global.LocalOrderModel =(bool)btn.IsChecked; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,49 @@ | |||||
using BPA.Helper; | |||||
using BPASmartClient.MorkS.Model; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Collections.ObjectModel; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using System.Windows; | |||||
namespace BPASmartClient.MorkS.ViewModel | |||||
{ | |||||
internal class GoodsEditViewModel:NotifyBase | |||||
{ | |||||
private string _orderNum { get; set; } | |||||
public string OrderNum { get { return _orderNum; } set { _orderNum = value; OnPropertyChanged(); } } | |||||
private string _goodsName="板面"; | |||||
public string GoodsName { get { return _goodsName; } set { _goodsName = value; OnPropertyChanged(); } } | |||||
public ObservableCollection<bool> bowlLocs { get; set; } = new ObservableCollection<bool>() { false, false }; | |||||
public ObservableCollection<bool> noodlesLocs { get; set; } = new ObservableCollection<bool>() { false, false, false, false, false }; | |||||
public BPARelayCommand ConfirmCommand { get; set; } | |||||
public GoodsEditViewModel() | |||||
{ | |||||
ConfirmCommand = new BPARelayCommand(() => { | |||||
GoodsModel goods = new GoodsModel(); | |||||
goods.OrderNum = Guid.NewGuid().ToString("D"); | |||||
goods.GoodsName = GoodsName; | |||||
var bLoc = bowlLocs.ToList().FindIndex(p => p == true); | |||||
var noLoc = noodlesLocs.ToList().FindIndex(p => p == true); | |||||
if (bLoc != -1&& noLoc!=-1) | |||||
{ | |||||
goods.BowlLoc = bLoc + 10; | |||||
goods.NoodlesLoc = noLoc + 1; | |||||
} | |||||
else | |||||
{ | |||||
MessageBox.Show("请选择面位置或碗类型", "提示", MessageBoxButton.OK, MessageBoxImage.Information); | |||||
return; | |||||
} | |||||
ActionManage.GetInstance.Send("orderEdit", goods); | |||||
ActionManage.GetInstance.Send ("CloseEditWindow"); | |||||
}); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,79 @@ | |||||
using BPA.Helper; | |||||
using BPASmartClient.Model; | |||||
using BPASmartClient.MorkS.Model; | |||||
using BPASmartClient.MorkS.View; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Collections.ObjectModel; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using System.Windows; | |||||
namespace BPASmartClient.MorkS.ViewModel | |||||
{ | |||||
internal class GoodsMakeViewModel : NotifyBase | |||||
{ | |||||
public ObservableCollection<GoodsModel> GoodsModels { get; set; } = new ObservableCollection<GoodsModel>(); | |||||
public BPARelayCommand<string> SendOrderCommand { get; set; } | |||||
public BPARelayCommand<string> DeleteOrderCommand { get; set; } | |||||
public BPARelayCommand EditCommand { get; set; } | |||||
public GoodsMakeViewModel() | |||||
{ | |||||
Json<Recipes>.Read(); | |||||
GoodsModels = Json<Recipes>.Data.GoodsModels; | |||||
ActionManage.GetInstance.Register(new Action<object>((res) => | |||||
{ | |||||
if (res != null && res is GoodsModel goods) | |||||
{ | |||||
var result = GoodsModels.FirstOrDefault(p => p.OrderNum == goods.OrderNum); | |||||
if (result == null) | |||||
{ | |||||
GoodsModels.Add(goods); | |||||
Json<Recipes>.Save(); | |||||
} | |||||
else | |||||
{ | |||||
MessageBox.Show("新增订单失败!","提示", MessageBoxButton.OK, MessageBoxImage.Warning); | |||||
} | |||||
} | |||||
}), "orderEdit"); | |||||
SendOrderCommand = new BPARelayCommand<string>((s) => | |||||
{ | |||||
var res = GoodsModels.FirstOrDefault(p => p.OrderNum.Equals(s)); | |||||
if (res != null) | |||||
{ | |||||
new MorksSimorderModel() { Bowloc = res.BowlLoc, NoodleLoc = res.NoodlesLoc }.Publish(); | |||||
} | |||||
}); | |||||
EditCommand = new BPARelayCommand(() => | |||||
{ | |||||
GoodsEditView goodsEditView = new GoodsEditView(); | |||||
goodsEditView.ShowDialog(); | |||||
}); | |||||
DeleteOrderCommand = new BPARelayCommand<string>((res) => | |||||
{ | |||||
if (!string.IsNullOrEmpty(res)) | |||||
{ | |||||
var re = GoodsModels.FirstOrDefault(p=>p.OrderNum.Equals(res)); | |||||
if (re != null) | |||||
{ | |||||
GoodsModels.Remove(re); | |||||
Json<Recipes>.Save(); | |||||
} | |||||
else | |||||
{ | |||||
MessageBox.Show("未查找到当前订单,删除失败!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
} | |||||
} |