pry пре 2 година
родитељ
комит
a4097c05e9
44 измењених фајлова са 2164 додато и 723 уклоњено
  1. +2
    -1
      BPASmartClient.Helper/ActionManage.cs
  2. +9
    -1
      BPASmartClient.JXJFoodBigStation/App.xaml.cs
  3. +34
    -3
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Read.cs
  4. +1
    -0
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
  5. +18
    -0
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/PlcCommAttribute.cs
  6. +14
    -14
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/StockBinName.cs
  7. +32
    -0
      BPASmartClient.JXJFoodBigStation/Model/PlcVarMonitor.cs
  8. +583
    -115
      BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
  9. +155
    -0
      BPASmartClient.JXJFoodBigStation/View/HKPlcCommMonitorView.xaml
  10. +28
    -0
      BPASmartClient.JXJFoodBigStation/View/HKPlcCommMonitorView.xaml.cs
  11. +2
    -2
      BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml
  12. +1
    -4
      BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml
  13. +131
    -0
      BPASmartClient.JXJFoodBigStation/ViewModel/HKPlcCommMonitorViewModel.cs
  14. +4
    -8
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs
  15. +23
    -9
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs
  16. +1
    -0
      BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
  17. +1
    -1
      BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs
  18. +2
    -2
      BPASmartClient.JXJFoodSmallStation/ViewModel/DeviceListViewModel.cs
  19. +1
    -0
      BPASmartClient.Model/大炒/FryPotMessages.cs
  20. +147
    -86
      BPASmartClient.MorkBF/Control_MorkBF.cs
  21. +19
    -1
      BPASmartClient.MorkBF/GVL_MorkBF.cs
  22. +11
    -13
      BPASmartClient.MorkBF/VIew/DebugView.xaml
  23. +7
    -0
      BPASmartClient.MorkBF/VIew/FoodManagerView.xaml
  24. +68
    -0
      BPASmartClient.MorkBF/VIew/MenuView.xaml
  25. +36
    -0
      BPASmartClient.MorkBF/VIew/MenuView.xaml.cs
  26. +13
    -35
      BPASmartClient.MorkBF/ViewModel/DebugViewModel.cs
  27. +4
    -3
      BPASmartClient.MorkBF/ViewModel/FoodManagerViewModel.cs
  28. +62
    -0
      BPASmartClient.MorkBF/ViewModel/MenuViewModel.cs
  29. +639
    -359
      BPASmartClient.MorkF/Control_MorkF.cs
  30. +1
    -11
      BPASmartClient.MorkF/ML_MorkF.cs
  31. +9
    -8
      BPASmartClient.MorkF/MaterialOperation.cs
  32. +8
    -8
      BPASmartClient.MorkF/View/DebugView.xaml
  33. +7
    -1
      BPASmartClient.MorkF/ViewModel/DebugViewModel.cs
  34. +6
    -1
      BPASmartClient.S7Net/SiemensHelper.cs
  35. +1
    -1
      BPASmartClient.ScreenLib/BPASmartClient.ScreenLib.csproj
  36. +4
    -4
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml
  37. +4
    -4
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml
  38. +4
    -4
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3.xaml
  39. +16
    -8
      BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml
  40. +1
    -1
      BPASmartClient.ScreenSplitMeals/App.config
  41. +34
    -0
      BeDesignerSCADA/Converters/MathAbsConverter.cs
  42. +0
    -4
      DosingSystem/ViewModel/NewRecipeViewModel.cs
  43. +20
    -10
      WpfTest/MainWindow.xaml.cs
  44. +1
    -1
      WpfTest/WpfTest.csproj

+ 2
- 1
BPASmartClient.Helper/ActionManage.cs Прегледај датотеку

@@ -44,7 +44,8 @@ namespace BPASmartClient.Helper
public void Send(string key, object par, Action Callback = null)
{
lock (SendLock)
if (actions.ContainsKey(key)) actions[key].ActionPar.Invoke(par, Callback);
if (actions.ContainsKey(key))
actions[key].ActionPar.Invoke(par, Callback);
}

public async void SendAsync(string key, object par, Action Callback = null)


+ 9
- 1
BPASmartClient.JXJFoodBigStation/App.xaml.cs Прегледај датотеку

@@ -27,8 +27,8 @@ namespace BPASmartClient.JXJFoodBigStation
base.OnStartup(e);
MenuInit();
DataInit();
ProcessControl.GetInstance.Init();
MainView mv = new MainView();
ProcessControl.GetInstance.Init();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)
@@ -134,6 +134,14 @@ namespace BPASmartClient.JXJFoodBigStation
AssemblyName = "BPASmartClient.JXJFoodBigStation",
ToggleWindowPath = "View.HardwareStatusView"
});
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "通讯状态",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.JXJFoodBigStation",
ToggleWindowPath = "View.HKPlcCommMonitorView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "",


+ 34
- 3
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Read.cs Прегледај датотеку

@@ -8,55 +8,86 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
public class DB_Read
{
[PlcComm("plc心跳上报")]
/// <summary>
/// plc心跳上报
/// </summary>
public bool HeartBeat { get; set; }
[PlcComm("配方1允许下发配方")]
/// <summary>
/// 配方1允许下发配方
/// </summary>
public bool IsAllowIssueRecipe1 { get; set; }

[PlcComm("配方2允许下发配方")]
public bool IsAllowIssueRecipe2 { get; set; }

[PlcComm("配方3允许下发配方")]
public bool IsAllowIssueRecipe3 { get; set; }

[PlcComm("配方4允许下发配方")]
public bool IsAllowIssueRecipe4 { get; set; }

[PlcComm("配方1接收配方完成")]
/// <summary>
/// 配方1 接收配方完成
/// </summary>
public bool ReceiveFinishRecipe1 { get; set; }
[PlcComm("配方2接收配方完成")]
public bool ReceiveFinishRecipe2 { get; set; }
[PlcComm("配方3接收配方完成")]
public bool ReceiveFinishRecipe3 { get; set; }
[PlcComm("配方4接收配方完成")]
public bool ReceiveFinishRecipe4 { get; set; }
[PlcComm("配方1配料完成")]
/// <summary>
/// 配方1 配料完成
/// </summary>
public bool Recipe1DosingFinish { get; set; }
[PlcComm("配方2配料完成")]
public bool Recipe2DosingFinish { get; set; }
[PlcComm("配方3配料完成")]
public bool Recipe3DosingFinish { get; set; }
[PlcComm("配方4配料完成")]
public bool Recipe4DosingFinish { get; set; }
[PlcComm("配方1托盘编号")]
/// <summary>
/// 配方1 托盘编号
/// </summary>
public short Recipe1TrayCode { get; set; }
[PlcComm("配方2托盘编号")]
public short Recipe2TrayCode { get; set; }
[PlcComm("配方3托盘编号")]
public short Recipe3TrayCode { get; set; }
[PlcComm("配方4托盘编号")]
public short Recipe4TrayCode { get; set; }
[PlcComm("料仓1实际下料重量")]
public float StockBin1ActualWeight { get; set; }
[PlcComm("料仓2实际下料重量")]
public float StockBin2ActualWeight { get; set; }
[PlcComm("料仓3实际下料重量")]
public float StockBin3ActualWeight { get; set; }
[PlcComm("料仓4实际下料重量")]
public float StockBin4ActualWeight { get; set; }
[PlcComm("料仓5实际下料重量")]
public float StockBin5ActualWeight { get; set; }
[PlcComm("料仓6实际下料重量")]
public float StockBin6ActualWeight { get; set; }
[PlcComm("料仓7实际下料重量")]
public float StockBin7ActualWeight { get; set; }
[PlcComm("料仓8实际下料重量")]
public float StockBin8ActualWeight { get; set; }
[PlcComm("料仓9实际下料重量")]
public float StockBin9ActualWeight { get; set; }
[PlcComm("料仓10实际下料重量")]
public float StockBin10ActualWeight { get; set; }
[PlcComm("料仓11实际下料重量")]
public float StockBin11ActualWeight { get; set; }
[PlcComm("料仓12实际下料重量")]
public float StockBin12ActualWeight { get; set; }
[PlcComm("料仓13实际下料重量")]
public float StockBin13ActualWeight { get; set; }
[PlcComm("料仓14实际下料重量")]
public float StockBin14ActualWeight { get; set; }
}
}

+ 1
- 0
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs Прегледај датотеку

@@ -30,6 +30,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
if (res1 != null && res1 is DB_Read data1)
{
PlcRead = data1;
GVL_BigStation.HeartBeatFromPlc = data1.HeartBeat;//读取plc心跳
}
if (res2 != null && res2 is StockBinName data2)
{


+ 18
- 0
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/PlcCommAttribute.cs Прегледај датотеку

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

namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
[AttributeUsage(AttributeTargets.Property)]
public sealed class PlcCommAttribute:Attribute
{
public PlcCommAttribute(string describe)
{
Describe = describe;
}
public string Describe { get; set; }
}
}

+ 14
- 14
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/StockBinName.cs Прегледај датотеку

@@ -10,32 +10,32 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
public class StockBinName
{
[Siemens(6)]
public string RawMaterialName1 { get; set; }
public string RawMaterialName1 { get; set; } = "";
[Siemens(6)]
public string RawMaterialName2 { get; set; }
public string RawMaterialName2 { get; set; } = "";
[Siemens(6)]
public string RawMaterialName3 { get; set; }
public string RawMaterialName3 { get; set; } = "";
[Siemens(6)]
public string RawMaterialName4 { get; set; }
public string RawMaterialName4 { get; set; } = "";
[Siemens(6)]
public string RawMaterialName5 { get; set; }
public string RawMaterialName5 { get; set; } = "";
[Siemens(6)]
public string RawMaterialName6 { get; set; }
public string RawMaterialName6 { get; set; } = "";
[Siemens(6)]
public string RawMaterialName7 { get; set; }
public string RawMaterialName7 { get; set; } = "";
[Siemens(6)]
public string RawMaterialName8 { get; set; }
public string RawMaterialName8 { get; set; } = "";
[Siemens(6)]
public string RawMaterialName9 { get; set; }
public string RawMaterialName9 { get; set; } = "";
[Siemens(6)]
public string RawMaterialName10 { get; set; }
public string RawMaterialName10 { get; set; } = "";
[Siemens(6)]
public string RawMaterialName11 { get; set; }
public string RawMaterialName11 { get; set; } = "";
[Siemens(6)]
public string RawMaterialName12 { get; set; }
public string RawMaterialName12 { get; set; } = "";
[Siemens(6)]
public string RawMaterialName13 { get; set; }
public string RawMaterialName13 { get; set; } = "";
[Siemens(6)]
public string RawMaterialName14 { get; set; }
public string RawMaterialName14 { get; set; } = "";
}
}

+ 32
- 0
BPASmartClient.JXJFoodBigStation/Model/PlcVarMonitor.cs Прегледај датотеку

@@ -0,0 +1,32 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodBigStation.Model
{
public class PlcVarMonitor: ObservableObject
{
private int _serialNum;
public int SerialNum { get { return _serialNum; } set { _serialNum = value;OnPropertyChanged(); } }

private string _variable;
public string Variable { get { return _variable; } set { _variable = value; OnPropertyChanged(); } }

private string _address;
public string Address { get { return _address; } set { _address = value; OnPropertyChanged(); } }

private string _type;
public string Type { get { return _type; } set { _type = value; OnPropertyChanged(); } }

private string _describe;
public string Describe { get { return _describe; } set { _describe = value; OnPropertyChanged(); } }

private string _nowValue;
public string NowValue { get { return _nowValue; } set { _nowValue = value; OnPropertyChanged(); } }
private string _setValue;
public string SetValue { get { return _setValue; } set { _setValue = value; OnPropertyChanged(); } }
}
}

+ 583
- 115
BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs Прегледај датотеку

@@ -24,27 +24,47 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public HKDeviceStatus HKDevice = new HKDeviceStatus();
DL_Finish_DB FinishData = new DL_Finish_DB();
/// <summary>
/// 配方数据
/// 西门子配方数据
/// </summary>
public ObservableCollection<RecipeData> Recipes = new ObservableCollection<RecipeData>();
public ObservableCollection<RecipeData> SiemensRecipes = new ObservableCollection<RecipeData>();
/// <summary>
/// 配方数据
/// 本地配方数据
/// </summary>
public ObservableCollection<RecipeData> IssuedComplete = new ObservableCollection<RecipeData>();
public ObservableCollection<RecipeData> LocalRecipes = new ObservableCollection<RecipeData>();

