NXX 2 years ago
parent
commit
22678db99e
15 changed files with 260 additions and 33 deletions
  1. +1
    -1
      BPASmartClient.Business/BPASmartClient.Business.csproj
  2. +5
    -4
      BPASmartClient.Business/Plugin/OrderProxy.cs
  3. +12
    -1
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  4. +35
    -0
      BPASmartClient.CustomResource/Properties/App.xaml
  5. +132
    -0
      BPASmartClient.CustomResource/Properties/App.xaml.cs
  6. +32
    -0
      BPASmartClient.CustomResource/RecDictionarys/RecButtonStyle.xaml
  7. +1
    -1
      BPASmartClient.Device/BPASmartClient.Device.csproj
  8. +0
    -10
      BPASmartClient.Device/BaseDevice.cs
  9. +1
    -1
      BPASmartClient.Model/BPASmartClient.Model.csproj
  10. +5
    -0
      BPASmartClient.Model/订单/OrderStatusChangedEvent.cs
  11. +2
    -2
      BPASmartClient.MorkS/Alarm.cs
  12. +19
    -2
      BPASmartClient.MorkS/Control_Morks.cs
  13. +11
    -5
      BPASmartClient.MorkS/View/Debug.xaml
  14. +3
    -4
      BPASmartClient/App.config
  15. +1
    -2
      BPASmartClient/App.xaml

+ 1
- 1
BPASmartClient.Business/BPASmartClient.Business.csproj View File

@@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="BPA.ApolloClient" Version="1.0.12" />
<PackageReference Include="BPA.Message" Version="1.0.26" />
<PackageReference Include="BPA.Message" Version="1.0.37" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />


+ 5
- 4
BPASmartClient.Business/Plugin/OrderProxy.cs View File

@@ -45,11 +45,11 @@ namespace BPASmartClient.Business
if (morkOrderPushes.TryDequeue(out MorkOrderPush mork))
{
Thread.Sleep(3000);
new OrderStatusChangedEvent() { Status = ORDER_STATUS.COOKING, SubOrderId = mork.SuborderId, GoodName = mork.GoodsName }.Publish();
new OrderStatusChangedEvent() { SortNum = mork.SortNum.ToString(), Status = ORDER_STATUS.COOKING, SubOrderId = mork.SuborderId, GoodName = mork.GoodsName }.Publish();
Thread.Sleep(5000);
new OrderStatusChangedEvent() { Status = ORDER_STATUS.COMPLETED_COOK, SubOrderId = mork.SuborderId, GoodName = mork.GoodsName }.Publish();
new OrderStatusChangedEvent() { SortNum = mork.SortNum.ToString(), Status = ORDER_STATUS.COMPLETED_COOK, SubOrderId = mork.SuborderId, GoodName = mork.GoodsName }.Publish();
Thread.Sleep(5000);
new OrderStatusChangedEvent() { Status = ORDER_STATUS.COMPLETED_TAKE, SubOrderId = mork.SuborderId, GoodName = mork.GoodsName }.Publish();
new OrderStatusChangedEvent() { SortNum = mork.SortNum.ToString(), Status = ORDER_STATUS.COMPLETED_TAKE, SubOrderId = mork.SuborderId, GoodName = mork.GoodsName }.Publish();
Thread.Sleep(2000);
}
}
@@ -140,7 +140,8 @@ namespace BPASmartClient.Business
{
CookingStatus = orderStatusChangedEvent.Status,
SuborderId = orderStatusChangedEvent.SubOrderId,
GoodName = orderStatusChangedEvent.GoodName
GoodName = orderStatusChangedEvent.GoodName,
SortNum = orderStatusChangedEvent.SortNum
};

#region API 订单状态修改


+ 12
- 1
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj View File

@@ -167,6 +167,17 @@
<None Remove="Image\黑菠萝科技.png" />
</ItemGroup>

<ItemGroup>
<Page Remove="Properties\App.xaml" />
</ItemGroup>

<ItemGroup>
<ApplicationDefinition Include="Properties\App.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
</ItemGroup>

<ItemGroup>
<Resource Include="Image\btn_close.png" />
<Resource Include="Image\ComboBoxPopSelect.png" />
@@ -204,7 +215,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.26" />
<PackageReference Include="BPA.Message" Version="1.0.37" />
</ItemGroup>

<ItemGroup>


+ 35
- 0
BPASmartClient.CustomResource/Properties/App.xaml View File

@@ -0,0 +1,35 @@
<Application
x:Class="BPASmartClient.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource"
xmlns:local="clr-namespace:BPASmartClient">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>

<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecCheckBox.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecTitleBarButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/GlobalStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecComboBox.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecIcoButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecToggleButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/BeveledRadioButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/DatePickeerDictionary.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecButtonStyle.xaml" />

