Browse Source

调试修改

样式分支
pry 2 years ago
parent
commit
e57014cc7e
7 changed files with 330 additions and 106 deletions
  1. +2
    -2
      BPASmartClient.CustomResource/Themes/Generic.xaml
  2. +101
    -51
      BPASmartClient.ViewModel/OrderStatusViewModel.cs
  3. +2
    -2
      BPASmartClient/App.config
  4. +7
    -7
      BPASmartClient/Control/OrderStatusView.xaml
  5. +214
    -40
      BPASmartClient/Control/ShopDeviceConfigView.xaml
  6. +1
    -1
      BPASmartClient/DeviceInfo.xml
  7. +3
    -3
      BPASmartClient/MainWindow.xaml

+ 2
- 2
BPASmartClient.CustomResource/Themes/Generic.xaml View File

@@ -14,7 +14,7 @@
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" />
<Grid HorizontalAlignment="Center">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<!--<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
@@ -35,7 +35,7 @@
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}" />
</Grid>
</StackPanel>
</Grid>
</ControlTemplate>
</Setter.Value>


+ 101
- 51
BPASmartClient.ViewModel/OrderStatusViewModel.cs View File

@@ -63,9 +63,6 @@ namespace BPASmartClient.ViewModel
StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
};
observableCollection.Add(morkOrder);
//var res = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.DeviceId == device.ToString());
//if (res == null)
//{
Application.Current?.Dispatcher.BeginInvoke((Action)delegate
{
int index = Array.FindIndex(Json<KeepDataBase>.Data.orderLists.ToArray(), p => p.DeviceId == device.DeviceId.ToString());
@@ -91,11 +88,6 @@ namespace BPASmartClient.ViewModel
StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
});
});
//}
//else
//{
// res.morkOrderPushes.Add(new MorkOrder() { OrderPush = morkOrderpush });
//}

}
}
@@ -103,56 +95,114 @@ namespace BPASmartClient.ViewModel

}), "AddOrder");