/// <summary>
/// 配方等待执行
/// </summary>
public ObservableCollection<RecipeData> RecipeWaitExecute = new ObservableCollection<RecipeData>();
/// <summary>
/// 配方正在执行
/// </summary>
public ObservableCollection<RecipeData> RecipeExecuting = new ObservableCollection<RecipeData>();
/// <summary>
/// 配方执行完成
/// </summary>
public ObservableCollection<RecipeData> RecipeExecuteComple = new ObservableCollection<RecipeData>();
/// <summary>
/// 原料的名称和料仓的位置对应
/// </summary>
public Dictionary<string, short> RawMaterialsNamePos = new Dictionary<string, short>();
/// <summary>
/// 配方队列
/// 西门子配方队列
/// </summary>
public ConcurrentQueue<string> RecipeQueue1 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> RecipeQueue2 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> RecipeQueue3 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> RecipeQueue4 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> SiemensRecipeQueue1 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> SiemensRecipeQueue2 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> SiemensRecipeQueue3 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> SiemensRecipeQueue4 = new ConcurrentQueue<string>();
/// <summary>
/// 本地配方队列
/// </summary>
public ConcurrentQueue<string> LocalRecipeQueue1 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> LocalRecipeQueue2 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> LocalRecipeQueue3 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> LocalRecipeQueue4 = new ConcurrentQueue<string>();
public void Init()
{
testData();
testRawMaterialNameData();//自定义料仓名称
ActionManage.GetInstance.CancelRegister("SiemensSendRecipe");
ActionManage.GetInstance.Register(new Action<object>((res) =>
{
@@ -68,7 +88,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
else
{
//报警,配方的原料名称下发和设备不一致
MessageNotify.GetInstance.ShowAlarmLog($"本地原料名称和西门子下发的原料名称无法对应,原料位置:{i}");
}
}
App.Current.Dispatcher.Invoke(() =>
@@ -89,13 +109,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model
try
{
//HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71500, HK_PLC_IP);
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP);
//SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP);
if (HKDevice.IsConnected)
{
HKDevice.Init();
MessageNotify.GetInstance.ShowRunLog("海科plc连接成功");
}
if (SiemensDevice.IsConnected || true)
if (SiemensDevice.IsConnected)
{
SiemensDevice.Init();
MessageNotify.GetInstance.ShowRunLog("西门子plc连接成功");
@@ -105,39 +125,480 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{

}
RecipeQueue1.Clear();
RecipeQueue2.Clear();
RecipeQueue3.Clear();
RecipeQueue4.Clear();
LocalRecipeQueue1.Clear();
LocalRecipeQueue2.Clear();
LocalRecipeQueue3.Clear();
LocalRecipeQueue4.Clear();
SiemensRecipeQueue1.Clear();
SiemensRecipeQueue2.Clear();
SiemensRecipeQueue3.Clear();
SiemensRecipeQueue4.Clear();
ThreadManage.GetInstance().StartLong(new Action(() =>
{
SystemStatus();
ReceviceData();
RecipeInfoToHKPLC();
Thread.Sleep(10);
}), "流程处理", true);
}), "西门子配方执行流程", true);
ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (GVL_BigStation.IsUseLocalRecipe)
{
LocalRecipeRecevice();
LocalRecipeDosing();
}
Thread.Sleep(10);
}), "本地配方执行流程", true);
}
private void SystemStatus()
{
GVL_BigStation.HeartBeatFromPlc = HKDevice.PlcRead.HeartBeat;//读取plc心跳
private void LocalRecipeRecevice()
{
if (LocalRecipes.Count > 0)
{
foreach (var data in LocalRecipes)
{
if (LocalRecipeQueue1.Count == 0 && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode))
{
if (!(LocalRecipeQueue1.Contains(data.RecipeCode)))
{
LocalRecipeQueue1.Enqueue(data.RecipeCode);
}
}
else if (LocalRecipeQueue2.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode))
{
if (!(LocalRecipeQueue2.Contains(data.RecipeCode)))
{
LocalRecipeQueue2.Enqueue(data.RecipeCode);
}
}
else if (LocalRecipeQueue3.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode))
{
if (!(LocalRecipeQueue3.Contains(data.RecipeCode)))
{
LocalRecipeQueue3.Enqueue(data.RecipeCode);
}
}
else if (LocalRecipeQueue4.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode))
{
if (!(LocalRecipeQueue4.Contains(data.RecipeCode)))
{
LocalRecipeQueue4.Enqueue(data.RecipeCode);
}
}
}
}
else
{
LocalRecipeQueue1.Clear();
LocalRecipeQueue2.Clear();
LocalRecipeQueue3.Clear();
LocalRecipeQueue4.Clear();
GVL_BigStation.Recipe1DosingStatus = 0;
GVL_BigStation.Recipe2DosingStatus = 0;
GVL_BigStation.Recipe3DosingStatus = 0;
GVL_BigStation.Recipe4DosingStatus = 0;
}
}
private void ReceviceData()
private void LocalRecipeDosing()
{
if (!GVL_BigStation.IsUseLocalRecipe && Recipes.Count == 0)//一个配方执行完成后,再获取配方数据
if (LocalRecipeQueue1.Count > 0)
{
int index = Array.FindIndex(LocalRecipes.ToArray(), p => p.RecipeCode == LocalRecipeQueue1.ElementAt(0));
if (index >= 0 && index < LocalRecipes.Count)
{
string code = LocalRecipes.ElementAt(index).RecipeCode;
int trayCode = LocalRecipes.ElementAt(index).TrayCode;
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0)//配方1是否允许下发配发
{
HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.PlcWrite.Recipe1IssuedFinish = true;
GVL_BigStation.Recipe1DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
if (HKDevice.PlcRead.ReceiveFinishRecipe1 && GVL_BigStation.Recipe1DosingStatus == 1)
{
GVL_BigStation.Recipe1DosingStatus = 2;
HKDevice.PlcWrite.Recipe1IssuedFinish = false;
StockBinParReset();
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
}
if (GVL_BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish)
{
GVL_BigStation.Recipe1DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
if (HKDevice.PlcRead.Recipe1TrayCode == 1)
{
foreach (var item in LocalRecipes.ElementAt(index).RawMaterial)
{
if (item.RawMaterialLocation == 1)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
}
else if (item.RawMaterialLocation == 2)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
}
else if (item.RawMaterialLocation == 3)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
}
else if (item.RawMaterialLocation == 4)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
}
else if (item.RawMaterialLocation == 5)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
}
else if (item.RawMaterialLocation == 6)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
}
else if (item.RawMaterialLocation == 7)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
}
else if (item.RawMaterialLocation == 8)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
}
else if (item.RawMaterialLocation == 9)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
}
else if (item.RawMaterialLocation == 10)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
}
else if (item.RawMaterialLocation == 11)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
}
else if (item.RawMaterialLocation == 12)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
}
else if (item.RawMaterialLocation == 13)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
}
else if (item.RawMaterialLocation == 14)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
}
}
}
LocalRecipeQueue1.TryDequeue(out code);
RecipeExecuteComple.Add(LocalRecipes.ElementAt(index));//将配方添加到完成列表
//App.Current.Dispatcher.Invoke(() => {
// Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
//});
LocalRecipes.RemoveAt(index);
GVL_BigStation.Recipe1DosingStatus = 0;
}
}
}
if (LocalRecipeQueue2.Count > 0)
{
int index = Array.FindIndex(LocalRecipes.ToArray(), p => p.RecipeCode == LocalRecipeQueue2.ElementAt(0));
if (index >= 0 && index < LocalRecipes.Count)
{
string code = LocalRecipes.ElementAt(index).RecipeCode;
int trayCode = LocalRecipes.ElementAt(index).TrayCode;
if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0)//配方2是否允许下发配发
{
HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.PlcWrite.Recipe2IssuedFinish = true;
GVL_BigStation.Recipe2DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
if (HKDevice.PlcRead.ReceiveFinishRecipe2 && GVL_BigStation.Recipe2DosingStatus == 1)
{
GVL_BigStation.Recipe2DosingStatus = 2;
HKDevice.PlcWrite.Recipe2IssuedFinish = false;
StockBinParReset();
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料");
}
if (GVL_BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish)
{
GVL_BigStation.Recipe2DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
if (HKDevice.PlcRead.Recipe2TrayCode > 0)
{
foreach (var item in LocalRecipes.ElementAt(index).RawMaterial)
{
if (item.RawMaterialLocation == 1)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
}
else if (item.RawMaterialLocation == 2)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
}
else if (item.RawMaterialLocation == 3)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
}
else if (item.RawMaterialLocation == 4)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
}
else if (item.RawMaterialLocation == 5)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
}
else if (item.RawMaterialLocation == 6)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
}
else if (item.RawMaterialLocation == 7)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
}
else if (item.RawMaterialLocation == 8)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
}
else if (item.RawMaterialLocation == 9)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
}
else if (item.RawMaterialLocation == 10)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
}
else if (item.RawMaterialLocation == 11)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
}
else if (item.RawMaterialLocation == 12)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
}
else if (item.RawMaterialLocation == 13)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
}
else if (item.RawMaterialLocation == 14)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
}
}
}
LocalRecipeQueue2.TryDequeue(out code);
RecipeExecuteComple.Add(LocalRecipes.ElementAt(index));//将该配方添加到下
//App.Current.Dispatcher.Invoke(() => {
// Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
//});
LocalRecipes.RemoveAt(index);
GVL_BigStation.Recipe2DosingStatus = 0;
}
}
}
if (LocalRecipeQueue3.Count > 0)
{
Recipes = Json<RemoteRecipe>.Data.Recipes;
int index = Array.FindIndex(LocalRecipes.ToArray(), p => p.RecipeCode == LocalRecipeQueue3.ElementAt(0));
if (index >= 0 && index < LocalRecipes.Count)
{
string code = LocalRecipes.ElementAt(index).RecipeCode;
int trayCode = LocalRecipes.ElementAt(index).TrayCode;
if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0)//配方3是否允许下发配发
{
HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.PlcWrite.Recipe3IssuedFinish = true;
GVL_BigStation.Recipe3DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
if (HKDevice.PlcRead.ReceiveFinishRecipe3 && GVL_BigStation.Recipe3DosingStatus == 1)
{
GVL_BigStation.Recipe3DosingStatus = 2;
StockBinParReset();
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料");
}
if (HKDevice.PlcRead.Recipe3DosingFinish && GVL_BigStation.Recipe3DosingStatus == 2)
{
GVL_BigStation.Recipe3DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
if (HKDevice.PlcRead.Recipe3TrayCode > 0)
{
foreach (var item in LocalRecipes.ElementAt(index).RawMaterial)
{
if (item.RawMaterialLocation == 1)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
}
else if (item.RawMaterialLocation == 2)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
}
else if (item.RawMaterialLocation == 3)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
}
else if (item.RawMaterialLocation == 4)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
}
else if (item.RawMaterialLocation == 5)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
}
else if (item.RawMaterialLocation == 6)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
}
else if (item.RawMaterialLocation == 7)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
}
else if (item.RawMaterialLocation == 8)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
}
else if (item.RawMaterialLocation == 9)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
}
else if (item.RawMaterialLocation == 10)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
}
else if (item.RawMaterialLocation == 11)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
}
else if (item.RawMaterialLocation == 12)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
}
else if (item.RawMaterialLocation == 13)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
}
else if (item.RawMaterialLocation == 14)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
}
}
}
HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.1", false);
LocalRecipeQueue3.TryDequeue(out code);
RecipeExecuteComple.Add(LocalRecipes.ElementAt(index));//将该配方添加到下
//App.Current.Dispatcher.Invoke(() => {
// Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
//});
LocalRecipes.RemoveAt(index);
GVL_BigStation.Recipe3DosingStatus = 0;
}
}
}
else if (GVL_BigStation.IsUseLocalRecipe && Recipes.Count == 0)
if (LocalRecipeQueue4.Count > 0)
{
Recipes = Json<LocalRecipe>.Data.Recipes;
int index = Array.FindIndex(LocalRecipes.ToArray(), p => p.RecipeCode == LocalRecipeQueue4.ElementAt(0));
if (index >= 0 && index < LocalRecipes.Count)
{
string code = LocalRecipes.ElementAt(index).RecipeCode;
int trayCode = LocalRecipes.ElementAt(index).TrayCode;
if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0)//配方4是否允许下发配发
{
HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.PlcWrite.Recipe4IssuedFinish = true;
GVL_BigStation.Recipe4DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
if (HKDevice.PlcRead.ReceiveFinishRecipe4 && GVL_BigStation.Recipe4DosingStatus == 1)
{
GVL_BigStation.Recipe4DosingStatus = 2;
HKDevice.PlcWrite.Recipe4IssuedFinish = false;
StockBinParReset();
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料");
}
if (GVL_BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish)
{
GVL_BigStation.Recipe4DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
if (HKDevice.PlcRead.Recipe4TrayCode > 0)
{
foreach (var item in LocalRecipes.ElementAt(index).RawMaterial)
{
if (item.RawMaterialLocation == 1)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
}
else if (item.RawMaterialLocation == 2)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
}
else if (item.RawMaterialLocation == 3)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
}
else if (item.RawMaterialLocation == 4)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
}
else if (item.RawMaterialLocation == 5)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
}
else if (item.RawMaterialLocation == 6)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
}
else if (item.RawMaterialLocation == 7)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
}
else if (item.RawMaterialLocation == 8)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
}
else if (item.RawMaterialLocation == 9)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
}
else if (item.RawMaterialLocation == 10)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
}
else if (item.RawMaterialLocation == 11)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
}
else if (item.RawMaterialLocation == 12)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
}
else if (item.RawMaterialLocation == 13)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
}
else if (item.RawMaterialLocation == 14)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
}
}
}
HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.3", false);
LocalRecipeQueue4.TryDequeue(out code);
RecipeExecuteComple.Add(LocalRecipes.ElementAt(index));//将该配方添加到下
//App.Current.Dispatcher.Invoke(() => {
// Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
//});
LocalRecipes.RemoveAt(index);
GVL_BigStation.Recipe4DosingStatus = 0;
}
}
}
if (Recipes.Count > 0)
}
private void ReceviceData()
{
SiemensRecipes = Json<RemoteRecipe>.Data.Recipes;
if (SiemensRecipes.Count > 0)
{
foreach (var data in Recipes)
foreach (var data in SiemensRecipes)
{
if (RecipeQueue1.Count == 0 && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode))
if (SiemensRecipeQueue1.Count == 0 && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode))
{
if (!(RecipeQueue1.Contains(data.RecipeCode)))
if (!(SiemensRecipeQueue1.Contains(data.RecipeCode)))
{
if (SiemensDevice.DL_Status is DL_Status_DB status)
{
@@ -161,16 +622,15 @@ namespace BPASmartClient.JXJFoodBigStation.Model
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
{
GVL_BigStation.SiemensSendRecipeStatus = 6;
RecipeQueue1.Enqueue(data.RecipeCode);
SiemensRecipeQueue1.Enqueue(data.RecipeCode);
}
}
}

}
}
else if (RecipeQueue2.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode))
else if (SiemensRecipeQueue2.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode))
{
if (!(RecipeQueue2.Contains(data.RecipeCode)))
if (!(SiemensRecipeQueue2.Contains(data.RecipeCode)))
{
if (SiemensDevice.DL_Status is DL_Status_DB status)
{
@@ -194,15 +654,15 @@ namespace BPASmartClient.JXJFoodBigStation.Model
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
{
GVL_BigStation.SiemensSendRecipeStatus = 6;
RecipeQueue2.Enqueue(data.RecipeCode);
SiemensRecipeQueue2.Enqueue(data.RecipeCode);
}
}
}
}
}
else if (RecipeQueue3.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode))
else if (SiemensRecipeQueue3.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode))
{
if (!(RecipeQueue3.Contains(data.RecipeCode)))
if (!(SiemensRecipeQueue3.Contains(data.RecipeCode)))
{
if (SiemensDevice.DL_Status is DL_Status_DB status)
{
@@ -226,15 +686,15 @@ namespace BPASmartClient.JXJFoodBigStation.Model
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
{
GVL_BigStation.SiemensSendRecipeStatus = 6;
RecipeQueue3.Enqueue(data.RecipeCode);
SiemensRecipeQueue3.Enqueue(data.RecipeCode);
}
}
}
}
}
else if (RecipeQueue4.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode))
else if (SiemensRecipeQueue4.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode))
{
if (!(RecipeQueue4.Contains(data.RecipeCode)))
if (!(SiemensRecipeQueue4.Contains(data.RecipeCode)))
{
if (SiemensDevice.DL_Status is DL_Status_DB status)
{
@@ -258,7 +718,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
{
GVL_BigStation.SiemensSendRecipeStatus = 6;
RecipeQueue4.Enqueue(data.RecipeCode);
SiemensRecipeQueue4.Enqueue(data.RecipeCode);
}
}
}
@@ -268,10 +728,10 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
else
{
RecipeQueue1.Clear();
RecipeQueue2.Clear();
RecipeQueue3.Clear();
RecipeQueue4.Clear();
SiemensRecipeQueue1.Clear();
SiemensRecipeQueue2.Clear();
SiemensRecipeQueue3.Clear();
SiemensRecipeQueue4.Clear();
GVL_BigStation.Recipe1DosingStatus = 0;
GVL_BigStation.Recipe2DosingStatus = 0;
GVL_BigStation.Recipe3DosingStatus = 0;
@@ -280,16 +740,16 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
private void RecipeInfoToHKPLC()
{
if (RecipeQueue1.Count > 0)
if (SiemensRecipeQueue1.Count > 0)
{
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeCode == RecipeQueue1.ElementAt(0));
if (index >= 0 && index < Recipes.Count)
int index = Array.FindIndex(SiemensRecipes.ToArray(), p => p.RecipeCode == SiemensRecipeQueue1.ElementAt(0));
if (index >= 0 && index < SiemensRecipes.Count)
{
string code = Recipes.ElementAt(index).RecipeCode;
int trayCode = Recipes.ElementAt(index).TrayCode;
string code = SiemensRecipes.ElementAt(index).RecipeCode;
int trayCode = SiemensRecipes.ElementAt(index).TrayCode;
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0)//配方1是否允许下发配发
{
HKDevice.StockBinPar(Recipes.ElementAt(index));
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.PlcWrite.Recipe1IssuedFinish = true;
GVL_BigStation.Recipe1DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
@@ -307,7 +767,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
if (HKDevice.PlcRead.Recipe1TrayCode == 1)
{
foreach (var item in Recipes.ElementAt(index).RawMaterial)
foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial)
{
if (item.RawMaterialLocation == 1)
{
@@ -367,27 +827,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
}
}
FinishData.Order_No = Recipes.ElementAt(index).RecipeCode;
FinishData.Product_Code = Recipes.ElementAt(index).RecipeName;
FinishData.job_No =(short) Recipes.ElementAt(index).TrayCode;
for (int i = 0; i < FinishData.Material.Length; i++)
{
FinishData.Material[i] = new UDT1();
}
for (int i = 0; i < Recipes.ElementAt(index).RawMaterial.Count; i++)
{
FinishData.Material[i].Material_Name = Recipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)Recipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = Recipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}
if (SiemensDevice.IsConnected)
{
FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode;
FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName;
FinishData.job_No = (short)SiemensRecipes.ElementAt(index).TrayCode;
for (int i = 0; i < FinishData.Material.Length; i++)
{
FinishData.Material[i] = new UDT1();
}
for (int i = 0; i < SiemensRecipes.ElementAt(index).RawMaterial.Count; i++)
{
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}
FinishData.Ask_For_Finish = true;
GVL_BigStation.SiemensSendRecipeStatus = 7;
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
}
RecipeQueue1.TryDequeue(out code);
IssuedComplete.Add(Recipes.ElementAt(index));//将配方添加到完成列表
SiemensRecipeQueue1.TryDequeue(out code);
RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));//将配方添加到完成列表
if (!GVL_BigStation.IsUseLocalRecipe)
{
App.Current.Dispatcher.Invoke(() => {
@@ -404,16 +864,16 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
}
}
if (RecipeQueue2.Count > 0)
if (SiemensRecipeQueue2.Count > 0)
{
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeCode == RecipeQueue2.ElementAt(0));
if (index >= 0 && index < Recipes.Count)
int index = Array.FindIndex(SiemensRecipes.ToArray(), p => p.RecipeCode == SiemensRecipeQueue2.ElementAt(0));
if (index >= 0 && index < SiemensRecipes.Count)
{
string code = Recipes.ElementAt(index).RecipeCode;
int trayCode = Recipes.ElementAt(index).TrayCode;
string code = SiemensRecipes.ElementAt(index).RecipeCode;
int trayCode = SiemensRecipes.ElementAt(index).TrayCode;
if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0)//配方2是否允许下发配发
{
HKDevice.StockBinPar(Recipes.ElementAt(index));
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.PlcWrite.Recipe2IssuedFinish = true;
GVL_BigStation.Recipe2DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
@@ -431,7 +891,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
if (HKDevice.PlcRead.Recipe2TrayCode > 0)
{
foreach (var item in Recipes.ElementAt(index).RawMaterial)
foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial)
{
if (item.RawMaterialLocation == 1)
{
@@ -490,14 +950,17 @@ namespace BPASmartClient.JXJFoodBigStation.Model
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
}
}
FinishData.Order_No = Recipes.ElementAt(index).RecipeCode;
FinishData.Product_Code = Recipes.ElementAt(index).RecipeName;
for (int i = 0; i < Recipes.ElementAt(index).RawMaterial.Count; i++)
FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode;
FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName;
for (int i = 0; i < FinishData.Material.Length; i++)
{
FinishData.Material[i] = new UDT1();
FinishData.Material[i].Material_Name = Recipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)Recipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = Recipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}
for (int i = 0; i < SiemensRecipes.ElementAt(index).RawMaterial.Count; i++)
{
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}
}
if (SiemensDevice.IsConnected)
@@ -505,8 +968,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
MessageNotify.GetInstance.ShowRunLog($"配方配料完成,将信号反馈给西门子");
}
RecipeQueue2.TryDequeue(out code);
IssuedComplete.Add(Recipes.ElementAt(index));//将该配方添加到下
SiemensRecipeQueue2.TryDequeue(out code);
RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));
if (!GVL_BigStation.IsUseLocalRecipe)
{
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
@@ -519,16 +982,16 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
}
}
if (RecipeQueue3.Count > 0)
if (SiemensRecipeQueue3.Count > 0)
{
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeCode == RecipeQueue3.ElementAt(0));
if (index >= 0 && index < Recipes.Count)
int index = Array.FindIndex(SiemensRecipes.ToArray(), p => p.RecipeCode == SiemensRecipeQueue3.ElementAt(0));
if (index >= 0 && index < SiemensRecipes.Count)
{
string code = Recipes.ElementAt(index).RecipeCode;
int trayCode = Recipes.ElementAt(index).TrayCode;
string code = SiemensRecipes.ElementAt(index).RecipeCode;
int trayCode = SiemensRecipes.ElementAt(index).TrayCode;
if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0)//配方3是否允许下发配发
{
HKDevice.StockBinPar(Recipes.ElementAt(index));
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.PlcWrite.Recipe3IssuedFinish = true;
GVL_BigStation.Recipe3DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
@@ -545,7 +1008,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
if (HKDevice.PlcRead.Recipe3TrayCode > 0)
{
foreach (var item in Recipes.ElementAt(index).RawMaterial)
foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial)
{
if (item.RawMaterialLocation == 1)
{
@@ -604,14 +1067,17 @@ namespace BPASmartClient.JXJFoodBigStation.Model
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
}
}
FinishData.Order_No = Recipes.ElementAt(index).RecipeCode;
FinishData.Product_Code = Recipes.ElementAt(index).RecipeName;
for (int i = 0; i < Recipes.ElementAt(index).RawMaterial.Count; i++)
FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode;
FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName;
for (int i = 0; i < FinishData.Material.Length; i++)
{
FinishData.Material[i] = new UDT1();
FinishData.Material[i].Material_Name = Recipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)Recipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = Recipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}
for (int i = 0; i < SiemensRecipes.ElementAt(index).RawMaterial.Count; i++)
{
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}
}
if (SiemensDevice.IsConnected)
@@ -619,8 +1085,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
}
HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.1", false);
RecipeQueue3.TryDequeue(out code);
IssuedComplete.Add(Recipes.ElementAt(index));//将该配方添加到下
SiemensRecipeQueue3.TryDequeue(out code);
RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));//将该配方添加到下
if (!GVL_BigStation.IsUseLocalRecipe)
{
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
@@ -633,16 +1099,16 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
}
}
if (RecipeQueue4.Count > 0)
if (SiemensRecipeQueue4.Count > 0)
{
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeCode == RecipeQueue4.ElementAt(0));
if (index >= 0 && index < Recipes.Count)
int index = Array.FindIndex(SiemensRecipes.ToArray(), p => p.RecipeCode == SiemensRecipeQueue4.ElementAt(0));
if (index >= 0 && index < SiemensRecipes.Count)
{
string code = Recipes.ElementAt(index).RecipeCode;
int trayCode = Recipes.ElementAt(index).TrayCode;
string code = SiemensRecipes.ElementAt(index).RecipeCode;
int trayCode = SiemensRecipes.ElementAt(index).TrayCode;
if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0)//配方4是否允许下发配发
{
HKDevice.StockBinPar(Recipes.ElementAt(index));
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.PlcWrite.Recipe4IssuedFinish = true;
GVL_BigStation.Recipe4DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
@@ -660,7 +1126,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
if (HKDevice.PlcRead.Recipe4TrayCode > 0)
{
foreach (var item in Recipes.ElementAt(index).RawMaterial)
foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial)
{
if (item.RawMaterialLocation == 1)
{
@@ -719,14 +1185,17 @@ namespace BPASmartClient.JXJFoodBigStation.Model
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
}
}
FinishData.Order_No = Recipes.ElementAt(index).RecipeCode;
FinishData.Product_Code = Recipes.ElementAt(index).RecipeName;
for (int i = 0; i < Recipes.ElementAt(index).RawMaterial.Count; i++)
FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode;
FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName;
for (int i = 0; i < FinishData.Material.Length; i++)
{
FinishData.Material[i] = new UDT1();
FinishData.Material[i].Material_Name = Recipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)Recipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = Recipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}
for (int i = 0; i < SiemensRecipes.ElementAt(index).RawMaterial.Count; i++)
{
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}
}
if (SiemensDevice.IsConnected)
@@ -734,8 +1203,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
}
HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.3", false);
RecipeQueue4.TryDequeue(out code);
IssuedComplete.Add(Recipes.ElementAt(index));//将该配方添加到下
SiemensRecipeQueue4.TryDequeue(out code);
RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));//将该配方添加到下
if (!GVL_BigStation.IsUseLocalRecipe)
{
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
@@ -772,7 +1241,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model
HKDevice.PlcWrite.Bareel1Bin13SetWeight = 0;
HKDevice.PlcWrite.Bareel1Bin14SetWeight = 0;


HKDevice.PlcWrite.Bareel2Bin1SetWeight = 0;
HKDevice.PlcWrite.Bareel2Bin2SetWeight = 0;
HKDevice.PlcWrite.Bareel2Bin3SetWeight = 0;
@@ -818,7 +1286,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
HKDevice.PlcWrite.Bareel5Bin13SetWeight = 0;
HKDevice.PlcWrite.Bareel5Bin14SetWeight = 0;
}
private void testData()
private void testRawMaterialNameData()
{
RawMaterialsNamePos.Clear();
if (!HKDevice.IsConnected)


+ 155
- 0
BPASmartClient.JXJFoodBigStation/View/HKPlcCommMonitorView.xaml Прегледај датотеку

@@ -0,0 +1,155 @@
<UserControl x:Class="BPASmartClient.JXJFoodBigStation.View.HKPlcCommMonitorView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodBigStation.ViewModel"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.DataContext>
<vm:HKPlcCommMonitorViewModel />
</UserControl.DataContext>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="80" />
<RowDefinition />
</Grid.RowDefinitions>
<!--#region 表格标题栏设置-->
<Grid
Grid.Row="0"
Margin="0,10,0,0"
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock Text="序号" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"/>
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="1" FontSize="24" Text="变量名" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<TextBlock Grid.Column="2" FontSize="24" Text="地址" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<TextBlock Grid.Column="3" FontSize="24" Text="类型" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<Grid Grid.Column="4">
<TextBlock Text="描述" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="5" FontSize="24" Text="当前值" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<Grid Grid.Column="6">
<TextBlock Text="设定值" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="7" FontSize="24" Text="功能操作" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<Border Grid.ColumnSpan="10" BorderThickness="1,0,1,0" />
</Grid>
<Grid Grid.Row="1">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" >
<ItemsControl ItemsSource="{Binding PlcInfo}" Foreground="Aqua">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr" >
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding SerialNum}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="1">
<TextBlock
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Variable}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<TextBlock
Grid.Column="2"
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Address }" />
<TextBlock
Grid.Column="3"
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Type }" />
<Grid Grid.Column="4">
<TextBlock
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Describe}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Grid.Column="5"
Text="{Binding NowValue}" FontSize="16" />
<Grid Grid.Column="6">
<TextBox
Text="{Binding SetValue}" Foreground="Aqua" Background="Transparent" FontSize="16" VerticalAlignment="Center" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="7">
<pry:IcoButton
Width="100"
Command="{Binding DataContext.SetValueCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding SetValue}"
Grid.Column="0"
Margin="50,5,50,5"
Content="设置"
FontSize="20"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<Border
Grid.ColumnSpan="10"
BorderThickness="1,0,1,1" />
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.JXJFoodBigStation/View/HKPlcCommMonitorView.xaml.cs Прегледај датотеку

