Browse Source

解决冲突

master
pengliangyang 1 year ago
parent
commit
80a5419cc5
62 changed files with 1585 additions and 439 deletions
  1. +1
    -1
      BPASmart.ConfigurationSoftware/BPASmart.ConfigurationSoftware.csproj
  2. +1
    -1
      BPASmart.PageLoad/BPASmart.PageLoad.csproj
  3. +1
    -1
      BPASmart.Server/BPASmart.Server.csproj
  4. +1
    -1
      BPASmart.VariableManager/BPASmart.VariableManager.csproj
  5. +1
    -1
      BPASmartClient.Business/BPASmartClient.Business.csproj
  6. +1
    -1
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  7. +34
    -28
      BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs
  8. +2
    -1
      BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml
  9. +39
    -10
      BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml.cs
  10. +2
    -1
      BPASmartClient.DosingSystemSingle/App.xaml
  11. +1
    -1
      BPASmartClient.DosingSystemSingle/BPASmartClient.DosingSystemSingle.csproj
  12. +2
    -1
      BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs
  13. +38
    -1
      BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs
  14. +3
    -0
      BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
  15. +115
    -38
      BPASmartClient.JakaRobot/JaKaHelper.cs
  16. +0
    -14
      BPASmartClient.Model/GlobalFoodMenu.cs
  17. +15
    -0
      BPASmartClient.Model/小炒机/MaterialAndFryingTime.cs
  18. +1
    -0
      BPASmartClient.MorkBF/BPASmartClient.MorkBF.csproj
  19. +10
    -9
      BPASmartClient.MorkBF/Control_MorkBF.cs
  20. +1
    -0
      BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
  21. +179
    -95
      BPASmartClient.MorkF/Control_MorkF.cs
  22. +35
    -0
      BPASmartClient.MorkF/Convert/PotActionToVisibilityConvert.cs
  23. +9
    -0
      BPASmartClient.MorkF/ML_MorkF.cs
  24. +21
    -0
      BPASmartClient.MorkF/Model/FoodMenuModel.cs
  25. +1
    -1
      BPASmartClient.MorkF/Model/MaterialSurplus.cs
  26. +6
    -6
      BPASmartClient.MorkF/View/DebugView.xaml
  27. +79
    -38
      BPASmartClient.MorkF/View/LocalMenu.xaml
  28. +1
    -1
      BPASmartClient.MorkF/View/LocalMenu.xaml.cs
  29. +73
    -30
      BPASmartClient.MorkF/View/MaterialCalibration.xaml
  30. +1
    -2
      BPASmartClient.MorkF/ViewModel/DebugViewModel.cs
  31. +45
    -32
      BPASmartClient.MorkF/ViewModel/LocalMenuViewModel.cs
  32. +62
    -29
      BPASmartClient.MorkF/ViewModel/MaterialCalibrationViewModel.cs
  33. +1
    -1
      BPASmartClient.S7Net/SiemensHelper.cs
  34. +1
    -1
      BPASmartClient.SmallBatchingSystem/BPASmartClient.SmallBatchingSystem.csproj
  35. +8
    -0
      BPASmartClient.Update/App.xaml
  36. +17
    -0
      BPASmartClient.Update/App.xaml.cs
  37. +10
    -0
      BPASmartClient.Update/AssemblyInfo.cs
  38. +14
    -0
      BPASmartClient.Update/BPASmartClient.Update.csproj
  39. +21
    -0
      BPASmartClient.Update/MainViewsModel.cs
  40. +68
    -0
      BPASmartClient.Update/MainWindow.xaml
  41. +85
    -0
      BPASmartClient.Update/MainWindow.xaml.cs
  42. +41
    -0
      BPASmartClient.Update/Models/UpdateModel.cs
  43. +9
    -2
      BPASmartClient.ViewModel/FoodMenuViewModel.cs
  44. +45
    -0
      BPASmartClient/Control/FoodMenu.xaml
  45. +26
    -0
      BPASmartClient/Control/FoodMenu.xaml.cs
  46. +5
    -5
      BPASmartClient/Control/FoodMenuView.xaml
  47. +3
    -1
      BPASmartClient/Control/FoodMenuView.xaml.cs
  48. +8
    -0
      BPASmartClient/MainWindow.xaml
  49. +1
    -0
      BPASmartClient/MainWindow.xaml.cs
  50. +1
    -1
      ComputerTestDemo/ComputerTestDemo.csproj
  51. +55
    -1
      DosingSystem/App.xaml.cs
  52. +2
    -1
      DosingSystem/BPASmartClient.DosingSystem.csproj
  53. +8
    -9
      DosingSystem/Model/DeviceInquire.cs
  54. +1
    -2
      DosingSystem/View/DeviceMaterialParView.xaml
  55. +99
    -0
      DosingSystem/View/TempManageControlView.xaml
  56. +28
    -0
      DosingSystem/View/TempManageControlView.xaml.cs
  57. +115
    -0
      DosingSystem/ViewModel/TempManageControlViewModel.cs
  58. +23
    -0
      SmartClient.sln
  59. +7
    -8
      WpfApp1/App.xaml
  60. +26
    -9
      WpfApp1/MainWindow.xaml
  61. +75
    -54
      WpfApp1/MainWindow.xaml.cs
  62. +1
    -0
      WpfApp1/WpfApp1.csproj

+ 1
- 1
BPASmart.ConfigurationSoftware/BPASmart.ConfigurationSoftware.csproj View File

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

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Helper" Version="1.0.54" />
</ItemGroup>

<ItemGroup>


+ 1
- 1
BPASmart.PageLoad/BPASmart.PageLoad.csproj View File

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

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Helper" Version="1.0.54" />
</ItemGroup>

<ItemGroup>


+ 1
- 1
BPASmart.Server/BPASmart.Server.csproj View File

@@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="BPA.Communication" Version="1.0.36" />
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Helper" Version="1.0.54" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.9" />
</ItemGroup>



+ 1
- 1
BPASmart.VariableManager/BPASmart.VariableManager.csproj View File

@@ -30,7 +30,7 @@

<ItemGroup>
<PackageReference Include="BPA.Communication" Version="1.0.36" />
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Helper" Version="1.0.54" />
</ItemGroup>

<ItemGroup>


+ 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.Helper" Version="1.0.33" />
<PackageReference Include="BPA.Helper" Version="1.0.54" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />


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

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

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Helper" Version="1.0.54" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.11.0" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />


+ 34
- 28
BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs View File

@@ -81,7 +81,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
catch (Exception)
{

// throw;
// throw;
}
}
}
@@ -109,34 +109,40 @@ namespace BPASmartClient.CustomResource.Pages.Model

public bool ShowDialog(string info, DialogType dialogType = DialogType.Information)
{
PromptView PV = new PromptView();
PV.TextBlockInfo = info;
switch (dialogType)
bool result = false;
Application.Current.Dispatcher.Invoke(() =>
{
case DialogType.Warning:
PV.TextBlockIcon = "&#xe61f;";
PV.TextBlockForeground = Brushes.Yellow;
PV.infoType.Text = "警告:";
//PV.Cancel.Visibility = Visibility.Collapsed;
break;
case DialogType.Error:
PV.TextBlockIcon = "&#xed1a;";
PV.TextBlockForeground = Brushes.Red;
PV.infoType.Text = "错误:";
//PV.Cancel.Visibility = Visibility.Collapsed;
break;
case DialogType.Information:
PV.TextBlockIcon = "&#xe657;";
PV.TextBlockForeground = Brushes.DeepSkyBlue;
PV.infoType.Text = "提示:";
//PV.Cancel.Visibility = Visibility.Visible;
break;
default:
break;
}
PV.infoType.Foreground = PV.TextBlockForeground;
var res = PV.ShowDialog();
return res == null ? false : (bool)res;
PromptView PV = new PromptView();
PV.TextBlockInfo = info;
switch (dialogType)
{
case DialogType.Warning:
PV.TextBlockIcon = "&#xe61f;";
PV.TextBlockForeground = Brushes.Yellow;
PV.infoType.Text = "警告:";
//PV.Cancel.Visibility = Visibility.Collapsed;
break;
case DialogType.Error:
PV.TextBlockIcon = "&#xed1a;";
PV.TextBlockForeground = Brushes.Red;
PV.infoType.Text = "错误:";
//PV.Cancel.Visibility = Visibility.Collapsed;
break;
case DialogType.Information:
PV.TextBlockIcon = "&#xe657;";
PV.TextBlockForeground = Brushes.DeepSkyBlue;
PV.infoType.Text = "提示:";
//PV.Cancel.Visibility = Visibility.Visible;
break;
default:
break;
}
PV.infoType.Foreground = PV.TextBlockForeground;

var res = PV.ShowDialog();
result = res == null ? false : (bool)res;
});
return result;
}
}



+ 2
- 1
BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml View File

@@ -83,7 +83,7 @@
Duration="0:0:20" />
</Storyboard>
</VisualState>
<VisualState Name="Stop" />
<!--<VisualState Name="Stop" />-->
</VisualStateGroup>
<VisualStateGroup Name="DirectionGroup">
<VisualState Name="LeftState">
@@ -96,6 +96,7 @@
Duration="0:0:20" />
</Storyboard>
</VisualState>
<VisualState Name="Stop" />
<VisualState Name="RightState">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation


+ 39
- 10
BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml.cs View File

@@ -37,7 +37,22 @@ namespace BPASmartClient.CustomResource.UserControls

private static void OnRunningChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
VisualStateManager.GoToState(d as ConveyBelt2, (bool)e.NewValue ? "RunState" : "Stop", false);
string status = "Stop";
if ((bool)e.NewValue)
{
if ((d as ConveyBelt2)?.BeltDirection == 0)
{
VisualStateManager.GoToState(d as ConveyBelt2, "RightState", false);
return;
}
else
{
VisualStateManager.GoToState(d as ConveyBelt2, "LeftState", false);
return;
}
}
VisualStateManager.GoToState(d as ConveyBelt2, status, false);
//VisualStateManager.GoToState(d as ConveyBelt2, (bool)e.NewValue ? "RunState" : "Stop", false);
}

public double BeltWidth
@@ -59,7 +74,7 @@ namespace BPASmartClient.CustomResource.UserControls
if (BeltHeight > 100)
{
pathFigure.StartPoint = new Point(0, 35 + (BeltHeight - 100) / 2);
pathFigure.Segments.Add(new LineSegment(new Point(BeltWidth - 10, 35 + (BeltHeight - 100)/2), true));
pathFigure.Segments.Add(new LineSegment(new Point(BeltWidth - 10, 35 + (BeltHeight - 100) / 2), true));
}
else
{
@@ -74,7 +89,7 @@ namespace BPASmartClient.CustomResource.UserControls
{
this.recDown.Margin = new Thickness(0, BeltHeight - 20, 0, 0);
}
else
else
{
this.recDown.Margin = new Thickness(0, 80, 0, 0);
}
@@ -115,15 +130,29 @@ namespace BPASmartClient.CustomResource.UserControls

private static void OnDirectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{

if ((d as ConveyBelt2)?.BeltDirection == 0)
{
VisualStateManager.GoToState(d as ConveyBelt2, "RightState", false);
}
else
string status = "Stop";
if ((d as ConveyBelt2).IsRun)
{
VisualStateManager.GoToState(d as ConveyBelt2, "LeftState", false);
if ((d as ConveyBelt2)?.BeltDirection == 0)
{
VisualStateManager.GoToState(d as ConveyBelt2, "RightState", false);
return;
}
else
{
VisualStateManager.GoToState(d as ConveyBelt2, "LeftState", false);
return;
}
}
VisualStateManager.GoToState(d as ConveyBelt2, status, false);
//if ((d as ConveyBelt2)?.BeltDirection == 0)
//{
// VisualStateManager.GoToState(d as ConveyBelt2, "RightState", false);
//}
//else
//{
// VisualStateManager.GoToState(d as ConveyBelt2, "LeftState", false);
//}

}
}


+ 2
- 1
BPASmartClient.DosingSystemSingle/App.xaml View File

@@ -1,4 +1,5 @@
<Application x:Class="BPASmartClient.DosingSystemSingle.App"
<Application
x:Class="BPASmartClient.DosingSystemSingle.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"


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

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

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.33" />
<PackageReference Include="BPA.Helper" Version="1.0.54" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>


+ 2
- 1
BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs View File

@@ -170,7 +170,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// <summary>
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
/// </summary>
public int RecipeStatusIDTray2 { get; set; } = 0;
public int[] RecipeProcessStatus { get; set; } = new int[5] { 0, 0, 0, 0, 0 };


[VarComm("Global", "当前配方正在配料位置")]
/// <summary>


+ 38
- 1
BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs View File

@@ -8,6 +8,7 @@ using System.Threading.Tasks;
using BPASmartClient.S7Net;
using BPASmartClient.CustomResource.Pages.Model;
using System.Threading;
using System.Collections.ObjectModel;

namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
@@ -188,5 +189,41 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
}
}
}