ActionManage.GetInstance.Register(new Action<object>((o) =>
EventBus.EventBus.GetInstance().Subscribe<OrderStatusChangedEvent>(0, OrderStatusChangedHandle);

//ActionManage.GetInstance.Register(new Action<object>((o) =>
//{
// if (o is OrderStatusChangedEvent orderStatusChange)
// {
// int index = Array.FindIndex(orderStatusLists.ToArray(), p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
// switch (orderStatusChange.Status)
// {
// case ORDER_STATUS.COOKING:
// if (index >= 0 && index < orderStatusLists.Count)
// orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
// break;
// case ORDER_STATUS.COMPLETED_COOK:
// if (index >= 0 && index < orderStatusLists.Count)
// {
// Application.Current.Dispatcher.BeginInvoke((Action)delegate
// {
// orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
// orderStatusLists.ElementAt(index).EndDate = DateTime.Now.ToString("HH:mm:ss");
// TimeSpan timeSpan = DateTime.Now.Subtract(Convert.ToDateTime(orderStatusLists.ElementAt(index).StartDate));
// orderStatusLists.ElementAt(index).CompleteDate = $"{timeSpan.TotalSeconds.ToString("0.00")} S";

// //压力测试时注释,正常使用需要取消注释
// if (!BPASmartClient.Business.InternetInfo.IsEnableTest)
// {
// WaitTakeMeal.Insert(0, orderStatusLists.ElementAt(index));
// orderStatusLists.RemoveAt(index);
// }

// });
// }

// break;
// case ORDER_STATUS.COMPLETED_TAKE:
// if (BPASmartClient.Business.InternetInfo.IsEnableTest)
// orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;

// //压力测试时注释,正常使用需要取消注释
// var re = WaitTakeMeal.FirstOrDefault(p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
// if (re != null)
// {
// Application.Current.Dispatcher.BeginInvoke((Action)delegate
// {
// WaitTakeMeal.Remove(re);
// var removeObj = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.morkOrderPushes.FirstOrDefault(s => s.OrderPush.SuborderId == re.OrderPush.SuborderId) != null);
// if (removeObj != null) Json<KeepDataBase>.Data.orderLists.Remove(removeObj);
// });
// }
// break;
// default:
// break;
// }
// }
//}), "OrderStatusChange");
}

private static void OrderStatusChangedHandle(IEvent @event, EventBus.EventBus.EventCallBackHandle callBack)
{
OrderStatusChangedEvent orderStatusChange = @event as OrderStatusChangedEvent;
int index = Array.FindIndex(orderStatusLists.ToArray(), p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
switch (orderStatusChange.Status)
{
if (o is OrderStatusChangedEvent orderStatusChange)
{
int index = Array.FindIndex(orderStatusLists.ToArray(), p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
switch (orderStatusChange.Status)
case ORDER_STATUS.COOKING:
if (index >= 0 && index < orderStatusLists.Count)
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
break;
case ORDER_STATUS.COMPLETED_COOK:
if (index >= 0 && index < orderStatusLists.Count)
{
case ORDER_STATUS.COOKING:
if (index >= 0 && index < orderStatusLists.Count)
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
break;
case ORDER_STATUS.COMPLETED_COOK:
if (index >= 0 && index < orderStatusLists.Count)
{
Application.Current.Dispatcher.BeginInvoke((Action)delegate
{
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
orderStatusLists.ElementAt(index).EndDate = DateTime.Now.ToString("HH:mm:ss");
TimeSpan timeSpan = DateTime.Now.Subtract(Convert.ToDateTime(orderStatusLists.ElementAt(index).StartDate));
orderStatusLists.ElementAt(index).CompleteDate = $"{timeSpan.TotalSeconds.ToString("0.00")} S";

//压力测试时注释,正常使用需要取消注释
//WaitTakeMeal.Insert(0, orderStatusLists.ElementAt(index));
//orderStatusLists.RemoveAt(index);
});
}

break;
case ORDER_STATUS.COMPLETED_TAKE:
Application.Current.Dispatcher.BeginInvoke((Action)delegate
{
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
orderStatusLists.ElementAt(index).EndDate = DateTime.Now.ToString("HH:mm:ss");
TimeSpan timeSpan = DateTime.Now.Subtract(Convert.ToDateTime(orderStatusLists.ElementAt(index).StartDate));
orderStatusLists.ElementAt(index).CompleteDate = $"{timeSpan.TotalSeconds.ToString("0.00")} S";

//压力测试时注释,正常使用需要取消注释
//var re = WaitTakeMeal.FirstOrDefault(p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
//if (re != null)
//{
// Application.Current.Dispatcher.BeginInvoke((Action)delegate
// {
// WaitTakeMeal.Remove(re);
// var removeObj = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.morkOrderPushes.FirstOrDefault(s => s.OrderPush.SuborderId == re.OrderPush.SuborderId) != null);
// if (removeObj != null) Json<KeepDataBase>.Data.orderLists.Remove(removeObj);
// });
//}
break;
default:
break;
if (!BPASmartClient.Business.InternetInfo.IsEnableTest)
{
WaitTakeMeal.Insert(0, orderStatusLists.ElementAt(index));
orderStatusLists.RemoveAt(index);
}

});
}
}
}), "OrderStatusChange");
}

break;
case ORDER_STATUS.COMPLETED_TAKE:
if (BPASmartClient.Business.InternetInfo.IsEnableTest)
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;

//压力测试时注释,正常使用需要取消注释
var re = WaitTakeMeal.FirstOrDefault(p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
if (re != null)
{
Application.Current.Dispatcher.BeginInvoke((Action)delegate
{
WaitTakeMeal.Remove(re);
var removeObj = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.morkOrderPushes.FirstOrDefault(s => s.OrderPush.SuborderId == re.OrderPush.SuborderId) != null);
if (removeObj != null) Json<KeepDataBase>.Data.orderLists.Remove(removeObj);
});
}
break;
default:
break;

}
}
}
}