@@ -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.JXJFoodBigStation.View
{
/// <summary>
/// HKPlcCommMonitor.xaml 的交互逻辑
/// </summary>
public partial class HKPlcCommMonitorView : UserControl
{
public HKPlcCommMonitorView()
{
InitializeComponent();
}
}
}

+ 2
- 2
BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml Прегледај датотеку

@@ -159,7 +159,7 @@
<CheckBox
x:Name="IsUseLocalRecipe"
Margin="0,0,10,0"
Content="应用本地配方"
Content="本地配方"
FontFamily="楷体"
VerticalAlignment="Center"
Foreground="Aqua"
@@ -285,7 +285,7 @@
<Expander.Content>
<StackPanel Margin="36,0,0,0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="托盘桶号:" Foreground="#FF2AB2E7"/>
<TextBlock Text="原料桶号:" Foreground="#FF2AB2E7"/>
<TextBlock Text="{Binding RawMaterialBarrelNum}" Foreground="#FF2AB2E7"/>
</StackPanel>
<StackPanel Orientation="Horizontal">


+ 1
- 4
BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml Прегледај датотеку

@@ -506,7 +506,7 @@
<Expander.Content>
<StackPanel Margin="36,0,0,0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="托盘编号:" Foreground="#FF2AB2E7"/>
<TextBlock Text="原料桶号:" Foreground="#FF2AB2E7"/>
<TextBlock Text="{Binding RawMaterialBarrelNum}" Foreground="#FF2AB2E7"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
@@ -514,14 +514,11 @@
<TextBlock Text="{Binding RawMaterialWeight}" Foreground="#FF2AB2E7"/>
</StackPanel>
</StackPanel>