<ResourceDictionary>
<con:ColorConverter x:Key="ColorConverter" />
<con:TextConverter x:Key="TextConverter" />
<con:VisibleTypeConverter x:Key="VisibleTypeConverter" />
</ResourceDictionary>

<ResourceDictionary>
<ImageBrush x:Key="hbl" ImageSource="/BPASmartClient.CustomResource;component/Image/HBL.png" />
<ImageBrush x:Key="dbxt" ImageSource="/BPASmartClient.CustomResource;component/Image/顶部线条.png" />
</ResourceDictionary>

</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

+ 132
- 0
BPASmartClient.CustomResource/Properties/App.xaml.cs View File

@@ -0,0 +1,132 @@
using BPA.Message;
using BPA.Message.Enum;
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;

namespace BPASmartClient
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : System.Windows.Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
SystemHelper.GetInstance.CreateDesktopShortcut();
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
DataRead();
MainWindow mainView = new MainWindow();
mainView.Show();
SplitScreenDisplay();
NoCompleteOrderInit();
}

/// <summary>
/// 分屏显示
/// </summary>
private void SplitScreenDisplay()
{
if (Screen.AllScreens.Length == 3)
{
//left = new MORKD_Window_Left();
//right = new MORKD_Window_Right();

//Screen[] screen = Screen.AllScreens;
//Rectangle[] rectangle = new Rectangle[screen.Length];
//Window[] windows = new Window[screen.Length];
//windows[0] = mainView;
//windows[1] = left;
//windows[2] = right;
//for (int i = 0; i < screen.Length; i++)
//{
// rectangle[i] = screen[i].WorkingArea;
// windows[i].Height = rectangle[i].Height;
// windows[i].Width = rectangle[i].Width;
// windows[i].Top = rectangle[i].Top;
// windows[i].Left = rectangle[i].Left;
//}

//left.Show();
//right.Show();
//windows[1].Owner = windows[0];
//windows[2].Owner = windows[0];
}
}

/// <summary>
/// 未完成订单初始化
/// </summary>
private void NoCompleteOrderInit()
{
if (Json<KeepDataBase>.Data.orderLists.Count > 0)
{
OrderListDialogView listDialogView = new OrderListDialogView();
listDialogView.ShowDialog();
}
}

private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var ErroLog = e.ExceptionObject.ToString();
MessageLog.GetInstance.Show(ErroLog);
TextHelper.GetInstance.WriteTextInfo(ErroLog, "ErroLog");
DataSave();
//SqlHelper.GetInstance.Save();
//MainConsole.Main.GetInstance.DataSave();
//IotReport.GetInstance.HttpAddLog(new BPA.Message.API请求.LogTable
//{
// ClientId = InternetInfo.ClientId.ToString(),
// LogTime = DateTime.Now,
// LogType = "1",
// LogMessage = ErroLog,
// LogVla = "异常",
//});
// Process.Start($"{AppDomain.CurrentDomain.BaseDirectory}{AppDomain.CurrentDomain.FriendlyName}.exe");
}

protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
DataSave();
//IotReport.Close();
//SqlHelper.GetInstance.Save();
//MainConsole.Main.GetInstance.DataSave();
ThreadManage.GetInstance().Dispose();
System.Environment.Exit(0);

}

/// <summary>
/// 输入保存
/// </summary>
private void DataSave()
{
Json<KeepDataBase>.Save();
//Sqlite<Alarm>.GetInstance.Save();
}

/// <summary>
/// 输入读取
/// </summary>
private void DataRead()
{
Json<KeepDataBase>.Read();
Task.Run(new Action(() => { Sqlite<Alarm>.GetInstance.GetData(); }));
}



}
}

+ 32
- 0
BPASmartClient.CustomResource/RecDictionarys/RecButtonStyle.xaml View File

@@ -0,0 +1,32 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!--#region 按钮样式-->
<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="Foreground" Value="#00c2f4" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Margin" Value="10,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Name="TitleBarBr"
Background="Transparent"
BorderBrush="#00c2f4"
BorderThickness="2"
CornerRadius="10">
<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Background" Value="#3300c2f4" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

</ResourceDictionary>

+ 1
- 1
BPASmartClient.Device/BPASmartClient.Device.csproj View File

@@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.26" />
<PackageReference Include="BPA.Message" Version="1.0.37" />
</ItemGroup>

<ItemGroup>


+ 0
- 10
BPASmartClient.Device/BaseDevice.cs View File