+ 2
- 2
BPASmartClient/App.config View File

@@ -3,7 +3,7 @@
<appSettings>
<!--通用配置-->
<!--1:且时且多冰淇淋咖啡机,2:且时且多煮面机,3:海科煮面机测试店铺-->
<add key="ClientId" value="10"/>
<add key="ClientId" value="46"/>
<!--<add key="ApolloUri" value="http://10.2.1.21:28080"/>
<add key="OrderServiceUri" value="http://10.2.1.26:21527/order/"/>
<add key="StockServiceUri" value="http://10.2.1.26:21527/stock/"/>-->
@@ -18,7 +18,7 @@
<add key="DataVServiceUri" value="https://bpa.black-pa.com:21527/datav"/>-->
<add key="AppId" value="order"/>
<add key ="Namespaces" value="TEST1.Config"/>
<add key="IsEnableTest" value="False"/>
<add key="IsEnableTest" value="false"/>

<!--测试环境-->
<!--<add key="ApolloUri" value="http://10.2.1.21:28070"/>


+ 7
- 7
BPASmartClient/Control/OrderStatusView.xaml View File

@@ -36,7 +36,7 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<!--<RowDefinition />-->
</Grid.RowDefinitions>

<!--#region 制作中的订单列表-->
@@ -118,8 +118,8 @@
<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible">
<ItemsControl ItemsSource="{Binding orderStatusLists}">
<ItemsControl.ItemTemplate>
<DataTemplate>
@@ -206,7 +206,7 @@

<!--#region 表格标题栏设置-->

<Grid Background="#dd2AB2E7">
<!--<Grid Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
@@ -271,13 +271,13 @@
Foreground="{StaticResource TitleFontColor}"
Text="完成时间" />

</Grid>
</Grid>-->

<!--#endregion-->

<!--#region 表格数据显示-->

<ScrollViewer
<!--<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
@@ -352,7 +352,7 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</ScrollViewer>-->

<!--#endregion-->



+ 214
- 40
BPASmartClient/Control/ShopDeviceConfigView.xaml View File

@@ -73,6 +73,7 @@
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition Height="70" />
<RowDefinition />
</Grid.RowDefinitions>

@@ -100,6 +101,7 @@

<pry:IcoButton
Width="140"
Margin="0,0,20,0"
Content="新建店铺"
FontSize="16"
Foreground="{StaticResource TextBlockForeground}"
@@ -109,46 +111,210 @@

<pry:IcoButton
Width="140"
Content="保存"
Content="保存配置"
FontSize="16"
Foreground="{StaticResource TextBlockForeground}"
IcoText="&#xe626;"
MouseLeftButtonDown="IcoButton_MouseLeftButtonDown"
Style="{StaticResource NewButtonStyle}" />

<!--<Button
Width="140"
Margin="0,0,20,0"
Background="#FF19B7EC"
Command="{Binding NewConnectCommand}"
Content="新建连接"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource NewButtonTemp}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>-->

<!--<Button
Width="140"
Command="{Binding SaveConnectSetCommand}"
Content="保存"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource SaveButtonTemp}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>-->
</StackPanel>

<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<Grid Width="400" HorizontalAlignment="Left">
<pry:TitleTextBlock />
<TextBlock
Margin="5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontFamily="雅黑"
FontSize="20"
Foreground="Yellow"
Text="店铺信息" />
</Grid>

<StackPanel
Grid.Row="1"
HorizontalAlignment="Right"
Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle}" Text="店铺名称:" />

<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Minute}" />

<TextBlock Style="{StaticResource TextBlockStyle}" Text="店铺ID:" />

<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#ff19b7ec"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="aa" />

<pry:IcoButton
Width="140"
Margin="10,0,0,0"
Content="新建设备"
FontSize="16"
Foreground="{StaticResource TextBlockForeground}"
IcoText="&#xe626;"
MouseLeftButtonDown="IcoButton_MouseLeftButtonDown"
Style="{StaticResource NewButtonStyle}" />
</StackPanel>