public void IssueRecipeToPlc(ObservableCollection<RemoteRecipeRawMaterial> rawMaterials,int recipeLoction)
{
if (IsConnected)
{
ushort barrel1 = 0;
ushort barrel2 = 0;
ushort barrel3 = 0;
foreach (var item in rawMaterials)
{
switch (item.RawMaterialBarrelNum)
{
case 1:
barrel1 = barrel1.SetBitValue((byte)item.RawMaterialLocation, true);
break;
case 2:
barrel2 = barrel2.SetBitValue((byte)item.RawMaterialLocation, true);
break;
case 3:
barrel3 = barrel3.SetBitValue((byte)item.RawMaterialLocation, true);
break;
default:
break;
}
}
string AddresBarrel1 = "DB4.DBW" + (12 + (recipeLoction - 1) * 6);
string AddresBarrel2 = "DB4.DBW" + (14 + (recipeLoction - 1) * 6);
string AddresBarrel3 = "DB4.DBW" + (16 + (recipeLoction - 1) * 6);
HK_PLC_S7.Write<ushort>(AddresBarrel1, barrel1);
HK_PLC_S7.Write<ushort>(AddresBarrel2, barrel2);
HK_PLC_S7.Write<ushort>(AddresBarrel3, barrel3);
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶1料仓配料{barrel1.ToBinString}");
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶2料仓配料{barrel1.ToBinString}");
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶3料仓配料{barrel1.ToBinString}");
}
}
}
}
}

+ 3
- 0
BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs View File

@@ -38,8 +38,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// 配方队列
/// </summary>
public ConcurrentQueue<string> RecipeQueueTray1 = new ConcurrentQueue<string>();

public ConcurrentQueue<string> RecipeQueueTray2 = new ConcurrentQueue<string>();



public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus();
public HKDeviceStatus HKDevice = new HKDeviceStatus();
public WindSendDeviceStatus WindSendDevice = new WindSendDeviceStatus();


+ 115
- 38
BPASmartClient.JakaRobot/JaKaHelper.cs View File

@@ -1,5 +1,7 @@
using BPASmartClient.Helper;
using BPASmartClient.Message;
using System.Net;
using System.Net.NetworkInformation;
using System.Text;

namespace BPASmartClient.JakaRobot
@@ -60,7 +62,7 @@ namespace BPASmartClient.JakaRobot
//public const string SENCE_初始位 = "20000";

#endregion
private int rshd = -1;
public int rshd = -1;
private bool login = false;

/// <summary>
@@ -74,49 +76,124 @@ namespace BPASmartClient.JakaRobot
public bool IsIdle { get; set; } = false;
public bool IsConnected { get { return login; } }
public bool IsDeviceFirstInit { get; set; }
private string IpAddress { get; set; }
private bool IsPingOk { get; set; }

public void Conn(string ip)
{
jakaAPI.create_handler(ip.ToCharArray(), ref rshd);
login = true;
}

public void Connect(string ip)
{
bool ErrorFlag = false;
ThreadManage.GetInstance().StartLong(new Action(() =>
MessageLog.GetInstance.Show("节卡机器人连接中。。。。。");
IpAddress = ip;
Task.Factory.StartNew(() =>
{
if (rshd == -1 || login == false)
while (!IsPingOk)
{
try
{
jakaAPI.create_handler(ip.ToCharArray(), ref rshd);
login = true;
}
catch (Exception ex)
{
if (!ErrorFlag)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
ErrorFlag = true;
login = false;
}
Thread.Sleep(3000);
}
Ping myPing = new Ping();
myPing.PingCompleted += new PingCompletedEventHandler(_myPing_PingCompleted);
myPing.SendAsync(IpAddress, 1000, null);
Thread.Sleep(3000);
}
if (login && IsDeviceFirstInit==false)
});


//bool ErrorFlag = false;
//ThreadManage.GetInstance().StartLong(new Action(() =>
//{
// if (rshd == -1 || login == false)
// {
// try
// {
// jakaAPI.create_handler(ip.ToCharArray(), ref rshd);
// login = true;
// }
// catch (Exception ex)
// {
// if (!ErrorFlag)
// {
// MessageLog.GetInstance.ShowEx(ex.ToString());
// ErrorFlag = true;
// login = false;
// }
// Thread.Sleep(3000);
// }
// }
// if (login && IsDeviceFirstInit == false)
// {
// try
// {
// Power_On();//打开机器人电源
// Thread.Sleep(1000);
// Enable_robot();//机器人上使能
// IsDeviceFirstInit = true;
// MessageLog.GetInstance.Show("机器人已上电使能");
// }
// catch (Exception ex)
// {
// MessageLog.GetInstance.ShowEx("机器人未完成上电和使能");
// }
// }
// Thread.Sleep(5000);
//}), $"节卡机器人连接", true);

}

private void _myPing_PingCompleted(object sender, PingCompletedEventArgs e)
{
if (e.Reply != null && e.Reply.Status == IPStatus.Success)
{
IsPingOk = true;
MessageLog.GetInstance.Show("节卡机器人物理网络准备就绪");
Thread.Sleep(3000);
bool ErrorFlag = false;
ThreadManage.GetInstance().StartLong(new Action(() =>
{
try
if (rshd == -1 || login == false)
{
Power_On();//打开机器人电源
Thread.Sleep(1000);
Enable_robot();//机器人上使能
IsDeviceFirstInit = true;
MessageLog.GetInstance.Show("机器人已上电使能");
try
{
int result = jakaAPI.create_handler(IpAddress.ToCharArray(), ref rshd);
login = true;
MessageLog.GetInstance.Show($"节卡机器人创建连接成功,句柄:{rshd},返回值:{result}");
}
catch (Exception ex)
{
if (!ErrorFlag)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
ErrorFlag = true;
login = false;
}
Thread.Sleep(3000);
}
}
catch (Exception ex)
if (login && IsDeviceFirstInit == false)
{
MessageLog.GetInstance.ShowEx("机器人未完成上电和使能");
try
{
MessageLog.GetInstance.Show("节卡机器人打开电源准备");
Thread.Sleep(2000);
Power_On();//打开机器人电源
Thread.Sleep(1000);
MessageLog.GetInstance.Show("节卡机器人上使能准备");
Enable_robot();//机器人上使能
IsDeviceFirstInit = true;
MessageLog.GetInstance.Show("机器人已上电使能");
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx("机器人未完成上电和使能");
}
}
}
Thread.Sleep(5000);
}), $"节卡机器人连接", true);
Thread.Sleep(5000);
}), $"节卡机器人连接", true);
}
}

public void Power_On()
{
if (login)
@@ -129,10 +206,10 @@ namespace BPASmartClient.JakaRobot
{
MessageLog.GetInstance.ShowEx(ave.ToString());
}
//catch (Exception ex)
//{
// MessageLog.GetInstance.ShowEx(ex.ToString());
//}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
}
}
else
{
@@ -324,8 +401,8 @@ namespace BPASmartClient.JakaRobot
{
try
{
//加载
p: file = Programname.ToCharArray();
//加载
p: file = Programname.ToCharArray();
MessageLog.GetInstance.Show($"调用文件名:{Programname}");
status = new JKTYPE.ProgramState();
jakaAPI.get_program_state(ref rshd, ref status);


+ 0
- 14
BPASmartClient.Model/GlobalFoodMenu.cs View File

@@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Model
{
public class GlobalFoodMenu
{
public static ObservableCollection<FoodMenuModel> LocalFoodMenus = new ObservableCollection<FoodMenuModel>();
}
}

+ 15
- 0
BPASmartClient.Model/小炒机/MaterialAndFryingTime.cs View File

@@ -0,0 +1,15 @@
using BPA.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Model.小炒机
{
public class MaterialAndFryingTime
{
public Dictionary<string, ObservableCollection<PotActions>> materials { get; set; } = new Dictionary<string, ObservableCollection<PotActions>>();
}
}

+ 1
- 0
BPASmartClient.MorkBF/BPASmartClient.MorkBF.csproj View File

@@ -13,6 +13,7 @@
<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" />
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
<ProjectReference Include="..\BPASmartClient.ViewModel\BPASmartClient.ViewModel.csproj" />
</ItemGroup>

<ItemGroup>


+ 10
- 9
BPASmartClient.MorkBF/Control_MorkBF.cs View File

@@ -9,6 +9,7 @@ using BPASmartClient.Model;
using BPASmartClient.Model.大炒;
using BPASmartClient.MorkBF.Model;
using BPASmartClient.MorkBF.ViewModel;
using BPASmartClient.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -36,14 +37,14 @@ namespace BPASmartClient.MorkBF
MonitorViewModel.DeviceId = DeviceId;
ActionManage.GetInstance.Register(new Action(() =>
{
GlobalFoodMenu.LocalFoodMenus.Clear();
if (BPASmartClient.Helper.Json<LocalFryPotMessage>.Data.FryPotMessage.Count > 0)
{
foreach (var item in BPASmartClient.Helper.Json<LocalFryPotMessage>.Data.FryPotMessage)
{
GlobalFoodMenu.LocalFoodMenus.Add(new FoodMenuModel { GoodKey = item.GoodKey, GoodName = item.GoodName });
}
}
//GlobalFoodMenu.LocalFoodMenus.Clear();
//if (BPASmartClient.Helper.Json<LocalFryPotMessage>.Data.FryPotMessage.Count > 0)
//{
// foreach (var item in BPASmartClient.Helper.Json<LocalFryPotMessage>.Data.FryPotMessage)
// {
// GlobalFoodMenu.LocalFoodMenus.Add(new FoodMenuModel { GoodKey = item.GoodKey, GoodName = item.GoodName });
// }
//}
}), "更新菜单");
CommandRegist();//调试
ServerInit();
@@ -1022,7 +1023,7 @@ namespace BPASmartClient.MorkBF
WorkStatus_1 = morkBF.FryPan1_TemperatureNow > 0 ? WorkStatus.工作 : WorkStatus.待机,
WorkStatus_2 = morkBF.FryPan2_TemperatureNow > 0 ? WorkStatus.工作 : WorkStatus.待机,
RobotStatu = WorkStatus.工作,
Alarm = new List<AlarmModel>(),
Alarm = new List<BPA.Message.AlarmModel>(),
FailuresCount = 0,
StatsCount = statsModels,
MaxWok_Dishes_1 = "满汉全席",


+ 1
- 0
BPASmartClient.MorkF/BPASmartClient.MorkF.csproj View File

@@ -18,6 +18,7 @@
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.ViewModel\BPASmartClient.ViewModel.csproj" />
</ItemGroup>

</Project>

+ 179
- 95
BPASmartClient.MorkF/Control_MorkF.cs View File

@@ -1,4 +1,5 @@
using BPA.Message;
using System;
using BPA.Message.Enum;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
@@ -16,6 +17,8 @@ using System.Windows.Documents;
using BPASmartClient.Business;
using Microsoft.CodeAnalysis;
using BPASmartClient.MorkF.ViewModel;
using BPASmartClient.ViewModel;
using System.Windows;

namespace BPASmartClient.MorkF
{
@@ -35,7 +38,7 @@ namespace BPASmartClient.MorkF
/// <summary>
/// 菜品库while循环最大sleep次数
/// </summary>
private const int materialSleepCount = 900;
private const int materialSleepCount = 600;

/// <summary>
/// 菜品库while循环每次sleep时间
@@ -50,40 +53,40 @@ namespace BPASmartClient.MorkF
/// <summary>
/// 菜品盒下移高度,相对于坐标系
/// </summary>
private const int materialBoxHigh = 4080;
//private const int materialBoxHigh = 4080;

//菜品库出餐高度
private const int materialHigh = 33000;
////菜品库出餐高度
//private const int materialHigh = 33000;

//传感器到菜品库的高度(坐标系)
private const int materialLaserHigh = 34500;
////传感器到菜品库的高度(坐标系)
//private const int materialLaserHigh = 34500;

/// <summary>
/// 菜品盒坐标系高度
/// </summary>
private const int materialBoxHeight = 9500;
private const int materialBoxHeight = 9700;

//传感器1到菜品库的高度(厘米)
private const int materialLaserHighCM_1 = 22;
//private const int materialLaserHighCM_1 = 22;

//传感器2到菜品库的高度(厘米)
private const int materialLaserHighCM_2 = 27;
////传感器2到菜品库的高度(厘米)
//private const int materialLaserHighCM_2 = 27;

//传感器3到菜品库的高度(厘米)
private const int materialLaserHighCM_3 = 31;
////传感器3到菜品库的高度(厘米)
//private const int materialLaserHighCM_3 = 31;

/// <summary>
/// 传感器到隔板的距离(坐标系)
/// </summary>
private const int clapboardLaserHigh = 10000;

//炒锅1倒菜的xy坐标
private const int materialPutPositionXFry1 = 70000;
private const int materialPutPositionYFry1 = 40000;
////炒锅1倒菜的xy坐标
//private const int materialPutPositionXFry1 = 70000;
//private const int materialPutPositionYFry1 = 40000;

//炒锅2倒菜的xy坐标
private const int materialPutPositionXFry2 = 70000;
private const int materialPutPositionYFry2 = 40000;
////炒锅2倒菜的xy坐标
//private const int materialPutPositionXFry2 = 70000;
//private const int materialPutPositionYFry2 = 40000;

//菜品库机械爪放置菜品距离
private const int materialToFryDistance = 10000;
@@ -146,7 +149,7 @@ namespace BPASmartClient.MorkF
/// <summary>
/// 告警列表
/// </summary>
private List<AlarmModel> alarmModel = new List<AlarmModel>();
private List<BPA.Message.AlarmModel> alarmModel = new List<BPA.Message.AlarmModel>();

/// <summary>
///
@@ -201,7 +204,7 @@ namespace BPASmartClient.MorkF
MaterialCoordinate.GetInstance().frying2 = materialCoordinate.frying2;
MaterialCoordinate.GetInstance().materialHeight = materialCoordinate.materialHeight;
MaterialCoordinate.GetInstance().MaterialOneX = materialCoordinate.MaterialOneX;
MaterialCoordinate.GetInstance().MaterialTwoX = materialCoordinate.MaterialTwoX;
MaterialCoordinate.GetInstance().MaterialTwoX = materialCoordinate.MaterialTwoX;
MaterialCoordinate.GetInstance().MaterialThreeX = materialCoordinate.MaterialThreeX;
}
////菜品库编号与坐标系对象存储
@@ -346,7 +349,15 @@ namespace BPASmartClient.MorkF
ml_morkf.PawArrivePortThree = bools[2];
}
}), 2);