@@ -209,20 +209,10 @@ namespace BPASmartClient.Device
{
InterfaceStatus = item.GetValue(this) as IStatus;
GetMonitorData(InterfaceStatus);
//ThreadManage.GetInstance().StopTask($"{item.Name}:{DeviceId}", new Action(() =>
// {
//ThreadManage.GetInstance().StartLong(new Action(() =>
//{
// UpdateValue(InterfaceStatus);
// Thread.Sleep(1000);
//}), $"GvlStatusMonitor:{DeviceId}");
//}));
}
else if (faces.Name == "IAlarm")
{
InterfaceAlarm = item.GetValue(this) as IAlarm;
//IAlarm alarm = item.GetValue(this) as IAlarm;
//AlarmHelper alarmHelper = new AlarmHelper();
alarmHelper.AddAction += new Action<string>((s) =>
{
var res = alarmHelper.Alarms.FirstOrDefault(p => p.Info == s);


+ 1
- 1
BPASmartClient.Model/BPASmartClient.Model.csproj View File

@@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.26" />
<PackageReference Include="BPA.Message" Version="1.0.37" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>



+ 5
- 0
BPASmartClient.Model/订单/OrderStatusChangedEvent.cs View File

@@ -25,5 +25,10 @@ namespace BPASmartClient.Model
/// 商品名称
/// </summary>
public string GoodName { get; set; }

/// <summary>
/// 订单排序号
/// </summary>
public string SortNum { get; set; }
}
}

+ 2
- 2
BPASmartClient.MorkS/Alarm.cs View File

@@ -98,11 +98,11 @@ namespace BPASmartClient.MorkS
public bool DeviceEstop { get; set; }

/// <summary>
/// 机器人初始化失败
/// PLC电池电压低
/// PLC ---> M231.3
/// ModbusTcp --> 1583
/// </summary>
[Alarm("机器人初始化失败")]
[Alarm("PLC电池电压低")]
public bool RobotInitError { get; set; }

/// <summary>


+ 19
- 2
BPASmartClient.MorkS/Control_Morks.cs View File

@@ -100,8 +100,13 @@ namespace BPASmartClient.MorkS
{
var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid);
string goodName = string.Empty;
if (res != null) goodName = res.MorkOrder.GoodsName;
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
string SortNum = string.Empty;
if (res != null)
{
goodName = res.MorkOrder.GoodsName;
SortNum = res.MorkOrder.SortNum.ToString();
}
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
}

private void GetStatus(string key, Action<object> action)
@@ -235,6 +240,18 @@ namespace BPASmartClient.MorkS
mORKS.doOrderEvents.Add(order);
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;

new OrderStatusChangedEvent()
{
DeviceId = DeviceId,
SubOrderId = order.MorkOrder.SuborderId,
Status = ORDER_STATUS.WAIT,
GoodName = order.MorkOrder.GoodsName,
SortNum = order.MorkOrder.SortNum.ToString(),
deviceClientType = DeviceType
}.Publish();


DeviceProcessLogShow($"接收到{OrderCount}次订单");
foreach (var item in order.MorkOrder.GoodBatchings)
{


+ 11
- 5
BPASmartClient.MorkS/View/Debug.xaml View File

@@ -16,10 +16,16 @@
</UserControl.DataContext>

<Grid>
<Label
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="调试界面"
FontSize="40" />
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition />
</Grid.RowDefinitions>
<Button
Grid.Row="0"
Width="150"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Content="初始化设备"
Style="{StaticResource ButtonStyle}" />
</Grid>
</UserControl>

+ 3
- 4
BPASmartClient/App.config View File

@@ -3,19 +3,18 @@
<appSettings>

<!--通用配置-->
<add key="ClientId" value="51"/>
<add key="ClientId" value="43"/>
<add key="IsEnableTest" value="true"/>

<!--开发环境-->
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/>
<add key="AppId" value="dev1_common"/>
<add key ="Namespaces" value="DEV.Config"/>
<add key="IsEnableTest" value="False"/>-->
<add key ="Namespaces" value="DEV.Config"/>-->

<!--正式环境-->
<add key="apollouri" value="http://47.108.65.220:28080/"/>
<add key="AppId" value="order"/>
<add key ="Namespaces" value="TEST1.Config"/>
<add key="IsEnableTest" value="False"/>

<!--阿里云上报启动方式:API 或者 LOCAL-->
<!--API :通过客户端ID,调用接口查询“设备连接信息”-->


+ 1
- 2
BPASmartClient/App.xaml View File

@@ -16,8 +16,7 @@
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecToggleButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/BeveledRadioButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/DatePickeerDictionary.xaml" />
<!--<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml"/>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml"/>-->
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecButtonStyle.xaml" />

<ResourceDictionary>
<con:ColorConverter x:Key="ColorConverter" />


Loading…
Cancel
Save