</Expander.Content>
</Expander>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>


</ScrollViewer>



+ 131
- 0
BPASmartClient.JXJFoodBigStation/ViewModel/HKPlcCommMonitorViewModel.cs Прегледај датотеку

@@ -0,0 +1,131 @@
using BPA.Helper;
using BPASmartClient.JXJFoodBigStation.Model;
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
public class HKPlcCommMonitorViewModel:ObservableObject
{
HKDeviceStatus DeviceStatus = new HKDeviceStatus();
public HKPlcCommMonitorViewModel()
{
Type type = typeof(DB_Read);
PropertyInfo[] properties = type.GetProperties();
double Offset = 0.0;
string addressPos = "";
ThreadManage.GetInstance().StartLong(new Action(() =>
{
foreach (PropertyInfo mi in properties)
{
PropertyInfo a = DeviceStatus.PlcRead.GetType().GetProperty(mi.Name);
object ab = a.GetValue(DeviceStatus.PlcRead, null);

int index = Array.FindIndex(PlcInfo.ToArray(), p => p.Describe == mi.Name);
if (index != -1)
{
PlcInfo.ElementAt(index).NowValue = ab.ToString();
}
}
Thread.Sleep(10);
}), "plc变量读取");
foreach (PropertyInfo mi in properties)
{
PropertyInfo a = DeviceStatus.PlcRead.GetType().GetProperty(mi.Name);
object ab = a.GetValue(DeviceStatus.PlcRead, null);
if (mi.PropertyType.Name == "Int16")
{
addressPos = "DBD";
Offset = Math.Ceiling(Offset);
if (Offset / 2.0 - Math.Floor(Offset / 2.0) > 0.0)
{
Offset += 1.0;
}
}
else if (mi.PropertyType.Name == "Boolean")
{
addressPos = "DBX";
Offset = Math.Round(Offset, 1);
if ((Offset - Math.Floor(Offset)) >= 0.8)
{
Offset = Math.Ceiling(Offset);
}
}
else if (mi.PropertyType.Name == "Single")
{
addressPos = "DBD";
Offset = Math.Ceiling(Offset);
if (Offset / 2.0 - Math.Floor(Offset / 2.0) > 0.0)
{
Offset += 1.0;
}
}
var num = DeviceStatus.PlcRead;
var res = a.GetCustomAttribute<PlcCommAttribute>();
string describe = "";
if (res != null)
{
describe = res.Describe;
}
else
{
describe = "";
}
PlcInfo.Add(new PlcVarMonitor()
{
SerialNum = PlcInfo.Count + 1,
Variable = mi.Name,
Address = "DB98." + addressPos + string.Format("{0:N1}", Offset),
Type = mi.PropertyType.Name,
Describe = describe,
NowValue = ab.ToString(),
});

if (mi.PropertyType.Name == "Int16")
{
Offset += 2;
}
else if (mi.PropertyType.Name == "Boolean")
{
Offset += 0.1;
}
else if (mi.PropertyType.Name == "Single")
{
Offset += 4;
}
}

SetValueCommand = new RelayCommand<object>((o) =>
{
if (o != null && o is String setValue)
{
int index = Array.FindIndex(PlcInfo.ToArray(), p => p.SetValue == setValue);
if (index != -1)
{
DeviceStatus.HK_PLC_S7.Write(PlcInfo.ElementAt(index).Address, setValue);
}
}
});
}
/*public static string GetPropertyValue<T>( T t,string PropertyName)
{
Type type = typeof(T);

}*/
public ObservableCollection<PlcVarMonitor> PlcInfo { get; set; } = new ObservableCollection<PlcVarMonitor>();

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

public RelayCommand Connect { get; set; }
}
}

+ 4
- 8
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs Прегледај датотеку

@@ -90,27 +90,23 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
Json<LocalRecipe>.Save();
});

RemoveCommand = new RelayCommand<string>((recipeCode) => {
RemoveCommand = new RelayCommand<string>((recipeCode) =>
{
var res = Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode);
if (res != null)
{
Recipes.Remove(res);
Json<LocalRecipe>.Save();
}
});
}

public RelayCommand<object> DetailsCommand { get; set; }
// public RelayCommand NewSimulateRecipe { get; set; }
public RelayCommand ClearAllRecipe { get; set; }

public RelayCommand NewRecipe { get; set; }
public bool IsUseLocalRecipe { get; set; } = true;
public bool IsUseLocalRecipe { get { return _isUseLocalRecipe; } set { _isUseLocalRecipe = value; OnPropertyChanged(); } }
public bool _isUseLocalRecipe { get; set; }
public RelayCommand<string> RemoveCommand { get; set; }
public ObservableCollection<RecipeData> Recipes { get; set; } = new ObservableCollection<RecipeData>();
}
}

+ 23
- 9
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs Прегледај датотеку

@@ -1,4 +1,6 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodBigStation.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
@@ -32,22 +34,34 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel

public RecipeSendDownViewModel()
{
StartCommand = new RelayCommand<string>((recipeName) => {
StartCommand = new RelayCommand<string>((recipeName) =>
{
if (recipeName != null)
{
//配方下发逻辑
var res = Recipes.FirstOrDefault(p => p.RecipeName == recipeName);
if (res != null)
if (GVL_BigStation.IsUseLocalRecipe)
{
Json<LocalRecipe>.Data.Recipes.Add(res);
for (int i = 0; i < Json<LocalRecipe>.Data.Recipes.Count; i++)
//配方下发逻辑
var res = Recipes.FirstOrDefault(p => p.RecipeName == recipeName);
if (res != null)
{
foreach (var item in Json<LocalRecipe>.Data.Recipes.ElementAt(i).RawMaterial)
//Json<LocalRecipe>.Data.Recipes.Add(res);
//for (int i = 0; i < Json<LocalRecipe>.Data.Recipes.Count; i++)
//{
// foreach (var item in Json<LocalRecipe>.Data.Recipes.ElementAt(i).RawMaterial)
// {
// item.RawMaterialLocation = Convert.ToInt32(item.RawMaterialName);
// }
//}
if (!ProcessControl.GetInstance.LocalRecipes.Contains(res))
{
item.RawMaterialLocation = Convert.ToInt32(item.RawMaterialName);
ProcessControl.GetInstance.LocalRecipes.Add(res);
MessageNotify.GetInstance.ShowAlarmLog($"手动下发配方:{recipeName}完成");
}
}
MessageNotify.GetInstance.ShowAlarmLog("手动下发配方完成");
}
else
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"未处于本地配方模式,无法下发配方");
}
}
});


+ 1
- 0
BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs Прегледај датотеку

@@ -51,6 +51,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public void Init()
{
testData();
Json<RemoteRecipeDataColl>.Data.Recipes = Json<LocalRecipeDataColl>.Data.Recipes;
for (int i = 0; i < 16; i++)
{
if (DeviceInquire.GetInstance.GetDevice(i).DeviceName != null)


+ 1
- 1
BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs Прегледај датотеку

@@ -103,7 +103,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
//AlarmHelper<AlarmInfo>.Init();
//AlarmHelper<AlarmInfo>.Alarm.EStop1 = true;

//TestData();
TestData();
IpAddressLines();
DeviceDataInit();
ThreadManage.GetInstance().StartLong(new Action(() =>


+ 2
- 2
BPASmartClient.JXJFoodSmallStation/ViewModel/DeviceListViewModel.cs Прегледај датотеку

@@ -28,11 +28,11 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
}
});
devices = DeviceInquire.GetInstance.devices;
foreach (var device in devices)
/*foreach (var device in devices)
{
device.Serial = Convert.ToInt32(device.DeviceName.Substring(1, device.DeviceName.Length - 1)) / 10;
}
devices = new ObservableCollection<Devices>(devices.OrderBy(item => item.Serial));
devices = new ObservableCollection<Devices>(devices.OrderBy(item => item.Serial));*/
}

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


+ 1
- 0
BPASmartClient.Model/大炒/FryPotMessages.cs Прегледај датотеку

@@ -11,6 +11,7 @@ namespace BPASmartClient.Model.大炒
public string GoodName { get; set; }
public string GoodKey { get; set; }
public List<FryPotProcess> fryPotProcesses { get; set; } = new List<FryPotProcess>();
public int FryOffStirTime;//关火翻炒时间;
}

public class FryPotProcess


+ 147
- 86
BPASmartClient.MorkBF/Control_MorkBF.cs Прегледај датотеку