//获取爪子伸出退回到位
GetStatus("M10.6", new Action<object>((objects) =>
{
if (objects is bool[] bools && bools.Length == 2)
{
ml_morkf.PawOutComplete = bools[0];
ml_morkf.PawInComplete = bools[1];
}
}), 2);
//获取总初始化完成
GetStatus("M10.2", new Action<object>((objects) =>
{
@@ -396,7 +407,6 @@ namespace BPASmartClient.MorkF
ActionManage.GetInstance.Register(PLCInite, "InitCommand");
ActionManage.GetInstance.Register(StartOrder, "StartOrder");
ActionManage.GetInstance.Register(StartOrderMain, "开始下单");
ActionManage.GetInstance.Register(StartLocalOrder, "StartLocalOrder");
ActionManage.GetInstance.Register(StopLocalOrder, "StopLocalOrder");
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
@@ -478,8 +488,21 @@ namespace BPASmartClient.MorkF
GetDistance_3();
}), "GetDistance_3");
}), "GetDistance_3");
ActionManage.GetInstance.Register(PawExtend, "PawTurnFront");
ActionManage.GetInstance.Register(PawShrink, "PawTurnBack");
ActionManage.GetInstance.Register(new Action(() =>
{
ThreadManage.GetInstance().Start(new Action(() =>
{
PawExtend();
}), "PawTurnFront");
}), "PawTurnFront");
ActionManage.GetInstance.Register(new Action(() =>
{
ThreadManage.GetInstance().Start(new Action(() =>
{
PawShrink();
}), "PawTurnBack");
}), "PawTurnBack");
ActionManage.GetInstance.Register(new Action<object>((list) =>
{
ThreadManage.GetInstance().Start(new Action(() =>
@@ -704,7 +727,7 @@ namespace BPASmartClient.MorkF
}

/// <summary>
/// 本地菜单下单
/// 根据菜品ID下单
/// </summary>
private void StartOrder(object o)
{
@@ -728,44 +751,42 @@ namespace BPASmartClient.MorkF
}

/// <summary>
/// 本地菜单下单
/// 主界面本地菜单下单
/// </summary>
private void StartOrderMain(object o)
{
if (o == null) return;
if (o is string goodId)
{
var res = LocalstirFryGoods?.FirstOrDefault(p => p.GoodsKey.ToString() == goodId);//匹配订单对应制作流程
if (res != null)
{
/* morkF.listStirBom.Add(res.StirFryBomInfo);*///添加订单制作流程
if (StirFryGoodsQuenes.Count > 0) return;
StirFryGoodsQuenes.Enqueue(new OrderLocInfo()
{
SuborderId = Guid.NewGuid().ToString(),
StirPotActions = res.StirPotActions,
GoodName = "本地菜品"
});
MessageLog.GetInstance.Show($"添加本地订单{res.GoodsKey}");
}
}
}
//if (o is FoodMenuModel good)
//{
// NewStartLocalOrder(good.GoodName);
//}

private void StartLocalOrder()
{
if (StirFryGoodsQuenes.Count > 0) return;//只能一个一个做
if (Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions.Count > 0)
{
StirFryGoodsQuenes.Enqueue(new OrderLocInfo()
{
SuborderId = Guid.NewGuid().ToString(),
StirPotActions = Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions,
GoodName = "本地菜品"
});
MessageLog.GetInstance.Show($"添加本地模拟的订单{Json<LocalPotStep>.Data.LocalstirFryGoods.GoodsKey}");
}
//if (o == null) return;
//if (o is string goodId)
//{
// var res = LocalstirFryGoods?.FirstOrDefault(p => p.GoodsKey.ToString() == goodId);//匹配订单对应制作流程
// if (res != null)
// {
// /* morkF.listStirBom.Add(res.StirFryBomInfo);*///添加订单制作流程
// if (StirFryGoodsQuenes.Count > 0) return;
// StirFryGoodsQuenes.Enqueue(new OrderLocInfo()
// {
// SuborderId = Guid.NewGuid().ToString(),
// StirPotActions = res.StirPotActions,
// GoodName = "本地菜品"
// });
// MessageLog.GetInstance.Show($"添加本地订单{res.GoodsKey}");
// }
//}
}


/// <summary>
/// 本地配置的订单
/// </summary>
/// <param name="materialName"></param>
private void NewStartLocalOrder(string materialName)
{
//if (StirFryGoodsQuenes.Count > 0) return;//只能一个一个做
@@ -800,6 +821,7 @@ namespace BPASmartClient.MorkF
GoodName = materialName
});
MessageLog.GetInstance.Show($"添加本地模拟的订单{Json<LocalPotStep>.Data.LocalstirFryGoods.GoodsKey}");
MessageBox.Show("下单成功");
}
}

@@ -968,33 +990,54 @@ namespace BPASmartClient.MorkF
/// 爪子伸出
/// </summary>
/// <param name="o">电磁阀启停:true:启动。false:停止。</param>
public void PawExtend()
public bool PawExtend()
{
if (!ml_morkf.InitialComplete)
{
MessageLog.GetInstance.ShowEx("爪子伸出错误,菜品库未初始化");
return;
return false;
}
Thread.Sleep(500);
MaterailLibrary_Write("M0.6", true);
//等待爪子伸出延时4s
Thread.Sleep(6000);
for (int i = 0; i < materialSleepCount && !ml_morkf.PawOutComplete; i++)//潘华小炒没有夹爪到位功能
{
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
{
MessageLog.GetInstance.ShowEx("爪子伸出超时");
return false;
}
}
return true;
////等待爪子伸出延时4s
//Thread.Sleep(6000);
}
/// <summary>
/// 爪子收缩
/// </summary>
/// <param name="o">电磁阀启停:true:启动。false:停止。</param>
public void PawShrink()
public bool PawShrink()
{
if (!ml_morkf.InitialComplete)
{
MessageLog.GetInstance.ShowEx("爪子伸出错误,菜品库未初始化");
return;
return false;
}

MaterailLibrary_Write("M0.7", true);
Thread.Sleep(500);
for (int i = 0; i < materialSleepCount && !ml_morkf.PawInComplete; i++)//潘华小炒没有夹爪到位功能
{
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
{
MessageLog.GetInstance.ShowEx("爪子伸出超时");
return false;
}
}
return true;
//等待爪子收缩延时4s
Thread.Sleep(6000);
//Thread.Sleep(6000);
}
/// <summary>
/// 电磁阀启停
@@ -1033,6 +1076,10 @@ namespace BPASmartClient.MorkF
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
{
if (i == 10)
{
MaterailLibrary_Write("M1.0", true);
}
MessageLog.GetInstance.ShowEx("爪子去到1号位超时");
return false;
}
@@ -1063,6 +1110,10 @@ namespace BPASmartClient.MorkF
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
{
if (i == 10)
{
MaterailLibrary_Write("M1.1", true);
}
MessageLog.GetInstance.ShowEx("爪子去到2号位超时");
return false;
}
@@ -1090,10 +1141,14 @@ namespace BPASmartClient.MorkF
for (int i = 0; i < materialSleepCount && !ml_morkf.PawArrivePortThree; i++)
{
Thread.Sleep(materialSleepTime);
if(i == 30)
{
MaterailLibrary_Write("M1.2", true);
}
if (i >= materialSleepCount - 1)
{
MessageLog.GetInstance.ShowEx("爪子去到3号位超时");
return false;
}
}
if (!ml_morkf.PawPositon_3)
@@ -1243,6 +1298,12 @@ namespace BPASmartClient.MorkF
return false;
}

if (x>212000|| y >240000)
{
MessageLog.GetInstance.ShowEx("机械臂移动超出范围");
return false;
}

//取反
x = 0 - Math.Abs(x);
y = 0 - Math.Abs(y);
@@ -1285,7 +1346,7 @@ namespace BPASmartClient.MorkF

//MessageLog.GetInstance.Show("机械臂移动操作完成");

Thread.Sleep(500);
Thread.Sleep(300);

return true;
}
@@ -1374,9 +1435,9 @@ namespace BPASmartClient.MorkF
Thread.Sleep(1000);

//获取传感器的距离,转换成坐标系的点
//int laserHigh = ml_morkf.LaserDistance;
int laserHigh = ml_morkf.LaserDistance;

int laserHigh = 400;
//秦工要求读取后置0
WriteDistance(0);

@@ -1396,7 +1457,7 @@ namespace BPASmartClient.MorkF
}

//设置到传感器感应的距离处
if (!SetArmPosition(x, y))
if (!SetArmPosition(x - moveX, y))
{
return false;
}
@@ -1414,7 +1475,11 @@ namespace BPASmartClient.MorkF
}

//伸出爪子
PawExtend();
if (!PawExtend())
{
return false;
}

//移动前开启电磁阀
Electromagnetism(new List<bool> { false });
@@ -1461,16 +1526,18 @@ namespace BPASmartClient.MorkF
return false;
}

WriteSpeed(50000);
WriteSpeed(50000);//移动速度
//ThreadManage.GetInstance().Start(new Action(() =>
//{
// //收缩爪子
// PawShrink();
//}), "GetMaterialPawShrink");
PawShrink();

//收缩爪子
if (!PawShrink()) return false;

//判断炒锅是否可以放盒
for (int i = 0; materialSleepCount > i && !morkFs[fryIndex].FryPot1_HOBTPut; i++)
for (int i = 0; materialSleepCount > i && !morkFs[fryNum].FryPot1_HOBTPut; i++)
{
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
@@ -1520,8 +1587,12 @@ namespace BPASmartClient.MorkF
return false;
}

//伸出爪子
PawExtend();
if (!PawExtend())
{
return false;
}

Thread.Sleep(300);

@@ -1530,7 +1601,7 @@ namespace BPASmartClient.MorkF
Thread.Sleep(300);

//收缩爪子
PawShrink();
if (!PawShrink()) return false;

//设置到炒锅i出菜处
if (!SetArmPosition(x + materialToFryDistance, y))
@@ -1578,10 +1649,13 @@ namespace BPASmartClient.MorkF
Electromagnetism(new List<bool> { true });

//爪子收回
PawShrink();
if (!PawShrink())
{
return false;
}

//爪子去2号点位
if(!PawToPoint2())
if (!PawToPoint2())
{
return false;
}
@@ -1670,8 +1744,10 @@ namespace BPASmartClient.MorkF
Laser2CoordinateState laser2CoordinateState = LaserDistance2MaterialCount(distance, x, out boxCount);
if (laser2CoordinateState == Laser2CoordinateState.MaterialNormal)
{
int compensateHeight = boxCount > 1 ? 500 : 0;//补偿高度,超过1层盒子增加补偿
//盒子高度计算除去起始位置的那个盒子
x_high = (boxCount - 1) * materialBoxHeight;
x_high = (boxCount - 1) * materialBoxHeight + compensateHeight;
}
return laser2CoordinateState;

@@ -1722,6 +1798,7 @@ namespace BPASmartClient.MorkF
if(heightDifferent < 0)
{
MessageLog.GetInstance.ShowEx($"菜品库检测{x}处的菜品量时,传感器获取的高度差为负数,请校准该层高度");
return Laser2CoordinateState.MaterialEmpty; ;
}

//盒子高度为45,但是需要考虑到误差,不足35,则认为为空
@@ -2216,11 +2293,7 @@ namespace BPASmartClient.MorkF
GoodsKey = item.GoodsKey,
StirPotActions = OrderSort(item.StirPotActions),
});
GlobalFoodMenu.LocalFoodMenus.Add(new FoodMenuModel
{
GoodKey = item.GoodsKey.ToString(),
GoodName = "",
});
}
}

@@ -2357,9 +2430,9 @@ namespace BPASmartClient.MorkF
/// </summary>
/// <param name="subid"></param>
/// <param name="oRDER_STATUS"></param>
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
private void OrderChange(string Id , string goodName, ORDER_STATUS oRDER_STATUS,int deviceId)
{
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid });
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, GoodName = goodName,DeviceId = deviceId, SubOrderId =Id });
}

