@@ -1,4 +1,5 @@ | |||||
using System; | |||||
using BPA.Message.Enum; | |||||
using System; | |||||
namespace HBLConsole.Abstract | namespace HBLConsole.Abstract | ||||
{ | { | ||||
@@ -6,10 +7,13 @@ namespace HBLConsole.Abstract | |||||
{ | { | ||||
public abstract void GetBatchingInfo<T>(T batchingInfo); | public abstract void GetBatchingInfo<T>(T batchingInfo); | ||||
public abstract void GetBatchingInfo(int ClientId); | |||||
public abstract void AddOrder<T>(T orderInfo); | public abstract void AddOrder<T>(T orderInfo); | ||||
public abstract void GetRecipeBom<T>(T recipeBomInfo); | public abstract void GetRecipeBom<T>(T recipeBomInfo); | ||||
public abstract void BatchingCountInfo(); | |||||
public abstract bool OrderStatusChange(string subOrderId, ORDER_STATUS status); | |||||
} | } | ||||
} | } |
@@ -4,4 +4,10 @@ | |||||
<TargetFramework>net5.0</TargetFramework> | <TargetFramework>net5.0</TargetFramework> | ||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | |||||
<Reference Include="BPA.Message"> | |||||
<HintPath>D:\BPACommon_output\net5.0\BPA.Message.dll</HintPath> | |||||
</Reference> | |||||
</ItemGroup> | |||||
</Project> | </Project> |
@@ -1,4 +1,6 @@ | |||||
using HBLConsole.Communication; | using HBLConsole.Communication; | ||||
using HBLConsole.Factory; | |||||
using HBLConsole.Interface; | |||||
using HBLConsole.Model; | using HBLConsole.Model; | ||||
using HBLConsole.Service; | using HBLConsole.Service; | ||||
using System; | using System; | ||||
@@ -6,19 +8,15 @@ using System.Collections.Generic; | |||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using HBLConsole.GVL; | |||||
using BPA.Message; | |||||
namespace HBLConsole.Business | |||||
namespace HBLConsole.Business.Devices | |||||
{ | { | ||||
public class MORKS | |||||
public class MORKS : IBusiness | |||||
{ | { | ||||
private volatile static MORKS _Instance; | private volatile static MORKS _Instance; | ||||
public static MORKS GetInstance => _Instance ?? (_Instance = new MORKS()); | public static MORKS GetInstance => _Instance ?? (_Instance = new MORKS()); | ||||
private MORKS() { } | private MORKS() { } | ||||
/// <summary> | /// <summary> | ||||
/// 写入配方数据到 PLC | /// 写入配方数据到 PLC | ||||
/// </summary> | /// </summary> | ||||
@@ -47,23 +45,12 @@ namespace HBLConsole.Business | |||||
}), "ConnectOk"); | }), "ConnectOk"); | ||||
//获取物料信息 | //获取物料信息 | ||||
Json<BatchingInfoPar>.GetInstance.Base.orderMaterialDelivery = APIHelper.GetInstance.GetBatchingInfo(InternetInfo.GetInstance.ClientId); | |||||
Json<BatchingInfoPar>.GetInstance.Base.orderMaterialDelivery.BatchingInfo.Sort((a, b) => a.BatchingLoc.CompareTo(b.BatchingLoc)); | |||||
MessageLog.GetInstance.Show("【物料信息】"); | |||||
Json<BatchingInfoPar>.GetInstance.Base.orderMaterialDelivery?.BatchingInfo?.ForEach(x => | |||||
{ | |||||
MessageLog.GetInstance.Show($"{x.BatchingLoc}号位置:{x.BatchingCount}"); | |||||
}); | |||||
SimpleFactory.GetInstance.GetBatchingInfo(); | |||||
//Modbus Tcp 连接 | //Modbus Tcp 连接 | ||||
ModbusTcpHelper.GetInstance.ModbusTcpConnect("127.0.0.1"); | ModbusTcpHelper.GetInstance.ModbusTcpConnect("127.0.0.1"); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -0,0 +1,93 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using HBLConsole.Abstract; | |||||
using BPA.Message; | |||||
using HBLConsole.Model; | |||||
using HBLConsole.Service; | |||||
using BPA.Message.Enum; | |||||
using HBLConsole.GVL; | |||||
using BPA.Utility; | |||||
using Newtonsoft.Json; | |||||
namespace HBLConsole.Business.MessageServer | |||||
{ | |||||
public class Base : AbstractMessageServer | |||||
{ | |||||
public override void AddOrder<T>(T orderInfo) | |||||
{ | |||||
if (orderInfo == null) return; | |||||
if (orderInfo is MorkOrderPush morkOrderpush) | |||||
{ | |||||
Json<MorkOrderPushPar>.GetInstance.Base.morkOrderPushes.Add(new OrderData() | |||||
{ | |||||
OrderStatus = ORDER_STATUS.WAIT, | |||||
IsSelected = true, | |||||
OrderPush = morkOrderpush | |||||
}); | |||||
ActionManagerment.GetInstance.Send("AddOrder", morkOrderpush); | |||||
} | |||||
} | |||||
public override void GetBatchingInfo<T>(T batchingInfo) | |||||
{ | |||||
if (batchingInfo == null) return; | |||||
if (batchingInfo is OrderMaterialDelivery BatchingInfos) | |||||
{ | |||||
Json<BatchingInfoPar>.GetInstance.Base.orderMaterialDelivery = BatchingInfos; | |||||
} | |||||
} | |||||
public override void GetBatchingInfo(int ClientId) | |||||
{ | |||||
string result = string.Empty; | |||||
try | |||||
{ | |||||
var jsondata = new { ClientId }; | |||||
string header = $"[{InternetInfo.GetInstance.StockServer}/GetItemInfo]_[{DateTime.Now.Ticks}]".AESEncrypt(); | |||||
string url = $"{InternetInfo.GetInstance.ApiAddress}{InternetInfo.GetInstance.StockServer}/GetItemInfo"; | |||||
result = APIHelper.GetInstance.HttpRequest(url, header, jsondata, RequestType.POST); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.Show(ex.ToString()); | |||||
} | |||||
Json<BatchingInfoPar>.GetInstance.Base.orderMaterialDelivery = JsonConvert.DeserializeObject<OrderMaterialDelivery>(result); | |||||
MessageLog.GetInstance.Show("【物料信息】"); | |||||
Json<BatchingInfoPar>.GetInstance.Base.orderMaterialDelivery?.BatchingInfo?.ForEach(x => | |||||
{ | |||||
MessageLog.GetInstance.Show($"{x.BatchingLoc}号位置:{x.BatchingCount}"); | |||||
}); | |||||
} | |||||
public override void GetRecipeBom<T>(T recipeBomInfo) | |||||
{ | |||||
if (recipeBomInfo == null) return; | |||||
if (recipeBomInfo is RecipeBoms recipeBom) | |||||
{ | |||||
Json<BatchingInfoPar>.GetInstance.Base.recipeBoms = recipeBom; | |||||
} | |||||
} | |||||
public override bool OrderStatusChange(string subOrderId, ORDER_STATUS status) | |||||
{ | |||||
string result = string.Empty; | |||||
OrderStatusChange orderStatusChange = new OrderStatusChange() { CookingStatus = status, SuborderId = subOrderId }; | |||||
try | |||||
{ | |||||
string header = $"[{InternetInfo.GetInstance.OrderServer}/order/robotstatuschange]_[{DateTime.Now.Ticks}]".AESEncrypt(); | |||||
string url = $"{InternetInfo.GetInstance.ApiAddress}{InternetInfo.GetInstance.OrderServer}/order/robotstatuschange"; | |||||
result = APIHelper.GetInstance.HttpRequest(url, header, orderStatusChange, RequestType.POST); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.Show(ex.ToString()); | |||||
} | |||||
var res = JsonConvert.DeserializeObject<OrderStatusChangeRsp>(result); | |||||
return res?.Result == 2; | |||||
} | |||||
} | |||||
} |
@@ -1,53 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using HBLConsole.Abstract; | |||||
using BPA.Message; | |||||
using HBLConsole.Model; | |||||
using HBLConsole.Service; | |||||
using BPA.Message.Enum; | |||||
namespace HBLConsole.Business | |||||
{ | |||||
public class MessageServerBase : AbstractMessageServer | |||||
{ | |||||
public override void AddOrder<T>(T orderInfo) | |||||
{ | |||||
if (orderInfo == null) return; | |||||
if (orderInfo is MorkOrderPush morkOrderpush) | |||||
{ | |||||
Json<MorkOrderPushPar>.GetInstance.Base.morkOrderPushes.Add(new OrderData() | |||||
{ | |||||
OrderStatus = ORDER_STATUS.WAIT, | |||||
IsSelected = true, | |||||
OrderPush = morkOrderpush | |||||
}); | |||||
} | |||||
} | |||||
public override void BatchingCountInfo() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void GetBatchingInfo<T>(T batchingInfo) | |||||
{ | |||||
if (batchingInfo == null) return; | |||||
if (batchingInfo is OrderMaterialDelivery BatchingInfos) | |||||
{ | |||||
Json<BatchingInfoPar>.GetInstance.Base.orderMaterialDelivery = BatchingInfos; | |||||
} | |||||
} | |||||
public override void GetRecipeBom<T>(T recipeBomInfo) | |||||
{ | |||||
if (recipeBomInfo == null) return; | |||||
if (recipeBomInfo is RecipeBoms recipeBom) | |||||
{ | |||||
Json<BatchingInfoPar>.GetInstance.Base.recipeBoms = recipeBom; | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -22,8 +22,6 @@ namespace HBLConsole.Business | |||||
ConcurrentQueue<string> receives = new ConcurrentQueue<string>(); | ConcurrentQueue<string> receives = new ConcurrentQueue<string>(); | ||||
IServerMessage serverMessage = new ServerMessage(); | |||||
public void Init() | public void Init() | ||||
{ | { | ||||
ThreadManagerment.GetInstance.StartLong(new Action(() => | ThreadManagerment.GetInstance.StartLong(new Action(() => | ||||
@@ -37,13 +35,13 @@ namespace HBLConsole.Business | |||||
{ | { | ||||
if (package.Message != null) | if (package.Message != null) | ||||
{ | { | ||||
serverMessage.Universal(SimpleFactory.GetInstance.GetAbsMessageServer, package.Message); | |||||
SimpleFactory.GetInstance.MqttMessage(package.Message); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
}), ""); | |||||
}), "mqtt消息处理"); | |||||
} | } | ||||
@@ -1,22 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using HBLConsole.Interface; | |||||
using BPA.Message; | |||||
using HBLConsole.Abstract; | |||||
namespace HBLConsole.Business | |||||
{ | |||||
public class ServerMessage : IServerMessage | |||||
{ | |||||
public void Universal(AbstractMessageServer abstractMessageServer, IMessage message) | |||||
{ | |||||
abstractMessageServer.AddOrder(message); | |||||
abstractMessageServer.GetBatchingInfo(message); | |||||
abstractMessageServer.GetRecipeBom(message); | |||||
abstractMessageServer.BatchingCountInfo(); | |||||
} | |||||
} | |||||
} |
@@ -4,6 +4,8 @@ using System; | |||||
using System.Reflection; | using System.Reflection; | ||||
using BPA.Message.Enum; | using BPA.Message.Enum; | ||||
using HBLConsole.GVL; | using HBLConsole.GVL; | ||||
using BPA.Message; | |||||
using HBLConsole.Service; | |||||
namespace HBLConsole.Factory | namespace HBLConsole.Factory | ||||
{ | { | ||||
@@ -17,15 +19,67 @@ namespace HBLConsole.Factory | |||||
public AbstractMessageServer GetAbsMessageServer => _GetAbsMessageServer ?? (_GetAbsMessageServer = GetAbstractMessageServer()); | public AbstractMessageServer GetAbsMessageServer => _GetAbsMessageServer ?? (_GetAbsMessageServer = GetAbstractMessageServer()); | ||||
private AbstractMessageServer _GetAbsMessageServer; | private AbstractMessageServer _GetAbsMessageServer; | ||||
//public IServerMessage GetIServerMessage => _GetIServerMessage ?? (_GetIServerMessage = new ServerMessage()); | |||||
//private IServerMessage _GetIServerMessage; | |||||
private string DeviceType => GeneralConfig.GetInstance.DeviceType.ToString(); | |||||
public void MqttMessage(IMessage message) | |||||
{ | |||||
GetAbsMessageServer.AddOrder(message); | |||||
GetAbsMessageServer.GetBatchingInfo(message); | |||||
GetAbsMessageServer.GetRecipeBom(message); | |||||
} | |||||
/// <summary> | |||||
/// 获取物料信息 | |||||
/// </summary> | |||||
public void GetBatchingInfo() | |||||
{ | |||||
GetAbsMessageServer.GetBatchingInfo(InternetInfo.GetInstance.ClientId); | |||||
} | |||||
/// <summary> | |||||
/// 订单状态更改 | |||||
/// </summary> | |||||
/// <param name="subid"></param> | |||||
/// <param name="status"></param> | |||||
/// <returns></returns> | |||||
public bool OrderChanged(string subid, ORDER_STATUS status) | |||||
{ | |||||
bool res = GetAbsMessageServer.OrderStatusChange(subid, status); | |||||
if (res) | |||||
{ | |||||
ActionManagerment.GetInstance.Send("OrderStatusChange", new OrderStatusChange() | |||||
{ | |||||
CookingStatus = status, | |||||
SuborderId = subid | |||||
}); | |||||
} | |||||
return res; | |||||
} | |||||
private AbstractMessageServer GetAbstractMessageServer() | private AbstractMessageServer GetAbstractMessageServer() | ||||
{ | { | ||||
Type type = Assembly.Load("HBLConsole.Business").GetType($"HBLConsole.Business.{GeneralConfig.GetInstance.DeviceType.ToString()}"); | |||||
string NameSpace = "HBLConsole.Business"; | |||||
Type type = Assembly.Load(NameSpace).GetType($"{NameSpace}.MessageServer.{DeviceType}"); | |||||
if (type == null) | if (type == null) | ||||
type = Assembly.Load("HBLConsole.Business").GetType($"HBLConsole.Business.MessageServerBase"); | |||||
type = Assembly.Load(NameSpace).GetType($"{NameSpace}.MessageServer.Base"); | |||||
return (AbstractMessageServer)Activator.CreateInstance(type); | return (AbstractMessageServer)Activator.CreateInstance(type); | ||||
} | } | ||||
/// <summary> | |||||
/// 设备初始化 | |||||
/// </summary> | |||||
public void DeviceInit() | |||||
{ | |||||
string NameSpace = "HBLConsole.Business";//Load 加载的是dll的名称,GetType获取的是全命名空间下的类 | |||||
Type type = Assembly.Load(NameSpace).GetType($"{NameSpace}.Devices.{DeviceType}"); | |||||
IBusiness business = (IBusiness)type?.GetProperty("GetInstance").GetValue(null); | |||||
business?.Init(); | |||||
} | |||||
public IGvl GetGvl() | |||||
{ | |||||
Type type = Assembly.Load("HBLConsole.GVL").GetType($"HBLConsole.GVL.{DeviceType}"); | |||||
return (IGvl)Activator.CreateInstance(type); | |||||
} | |||||
} | } | ||||
} | } |
@@ -13,6 +13,7 @@ | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<ProjectReference Include="..\HBLConsole.Interface\HBLConsole.Interface.csproj" /> | |||||
<ProjectReference Include="..\HBLConsole.Service\HBLConsole.Service.csproj" /> | <ProjectReference Include="..\HBLConsole.Service\HBLConsole.Service.csproj" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -22,7 +22,10 @@ namespace HBLConsole.GVL | |||||
public static InternetInfo GetInstance => _Instance ?? (_Instance = new InternetInfo()); | public static InternetInfo GetInstance => _Instance ?? (_Instance = new InternetInfo()); | ||||
private InternetInfo() { } | private InternetInfo() { } | ||||
public void Init() | |||||
/// <summary> | |||||
/// 配置初始化 | |||||
/// </summary> | |||||
public void ConfigInit() | |||||
{ | { | ||||
NetworkConnectState = UniversalHelper.GetInstance.GetNetworkState(); | NetworkConnectState = UniversalHelper.GetInstance.GetNetworkState(); | ||||
while (!NetworkConnectState) | while (!NetworkConnectState) | ||||
@@ -3,13 +3,14 @@ using System.Collections.Generic; | |||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using HBLConsole.Interface; | |||||
namespace HBLConsole.GVL | namespace HBLConsole.GVL | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// MORKS 设备数据 | /// MORKS 设备数据 | ||||
/// </summary> | /// </summary> | ||||
public class MORKS | |||||
public class MORKS : IGvl | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 初始化完成 | /// 初始化完成 | ||||
@@ -0,0 +1,13 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace HBLConsole.Interface | |||||
{ | |||||
public interface IBusiness | |||||
{ | |||||
void Init(); | |||||
} | |||||
} |
@@ -0,0 +1,12 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace HBLConsole.Interface | |||||
{ | |||||
public interface IGvl | |||||
{ | |||||
} | |||||
} |
@@ -9,6 +9,7 @@ using HBLConsole.GVL; | |||||
using HBLConsole.Communication; | using HBLConsole.Communication; | ||||
using BPA.Message; | using BPA.Message; | ||||
using HBLConsole.Business; | using HBLConsole.Business; | ||||
using HBLConsole.Factory; | |||||
namespace HBLConsole.MainConsole | namespace HBLConsole.MainConsole | ||||
{ | { | ||||
@@ -40,15 +41,19 @@ namespace HBLConsole.MainConsole | |||||
Topics.Add(TOPIC.GetInstance.GetBusinessTopic(GeneralConfig.GetInstance.DeviceType, InternetInfo.GetInstance.ClientId)); | Topics.Add(TOPIC.GetInstance.GetBusinessTopic(GeneralConfig.GetInstance.DeviceType, InternetInfo.GetInstance.ClientId)); | ||||
ThreadManagerment.GetInstance.Start(new Action(() => | ThreadManagerment.GetInstance.Start(new Action(() => | ||||
{ | { | ||||
InternetInfo.GetInstance.Init();//从 consul 获取配置数据 | |||||
InternetInfo.GetInstance.ConfigInit();//从 consul 获取配置数据 | |||||
MORKS.GetInstance.Init();//设备初始化 | |||||
SimpleFactory.GetInstance.DeviceInit();//设备初始化 | |||||
//MQTT 连接成功 | //MQTT 连接成功 | ||||
MqttHelper.GetInstance.ConnectOk = new Action(() => | MqttHelper.GetInstance.ConnectOk = new Action(() => | ||||
{ | { | ||||
MqttHelper.GetInstance.MqttSubscriptionAsync(Topics.ToArray());//主题订阅 | MqttHelper.GetInstance.MqttSubscriptionAsync(Topics.ToArray());//主题订阅 | ||||
HeartbeatReport.GetInstance.Init();//心跳上报 | HeartbeatReport.GetInstance.Init();//心跳上报 | ||||
ServerData.GetInstance.Init();//数据处理初始化 | |||||
//接收MQTT消息 | //接收MQTT消息 | ||||
MqttHelper.GetInstance.MqttReceive = new Action<MQTTnet.MqttApplicationMessageReceivedEventArgs>((receivce) => | MqttHelper.GetInstance.MqttReceive = new Action<MQTTnet.MqttApplicationMessageReceivedEventArgs>((receivce) => | ||||
{ | { | ||||
@@ -0,0 +1,199 @@ | |||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | |||||
<!--#region ScrollViewerStyle--> | |||||
<ControlTemplate x:Key="MyScrollViewer" TargetType="{x:Type ScrollViewer}"> | |||||
<!-- View区域背景色 --> | |||||
<Grid x:Name="Grid" Background="{TemplateBinding Background}"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="*" /> | |||||
<ColumnDefinition Width="Auto" /> | |||||
</Grid.ColumnDefinitions> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="*" /> | |||||
<RowDefinition Height="Auto" /> | |||||
</Grid.RowDefinitions> | |||||
<Rectangle | |||||
x:Name="Corner" | |||||
Grid.Row="1" | |||||
Grid.Column="1" | |||||
Fill="White" /> | |||||
<ScrollContentPresenter | |||||
x:Name="PART_ScrollContentPresenter" | |||||
Grid.Row="0" | |||||
Grid.Column="0" | |||||
Margin="{TemplateBinding Padding}" | |||||
CanContentScroll="{TemplateBinding CanContentScroll}" | |||||
CanHorizontallyScroll="False" | |||||
CanVerticallyScroll="False" | |||||
Content="{TemplateBinding Content}" | |||||
ContentTemplate="{TemplateBinding ContentTemplate}" /> | |||||
<ScrollBar | |||||
x:Name="PART_VerticalScrollBar" | |||||
Grid.Row="0" | |||||
Grid.Column="1" | |||||
AutomationProperties.AutomationId="VerticalScrollBar" | |||||
Cursor="Arrow" | |||||
Maximum="{TemplateBinding ScrollableHeight}" | |||||
Minimum="0" | |||||
Style="{DynamicResource MyScrollBarStyle}" | |||||
ViewportSize="{TemplateBinding ViewportHeight}" | |||||
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" | |||||
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" /> | |||||
<ScrollBar | |||||
x:Name="PART_HorizontalScrollBar" | |||||
Grid.Row="1" | |||||
Grid.Column="0" | |||||
AutomationProperties.AutomationId="HorizontalScrollBar" | |||||
Cursor="Arrow" | |||||
Maximum="{TemplateBinding ScrollableWidth}" | |||||
Minimum="0" | |||||
Orientation="Horizontal" | |||||
Style="{DynamicResource MyScrollBarStyle}" | |||||
ViewportSize="{TemplateBinding ViewportWidth}" | |||||
Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" | |||||
Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" /> | |||||
</Grid> | |||||
</ControlTemplate> | |||||
<SolidColorBrush x:Key="ScrollBarDisabledBackground" Color="#F4F4F4" /> | |||||
<Style x:Key="VerticalScrollBarPageButton" TargetType="{x:Type RepeatButton}"> | |||||
<Setter Property="OverridesDefaultStyle" Value="true" /> | |||||
<Setter Property="Background" Value="Transparent" /> | |||||
<Setter Property="Focusable" Value="false" /> | |||||
<Setter Property="IsTabStop" Value="false" /> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="{x:Type RepeatButton}"> | |||||
<Rectangle | |||||
Width="{TemplateBinding Width}" | |||||
Height="{TemplateBinding Height}" | |||||
Fill="{TemplateBinding Background}" /> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</Style> | |||||
<!-- 滚动条颜色、圆角等设置 --> | |||||
<Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}"> | |||||
<Setter Property="OverridesDefaultStyle" Value="true" /> | |||||
<Setter Property="IsTabStop" Value="false" /> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="{x:Type Thumb}"> | |||||
<!-- 滚动条颜色和圆角设置 --> | |||||
<Rectangle | |||||
Name="thumbRect" | |||||
Fill="#03ffea" | |||||
RadiusX="3" | |||||
RadiusY="3" /> | |||||
<!-- 鼠标拉动滚动条时的颜色 --> | |||||
<ControlTemplate.Triggers> | |||||
<Trigger Property="IsMouseOver" Value="True"> | |||||
<Setter TargetName="thumbRect" Property="Fill" Value="CornflowerBlue" /> | |||||
</Trigger> | |||||
</ControlTemplate.Triggers> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</Style> | |||||
<Style x:Key="HorizontalScrollBarPageButton" TargetType="{x:Type RepeatButton}"> | |||||
<Setter Property="OverridesDefaultStyle" Value="true" /> | |||||
<Setter Property="Background" Value="Transparent" /> | |||||
<Setter Property="Focusable" Value="false" /> | |||||
<Setter Property="IsTabStop" Value="false" /> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="{x:Type RepeatButton}"> | |||||
<Rectangle | |||||
Width="{TemplateBinding Width}" | |||||
Height="{TemplateBinding Height}" | |||||
Fill="{TemplateBinding Background}" /> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</Style> | |||||
<Style x:Key="MyScrollBarStyle" TargetType="{x:Type ScrollBar}"> | |||||
<Setter Property="Background" Value="AliceBlue" /> | |||||
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" /> | |||||
<Setter Property="Stylus.IsFlicksEnabled" Value="false" /> | |||||
<!-- 滚动条宽度 --> | |||||
<Setter Property="Width" Value="8" /> | |||||
<Setter Property="MinWidth" Value="6" /> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="{x:Type ScrollBar}"> | |||||
<!-- 滚动条背景色 --> | |||||
<Grid | |||||
x:Name="Bg" | |||||
Width="8" | |||||
Background="#001f55" | |||||
SnapsToDevicePixels="true"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
<Track | |||||
x:Name="PART_Track" | |||||
IsDirectionReversed="true" | |||||
IsEnabled="{TemplateBinding IsMouseOver}"> | |||||
<Track.DecreaseRepeatButton> | |||||
<RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource VerticalScrollBarPageButton}" /> | |||||
</Track.DecreaseRepeatButton> | |||||
<Track.IncreaseRepeatButton> | |||||
<RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource VerticalScrollBarPageButton}" /> | |||||
</Track.IncreaseRepeatButton> | |||||
<Track.Thumb> | |||||
<Thumb Style="{StaticResource ScrollBarThumb}" /> | |||||
</Track.Thumb> | |||||
</Track> | |||||
</Grid> | |||||
<ControlTemplate.Triggers> | |||||
<Trigger Property="IsEnabled" Value="false"> | |||||
<Setter TargetName="Bg" Property="Background" Value="{StaticResource ScrollBarDisabledBackground}" /> | |||||
</Trigger> | |||||
</ControlTemplate.Triggers> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
<Style.Triggers> | |||||
<Trigger Property="Orientation" Value="Horizontal"> | |||||
<Setter Property="Width" Value="Auto" /> | |||||
<Setter Property="MinWidth" Value="0" /> | |||||
<Setter Property="Height" Value="6" /> | |||||
<Setter Property="MinHeight" Value="6" /> | |||||
<Setter Property="Background" Value="AliceBlue" /> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="{x:Type ScrollBar}"> | |||||
<Grid | |||||
x:Name="Bg" | |||||
Background="Red" | |||||
SnapsToDevicePixels="true"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition /> | |||||
</Grid.ColumnDefinitions> | |||||
<Track x:Name="PART_Track" IsEnabled="{TemplateBinding IsMouseOver}"> | |||||
<Track.DecreaseRepeatButton> | |||||
<RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource HorizontalScrollBarPageButton}" /> | |||||
</Track.DecreaseRepeatButton> | |||||
<Track.IncreaseRepeatButton> | |||||
<RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource HorizontalScrollBarPageButton}" /> | |||||
</Track.IncreaseRepeatButton> | |||||
<Track.Thumb> | |||||
<Thumb Style="{StaticResource ScrollBarThumb}" /> | |||||
</Track.Thumb> | |||||
</Track> | |||||
</Grid> | |||||
<ControlTemplate.Triggers> | |||||
<Trigger Property="IsEnabled" Value="false"> | |||||
<Setter TargetName="Bg" Property="Background" Value="{StaticResource ScrollBarDisabledBackground}" /> | |||||
</Trigger> | |||||
</ControlTemplate.Triggers> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</Trigger> | |||||
</Style.Triggers> | |||||
</Style> | |||||
<!--#endregion--> | |||||
</ResourceDictionary> |
@@ -6,14 +6,11 @@ using System.Linq; | |||||
using System.Net; | using System.Net; | ||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPA.Utility; | |||||
using HBLConsole.GVL; | |||||
using BPA.Message; | |||||
using System.Web; | using System.Web; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using HBLConsole.Service; | using HBLConsole.Service; | ||||
namespace HBLConsole.Business | |||||
namespace HBLConsole.Service | |||||
{ | { | ||||
public class APIHelper | public class APIHelper | ||||
{ | { | ||||
@@ -27,46 +24,46 @@ namespace HBLConsole.Business | |||||
/// </summary> | /// </summary> | ||||
/// <param name="ClientId"></param> | /// <param name="ClientId"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public OrderMaterialDelivery GetBatchingInfo(int ClientId) | |||||
{ | |||||
string result = string.Empty; | |||||
try | |||||
{ | |||||
var jsondata = new { ClientId }; | |||||
string header = $"[{InternetInfo.GetInstance.StockServer}/GetItemInfo]_[{DateTime.Now.Ticks}]".AESEncrypt(); | |||||
string url = $"{InternetInfo.GetInstance.ApiAddress}{InternetInfo.GetInstance.StockServer}/GetItemInfo"; | |||||
result = HttpRequest(url, header, jsondata, RequestType.POST); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.Show(ex.ToString()); | |||||
} | |||||
return JsonConvert.DeserializeObject<OrderMaterialDelivery>(result); | |||||
} | |||||
//public OrderMaterialDelivery GetBatchingInfo(int ClientId) | |||||
//{ | |||||
// string result = string.Empty; | |||||
// try | |||||
// { | |||||
// var jsondata = new { ClientId }; | |||||
// string header = $"[{InternetInfo.GetInstance.StockServer}/GetItemInfo]_[{DateTime.Now.Ticks}]".AESEncrypt(); | |||||
// string url = $"{InternetInfo.GetInstance.ApiAddress}{InternetInfo.GetInstance.StockServer}/GetItemInfo"; | |||||
// result = HttpRequest(url, header, jsondata, RequestType.POST); | |||||
// } | |||||
// catch (Exception ex) | |||||
// { | |||||
// MessageLog.GetInstance.Show(ex.ToString()); | |||||
// } | |||||
// return JsonConvert.DeserializeObject<OrderMaterialDelivery>(result); | |||||
//} | |||||
/// <summary> | |||||
/// 更改订单状态 | |||||
/// </summary> | |||||
/// <param name=""></param> | |||||
/// <returns></returns> | |||||
public OrderStatusChangeRsp OrderStatusChange(OrderStatusChange orderStatusChange) | |||||
{ | |||||
string result = string.Empty; | |||||
try | |||||
{ | |||||
string header = $"[{InternetInfo.GetInstance.OrderServer}/order/robotstatuschange]_[{DateTime.Now.Ticks}]".AESEncrypt(); | |||||
string url = $"{InternetInfo.GetInstance.ApiAddress}{InternetInfo.GetInstance.OrderServer}/order/robotstatuschange"; | |||||
result = HttpRequest(url, header, orderStatusChange, RequestType.POST); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.Show(ex.ToString()); | |||||
} | |||||
return JsonConvert.DeserializeObject<OrderStatusChangeRsp>(result); | |||||
} | |||||
///// <summary> | |||||
///// 更改订单状态 | |||||
///// </summary> | |||||
///// <param name=""></param> | |||||
///// <returns></returns> | |||||
//public OrderStatusChangeRsp OrderStatusChange(OrderStatusChange orderStatusChange) | |||||
//{ | |||||
// string result = string.Empty; | |||||
// try | |||||
// { | |||||
// string header = $"[{InternetInfo.GetInstance.OrderServer}/order/robotstatuschange]_[{DateTime.Now.Ticks}]".AESEncrypt(); | |||||
// string url = $"{InternetInfo.GetInstance.ApiAddress}{InternetInfo.GetInstance.OrderServer}/order/robotstatuschange"; | |||||
// result = HttpRequest(url, header, orderStatusChange, RequestType.POST); | |||||
// } | |||||
// catch (Exception ex) | |||||
// { | |||||
// MessageLog.GetInstance.Show(ex.ToString()); | |||||
// } | |||||
// return JsonConvert.DeserializeObject<OrderStatusChangeRsp>(result); | |||||
//} | |||||
public static string PostData(string url, string data, string head) | |||||
public string PostData(string url, string data, string head) | |||||
{ | { | ||||
byte[] b = Encoding.UTF8.GetBytes(data);//把字符串转换为二进制 | byte[] b = Encoding.UTF8.GetBytes(data);//把字符串转换为二进制 | ||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); | ||||
@@ -88,7 +85,7 @@ namespace HBLConsole.Business | |||||
return str; | return str; | ||||
} | } | ||||
public static string GetData(string url, string head) | |||||
public string GetData(string url, string head) | |||||
{ | { | ||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); | ||||
request.Method = "GET"; | request.Method = "GET"; |
@@ -12,6 +12,8 @@ using System.Diagnostics; | |||||
using HBLConsole.Service; | using HBLConsole.Service; | ||||
using HBLConsole.Model; | using HBLConsole.Model; | ||||
using HBLConsole.MainConsole; | using HBLConsole.MainConsole; | ||||
using HBLConsole.GVL; | |||||
using BPA.Message.Enum; | |||||
namespace HBLConsole | namespace HBLConsole | ||||
{ | { | ||||
@@ -25,6 +27,7 @@ namespace HBLConsole | |||||
protected override void OnStartup(StartupEventArgs e) | protected override void OnStartup(StartupEventArgs e) | ||||
{ | { | ||||
base.OnStartup(e); | base.OnStartup(e); | ||||
GeneralConfig.GetInstance.DeviceType = DeviceClientType.MORKS; | |||||
SystemHelper.GetInstance.AutoStart(false); | SystemHelper.GetInstance.AutoStart(false); | ||||
SystemHelper.GetInstance.CreateDesktopShortcut(); | SystemHelper.GetInstance.CreateDesktopShortcut(); | ||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; | AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; | ||||
@@ -196,4 +196,201 @@ | |||||
</ControlTemplate> | </ControlTemplate> | ||||
<!--#endregion--> | <!--#endregion--> | ||||
<!--#region ScrollViewerStyle--> | |||||
<ControlTemplate x:Key="MyScrollViewer" TargetType="{x:Type ScrollViewer}"> | |||||
<!-- View区域背景色 --> | |||||
<Grid x:Name="Grid" Background="{TemplateBinding Background}"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="*" /> | |||||
<ColumnDefinition Width="Auto" /> | |||||
</Grid.ColumnDefinitions> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="*" /> | |||||
<RowDefinition Height="Auto" /> | |||||
</Grid.RowDefinitions> | |||||
<Rectangle | |||||
x:Name="Corner" | |||||
Grid.Row="1" | |||||
Grid.Column="1" | |||||
Fill="Transparent" /> | |||||
<ScrollContentPresenter | |||||
x:Name="PART_ScrollContentPresenter" | |||||
Grid.Row="0" | |||||
Grid.Column="0" | |||||
Margin="{TemplateBinding Padding}" | |||||
CanContentScroll="{TemplateBinding CanContentScroll}" | |||||
CanHorizontallyScroll="False" | |||||
CanVerticallyScroll="False" | |||||
Content="{TemplateBinding Content}" | |||||
ContentTemplate="{TemplateBinding ContentTemplate}" /> | |||||
<ScrollBar | |||||
x:Name="PART_VerticalScrollBar" | |||||
Grid.Row="0" | |||||
Grid.Column="1" | |||||
AutomationProperties.AutomationId="VerticalScrollBar" | |||||
Cursor="Arrow" | |||||
Maximum="{TemplateBinding ScrollableHeight}" | |||||
Minimum="0" | |||||
Style="{DynamicResource MyScrollBarStyle}" | |||||
ViewportSize="{TemplateBinding ViewportHeight}" | |||||
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" | |||||
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" /> | |||||
<ScrollBar | |||||
x:Name="PART_HorizontalScrollBar" | |||||
Grid.Row="1" | |||||
Grid.Column="0" | |||||
AutomationProperties.AutomationId="HorizontalScrollBar" | |||||
Cursor="Arrow" | |||||
Maximum="{TemplateBinding ScrollableWidth}" | |||||
Minimum="0" | |||||
Orientation="Horizontal" | |||||
Style="{DynamicResource MyScrollBarStyle}" | |||||
ViewportSize="{TemplateBinding ViewportWidth}" | |||||
Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" | |||||
Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" /> | |||||
</Grid> | |||||
</ControlTemplate> | |||||
<!--初始滚动条样式--> | |||||
<SolidColorBrush x:Key="ScrollBarDisabledBackground" Color="Transparent" /> | |||||
<Style x:Key="VerticalScrollBarPageButton" TargetType="{x:Type RepeatButton}"> | |||||
<Setter Property="OverridesDefaultStyle" Value="true" /> | |||||
<Setter Property="Background" Value="Transparent" /> | |||||
<Setter Property="Focusable" Value="false" /> | |||||
<Setter Property="IsTabStop" Value="false" /> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="{x:Type RepeatButton}"> | |||||
<Rectangle | |||||
Width="{TemplateBinding Width}" | |||||
Height="{TemplateBinding Height}" | |||||
Fill="{TemplateBinding Background}" /> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</Style> | |||||
<!-- 滚动条颜色、圆角等设置 --> | |||||
<Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}"> | |||||
<Setter Property="OverridesDefaultStyle" Value="true" /> | |||||
<Setter Property="IsTabStop" Value="false" /> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="{x:Type Thumb}"> | |||||
<!-- 滚动条颜色和圆角设置 --> | |||||
<Rectangle | |||||
Name="thumbRect" | |||||
Fill="#334B8EC4" | |||||
RadiusX="3" | |||||
RadiusY="3" /> | |||||
<!-- 鼠标拉动滚动条时的颜色 --> | |||||
<ControlTemplate.Triggers> | |||||
<Trigger Property="IsMouseOver" Value="True"> | |||||
<Setter TargetName="thumbRect" Property="Fill" Value="CornflowerBlue" /> | |||||
</Trigger> | |||||
</ControlTemplate.Triggers> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</Style> | |||||
<Style x:Key="HorizontalScrollBarPageButton" TargetType="{x:Type RepeatButton}"> | |||||
<Setter Property="OverridesDefaultStyle" Value="true" /> | |||||
<Setter Property="Background" Value="Transparent" /> | |||||
<Setter Property="Focusable" Value="false" /> | |||||
<Setter Property="IsTabStop" Value="false" /> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="{x:Type RepeatButton}"> | |||||
<Rectangle | |||||
Width="{TemplateBinding Width}" | |||||
Height="{TemplateBinding Height}" | |||||
Fill="{TemplateBinding Background}" /> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</Style> | |||||
<Style x:Key="MyScrollBarStyle" TargetType="{x:Type ScrollBar}"> | |||||
<Setter Property="Background" Value="AliceBlue" /> | |||||
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" /> | |||||
<Setter Property="Stylus.IsFlicksEnabled" Value="false" /> | |||||
<!-- 滚动条宽度 --> | |||||
<Setter Property="Width" Value="8" /> | |||||
<Setter Property="MinWidth" Value="6" /> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="{x:Type ScrollBar}"> | |||||
<!-- 滚动条背景色 --> | |||||
<Grid | |||||
x:Name="Bg" | |||||
Width="8" | |||||
Background="#884B8EC4" | |||||
SnapsToDevicePixels="true"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
<Track | |||||
x:Name="PART_Track" | |||||
IsDirectionReversed="true" | |||||
IsEnabled="{TemplateBinding IsMouseOver}"> | |||||
<Track.DecreaseRepeatButton> | |||||
<RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource VerticalScrollBarPageButton}" /> | |||||
</Track.DecreaseRepeatButton> | |||||
<Track.IncreaseRepeatButton> | |||||
<RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource VerticalScrollBarPageButton}" /> | |||||
</Track.IncreaseRepeatButton> | |||||
<Track.Thumb> | |||||
<Thumb Style="{StaticResource ScrollBarThumb}" /> | |||||
</Track.Thumb> | |||||
</Track> | |||||
</Grid> | |||||
<ControlTemplate.Triggers> | |||||
<Trigger Property="IsEnabled" Value="false"> | |||||
<Setter TargetName="Bg" Property="Background" Value="{StaticResource ScrollBarDisabledBackground}" /> | |||||
</Trigger> | |||||
</ControlTemplate.Triggers> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
<Style.Triggers> | |||||
<Trigger Property="Orientation" Value="Horizontal"> | |||||
<Setter Property="Width" Value="Auto" /> | |||||
<Setter Property="MinWidth" Value="0" /> | |||||
<Setter Property="Height" Value="6" /> | |||||
<Setter Property="MinHeight" Value="6" /> | |||||
<Setter Property="Background" Value="AliceBlue" /> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="{x:Type ScrollBar}"> | |||||
<Grid | |||||
x:Name="Bg" | |||||
Background="Red" | |||||
SnapsToDevicePixels="true"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition /> | |||||
</Grid.ColumnDefinitions> | |||||
<Track x:Name="PART_Track" IsEnabled="{TemplateBinding IsMouseOver}"> | |||||
<Track.DecreaseRepeatButton> | |||||
<RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource HorizontalScrollBarPageButton}" /> | |||||
</Track.DecreaseRepeatButton> | |||||
<Track.IncreaseRepeatButton> | |||||
<RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource HorizontalScrollBarPageButton}" /> | |||||
</Track.IncreaseRepeatButton> | |||||
<Track.Thumb> | |||||
<Thumb Style="{StaticResource ScrollBarThumb}" /> | |||||
</Track.Thumb> | |||||
</Track> | |||||
</Grid> | |||||
<ControlTemplate.Triggers> | |||||
<Trigger Property="IsEnabled" Value="false"> | |||||
<Setter TargetName="Bg" Property="Background" Value="{StaticResource ScrollBarDisabledBackground}" /> | |||||
</Trigger> | |||||
</ControlTemplate.Triggers> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</Trigger> | |||||
</Style.Triggers> | |||||
</Style> | |||||
<!--#endregion--> | |||||
</ResourceDictionary> | </ResourceDictionary> |
@@ -15,13 +15,23 @@ | |||||
<vm:MessageLogViewModel /> | <vm:MessageLogViewModel /> | ||||
</UserControl.DataContext> | </UserControl.DataContext> | ||||
<UserControl.Resources> | |||||
<ResourceDictionary> | |||||
<ResourceDictionary.MergedDictionaries> | |||||
<ResourceDictionary Source="../Resources/ResourceDictionarys/BasicStyle.xaml" /> | |||||
</ResourceDictionary.MergedDictionaries> | |||||
</ResourceDictionary> | |||||
</UserControl.Resources> | |||||
<Grid> | <Grid> | ||||
<ScrollViewer | <ScrollViewer | ||||
Template="{StaticResource MyScrollViewer}" | |||||
Grid.Row="1" | Grid.Row="1" | ||||
Margin="5" | Margin="5" | ||||
HorizontalScrollBarVisibility="Hidden" | |||||
VerticalScrollBarVisibility="Hidden"> | |||||
HorizontalScrollBarVisibility="Visible" | |||||
VerticalScrollBarVisibility="Visible"> | |||||
<TextBlock | <TextBlock | ||||
FontSize="14" | FontSize="14" | ||||
Foreground="Aqua" | Foreground="Aqua" | ||||
@@ -39,204 +39,319 @@ | |||||
<Grid> | <Grid> | ||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
<RowDefinition Height="30" /> | |||||
<RowDefinition /> | |||||
<RowDefinition /> | <RowDefinition /> | ||||
</Grid.RowDefinitions> | </Grid.RowDefinitions> | ||||
<!--#region 表格标题栏设置--> | |||||
<Grid Background="#dd2AB2E7"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.5*" /> | |||||
</Grid.ColumnDefinitions> | |||||
<TextBlock | |||||
Grid.Column="0" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="{StaticResource TitleFontColor}" | |||||
Text="取餐号" /> | |||||
<Grid Grid.Column="1"> | |||||
<!--#region 制作中的订单列表--> | |||||
<Grid> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="30" /> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
<!--#region 表格标题栏设置--> | |||||
<Grid Background="#dd2AB2E7"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.5*" /> | |||||
</Grid.ColumnDefinitions> | |||||
<TextBlock | <TextBlock | ||||
Grid.Column="0" | |||||
HorizontalAlignment="Center" | HorizontalAlignment="Center" | ||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
FontSize="16" | FontSize="16" | ||||
Foreground="{StaticResource TitleFontColor}" | Foreground="{StaticResource TitleFontColor}" | ||||
Text="商品名" /> | |||||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" /> | |||||
</Grid> | |||||
Text="取餐号" /> | |||||
<TextBlock | |||||
Grid.Column="2" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="{StaticResource TitleFontColor}" | |||||
Text="开始时间" /> | |||||
<Grid Grid.Column="1"> | |||||
<TextBlock | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="{StaticResource TitleFontColor}" | |||||
Text="商品名" /> | |||||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" /> | |||||
</Grid> | |||||
<Grid Grid.Column="3"> | |||||
<TextBlock | <TextBlock | ||||
Grid.Column="2" | |||||
HorizontalAlignment="Center" | HorizontalAlignment="Center" | ||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
FontSize="16" | FontSize="16" | ||||
Foreground="{StaticResource TitleFontColor}" | Foreground="{StaticResource TitleFontColor}" | ||||
Text="结束时间" /> | |||||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" /> | |||||
</Grid> | |||||
Text="开始时间" /> | |||||
<Grid Grid.Column="3"> | |||||
<TextBlock | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="{StaticResource TitleFontColor}" | |||||
Text="结束时间" /> | |||||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" /> | |||||
</Grid> | |||||
<Grid Grid.Column="5"> | |||||
<TextBlock | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="{StaticResource TitleFontColor}" | |||||
Text="制作状态" /> | |||||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="0,0,1,0" /> | |||||
</Grid> | |||||
<Grid Grid.Column="5"> | |||||
<TextBlock | <TextBlock | ||||
Grid.Column="6" | |||||
HorizontalAlignment="Center" | HorizontalAlignment="Center" | ||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
FontSize="16" | FontSize="16" | ||||
Foreground="{StaticResource TitleFontColor}" | Foreground="{StaticResource TitleFontColor}" | ||||
Text="制作状态" /> | |||||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="0,0,1,0" /> | |||||
</Grid> | |||||
Text="完成时间" /> | |||||
<TextBlock | |||||
Grid.Column="6" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="{StaticResource TitleFontColor}" | |||||
Text="完成时间" /> | |||||
</Grid> | |||||
<!--#endregion--> | |||||
</Grid> | |||||
<!--#endregion--> | |||||
<!--#region 表格数据显示--> | |||||
<ScrollViewer | |||||
Grid.Row="1" | |||||
HorizontalScrollBarVisibility="Hidden" | |||||
VerticalScrollBarVisibility="Hidden"> | |||||
<ItemsControl ItemsSource="{Binding orderStatusLists}"> | |||||
<ItemsControl.ItemTemplate> | |||||
<DataTemplate> | |||||
<Grid Height="30"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.5*" /> | |||||
</Grid.ColumnDefinitions> | |||||
<!--#region 表格数据显示--> | |||||
<ScrollViewer | |||||
Grid.Row="1" | |||||
HorizontalScrollBarVisibility="Hidden" | |||||
VerticalScrollBarVisibility="Hidden"> | |||||
<ItemsControl ItemsSource="{Binding orderStatusLists}"> | |||||
<ItemsControl.ItemTemplate> | |||||
<DataTemplate> | |||||
<Grid Height="30"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.5*" /> | |||||
</Grid.ColumnDefinitions> | |||||
<TextBlock | |||||
Grid.Column="0" | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | |||||
Style="{StaticResource TextBlockStyle}" | |||||
Text="{Binding SortNo}" /> | |||||
<Grid Grid.Column="1"> | |||||
<TextBlock | <TextBlock | ||||
Grid.Column="0" | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | ||||
Style="{StaticResource TextBlockStyle}" | Style="{StaticResource TextBlockStyle}" | ||||
Text="{Binding GoodName}" /> | |||||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||||
</Grid> | |||||
Text="{Binding SortNo}" /> | |||||
<Grid Grid.Column="1"> | |||||
<TextBlock | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | |||||
Style="{StaticResource TextBlockStyle}" | |||||
Text="{Binding GoodName}" /> | |||||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||||
</Grid> | |||||
<TextBlock | |||||
Grid.Column="2" | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | |||||
Style="{StaticResource TextBlockStyle}" | |||||
Text="开始时间" /> | |||||
<Grid Grid.Column="3"> | |||||
<TextBlock | <TextBlock | ||||
Grid.Column="2" | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | ||||
Style="{StaticResource TextBlockStyle}" | Style="{StaticResource TextBlockStyle}" | ||||
Text="结束时间" /> | |||||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||||
Text="开始时间" /> | |||||
<Grid Grid.Column="3"> | |||||
<TextBlock | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | |||||
Style="{StaticResource TextBlockStyle}" | |||||
Text="结束时间" /> | |||||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||||
</Grid> | |||||
<Grid Grid.Column="5"> | |||||
<TextBlock | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | |||||
Style="{StaticResource TextBlockStyle}" | |||||
Text="{Binding OrderStatus, Converter={StaticResource TextConverter}}" /> | |||||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="0,0,1,0" /> | |||||
</Grid> | |||||
<Grid Grid.Column="6"> | |||||
<TextBlock | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | |||||
Style="{StaticResource TextBlockStyle}" | |||||
Text="{Binding CookDateTime}" /> | |||||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="0,0,1,0" /> | |||||
</Grid> | |||||
<Border | |||||
Grid.ColumnSpan="8" | |||||
BorderBrush="{StaticResource BorderSolid}" | |||||
BorderThickness="1,0,1,1" /> | |||||
</Grid> | </Grid> | ||||
</DataTemplate> | |||||
</ItemsControl.ItemTemplate> | |||||
</ItemsControl> | |||||
</ScrollViewer> | |||||
<!--#endregion--> | |||||
</Grid> | |||||
<!--#endregion--> | |||||
<!--#region 等待取餐的订单列表--> | |||||
<Grid Grid.Row="1"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="30" /> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
<!--#region 表格标题栏设置--> | |||||
<Grid Background="#dd2AB2E7"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.5*" /> | |||||
</Grid.ColumnDefinitions> | |||||
<TextBlock | |||||
Grid.Column="0" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="{StaticResource TitleFontColor}" | |||||
Text="取餐号" /> | |||||
<Grid Grid.Column="1"> | |||||
<TextBlock | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="{StaticResource TitleFontColor}" | |||||
Text="商品名" /> | |||||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" /> | |||||
</Grid> | |||||
<TextBlock | |||||
Grid.Column="2" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="{StaticResource TitleFontColor}" | |||||
Text="开始时间" /> | |||||
<Grid Grid.Column="3"> | |||||
<TextBlock | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="{StaticResource TitleFontColor}" | |||||
Text="结束时间" /> | |||||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" /> | |||||
</Grid> | |||||
<Grid Grid.Column="5"> | |||||
<TextBlock | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="{StaticResource TitleFontColor}" | |||||
Text="制作状态" /> | |||||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="0,0,1,0" /> | |||||
</Grid> | |||||
<TextBlock | |||||
Grid.Column="6" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="{StaticResource TitleFontColor}" | |||||
Text="完成时间" /> | |||||
</Grid> | |||||
<!--#endregion--> | |||||
<!--#region 表格数据显示--> | |||||
<ScrollViewer | |||||
Grid.Row="1" | |||||
HorizontalScrollBarVisibility="Hidden" | |||||
VerticalScrollBarVisibility="Hidden"> | |||||
<ItemsControl ItemsSource="{Binding WaitTakeMeal}"> | |||||
<ItemsControl.ItemTemplate> | |||||
<DataTemplate> | |||||
<Grid Height="30"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.5*" /> | |||||
</Grid.ColumnDefinitions> | |||||
<Grid Grid.Column="5"> | |||||
<TextBlock | <TextBlock | ||||
Grid.Column="0" | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | ||||
Style="{StaticResource TextBlockStyle}" | Style="{StaticResource TextBlockStyle}" | ||||
Text="{Binding OrderStatus, Converter={StaticResource TextConverter}}" /> | |||||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="0,0,1,0" /> | |||||
</Grid> | |||||
Text="{Binding SortNo}" /> | |||||
<Grid Grid.Column="1"> | |||||
<TextBlock | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | |||||
Style="{StaticResource TextBlockStyle}" | |||||
Text="{Binding GoodName}" /> | |||||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||||
</Grid> | |||||
<Grid Grid.Column="6"> | |||||
<TextBlock | <TextBlock | ||||
Grid.Column="2" | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | ||||
Style="{StaticResource TextBlockStyle}" | Style="{StaticResource TextBlockStyle}" | ||||
Text="{Binding CookDateTime}" /> | |||||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="0,0,1,0" /> | |||||
</Grid> | |||||
Text="开始时间" /> | |||||
<Border | |||||
Grid.ColumnSpan="8" | |||||
BorderBrush="{StaticResource BorderSolid}" | |||||
BorderThickness="1,0,1,1" /> | |||||
<Grid Grid.Column="3"> | |||||
<TextBlock | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | |||||
Style="{StaticResource TextBlockStyle}" | |||||
Text="结束时间" /> | |||||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||||
</Grid> | |||||
</Grid> | |||||
</DataTemplate> | |||||
</ItemsControl.ItemTemplate> | |||||
</ItemsControl> | |||||
</ScrollViewer> | |||||
<!--#endregion--> | |||||
<Grid Grid.Column="5"> | |||||
<TextBlock | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | |||||
Style="{StaticResource TextBlockStyle}" | |||||
Text="{Binding OrderStatus, Converter={StaticResource TextConverter}}" /> | |||||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="0,0,1,0" /> | |||||
</Grid> | |||||
<!--<ScrollViewer | |||||
Grid.Row="1" | |||||
Margin="10,30,10,0" | |||||
HorizontalScrollBarVisibility="Hidden" | |||||
VerticalScrollBarVisibility="Hidden"> | |||||
<ItemsControl ItemsSource="{Binding orderStatusLists}"> | |||||
<ItemsControl.ItemTemplate> | |||||
<DataTemplate> | |||||
<Grid> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition /> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
<TextBlock | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="Center" | |||||
FontSize="26" | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource color}}" | |||||
Text="{Binding GoodName}" /> | |||||
<StackPanel | |||||
Grid.Row="1" | |||||
Margin="0,10,0,20" | |||||
Orientation="Horizontal"> | |||||
<TextBlock | |||||
Margin="0,0,20,0" | |||||
VerticalAlignment="Center" | |||||
FontSize="26" | |||||
Foreground="#ddd" | |||||
Text="{Binding CreateDateTime}" /> | |||||
<TextBlock | |||||
Margin="0,0,20,0" | |||||
VerticalAlignment="Center" | |||||
FontSize="26" | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource color}}" | |||||
Text="{Binding SortNo}" /> | |||||
<TextBlock | |||||
VerticalAlignment="Center" | |||||
FontSize="26" | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource color}}" | |||||
Text="{Binding OrderStatus, Converter={StaticResource text}}" /> | |||||
</StackPanel> | |||||
</Grid> | |||||
</DataTemplate> | |||||
</ItemsControl.ItemTemplate> | |||||
</ItemsControl> | |||||
</ScrollViewer>--> | |||||
<Grid Grid.Column="6"> | |||||
<TextBlock | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | |||||
Style="{StaticResource TextBlockStyle}" | |||||
Text="{Binding CookDateTime}" /> | |||||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="0,0,1,0" /> | |||||
</Grid> | |||||
<Border | |||||
Grid.ColumnSpan="8" | |||||
BorderBrush="{StaticResource BorderSolid}" | |||||
BorderThickness="1,0,1,1" /> | |||||
</Grid> | |||||
</DataTemplate> | |||||
</ItemsControl.ItemTemplate> | |||||
</ItemsControl> | |||||
</ScrollViewer> | |||||
<!--#endregion--> | |||||
</Grid> | |||||
<!--#endregion--> | |||||
</Grid> | </Grid> | ||||
</UserControl> | </UserControl> |
@@ -1,5 +1,4 @@ | |||||
using BPA.Message; | using BPA.Message; | ||||
//using BPA.Message.Kafka; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -14,61 +13,6 @@ namespace HBLConsole.ViewModel | |||||
{ | { | ||||
MqttReceive(); | MqttReceive(); | ||||
WindowName = "订单状态"; | WindowName = "订单状态"; | ||||
//orderStatusLists.Add(new OrderStatusList() | |||||
//{ | |||||
// StartDateTime = DateTime.Now.ToString("HH:mm:ss"), | |||||
// EndDateTime = DateTime.Now.ToString("HH:mm:ss"), | |||||
// GoodName = "细面", | |||||
// OrderStatus = ORDER_STATUS.WAIT, | |||||
// SortNo = "0001", | |||||
// SubOrderId = "0001", | |||||
//}); | |||||
//orderStatusLists.Add(new OrderStatusList() | |||||
//{ | |||||
// StartDateTime = DateTime.Now.ToString("HH:mm:ss"), | |||||
// EndDateTime = DateTime.Now.ToString("HH:mm:ss"), | |||||
// GoodName = "细面", | |||||
// OrderStatus = ORDER_STATUS.COOKING, | |||||
// SortNo = "0002", | |||||
// SubOrderId = "0002", | |||||
//}); | |||||
//orderStatusLists.Add(new OrderStatusList() | |||||
//{ | |||||
// StartDateTime = DateTime.Now.ToString("HH:mm:ss"), | |||||
// EndDateTime = DateTime.Now.ToString("HH:mm:ss"), | |||||
// GoodName = "细面", | |||||
// OrderStatus = ORDER_STATUS.COMPLETED_COOK, | |||||
// SortNo = "0003", | |||||
// SubOrderId = "0003", | |||||
//}); | |||||
//orderStatusLists.Add(new OrderStatusList() | |||||
//{ | |||||
// StartDateTime = DateTime.Now.ToString("HH:mm:ss"), | |||||
// EndDateTime = DateTime.Now.ToString("HH:mm:ss"), | |||||
// GoodName = "细面", | |||||
// OrderStatus = ORDER_STATUS.COMPLETED_TAKE, | |||||
// SortNo = "0004", | |||||
// SubOrderId = "0004", | |||||
//}); | |||||
//orderStatusLists.Add(new OrderStatusList() | |||||
//{ | |||||
// StartDateTime = DateTime.Now.ToString("HH:mm:ss"), | |||||
// EndDateTime = DateTime.Now.ToString("HH:mm:ss"), | |||||
// GoodName = "细面", | |||||
// OrderStatus = ORDER_STATUS.ERR_NOT_REPLY_WHEN_COOKING, | |||||
// SortNo = "0005", | |||||
// SubOrderId = "0005", | |||||
//}); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -11,6 +11,7 @@ using BPA.Message; | |||||
using Microsoft.Toolkit.Mvvm.ComponentModel; | using Microsoft.Toolkit.Mvvm.ComponentModel; | ||||
using HBLConsole.Service; | using HBLConsole.Service; | ||||
using HBLConsole.Model; | using HBLConsole.Model; | ||||
using BPA.Message.Enum; | |||||
namespace HBLConsole.ViewModel | namespace HBLConsole.ViewModel | ||||
{ | { | ||||
@@ -55,6 +56,11 @@ namespace HBLConsole.ViewModel | |||||
/// </summary> | /// </summary> | ||||
public static ObservableCollection<OrderData> orderStatusLists { get; set; } = new ObservableCollection<OrderData>(); | public static ObservableCollection<OrderData> orderStatusLists { get; set; } = new ObservableCollection<OrderData>(); | ||||
/// <summary> | |||||
/// 等待取餐列表 | |||||
/// </summary> | |||||
public static ObservableCollection<OrderData> WaitTakeMeal { get; set; } = new ObservableCollection<OrderData>(); | |||||
/// <summary> | /// <summary> | ||||
/// 显示当前窗体名称 | /// 显示当前窗体名称 | ||||
/// </summary> | /// </summary> | ||||
@@ -75,68 +81,55 @@ namespace HBLConsole.ViewModel | |||||
/// </summary> | /// </summary> | ||||
public void MqttReceive() | public void MqttReceive() | ||||
{ | { | ||||
//ClientStation.GetInstance.MqttReceive = new Action<IMessage>((m) => | |||||
//{ | |||||
// if (m is Kafka_BigScreenTakeInfo message) | |||||
// { | |||||
// App.Current.Dispatcher.Invoke(new Action(() => | |||||
// { | |||||
// foreach (var item in message.SubOrderInfos) | |||||
// { | |||||
// var SubOrderInfo = orderStatusLists.FirstOrDefault(p => p.SubOrderId == item.SubOrderId); | |||||
// if (SubOrderInfo != null)//大屏取餐有该订单编号 | |||||
// { | |||||
// //GVL.MessageLogOut.GetInstance.Show($"更改的 订单的ID是= 【{item.SubOrderId}】 状态是:={item.SubOrderStatus}"); | |||||
// int index = Array.FindIndex(orderStatusLists.ToArray(), p => p.SubOrderId == item.SubOrderId); | |||||
// orderStatusLists.ElementAt(index).OrderStatus = item.SubOrderStatus; | |||||
// if (item.SubOrderStatus == ORDER_STATUS.COMPLETED_TAKE) | |||||
// { | |||||
// orderStatusLists.RemoveAt(index); | |||||
// } | |||||
// if (item.SubOrderStatus == ORDER_STATUS.COMPLETED_COOK) | |||||
// { | |||||
// string SortNo = orderStatusLists.FirstOrDefault(p => p.SubOrderId == item.SubOrderId).SortNo; | |||||
// if (SortNo != null) | |||||
// { | |||||
// if (SortNo.Length > 0) | |||||
// { | |||||
// //GVL_VAR.GetInstance.speacks.Enqueue(SortNo); | |||||
// //GVL.MessageLogOut.GetInstance.Show($"语音提示"); | |||||
// } | |||||
// } | |||||
// orderStatusLists.ElementAt(index).EndDateTime = DateTime.Now.ToString("HH:mm:ss"); | |||||
// orderStatusLists[index].CompleteDateTime = DateTime.Now.Subtract(Convert.ToDateTime(orderStatusLists.ElementAt(index).StartDateTime)).TotalSeconds.ToString(); | |||||
// } | |||||
// if (item.SubOrderStatus == ORDER_STATUS.ERR_NOT_REPLY_WHEN_COOKING) orderStatusLists.ElementAt(index).OrderStatus = ORDER_STATUS.ERR_NOT_REPLY_WHEN_COOKING; | |||||
// } | |||||
// else//大屏取餐界面没有该订单编号 | |||||
// { | |||||
// if (item.SubOrderStatus == ORDER_STATUS.WAIT) | |||||
// { | |||||
// MessageLogOut.GetInstance.Show($"添加的 订单编号= 【{item.SortNo}】 的ID是= 【{item.SubOrderId}】"); | |||||
// if (item.SortNo != null) | |||||
// { | |||||
// if (item.SortNo.Length > 0) | |||||
// { | |||||
// orderStatusLists.Add(new OrderStatusList() | |||||
// { | |||||
// SortNo = item.SortNo.Substring(0, 4), | |||||
// GoodName = item.GoodName, | |||||
// OrderStatus = item.SubOrderStatus, | |||||
// SubOrderId = item.SubOrderId, | |||||
// StartDateTime = DateTime.Now.ToString("HH:mm:ss"), | |||||
// }); | |||||
// } | |||||
// } | |||||
// } | |||||
// } | |||||
// } | |||||
// })); | |||||
// } | |||||
//}); | |||||
ActionManagerment.GetInstance.Register(new Action<object>((o) => | |||||
{ | |||||
if (o is MorkOrderPush morkOrderpush) | |||||
{ | |||||
var result = orderStatusLists.FirstOrDefault(p => p.OrderPush.SuborderId == morkOrderpush.SuborderId); | |||||
if (result == null) | |||||
{ | |||||
orderStatusLists.Add(new OrderData() | |||||
{ | |||||
OrderPush = morkOrderpush, | |||||
OrderStatus = ORDER_STATUS.WAIT, | |||||
StartDate = DateTime.Now.ToString("HH:mm:ss") | |||||
}); | |||||
} | |||||
} | |||||
}), "AddOrder"); | |||||
ActionManagerment.GetInstance.Register(new Action<object>((o) => | |||||
{ | |||||
if (o is OrderStatusChange orderStatusChange) | |||||
{ | |||||
int index = Array.FindIndex(orderStatusLists.ToArray(), p => p.OrderPush.SuborderId == orderStatusChange.SuborderId); | |||||
if (index >= 0) orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.CookingStatus; | |||||
switch (orderStatusChange.CookingStatus) | |||||
{ | |||||
case ORDER_STATUS.COOKING: | |||||
break; | |||||
case ORDER_STATUS.COMPLETED_COOK: | |||||
if (index >= 0) | |||||
{ | |||||
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(); | |||||
WaitTakeMeal.Insert(0, orderStatusLists.ElementAt(index)); | |||||
orderStatusLists.RemoveAt(index); | |||||
} | |||||
break; | |||||
case ORDER_STATUS.COMPLETED_TAKE: | |||||
var re = WaitTakeMeal.FirstOrDefault(p => p.OrderPush.SuborderId == orderStatusChange.SuborderId); | |||||
if (re != null) WaitTakeMeal.Remove(re); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
} | |||||
}), "OrderStatusChange"); | |||||
} | } | ||||
#endregion | #endregion | ||||
} | } | ||||