@@ -1,10 +1,10 @@
using BPA.Helper;
using BPA.Message;
using BPA.Message;
using BPA.Message.Enum;
using BPASmartClient.Business;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.大炒;
using BPASmartClient.MorkBF.Model;
@@ -17,8 +17,6 @@ using System.Threading;
using System.Threading.Tasks;
using static BPASmartClient.EventBus.EventBus;
using static BPASmartClient.Model.大炒.FryPotMessages;
using ActionManage = BPA.Helper.ActionManage;
using ThreadManage = BPA.Helper.ThreadManage;

namespace BPASmartClient.MorkBF
{
@@ -28,15 +26,30 @@ namespace BPASmartClient.MorkBF

public override DeviceClientType DeviceType => DeviceClientType.MORKCS;

int RobotLeadTime = 5;//机器人提前动作时间 s

public override void DoMain()
{
IsHealth = true;
BPASmartClient.Helper.Json<LocalFryPotMessage>.Read();
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 });
}
}
}), "更新菜单");
CommandRegist();//调试
ServerInit();
DataParse();//数据解析
ScreenDataServer();//大屏数据上报
ActionManage.GetInstance.Send("更新菜单");
DeviceProcessLogShow("MORKF 设备初始化完成");
}

@@ -109,7 +122,7 @@ namespace BPASmartClient.MorkBF
ActionManage.GetInstance.Register(FirePot_PotGotoP2, "FirePot_PotGotoP2");//炒锅去位置2
ActionManage.GetInstance.Register(FirePot_PotGotoP3, "FirePot_PotGotoP3");//炒锅去位置3
ActionManage.GetInstance.Register(FirePot_PotGotoP4, "FirePot_PotGotoP4");//炒锅去位置4
ActionManage.GetInstance.Register(FirePot_PotGotoOutFoodPositiong, "FirePot_PotGotoOutFoodPositiong");//炒锅去出餐位置
//ActionManage.GetInstance.Register(FirePot_PotGotoOutFoodPosition, "FirePot_PotGotoOutFoodPositiong");//炒锅去出餐位置
ActionManage.GetInstance.Register(FirePot_PotGotoInFoodPosition, "FirePot_PotGotoInFoodPosition");//炒锅去投料位置
ActionManage.GetInstance.Register(FirePot_StartOutFood, "FirePot_StartOutFood");//出餐启动
ActionManage.GetInstance.Register(FirePot_Clean, "FirePot_Clean");//清洗
@@ -156,27 +169,33 @@ namespace BPASmartClient.MorkBF
if(morkBF.FirePan1_Order.TryDequeue(out FryPotMessages result))
{

morkBF.FirePan1_Busy = true;
morkBF.FryPot1_CurrentProcess = result.fryPotProcesses;
foreach (var item in result.fryPotProcesses)
{
switch (item.fryActions)
{
case FryAction.冷锅加热:
FirePot_PotPerHeat(item, 1);
MessageLog.GetInstance.Show("炒锅1---冷锅加热完成");
break;

case FryAction.热油:
FirePot_HeatOil(item,1);
MessageLog.GetInstance.Show("炒锅1---热油完成");
break;

case FryAction.加调料:
FirePot_AddSeasoning(item, 1);
MessageLog.GetInstance.Show("炒锅1---加调料完成");
break;
case FryAction.加辅料:
FirePot_AddAccessories(item,1);
MessageLog.GetInstance.Show("炒锅1---加辅料完成");
break;
case FryAction.炒制菜品:
FirePot_FryFood(item,1);
MessageLog.GetInstance.Show("炒锅1---炒制菜品完成");
break;

default:
@@ -194,24 +213,45 @@ namespace BPASmartClient.MorkBF


#region 炒锅流程功能

private bool IsRobotNextWork(List<FryPotProcess> currentProcess, int currentFryTime)
{
bool res = false;
if(currentProcess.Count> currentFryTime)
{
if (currentProcess[currentFryTime + 1].fryActions == FryAction.加调料 ||
currentProcess[currentFryTime + 1].fryActions == FryAction.加辅料 ||
currentProcess[currentFryTime + 1].fryActions == FryAction.炒制菜品)
{
res = true;
}
}
return res;
}

/// <summary>
/// 冷锅预热
/// </summary>
private void FirePot_PotPerHeat(FryPotProcess item,int i)
{
bool isRobotWork = false;
if(i == 1)//炒锅1
{
FirePot1_SetFireGear(item.FryGear);
Thread.Sleep(200);
FirePot1_StartFire(true);
isRobotWork = IsRobotNextWork(morkBF.FryPot1_CurrentProcess,item.FryTime);
}
else if(i == 2)//炒锅2
{
FirePot2_SetFireGear(item.FryGear);
FirePot2_StartFire(true);
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime);
}
Thread.Sleep(item.FryDuration);
if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料
else Thread.Sleep(item.FryDuration * 1000);


}

/// <summary>
@@ -219,17 +259,21 @@ namespace BPASmartClient.MorkBF
/// </summary>
private void FirePot_HeatOil(FryPotProcess item, int i)
{
bool isRobotWork = false;
if (item.FryGear != 0)
{
FirePot1_SetFireGear(item.FryGear);//设定加热挡位
FirePot1_StartFire(true);//开启加热
isRobotWork = IsRobotNextWork(morkBF.FryPot1_CurrentProcess, item.FryTime);
}
if (item.StirGear != 0)
{
FirePot1_SetStirGear(item.StirGear);//设定搅拌挡位
FirePot1_StartFire(true);//开启搅拌
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime);
}
Thread.Sleep(item.FryDuration);//加热时间;
if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料
else Thread.Sleep(item.FryDuration * 1000);//加热时间;
}

/// <summary>
@@ -237,6 +281,7 @@ namespace BPASmartClient.MorkBF
/// </summary>
private void FirePot_AddSeasoning(FryPotProcess item,int i)
{

if(i == 1)
{
@@ -260,7 +305,7 @@ namespace BPASmartClient.MorkBF
{
if (i == 1)
{
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 1, robotActionModel = RobotActionModel.取1号炒锅辅料盆1倒入1号炒锅 });
Thread.Sleep(item.FryDuration);

@@ -279,6 +324,7 @@ namespace BPASmartClient.MorkBF
/// </summary>
private void FirePot_FryFood(FryPotProcess item, int i)
{
bool isRobotWork = false;
if (i == 1)
{
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 1, robotActionModel = (RobotActionModel)item.accessories[0].Loc });
@@ -286,7 +332,8 @@ namespace BPASmartClient.MorkBF
{
Thread.Sleep(100);
}
Thread.Sleep(item.FryDuration);
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime);

}

@@ -297,8 +344,11 @@ namespace BPASmartClient.MorkBF
{
Thread.Sleep(100);
}
Thread.Sleep(item.FryDuration);
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime);
}
if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料
else Thread.Sleep(item.FryDuration * 1000);//加热时间;
}
#endregion

@@ -317,27 +367,28 @@ namespace BPASmartClient.MorkBF
{
if (robotAction.robotActionModel == RobotActionModel.取1号空盆出餐)
{
Robot_Write("GM521", true);//炒锅去投料位置
Robot_Write("GM520", true);//机器人去出餐倒料减速位置
while(!morkBF.Robot_ArriveFirePot1)//机器人到位,请求1#炒锅倒菜
{
Thread.Sleep(100);
}
FirePot_Write("M11.6", true);//炒锅去出餐倒料位置
FirePot_StartOutFood(1);//炒锅出餐;
while (!morkBF.FirePot1_PotOnOutFoodPosition)//炒锅在出餐倒料位置反馈
{
Thread.Sleep(1000);
}
Thread.Sleep(20 * 1000);//等待20s出餐
Thread.Sleep(6 * 1000);//等待6s出餐
Robot_Write("GM521", true);//机器人出餐到料完成

}
else
{
FirePot_Write("M11.7", true);//炒锅去投料位置
FirePot_Write("M11.6", true);//炒锅去投料位置
while (!morkBF.FirePot1_PotOnIntoFoodPosition)//等待炒锅允许倒料
{
Thread.Sleep(100);
}
Robot_Write("GM520", true);//机器人投料
Robot_Write("GM531", true);//机器人投料
}
}
@@ -345,17 +396,18 @@ namespace BPASmartClient.MorkBF
{
if (robotAction.robotActionModel == RobotActionModel.取1号空盆出餐)
{
Robot_Write("GM531", true);//炒锅去投料位置
Robot_Write("GM522", true);//炒锅去出餐倒料减速位置
while (!morkBF.Robot_ArriveFirePot2)//机器人到位,请求1#炒锅倒菜
{
Thread.Sleep(100);
}
FirePot_Write("M16.6", true);//炒锅去出餐倒料位置
FirePot_StartOutFood(2);//炒锅去出餐倒料位置
while (!morkBF.FirePot2_PotOnOutFoodPosition)//炒锅在出餐倒料位置反馈
{
Thread.Sleep(1000);
}
Thread.Sleep(20 * 1000);//等待20s出餐
Thread.Sleep(6 * 1000);//等待20s出餐
Robot_Write("GM523", true);//机器人出餐倒料完成

}
else
@@ -365,7 +417,7 @@ namespace BPASmartClient.MorkBF
{
Thread.Sleep(100);
}
Robot_Write("GM530", true);
Robot_Write("GM531", true);
}
}
@@ -550,9 +602,9 @@ namespace BPASmartClient.MorkBF
private void FirePot1_SetFireGear(object o)
{
if (o == null) return;
if (o is int value)
if (int.TryParse(o.ToString(), out int value))
{
FirePot_Write("VW100", value);
FirePot_Write("VW100", (ushort)value);
}
Thread.Sleep(200);
}
@@ -563,11 +615,12 @@ namespace BPASmartClient.MorkBF
private void FirePot1_StartFire(object o)
{
if (o == null) return;
if (o is bool value)
if (bool.TryParse(o.ToString(), out bool value))
{
FirePot_Write("M10.0", value);
}
Thread.Sleep(200);
FirePot_Write("M10.2", true);
}
/// <summary>
/// 炒锅1设置搅拌挡位
@@ -576,11 +629,12 @@ namespace BPASmartClient.MorkBF
private void FirePot1_SetStirGear(object o)
{
if (o == null) return;
if (o is int value)
if (int.TryParse(o.ToString(), out int value))
{
FirePot_Write("VW102", value);
FirePot_Write("VW102", (ushort)value);
}
Thread.Sleep(200);
FirePot_Write("M10.3", true);
}
/// <summary>
/// 炒锅1搅拌启停
@@ -589,7 +643,7 @@ namespace BPASmartClient.MorkBF
private void FirePot1_StartStir(object o)
{
if (o == null) return;
if (o is bool value)
if (bool.TryParse(o.ToString(), out bool value))
{
FirePot_Write("M10.1", value);
}
@@ -602,11 +656,13 @@ namespace BPASmartClient.MorkBF
private void FirePot1_SetTurnSpeed(object o)
{
if (o == null) return;
if (o is int value)
if (int.TryParse(o.ToString(), out int value))
{
FirePot_Write("VW104", value);
FirePot_Write("VW104", (ushort)value);
}
Thread.Sleep(200);
FirePot_Write("M10.4", true);
Thread.Sleep(200);
}
#endregion

@@ -618,11 +674,12 @@ namespace BPASmartClient.MorkBF
private void FirePot2_SetFireGear(object o)
{
if (o == null) return;
if (o is int value)
if (int.TryParse(o.ToString(), out int value))
{
FirePot_Write("VW130", value);
FirePot_Write("VW130", (ushort)value);
}
Thread.Sleep(200);
FirePot_Write("M15.2", true);
}
/// <summary>
/// 炒锅2加热启停
@@ -646,9 +703,11 @@ namespace BPASmartClient.MorkBF
if (o == null) return;
if (o is int value)
{
FirePot_Write("VW132", value);
FirePot_Write("VW132", (ushort)value);
}
Thread.Sleep(200);
FirePot_Write("M15.3", true);
Thread.Sleep(200);
}
/// <summary>
/// 炒锅2搅拌启停
@@ -672,9 +731,11 @@ namespace BPASmartClient.MorkBF
if (o == null) return;
if (o is int value)
{
FirePot_Write("VW134", value);
FirePot_Write("VW134", (ushort)value);
}
Thread.Sleep(200);
FirePot_Write("M15.4", true);
Thread.Sleep(200);
}