/// <summary>
@@ -2405,7 +2478,7 @@ namespace BPASmartClient.MorkF
if (materialInfo != null)
{
//if
if(Convert.ToInt32(materialInfo.Qty) - goodBatching.BatchingCount < 0)
if(System.Convert.ToInt32(materialInfo.Qty) - goodBatching.BatchingCount < 0)
{
MessageLog.GetInstance.ShowEx($"{materialInfo.Name}不够,请更新菜品库,并点击检测");
return;
@@ -2487,13 +2560,14 @@ namespace BPASmartClient.MorkF
if (morkFs[i].AutoMode && morkFs[i].FryPot1_InitialComplete && ml_morkf.InitialComplete &&
!morkFs[i].FryWorking)//炒锅在自动状态&&初始化完成&&菜品库初始化&&是否在炒菜中
{
Thread.Sleep(5000);
Thread.Sleep(4000);

lock(lock_MainProcessExcute)
{
//待炒小炒队列出队列
if (StirFryGoodsQuenes.TryDequeue(out var res))
{
OrderChange(res.SuborderId, res.GoodName, ORDER_STATUS.WAIT, DeviceId = i);
//设置当前炒制菜品
nowStirFryGood[i] = res;
//炒锅工作状态置为正在工作中
@@ -2519,7 +2593,7 @@ namespace BPASmartClient.MorkF
bool ret = true;
MessageLog.GetInstance.Show($"炒锅{i}开始炒制菜品{res.GoodName}");
OrderChange(res.SuborderId, res.GoodName, ORDER_STATUS.COOKING, DeviceId = i);
morkFs[i].GoodName = res.GoodName;

Coordinate myCoordinate = new Coordinate();
@@ -2542,7 +2616,7 @@ namespace BPASmartClient.MorkF

//更新
morkFs[i].UpdateProcess(potActions);
switch (potActions.Actions)
{
case nameof(StirFryPotActionEnum.加热开启):
@@ -2608,6 +2682,16 @@ namespace BPASmartClient.MorkF
MessageLog.GetInstance.Show(potActions.Actions);
break;
case nameof(StirFryPotActionEnum.取原料):
if(potActions.SeasoningLists[0].Loc == 1 ||
potActions.SeasoningLists[0].Loc == 9 ||
potActions.SeasoningLists[0].Loc == 10 ||
potActions.SeasoningLists[0].Loc == 18 ||
potActions.SeasoningLists[0].Loc == 19 ||
potActions.SeasoningLists[0].Loc == 27 )
{
MessageLog.GetInstance.ShowEx("该取料位置禁止使用");
return;
}
//炒锅取菜状态置为未取到
morkFs[i].GetMaterialComplete = false;

@@ -2678,7 +2762,7 @@ namespace BPASmartClient.MorkF
ret = OutFood(i, out error, true);
if(ret == false)
{
alarmModel.Add(new AlarmModel() { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = error });
alarmModel.Add(new BPA.Message.AlarmModel() { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = error });
}
break;
case nameof(StirFryPotActionEnum.炒制菜品):
@@ -2696,7 +2780,7 @@ namespace BPASmartClient.MorkF
}
if (ret == false)
{
alarmModel.Add(new AlarmModel() { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = error });
alarmModel.Add(new BPA.Message.AlarmModel() { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = error });
}
MessageLog.GetInstance.Show(potActions.Actions);
break;
@@ -2713,9 +2797,9 @@ namespace BPASmartClient.MorkF
Thread.Sleep(3000);
//回原点位
StirArmGoOrigin(i);
OrderChange(res.SuborderId, res.GoodName, ORDER_STATUS.COMPLETED_COOK, DeviceId = i);
//同时只能允许有一个出餐
lock(lock_OutMeal)
lock (lock_OutMeal)
{
//出餐启动
OutMeal(i);
@@ -2804,12 +2888,12 @@ namespace BPASmartClient.MorkF
if (batchingInfo == null)
{
//为空就新增
BatchingInfos.Add(new BatchingInfo() { BatchingCount = Convert.ToInt32(surplus.Qty) - stagingCount, BatchingLoc = surplus.Loc, BatchingId = surplus.Key });
BatchingInfos.Add(new BatchingInfo() { BatchingCount = System.Convert.ToInt32(surplus.Qty) - stagingCount, BatchingLoc = surplus.Loc, BatchingId = surplus.Key });
}
else
{
batchingInfo.BatchingLoc = surplus.Loc;
batchingInfo.BatchingCount = Convert.ToInt32(surplus.Qty) - stagingCount;
batchingInfo.BatchingCount = System.Convert.ToInt32(surplus.Qty) - stagingCount;
}
}
Thread.Sleep(1000);


+ 35
- 0
BPASmartClient.MorkF/Convert/PotActionToVisibilityConvert.cs View File

@@ -0,0 +1,35 @@
using AlibabaCloud.SDK.Iot20180120.Models;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace BPASmartClient.MorkF.Convert
{
internal class PotActionToVisibilityConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Visibility vs = Visibility.Collapsed;
if(value is string action)
{
switch (action)
{
case "":
default:
break;
}
}
return vs;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

+ 9
- 0
BPASmartClient.MorkF/ML_MorkF.cs View File

@@ -35,6 +35,15 @@ namespace BPASmartClient.MorkF
/// </summary>
public bool InitialComplete { get; set; }

/// <summary>
/// 爪子伸出到位
/// </summary>
public bool PawOutComplete { get; set; }
/// <summary>
/// 爪子缩回到位
/// </summary>
public bool PawInComplete { get; set; }

private bool _ArriveComplete = false;
/// <summary>
/// 定位到达,上升沿捕获需要特殊处理


+ 21
- 0
BPASmartClient.MorkF/Model/FoodMenuModel.cs View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkF.Model
{
public class FoodMenuModel
{
public string ID { get; set; }
public string FoodName { get; set; }
public Dictionary<int,int> FoodHouseMaterials { get; set; } = new Dictionary<int,int>();
}



}

+ 1
- 1
BPASmartClient.MorkF/Model/MaterialSurplus.cs View File

@@ -87,7 +87,7 @@ namespace BPASmartClient.MorkF
foreach(MaterialInfo material in materials)
{
//surplus += int.Parse(material.Qty.ToString());
surplus += Convert.ToInt32(material.Qty);
surplus += System.Convert.ToInt32(material.Qty);
}
return true;
}


+ 6
- 6
BPASmartClient.MorkF/View/DebugView.xaml View File

@@ -55,16 +55,16 @@

<TextBlock Text="菜单编号:" Margin="10,0"/>
<TextBox Text="{Binding FoodMenuID}" Width="100"/>
<Button Content="下单" Margin="10,0" Command="{Binding StartOrder}" Cursor="Hand"/>
<Button Content="本地模拟流程配置" Click="Button_Click"/>
<Button Content="本地模拟流程下单" Margin="10,0" Command="{Binding StartLocalOrder}" Cursor="Hand"/>
<Button Content="菜单编号下单下单" Margin="10,0" Command="{Binding StartOrder}" Cursor="Hand"/>
<Button Content="本地菜单流程配置" Click="Button_Click"/>
<Button Content="停止炒菜" Margin="10,0" Command="{Binding StopLocalOrder}" Cursor="Hand"/>
<Button Content="{Binding ModeButten}" Margin="10,0" Command="{Binding ModeChange}" Cursor="Hand"/>
<Button Content="{Binding ModeButten}" Margin="10,0" Command="{Binding ModeChange}" Cursor="Hand"/>
</WrapPanel>
</Grid>

</GroupBox>
<GroupBox Header="菜品选择" FontSize="15" Foreground="Aqua" Grid.Row="2" VerticalAlignment="Center" Height="190" >
<!--<GroupBox Header="菜品选择" FontSize="15" Foreground="Aqua" Grid.Row="2" VerticalAlignment="Center" Height="190" >
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
@@ -127,7 +127,7 @@
</WrapPanel>
</Grid>

</GroupBox>
</GroupBox>-->
<StackPanel Orientation="Vertical" Grid.Row="3">
<GroupBox Header="配料仓控制" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" Height="65">
<WrapPanel Orientation="Horizontal" Grid.RowSpan="2" VerticalAlignment="Top" Margin="0,5,0,0" >


+ 79
- 38
BPASmartClient.MorkF/View/LocalMenu.xaml View File

@@ -7,61 +7,102 @@
xmlns:local="clr-namespace:BPASmartClient.MorkF.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkF.ViewModel"
mc:Ignorable="d"
Title="LocalMenu" Height="800" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True" MouseLeftButtonDown="Window_MouseLeftButtonDown">
Title="LocalMenu" Height="900" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True" MouseLeftButtonDown="Window_MouseLeftButtonDown" Background="Gray"
>
<Window.DataContext>
<vm:LocalMenuViewModel/>
</Window.DataContext>
<Window.Resources>
<Style TargetType="ListBoxItem" >
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border BorderBrush="Black" BorderThickness="0" Background="White">
<Grid Width="600" HorizontalAlignment="Center" VerticalAlignment="Center" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Text="{Binding FryTime}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<TextBox Grid.Column="1" Text="{Binding During}" Margin="10,0"/>
<ComboBox Grid.Column="2" Width="120" ItemsSource="{Binding DataContext.strPotActions , RelativeSource={RelativeSource AncestorType=Window,Mode=FindAncestor}}"
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="ListBoxItem" x:Key="newFoodList" >
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border BorderBrush="Black" BorderThickness="0" Background="Transparent" Margin="5">
<StackPanel Orientation="Vertical">
<TextBlock Text="步骤:"/>
<TextBox Text="{Binding FryTime}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<ComboBox Width="120" ItemsSource="{Binding DataContext.strPotActions , RelativeSource={RelativeSource AncestorType=Window,Mode=FindAncestor}}"
SelectedValue="{Binding Actions}" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding SeasoningLists[0].Loc}" Margin="10,0"/>
<TextBox Grid.Column="4" Text="{Binding SeasoningLists[0].Qty}" Margin="10,0"/>
<Button Grid.Column="5" Content="删除" Margin="10,0" HorizontalAlignment="Center"
<TextBlock Text="时间"/>
<TextBox Text="{Binding During}" Margin="10,0"/>
<TextBox Text="{Binding SeasoningLists[0].Loc}" Margin="10,0"/>
<TextBox Text="{Binding SeasoningLists[0].Qty}" Margin="10,0"/>
<Button Content="删除" Margin="10,0" HorizontalAlignment="Center"/>
</StackPanel>
</Border>

</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ListBoxItem" >
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border BorderBrush="Black" BorderThickness="0" Background="Transparent" Margin="5">
<Grid Width="600" HorizontalAlignment="Center" VerticalAlignment="Center" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Text="{Binding FryTime}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<TextBox Grid.Column="1" Text="{Binding During}" Margin="10,0"/>
<ComboBox Grid.Column="2" Width="120" ItemsSource="{Binding DataContext.strPotActions , RelativeSource={RelativeSource AncestorType=Window,Mode=FindAncestor}}"
SelectedValue="{Binding Actions}" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding SeasoningLists[0].Loc}" Margin="10,0"/>
<TextBox Grid.Column="4" Text="{Binding SeasoningLists[0].Qty}" Margin="10,0"/>
<Button Grid.Column="5" Content="删除" Margin="10,0" HorizontalAlignment="Center"
Command="{Binding DataContext.Delete, RelativeSource={RelativeSource AncestorType=Window,Mode=FindAncestor}}"
CommandParameter="{Binding DataContext, RelativeSource={RelativeSource AncestorType=ListBoxItem,Mode=FindAncestor}}"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid>
</Border>

</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid >
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/窗体样式/From/内部背景.png"/>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="80"/>
<RowDefinition Height="80"/>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<ComboBox Name="Materials" SelectionChanged="Materials_SelectionChanged" ItemsSource="{Binding MaterialNames}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<StackPanel Margin="10,20,10,0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBox Text="{Binding MaterialName}" Width="80" Height="40" Margin="10,0"/>
<Button Content="增加菜谱" Command="{Binding AddMaterial}" Width="80" Height="40" Margin="10,0"/>
<Button Content="下单" Command="{Binding NewStartLocalMaterial}" Width="80" Height="40" Margin="10,0"/>
<!--<Button Content="菜谱重命名" Command="{Binding RenameMaterial}" Width="80" Height="40" Margin="10,0"/>
<Button Content="删除菜谱" Command="{Binding DeleteMaterial}" Width="80" Height="40" Margin="10,0"/>-->
</StackPanel>
<StackPanel Grid.Row="1" Margin="10,20,10,0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<ComboBox Name="Materials" Width="100" Height="40" SelectionChanged="Materials_SelectionChanged" SelectedIndex="0" IsReadOnly="True"
ItemsSource="{Binding MaterialNames}" SelectedItem="{Binding SelectMaterialName}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<!--<Button Content="下单" Command="{Binding NewStartLocalMaterial}" Width="80" Height="40" Margin="10,0" Cursor="Hand"/>-->
<!--<Button Content="菜谱重命名" Command="{Binding RenameMaterial}" Width="80" Height="40" Margin="10,0"/>-->
<Button Content="删除菜谱" Command="{Binding DeleteMaterial}" Width="80" Height="40" Margin="10,0"/>
<Button Content="增加步骤" Command="{Binding AddFryTime}" Width="80" Height="40" Margin="10,0"/>
<Button Content="保存" Command="{Binding Save}" Width="80" Height="40" Margin="10,0"/>
<Button Content="退出" Click="Button_Click" Width="80" Height="40" Margin="10,0"/>
</StackPanel>
<Grid Grid.Row="1" Width="600" HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid Grid.Row="2" Width="600" HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
@@ -77,9 +118,9 @@
<TextBlock Grid.Column="4" Text="调料重量" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="5" Text="删除" HorizontalAlignment="Center"/>
</Grid>
<ListBox x:Name="listview1" Grid.Row="2" BorderBrush="Black" BorderThickness="0" HorizontalAlignment="Center" AllowDrop="True"
<ListBox x:Name="listview1" Grid.Row="3" BorderBrush="Black" BorderThickness="0" HorizontalAlignment="Center" AllowDrop="True"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding PotActionStep}" Margin=" 10" Background="Transparent"
ItemContainerStyle="{DynamicResource newFoodList}"
>
</ListBox>


+ 1
- 1
BPASmartClient.MorkF/View/LocalMenu.xaml.cs View File

@@ -233,7 +233,7 @@ namespace BPASmartClient.MorkF.View

private void Materials_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
string str = Materials.SelectedValue.ToString();
string str = Materials.SelectedValue?.ToString();
if(str != string.Empty)
{
ActionManage.GetInstance.Send("LoacMenuSelectMaterial", str);


+ 73
- 30
BPASmartClient.MorkF/View/MaterialCalibration.xaml View File

@@ -82,6 +82,10 @@
<Grid>
<ScrollViewer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="0.4*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
@@ -627,7 +631,7 @@
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentySixX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding SeventeenY}" Width="100"/>
<TextBox Grid.Column="3" Text="{Binding TwentySixY}" Width="100"/>
</Grid>
</Grid>
<Grid>
@@ -657,6 +661,8 @@
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WrapPanel>
<Grid>
@@ -725,6 +731,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="第二层菜品库出菜位置" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionMaterialTwo}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
@@ -740,6 +747,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="第三层菜品库出菜位置" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionMaterialThree}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
@@ -749,56 +757,91 @@
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="0" IsEnabled="False" Width="100"/>
</WrapPanel>
</Grid>
</Grid>