</Grid>

<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition />
</Grid.RowDefinitions>

<Grid Width="400" HorizontalAlignment="Left">
<pry:TitleTextBlock />
<TextBlock
Margin="5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontFamily="雅黑"
FontSize="20"
Foreground="Yellow"
Text="设备信息" />
</Grid>

<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<StackPanel
Grid.Column="0"
Margin="10"
Background="Red">
<Button Content="设备1" />
<Button Content="设备1" />
<Button Content="设备1" />
<Button Content="设备1" />
<Button Content="设备1" />
</StackPanel>

<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition />
</Grid.RowDefinitions>

<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle}" Text="设备名称:" />

<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Minute}" />

<TextBlock Style="{StaticResource TextBlockStyle}" Text="设备ID:" />

<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#ff19b7ec"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="aa" />

<TextBlock
HorizontalAlignment="Left"
Style="{StaticResource TextBlockStyle}"
Text="选择启动设备:" />

<ComboBox
Width="130"
VerticalAlignment="Center"
BorderBrush="#FF23CACA"
BorderThickness="1"
FontFamily="楷体"
FontSize="20"
Foreground="#ff23caca"
IsEditable="False"
ItemsSource="{Binding Path=Device.PlcTypes}"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding Path=Device.PlcType}" />

<pry:IcoButton
Width="140"
Margin="10,0,0,0"
Content="新建通讯"
FontSize="16"
Foreground="{StaticResource TextBlockForeground}"
IcoText="&#xe626;"
MouseLeftButtonDown="IcoButton_MouseLeftButtonDown"
Style="{StaticResource NewButtonStyle}" />
</StackPanel>

<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<StackPanel>
<Button Content="通讯1" />
<Button Content="通讯1" />
<Button Content="通讯1" />
<Button Content="通讯1" />
</StackPanel>

<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
</Grid>

</Grid>

</Grid>



</Grid>




</Grid>


<ScrollViewer
Grid.Row="1"
Margin="0,10,0,0"
@@ -156,14 +322,16 @@
VerticalScrollBarVisibility="Hidden">


<Grid>
<!--<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="200" />
<RowDefinition />
</Grid.RowDefinitions>

<!-- 店铺信息 -->
-->
<!-- 店铺信息 -->
<!--
<Grid Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
@@ -246,7 +414,9 @@

</Grid>

<!-- 设备信息 -->
-->
<!-- 设备信息 -->
<!--
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
@@ -268,7 +438,9 @@
Text="设备信息" />
</Grid>

<!--#region 使用列表包裹-->
-->
<!--#region 使用列表包裹-->
<!--
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition />
@@ -359,19 +531,21 @@
Style="{StaticResource ComboBoxStyle}"
Text="{Binding Path=Device.PlcType}" />
</Grid>
<!--#endregion-->
-->
<!--#endregion-->

<!--<pry:IcoButton
<!--<pry:IcoButton
Grid.Row="4"
Content="添加设备"
FontSize="16"
Foreground="{StaticResource TextBlockForeground}"
IcoText="&#xe626;"
Style="{StaticResource NewButtonStyle}" />-->
<!--
</Grid>


</Grid>
</Grid>-->
<!--<ItemsControl ItemsSource="{Binding communicationSets}">
<ItemsControl.ItemTemplate>
<DataTemplate>


+ 1
- 1
BPASmartClient/DeviceInfo.xml View File

@@ -38,7 +38,7 @@
</Peripherals>
</Device>-->

<Device Name="Morks" Module="BPASmartClient.MorkS.Control" DeviceId="26">
<Device Name="Morks" Module="BPASmartClient.MorkS.Control" DeviceId="28">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.MorksMachine">
<Parameters>


+ 3
- 3
BPASmartClient/MainWindow.xaml View File

@@ -9,11 +9,11 @@
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
Title="MainWindow"
Width="1600"
Height="900"
Width="1300"
Height="800"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="False"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">


Loading…
Cancel
Save