#endregion
@@ -687,7 +748,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_Reset(object o)
{
if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{
if (i == 1)
{
@@ -708,7 +769,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotGotoOrigin(object o)
{
if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{
if (i == 1)
{
@@ -728,7 +789,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotGotoP1(object o)
{
if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{
if (i == 1)
{
@@ -748,7 +809,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotGotoP2(object o)
{
if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{
if (i == 1)
{
@@ -768,7 +829,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotGotoP3(object o)
{
if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{
if (i == 1)
{
@@ -788,7 +849,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotGotoP4(object o)
{
if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{
if (i == 1)
{
@@ -801,26 +862,26 @@ namespace BPASmartClient.MorkBF
}
Thread.Sleep(200);
}
/// <summary>
/// 炒锅去出餐位置
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoOutFoodPositiong(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M11.6", true);
}
else if (i == 2)
{
FirePot_Write("M16.6", true);
}
}
Thread.Sleep(200);
}
///// <summary>
///// 炒锅去出餐位置
///// </summary>
///// <param name="o"></param>
//private void FirePot_PotGotoOutFoodPositiong(object o)
//{
// if (o == null) return;
// if (o is int i)
// {
// if (i == 1)
// {
// FirePot_Write("M11.6", true);
// }
// else if (i == 2)
// {
// FirePot_Write("M16.6", true);
// }
// }
// Thread.Sleep(200);
//}
/// <summary>
/// 炒锅去投料位置
/// </summary>
@@ -828,15 +889,15 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotGotoInFoodPosition(object o)
{
if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString() ,out int i))
{
if (i == 1)
{
FirePot_Write("M11.7", true);
FirePot_Write("M11.6", true);
}
else if (i == 2)
{
FirePot_Write("M16.7", true);
FirePot_Write("M16.6", true);
}
}
Thread.Sleep(200);
@@ -848,7 +909,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_StartOutFood(object o)
{
if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{
if (i == 1)
{
@@ -869,7 +930,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_Clean(object o)
{
if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{
if (i == 1)
{
@@ -890,7 +951,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_StartPumpWater(object o)
{
if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{
if (i == 1)
{
@@ -910,7 +971,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_StartPumpOil(object o)
{
if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{
if (i == 1)
{
@@ -963,7 +1024,7 @@ namespace BPASmartClient.MorkBF
/// </summary>
private void Robot_Pot1AllowInMaterail()
{
Robot_Write("GM520", true);
Robot_Write("GM531", true);
Thread.Sleep(200);
}
/// <summary>
@@ -971,7 +1032,7 @@ namespace BPASmartClient.MorkBF
/// </summary>
private void Robot_Pot1OutFoodInSlowDown()
{
Robot_Write("GM621", true);
Robot_Write("GM620", true);
Thread.Sleep(200);
}
/// <summary>
@@ -979,7 +1040,7 @@ namespace BPASmartClient.MorkBF
/// </summary>
private void Robot_Pot1OutFood()
{
Robot_Write("GM522", true);
Robot_Write("GM521", true);
Thread.Sleep(200);
}
/// <summary>
@@ -995,7 +1056,7 @@ namespace BPASmartClient.MorkBF
/// </summary>
private void Robot_Pot2OutFoodInSlowDown()
{
Robot_Write("GM531", true);
Robot_Write("GM522", true);
Thread.Sleep(200);
}
/// <summary>
@@ -1003,7 +1064,7 @@ namespace BPASmartClient.MorkBF
/// </summary>
private void Robot_Pot2OutFood()
{
Robot_Write("GM532", true);
Robot_Write("GM523", true);
Thread.Sleep(200);
}
/// <summary>
@@ -1012,7 +1073,7 @@ namespace BPASmartClient.MorkBF
private void RobotActionStart(object o)
{
if (o == null) return;
if(o is int value)
if(int.TryParse(o.ToString(), out int value))
{
Robot_Write("GI0",value);
}
@@ -1034,24 +1095,24 @@ namespace BPASmartClient.MorkBF
statsModels.Add(new StatsModel() { Name = "帝王蟹", Count = 666 });
ScreenModelMaxWok maxWok = new ScreenModelMaxWok
{
IsRun = new Random().Next(0, 2) == 0 ? IsRun.运行 : IsRun.停止,
WorkStatus_1 = (WorkStatus)new Random().Next(0, 3),
WorkStatus_2 = (WorkStatus)new Random().Next(0, 3),
RobotStatu = (WorkStatus)new Random().Next(0, 3),
IsRun = IsHealth ? IsRun.运行 : IsRun.停止,
WorkStatus_1 = morkBF.FirePot1_Temperature > 0 ? WorkStatus.工作 : WorkStatus.待机,
WorkStatus_2 = morkBF.FirePot2_Temperature > 0 ? WorkStatus.工作 : WorkStatus.待机,
RobotStatu = morkBF.Robot_ActionCallback == 0? WorkStatus.待机 : WorkStatus.工作,
Alarm = new List<AlarmModel>(),
FailuresCount = 0,
StatsCount = statsModels,
MaxWok_Dishes_1 = "满汉全席",
MaxWok_Dishes_2 = "海鲜大餐",
MaxWok_Task_1 = "炒制菜品",
MaxWok_Task_2 = "热油",
MaxWok_Task_1 = "",
MaxWok_Task_2 = "",
MaxWok_Process_1 = new List<ProcessModel>(),
MaxWok_HeatGear_1 = new Random().Next(0, 5).ToString(),
MaxWok_HeatGear_2 = new Random().Next(0, 5).ToString(),
MaxWok_StirGear_1 = new Random().Next(0, 5).ToString(),
MaxWok_StirGear_2 = new Random().Next(0, 5).ToString(),
MaxWok_FlipSpeed_1 = new Random().Next(250, 450).ToString(),
MaxWok_FlipSpeed_2 = new Random().Next(250, 450).ToString(),
MaxWok_HeatGear_1 = morkBF.FirePot1_FireGear.ToString(),
MaxWok_HeatGear_2 = morkBF.FirePot2_FireGear.ToString(),
MaxWok_StirGear_1 = morkBF.FirePot1_StirGear.ToString(),
MaxWok_StirGear_2 = morkBF.FirePot2_StirGear.ToString(),
MaxWok_FlipSpeed_1 = morkBF.FirePot1_FlipSpeed.ToString(),
MaxWok_FlipSpeed_2 = morkBF.FirePot2_FlipSpeed.ToString(),
MaxWok_Temp_1 = new Random().Next(250, 450).ToString(),
MaxWok_Temp_2 = new Random().Next(250, 450).ToString(),
MaxWok_OrderCount_1 = 2,


+ 19
- 1
BPASmartClient.MorkBF/GVL_MorkBF.cs Прегледај датотеку

@@ -32,6 +32,15 @@ namespace BPASmartClient.MorkBF
/// 炒锅2忙碌
/// </summary>
public bool FirePan2_Busy = false;
/// <summary>
/// 炒锅1当前流程
/// </summary>
public List<FryPotProcess> FryPot1_CurrentProcess;
/// <summary>
/// 炒锅2当前流程
/// </summary>
public List<FryPotProcess> FryPot2_CurrentProcess;


#region 炒锅1读取数据
/// <summary>
@@ -140,6 +149,11 @@ namespace BPASmartClient.MorkBF
/// </summary>
[VariableMonitor("1#炒锅在洗锅位置反馈", "M22.2", "498")]
public bool FirePot1_PotOnCleanPosition{ get; set; }

public int FirePot1_FireGear { get; set; } = 0;
public int FirePot1_StirGear { get; set; } = 0;
public int FirePot1_FlipSpeed { get; set; } = 0;

#endregion

#region 炒锅2读取数据
@@ -249,7 +263,11 @@ namespace BPASmartClient.MorkBF
/// </summary>
[VariableMonitor("2#炒锅在洗锅位置反馈", "M27.2", "538")]
public bool FirePot2_PotOnCleanPosition{ get; set; }
#endregion

public int FirePot2_FireGear { get; set; } = 0;
public int FirePot2_StirGear { get; set; } = 0;

public int FirePot2_FlipSpeed { get; set; } = 0;

#region 机器人数据读取
public bool Robot_IsBusy;


+ 11
- 13
BPASmartClient.MorkBF/VIew/DebugView.xaml Прегледај датотеку

@@ -21,13 +21,11 @@
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Content="添加新菜品" Width="200" Click="Button_Click"/>
<!--<Button Content="添加新菜品" Width="200" Click="Button_Click"/>
<ListBox Grid.Row="1" ItemsSource="{Binding fryPotMessages}">
<ListBox.Template>
<ControlTemplate TargetType="{x:Type ListBox}">
@@ -51,18 +49,18 @@
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ListBox>-->
<GroupBox Grid.Row="2" Header="炒锅1" FontSize="22">
<GroupBox Grid.Row="0" Header="炒锅1" FontSize="22">
<WrapPanel Orientation="Horizontal">
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding FirePot_ResetCommand}" CommandParameter="1"/>
<TextBlock Text="加热挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding FireGear}" Margin="10,5" SelectedItem="{Binding FirePot1_FireGear}"/>
<ComboBox Width="80" ItemsSource="{Binding FireGear}" Margin="10,5" SelectedItem="{Binding FirePot1_FireGear}" SelectedIndex="0" />
<Button Content="加热档位设定" Width="110" Margin="10,5" Command="{Binding FirePot1_SetFireGearCommand}"/>
<Button Content="加热启动" Width="80" Margin="10,5" Command="{Binding FirePot1_StartFireCommand}"/>
<Button Content="加热停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot1_StopFireCommand}"/>
<TextBlock Text="搅拌挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding StirGear}" SelectedItem="{Binding FirePot1_StirGear}" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding StirGear}" SelectedItem="{Binding FirePot1_StirGear}" Margin="10,5" SelectedIndex="0" />
<Button Content="搅拌档位设定" Width="110" Margin="10,5" Command="{Binding FirePot1_SetStirGearCommand}"/>
<Button Content="搅拌启动" Width="80" Margin="10,5" Command="{Binding FirePot1_StartStirCommand}"/>
<Button Content="搅拌停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot1_StopStirCommand}"/>
@@ -83,16 +81,16 @@
</WrapPanel>

</GroupBox>
<GroupBox Grid.Row="3" Header="炒锅2" FontSize="22">
<GroupBox Grid.Row="1" Header="炒锅2" FontSize="22">
<WrapPanel Grid.Row="1" Orientation="Horizontal">
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding FirePot_ResetCommand}" CommandParameter="1"/>
<TextBlock Text="加热挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding FireGear}" Margin="10,5" SelectedItem="{Binding FirePot2_FireGear}"/>
<ComboBox Width="80" ItemsSource="{Binding FireGear}" Margin="10,5" SelectedItem="{Binding FirePot2_FireGear}" SelectedIndex="0" />
<Button Content="加热档位设定" Width="110" Margin="10,5" Command="{Binding FirePot2_SetFireGearCommand}"/>
<Button Content="加热启动" Width="80" Margin="10,5" Command="{Binding FirePot2_StartFireCommand}"/>
<Button Content="加热停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot2_StopFireCommand}"/>
<TextBlock Text="搅拌挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding StirGear}" SelectedItem="{Binding FirePot2_StirGear}" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding StirGear}" SelectedItem="{Binding FirePot2_StirGear}" Margin="10,5" SelectedIndex="0" />
<Button Content="搅拌档位设定" Width="110" Margin="10,5" Command="{Binding FirePot2_SetStirGearCommand}"/>
<Button Content="搅拌启动" Width="80" Margin="10,5" Command="{Binding FirePot2_StartStirCommand}"/>
<Button Content="搅拌停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot2_StopStirCommand}"/>
@@ -112,14 +110,14 @@
<Button Content="炒锅去投料位置" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoInFoodPositionCommand}" CommandParameter="2"/>
</WrapPanel>
</GroupBox>
<GroupBox Grid.Row="4" Header="机器人" FontSize="22">
<GroupBox Grid.Row="2" Header="机器人" FontSize="22">
<WrapPanel Orientation="Horizontal">
<Button Content="机器人启动" Width="110" Margin="10,5" Command="{Binding RobotStartCommand}"/>
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding RobotResetCommand}"/>
<Button Content="程序启动" Width="110" Margin="10,5" Command="{Binding RobotProgramStartCommand}"/>
<Button Content="机器人停止" Width="110" Margin="10,5" Command="{Binding RobotStopCommand}"/>
<Button Content="1号炒锅允许机器人投料" Width="160" Margin="10,5" Command="{Binding Robot_Pot1AllowInMaterailCommand}"/>
<Button Content="1号炒锅出餐倒料到减速位" Width="160" Margin="10,5" Command="{Binding Robot_Pot1OutFoodInSlowDownCommand}"/>
<Button Content="1号炒锅允许机器人投料" Width="160" Margin="10,5" Command="{Binding Robot_Pot1AllowInMaterailCommand}" Cursor="Hand"/>
<Button Content="1号炒锅出餐倒料到减速位" Width="160" Margin="10,5" Command="{Binding Robot_Pot1OutFoodInSlowDownCommand}" Cursor="Hand"/>
<Button Content="1号炒锅出餐倒料完成" Width="160" Margin="10,5" Command="{Binding Robot_Pot1OutFoodCommand}"/>
<Button Content="2号炒锅允许机器人投料" Width="160" Margin="10,5" Command="{Binding Robot_Pot2AllowInMaterailCommand}"/>
<Button Content="2号炒锅出餐倒料到减速位" Width="160" Margin="10,5" Command="{Binding Robot_Pot2OutFoodInSlowDownCommand}"/>


+ 7
- 0
BPASmartClient.MorkBF/VIew/FoodManagerView.xaml Прегледај датотеку

@@ -30,6 +30,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Height="45">
<TextBlock Text="菜品名称:" Margin="10,0"/>
@@ -70,6 +71,12 @@
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<StackPanel Orientation="Horizontal" Grid.Row="2" Margin="70,0" >
<TextBlock Text="关火搅拌时间" Margin="10,0"/>
<TextBox Text="{Binding FryOffStirTime}" Width="60"/>
<TextBlock Text="秒" Margin="10"/>
</StackPanel>
</Grid>
</Border>
</Window>

+ 68
- 0
BPASmartClient.MorkBF/VIew/MenuView.xaml Прегледај датотеку

@@ -0,0 +1,68 @@
<UserControl x:Class="BPASmartClient.MorkBF.VIew.MenuView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkBF.VIew"
xmlns:vm="clr-namespace:BPASmartClient.MorkBF.ViewModel"
x:Name="菜单"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:MenuViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Content="添加新菜品" Width="200" Click="Button_Click"/>
<ListBox Grid.Row="1" ItemsSource="{Binding fryPotMessages}">
<ListBox.Template>
<ControlTemplate TargetType="{x:Type ListBox}">
<WrapPanel Orientation="Horizontal" IsItemsHost="True"></WrapPanel>
</ControlTemplate>
</ListBox.Template>
<ListBox.ItemTemplate>
<DataTemplate>
<Border Margin="5,10">
<Border.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/矩形.png"/>
</Border.Background>
<Grid Margin="0,5,0,10">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Margin="10">
<TextBlock Text="{Binding GoodName}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18" Margin="10,0"/>
<Button Content="编辑" Command="{Binding DataContext.MenuEditCommand, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}"
CommandParameter="{Binding DataContext , RelativeSource={RelativeSource AncestorType=ListBoxItem,Mode=FindAncestor}}" Margin="10,0"/>
<Button Content="删除 " Command="{Binding DataContext.MenuDeleteCommand, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}"
CommandParameter="{Binding DataContext , RelativeSource={RelativeSource AncestorType=ListBoxItem,Mode=FindAncestor}}" Margin="10,0"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Grid.Row="1" Content="下单_炒锅1" Width="120" HorizontalAlignment="Center" VerticalAlignment="Center"
Command="{Binding DataContext.FryPot1_StartOrderCommand, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}"
CommandParameter="{Binding DataContext , RelativeSource={RelativeSource AncestorType=ListBoxItem,Mode=FindAncestor}}" Margin="5,5"/>
<Button Grid.Row="1" Content="下单_炒锅2" Width="120" HorizontalAlignment="Center" VerticalAlignment="Center"
Command="{Binding DataContext.FryPot2_StartOrderCommand, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}"
CommandParameter="{Binding DataContext , RelativeSource={RelativeSource AncestorType=ListBoxItem,Mode=FindAncestor}}" Margin="5,5"/>
</StackPanel>
</Grid>
</Border>

</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</UserControl>

+ 36
- 0
BPASmartClient.MorkBF/VIew/MenuView.xaml.cs Прегледај датотеку

@@ -0,0 +1,36 @@
using BPASmartClient.MorkBF.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.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.MorkBF.VIew
{
/// <summary>
/// MenuView.xaml 的交互逻辑
/// </summary>
public partial class MenuView : UserControl
{
public MenuView()
{
InitializeComponent();
}

private void Button_Click(object sender, RoutedEventArgs e)
{
Global.GLoFryMessage = null;
FoodManagerView foodManagerView = new FoodManagerView();
foodManagerView.ShowDialog();
}
}
}

+ 13
- 35
BPASmartClient.MorkBF/ViewModel/DebugViewModel.cs Прегледај датотеку

@@ -17,30 +17,7 @@ namespace BPASmartClient.MorkBF.ViewModel
partial class DebugViewModel
{

public ObservableCollection<FryPotMessages> fryPotMessages { get; set; } = Json<LocalFryPotMessage>.Data.FryPotMessage;

[RelayCommand]
private void MenuEdit(object o)
{
if (o == null) return;
if(o is FryPotMessages value)
{
Global.GLoFryMessage = value;
FoodManagerView foodManagerView = new FoodManagerView();
foodManagerView.ShowDialog();
}
}

[RelayCommand]
private void MenuDelete(object o)
{
if (o == null) return;
if (o is FryPotMessages value)
{
fryPotMessages.Remove(value);
}
Json<LocalFryPotMessage>.Save();
}



@@ -55,13 +32,13 @@ namespace BPASmartClient.MorkBF.ViewModel
public ObservableCollection<int> StirGear { get; set; } = new ObservableCollection<int>() { 1, 2, 3, 4, 5 };

[ObservableProperty]
private int _firePot1_FireGear = 0;
private int _firePot1_FireGear = 1;
[ObservableProperty]
private int _firePot2_FireGear = 0;
private int _firePot2_FireGear = 1;
[ObservableProperty]
private int _firePot1_StirGear = 0;
private int _firePot1_StirGear = 1;
[ObservableProperty]
private int _firePot2_StirGear = 0;
private int _firePot2_StirGear = 1;
[ObservableProperty]
private int _firePot1_TurnSpeed;
[ObservableProperty]
@@ -74,7 +51,7 @@ namespace BPASmartClient.MorkBF.ViewModel
[RelayCommand]
private void FirePot1_SetFireGear()
{
ActionManage.GetInstance.Send("FirePot1_SetFireGear",new List<int> { FirePot1_FireGear});
ActionManage.GetInstance.Send("FirePot1_SetFireGear", FirePot1_FireGear);
}
/// <summary>
/// 加热启动
@@ -98,7 +75,7 @@ namespace BPASmartClient.MorkBF.ViewModel
[RelayCommand]
private void FirePot1_SetStirGear()
{
ActionManage.GetInstance.Send("FirePot1_SetStirGear",new List<int> { FirePot1_StirGear});
ActionManage.GetInstance.Send("FirePot1_SetStirGear", FirePot1_StirGear);
}
/// <summary>
/// 搅拌启动
@@ -123,7 +100,7 @@ namespace BPASmartClient.MorkBF.ViewModel
private void FirePot1_SetTurnSpeed()
{
if (FirePot1_TurnSpeed > 800) FirePot1_TurnSpeed = 800;
ActionManage.GetInstance.Send("FirePot1_SetTurnSpeed",new List<int> { FirePot1_TurnSpeed});
ActionManage.GetInstance.Send("FirePot1_SetTurnSpeed", FirePot1_TurnSpeed);
}
#endregion

@@ -134,7 +111,7 @@ namespace BPASmartClient.MorkBF.ViewModel
[RelayCommand]
private void FirePot2_SetFireGear()
{
ActionManage.GetInstance.Send("FirePot2_SetFireGear", new List<int> { FirePot2_FireGear });
ActionManage.GetInstance.Send("FirePot2_SetFireGear", FirePot2_FireGear );
}
/// <summary>
/// 加热启动
@@ -158,7 +135,7 @@ namespace BPASmartClient.MorkBF.ViewModel
[RelayCommand]
private void FirePot2_SetStirGear()
{
ActionManage.GetInstance.Send("FirePot2_SetStirGear", new List<int> { FirePot2_StirGear });
ActionManage.GetInstance.Send("FirePot2_SetStirGear", FirePot2_StirGear);
}
/// <summary>
/// 搅拌启动
@@ -174,7 +151,7 @@ namespace BPASmartClient.MorkBF.ViewModel
[RelayCommand]
private void FirePot2_StopStir()
{
ActionManage.GetInstance.Send("FirePot1_StopStir", false);
ActionManage.GetInstance.Send("FirePot2_StopStir", false);
}
/// <summary>
/// 翻转频率设定
@@ -183,7 +160,7 @@ namespace BPASmartClient.MorkBF.ViewModel
private void FirePot2_SetTurnSpeed()
{
if (FirePot1_TurnSpeed > 800) FirePot1_TurnSpeed = 800;
ActionManage.GetInstance.Send("FirePot2_SetTurnSpeed", new List<int> { FirePot2_TurnSpeed });
ActionManage.GetInstance.Send("FirePot2_SetTurnSpeed", FirePot2_TurnSpeed );
}
#endregion

@@ -250,6 +227,7 @@ namespace BPASmartClient.MorkBF.ViewModel
[RelayCommand]
private void FirePot_PotGotoInFoodPosition(object o)
{
ActionManage.GetInstance.Send("FirePot_PotGotoInFoodPosition", o);
}
/// <summary>


+ 4
- 3
BPASmartClient.MorkBF/ViewModel/FoodManagerViewModel.cs Прегледај датотеку

@@ -16,7 +16,7 @@ namespace BPASmartClient.MorkBF.ViewModel
/// <summary>
/// 菜品步骤
/// </summary>
public ObservableCollection<FryPotProcess> FryPotProcesses { get; set; } =new ObservableCollection<FryPotProcess>();
public ObservableCollection<FryPotProcess> FryPotProcesses { get; set; } = new ObservableCollection<FryPotProcess>();

public ObservableCollection<FryAction> FryAction { get; set; } = new ObservableCollection<FryAction>();

@@ -59,6 +59,7 @@ namespace BPASmartClient.MorkBF.ViewModel
});
}
Json<LocalFryPotMessage>.Save();
ActionManage.GetInstance.Send("更新菜单");
ActionManage.GetInstance.Send("FoodManagerViewClose");
}

@@ -70,7 +71,8 @@ namespace BPASmartClient.MorkBF.ViewModel
{
FryPotProcesses.Remove(value);
}
ActionManage.GetInstance.Send("更新菜单");

}


@@ -87,7 +89,6 @@ namespace BPASmartClient.MorkBF.ViewModel
GoodName = Global.GLoFryMessage.GoodName;
FryPotProcesses = new ObservableCollection<FryPotProcess>(Global.GLoFryMessage.fryPotProcesses);
}
}
}
}

+ 62
- 0
BPASmartClient.MorkBF/ViewModel/MenuViewModel.cs Прегледај датотеку

@@ -0,0 +1,62 @@
using BPASmartClient.Helper;
using BPASmartClient.Model.大炒;
using BPASmartClient.MorkBF.Model;
using BPASmartClient.MorkBF.VIew;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkBF.ViewModel
{
[INotifyPropertyChanged]
partial class MenuViewModel
{
public ObservableCollection<FryPotMessages> fryPotMessages { get; set; } = Json<LocalFryPotMessage>.Data.FryPotMessage;

[RelayCommand]
private void MenuEdit(object o)
{
if (o == null) return;
if (o is FryPotMessages value)
{
Global.GLoFryMessage = value;
FoodManagerView foodManagerView = new FoodManagerView();
foodManagerView.ShowDialog();
}
}

[RelayCommand]
private void MenuDelete(object o)
{
if (o == null) return;
if (o is FryPotMessages value)
{
fryPotMessages.Remove(value);
}
Json<LocalFryPotMessage>.Save();
}
[RelayCommand]
private void FryPot1_StartOrder(object o)
{
if (o == null) return;
if (o is FryPotMessages value)
{
ActionManage.GetInstance.Send("FryPot1StartLocalOrder", value.fryPotProcesses);
}
}

[RelayCommand]
private void FryPot2_StartOrder(object o)
{
if (o == null) return;
if (o is FryPotMessages value)
{
ActionManage.GetInstance.Send("FryPot2StartLocalOrder", value.fryPotProcesses);
}
}
}
}

+ 639
- 359
BPASmartClient.MorkF/Control_MorkF.cs
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 1
- 11
BPASmartClient.MorkF/ML_MorkF.cs Прегледај датотеку

@@ -43,17 +43,7 @@ namespace BPASmartClient.MorkF
{
get
{
var ret = _ArriveComplete;
_ArriveComplete = false;
if(ret)
{
MessageLog.GetInstance.Show("到达上升沿为true");
}
else
{
MessageLog.GetInstance.Show("到达上升沿为false");
}
return ret;
return _ArriveComplete;
}
set
{


+ 9
- 8
BPASmartClient.MorkF/MaterialOperation.cs Прегледај датотеку

@@ -6,19 +6,20 @@ using System.Threading.Tasks;

namespace BPASmartClient.MorkF
{
public class Coordinate
{
public int X { get; set; } = 0;

public int Y { get; set; } = 0;
}

/// <summary>
/// 菜品库操作类
/// </summary>
internal class MaterialOperation
{
/// <summary>
/// x轴坐标
/// </summary>
public int x;
/// <summary>
/// y轴坐标
/// </summary>
public int y;
public Coordinate coordinate { get; set; } = new Coordinate();

/// <summary>
/// 炒锅编号
/// </summary>


+ 8
- 8
BPASmartClient.MorkF/View/DebugView.xaml Прегледај датотеку

@@ -89,7 +89,7 @@
<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" />
<Button Content="感应器1测距" Margin="5,0" Command="{Binding GetDistance_1}"/>
<Button Content="感应器1测距" Margin="5,0" Command="{Binding GetDistance_1}" Cursor="Hand"/>
<TextBox Text="{Binding SensingDistance_1}" Margin="5,0" Width="60" IsReadOnly="True"/>
<Button Content="感应器2测距" Margin="5,0" Command="{Binding GetDistance_2}"/>
<TextBox Text="{Binding SensingDistance_2}" Margin="5,0" Width="60" IsReadOnly="True"/>
@@ -107,15 +107,15 @@
<WrapPanel Grid.Row="3" Orientation="Horizontal" >
<Button Content="夹爪正转" Command="{Binding PawTurnFront}" Margin="5,0" Cursor="Hand"/>
<Button Content="夹爪反转" Command="{Binding PawTurnBack}" Margin="5,0" Cursor="Hand"/>
<RadioButton Content="位置1" Margin="5,0" IsEnabled="True" IsChecked="{Binding PawPositon1}" Command="{Binding GetDistance_1}" GroupName="PawTurn"/>
<RadioButton Content="位置2" Margin="5,0" IsEnabled="True" IsChecked="{Binding PawPositon2}" Command="{Binding GetDistance_2}" GroupName="PawTurn"/>
<RadioButton Content="位置3" Margin="5,0 " IsEnabled="True" IsChecked="{Binding PawPositon3}" Command="{Binding GetDistance_3}" GroupName="PawTurn"/>
<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="4" Orientation="Horizontal" >
<RadioButton Content="上" Margin="5,0" IsEnabled="{Binding ArmRunEnable}" IsChecked="{Binding ArmRunUp}" Command="{Binding GetDistance_1}" GroupName="ArmRun"/>
<RadioButton Content="下" Margin="5,0" IsEnabled="{Binding ArmRunEnable}" IsChecked="{Binding ArmRunDown}" Command="{Binding GetDistance_2}" GroupName="ArmRun"/>
<RadioButton Content="左" Margin="5,0 " IsEnabled="{Binding ArmRunEnable}" IsChecked="{Binding ArmRunLeft}" Command="{Binding GetDistance_3}" GroupName="ArmRun"/>
<RadioButton Content="右" Margin="5,0 " IsEnabled="{Binding ArmRunEnable}" IsChecked="{Binding ArmRunRight}" Command="{Binding GetDistance_3}" GroupName="ArmRun"/>
<RadioButton Content="上" Margin="5,0" IsEnabled="{Binding ArmRunEnable}" IsChecked="{Binding ArmRunUp}" GroupName="ArmRun"/>
<RadioButton Content="下" Margin="5,0" IsEnabled="{Binding ArmRunEnable}" IsChecked="{Binding ArmRunDown}" GroupName="ArmRun"/>
<RadioButton Content="左" Margin="5,0 " IsEnabled="{Binding ArmRunEnable}" IsChecked="{Binding ArmRunLeft}" GroupName="ArmRun"/>
<RadioButton Content="右" Margin="5,0 " IsEnabled="{Binding ArmRunEnable}" IsChecked="{Binding ArmRunRight}" GroupName="ArmRun"/>
<Button Content="{Binding ArmButtonName}" Command="{Binding ArmRun}" Margin="5,0" Cursor="Hand">
</Button>
</WrapPanel>


+ 7
- 1
BPASmartClient.MorkF/ViewModel/DebugViewModel.cs Прегледај датотеку

@@ -96,6 +96,9 @@ namespace BPASmartClient.MorkF.ViewModel
public RelayCommand PawTurnBack { get; set; }//夹爪反转
public RelayCommand SetArmPosition { get; set; }//机器臂位置设定
public RelayCommand ArmRun { get; set; }//机械臂运动
public RelayCommand PawToPoint1 { get; set; }//感应测距1
public RelayCommand PawToPoint2 { get; set; }//感应测距2
public RelayCommand PawToPoint3 { get; set; }//感应测距3

#endregion

@@ -207,8 +210,11 @@ namespace BPASmartClient.MorkF.ViewModel
StopElectromagnetism = new RelayCommand(() => { ActionManage.GetInstance.Send("Electromagnetism", new List<bool> { true });});//电磁阀关闭
SetSpeed = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("SetSpeed", new List<int> { MoveSpeed });
ActionManage.GetInstance.Send("SetSpeed", new List<int> { MoveSpeed });
});//设定速度
PawToPoint1 = new RelayCommand(() => { ActionManage.GetInstance.Send("PawToPoint1"); });//爪子去1号位
PawToPoint2 = new RelayCommand(() => { ActionManage.GetInstance.Send("PawToPoint2"); });//爪子去2号位
PawToPoint3 = new RelayCommand(() => { ActionManage.GetInstance.Send("PawToPoint3"); });//爪子去3号位
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


+ 6
- 1
BPASmartClient.S7Net/SiemensHelper.cs Прегледај датотеку

@@ -105,7 +105,12 @@ namespace BPASmartClient.S7Net
return $"失败,地址:{address},值:{value},断开连接";
}
}

/// <summary>
///
/// </summary>
/// <param name="db">DB号</param>
/// <param name="txt">字符串</param>
/// <param name="startAddress">字节偏移地址</param>
public void WriteString(int db, string txt, int startAddress = 0)
{
var temp = Encoding.ASCII.GetBytes(txt);


+ 1
- 1
BPASmartClient.ScreenLib/BPASmartClient.ScreenLib.csproj Прегледај датотеку

@@ -19,7 +19,7 @@
</COMReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="BPA.CustomResource" Version="1.0.14" />
<PackageReference Include="BPA.CustomResource" Version="1.0.16" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1418.22" />
</ItemGroup>



+ 4
- 4
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml Прегледај датотеку

@@ -33,7 +33,7 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.IsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -45,7 +45,7 @@
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备是否运行</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
@@ -132,7 +132,7 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.IsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -144,7 +144,7 @@
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备是否运行</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>


+ 4
- 4
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml Прегледај датотеку

@@ -33,7 +33,7 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.IsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_4,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -45,7 +45,7 @@
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备是否运行</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_4,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
@@ -131,7 +131,7 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.IsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_3,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -143,7 +143,7 @@
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备是否运行</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_3,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>


+ 4
- 4
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3.xaml Прегледај датотеку

@@ -33,7 +33,7 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.IsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -45,7 +45,7 @@
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备是否运行</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
@@ -131,7 +131,7 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.IsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -143,7 +143,7 @@
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备是否运行</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>


+ 16
- 8
BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml Прегледај датотеку

@@ -203,7 +203,7 @@
<Setter Property="Foreground" Value="#FFD2C106"></Setter>
<Setter Property="Text" Value="空闲"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_NoodleUpOrDown_1}" Value="true">
<DataTrigger Binding="{Binding ViewData.Morks_NoodleUpOrDown[0]}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="煮面"></Setter>
</DataTrigger>
@@ -220,7 +220,7 @@
<Setter Property="Foreground" Value="#FFD2C106"></Setter>
<Setter Property="Text" Value="空闲"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_NoodleUpOrDown_2}" Value="true">
<DataTrigger Binding="{Binding ViewData..Morks_NoodleUpOrDown[1]}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="煮面"></Setter>
</DataTrigger>
@@ -244,7 +244,7 @@
<Setter Property="Foreground" Value="#FFD2C106"></Setter>
<Setter Property="Text" Value="空闲"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_NoodleUpOrDown_3}" Value="true">
<DataTrigger Binding="{Binding ViewData.Morks_NoodleUpOrDown[2]}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="煮面"></Setter>
</DataTrigger>
@@ -261,7 +261,7 @@
<Setter Property="Foreground" Value="#FFD2C106"></Setter>
<Setter Property="Text" Value="空闲"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_NoodleUpOrDown_4}" Value="true">
<DataTrigger Binding="{Binding ViewData.Morks_NoodleUpOrDown[3]}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="煮面"></Setter>
</DataTrigger>
@@ -285,7 +285,7 @@
<Setter Property="Foreground" Value="#FFD2C106"></Setter>
<Setter Property="Text" Value="空闲"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_NoodleUpOrDown_5}" Value="true">
<DataTrigger Binding="{Binding ViewData.Morks_NoodleUpOrDown[4]}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="煮面"></Setter>
</DataTrigger>
@@ -302,7 +302,7 @@
<Setter Property="Foreground" Value="#FFD2C106"></Setter>
<Setter Property="Text" Value="空闲"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_NoodleUpOrDown_6}" Value="true">
<DataTrigger Binding="{Binding ViewData.Morks_NoodleUpOrDown[5]}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="煮面"></Setter>
</DataTrigger>
@@ -345,10 +345,18 @@
<Setter Property="Foreground" Value="#a70909"></Setter>
<Setter Property="Text" Value="缺碗"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_NoBowMeas}" Value="true">
<DataTrigger Binding="{Binding ViewData.MorkS_NoBowMeas1}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="充足"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding ViewData.MorkS_NoBowMeas1}" Value="false">
<Setter Property="Foreground" Value="#a70909"/>
<Setter Property="Text" Value="缺大碗"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding ViewData.MorkS_NoBowMeas2}" Value="false">
<Setter Property="Foreground" Value="#a70909"/>
<Setter Property="Text" Value="缺小碗"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
@@ -375,7 +383,7 @@
<Setter Property="Foreground" Value="#a70909"></Setter>
<Setter Property="Text" Value="缺面"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_SiloMeas}" Value="true">
<DataTrigger Binding="{Binding ViewData.Morks_SiloMeasDown}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="充足"></Setter>
</DataTrigger>


+ 1
- 1
BPASmartClient.ScreenSplitMeals/App.config Прегледај датотеку

@@ -8,7 +8,7 @@
<add key="GgAdder" value="https://stream7.iqilu.com/10339/upload_transcode/202002/18/20200218114723HDu3hhxqIT.mp4"/>

<add key="一号屏" value="0"/>
<add key="二号屏" value="0"/>
<add key="二号屏" value="1"/>
<add key="三号屏" value="0"/>
</appSettings>
</configuration>

+ 34
- 0
BeDesignerSCADA/Converters/MathAbsConverter.cs Прегледај датотеку

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

namespace BeDesignerSCADA.Converters
{
[ValueConversion(typeof(float), typeof(float))]
public class MathAbsConverter : IValueConverter
{
static MathAbsConverter()
{
Instance = new MathAbsConverter();
}

public static MathAbsConverter Instance
{
get;
private set;
}

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return Math.Abs((float)value);
}

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

+ 0
- 4
DosingSystem/ViewModel/NewRecipeViewModel.cs Прегледај датотеку

@@ -118,7 +118,6 @@ namespace BPASmartClient.DosingSystem.ViewModel
MessageNotify.GetInstance.ShowDialog("配方名称已经存在!", DialogType.Warning);
return;
}

ObservableCollection<RawMaterialModel> TempRawMaterials = new ObservableCollection<RawMaterialModel>();
RawMaterials.ToList()?.ForEach(item =>
{
@@ -134,7 +133,6 @@ namespace BPASmartClient.DosingSystem.ViewModel
}
TempRawMaterials.Add(item);
});

Json<LocaPar>.Data.Recipes.Add(new RecipeModel()
{
RecipeName = RecipeName,
@@ -143,8 +141,6 @@ namespace BPASmartClient.DosingSystem.ViewModel
Json<LocaPar>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"新建配方成功!");
}


ActionManage.GetInstance.Send("CloseNewRecipeView");
});



+ 20
- 10
WpfTest/MainWindow.xaml.cs Прегледај датотеку

@@ -250,17 +250,18 @@ namespace WpfTest
},
MorkS_OrderCount = new Random().Next(0, 100),
MorkS_ErrorOrderCount = new Random().Next(0, 100),
MorkS_NoodleUpOrDown_1 = k2 == 0 ? "true" : "false",
MorkS_NoodleUpOrDown_2 = k2 == 0 ? "true" : "false",
MorkS_NoodleUpOrDown_3 = k2 == 0 ? "true" : "false",
MorkS_NoodleUpOrDown_4 = k2 == 0 ? "true" : "false",
MorkS_NoodleUpOrDown_5 = k2 == 0 ? "true" : "false",
MorkS_NoodleUpOrDown_6 = k2 == 0 ? "true" : "false",
Morks_NoodleUpOrDown = new bool[] {
true,true,true,true,false,true
},

MorkS_Temp = false,// k2 == 0 ? "true" : "false",
MorkS_BinLocation = new Random().Next(0, 6),
Morks_SiloMeasUp = k2 == 0 ,
Morks_SiloMeasDown = k2 == 0,
MorkS_NoBowMeas1= new Random().Next(0, 2)==1,
MorkS_NoBowMeas2 = new Random().Next(0, 2) == 1,


MorkS_Temp = "false",// k2 == 0 ? "true" : "false",
MorkS_BinLocation = new Random().Next(0, 6).ToString(),
MorkS_SiloMeas = k2 == 0 ? "true" : "false",
MorkS_NoBowMeas = k2 == 0 ? "true" : "false",
MakeOrder = new List<OrderMakeModel> {
new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.WAIT, SortNum="007".ToString()},
new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.WAIT, SortNum="008".ToString()},
@@ -284,6 +285,15 @@ namespace WpfTest
{
IsRun = k2 == 0 ? IsRun.运行 : IsRun.停止,
WorkStatus = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
WorkStatus_1 = WorkStatus.待机,
WorkStatus_2 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
WorkStatus_3 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
WorkStatus_4 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
WorkStatus_5 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
WorkStatus_6 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
RobotStatu1= k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
RobotStatu2 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,

RobotStatu = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
//Alarm = new List<AlarmModel> {
// new AlarmModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" },


+ 1
- 1
WpfTest/WpfTest.csproj Прегледај датотеку

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

<ItemGroup>
<PackageReference Include="BPA.CustomResource" Version="1.0.14" />
<PackageReference Include="BPA.CustomResource" Version="1.0.16" />
</ItemGroup>

</Project>

Loading…
Откажи
Сачувај