</WrapPanel>
<WrapPanel Grid.Row="2" Margin="10,10">
<Button Content="感应器1标准位置" Margin="10,0,10,0" Command="{Binding GetDistance_1}" Cursor="Hand"/>
<TextBox Grid.Column="1" Text="{Binding Distance_1}" Margin="10,0,10,0" Width="100"/>
<Button Content="感应器2标准位置" Margin="10,0,10,0" Command="{Binding GetDistance_2}"/>
<TextBox Grid.Column="1" Text="{Binding Distance_2}" Margin="10,0,10,0" Width="100"/>
<Button Content="感应器3标准位置" Margin="10,0,10,0" Command="{Binding GetDistance_3}"/>
<TextBox Grid.Column="1" Text="{Binding Distance_3}" Margin="10,0,10,0" Width="100"/>
</WrapPanel>
<WrapPanel Grid.Row="3">
<Button Content="全部位置保存" Margin="10,0,50,0" Height="40" Command="{Binding SaveCoordinate}" Cursor="Hand"/>
<Button Content="全部位置读取" Height="40" Command="{Binding ReadCoordinate}"/>
</WrapPanel>
</Grid>
</GroupBox>
<GroupBox Grid.Row="4" Header="操作" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<WrapPanel>
<GroupBox Grid.Row="0" Grid.RowSpan="3" Grid.Column="1" Header="操作" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<StackPanel >
<WrapPanel Margin="10,10">
<Button Content="菜品库初始化" Margin="10,0,5,0" Command="{Binding FoodLibInit}"/>
</WrapPanel>
<WrapPanel Grid.Row="1" Margin="10,10">
<Button Content="电磁阀启动" Margin="10,0,5,0" Command="{Binding StartElectromagnetism}"/>
<Button Content="电磁阀停止" Margin="10,0,5,0" Command="{Binding StopElectromagnetism}"/>
<Button Content="夹爪伸出" Command="{Binding PawTurnFront}" Margin="5,0" Cursor="Hand"/>
<Button Content="夹爪收缩" Command="{Binding PawTurnBack}" Margin="5,0" Cursor="Hand"/>
</WrapPanel>
<WrapPanel Grid.Row="2" Margin="10,10">
<Button Content="夹爪伸出" Command="{Binding PawTurnFront}" Margin="10,0,5,0" Cursor="Hand"/>
<Button Content="夹爪收缩" Command="{Binding PawTurnBack}" Margin="10,0,5,0" Cursor="Hand"/>
</WrapPanel>
<WrapPanel Grid.Row="3" Margin="10,10">
<TextBlock Text="夹爪位置:" Margin="10,0,5,0" />
<RadioButton Content="位置1" Margin="5,0" IsEnabled="True" IsChecked="{Binding PawPositon1}" Command="{Binding PawToPoint1}" GroupName="PawTurn"/>
<RadioButton Content="位置2" Margin="5,0" IsEnabled="True" IsChecked="{Binding PawPositon2}" Command="{Binding PawToPoint2}" GroupName="PawTurn"/>
<RadioButton Content="位置3" Margin="5,0 " IsEnabled="True" IsChecked="{Binding PawPositon3}" Command="{Binding PawToPoint3}" GroupName="PawTurn"/>
</WrapPanel>
<WrapPanel Grid.Row="1">
<Button Content="感应器1测距" Margin="5,0" Command="{Binding GetDistance_1}" Cursor="Hand"/>
<TextBox Grid.Column="1" Text="{Binding Distance_1}" Width="100"/>
<Button Content="感应器2测距" Margin="5,0" Command="{Binding GetDistance_2}"/>
<TextBox Grid.Column="1" Text="{Binding Distance_2}" Width="100"/>
<Button Content="感应器3测距" Margin="5,0" Command="{Binding GetDistance_3}"/>
<TextBox Grid.Column="1" Text="{Binding Distance_3}" Width="100"/>
</WrapPanel>
<WrapPanel Grid.Row="2">
<TextBlock Text="移动系数:"></TextBlock>
<WrapPanel Grid.Row="4" Margin="10,10">
<TextBlock Text="移动系数:" Margin="10,0,0,0"></TextBlock>
<TextBox
Style="{DynamicResource UserTextBoxStyle}"
Foreground="#a2c2e8" Text="{Binding Str}"/>
<TextBlock Text="移动方式:" Margin="50,0,0,0"></TextBlock>
Style="{DynamicResource UserTextBoxStyle}"
Foreground="#a2c2e8" Text="{Binding Str}"/>
</WrapPanel>
<WrapPanel Grid.Row="5" Margin="10,10">
<TextBlock Text="移动方式:" Margin="10,0,0,0"></TextBlock>
<RadioButton Content="上" Margin="5,0" IsChecked="{Binding Up}" GroupName="ArmRun"/>
<RadioButton Content="下" Margin="5,0" IsChecked="{Binding Down}" GroupName="ArmRun"/>
<RadioButton Content="左" Margin="5,0 " IsChecked="{Binding Left}" GroupName="ArmRun"/>
<RadioButton Content="右" Margin="5,0 " IsChecked="{Binding Right}" GroupName="ArmRun"/>
<RadioButton Content="定点" Margin="5,0 " IsChecked="{Binding Point}" GroupName="ArmRun"/>
<Button Content="移动" Command="{Binding SetNowPosition}"/>

</WrapPanel>
<WrapPanel Grid.Row="3" Cursor="">
<Button Content="自动计算" Margin="20,0,50,0" Command="{Binding AutoCalculation}"/>
<Button Content="保存" Margin="20,0,50,0" Command="{Binding SaveCoordinate}"/>
<Button Content="读取" Command="{Binding ReadCoordinate}"/>
<WrapPanel Grid.Row="6" Margin="10,10">
<Button Content="自动计算" Margin="10,0,50,0" Command="{Binding AutoCalculation}"/>

</WrapPanel >
<WrapPanel Grid.Row="7" Margin="10,10">
<TextBlock Text="取料手臂设定位置" Margin="10,0,10,10"/>
<TextBlock Text="X:" Margin="5,0"/>
<TextBox Text="{Binding SettingX}" Width="70" Margin="5,0" VerticalAlignment="Center" />
<TextBlock Text="Y:" Margin="5,0"/>
<TextBox Text="{Binding SettingY}" Width="70" Margin="5,0" VerticalAlignment="Center" />
<Button Content="移动" Command="{Binding SetArmPosition}" Margin="5,0,10,0" Cursor="Hand"/>
<TextBlock Text="移动速度:" Margin="5,0"/>
<TextBox Text="{Binding MoveSpeed}" Width="70" Margin="5,0" VerticalAlignment="Center" />
<Button Content="设定" Command="{Binding SetSpeed}" Cursor="Hand" Margin="5,0,10,0" />
</WrapPanel>
</Grid>
<!--<WrapPanel Margin="10">
<Button Content="感应器1测距" Margin="5,0" Command="{Binding GetTestDistance_1}" Cursor="Hand"/>
<TextBox Text="{Binding SensingDistance_1}" Margin="5,0" Width="60" IsReadOnly="True"/>
<Button Content="感应器2测距" Margin="5,0" Command="{Binding GetTestDistance_2}"/>
<TextBox Text="{Binding SensingDistance_2}" Margin="5,0" Width="60" IsReadOnly="True"/>
<Button Content="感应器3测距" Margin="5,0" Command="{Binding GetTestDistance_3}"/>
<TextBox Text="{Binding SensingDistance_3}" Margin="5,0" Width="60" IsReadOnly="True"/>
</WrapPanel>-->
</StackPanel>
</GroupBox>
</Grid>
</ScrollViewer>


+ 1
- 2
BPASmartClient.MorkF/ViewModel/DebugViewModel.cs View File

@@ -33,7 +33,7 @@ namespace BPASmartClient.MorkF.ViewModel
public RelayCommand FoodPlcInite { get; set; }
public RelayCommand Plc1Reset { get; set; }
public RelayCommand StartOrder { get; set; }
public RelayCommand StartLocalOrder { get; set; }
public RelayCommand StopLocalOrder { get; set; }
public RelayCommand ModeChange { get; set; }

@@ -205,7 +205,6 @@ namespace BPASmartClient.MorkF.ViewModel
PlcInite = new RelayCommand(() => { ActionManage.GetInstance.Send("InitCommand"); });
Plc1Reset = new RelayCommand(() => { ActionManage.GetInstance.Send("Plc1Reset"); });
StartOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("StartOrder", FoodMenuID); });
StartLocalOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("StartLocalOrder"); });
StopLocalOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("StopLocalOrder"); });
ModeChange = new RelayCommand(() => {
ActionManage.GetInstance.Send("ModeChange");


+ 45
- 32
BPASmartClient.MorkF/ViewModel/LocalMenuViewModel.cs View File

@@ -1,6 +1,9 @@
using BPA.Models;
using BPASmartClient.Helper;
using BPASmartClient.Model;
using BPASmartClient.Model.小炒机;
using BPASmartClient.MorkF.Model;
using BPASmartClient.ViewModel;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
@@ -17,20 +20,33 @@ namespace BPASmartClient.MorkF.ViewModel
partial class LocalMenuViewModel:ObservableObject
{
/// <summary>
/// 单个菜品流程
/// </summary>
public ObservableCollection<PotActions> PotActionStep { get { return _PotActionStep; }
set { _PotActionStep = value; OnPropertyChanged(); } }
private ObservableCollection<PotActions> _PotActionStep = new ObservableCollection<PotActions>();

public string MaterialName { get; set; }

public string SelectMaterialName { get; set; }

/// <summary>
/// 选中的菜品
/// </summary>
public string SelectMaterialName { get { return _selectMaterialName; } set { _selectMaterialName = value; OnPropertyChanged(); } }
private string _selectMaterialName;
/// <summary>
/// 菜品combox集合
/// </summary>
public ObservableCollection<string> MaterialNames { get; set; } = new ObservableCollection<string>();


/// <summary>
/// 动作名称combox集合
/// </summary>
public ObservableCollection<string> strPotActions { get; set; } = new ObservableCollection<string>();

public MaterialAndFryingTime materialAndFryingTime { get; set; } = new MaterialAndFryingTime();
/// <summary>
/// 全部菜品流程集合
/// </summary>
public MaterialAndFryingTime materialAndFryingTime { get; set; } = Json<MaterialAndFryingTime>.Data;

public RelayCommand<object> Delete { get; set; }
public RelayCommand AddFryTime { get; set; }
@@ -106,34 +122,33 @@ namespace BPASmartClient.MorkF.ViewModel
else
{
MaterialNames.Add(MaterialName);
SelectMaterialName = MaterialName;
}
});
DeleteMaterial = new RelayCommand(() =>
{
//尝试是否能找到
if (MaterialNames.FirstOrDefault(o => o == SelectMaterialName) == SelectMaterialName)
if (materialAndFryingTime.materials.ContainsKey(SelectMaterialName))
{
MaterialNames.Remove(SelectMaterialName);
if(materialAndFryingTime.materials.ContainsKey(SelectMaterialName))
{
materialAndFryingTime.materials.Remove(SelectMaterialName);
}
}
});
RenameMaterial = new RelayCommand(() =>
{
//尝试是否能找到
if (MaterialNames.FirstOrDefault(o => o == SelectMaterialName) == SelectMaterialName)
{
MaterialNames.Remove(SelectMaterialName);
MaterialNames.Add(MaterialName);
if (materialAndFryingTime.materials.ContainsKey(SelectMaterialName))
{
materialAndFryingTime.materials.Add(MaterialName, materialAndFryingTime.materials[SelectMaterialName]);
materialAndFryingTime.materials.Remove(SelectMaterialName);
}
materialAndFryingTime.materials.Remove(SelectMaterialName);
}
MaterialNames.Remove(SelectMaterialName);
PotActionStep.Clear();
});
//RenameMaterial = new RelayCommand(() =>
//{
// //尝试是否能找到
// if (MaterialNames.FirstOrDefault(o => o == SelectMaterialName) == SelectMaterialName)
// {
// MaterialNames.Remove(SelectMaterialName);
// MaterialNames.Add(MaterialName);
// if (materialAndFryingTime.materials.ContainsKey(SelectMaterialName))
// {
// materialAndFryingTime.materials.Add(MaterialName, materialAndFryingTime.materials[SelectMaterialName]);
// materialAndFryingTime.materials.Remove(SelectMaterialName);

// }
// }
//});
Save = new RelayCommand(new Action(() =>
{
if(PotActionStep.Count > 0)
@@ -155,8 +170,9 @@ namespace BPASmartClient.MorkF.ViewModel
//Json<LocalPotStep>.Data.LocalstirFryGoods.GoodsKey = 11;
//Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions = new List<PotActions>(PotActionStep);
//Json<LocalPotStep>.Save();
Json<MaterialAndFryingTime>.Data.materials = materialAndFryingTime.materials;
//Json<MaterialAndFryingTime>.Data.materials = materialAndFryingTime.materials;
Json<MaterialAndFryingTime>.Save();
//ActionManage.GetInstance.Send("LocalMenuClose");
}));

@@ -209,8 +225,5 @@ namespace BPASmartClient.MorkF.ViewModel
}
}

partial class MaterialAndFryingTime
{
public Dictionary<string, ObservableCollection<PotActions>> materials { get; set; } = new Dictionary<string, ObservableCollection<PotActions>>();
}
}

+ 62
- 29
BPASmartClient.MorkF/ViewModel/MaterialCalibrationViewModel.cs View File

@@ -280,6 +280,30 @@ namespace BPASmartClient.MorkF.ViewModel
private int _Distance_2;
public int Distance_3 { get { return _Distance_3; } set { _Distance_3 = value; OnPropertyChanged(); } }
private int _Distance_3;
#endregion

#region 控制
public int SettingX { get { return _settingX; } set { _settingX = value; OnPropertyChanged(); } }
private int _settingX = 0;
public int SettingY { get { return _settingY; } set { _settingY = value; OnPropertyChanged(); } }
private int _settingY = 0;
public int MoveSpeed { get { return _moveSpeed; } set { _moveSpeed = value; OnPropertyChanged(); } }
private int _moveSpeed;

public int SensingDistance_1 { get { return _sensingDistance_1; } set { _sensingDistance_1 = value; OnPropertyChanged(); } }
private int _sensingDistance_1;
public int SensingDistance_2 { get { return _sensingDistance_2; } set { _sensingDistance_2 = value; OnPropertyChanged(); } }
private int _sensingDistance_2;
public int SensingDistance_3 { get { return _sensingDistance_3; } set { _sensingDistance_3 = value; OnPropertyChanged(); } }
private int _sensingDistance_3;

public RelayCommand SetSpeed { get; set; }//速度设定
public RelayCommand SetArmPosition { get; set; }//机器臂位置设定

public RelayCommand GetTestDistance_1 { get; set; }//获取感应器距离1
public RelayCommand GetTestDistance_2 { get; set; }//获取感应器距离2
public RelayCommand GetTestDistance_3 { get; set; }//获取感应器距离3

#endregion
public bool Up { get { return _Up; } set { _Up = value; OnPropertyChanged(); } }
private bool _Up;
@@ -355,9 +379,9 @@ namespace BPASmartClient.MorkF.ViewModel
public RelayCommand StopElectromagnetism { get; set; }
public RelayCommand PawTurnFront { get; set; }//夹爪正转
public RelayCommand PawTurnBack { get; set; }//夹爪反转
public RelayCommand PawToPoint1 { get; set; }//感应测距1
public RelayCommand PawToPoint2 { get; set; }//感应测距2
public RelayCommand PawToPoint3 { get; set; }//感应测距3
public RelayCommand PawToPoint1 { get; set; }//夹爪位置1
public RelayCommand PawToPoint2 { get; set; }//夹爪位置2
public RelayCommand PawToPoint3 { get; set; }//夹爪位置3
public RelayCommand GetDistance_1 { get; set; }//感应测距1
public RelayCommand GetDistance_2 { get; set; }//感应测距2
public RelayCommand GetDistance_3 { get; set; }//感应测距3
@@ -844,10 +868,10 @@ namespace BPASmartClient.MorkF.ViewModel
return;
}

if (PositionOne)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> {"1", OneX + OperationX, OneY + OperationY });//设定机械臂当前位置
}
//if (PositionOne)
//{
// ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> {"1", OneX + OperationX, OneY + OperationY });//设定机械臂当前位置
//}
if (PositionTwo)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "2", TwoX + OperationX, TwoY + OperationY });//设定机械臂当前位置
@@ -876,14 +900,14 @@ namespace BPASmartClient.MorkF.ViewModel
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "8", EightX + OperationX, EightY + OperationY });//设定机械臂当前位置
}
if (PositionNine)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "9", NineX + OperationX, NineY + OperationY });//设定机械臂当前位置
}
if (PositionTen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "10", TenX + OperationX, TenY + OperationY });//设定机械臂当前位置
}
//if (PositionNine)
//{
// ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "9", NineX + OperationX, NineY + OperationY });//设定机械臂当前位置
//}
//if (PositionTen)
//{
// ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "10", TenX + OperationX, TenY + OperationY });//设定机械臂当前位置
//}
if (PositionEleven)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "11", ElevenX + OperationX, ElevenY + OperationY });//设定机械臂当前位置
@@ -912,14 +936,14 @@ namespace BPASmartClient.MorkF.ViewModel
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "17", SeventeenX + OperationX, SeventeenY + OperationY });//设定机械臂当前位置
}
if (PositionEighteen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "18", EighteenX + OperationX, EighteenY + OperationY });//设定机械臂当前位置
}
if (PositionNineteen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "19", NineteenX + OperationX, NineteenY + OperationY });//设定机械臂当前位置
}
//if (PositionEighteen)
//{
// ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "18", EighteenX + OperationX, EighteenY + OperationY });//设定机械臂当前位置
//}
//if (PositionNineteen)
//{
// ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "19", NineteenX + OperationX, NineteenY + OperationY });//设定机械臂当前位置
//}
if (PositionTwenty)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "20", TwentyX + OperationX, TwentyY + OperationY });//设定机械臂当前位置
@@ -948,10 +972,10 @@ namespace BPASmartClient.MorkF.ViewModel
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "26", TwentySixX + OperationX, TwentySixY + OperationY });//设定机械臂当前位置
}
if (PositionTwentySeven)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "27", TwentySevenX + OperationX, TwentySevenY + OperationY });//设定机械臂当前位置
}
//if (PositionTwentySeven)
//{
// ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "27", TwentySevenX + OperationX, TwentySevenY + OperationY });//设定机械臂当前位置
//}
if (PositionMaterialHeight)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "MaterialHeight", MaterialHeightX + OperationX, MaterialHeightY + OperationY });//设定机械臂当前位置
@@ -987,12 +1011,21 @@ namespace BPASmartClient.MorkF.ViewModel
PawToPoint1 = new RelayCommand(() => { ActionManage.GetInstance.Send("PawToPoint1"); });//爪子去1号位
PawToPoint2 = new RelayCommand(() => { ActionManage.GetInstance.Send("PawToPoint2"); });//爪子去2号位
PawToPoint3 = new RelayCommand(() => { ActionManage.GetInstance.Send("PawToPoint3"); });//爪子去3号位
PawTurnFront = new RelayCommand(() => { ActionManage.GetInstance.Send("PawTurnFront"); });//夹爪正转
PawTurnBack = new RelayCommand(() => { ActionManage.GetInstance.Send("PawTurnBack"); });//夹爪反转
PawTurnFront = new RelayCommand(() => {
ActionManage.GetInstance.Send("PawTurnFront");
});//夹爪伸出
PawTurnBack = new RelayCommand(() => {
ActionManage.GetInstance.Send("PawTurnBack");
});//夹爪收缩
GetDistance_1 = new RelayCommand(() => { ActionManage.GetInstance.Send("GetDistance_1"); });//感应距离1
GetDistance_2 = new RelayCommand(() => { ActionManage.GetInstance.Send("GetDistance_2"); });//感应距离2
GetDistance_3 = new RelayCommand(() => { ActionManage.GetInstance.Send("GetDistance_3"); });//感应距离3

SetSpeed = new RelayCommand(() => { ActionManage.GetInstance.Send("SetSpeed", new List<int> { MoveSpeed }); });//速度设定
SetArmPosition = new RelayCommand(() => {
ActionManage.GetInstance.Send("SetArmPosition", new List<int> { SettingX, SettingY });
});//设定移动位置

PhysicalMaterialCoordinate();
ActionManage.GetInstance.Register(new Action<object>((o) =>
{


+ 1
- 1
BPASmartClient.S7Net/SiemensHelper.cs View File

@@ -120,7 +120,7 @@ namespace BPASmartClient.S7Net
}
public void WriteInt16(int db, short txt, int startAddress = 0)
{
var bytes =BitConverter.GetBytes(txt);
var bytes = BitConverter.GetBytes(txt);
myPlc.WriteBytes(DataType.DataBlock, db, startAddress, bytes);

}


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

@@ -22,7 +22,7 @@

<ItemGroup>
<PackageReference Include="BPA.Communication" Version="1.0.36" />
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Helper" Version="1.0.54" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>



+ 8
- 0
BPASmartClient.Update/App.xaml View File

@@ -0,0 +1,8 @@
<Application
x:Class="BPASmartClient.Update.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BPASmartClient.Update"
StartupUri="MainWindow.xaml">
<Application.Resources />
</Application>

+ 17
- 0
BPASmartClient.Update/App.xaml.cs View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.Update
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

+ 10
- 0
BPASmartClient.Update/AssemblyInfo.cs View File

@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

+ 14
- 0
BPASmartClient.Update/BPASmartClient.Update.csproj View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.54" />
</ItemGroup>

</Project>

+ 21
- 0
BPASmartClient.Update/MainViewsModel.cs View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Helper;
using BPASmartClient.Update.Model;

namespace BPASmartClient.Update
{
public class MainViewsModel : NotifyBase
{
public MainViewsModel()
{

}
public UpdateModel um { get { return _mum; } set { _mum = value; OnPropertyChanged(); } }
private UpdateModel _mum = new UpdateModel();

}
}

+ 68
- 0
BPASmartClient.Update/MainWindow.xaml View File

@@ -0,0 +1,68 @@
<Window
x:Class="BPASmartClient.Update.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.Update"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="Update"
Width="600"
Height="400"
mc:Ignorable="d">

<Window.DataContext>
<local:MainViewsModel />
</Window.DataContext>

<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition />
<RowDefinition Height="80"/>
<RowDefinition Height="40" />
</Grid.RowDefinitions>

<TextBlock Grid.Row="0" Text="{Binding um.Version, StringFormat=当前软件版本号:\{0\}}" />
<TextBlock Grid.Row="1" Text="{Binding um.UpgradeVersion, StringFormat=更新软件版本号:\{0\}}" />
<TextBlock
Grid.Row="2"
Text="{Binding um.UpdateDescription}"
TextWrapping="Wrap" />

<Grid Name="grProgressbar" Margin="0 0 0 20" Grid.Row="3">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Name="tb" Text="当前更新进度:1/4" VerticalAlignment="Bottom"/>
<ProgressBar Name="progressbar" Grid.Row="1" Height="15" VerticalAlignment="Center" Minimum="0" Maximum="100" Value="10"/>
</Grid>

<Grid Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button
Name="cancel"
Grid.Column="0"
Width="100"
Background="DeepSkyBlue"
Click="cancel_Click"
BorderThickness="0"
Content="取消更新"
Foreground="#272727" />
<Button
Name="ok"
Grid.Column="1"
Width="100"
Click="ok_Click"
Background="DeepSkyBlue"
BorderThickness="0"
Content="开始更新"
Foreground="#272727" />
</Grid>

</Grid>
</Window>

+ 85
- 0
BPASmartClient.Update/MainWindow.xaml.cs View File

@@ -0,0 +1,85 @@
using BPA.Helper;
using BPASmartClient.Update.Model;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.Update
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.grProgressbar.Visibility = Visibility.Collapsed;
}

private void cancel_Click(object sender, RoutedEventArgs e)
{
this.Close();
}

private async void ok_Click(object sender, RoutedEventArgs e)
{
this.cancel.Visibility = Visibility.Collapsed;
this.grProgressbar.Visibility = Visibility.Visible;
await Task.Run(() =>
{
App.Current.Dispatcher.Invoke(() =>
{
this.progressbar.Value = 25;
this.tb.Text = "当前更新进度:1/4";
});
Thread.Sleep(2000);

App.Current.Dispatcher.Invoke(() =>
{
this.progressbar.Value = 50;
this.tb.Text = "当前更新进度:2/4";
});
Thread.Sleep(1500);

App.Current.Dispatcher.Invoke(() =>
{
this.progressbar.Value = 75;
this.tb.Text = "当前更新进度:3/4";
});
Thread.Sleep(3000);

App.Current.Dispatcher.Invoke(() =>
{
this.progressbar.Value = 100;
this.tb.Text = "当前更新进度:4/4";
});
Thread.Sleep(1500);

App.Current.Dispatcher.Invoke(() =>
{
this.progressbar.Value = 100;
this.tb.Text = "当前更新进度:更新完成";
});
Thread.Sleep(1500);
});
string directory = AppDomain.CurrentDomain.BaseDirectory;
Process.Start($"{directory}BPASmartClient.DosingSystem.exe");
Json<UpdateModel>.Save();
this.Close();
}
}
}

+ 41
- 0
BPASmartClient.Update/Models/UpdateModel.cs View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Helper;

namespace BPASmartClient.Update.Model
{
public class UpdateModel : NotifyBase
{
/// <summary>
/// 软件名称
/// </summary>
public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged(); } }
private string _mName = "味魔方管理系统软件[简称:味魔方] ";


/// <summary>
/// 软件当前版本号
/// </summary>
public string Version { get { return _mVersion; } set { _mVersion = value; OnPropertyChanged(); } }
private string _mVersion = "V1.0.1";


/// <summary>
/// 软件升级版本号
/// </summary>
public string UpgradeVersion { get { return _mUpgradeVersion; } set { _mUpgradeVersion = value; OnPropertyChanged(); } }
private string _mUpgradeVersion = "V1.0.2";


/// <summary>
/// 软件更新说明
/// </summary>
public string UpdateDescription { get { return _mUpdateDescription; } set { _mUpdateDescription = value; OnPropertyChanged(); } }
private string _mUpdateDescription = "下列 Bug 问题已修复:\n1、当在某些语言环境中保存文档后重新打开时,Canvas的缩放级别与文件保存时不同。\n2、删除样本数据后执行“另存为”时,有时无法使用串行打印机打印。\n3、如果显示放大率设置为100%以外的值,有时仅部分显示最小化、最大化和关闭按钮。\n4、其他小Bug。";


}
}

+ 9
- 2
BPASmartClient.ViewModel/FoodMenuViewModel.cs View File

@@ -1,5 +1,6 @@
using BPASmartClient.Helper;
using BPASmartClient.Model;
using BPASmartClient.Model.小炒机;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
@@ -13,17 +14,23 @@ namespace BPASmartClient.ViewModel
{
public class FoodMenuViewModel: ObservableObject
{
public ObservableCollection<FoodMenuModel> FoodMenus { get; set; } = GlobalFoodMenu.LocalFoodMenus;
/// <summary>
/// 菜单
/// </summary>
public ObservableCollection<FoodMenuModel> FoodMenus { get; set; } = new ObservableCollection<FoodMenuModel>();

public RelayCommand<object> StartOrder { get; set; }

public FoodMenuViewModel()
{
Json<MaterialAndFryingTime>.Data.materials?.Keys?.ToList().ForEach(key => FoodMenus.Add(new FoodMenuModel { GoodName = key }));

StartOrder = new RelayCommand<object>((o) =>
{
ActionManage.GetInstance.Send("开始下单", o);
});
}

}
}

+ 45
- 0
BPASmartClient/Control/FoodMenu.xaml View File

@@ -0,0 +1,45 @@
<UserControl
x:Class="Control.FoodMenu"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Control"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Name="FoodMenu1"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="ListBoxItem">
<Setter Property="Margin" Value="2" />
<Setter Property="FontSize" Value="22" />
<Setter Property="FontWeight" Value="Black" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border
Background="Transparent"
BorderBrush="Black"
BorderThickness="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80*" />
<ColumnDefinition Width="20*" />
</Grid.ColumnDefinitions>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid />
</UserControl>

+ 26
- 0
BPASmartClient/Control/FoodMenu.xaml.cs View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Control
{
/// <summary>
/// FoodMenu.xaml 的交互逻辑
/// </summary>
public partial class FoodMenu : UserControl
{
public FoodMenu()
{
InitializeComponent();
}
}
}

+ 5
- 5
BPASmartClient/Control/FoodMenuView.xaml View File

@@ -6,10 +6,8 @@
xmlns:local="clr-namespace:Control"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:FoodMenuViewModel/>
</UserControl.DataContext>
d:DesignHeight="850" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
@@ -23,6 +21,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
<RowDefinition Height="0.6*"/>
</Grid.RowDefinitions>
<Grid HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
@@ -47,11 +46,12 @@
<TextBlock Grid.Column="1" FontSize="18" Text="{Binding GoodName}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Button Grid.Column="2" Width="120" Content="下单" HorizontalAlignment="Center" VerticalAlignment="Center" Height="30"
Command="{Binding DataContext.StartOrder, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}"
CommandParameter="{Binding GoodKey}"/>
CommandParameter="{Binding .}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>


+ 3
- 1
BPASmartClient/Control/FoodMenuView.xaml.cs View File

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.ViewModel;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
@@ -21,6 +22,7 @@ namespace BPASmartClient.Control
public FoodMenuView()
{
InitializeComponent();
this.DataContext = new FoodMenuViewModel();
}
}
}

+ 8
- 0
BPASmartClient/MainWindow.xaml View File

@@ -80,6 +80,14 @@
Content="订单监视"
Cursor="Hand"
Tag="OrderStatusView" />
<Button
Width="120"
Height="40"
Margin="20,0"
Click="MenuItem_Click"
Content="本地菜单"
Cursor="Hand"
Tag="OrderStatusView" />
</StackPanel>
<!--#endregion-->
<Menu x:Name="myMenu" Visibility="Visible">


+ 1
- 0
BPASmartClient/MainWindow.xaml.cs View File

@@ -66,6 +66,7 @@ namespace BPASmartClient
if(res == MessageBoxResult.OK)
{
this.Close();
Application.Current.Shutdown();
}
};


+ 1
- 1
ComputerTestDemo/ComputerTestDemo.csproj View File

@@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="BPA.Communication" Version="1.0.36" />
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Helper" Version="1.0.54" />
</ItemGroup>

<ItemGroup>


+ 55
- 1
DosingSystem/App.xaml.cs View File

@@ -13,6 +13,13 @@ using BPASmartClient.CustomResource.Pages.View;
using BPASmartClient.CustomResource.Pages.ViewModel;
using BPASmartClient.DosingSystem.View;
using BPA.Helper;
using BPASmartClient.DosingSystem.Model;
using System.Diagnostics;
using System.IO;
using BPASmartClient.Update.Model;
using BPASmartClient.DosingSystem.ViewModel;
using System.Drawing;
using System.Windows.Media;

namespace BPASmartClient.DosingSystem
{
@@ -27,6 +34,22 @@ namespace BPASmartClient.DosingSystem
protected override void OnStartup(StartupEventArgs e)
{
bool createNew;
MessageLog.GetInstance.NotifyShow = new Action<string>(o =>
{
DebugLogViewModel.MessageModels.Add(new MessageModel()
{
LogInfo = o,
Forground = System.Windows.Media.Brushes.DeepSkyBlue
});
});
MessageLog.GetInstance.NotifyShowEx = new Action<string>(o =>
{
DebugLogViewModel.MessageModels.Add(new MessageModel()
{
LogInfo = o,
Forground = System.Windows.Media.Brushes.Red
});
});
ProgramStarted = new EventWaitHandle(false, EventResetMode.AutoReset, "DosingSystem", out createNew);
if (!createNew)
{
@@ -38,13 +61,35 @@ namespace BPASmartClient.DosingSystem
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut();
MenuInit();
DataInit();
SiemensTest.GetInstance.Init();
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
MainView mv = new MainView();
mv.TitleName = "味魔方管理系统软件[简称:味魔方] 1.0.1";
mv.TitleName = $"味魔方管理系统软件[简称:味魔方] V1.0.1";
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)
{
#region 更新测试
//string directory = $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\JSON\\UpdateModel.json";
//if (File.Exists(directory))
// mv.TitleName = $"味魔方管理系统软件[简称:味魔方] {Json<UpdateModel>.Data.UpgradeVersion}";
//else
//{
// mv.TitleName = $"味魔方管理系统软件[简称:味魔方] V1.0.1";
// Task.Run(() =>
// {
// Thread.Sleep(3000);
// var tt = MessageNotify.GetInstance.ShowDialog("检测到新版本,请问是否现在更新?", DialogType.Information);
// if (tt)
// {
// string directory = AppDomain.CurrentDomain.BaseDirectory;
// Process.Start($"{directory}BPASmartClient.Update.exe");
// App.Current.Dispatcher.Invoke(() => { mv.Close(); });
// }
// });
//}
#endregion

BPASmartClient.CustomResource.Pages.Model.MessageNotify.GetInstance.ShowUserLog("用户登录");
mv.Show();
}
@@ -148,6 +193,15 @@ namespace BPASmartClient.DosingSystem
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.ConveyerBeltManualView"
});

ManualControl.Add(new SubMenumodel()
{
SubMenuName = "配料输送带控制",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.TempManageControlView"
});

//ManualControl.Add(new SubMenumodel()
//{
// SubMenuName = "料仓控制",


+ 2
- 1
DosingSystem/BPASmartClient.DosingSystem.csproj View File

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

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Helper" Version="1.0.54" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
@@ -30,6 +30,7 @@
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" />
<ProjectReference Include="..\BPASmartClient.S7Net\BPASmartClient.S7Net.csproj" />
<ProjectReference Include="..\BPASmartClient.Update\BPASmartClient.Update.csproj" />
</ItemGroup>

<ItemGroup>


+ 8
- 9
DosingSystem/Model/DeviceInquire.cs View File

@@ -87,14 +87,13 @@ namespace BPASmartClient.DosingSystem
private void TestData()
{

//aa(1, "盐");
//aa(2, "郫县豆瓣");
//aa(3, "芥菜");
//aa(4, "调味剂");
//aa(5, "香料");
//aa(6, "鸡精");
//aa(7, "味精");

aa(1, "盐");
aa(2, "郫县豆瓣");
aa(3, "芥菜");
aa(4, "调味剂");
aa(5, "香料");
aa(6, "鸡精");
aa(7, "味精");
for (int i = 0; i < 8; i++)
{
DeviceLists.TryAdd($"192.168.1.{i + 1}", new DeviceStatus() { DeviceName = $"测试设备{i + 1}" });
@@ -144,7 +143,7 @@ namespace BPASmartClient.DosingSystem
{
if (!string.IsNullOrEmpty(Json<DevicePar>.Data.BaseParModel.NetworkSegAddress)) IPSegment = Json<DevicePar>.Data.BaseParModel.NetworkSegAddress;
else Json<DevicePar>.Data.BaseParModel.NetworkSegAddress = IPSegment;
//TestData();
TestData();
IpAddressLines();
SiemensDevice.GetInstance.Connect(Json<DevicePar>.Data.BaseParModel.DeviceAddress);
DeviceDataInit();


+ 1
- 2
DosingSystem/View/DeviceMaterialParView.xaml View File

@@ -62,8 +62,7 @@
<Style x:Key="InputTextboxStyle" TargetType="TextBox">
<Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Width" Value="150" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Height" Value="40" />
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" />
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" />


+ 99
- 0
DosingSystem/View/TempManageControlView.xaml View File

@@ -0,0 +1,99 @@
<UserControl
x:Class="BPASmartClient.DosingSystem.View.TempManageControlView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:TempManageControlViewModel />
</UserControl.DataContext>

<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<Grid Margin="8">
<Grid
Name="cy"
Grid.Row="0"
Margin="5">
<pry:ImageBorder
Grid.RowSpan="2"
Width="{Binding ElementName=cy, Path=ActualWidth}"
Height="{Binding ElementName=cy, Path=ActualHeight}" />

<StackPanel Background="Transparent">
<Grid Height="40">
<Image
Margin="2,3,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Source="/BPASmartClient.CustomResource;component/Image/标签.png" />
<TextBlock
Margin="10,10,0,0"
VerticalAlignment="Top"
FontSize="16"
Foreground="Aqua"
Text="{Binding Name}" />
<StackPanel
Margin="0,0,20,0"
HorizontalAlignment="Right"
Orientation="Horizontal">
<TextBlock
Margin="0,0,2,0"
Style="{StaticResource TextBlockStyle}"
Text="输送带反转控制" />
<ToggleButton
Width="80"
Height="30"
Margin="5,0,5,0"
Background="Transparent"
FontSize="20"
IsChecked="{Binding Reversal}"
Style="{StaticResource SwitchToggleButtonStyle}" />

<TextBlock
Margin="20,0,5,0"
VerticalAlignment="Center"
FontSize="20"
Foreground="#00c2f4"
Text="输送带正转控制" />

<ToggleButton
Width="80"
Height="30"
Margin="5,0,5,0"
Background="Transparent"
FontSize="20"
IsChecked="{Binding Foreward}"
Style="{StaticResource SwitchToggleButtonStyle}" />

</StackPanel>

</Grid>
<Grid Name="gr" Height="200">
<pry:ConveyBelt2
Grid.RowSpan="4"
Margin="-12,0,10,0"
BeltDashThickess="50"
BeltDirection="{Binding BeltDirection}"
BeltHeight="{Binding ElementName=gr, Path=ActualHeight}"
BeltWidth="{Binding ElementName=gr, Path=ActualWidth}"
IsRun="{Binding IsRun}" />
</Grid>
</StackPanel>
</Grid>
</Grid>

</Grid>
</UserControl>

+ 28
- 0
DosingSystem/View/TempManageControlView.xaml.cs View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.DosingSystem.View
{
/// <summary>
/// TempManageControlView.xaml 的交互逻辑
/// </summary>
public partial class TempManageControlView : UserControl
{
public TempManageControlView()
{
InitializeComponent();
}
}
}

+ 115
- 0
DosingSystem/ViewModel/TempManageControlViewModel.cs View File

@@ -0,0 +1,115 @@
using BPA.Helper;
using BPASmartClient.S7Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace BPASmartClient.DosingSystem.ViewModel
{
public class TempManageControlViewModel : NotifyBase
{
public TempManageControlViewModel()
{

}

/// <summary>
/// 正转
/// </summary>
public bool Foreward
{
get { return _mForeward; }
set
{
_mForeward = value;
BeltDirection = 0;
IsRun = _mForeward;
OnPropertyChanged();
Task.Factory.StartNew(() =>
{
if (Reversal || !_mForeward)
{
SiemensTest.GetInstance.sh.Write("M1000.1", true);
Thread.Sleep(2000);
SiemensTest.GetInstance.sh.Write("M1000.1", false);
}
if (_mForeward)
{
SiemensTest.GetInstance.sh.Write("M1000.0", true);
Thread.Sleep(2000);
SiemensTest.GetInstance.sh.Write("M1000.0", false);
}
});
}
}
private bool _mForeward;

/// <summary>
/// 反转
/// </summary>
public bool Reversal
{
get { return _mReversal; }
set
{
_mReversal = value;
BeltDirection = 1;
IsRun = _mReversal;
OnPropertyChanged();
Task.Factory.StartNew(() =>
{
if (Foreward || !_mReversal)
{
SiemensTest.GetInstance.sh.Write("M1000.1", true);
Thread.Sleep(2000);
SiemensTest.GetInstance.sh.Write("M1000.1", false);
}
if (_mReversal)
{
SiemensTest.GetInstance.sh.Write("M1000.3", true);
Thread.Sleep(2000);
SiemensTest.GetInstance.sh.Write("M1000.3", false);
}
});
}
}
private bool _mReversal;

public bool IsRun { get { return _mIsRun; } set { _mIsRun = value; OnPropertyChanged(); } }
private bool _mIsRun;


public int BeltDirection { get { return _mBeltDirection; } set { _mBeltDirection = value; OnPropertyChanged(); } }
private int _mBeltDirection;

}

public class SiemensTest
{

private volatile static SiemensTest _Instance;
public static SiemensTest GetInstance => _Instance ?? (_Instance = new SiemensTest());
private SiemensTest() { }

public SiemensHelper sh { get; set; } = new SiemensHelper();

public void Init()
{
Task.Run(() =>
{
//sh.Connect(S7.Net.CpuType.S71500, "192.168.1.12");
sh.Connect(S7.Net.CpuType.S71200, "192.168.0.15");
if (sh.IsConnected)
MessageLog.GetInstance.Show("西门子PLC连接成功");
else
MessageLog.GetInstance.Show("西门子PLC连接失败");
});
//sh.Connect(S7.Net.CpuType.S71500, "192.168.1.12");
//sh.Connect(S7.Net.CpuType.S71200, "192.168.0.15");
}

}
}

+ 23
- 0
SmartClient.sln View File

@@ -212,6 +212,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.RobotGripper
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MilkTeaCube", "BPASmartClient.MilkTeaCube\BPASmartClient.MilkTeaCube.csproj", "{915F0718-B7AC-428D-ACD5-7DAACC28539F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.Update", "BPASmartClient.Update\BPASmartClient.Update.csproj", "{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -1986,6 +1988,26 @@ Global
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Release|x64.Build.0 = Release|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Release|x86.ActiveCfg = Release|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Release|x86.Build.0 = Release|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Debug|ARM.ActiveCfg = Debug|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Debug|ARM.Build.0 = Debug|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Debug|ARM64.Build.0 = Debug|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Debug|x64.ActiveCfg = Debug|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Debug|x64.Build.0 = Debug|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Debug|x86.ActiveCfg = Debug|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Debug|x86.Build.0 = Debug|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Release|Any CPU.Build.0 = Release|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Release|ARM.ActiveCfg = Release|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Release|ARM.Build.0 = Release|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Release|ARM64.ActiveCfg = Release|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Release|ARM64.Build.0 = Release|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Release|x64.ActiveCfg = Release|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Release|x64.Build.0 = Release|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Release|x86.ActiveCfg = Release|Any CPU
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -2084,6 +2106,7 @@ Global
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
{915F0718-B7AC-428D-ACD5-7DAACC28539F} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
{CB3E9835-2FF2-4A76-A0EE-0819EEC8CAE7} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}


+ 7
- 8
WpfApp1/App.xaml View File

@@ -1,9 +1,8 @@
<Application x:Class="WpfApp1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApp1"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
<Application
x:Class="WpfApp1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApp1"
StartupUri="MainWindow.xaml">
<Application.Resources />
</Application>

+ 26
- 9
WpfApp1/MainWindow.xaml View File

@@ -1,12 +1,29 @@
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Window
x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WpfApp1"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="MainWindow"
Width="800"
Height="450"
mc:Ignorable="d">
<Grid>

<Button
Width="100"
Height="30"
Margin="36,24,664,381"
Content="连接" Click="Button_Click" />
<Button
Width="100"
Height="30"
Margin="167,24,533,381"
Content="上电" Click="Button_Click_1" />
<Button
Width="100"
Height="30"
Margin="300,24,400,381"
Content="使能" Click="Button_Click_2" />
</Grid>
</Window>

+ 75
- 54
WpfApp1/MainWindow.xaml.cs View File

@@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using BPASmartClient.JakaRobot;
using BPASmartClient.S7Net;

namespace WpfApp1
@@ -24,67 +25,87 @@ namespace WpfApp1
public MainWindow()
{
InitializeComponent();
SiemensHelper siemensHelper = new SiemensHelper();
siemensHelper.Connect(S7.Net.CpuType.S71200, "192.168.101.16");
if (siemensHelper.IsConnected)
{
siemensHelper.WriteString(S7.Net.DataType.DataBlock, 1, 0, "cccc");
var res = siemensHelper.ReadClass<XL_Start_DB>(1);
//SiemensHelper siemensHelper = new SiemensHelper();
//siemensHelper.Connect(S7.Net.CpuType.S71200, "192.168.101.16");
//if (siemensHelper.IsConnected)
//{
// siemensHelper.WriteString(S7.Net.DataType.DataBlock, 1, 0, "cccc");
// var res = siemensHelper.ReadClass<XL_Start_DB>(1);

//XL_Start_DB xL_Start_DB = new XL_Start_DB();
//xL_Start_DB.RecipeCode = "编码";
//xL_Start_DB.RecipeName = "名称";
//xL_Start_DB.StockCode = 1;
//xL_Start_DB.TrayCode = 2;
//for (int i = 0; i < xL_Start_DB.Powder.Length; i++)
//{
// xL_Start_DB.Powder[i].Powder_Name = $"料{i}";
// xL_Start_DB.Powder[i].Powder_Weight = (float)(5.0 + i);
//}
//for (int i = 0; i < xL_Start_DB.Material.Length; i++)
//{
// xL_Start_DB.Material[i].Material_Name = $"原料{i}";
// xL_Start_DB.Material[i].Material_Weight = (float)(50.0 + i);
// xL_Start_DB.Material[i].Material_BarrelNum = (short)(i + 1);
//}
//xL_Start_DB.Order_Request_ACK = true;
//xL_Start_DB.Order_Request = true;
// //XL_Start_DB xL_Start_DB = new XL_Start_DB();
// //xL_Start_DB.RecipeCode = "编码";
// //xL_Start_DB.RecipeName = "名称";
// //xL_Start_DB.StockCode = 1;
// //xL_Start_DB.TrayCode = 2;
// //for (int i = 0; i < xL_Start_DB.Powder.Length; i++)
// //{
// // xL_Start_DB.Powder[i].Powder_Name = $"料{i}";
// // xL_Start_DB.Powder[i].Powder_Weight = (float)(5.0 + i);
// //}
// //for (int i = 0; i < xL_Start_DB.Material.Length; i++)
// //{
// // xL_Start_DB.Material[i].Material_Name = $"原料{i}";
// // xL_Start_DB.Material[i].Material_Weight = (float)(50.0 + i);
// // xL_Start_DB.Material[i].Material_BarrelNum = (short)(i + 1);
// //}
// //xL_Start_DB.Order_Request_ACK = true;
// //xL_Start_DB.Order_Request = true;

//for (int i = 0; i < xL_Start_DB.Standby.Length; i++)
//{
// xL_Start_DB.Standby[i] = (short)(i + 100);
// xL_Start_DB.Standby1[i] = (short)(i + 300);
//}
// //for (int i = 0; i < xL_Start_DB.Standby.Length; i++)
// //{
// // xL_Start_DB.Standby[i] = (short)(i + 100);
// // xL_Start_DB.Standby1[i] = (short)(i + 300);
// //}

res.RecipeCode = "";
res.RecipeName = "";
res.StockCode = 0;
res.TrayCode = 0;
for (int i = 0; i < res.Powder.Length; i++)
{
res.Powder[i].Powder_Name = "";
res.Powder[i].Powder_Weight = 0;
}
for (int i = 0; i < res.Material.Length; i++)
{
res.Material[i].Material_Name = "";
res.Material[i].Material_Weight = 0;
res.Material[i].Material_BarrelNum = 0;
}
res.Order_Request_ACK = false;
res.Order_Request = false;
// res.RecipeCode = "";
// res.RecipeName = "";
// res.StockCode = 0;
// res.TrayCode = 0;
// for (int i = 0; i < res.Powder.Length; i++)
// {
// res.Powder[i].Powder_Name = "";
// res.Powder[i].Powder_Weight = 0;
// }
// for (int i = 0; i < res.Material.Length; i++)
// {
// res.Material[i].Material_Name = "";
// res.Material[i].Material_Weight = 0;
// res.Material[i].Material_BarrelNum = 0;
// }
// res.Order_Request_ACK = false;
// res.Order_Request = false;

for (int i = 0; i < res.Standby.Length; i++)
{
res.Standby[i] = 0;
res.Standby1[i] = 0;
}
// for (int i = 0; i < res.Standby.Length; i++)
// {
// res.Standby[i] = 0;
// res.Standby1[i] = 0;
// }

siemensHelper.WriteClass<XL_Start_DB>(res, 1);
// siemensHelper.WriteClass<XL_Start_DB>(res, 1);

var res1 = siemensHelper.ReadClass<XL_Start_DB>(1);
}
// var res1 = siemensHelper.ReadClass<XL_Start_DB>(1);
//}

}

JaKaHelper jaKaHelper = new JaKaHelper();

private void Button_Click(object sender, RoutedEventArgs e)
{
jaKaHelper.Conn("192.168.0.12");
MessageBox.Show($"连接成功,{jaKaHelper.rshd}");
}

private void Button_Click_1(object sender, RoutedEventArgs e)
{
jaKaHelper.Power_On();
MessageBox.Show($"上电成功,{jaKaHelper.rshd}");
}

private void Button_Click_2(object sender, RoutedEventArgs e)
{
jaKaHelper.Enable_robot();
MessageBox.Show($"使能成功,{jaKaHelper.rshd}");
}
}
}

+ 1
- 0
WpfApp1/WpfApp1.csproj View File

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

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.JakaRobot\BPASmartClient.JakaRobot.csproj" />
<ProjectReference Include="..\BPASmartClient.S7Net\BPASmartClient.S7Net.csproj" />
</ItemGroup>



Loading…
Cancel
Save