浏览代码

1

JXJAgvReake
pry 1年前
父节点
当前提交
a97d4951d2
共有 69 个文件被更改,包括 611 次插入517 次删除
  1. +2
    -3
      BPASmartClient.Business/Plugin/ConfigMgr.cs
  2. +2
    -3
      BPASmartClient.Business/Plugin/DeviceMgr.cs
  3. +2
    -2
      BPASmartClient.Business/Plugin/OrderProxy.cs
  4. +3
    -3
      BPASmartClient.Business/Plugin/StatusMgr.cs
  5. +4
    -3
      BPASmartClient.CustomResource/Pages/Model/NfcServer.cs
  6. +1
    -0
      BPASmartClient.CustomResource/Pages/Model/VoiceAPI.cs
  7. +23
    -23
      BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
  8. +5
    -5
      BPASmartClient.DosingSystemSingle/Model/ViewModelBase.cs
  9. +2
    -2
      BPASmartClient.DosingSystemSingle/ViewModel/ChangeDeviceNameViewModel.cs
  10. +2
    -2
      BPASmartClient.DosingSystemSingle/ViewModel/CommparSetViewModel.cs
  11. +2
    -2
      BPASmartClient.DosingSystemSingle/ViewModel/DeviceListViewModel.cs
  12. +6
    -6
      BPASmartClient.DosingSystemSingle/ViewModel/DeviceMaterialParViewModel.cs
  13. +4
    -4
      BPASmartClient.DosingSystemSingle/ViewModel/HardwareStatusViewModel.cs
  14. +8
    -8
      BPASmartClient.DosingSystemSingle/ViewModel/ManualControlViewModel.cs
  15. +4
    -4
      BPASmartClient.DosingSystemSingle/ViewModel/NewMaterialViewModel.cs
  16. +4
    -4
      BPASmartClient.DosingSystemSingle/ViewModel/NewOutletViewModel.cs
  17. +6
    -6
      BPASmartClient.DosingSystemSingle/ViewModel/NewRecipeViewModel.cs
  18. +4
    -4
      BPASmartClient.DosingSystemSingle/ViewModel/OutletManagementViewModel.cs
  19. +6
    -6
      BPASmartClient.DosingSystemSingle/ViewModel/RecipeControlViewModel.cs
  20. +11
    -11
      BPASmartClient.DosingSystemSingle/ViewModel/RecipeSettingsViewModel.cs
  21. +93
    -93
      BPASmartClient.Http/APIHelper.cs
  22. +4
    -3
      BPASmartClient.IoT/DataVClient.cs
  23. +4
    -2
      BPASmartClient.IoT/Model/DataVReport.cs
  24. +12
    -12
      BPASmartClient.IoT/Model/FileUpload.cs
  25. +3
    -2
      BPASmartClient.IoT/Model/IOT/IOTDevServer.cs
  26. +29
    -0
      BPASmartClient.Model/LocaPath.cs
  27. +7
    -6
      BPASmartClient.MorkM/Control_MORKM.cs
  28. +3
    -2
      BPASmartClient.MorkMV1/Control_MorkMV1.cs
  29. +13
    -4
      BPASmartClient.MorkMV1/DataServer.cs
  30. +0
    -3
      BPASmartClient.MorkMV1/GlobalUsing.cs
  31. +1
    -1
      BPASmartClient.MorkMW/Control_MorkMW.cs
  32. +2
    -1
      BPASmartClient.MorkS/Control_Morks.cs
  33. +12
    -4
      BPASmartClient.MorkS/DataServer.cs
  34. +28
    -23
      BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs
  35. +12
    -4
      BPASmartClient.MorkSUpgradedVer/DataServer.cs
  36. +0
    -3
      BPASmartClient.MorkSUpgradedVer/GlobalUsing.cs
  37. +1
    -0
      BPASmartClient.MorkT.Lebai.JC/Control_MORKJC2.cs
  38. +17
    -17
      BPASmartClient.MorkT/Control_MorkT.cs
  39. +11
    -9
      BPASmartClient.MorkTSingle/Control_MORKJC.cs
  40. +28
    -27
      BPASmartClient.MorkT_BarCounter/Control_MorkT_BarCounter.cs
  41. +1
    -0
      BPASmartClient.MorkT_Container/Control_MorkT_Container.cs
  42. +29
    -29
      BPASmartClient.MorkT_HQ/Control_MorkTHQ.cs
  43. +11
    -11
      BPASmartClient.Morkt.JAKA.JC/Control_MORKJC.cs
  44. +3
    -3
      BPASmartClient.SCADAControl/CustomerControls/TheAPI.xaml.cs
  45. +1
    -1
      BPASmartClient.ScreenLib/Helper/Main.cs
  46. +1
    -1
      BPASmartClient.SerialPort/BPASmartClient.SerialPort.csproj
  47. +5
    -6
      BPASmartClient.ViewModel/AlarmViewModel.cs
  48. +5
    -6
      BPASmartClient.ViewModel/DataVViewModel.cs
  49. +2
    -2
      BPASmartClient.ViewModel/LogOrAlarmIOTViewModel.cs
  50. +0
    -3
      BPASmartClient.ViewModel/NewShopWindowModel.cs
  51. +13
    -16
      BPASmartClient.ViewModel/OrderListDialogViewModel.cs
  52. +5
    -5
      BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs
  53. +77
    -45
      BPASmartClient/Control/AdminstratorsView.xaml
  54. +11
    -6
      BPASmartClient/OrderListDialogView.xaml.cs
  55. +1
    -1
      DosingSystem/App.xaml.cs
  56. +5
    -5
      DosingSystem/Model/ViewModelBase.cs
  57. +2
    -2
      DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
  58. +2
    -2
      DosingSystem/ViewModel/CommparSetViewModel.cs
  59. +2
    -2
      DosingSystem/ViewModel/DeviceListViewModel.cs
  60. +6
    -6
      DosingSystem/ViewModel/DeviceMaterialParViewModel.cs
  61. +4
    -4
      DosingSystem/ViewModel/HardwareStatusViewModel.cs
  62. +8
    -8
      DosingSystem/ViewModel/ManualControlViewModel.cs
  63. +4
    -4
      DosingSystem/ViewModel/NewMaterialViewModel.cs
  64. +4
    -4
      DosingSystem/ViewModel/NewOutletViewModel.cs
  65. +6
    -6
      DosingSystem/ViewModel/NewRecipeViewModel.cs
  66. +4
    -4
      DosingSystem/ViewModel/OutletManagementViewModel.cs
  67. +6
    -6
      DosingSystem/ViewModel/RecipeControlViewModel.cs
  68. +11
    -11
      DosingSystem/ViewModel/RecipeSettingsViewModel.cs
  69. +1
    -1
      TestDemo/Form1.cs

+ 2
- 3
BPASmartClient.Business/Plugin/ConfigMgr.cs 查看文件

@@ -1,7 +1,6 @@
using BPA.ApolloClient;
using BPA.Message;
using BPA.Helper;
using BPASmartClient.Model;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
@@ -45,7 +44,7 @@ namespace BPASmartClient.Business
public void Initialize()
{
var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig");
string path = $"{LocaPath.GetInstance().GetDeviceConfigPath}{text}.json";
string path = $"{LocaPath.GetDeviceConfigPath}{text}.json";
if (File.Exists(path))
{
string JsonString = File.ReadAllText(path);


+ 2
- 3
BPASmartClient.Business/Plugin/DeviceMgr.cs 查看文件

@@ -2,8 +2,7 @@
using BPASmartClient.Device;

using BPA.Helper;
using BPASmartClient.Http;

using BPASmartClient.Model;
using BPASmartClient.Model.小炒机;
using BPASmartClient.Model.调酒机;
@@ -105,7 +104,7 @@ namespace BPASmartClient.Business
var jsondata = new { clientId, PushType };
string header = $"[/stock/GetItemInfo]_[{DateTime.Now.Ticks}]".AESEncrypt();
string url = $"{InternetInfo.StockServer}GetItemInfo";
result = APIHelper.GetInstance.HttpRequest(url, header, jsondata, RequestType.POST);
result = APIHelper.GetInstance.HttpRequest(url, jsondata, header, RequestType.POST);

if (PushType == 1)
{


+ 2
- 2
BPASmartClient.Business/Plugin/OrderProxy.cs 查看文件

@@ -5,7 +5,7 @@ using BPA.Models;
using BPASmartClient.Device;

using BPA.Helper;
using BPASmartClient.Http;

using BPASmartClient.Model;
using BPASmartClient.Model.小炒机;
@@ -186,7 +186,7 @@ namespace BPASmartClient.Business
{
string header = $"[{InternetInfo.OrderServer}/order/robotstatuschange]_[{DateTime.Now.Ticks}]".AESEncrypt();
string url = $"{InternetInfo.OrderServer}order/robotstatuschange";
result = APIHelper.GetInstance.HttpRequest(url, header, orderStatusChange, RequestType.POST);
result = APIHelper.GetInstance.HttpRequest(url, orderStatusChange, header, RequestType.POST);
}
catch (Exception ex)
{


+ 3
- 3
BPASmartClient.Business/Plugin/StatusMgr.cs 查看文件

@@ -44,7 +44,7 @@ namespace BPASmartClient.Business
}
Thread.Sleep(50);
}
}, "设备状态收集", true);
}, "设备状态收集", isRestart: true);

deviceStatus.BatchingInfo = new List<BPA.Models.BatchingInfo>();

@@ -59,13 +59,13 @@ namespace BPASmartClient.Business

deviceStatus.Healthy = device.IsHealth ? BPA.Message.Enum.DeviceHealthy.Health : BPA.Message.Enum.DeviceHealthy.UnHealth;
deviceStatus.DeviceType = device.DeviceType;
deviceStatus.BatchingInfo = device.BatchingInfos;
deviceStatus.BatchingInfo = device.BatchingInfos;
var msg = BPAPackage.Make(deviceStatus, device.DeviceId, device.DeviceType);
mqttMgr.Publish(TopicDefine.GetInstance().PushHeartbeatTopics[device.DeviceType], msg.Serialize());
}
Thread.Sleep(1000);
}
}, "设备心跳上报", true);
}, "设备心跳上报", isRestart: true);
}

public void Dispose()


+ 4
- 3
BPASmartClient.CustomResource/Pages/Model/NfcServer.cs 查看文件

@@ -1,4 +1,5 @@
using BPASmartClient.CustomResource.Pages.ViewModel;
using BPA.Helper;
using BPASmartClient.CustomResource.Pages.ViewModel;
using BPASmartClient.Nfc;
using System;
using System.Collections.Generic;
@@ -28,10 +29,10 @@ namespace BPASmartClient.CustomResource.Pages.Model
if (NFCHelper.GetInstance.GetReadResult?.CardNum.Length > 0)
{
string id = NFCHelper.GetInstance.GetReadResult?.CardNum;
var res = Global.userManager.userInfos.FirstOrDefault(p => p.CardId == id) ;
var res = Global.userManager.userInfos.FirstOrDefault(p => p.CardId == id);
if (res != null)
{
BPASmartClient.Message.MessageLog.GetInstance.ShowDebugLog("NFC卡登录");
MessageLog.GetInstance.Show("NFC卡登录");
LoginViewModel.NfcLogin(id);
}
}


+ 1
- 0
BPASmartClient.CustomResource/Pages/Model/VoiceAPI.cs 查看文件

@@ -1,4 +1,5 @@

using BPA.Helper;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;


+ 23
- 23
BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs 查看文件

@@ -12,7 +12,7 @@ using BPASmartClient.CustomResource.Pages.Model;
using BPA.Helper;
using BPASmartClient.Model;
using BPA.Helper;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
@@ -21,24 +21,24 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
public MainViewModel()
{
NavChangedCommand = new BPARelayCommand<object>(DoNavChanged);
BPASmartClient.Message. MessageLog.GetInstance.InfoNotify = new Action<string>((o) =>
{
Application.Current?.Dispatcher?.Invoke(() =>
{
//ff20aefe
var temp = new MessageModel()
{
LogInfo = o,
Forground = new SolidColorBrush(Color.FromArgb(255, 32, 174, 254))
};
if (DebugLogViewModel.MessageModels.Count > 0)
DebugLogViewModel.MessageModels.Insert(0, temp);
else
DebugLogViewModel.MessageModels.Add(temp);
});
});
MessageLog.GetInstance.InfoNotify = new Action<string>((o) =>
{
Application.Current?.Dispatcher?.Invoke(() =>
{
//ff20aefe
var temp = new MessageModel()
{
LogInfo = o,
Forground = new SolidColorBrush(Color.FromArgb(255, 32, 174, 254))
};
if (DebugLogViewModel.MessageModels.Count > 0)
DebugLogViewModel.MessageModels.Insert(0, temp);
else
DebugLogViewModel.MessageModels.Add(temp);
});
});

BPASmartClient.Message.MessageLog.GetInstance.ExInfoNotify = new Action<string>((o) =>
MessageLog.GetInstance.ExInfoNotify = new Action<string>((o) =>
{
Application.Current?.Dispatcher?.Invoke(() =>
{
@@ -98,9 +98,9 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

ActionManage.GetInstance.Register(new Action<object>((c) =>
{
if(c!=null)
IsAlarm = Convert.ToBoolean(c);
}),"HeartBeatCheck");
if (c != null)
IsAlarm = Convert.ToBoolean(c);
}), "HeartBeatCheck");
}

private void PermissionChange()
@@ -160,14 +160,14 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
OnPropertyChanged();
}
}
private bool _isAlarm=true;
private bool _isAlarm = true;
/// <summary>
/// 心跳检测报警
/// </summary>
public bool IsAlarm
{
get { return _isAlarm; }
set { _isAlarm = value;OnPropertyChanged(); }
set { _isAlarm = value; OnPropertyChanged(); }
}
/// <summary>
/// 开机自启


+ 5
- 5
BPASmartClient.DosingSystemSingle/Model/ViewModelBase.cs 查看文件

@@ -12,11 +12,11 @@ namespace BPASmartClient.DosingSystemSingle
public class ViewModelBase : NotifyBase
{
public int Index { get; set; } = -1;
public BPABPARelayCommand AddCommand { get; set; }//添加
public BPABPARelayCommand CancelCommand { get; set; }//取消
public BPABPARelayCommand SaveCommand { get; set; }//保存
public BPABPARelayCommand<object> RemoveCommand { get; set; }//移除
public BPABPARelayCommand<object> DetailsCommand { get; set; }//编辑
public BPARelayCommand AddCommand { get; set; }//添加
public BPARelayCommand CancelCommand { get; set; }//取消
public BPARelayCommand SaveCommand { get; set; }//保存
public BPARelayCommand<object> RemoveCommand { get; set; }//移除
public BPARelayCommand<object> DetailsCommand { get; set; }//编辑

/// <summary>
/// 错误信息


+ 2
- 2
BPASmartClient.DosingSystemSingle/ViewModel/ChangeDeviceNameViewModel.cs 查看文件

@@ -17,8 +17,8 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
if (o != null && o is string str) IpAddress = str;
}), "ChangeDeviceNameViewOpen");

CancelCommand = new BPABPARelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); });
AddCommand = new BPABPARelayCommand(() =>
CancelCommand = new BPARelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); });
AddCommand = new BPARelayCommand(() =>
{
if (string.IsNullOrEmpty(DeviceName))
{


+ 2
- 2
BPASmartClient.DosingSystemSingle/ViewModel/CommparSetViewModel.cs 查看文件

@@ -14,7 +14,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
{
public CommparSetViewModel()
{
SaveCommand = new BPABPARelayCommand(() =>
SaveCommand = new BPARelayCommand(() =>
{
if (!string.IsNullOrEmpty(CommBaseParModel.NetworkSegAddress))
{
@@ -38,7 +38,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
public BasePar CommBaseParModel { get { return Json<DevicePar>.Data.BaseParModel; } set { Json<DevicePar>.Data.BaseParModel = value; OnPropertyChanged(); } }
//private BasePar _mCommBaseParModel;

public BPABPARelayCommand SaveCommand { get; set; }
public BPARelayCommand SaveCommand { get; set; }

}
}

+ 2
- 2
BPASmartClient.DosingSystemSingle/ViewModel/DeviceListViewModel.cs 查看文件

@@ -16,7 +16,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
{
public DeviceListViewModel()
{
DetailsCommand = new BPABPARelayCommand<object>((o) =>
DetailsCommand = new BPARelayCommand<object>((o) =>
{
if (o != null && o is string str)
{
@@ -28,7 +28,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
devices = DeviceInquire.GetInstance.devices;
}

//public BPABPARelayCommand<object> ChangeNameCommand { get; set; }
//public BPARelayCommand<object> ChangeNameCommand { get; set; }

//public static ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>();
public ObservableCollection<Devices> devices { get; set; }


+ 6
- 6
BPASmartClient.DosingSystemSingle/ViewModel/DeviceMaterialParViewModel.cs 查看文件

@@ -16,15 +16,15 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
public DeviceMaterialParViewModel()
{
deviceParModels = Json<DevicePar>.Data.deviceParModels;
RemoveCommand = new BPABPARelayCommand<object>((o) =>
RemoveCommand = new BPARelayCommand<object>((o) =>
{
var res = deviceParModels.FirstOrDefault(p => p.MaterialName == o?.ToString());
if (res != null) deviceParModels.Remove(res);
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{o.ToString()}:原料删除成功!");
});

AddCommand = new BPABPARelayCommand(() => { deviceParModels.Add(new DeviceParModel()); });
SaveCommand = new BPABPARelayCommand(() =>
AddCommand = new BPARelayCommand(() => { deviceParModels.Add(new DeviceParModel()); });
SaveCommand = new BPARelayCommand(() =>
{
if (deviceParModels == null || deviceParModels.Count <= 0)
{
@@ -57,10 +57,10 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel

public ObservableCollection<DeviceParModel> deviceParModels { get; set; }

//public BPABPARelayCommand<object> RemoveCommand { get; set; }
//public BPARelayCommand<object> RemoveCommand { get; set; }

//public BPABPARelayCommand AddCommand { get; set; }
//public BPABPARelayCommand SaveCommand { get; set; }
//public BPARelayCommand AddCommand { get; set; }
//public BPARelayCommand SaveCommand { get; set; }

}
}

+ 4
- 4
BPASmartClient.DosingSystemSingle/ViewModel/HardwareStatusViewModel.cs 查看文件

@@ -23,7 +23,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
// ConveyerBeltModels.Add(new ConveyerBeltModel() { Name = $"输送带{i}", Num = i++ });
//}

//ConveyerBeltControlCommand = new BPABPARelayCommand<object>(o =>
//ConveyerBeltControlCommand = new BPARelayCommand<object>(o =>
//{
// if (o != null && o is int tempCount)
// {
@@ -62,7 +62,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
Thread.Sleep(100);
}), "输送带料仓状态监控");

RecipeControlCommand = new BPABPARelayCommand<object>((o) =>
RecipeControlCommand = new BPARelayCommand<object>((o) =>
{
if (o != null && o is DeviceCurrentStatus currentStatus)
{
@@ -109,9 +109,9 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel

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

public BPABPARelayCommand<object> ConveyerBeltControlCommand { get; set; }
public BPARelayCommand<object> ConveyerBeltControlCommand { get; set; }

public BPABPARelayCommand<object> RecipeControlCommand { get; set; }
public BPARelayCommand<object> RecipeControlCommand { get; set; }

/// <summary>
/// 输送带状态


+ 8
- 8
BPASmartClient.DosingSystemSingle/ViewModel/ManualControlViewModel.cs 查看文件

@@ -51,7 +51,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
OtherHandCylinders.Add(new CylinderModel() { Name = "上桶工位气缸" });
OtherHandCylinders.Add(new CylinderModel() { Name = "下桶工位气缸" });

Open = new BPABPARelayCommand<object>((o) =>
Open = new BPARelayCommand<object>((o) =>
{
if (o != null)
{
@@ -76,7 +76,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
});


Close = new BPABPARelayCommand<object>((o) =>
Close = new BPARelayCommand<object>((o) =>
{
if (o != null)
{
@@ -100,13 +100,13 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
}
});

SystemStart = new BPABPARelayCommand(() =>
SystemStart = new BPARelayCommand(() =>
{
SiemensDevice.GetInstance.MySiemens.Write("M10.0", SystemControlText == "停止" ? false : true);
/*var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.0");
SystemControlText = res ? "停止" : "启动";*/
});
ModelSwitch = new BPABPARelayCommand(() =>
ModelSwitch = new BPARelayCommand(() =>
{
SiemensDevice.GetInstance.MySiemens.Write("M10.1", ModelSwitchText == "手动" ? true : false);
/*var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.1");
@@ -166,12 +166,12 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
/// </summary>
public ObservableCollection<CylinderModel> OtherHandCylinders { get; set; } = new ObservableCollection<CylinderModel>();

public BPABPARelayCommand<object> Open { get; set; }
public BPARelayCommand<object> Open { get; set; }

public BPABPARelayCommand<object> Close { get; set; }
public BPARelayCommand<object> Close { get; set; }

public BPABPARelayCommand SystemStart { get; set; }
public BPABPARelayCommand ModelSwitch { get; set; }
public BPARelayCommand SystemStart { get; set; }
public BPARelayCommand ModelSwitch { get; set; }


public string SystemControlText { get { return _mSystemControlText; } set { _mSystemControlText = value; OnPropertyChanged(); } }


+ 4
- 4
BPASmartClient.DosingSystemSingle/ViewModel/NewMaterialViewModel.cs 查看文件

@@ -22,9 +22,9 @@ public class NewMaterialViewModel : ViewModelBase
//public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
//private string _mErrorInfo;

//public BPABPARelayCommand<object> RemoveCommand { get; set; }
//public BPARelayCommand<object> RemoveCommand { get; set; }

//public BPABPARelayCommand SaveCommand { get; set; }
//public BPARelayCommand SaveCommand { get; set; }



@@ -42,9 +42,9 @@ public class NewMaterialViewModel : ViewModelBase

public NewMaterialViewModel()
{
RemoveCommand = new BPABPARelayCommand<object>(Remove);
RemoveCommand = new BPARelayCommand<object>(Remove);

SaveCommand = new BPABPARelayCommand(() =>
SaveCommand = new BPARelayCommand(() =>
{
if (MaterialName == String.Empty) { ErrorInfo = "原料名称不能为空"; return; }
if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == MaterialName) != null) { ErrorInfo = "设备中已存在该原料名称"; return; }


+ 4
- 4
BPASmartClient.DosingSystemSingle/ViewModel/NewOutletViewModel.cs 查看文件

@@ -29,9 +29,9 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
Index = Array.FindIndex(Json<DevicePar>.Data.OutletInfoModels.ToArray(), p => p.OutletName == tempOutletInfo.OutletName);
}
}), "OpenNewOutlet", true);
AddCommand = new BPABPARelayCommand(() => { SiloInfos.Add(new RawMaterialInfo()); });
CancelCommand = new BPABPARelayCommand(() => { ActionManage.GetInstance.Send("NewOutletViewClose"); });
SaveCommand = new BPABPARelayCommand(() =>
AddCommand = new BPARelayCommand(() => { SiloInfos.Add(new RawMaterialInfo()); });
CancelCommand = new BPARelayCommand(() => { ActionManage.GetInstance.Send("NewOutletViewClose"); });
SaveCommand = new BPARelayCommand(() =>
{
ObservableCollection<string> SileNames = new ObservableCollection<string>();
SiloInfos.ToList()?.ForEach(item => { SileNames.Add(item.RawMaterialName); });
@@ -82,7 +82,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
}
ActionManage.GetInstance.Send("NewOutletViewClose");
});
RemoveCommand = new BPABPARelayCommand<object>((o) =>
RemoveCommand = new BPARelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{


+ 6
- 6
BPASmartClient.DosingSystemSingle/ViewModel/NewRecipeViewModel.cs 查看文件

@@ -41,7 +41,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
}
}), "Details", true);

AddCommand = new BPABPARelayCommand(() =>
AddCommand = new BPARelayCommand(() =>
{
if (RawMaterials.Count >= DeviceInquire.GetInstance.devices.Count)
{
@@ -62,7 +62,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
else goto p;
});

RemoveCommand = new BPABPARelayCommand<object>((obj) =>
RemoveCommand = new BPARelayCommand<object>((obj) =>
{
if (obj is string rm)
{
@@ -71,7 +71,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
}
});

SaveCommand = new BPABPARelayCommand(() =>
SaveCommand = new BPARelayCommand(() =>
{
if (string.IsNullOrEmpty(RecipeName)) { MessageNotify.GetInstance.ShowDialog("请输入配方名称!", DialogType.Warning); ErrorInfo = "请输入配方名称"; return; }
var tempRes = RawMaterials.GroupBy(p => p.RawMaterialName);
@@ -196,11 +196,11 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
//public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
//private string _mErrorInfo;

//public BPABPARelayCommand AddCommand { get; set; }
//public BPARelayCommand AddCommand { get; set; }

//public BPABPARelayCommand<object> RemoveCommand { get; set; }
//public BPARelayCommand<object> RemoveCommand { get; set; }

//public BPABPARelayCommand SaveCommand { get; set; }
//public BPARelayCommand SaveCommand { get; set; }

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



+ 4
- 4
BPASmartClient.DosingSystemSingle/ViewModel/OutletManagementViewModel.cs 查看文件

@@ -14,14 +14,14 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
{
public OutletManagementViewModel()
{
AddCommand = new BPABPARelayCommand(() =>
AddCommand = new BPARelayCommand(() =>
{
NewOutletView newOutletView = new NewOutletView();
newOutletView.ShowDialog();
});
SaveCommand = new BPABPARelayCommand(() => { Json<DevicePar>.Save(); });
SaveCommand = new BPARelayCommand(() => { Json<DevicePar>.Save(); });
OutletInfoModels = Json<DevicePar>.Data.OutletInfoModels;
RemoveCommand = new BPABPARelayCommand<object>((o) =>
RemoveCommand = new BPARelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
@@ -34,7 +34,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
}
});

DetailsCommand = new BPABPARelayCommand<object>((o) =>
DetailsCommand = new BPARelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{


+ 6
- 6
BPASmartClient.DosingSystemSingle/ViewModel/RecipeControlViewModel.cs 查看文件

@@ -26,9 +26,9 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
static ObservableCollection<string> RawMaterialReset = new ObservableCollection<string>();
public RecipeControlViewModel()
{
StartCommand = new BPABPARelayCommand<object>(RecipeIssued);
ChangeRecipeStateCommand = new BPABPARelayCommand<object>(ChangeRecipeState);
CancelRecipeCommand = new BPABPARelayCommand<object>(CancelRecipe);
StartCommand = new BPARelayCommand<object>(RecipeIssued);
ChangeRecipeStateCommand = new BPARelayCommand<object>(ChangeRecipeState);
CancelRecipeCommand = new BPARelayCommand<object>(CancelRecipe);
RecipeRun();
RecipeStatusInquire();
}
@@ -247,11 +247,11 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
}), "RecipeControlViewModelStatusInquire");
}

public BPABPARelayCommand<object> StartCommand { get; set; }
public BPARelayCommand<object> StartCommand { get; set; }

public BPABPARelayCommand<object> ChangeRecipeStateCommand { get; set; }
public BPARelayCommand<object> ChangeRecipeStateCommand { get; set; }

public BPABPARelayCommand<object> CancelRecipeCommand { get; set; }
public BPARelayCommand<object> CancelRecipeCommand { get; set; }

public static ObservableCollection<RecipeModel> Recipes { get; set; } = Json<LocaPar>.Data.Recipes;



+ 11
- 11
BPASmartClient.DosingSystemSingle/ViewModel/RecipeSettingsViewModel.cs 查看文件

@@ -26,24 +26,24 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
{
Recipes = Json<LocaPar>.Data.Recipes;

NewMaterital = new BPABPARelayCommand(() =>
NewMaterital = new BPARelayCommand(() =>
{
NewMaterialView newMateritalView = new NewMaterialView();
newMateritalView.ShowDialog();
});
NewRecipe = new BPABPARelayCommand(() =>
NewRecipe = new BPARelayCommand(() =>
{
NewRecipeView nrv = new NewRecipeView();
nrv.ShowDialog();
MessageNotify.GetInstance.ShowUserLog("新建配方");
});
SaveRecipe = new BPABPARelayCommand(() =>
SaveRecipe = new BPARelayCommand(() =>
{
Json<LocaPar>.Save();
MessageNotify.GetInstance.ShowUserLog("保存配方");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!");
});
RemoveCommand = new BPABPARelayCommand<object>((o) =>
RemoveCommand = new BPARelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
@@ -65,7 +65,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
}
});

DetailsCommand = new BPABPARelayCommand<object>((o) =>
DetailsCommand = new BPARelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
@@ -82,17 +82,17 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel

}

public BPABPARelayCommand NewMaterital { get; set; }
public BPARelayCommand NewMaterital { get; set; }

public BPABPARelayCommand NewRecipe { get; set; }
public BPARelayCommand NewRecipe { get; set; }

public BPABPARelayCommand SaveRecipe { get; set; }
public BPARelayCommand SaveRecipe { get; set; }

public BPABPARelayCommand<object> EditCommand { get; set; }
public BPARelayCommand<object> EditCommand { get; set; }

public BPABPARelayCommand<object> DetailsCommand { get; set; }
public BPARelayCommand<object> DetailsCommand { get; set; }

public BPABPARelayCommand<object> RemoveCommand { get; set; }
public BPARelayCommand<object> RemoveCommand { get; set; }

public ObservableCollection<RecipeModel> Recipes { get; set; }
}


+ 93
- 93
BPASmartClient.Http/APIHelper.cs 查看文件

@@ -1,101 +1,101 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using Newtonsoft.Json;
using System.Net.Http;
//using Newtonsoft.Json.Linq;
//using System;
//using System.Collections.Generic;
//using System.IO;
//using System.Linq;
//using System.Net;
//using System.Text;
//using System.Threading.Tasks;
//using System.Web;
//using Newtonsoft.Json;
//using System.Net.Http;

namespace BPASmartClient.Http
{
public class APIHelper
{
//namespace BPASmartClient.Http
//{
// public class APIHelper
// {

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

/// <summary>
/// POST 数据请求
/// </summary>
/// <param name="url">地址</param>
/// <param name="data">参数数据</param>
/// <param name="head">请求头</param>
/// <returns></returns>
public string PostData(string url, string data, string head)
{
byte[] b = Encoding.UTF8.GetBytes(data);//把字符串转换为二进制
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Proxy = null;
request.ContentType = "application/json";
request.Method = "POST"; //设置请求方法
request.ContentLength = b.Length; //设置长度
request.Headers["Authorize"] = head;
Stream postStream = request.GetRequestStream(); //requst流
postStream.Write(b, 0, b.Length); //写入POST数据,二进制类型的
postStream.Close(); //关闭
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); //获取response
Stream stream = response.GetResponseStream(); // 得到response响应流
StreamReader sr = new StreamReader(stream);
string str = sr.ReadToEnd(); //读取流
// /// <summary>
// /// POST 数据请求
// /// </summary>
// /// <param name="url">地址</param>
// /// <param name="data">参数数据</param>
// /// <param name="head">请求头</param>
// /// <returns></returns>
// public string PostData(string url, string data, string head)
// {
// byte[] b = Encoding.UTF8.GetBytes(data);//把字符串转换为二进制
// HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
// request.Proxy = null;
// request.ContentType = "application/json";
// request.Method = "POST"; //设置请求方法
// request.ContentLength = b.Length; //设置长度
// request.Headers["Authorize"] = head;
// Stream postStream = request.GetRequestStream(); //requst流
// postStream.Write(b, 0, b.Length); //写入POST数据,二进制类型的
// postStream.Close(); //关闭
// HttpWebResponse response = (HttpWebResponse)request.GetResponse(); //获取response
// Stream stream = response.GetResponseStream(); // 得到response响应流
// StreamReader sr = new StreamReader(stream);
// string str = sr.ReadToEnd(); //读取流

sr.Close();
stream.Close();
return str;
}
// sr.Close();
// stream.Close();
// return str;
// }

public string GetData(string url, string head)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.Accept = "text/html, application/xhtml+xml, */*";
request.ContentType = "application/json";
request.Headers["Authorize"] = head;
byte[] buffer = Encoding.UTF8.GetBytes(head);
request.ContentLength = buffer.Length;
request.GetRequestStream().Write(buffer, 0, buffer.Length);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
using (StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
{
return myStreamReader.ReadToEnd();
}
}
// public string GetData(string url, string head)
// {
// HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
// request.Method = "GET";
// request.Accept = "text/html, application/xhtml+xml, */*";
// request.ContentType = "application/json";
// request.Headers["Authorize"] = head;
// byte[] buffer = Encoding.UTF8.GetBytes(head);
// request.ContentLength = buffer.Length;
// request.GetRequestStream().Write(buffer, 0, buffer.Length);
// HttpWebResponse response = (HttpWebResponse)request.GetResponse();
// using (StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
// {
// return myStreamReader.ReadToEnd();
// }
// }

public string HttpRequest(string url, string head, object data, RequestType requestType)
{
if (requestType == RequestType.POST)
{
return PostData(url, JsonConvert.SerializeObject(data), head);
}
else
{
StringBuilder sb = new StringBuilder();
sb.Append("?");
foreach (System.Reflection.PropertyInfo p in data.GetType().GetProperties())
{
if (sb.ToString().Last() != '?')
{
sb.Append("&");
}
sb.Append(p.Name);
sb.Append("=");
sb.Append(p.GetValue(data));
}
return GetData(url + sb.ToString(), head);
}
}
// public string HttpRequest(string url, string head, object data, RequestType requestType)
// {
// if (requestType == RequestType.POST)
// {
// return PostData(url, JsonConvert.SerializeObject(data), head);
// }
// else
// {
// StringBuilder sb = new StringBuilder();
// sb.Append("?");
// foreach (System.Reflection.PropertyInfo p in data.GetType().GetProperties())
// {
// if (sb.ToString().Last() != '?')
// {
// sb.Append("&");
// }
// sb.Append(p.Name);
// sb.Append("=");
// sb.Append(p.GetValue(data));
// }
// return GetData(url + sb.ToString(), head);
// }
// }

}
// }

public enum RequestType
{
POST,
PUT,
DELETE,
GET
}
}
// public enum RequestType
// {
// POST,
// PUT,
// DELETE,
// GET
// }
//}

+ 4
- 3
BPASmartClient.IoT/DataVClient.cs 查看文件

@@ -5,7 +5,7 @@ using BPASmartClient.Business;
using BPASmartClient.Device;
using BPA.Helper;
using BPASmartClient.IoT.Model;
using BPASmartDatavDeviceClient.IoT;
using System;
using System.Collections.Generic;
@@ -100,7 +100,8 @@ namespace BPASmartClient.IoT
if (DeviceDataV != null && DeviceDataV.GetIsConnected() && DeviceDataV.deviceTable != null)
{
string api = DataVApiAddress + "/api/Device/FlushedDevice";
HttpRequestHelper.HttpGetRequest(api, 1000);
// APIHelper.GetInstance.GetRequest(api, 1000);
APIHelper.GetInstance.GetRequest(api);
//DeviceDataV.IOT_Publish(BroadcastPubTopic, Tools.JsonConvertTools("刷新店铺列表"));
}
}
@@ -212,7 +213,7 @@ namespace BPASmartClient.IoT
}
});
}
if (DeviceDataV.Initialize(DataVApiAddress, ClientId, ListDeviceId.Count==0?"": ListDeviceId?.First().ToString(), ref message))
if (DeviceDataV.Initialize(DataVApiAddress, ClientId, ListDeviceId.Count == 0 ? "" : ListDeviceId?.First().ToString(), ref message))
{
ProductKey = DeviceDataV.deviceTable.productkey;
DeviceName = DeviceDataV.deviceTable.devicename;


+ 4
- 2
BPASmartClient.IoT/Model/DataVReport.cs 查看文件

@@ -193,9 +193,11 @@ namespace BPASmartDatavDeviceClient.IoT
{
string json = string.Empty;
if (string.IsNullOrEmpty(deviceId))
json = HttpRequestHelper.HttpGetRequest($"{url}/api/Device/Query?clientId={clientId}", 1000);
//json = APIHelper.GetInstance.GetRequest($"{url}/api/Device/Query?clientId={clientId}", 1000);
json = APIHelper.GetInstance.GetRequest($"{url}/api/Device/Query?clientId={clientId}");
else
json = HttpRequestHelper.HttpGetRequest($"{url}/api/Device/Query?clientId={clientId}&deviceId={deviceId}");
//json = APIHelper.GetInstance.GetRequest($"{url}/api/Device/Query?clientId={clientId}&deviceId={deviceId}");
json = APIHelper.GetInstance.GetRequest($"{url}/api/Device/Query?clientId={clientId}&deviceId={deviceId}");
JsonMsg<List<DeviceTable>> jsonMsg = Tools.JsonToObjectTools<JsonMsg<List<DeviceTable>>>(json);
if (jsonMsg.obj != null && jsonMsg.obj.data != null)
{


+ 12
- 12
BPASmartClient.IoT/Model/FileUpload.cs 查看文件

@@ -1,5 +1,5 @@
using BPA.Helper;
using BPASmartDatavDeviceClient.IoT;
using DataVAPI.Tool.IOT;
using System;
@@ -27,7 +27,7 @@ namespace BPASmartClient.IoT.Model
/// <summary>
/// 请求反馈信息
/// </summary>
public static FileUploadModelResult modelResult=null;
public static FileUploadModelResult modelResult = null;
/// <summary>
/// 文件请求上传
/// </summary>
@@ -37,8 +37,8 @@ namespace BPASmartClient.IoT.Model
{
try
{
List<QueryDeviceFileResponseBodyData> queryDeviceFiles= Sample.FileQueryALL(DataVClient.GetInstance().DeviceName);
QueryDeviceFileResponseBodyData _data= queryDeviceFiles?.Find(par => par.Name == FileName);
List<QueryDeviceFileResponseBodyData> queryDeviceFiles = Sample.FileQueryALL(DataVClient.GetInstance().DeviceName);
QueryDeviceFileResponseBodyData _data = queryDeviceFiles?.Find(par => par.Name == FileName);
if (_data != null)//删除文件
{
MessageLog.GetInstance.Show("阿里云设备下文件已存在,准备删除续传...");
@@ -66,12 +66,12 @@ namespace BPASmartClient.IoT.Model

FileUploadModel fileUpload = new FileUploadModel();
fileUpload.@params.fileName = FileName;
fileUpload.@params.fileSize =-1;
fileUpload.@params.fileSize = -1;

fileUpload.@params.conflictStrategy = length>130000 ? "append":"overwrite";
fileUpload.@params.conflictStrategy = length > 130000 ? "append" : "overwrite";
//fileUpload.@params.conflictStrategy = "append";// "overwrite";//覆盖模式
//fileUpload.@params.ficMode = "crc64";
//fileUpload.@params.ficValue = CRC.ToCRC16(FileBlock);
//fileUpload.@params.ficMode = "crc64";
//fileUpload.@params.ficValue = CRC.ToCRC16(FileBlock);
fileUpload.@params.initUid = $"ab{RandomHelper.GenerateRandomCode()}";

//上传到阿里云物联网平台的OSS存储空间中
@@ -92,7 +92,7 @@ namespace BPASmartClient.IoT.Model
if (count > 5)
{
MessageLog.GetInstance.Show($"[阿里云上传]:超时上传、未知原因、退出线程.");
return;
}
Thread.Sleep(3000); count++;
@@ -116,19 +116,19 @@ namespace BPASmartClient.IoT.Model
{
MessageLog.GetInstance.ShowEx(ex.ToString());
}
}), "文件请求上传", false);
}), "文件请求上传", isRestart: false);
}

/// <summary>
/// 文件上传
/// </summary>
public static void FileSend(DataVReport dataV, string uploadId,long offset)
public static void FileSend(DataVReport dataV, string uploadId, long offset)
{
FileSendModel fileSend = new FileSendModel();
fileSend.@params.uploadId = uploadId;
fileSend.@params.offset = offset;
fileSend.@params.bSize = FileBlock.Count();
fileSend.@params.isComplete = FileBlock.Count()==130000?false:true;
fileSend.@params.isComplete = FileBlock.Count() == 130000 ? false : true;
//结构如下图
//Header.length(高 低) + Header(字节数组UTF-8) + 文件分片的字节数组 + "分片校验值CrC16 低 高"
byte[] Header = Encoding.UTF8.GetBytes(Tools.JsonConvertTools(fileSend));


+ 3
- 2
BPASmartClient.IoT/Model/IOT/IOTDevServer.cs 查看文件

@@ -154,9 +154,10 @@ namespace DataVAPI.Tool.IOT
try
{
//http://localhost:9092/api/Device/Query?chid=2
string json = HttpRequestHelper.HttpGetRequest($"{APIurl}/api/Device/Query?clientId={ClientId}");
//string json = APIHelper.GetInstance.GetRequest($"{APIurl}/api/Device/Query?clientId={ClientId}");
string json = APIHelper.GetInstance.GetRequest($"{APIurl}/api/Device/Query?clientId={ClientId}");
JsonMsg<List<DeviceTable>> jsonMsg = Tools.JsonToObjectTools<JsonMsg<List<DeviceTable>>>(json);
if (jsonMsg.obj != null && jsonMsg.obj.data!=null)
if (jsonMsg.obj != null && jsonMsg.obj.data != null)
{
device = jsonMsg.obj.data.FirstOrDefault();
if (device == null) return false;


+ 29
- 0
BPASmartClient.Model/LocaPath.cs 查看文件

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

namespace BPASmartClient.Model
{
public class LocaPath
{
public static string FilePath { get; set; } = string.Empty;

public static string Getpath(string name)
{
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"{FilePath}\\JSON"));
return $"{AppDomain.CurrentDomain.BaseDirectory}{FilePath}JSON\\{name}.json";
}

public static string GetDeviceConfigPath
{
get
{
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\DeviceConfig"));
return $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\DeviceConfig\\";
}
}

}
}

+ 7
- 6
BPASmartClient.MorkM/Control_MORKM.cs 查看文件

@@ -16,6 +16,7 @@ using System.Collections.ObjectModel;
using BPASmartClient.Model.PLC;
using BPASmartClient.MorkM.ViewModel;
using BPA.Message;
using static BPA.Helper.EventBus;

namespace BPASmartClient.MorkM
{
@@ -59,7 +60,7 @@ namespace BPASmartClient.MorkM
Loc = 11,
SuborderId = subId,
MakeType = false
}) ;
});
mORKS.DishNumber = orders.Count;//订单中配菜的数量
while (orders.Count > 0)
{
@@ -161,7 +162,7 @@ namespace BPASmartClient.MorkM
List<OrderLocInfo> locs = new List<OrderLocInfo>();
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res =orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
if (ushort.TryParse(res.BatchingLoc, out ushort loc))
@@ -269,7 +270,7 @@ namespace BPASmartClient.MorkM
TakeBowlControl(orderLocInfo.Loc);
SetRecipeNumber(orderLocInfo.RecipeNumber);
OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
DeviceProcessLogShow($"订单【{mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
}
mORKS.TakeBowlInterlock = true;
}
@@ -386,13 +387,13 @@ namespace BPASmartClient.MorkM
{
values.Add(2);//分
values.Add(0);//秒
EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = $"VW{ 116 + (loc * 6) }", Value = values.ToArray() });
EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = $"VW{116 + (loc * 6)}", Value = values.ToArray() });
}
else //荤菜
{
values.Add(4);//分
values.Add(0);//秒
EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = $"VW{ 116 + (loc * 6) }", Value = values.ToArray() });
EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = $"VW{116 + (loc * 6)}", Value = values.ToArray() });
}


@@ -813,7 +814,7 @@ namespace BPASmartClient.MorkM
}
});
}
public override void DoMain()
{
MonitorViewModel.DeviceId = DeviceId;


+ 3
- 2
BPASmartClient.MorkMV1/Control_MorkMV1.cs 查看文件

@@ -8,7 +8,7 @@ using BPASmartClient.Peripheral;

using BPA.Helper;
using System.Threading;
using BPA.Message;
using System.Linq;
using BPASmartClient.Model.PLC;
@@ -24,6 +24,7 @@ using System.Windows.Forms;
using System.Media;
using BPASmartClient.CustomResource;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using static BPA.Helper.EventBus;
//using BPA.Helper;

namespace BPASmartClient.MorkMV1
@@ -291,7 +292,7 @@ namespace BPASmartClient.MorkMV1
{
if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1)
{
var tt = ushorts.UshortsToBytes(true).BytesToUshorts();
var tt = ushorts.ToBytes(true).ToUshorts();

for (byte i = 0; i < 6; i++)
{


+ 13
- 4
BPASmartClient.MorkMV1/DataServer.cs 查看文件

@@ -4,9 +4,10 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BPASmartClient.MQTT;
using BPA.Message;
using BPASmartClient.Model;
using BPA.Communication;


namespace BPASmartClient.MorkMV1
{
@@ -19,10 +20,10 @@ namespace BPASmartClient.MorkMV1

public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS();

MQTTProxy mQTTProxy = new MQTTProxy();
MqttHelper mQTTProxy = new MqttHelper();
public void Init()
{
mQTTProxy.Connected = new Action(() =>
mQTTProxy.ConnectOk = new Action(() =>
{
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机));
ThreadManage.GetInstance().StartLong(new Action(() =>
@@ -35,7 +36,15 @@ namespace BPASmartClient.MorkMV1
Thread.Sleep(100);
}), "海科食堂大屏监听");
});
mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
//mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
mQTTProxy.Connect(new BPA.Communication.Base.ConfigurationOptions()
{
UserName = "UserName",
Password = "Password",
IpAddress = "Host",
Port = 1883,
ClientId = $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"
});
}

//订单信息(正在制作,等待制作,制作完成)


+ 0
- 3
BPASmartClient.MorkMV1/GlobalUsing.cs 查看文件

@@ -2,13 +2,10 @@
global using System.Collections.Generic;
global using BPA.Message.Enum;
global using BPASmartClient.Device;
global
global using BPASmartClient.Model;
global using BPASmartClient.Peripheral;
global
global using BPA.Helper;
global using System.Threading;
global
global using BPA.Message;
global using System.Linq;
global using BPASmartClient.Model.PLC;


+ 1
- 1
BPASmartClient.MorkMW/Control_MorkMW.cs 查看文件

@@ -20,7 +20,7 @@ using System.Net.Http.Json;
using System.Reflection;
using System.Threading;
using System.Windows.Documents;
using static BPA.Helper.EventBus;

namespace BPASmartClient.MorkMW
{


+ 2
- 1
BPASmartClient.MorkS/Control_Morks.cs 查看文件

@@ -8,7 +8,7 @@ using BPASmartClient.Peripheral;

using BPA.Helper;
using System.Threading;
using BPA.Message;
using System.Linq;
using BPASmartClient.Model.PLC;
@@ -24,6 +24,7 @@ using System.Speech.Synthesis;
using System.Windows.Forms;
using System.Media;
using BPASmartClient.CustomResource;
using static BPA.Helper.EventBus;

namespace BPASmartClient.MorkS
{


+ 12
- 4
BPASmartClient.MorkS/DataServer.cs 查看文件

@@ -5,9 +5,9 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BPA.Helper;
using BPASmartClient.MQTT;
using BPA.Message;
using BPASmartClient.Model;
using BPA.Communication;

namespace BPASmartClient.MorkS
{
@@ -20,10 +20,10 @@ namespace BPASmartClient.MorkS

public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS();

MQTTProxy mQTTProxy = new MQTTProxy();
MqttHelper mQTTProxy = new MqttHelper();
public void Init()
{
mQTTProxy.Connected = new Action(() =>
mQTTProxy.ConnectOk = new Action(() =>
{
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机));
ThreadManage.GetInstance().StartLong(new Action(() =>
@@ -36,7 +36,15 @@ namespace BPASmartClient.MorkS
Thread.Sleep(100);
}), "海科食堂大屏监听");
});
mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
//mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
mQTTProxy.Connect(new BPA.Communication.Base.ConfigurationOptions()
{
UserName = "UserName",
Password = "Password",
IpAddress = "Host",
Port = 1883,
ClientId = $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"
});
}

//订单信息(正在制作,等待制作,制作完成)


+ 28
- 23
BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs 查看文件

@@ -8,7 +8,7 @@ using BPASmartClient.Peripheral;

using BPA.Helper;
using System.Threading;
using BPA.Message;
using System.Linq;
using BPASmartClient.Model.PLC;
@@ -23,6 +23,7 @@ using BPA.Models;
using System.Windows.Forms;
using System.Media;
using BPASmartClient.CustomResource;
using static BPA.Helper.EventBus;
//using BPA.Helper;

namespace BPASmartClient.MorkSUpgradedVer
@@ -343,7 +344,7 @@ namespace BPASmartClient.MorkSUpgradedVer
{
if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1)
{
var tt = ushorts.UshortsToBytes(true).BytesToUshorts();
var tt = ushorts.ToBytes(true).ToUshorts();

for (byte i = 0; i < 6; i++)
{
@@ -656,9 +657,11 @@ namespace BPASmartClient.MorkSUpgradedVer
//values.Add(Json<MorksPar>.Data.parSets.ElementAt(loc).Minute);
//values.Add(Json<MorksPar>.Data.parSets.ElementAt(loc).Second);
//WriteData($"VW{324 + (loc * 4)}", values.ToArray());
if (mORKS.CurrentFeedbackLoc >= 1 && mORKS.CurrentFeedbackLoc <= 5) {
if (mORKS.CurrentFeedbackLoc >= 1 && mORKS.CurrentFeedbackLoc <= 5)
{
var x = Json<MorksPar>.Data.DishLibraryParSets.FirstOrDefault(p => p.TextBlockContext == mORKS.CurrentFeedbackLoc.ToString());
if (x != null) {
if (x != null)
{
List<ushort> values = new List<ushort>();
values.Add(x.Minute);
values.Add(x.Second);
@@ -711,24 +714,26 @@ namespace BPASmartClient.MorkSUpgradedVer
//}
#endregion

for (int loc = 0; loc < mORKS.CookNodelId.Length; loc++) {
if (mORKS.CookNoodleCom[loc]&&!mORKS.RobotOutDinnigLock) {
SetTakeNoodleLoc((ushort)(loc + 1));
mORKS.NoodleCookerStatus[loc] = false;
WriteData($"VW260", (ushort)0);//设置出汤时间
OrderChange(mORKS.CookNodelId[loc], ORDER_STATUS.COMPLETED_COOK);
DeviceProcessLogShow($"订单【{mORKS.CookNodelId[loc]}】制作完成");
mORKS.CookCompleteFlatBit = true;
mORKS.OutMealId = mORKS.CookNodelId[loc];
mORKS.OutMealName = mORKS.IngredientsCompleteName;
mORKS.OutMealSortNum = mORKS.IngredientsCompleteSortNum;
mORKS.IngredientsCompleteId = string.Empty;
mORKS.CookNodelId[loc] = string.Empty;
DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{mORKS.OutMealId}");
mORKS.CookNoodleCom[loc] = false;
mORKS.RobotOutDinnigLock = true;
}
for (int loc = 0; loc < mORKS.CookNodelId.Length; loc++)
{

if (mORKS.CookNoodleCom[loc] && !mORKS.RobotOutDinnigLock)
{
SetTakeNoodleLoc((ushort)(loc + 1));
mORKS.NoodleCookerStatus[loc] = false;
WriteData($"VW260", (ushort)0);//设置出汤时间
OrderChange(mORKS.CookNodelId[loc], ORDER_STATUS.COMPLETED_COOK);
DeviceProcessLogShow($"订单【{mORKS.CookNodelId[loc]}】制作完成");
mORKS.CookCompleteFlatBit = true;
mORKS.OutMealId = mORKS.CookNodelId[loc];
mORKS.OutMealName = mORKS.IngredientsCompleteName;
mORKS.OutMealSortNum = mORKS.IngredientsCompleteSortNum;
mORKS.IngredientsCompleteId = string.Empty;
mORKS.CookNodelId[loc] = string.Empty;
DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{mORKS.OutMealId}");
mORKS.CookNoodleCom[loc] = false;
mORKS.RobotOutDinnigLock = true;
}
}
}
}
@@ -760,7 +765,7 @@ namespace BPASmartClient.MorkSUpgradedVer
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成");
WriteData("M10.1", false);

var orderEvent= mORKS.doOrderEvents.FirstOrDefault(order => order.MorkOrder.SuborderId == mORKS.OutMealId);
var orderEvent = mORKS.doOrderEvents.FirstOrDefault(order => order.MorkOrder.SuborderId == mORKS.OutMealId);
mORKS.OutMealSortNum = orderEvent?.MorkOrder.SortNum ?? 0;

DeviceProcessLogShow($"出餐订单序号【{mORKS.OutMealSortNum}】");


+ 12
- 4
BPASmartClient.MorkSUpgradedVer/DataServer.cs 查看文件

@@ -4,9 +4,9 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BPASmartClient.MQTT;
using BPA.Message;
using BPASmartClient.Model;
using BPA.Communication;

namespace BPASmartClient.MorkSUpgradedVer
{
@@ -19,10 +19,10 @@ namespace BPASmartClient.MorkSUpgradedVer

public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS();

MQTTProxy mQTTProxy = new MQTTProxy();
MqttHelper mQTTProxy = new MqttHelper();
public void Init()
{
mQTTProxy.Connected = new Action(() =>
mQTTProxy.ConnectOk = new Action(() =>
{
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机));
ThreadManage.GetInstance().StartLong(new Action(() =>
@@ -35,7 +35,15 @@ namespace BPASmartClient.MorkSUpgradedVer
Thread.Sleep(100);
}), "海科食堂大屏监听");
});
mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
//mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
mQTTProxy.Connect(new BPA.Communication.Base.ConfigurationOptions()
{
UserName = "UserName",
Password = "Password",
IpAddress = "Host",
Port = 1883,
ClientId = $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"
});
}

//订单信息(正在制作,等待制作,制作完成)


+ 0
- 3
BPASmartClient.MorkSUpgradedVer/GlobalUsing.cs 查看文件

@@ -2,13 +2,10 @@
global using System.Collections.Generic;
global using BPA.Message.Enum;
global using BPASmartClient.Device;
global
global using BPASmartClient.Model;
global using BPASmartClient.Peripheral;
global
global using BPA.Helper;
global using System.Threading;
global
global using BPA.Message;
global using System.Linq;
global using BPASmartClient.Model.PLC;


+ 1
- 0
BPASmartClient.MorkT.Lebai.JC/Control_MORKJC2.cs 查看文件

@@ -17,6 +17,7 @@ using BPASmartClient.Model;
using BPASmartClient.Model.乐白机器人;
using BPASmartClient.Model.单片机;
using static BPA.Helper.EventBus;

namespace BPASmartClient.MorkTLebaiJC
{


+ 17
- 17
BPASmartClient.MorkT/Control_MorkT.cs 查看文件

@@ -6,7 +6,7 @@ using BPASmartClient.GSIceCream;
using BPA.Helper;
using BPASmartClient.Lebai;
using BPASmartClient.LebaiRobot;
using BPASmartClient.Model;
using BPASmartClient.Model.乐白机器人;
using BPASmartClient.Model.乐白机器人.Enum;
@@ -22,7 +22,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static BPA.Helper.EventBus;

namespace BPASmartClient.MorkT
{
@@ -208,7 +208,7 @@ namespace BPASmartClient.MorkT
morkT.IceCreamError = error;
}
}));
GetStatus("IceCreamDLCompleted", new Action<object>((o) =>
{
if (o is bool b)
@@ -420,7 +420,7 @@ namespace BPASmartClient.MorkT
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_接咖啡后回原点 }); //接咖啡后回原点
Wait();
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
EventBus.GetInstance().Publish(new DRCoffee_MakeCoffeeEvent() {DeviceId = DeviceId, DrinkCode = (BPASmartClient.Model.咖啡机.Enum.DrCoffeeDrinksCode)int.Parse(orderLoc.Loc) });//接咖啡控制
EventBus.GetInstance().Publish(new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (BPASmartClient.Model.咖啡机.Enum.DrCoffeeDrinksCode)int.Parse(orderLoc.Loc) });//接咖啡控制
DeviceProcessLogShow($"发送咖啡机制作{orderLoc.Loc}!");
morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc;
}
@@ -469,9 +469,9 @@ namespace BPASmartClient.MorkT
/// <param name="order"></param>
private void GetAndCheeckCoffe(OrderLocInfo order)
{
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 },(o)=>{ });
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { });
OrderChange(order.SuborderId, ORDER_STATUS.COOKING);
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_取咖啡杯 }); //SENCE_取咖啡杯
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_取咖啡杯 }); //SENCE_取咖啡杯

Wait();
// EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制
@@ -489,10 +489,10 @@ namespace BPASmartClient.MorkT
int count = 1;
bool result = true;
p:
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_咖啡杯检测 }); //SENCE_咖啡杯检测
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_咖啡杯检测 }); //SENCE_咖啡杯检测
Wait();
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
EventBus.GetInstance().Publish(new LebaiRobot_GetTCPInputEvent { DeviceId = DeviceId, Pin = 1 }, (o)=>
EventBus.GetInstance().Publish(new LebaiRobot_GetTCPInputEvent { DeviceId = DeviceId, Pin = 1 }, (o) =>
{
if (o != null && o.Length > 0 && o[0] is bool resultValue)
{
@@ -506,14 +506,14 @@ namespace BPASmartClient.MorkT
{
//退出循环回到初始位置
DeviceProcessLogShow($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!");
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_咖啡杯回原点 }); //SENCE_咖啡杯回原点
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_咖啡杯回原点 }); //SENCE_咖啡杯回原点
Wait();
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
morkT.GetCoffeeCup = false;
return;
}
DeviceProcessLogShow("执行二次取咖啡杯");
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_二次取咖啡杯 }); //SENCE_二次取咖啡杯
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_二次取咖啡杯 }); //SENCE_二次取咖啡杯
Wait();
EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
@@ -619,22 +619,22 @@ namespace BPASmartClient.MorkT
bool result = true;
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
p:
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_冰淇淋杯检测 }); //SENCE_冰淇淋杯检测
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_冰淇淋杯检测 }); //SENCE_冰淇淋杯检测
Wait();
Thread.Sleep(500);
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) =>
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) =>
{
if (o != null && o.Length > 0 && o[0] is SignalResult res)
{
MessageLog.GetInstance.Show(res.ToString());
}
});
while((int)peripheralStatus["RobotValue"] != 0)
while ((int)peripheralStatus["RobotValue"] != 0)
{
Thread.Sleep(10);
}
MessageLog.GetInstance.Show($"乐白机器人信号值{peripheralStatus["RobotValue"].ToString()}");
//while ((ELebaiRModel)peripheralStatus["RobotMode"] !=ELebaiRModel.空闲状态)
//{
// EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 });
@@ -656,12 +656,12 @@ namespace BPASmartClient.MorkT
DeviceProcessLogShow($"执行{count}次取冰淇淋杯,仍未成功,订单默认废弃,机器人回到初始位置!");
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_冰淇淋杯回原点 }); //SENCE_冰淇淋杯回原点
Wait();
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 },(o) => { });
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
morkT.GetIceCreamCup = false;
return;
}
DeviceProcessLogShow($"执行{count}次取冰淇淋杯!");
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_二次取冰淇淋杯 }); //SENCE_二次取冰淇淋杯
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_二次取冰淇淋杯 }); //SENCE_二次取冰淇淋杯
EventBus.GetInstance().Equals(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制
Wait();
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
@@ -742,7 +742,7 @@ namespace BPASmartClient.MorkT
});
Thread.Sleep(500);
}
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_放冰淇淋位置 }); //SENCE_放冰淇淋位置
Wait();
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });


+ 11
- 9
BPASmartClient.MorkTSingle/Control_MORKJC.cs 查看文件

@@ -18,7 +18,8 @@ using BPASmartClient.Model.PLC;
using BPASmartClient.Model.单片机;
using BPASmartClient.Business;
using BPASmartClient.KLMCoffee.Protocal;
using static BPA.Helper.EventBus;

namespace BPASmartClient.MorkTSingle
{
/*
@@ -58,7 +59,7 @@ namespace BPASmartClient.MorkTSingle

}
ConcurrentQueue<MorkOrderPush> morkOrderPushes = new ConcurrentQueue<MorkOrderPush>();
/// <summary>
///
/// </summary>
@@ -83,7 +84,7 @@ namespace BPASmartClient.MorkTSingle
}
}
DateTime delayTimeOut_Coffee;
private void DoCoffee()
private void DoCoffee()
{
if (IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && !morkT.IsCoffeeMake /*&& morkT.coffeeState== K95SysTemStatus.空闲状态*/)
{
@@ -93,13 +94,13 @@ namespace BPASmartClient.MorkTSingle
{
new KLMCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, KLMDrinkFaultCode = (KLMDrinkFaultType)(morkT.morkOrderPushesCoffee.ElementAt(0).Loc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水
}
else
else
{
new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish();
}
morkT.IsCoffeeMake = true;
}
else if (morkT.MakeCoffeeFinish && IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && morkT.IsCoffeeMake)
else if (morkT.MakeCoffeeFinish && IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && morkT.IsCoffeeMake)
{
OrderChange(morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow($"{morkT.morkOrderPushesCoffee.ElementAt(0).GoodName}制作完成");
@@ -171,7 +172,7 @@ namespace BPASmartClient.MorkTSingle
{
//验证商品是做的某种饮料
if (ValidateGoodsByBatching(res.BatchingLoc) != GOODS_TYPE.NEITHER)
{
{
//获取当前物料所属商品类型
currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc);
}
@@ -235,7 +236,8 @@ namespace BPASmartClient.MorkTSingle
morkT.KLMCoffeeIsConnected = b;
}
}));
if ( morkT.morkOrderPushesCoffee.Count > 0) {
if (morkT.morkOrderPushesCoffee.Count > 0)
{
if (morkT.KLMCoffeeIsConnected)
{
if (morkT.IsCoffeeMake)
@@ -248,7 +250,7 @@ namespace BPASmartClient.MorkTSingle
morkT.MakeCoffeeFinish = true;
});
}
else
else
{
EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
@@ -297,7 +299,7 @@ namespace BPASmartClient.MorkTSingle
});
/*string aa = calLrcCommon("01" + "01" + "0001");
string bb = ":01010001" + aa + "\r\n";*/
}
public static string calLrcCommon(string data)
{


+ 28
- 27
BPASmartClient.MorkT_BarCounter/Control_MorkT_BarCounter.cs 查看文件

@@ -14,7 +14,7 @@ using BPASmartClient.Model.咖啡机.Enum;
using BPASmartClient.Model;


using BPASmartClient.Model.乐白机器人;
using BPASmartClient.Model.单片机;
using BPASmartClient.Model.PLC;
@@ -23,6 +23,7 @@ using BPASmartClient.LebaiRobot;
using BPASmartClient.RobotGripper;
using BPASmartClient.Model.电夹爪;
using BPASmartClient.Model.奶茶味魔方;
using static BPA.Helper.EventBus;

namespace BPASmartClient.MorkT_BarCounter
{
@@ -45,7 +46,7 @@ namespace BPASmartClient.MorkT_BarCounter
private string mainMaterialLoc;
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } }

GVL_MorkT morkT =new GVL_MorkT();
GVL_MorkT morkT = new GVL_MorkT();
/// <summary>
/// 果汁机做法,true:热饮,false:冷饮
/// </summary>
@@ -81,7 +82,7 @@ namespace BPASmartClient.MorkT_BarCounter
}
private void DataParse()
{
EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{
if (@event == null) return;
@@ -117,14 +118,14 @@ namespace BPASmartClient.MorkT_BarCounter
switch (currentGoodsType)
{
case GOODS_TYPE.COFFEE:
if (morkT.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
{
morkT.morkOrderPushesCoffee.Enqueue(new OrderLocInfo()
{
SuborderId = order.MorkOrder.SuborderId,
BatchingId = res.BatchingId,
Loc = ushort.Parse( mainMaterialLoc),
Loc = ushort.Parse(mainMaterialLoc),
GoodName = order.MorkOrder.GoodsName,
});
morkT.morkOrderPushesAll.Enqueue(new OrderLocInfo()
@@ -134,7 +135,7 @@ namespace BPASmartClient.MorkT_BarCounter
Loc = ushort.Parse(mainMaterialLoc),
GoodName = order.MorkOrder.GoodsName,
});
}
break;
//case GOODS_TYPE.JUICE:
@@ -194,7 +195,7 @@ namespace BPASmartClient.MorkT_BarCounter
/// 将空杯放好到接饮料的地方的标志位
/// </summary>
private bool bFirstTrig_MilkTea = false;
private bool bFirstTrig_Coffee = false;
private bool bFirstTrig_Coffee = false;
/// <summary>
/// 延迟的超时时间
/// </summary>
@@ -206,7 +207,7 @@ namespace BPASmartClient.MorkT_BarCounter
{
if (morkT.IsHaveCoffeeCup && morkT.MakeCoffeeEnd != true)
morkT.MakeCoffeeEnd = true;
bFirstTrig_Coffee = false;
bFirstTrig_Coffee = false;
});
if (morkT.IsHaveCoffeeCup && morkT.MakeCoffeeEnd != true)
{
@@ -215,7 +216,7 @@ namespace BPASmartClient.MorkT_BarCounter
bFirstTrig_Coffee = true;
delayTimeOut_Coffee = DateTime.Now;
}
else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 180 && bFirstTrig_Coffee == true)
else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 180 && bFirstTrig_Coffee == true)
{
DeviceProcessLogShow("接咖啡超时,接咖啡结束,等待取咖啡");
bFirstTrig_Coffee = false;
@@ -235,9 +236,9 @@ namespace BPASmartClient.MorkT_BarCounter
DeviceProcessLogShow("接茶或水延迟时间结束");
morkT.MakeMilkTeaEnd = true;
}
if ( GetStatus<bool>("Get_MilkTeaCubeStatus") == true)
if (GetStatus<bool>("Get_MilkTeaCubeStatus") == true)
{
while(GetStatus<bool>("Get_MilkTeaCubeDosingStatus") == true)
while (GetStatus<bool>("Get_MilkTeaCubeDosingStatus") == true)
{
if (morkT.IsHaveTeaMilkTeaCup && morkT.MakeMilkTeaEnd != true)
{
@@ -284,9 +285,9 @@ namespace BPASmartClient.MorkT_BarCounter
/// </summary>
/// <param name="value"></param>
/// <param name="pin"></param>
private void Output(bool value,int pin)
private void Output(bool value, int pin)
{
new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Pin = pin,Value=value }.Publish();
new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Pin = pin, Value = value }.Publish();
}
private T GetStatus<T>(string key)
{
@@ -304,14 +305,14 @@ namespace BPASmartClient.MorkT_BarCounter
/// 传感器的输入信号 0:无意义 1:有信号 2:无信号 3:信号不正确
/// </summary>
int bSensorInput;
/// <summary>
/// 判断是否有咖啡订单
/// </summary>
/// <returns></returns>
private bool IsMakeCoffee()
private bool IsMakeCoffee()
{
bool bMake = (IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && !morkT.IsHaveCoffeeCup && morkT.morkOrderPushesAll.ElementAt(0).SuborderId == morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId) ? true : false;
bool bMake = (IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && !morkT.IsHaveCoffeeCup && morkT.morkOrderPushesAll.ElementAt(0).SuborderId == morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId) ? true : false;
return bMake;
}
/// <summary>
@@ -320,7 +321,7 @@ namespace BPASmartClient.MorkT_BarCounter
/// <returns></returns>
private bool IsMakeJuice()
{
bool bMake = (IsHealth && morkT.morkOrderPushesJuicer.Count > 0 && !morkT.IsHaveJuiceCup && morkT.morkOrderPushesAll.ElementAt(0).SuborderId == morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId) ? true : false;
bool bMake = (IsHealth && morkT.morkOrderPushesJuicer.Count > 0 && !morkT.IsHaveJuiceCup && morkT.morkOrderPushesAll.ElementAt(0).SuborderId == morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId) ? true : false;
return bMake;
}
/// <summary>
@@ -338,20 +339,20 @@ namespace BPASmartClient.MorkT_BarCounter
/// <returns></returns>
private bool IsMakeWater()
{
bool bMake = (IsHealth && morkT.morkOrderPushesWater.Count > 0 && !morkT.IsHaveTeaMilkTeaCup) ? true : false;
bool bMake = (IsHealth && morkT.morkOrderPushesWater.Count > 0 && !morkT.IsHaveTeaMilkTeaCup) ? true : false;
return bMake;
}
/// <summary>
/// 做咖啡流程
/// </summary>
private void DoCoffee()
private void DoCoffee()
{
if (IsMakeCoffee())
{
Discharge_Control(Kind.咖啡);//接咖啡
morkT.IsHaveCoffeeCup = true;
}
else if(morkT.MakeCoffeeEnd)
else if (morkT.MakeCoffeeEnd)
{
try
{
@@ -368,7 +369,7 @@ namespace BPASmartClient.MorkT_BarCounter
}
}
}
private void DoMilkTea()
private void DoMilkTea()
{
if (IsMakeMilkTea())
{
@@ -414,7 +415,7 @@ namespace BPASmartClient.MorkT_BarCounter
{
if (kind == Kind.咖啡)
{
new WriteJaka() { DeviceId =DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯位_接咖啡位 }.Publish();
new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯位_接咖啡位 }.Publish();
JakaWait(int.Parse(JakaModel.SENCE_取杯位_接咖啡位));

new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)(morkT.morkOrderPushesCoffee.ElementAt(0).Loc) }.Publish(); //控制咖啡出料
@@ -426,7 +427,7 @@ namespace BPASmartClient.MorkT_BarCounter

//DeviceProcessLogShow("接咖啡杯动作完成");
}
else
else
{
new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯位_接奶茶位 }.Publish();
JakaWait(int.Parse(JakaModel.SENCE_取杯位_接奶茶位));
@@ -608,7 +609,7 @@ namespace BPASmartClient.MorkT_BarCounter
JakaWait(int.Parse(JakaModel.SENCE_初始位_取杯位));

int cnt = 0;
p: new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_落杯 }.Publish();
p: new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_落杯 }.Publish();
JakaWait(int.Parse(JakaModel.SENCE_落杯));
cnt = cnt + 1;
if (!GetStatus<bool>("Get_JakaRobotDI5"))
@@ -647,7 +648,7 @@ namespace BPASmartClient.MorkT_BarCounter
}
public void SimOrder<T>(T simOrder)
{
}
private void JakaWait(int value)
{
@@ -897,11 +898,11 @@ namespace BPASmartClient.MorkT_BarCounter
DeviceProcessLogShow("----开始模拟订单----");
if (msm.OrderNum == 1)
{
morkT.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() { Loc =(ushort)msm.DrinkCode, SuborderId = guid, GoodName="模拟咖啡订单" });
morkT.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.DrinkCode, SuborderId = guid, GoodName = "模拟咖啡订单" });
}
else if (msm.OrderNum == 2)
{
morkT.morkOrderPushesJuicer.Enqueue(new OrderLocInfo() { Loc = (ushort) (msm.JuiceList + 51), makeID = msm.JuiceMakeID, SuborderId = guid, GoodName = "模拟果汁订单" });
morkT.morkOrderPushesJuicer.Enqueue(new OrderLocInfo() { Loc = (ushort)(msm.JuiceList + 51), makeID = msm.JuiceMakeID, SuborderId = guid, GoodName = "模拟果汁订单" });
}
else if (msm.OrderNum == 3)
{


+ 1
- 0
BPASmartClient.MorkT_Container/Control_MorkT_Container.cs 查看文件

@@ -21,6 +21,7 @@ using BPASmartClient.Model.PLC;
using BPASmartClient.DRCoffee;
using BPASmartClient.LebaiRobot;
using System.Text.RegularExpressions;
using static BPA.Helper.EventBus;

namespace BPASmartClient.MorkT_Container
{


+ 29
- 29
BPASmartClient.MorkT_HQ/Control_MorkTHQ.cs 查看文件

@@ -8,7 +8,7 @@ using BPA.Helper;
using BPASmartClient.KLMCoffee.Protocal;
using BPASmartClient.Lebai;
using BPASmartClient.LebaiRobot;
using BPASmartClient.Model;
using BPASmartClient.Model.乐白机器人;
using BPASmartClient.Model.冰淇淋.Enum;
@@ -22,7 +22,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static BPA.Helper.EventBus;

namespace BPASmartClient.MorkTHQ
{
@@ -35,7 +35,7 @@ namespace BPASmartClient.MorkTHQ

public override void DoMain()
{
if(Json<KeepDataBase>.Data.IsVerify)
if (Json<KeepDataBase>.Data.IsVerify)
{
IsHealth = true;
}
@@ -74,7 +74,7 @@ namespace BPASmartClient.MorkTHQ

public override void MainTask()
{
//制作咖啡
//制作咖啡
MakeCoffeeProcess();
//制作果汁
MakeJuiceProcess();
@@ -82,7 +82,7 @@ namespace BPASmartClient.MorkTHQ
MakeIceCreamProcess();
//制作完取咖啡
MakeCoffeeComplete();


}
@@ -99,7 +99,7 @@ namespace BPASmartClient.MorkTHQ

GetStatus("RobotMode", new Action<object>((o) =>
{
if (o is ELebaiRModel eLebaiRModel)
if (o is ELebaiRModel eLebaiRModel)
{
morkT.RobotMode = eLebaiRModel;
}
@@ -287,7 +287,7 @@ namespace BPASmartClient.MorkTHQ
morkT.batchings = PolymerBatching.BuildAll();
//商品类型
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER;
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
@@ -333,7 +333,7 @@ namespace BPASmartClient.MorkTHQ
}
break;
case GOODS_TYPE.JUICE:
if(morkT.morkOrderPushesIceCream.FirstOrDefault(p=>p.SuborderId == order?.MorkOrder.SuborderId) == null)
if (morkT.morkOrderPushesIceCream.FirstOrDefault(p => p.SuborderId == order?.MorkOrder.SuborderId) == null)
{
morkT.GuMake = order.MorkOrder.MakeID == "2";
morkT.morkOrderPushesJuice.Enqueue(new OrderLocInfo()
@@ -351,7 +351,7 @@ namespace BPASmartClient.MorkTHQ
break;
}
}
}
}
}
@@ -367,9 +367,9 @@ namespace BPASmartClient.MorkTHQ
return morkT.batchings[batchingLoc].GoodsType;
return GOODS_TYPE.NEITHER;
}




private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
{
@@ -408,16 +408,16 @@ namespace BPASmartClient.MorkTHQ
DeviceProcessLogShow($"开始制作 [咖啡] 订单[{orderLoc.SortNum}]");
GetAndCheeckCoffe(orderLoc);//取咖啡杯
if (!morkT.GetCoffeeCup) return;
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10051}); //接咖啡后回原点
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10051 }); //接咖啡后回原点
Wait();
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
EventBus.GetInstance().Publish(new KLMCoffee_MakeCoffeeEvent() {DeviceId = DeviceId, DrinkCode = (Model.咖啡机.Enum.DrinkType)int.Parse(orderLoc.Loc) });//接咖啡控制
EventBus.GetInstance().Publish(new KLMCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (Model.咖啡机.Enum.DrinkType)int.Parse(orderLoc.Loc) });//接咖啡控制
DeviceProcessLogShow($"发送咖啡机制作{orderLoc.Loc}!");
morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc;
}

}


}
@@ -461,13 +461,13 @@ namespace BPASmartClient.MorkTHQ
/// <param name="order"></param>
private void GetAndCheeckCoffe(OrderLocInfo order)
{
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 },(o)=>{ });
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { });
OrderChange(order.SuborderId, ORDER_STATUS.COOKING);
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10031 }); //SENCE_取咖啡杯
Wait();
Thread.Sleep(500);
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
morkT.GetCoffeeCup = true;
DeviceProcessLogShow("取咖啡杯完成");
}
@@ -535,7 +535,7 @@ namespace BPASmartClient.MorkTHQ
//CheckICeCreaCup();
GetIceCream(order);
PutIceCream(order);
}

/// <summary>
@@ -564,19 +564,19 @@ namespace BPASmartClient.MorkTHQ
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10034 }); //SENCE_冰淇淋杯检测
Wait();
Thread.Sleep(500);
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) =>
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) =>
{
if (o != null && o.Length > 0 && o[0] is SignalResult res)
{
MessageLog.GetInstance.Show(res.ToString());
}
});
while((int)peripheralStatus["RobotValue"] != 0)
while ((int)peripheralStatus["RobotValue"] != 0)
{
Thread.Sleep(10);
}
MessageLog.GetInstance.Show($"乐白机器人信号值{peripheralStatus["RobotValue"].ToString()}");
//while ((ELebaiRModel)peripheralStatus["RobotMode"] !=ELebaiRModel.空闲状态)
//{
// EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 });
@@ -598,7 +598,7 @@ namespace BPASmartClient.MorkTHQ
DeviceProcessLogShow($"执行{count}次取冰淇淋杯,仍未成功,订单默认废弃,机器人回到初始位置!");
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10049 }); //SENCE_冰淇淋杯回原点
Wait();
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 },(o) => { });
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
morkT.GetIceCreamCup = false;
return;
}
@@ -637,7 +637,7 @@ namespace BPASmartClient.MorkTHQ
//DeviceProcessLogShow("开始等待6s");
//Thread.Sleep(5000);

// 出料
// 出料
EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId }, (o) =>
{
doItResult = (bool)o[0];
@@ -680,7 +680,7 @@ namespace BPASmartClient.MorkTHQ
});
Thread.Sleep(500);
}
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10056 }); //SENCE_放冰淇淋位置
Wait();
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
@@ -700,7 +700,7 @@ namespace BPASmartClient.MorkTHQ
bool result = false;
int retry = 3;
DateTime beginTime = DateTime.Now;
while (!result)
{
EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) =>
@@ -718,7 +718,7 @@ namespace BPASmartClient.MorkTHQ
if (DateTime.Now.Subtract(beginTime).TotalSeconds > 5)
{
DeviceProcessLogShow("超时未出料,重新发送打料指令");
EventBus.GetInstance().Publish( new GSIceCream_ModeSetEvent() { DeviceId =DeviceId, Mode = MORKI_MODE.打料 });
EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent() { DeviceId = DeviceId, Mode = MORKI_MODE.打料 });
beginTime = DateTime.Now;
retry--;
}
@@ -736,7 +736,7 @@ namespace BPASmartClient.MorkTHQ
/// </summary>
private void MakeJuiceProcess()
{
if(morkT.morkOrderPushesJuice.TryDequeue(out OrderLocInfo order))
if (morkT.morkOrderPushesJuice.TryDequeue(out OrderLocInfo order))
{
OrderChange(order.SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 11111 });//SENCE_取果汁杯位置
@@ -840,9 +840,9 @@ namespace BPASmartClient.MorkTHQ
MessageLog.GetInstance.Show("果汁制作完成");
}
}



}

private T GetDeviceStatus<T>(string key)
@@ -859,7 +859,7 @@ namespace BPASmartClient.MorkTHQ
#endregion
public override void SimOrder()
{
}
}
}

+ 11
- 11
BPASmartClient.Morkt.JAKA.JC/Control_MORKJC.cs 查看文件

@@ -16,7 +16,7 @@ using BPASmartClient.Model;

using BPASmartClient.Model.PLC;
using BPASmartClient.Model.单片机;
using static BPA.Helper.EventBus;

namespace BPASmartClient.MorktJAKAJC
{
@@ -252,7 +252,7 @@ namespace BPASmartClient.MorktJAKAJC
return batchings[batchingLoc].GoodsType;
return GOODS_TYPE.NEITHER;
}
private AutoResetEvent are = new AutoResetEvent(false);

private T GetStatus<T>(string key)
@@ -731,7 +731,7 @@ namespace BPASmartClient.MorktJAKAJC
Wait(0);
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish();
Wait(int.Parse(JakaModel.SENCE_初始位));
new WriteJaka() { TagName = "JakaDOutput", DO_Index=0, Value = true }.Publish();
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 0, Value = true }.Publish();
Thread.Sleep(100);
new WriteJaka() { TagName = "Set_RobotAO1", Value = 0 }.Publish();
Wait(0);
@@ -739,7 +739,7 @@ namespace BPASmartClient.MorktJAKAJC
Wait(int.Parse(JakaModel.SENCE_取杯位检测_取杯位));
//取杯到位,使用落杯器
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 1, Value = true }.Publish();
if (sensor_Sign(1)==1 )
if (sensor_Sign(1) == 1)
{
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 1, Value = false }.Publish();
Thread.Sleep(2000);
@@ -788,7 +788,7 @@ namespace BPASmartClient.MorktJAKAJC
}
}
}
return 1;
}
catch (Exception ex)
@@ -899,8 +899,8 @@ namespace BPASmartClient.MorktJAKAJC
if (num == 0)
{
bSensorInput = GetStatus<bool>("Get_RobotDI0") ? 1 : 2;
}
else if (num == 1)
}
else if (num == 1)
{
bSensorInput = GetStatus<bool>("Get_RobotDI1") ? 1 : 2;
}
@@ -945,11 +945,11 @@ namespace BPASmartClient.MorktJAKAJC

public void SimOrder<T>(T simOrder)
{
}

public override void Stop()
{

@@ -957,7 +957,7 @@ namespace BPASmartClient.MorktJAKAJC

public override void ReadData()
{
}




+ 3
- 3
BPASmartClient.SCADAControl/CustomerControls/TheAPI.xaml.cs 查看文件

@@ -96,7 +96,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls
if (!string.IsNullOrEmpty(DataSouceInformation))
{
Direction = 1;
FDataSouce = HttpRequestHelper.HttpPostRequest(DataSouceInformation,InterfaceParameters);
FDataSouce = APIHelper.GetInstance.HttpRequest(DataSouceInformation,InterfaceParameters);
}
break;
@@ -105,7 +105,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls
{
Direction = 1;
string returndata=string.Empty;
string obj_data= HttpRequestHelper.HttpGetRequest(DataSouceInformation);
string obj_data= APIHelper.GetInstance.GetRequest(DataSouceInformation);
Dictionary<string, object> obj = JsonConvert.DeserializeObject<Dictionary<string, object>>(obj_data);
if (obj.ContainsKey("data"))
{
@@ -132,7 +132,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls
if (!string.IsNullOrEmpty(DataSouceInformation))
{
Direction = 1;
//string data = HttpRequestHelper.HttpPostRequest(DataSouceInformation,InterfaceParameters);
//string data = APIHelper.GetInstance.HttpRequest(DataSouceInformation,InterfaceParameters);
}
break;
default:


+ 1
- 1
BPASmartClient.ScreenLib/Helper/Main.cs 查看文件

@@ -293,7 +293,7 @@ namespace BPASmartClient.ScreenLib
try
{
string SaasRoute = System.Configuration.ConfigurationManager.AppSettings["SaasRoute"].ToString();
string res = HttpRequestHelper.HttpGetRequest(SaasRoute);
string res = APIHelper.GetInstance.GetRequest(SaasRoute);
if (!string.IsNullOrEmpty(res))
{
HttpReturn httpReturn= JsonConvert.DeserializeObject<HttpReturn>(res);


+ 1
- 1
BPASmartClient.SerialPort/BPASmartClient.SerialPort.csproj 查看文件

@@ -6,7 +6,7 @@

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.66" />
<PackageReference Include="System.IO.Ports" Version="7.0.0" />
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
</ItemGroup>

</Project>

+ 5
- 6
BPASmartClient.ViewModel/AlarmViewModel.cs 查看文件

@@ -3,13 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using System.Windows;
using System.Threading;
using BPA.Helper;
using BPASmartClient.Device;
using BPA.Helper;
using BPASmartClient.Business;
using BPASmartClient.Model;

@@ -27,7 +26,7 @@ namespace BPASmartClient.ViewModel
}
if (ControlButText == "开始查询")
{
var lists = Sqlite<Alarm>.GetInstance.GetData();
var lists = Sqlite<BPASmartClient.Model.Alarm>.GetInstance.GetData();
var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList();
if (res != null)
{
@@ -90,7 +89,7 @@ namespace BPASmartClient.ViewModel

private void GetHistoryAlarm()
{
var data = Sqlite<Alarm>.GetInstance.GetData();
var data = Sqlite<BPASmartClient.Model.Alarm>.GetInstance.GetData();
if (data != null)
{
HistoryAlarm.Clear();
@@ -150,9 +149,9 @@ namespace BPASmartClient.ViewModel
private DateTime _mEndDateTime = DateTime.Now;


public ObservableCollection<Alarm> AlarmInfos { get; set; } = new ObservableCollection<Alarm>();
public ObservableCollection<BPASmartClient.Model.Alarm> AlarmInfos { get; set; } = new();

public ObservableCollection<Alarm> HistoryAlarm { get; set; } = new ObservableCollection<Alarm>();
public ObservableCollection<BPASmartClient.Model.Alarm> HistoryAlarm { get; set; } = new();

}
}

+ 5
- 6
BPASmartClient.ViewModel/DataVViewModel.cs 查看文件

@@ -3,7 +3,6 @@ using BPASmartClient.Business;
using BPA.Helper;
using BPASmartClient.IoT;
using DataVAPI.Tool.IOT;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -99,7 +98,7 @@ namespace BPASmartClient.ViewModel
{
string url = ApiURL + "/api/Device/Query";
if (!string.IsNullOrEmpty(clientId)) url = ApiURL + "/api/Device/Query?clientId=" + clientId;
string json = HttpRequestHelper.HttpGetRequest(url);
string json = APIHelper.GetInstance.GetRequest(url);
JsonMsg<List<DeviceTable>> jsonMsg = Tools.JsonToObjectTools<JsonMsg<List<DeviceTable>>>(json);
return jsonMsg.obj.data;
}
@@ -119,7 +118,7 @@ namespace BPASmartClient.ViewModel
try
{
string url = ApiURL + "/api/Device/Modify";
string json = HttpRequestHelper.HttpPostRequest(url, Tools.JsonConvertTools(device));
string json = APIHelper.GetInstance.HttpRequest(url, device);
Refresh();
return true;
}
@@ -139,7 +138,7 @@ namespace BPASmartClient.ViewModel
try
{
string url = ApiURL + "/api/Device/Create";
string json = HttpRequestHelper.HttpPostRequest(url, Tools.JsonConvertTools(device));
string json = APIHelper.GetInstance.HttpRequest(url, device);
Refresh();
return true;
}
@@ -155,7 +154,7 @@ namespace BPASmartClient.ViewModel
try
{
string url = ApiURL + "/api/Device/Create";
string json = HttpRequestHelper.HttpPostRequest(url, Tools.JsonConvertTools(deviceTable));
string json = APIHelper.GetInstance.HttpRequest(url, Tools.JsonConvertTools(deviceTable));
Refresh();
return true;
}
@@ -175,7 +174,7 @@ namespace BPASmartClient.ViewModel
try
{
string url = ApiURL + "/api/Device/DeleteDate?id=" + device.Id;
string json = HttpRequestHelper.HttpGetRequest(url);
string json = APIHelper.GetInstance.GetRequest(url);
Refresh();
return true;
}


+ 2
- 2
BPASmartClient.ViewModel/LogOrAlarmIOTViewModel.cs 查看文件

@@ -5,7 +5,7 @@ using BPA.Helper;
using BPASmartClient.IoT;
using DataVAPI.Tool.IOT;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -70,7 +70,7 @@ namespace BPASmartClient.ViewModel
{
LogDataFile.Clear();
api = $"{DataVApiAddress}/api/Log/QueryLogFile?DeviceName={DataVClient.GetInstance().DeviceDataV.deviceTable.devicename}"; ;
string json = HttpRequestHelper.HttpGetRequest(api, 1000);
string json = APIHelper.GetInstance.GetRequest(api);
JsonMsg<List<FileModel>> jsonMsg = Tools.JsonToObjectTools<JsonMsg<List<FileModel>>>(json);
jsonMsg.obj?.data?.ForEach(file =>
{


+ 0
- 3
BPASmartClient.ViewModel/NewShopWindowModel.cs 查看文件

@@ -4,9 +4,6 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Helper;
using BPA.Helper;
using Microsoft.Toolkit.Mvvm.Messaging;
using System.Windows;
using System.IO;



+ 13
- 16
BPASmartClient.ViewModel/OrderListDialogViewModel.cs 查看文件

@@ -6,9 +6,6 @@ using BPA.Message;
using BPA.Message.Enum;
using BPA.Helper;
using BPASmartClient.Model;
using BPA.Helper;
using Microsoft.Toolkit.Mvvm.Messaging;

namespace BPASmartClient.ViewModel
{
@@ -27,11 +24,11 @@ namespace BPASmartClient.ViewModel
ConfirmButton();
if (Json<KeepDataBase>.Data.orderLists.Count > 0)
{
Message.MessageLog.GetInstance.Show($"重启软件前订单剩余{Json<KeepDataBase>.Data.orderLists.Count}个");
MessageLog.GetInstance.Show($"重启软件前订单剩余{Json<KeepDataBase>.Data.orderLists.Count}个");
ThreadManage.GetInstance().Start(new Action(() =>
{
Thread.Sleep(10000);
if (!IsAutoClose) WeakReferenceMessenger.Default.Send("false", "Close");
if (!IsAutoClose) ActionManage.GetInstance.Send("Close", false);
}), "延时退出");
}
}
@@ -44,7 +41,7 @@ namespace BPASmartClient.ViewModel
CloseCommand = new BPARelayCommand(() =>
{
Json<KeepDataBase>.Data.orderLists.Clear();
WeakReferenceMessenger.Default.Send("false", "Close");
ActionManage.GetInstance.Send("Close", false);
Json<KeepDataBase>.Save();
});
}
@@ -57,7 +54,7 @@ namespace BPASmartClient.ViewModel
CancelCommand = new BPARelayCommand(() =>
{
Json<KeepDataBase>.Data.orderLists.Clear();
WeakReferenceMessenger.Default.Send("false", "Close");
ActionManage.GetInstance.Send("Close", false);
Json<KeepDataBase>.Save();
});
}
@@ -89,17 +86,17 @@ namespace BPASmartClient.ViewModel
IsAllSelect = item.IsAllSelect,
morkOrderPushes = morkOrders,
});
/*
foreach (var mo in morkOrders)
{
DoOrderEvent de = new DoOrderEvent();
de.DeviceId = int.Parse(item.DeviceId);
de.MorkOrder = mo.OrderPush;
EventBus.GetInstance().Publish(de);
}*/
/*
foreach (var mo in morkOrders)
{
DoOrderEvent de = new DoOrderEvent();
de.DeviceId = int.Parse(item.DeviceId);
de.MorkOrder = mo.OrderPush;
EventBus.GetInstance().Publish(de);
}*/
}
}
WeakReferenceMessenger.Default.Send("true", "Close");
ActionManage.GetInstance.Send("Close", true);
});
}



+ 5
- 5
BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs 查看文件

@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using BPA.Helper;
using BPA.Helper;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
@@ -64,7 +64,7 @@ namespace BPASmartClient.ViewModel
deviceConfig.ElementAt(0).deviceModels.ElementAt(i).communicationDevcies.ElementAt(m).CommunicationNamespace = IPeripherals.FirstOrDefault(p => p.Contains(comName));
}
}
File.WriteAllText($"{LocaPath.GetInstance().GetDeviceConfigPath}{FileName}.json", JsonConvert.SerializeObject(deviceConfig));
File.WriteAllText($"{LocaPath.GetDeviceConfigPath}{FileName}.json", JsonConvert.SerializeObject(deviceConfig));
}
});
}
@@ -87,7 +87,7 @@ namespace BPASmartClient.ViewModel
}
}
}
}

private void NewCommunication(object? obj)
@@ -111,7 +111,7 @@ namespace BPASmartClient.ViewModel
CommunicationName = $"Communication_{num}",
DeviceModelId = deviceConfig.ElementAt(0).deviceModels.FirstOrDefault(p => p.DeviceName == dm.DeviceName)?.Id,
communicationPar = new CommunicationPar() { IsNetworkPort = false },

});
break;
@@ -250,7 +250,7 @@ namespace BPASmartClient.ViewModel
});

Shops.Clear();
DirectoryInfo directoryInfo = new DirectoryInfo(LocaPath.GetInstance().GetDeviceConfigPath);
DirectoryInfo directoryInfo = new DirectoryInfo(LocaPath.GetDeviceConfigPath);
var files = directoryInfo.GetFiles();
foreach (var item in files)
{


+ 77
- 45
BPASmartClient/Control/AdminstratorsView.xaml 查看文件

@@ -35,51 +35,83 @@
<RowDefinition Height="8*" />
<RowDefinition Height="20*" />
</Grid.RowDefinitions>
<TextBlock Text="账号:"
VerticalAlignment="Bottom" HorizontalAlignment="Right"
Margin="20" Foreground="#feffff"
Style="{StaticResource TxLogin}"
/>
<TextBlock Text="密码:" Grid.Row="1"
VerticalAlignment="Top" HorizontalAlignment="Right"
Margin="20" Foreground="#feffff"
Style="{StaticResource TxLogin}"/>
<TextBox x:Name="tbx_admin" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
Text="{Binding Admin, Mode=TwoWay}"
Foreground="#F8F8FF" FontSize="20"
Width="180" Height="28"
VerticalAlignment="Bottom" HorizontalAlignment="Center"
VerticalContentAlignment="Top" HorizontalContentAlignment="Center"
Margin="20"
Background="Transparent"
BorderBrush="White" BorderThickness="0,0,0,1"
GotFocus="TextBox_GotFocus">

</TextBox>
<PasswordBox x:Name="password" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
FontSize="20" Foreground="#F8F8FF"
Width="180" Margin="20"
Background="Transparent"
VerticalAlignment="Top" HorizontalAlignment="Center"
VerticalContentAlignment="Top" HorizontalContentAlignment="Center"
BorderBrush="White" BorderThickness="0,0,0,1" CaretBrush="White"
helper:PasswordBoxHelper.PasswordContent="{Binding Password ,Mode=TwoWay}"
GotFocus="Password_GotFocus"/>
<TextBlock Text="{Binding ErrorMessage}"
Grid.Row="2" Grid.ColumnSpan="2"
VerticalAlignment="Top" HorizontalAlignment="Center"
FontFamily="楷体"
FontSize="16"
Foreground="#FFE2415C"
TextWrapping="Wrap" />
<Button Grid.Row="3" Grid.ColumnSpan="2"
FontSize="28" Foreground="#9934F7F7"
Width="120" Height="40"
Background="Transparent"
VerticalAlignment="Top"
BorderBrush="#ff19b7ec" BorderThickness="2"
Content="登 录"
Command="{Binding AdminLoginCommand}" IsDefault="True"/>
<TextBlock
Margin="20"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Foreground="#feffff"
Style="{StaticResource TxLogin}"
Text="账号:" />
<TextBlock
Grid.Row="1"
Margin="20"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Foreground="#feffff"
Style="{StaticResource TxLogin}"
Text="密码:" />
<TextBox
x:Name="tbx_admin"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
Width="180"
Height="28"
Margin="20"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Top"
Background="Transparent"
BorderBrush="White"
BorderThickness="0,0,0,1"
FontSize="20"
Foreground="#F8F8FF"
GotFocus="TextBox_GotFocus"
Text="{Binding Admin, Mode=TwoWay}" />
<PasswordBox
x:Name="password"
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Width="180"
Margin="20"
HorizontalAlignment="Center"
VerticalAlignment="Top"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Top"
helper:PasswordBoxHelper.PasswordContent="{Binding Password, Mode=TwoWay}"
Background="Transparent"
BorderBrush="White"
BorderThickness="0,0,0,1"
CaretBrush="White"
FontSize="20"
Foreground="#F8F8FF"
GotFocus="Password_GotFocus" />
<TextBlock
Grid.Row="2"
Grid.ColumnSpan="2"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontFamily="楷体"
FontSize="16"
Foreground="#FFE2415C"
Text="{Binding ErrorMessage}"
TextWrapping="Wrap" />
<Button
Grid.Row="3"
Grid.ColumnSpan="2"
Width="120"
Height="40"
VerticalAlignment="Top"
Background="Transparent"
BorderBrush="#ff19b7ec"
BorderThickness="2"
Command="{Binding AdminLoginCommand}"
Content="登 录"
FontSize="28"
Foreground="#9934F7F7"
IsDefault="True" />

<uc:UserKeyBoard
x:Name="myKeyboard"


+ 11
- 6
BPASmartClient/OrderListDialogView.xaml.cs 查看文件

@@ -11,6 +11,7 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using BPA.Helper;
using BPASmartClient.ViewModel;
using Microsoft.Toolkit.Mvvm.Messaging;

@@ -29,14 +30,18 @@ namespace BPASmartClient
this.DragMove();
};

WeakReferenceMessenger.Default.Register<string, string>(this, "Close", (o, e) =>
ActionManage.GetInstance.Register(new Action<object>(o =>
{
App.Current.Dispatcher.Invoke(new Action(() =>
if (o != null && o is bool tempValue)
{
this.DialogResult = Convert.ToBoolean(e);
this.Close();
}));
});
App.Current.Dispatcher.Invoke(new Action(() =>
{
this.DialogResult = tempValue;
this.Close();
}));
}
}), "Close", true);

}
int MoveCount = 0;
private void Window_MouseMove(object sender, MouseEventArgs e)


+ 1
- 1
DosingSystem/App.xaml.cs 查看文件

@@ -58,7 +58,7 @@ namespace BPASmartClient.DosingSystem
Environment.Exit(0);
}
base.OnStartup(e);
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut();
SystemHelper.GetInstance.CreateDesktopShortcut();
MenuInit();
DataInit();
//SiemensTest.GetInstance.Init();


+ 5
- 5
DosingSystem/Model/ViewModelBase.cs 查看文件

@@ -12,11 +12,11 @@ namespace BPASmartClient.DosingSystem
public class ViewModelBase : NotifyBase
{
public int Index { get; set; } = -1;
public BPABPARelayCommand AddCommand { get; set; }//添加
public BPABPARelayCommand CancelCommand { get; set; }//取消
public BPABPARelayCommand SaveCommand { get; set; }//保存
public BPABPARelayCommand<object> RemoveCommand { get; set; }//移除
public BPABPARelayCommand<object> DetailsCommand { get; set; }//编辑
public BPARelayCommand AddCommand { get; set; }//添加
public BPARelayCommand CancelCommand { get; set; }//取消
public BPARelayCommand SaveCommand { get; set; }//保存
public BPARelayCommand<object> RemoveCommand { get; set; }//移除
public BPARelayCommand<object> DetailsCommand { get; set; }//编辑

/// <summary>
/// 错误信息


+ 2
- 2
DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs 查看文件

@@ -17,8 +17,8 @@ namespace BPASmartClient.DosingSystem.ViewModel
if (o != null && o is string str) IpAddress = str;
}), "ChangeDeviceNameViewOpen");

CancelCommand = new BPABPARelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); });
AddCommand = new BPABPARelayCommand(() =>
CancelCommand = new BPARelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); });
AddCommand = new BPARelayCommand(() =>
{
if (string.IsNullOrEmpty(DeviceName))
{


+ 2
- 2
DosingSystem/ViewModel/CommparSetViewModel.cs 查看文件

@@ -14,7 +14,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
public CommparSetViewModel()
{
SaveCommand = new BPABPARelayCommand(() =>
SaveCommand = new BPARelayCommand(() =>
{
if (!string.IsNullOrEmpty(CommBaseParModel.NetworkSegAddress))
{
@@ -37,7 +37,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
public BasePar CommBaseParModel { get { return Json<DevicePar>.Data.BaseParModel; } set { Json<DevicePar>.Data.BaseParModel = value; OnPropertyChanged(); } }
//private BasePar _mCommBaseParModel;

public BPABPARelayCommand SaveCommand { get; set; }
public BPARelayCommand SaveCommand { get; set; }

}
}

+ 2
- 2
DosingSystem/ViewModel/DeviceListViewModel.cs 查看文件

@@ -16,7 +16,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
public DeviceListViewModel()
{
DetailsCommand = new BPABPARelayCommand<object>((o) =>
DetailsCommand = new BPARelayCommand<object>((o) =>
{
if (o != null && o is string str)
{
@@ -28,7 +28,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
devices = DeviceInquire.GetInstance.devices;
}

//public BPABPARelayCommand<object> ChangeNameCommand { get; set; }
//public BPARelayCommand<object> ChangeNameCommand { get; set; }

//public static ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>();
public ObservableCollection<Devices> devices { get; set; }


+ 6
- 6
DosingSystem/ViewModel/DeviceMaterialParViewModel.cs 查看文件

@@ -16,15 +16,15 @@ namespace BPASmartClient.DosingSystem.ViewModel
public DeviceMaterialParViewModel()
{
deviceParModels = Json<DevicePar>.Data.deviceParModels;
RemoveCommand = new BPABPARelayCommand<object>((o) =>
RemoveCommand = new BPARelayCommand<object>((o) =>
{
var res = deviceParModels.FirstOrDefault(p => p.MaterialName == o?.ToString());
if (res != null) deviceParModels.Remove(res);
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{o.ToString()}:原料删除成功!");
});

AddCommand = new BPABPARelayCommand(() => { deviceParModels.Add(new DeviceParModel()); });
SaveCommand = new BPABPARelayCommand(() =>
AddCommand = new BPARelayCommand(() => { deviceParModels.Add(new DeviceParModel()); });
SaveCommand = new BPARelayCommand(() =>
{
if (deviceParModels == null || deviceParModels.Count <= 0)
{
@@ -57,10 +57,10 @@ namespace BPASmartClient.DosingSystem.ViewModel

public ObservableCollection<DeviceParModel> deviceParModels { get; set; }

//public BPABPARelayCommand<object> RemoveCommand { get; set; }
//public BPARelayCommand<object> RemoveCommand { get; set; }

//public BPABPARelayCommand AddCommand { get; set; }
//public BPABPARelayCommand SaveCommand { get; set; }
//public BPARelayCommand AddCommand { get; set; }
//public BPARelayCommand SaveCommand { get; set; }

}
}

+ 4
- 4
DosingSystem/ViewModel/HardwareStatusViewModel.cs 查看文件

@@ -23,7 +23,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
// ConveyerBeltModels.Add(new ConveyerBeltModel() { Name = $"输送带{i}", Num = i++ });
//}

//ConveyerBeltControlCommand = new BPABPARelayCommand<object>(o =>
//ConveyerBeltControlCommand = new BPARelayCommand<object>(o =>
//{
// if (o != null && o is int tempCount)
// {
@@ -62,7 +62,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
Thread.Sleep(100);
}), "输送带料仓状态监控",true);

RecipeControlCommand = new BPABPARelayCommand<object>((o) =>
RecipeControlCommand = new BPARelayCommand<object>((o) =>
{
if (o != null && o is DeviceCurrentStatus currentStatus)
{
@@ -109,9 +109,9 @@ namespace BPASmartClient.DosingSystem.ViewModel

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

public BPABPARelayCommand<object> ConveyerBeltControlCommand { get; set; }
public BPARelayCommand<object> ConveyerBeltControlCommand { get; set; }

public BPABPARelayCommand<object> RecipeControlCommand { get; set; }
public BPARelayCommand<object> RecipeControlCommand { get; set; }

/// <summary>
/// 输送带状态


+ 8
- 8
DosingSystem/ViewModel/ManualControlViewModel.cs 查看文件

@@ -51,7 +51,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
OtherHandCylinders.Add(new CylinderModel() { Name = "上桶工位气缸" });
OtherHandCylinders.Add(new CylinderModel() { Name = "下桶工位气缸" });

Open = new BPABPARelayCommand<object>((o) =>
Open = new BPARelayCommand<object>((o) =>
{
if (o != null)
{
@@ -76,7 +76,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
});


Close = new BPABPARelayCommand<object>((o) =>
Close = new BPARelayCommand<object>((o) =>
{
if (o != null)
{
@@ -100,14 +100,14 @@ namespace BPASmartClient.DosingSystem.ViewModel
}
});

SystemStart = new BPABPARelayCommand(() =>
SystemStart = new BPARelayCommand(() =>
{
SiemensDevice.GetInstance.MySiemens.Write("M10.0", SystemControlText == "停止" ? false : true);
Thread.Sleep(100);
var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.0");
SystemControlText = res ? "停止" : "启动";
});
ModelSwitch = new BPABPARelayCommand(() =>
ModelSwitch = new BPARelayCommand(() =>
{
SiemensDevice.GetInstance.MySiemens.Write("M10.1", ModelSwitchText == "手动" ? true : false);
Thread.Sleep(100);
@@ -170,12 +170,12 @@ namespace BPASmartClient.DosingSystem.ViewModel
/// </summary>
public ObservableCollection<CylinderModel> OtherHandCylinders { get; set; } = new ObservableCollection<CylinderModel>();

public BPABPARelayCommand<object> Open { get; set; }
public BPARelayCommand<object> Open { get; set; }

public BPABPARelayCommand<object> Close { get; set; }
public BPARelayCommand<object> Close { get; set; }

public BPABPARelayCommand SystemStart { get; set; }
public BPABPARelayCommand ModelSwitch { get; set; }
public BPARelayCommand SystemStart { get; set; }
public BPARelayCommand ModelSwitch { get; set; }


public string SystemControlText { get { return _mSystemControlText; } set { _mSystemControlText = value; OnPropertyChanged(); } }


+ 4
- 4
DosingSystem/ViewModel/NewMaterialViewModel.cs 查看文件

@@ -22,9 +22,9 @@ public class NewMaterialViewModel : ViewModelBase
//public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
//private string _mErrorInfo;

//public BPABPARelayCommand<object> RemoveCommand { get; set; }
//public BPARelayCommand<object> RemoveCommand { get; set; }

//public BPABPARelayCommand SaveCommand { get; set; }
//public BPARelayCommand SaveCommand { get; set; }



@@ -42,9 +42,9 @@ public class NewMaterialViewModel : ViewModelBase

public NewMaterialViewModel()
{
RemoveCommand = new BPABPARelayCommand<object>(Remove);
RemoveCommand = new BPARelayCommand<object>(Remove);

SaveCommand = new BPABPARelayCommand(() =>
SaveCommand = new BPARelayCommand(() =>
{
if (MaterialName == String.Empty) { ErrorInfo = "原料名称不能为空"; return; }
if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == MaterialName) != null) { ErrorInfo = "设备中已存在该原料名称"; return; }


+ 4
- 4
DosingSystem/ViewModel/NewOutletViewModel.cs 查看文件

@@ -29,9 +29,9 @@ namespace BPASmartClient.DosingSystem.ViewModel
Index = Array.FindIndex(Json<DevicePar>.Data.OutletInfoModels.ToArray(), p => p.OutletName == tempOutletInfo.OutletName);
}
}), "OpenNewOutlet", true);
AddCommand = new BPABPARelayCommand(() => { SiloInfos.Add(new RawMaterialInfo()); });
CancelCommand = new BPABPARelayCommand(() => { ActionManage.GetInstance.Send("NewOutletViewClose"); });
SaveCommand = new BPABPARelayCommand(() =>
AddCommand = new BPARelayCommand(() => { SiloInfos.Add(new RawMaterialInfo()); });
CancelCommand = new BPARelayCommand(() => { ActionManage.GetInstance.Send("NewOutletViewClose"); });
SaveCommand = new BPARelayCommand(() =>
{
ObservableCollection<string> SileNames = new ObservableCollection<string>();
SiloInfos.ToList()?.ForEach(item => { SileNames.Add(item.RawMaterialName); });
@@ -82,7 +82,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
}
ActionManage.GetInstance.Send("NewOutletViewClose");
});
RemoveCommand = new BPABPARelayCommand<object>((o) =>
RemoveCommand = new BPARelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{


+ 6
- 6
DosingSystem/ViewModel/NewRecipeViewModel.cs 查看文件

@@ -41,7 +41,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
}
}), "Details", true);

AddCommand = new BPABPARelayCommand(() =>
AddCommand = new BPARelayCommand(() =>
{
if (RawMaterials.Count >= DeviceInquire.GetInstance.devices.Count)
{
@@ -62,7 +62,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
else goto p;
});

RemoveCommand = new BPABPARelayCommand<object>((obj) =>
RemoveCommand = new BPARelayCommand<object>((obj) =>
{
if (obj is string rm)
{
@@ -71,7 +71,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
}
});

SaveCommand = new BPABPARelayCommand(() =>
SaveCommand = new BPARelayCommand(() =>
{
if (string.IsNullOrEmpty(RecipeName)) { MessageNotify.GetInstance.ShowDialog("请输入配方名称!", DialogType.Warning); ErrorInfo = "请输入配方名称"; return; }
var tempRes = RawMaterials.GroupBy(p => p.RawMaterialName);
@@ -195,11 +195,11 @@ namespace BPASmartClient.DosingSystem.ViewModel
//public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
//private string _mErrorInfo;

//public BPABPARelayCommand AddCommand { get; set; }
//public BPARelayCommand AddCommand { get; set; }

//public BPABPARelayCommand<object> RemoveCommand { get; set; }
//public BPARelayCommand<object> RemoveCommand { get; set; }

//public BPABPARelayCommand SaveCommand { get; set; }
//public BPARelayCommand SaveCommand { get; set; }

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



+ 4
- 4
DosingSystem/ViewModel/OutletManagementViewModel.cs 查看文件

@@ -14,14 +14,14 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
public OutletManagementViewModel()
{
AddCommand = new BPABPARelayCommand(() =>
AddCommand = new BPARelayCommand(() =>
{
NewOutletView newOutletView = new NewOutletView();
newOutletView.ShowDialog();
});
SaveCommand = new BPABPARelayCommand(() => { Json<DevicePar>.Save(); });
SaveCommand = new BPARelayCommand(() => { Json<DevicePar>.Save(); });
OutletInfoModels = Json<DevicePar>.Data.OutletInfoModels;
RemoveCommand = new BPABPARelayCommand<object>((o) =>
RemoveCommand = new BPARelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
@@ -34,7 +34,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
}
});

DetailsCommand = new BPABPARelayCommand<object>((o) =>
DetailsCommand = new BPARelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{


+ 6
- 6
DosingSystem/ViewModel/RecipeControlViewModel.cs 查看文件

@@ -25,9 +25,9 @@ namespace BPASmartClient.DosingSystem.ViewModel
static ObservableCollection<StockStatusModel> StockStatus = new ObservableCollection<StockStatusModel>();
public RecipeControlViewModel()
{
StartCommand = new BPABPARelayCommand<object>(RecipeIssued);
ChangeRecipeStateCommand = new BPABPARelayCommand<object>(ChangeRecipeState);
CancelRecipeCommand = new BPABPARelayCommand<object>(CancelRecipe);
StartCommand = new BPARelayCommand<object>(RecipeIssued);
ChangeRecipeStateCommand = new BPARelayCommand<object>(ChangeRecipeState);
CancelRecipeCommand = new BPARelayCommand<object>(CancelRecipe);
RecipeRun();
RecipeStatusInquire();
}
@@ -666,11 +666,11 @@ namespace BPASmartClient.DosingSystem.ViewModel
}), "RecipeControlViewModelStatusInquire",true);
}

public BPABPARelayCommand<object> StartCommand { get; set; }
public BPARelayCommand<object> StartCommand { get; set; }

public BPABPARelayCommand<object> ChangeRecipeStateCommand { get; set; }
public BPARelayCommand<object> ChangeRecipeStateCommand { get; set; }

public BPABPARelayCommand<object> CancelRecipeCommand { get; set; }
public BPARelayCommand<object> CancelRecipeCommand { get; set; }

public static ObservableCollection<RecipeModel> Recipes { get; set; } = Json<LocalRecipe>.Data.Recipes;



+ 11
- 11
DosingSystem/ViewModel/RecipeSettingsViewModel.cs 查看文件

@@ -26,24 +26,24 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
Recipes = Json<LocalRecipe>.Data.Recipes;

NewMaterital = new BPABPARelayCommand(() =>
NewMaterital = new BPARelayCommand(() =>
{
NewMaterialView newMateritalView = new NewMaterialView();
newMateritalView.ShowDialog();
});
NewRecipe = new BPABPARelayCommand(() =>
NewRecipe = new BPARelayCommand(() =>
{
NewRecipeView nrv = new NewRecipeView();
nrv.ShowDialog();
MessageNotify.GetInstance.ShowUserLog("新建配方");
});
SaveRecipe = new BPABPARelayCommand(() =>
SaveRecipe = new BPARelayCommand(() =>
{
Json<LocalRecipe>.Save();
MessageNotify.GetInstance.ShowUserLog("保存配方");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!");
});
RemoveCommand = new BPABPARelayCommand<object>((o) =>
RemoveCommand = new BPARelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
@@ -65,7 +65,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
}
});

DetailsCommand = new BPABPARelayCommand<object>((o) =>
DetailsCommand = new BPARelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
@@ -82,17 +82,17 @@ namespace BPASmartClient.DosingSystem.ViewModel

}

public BPABPARelayCommand NewMaterital { get; set; }
public BPARelayCommand NewMaterital { get; set; }

public BPABPARelayCommand NewRecipe { get; set; }
public BPARelayCommand NewRecipe { get; set; }

public BPABPARelayCommand SaveRecipe { get; set; }
public BPARelayCommand SaveRecipe { get; set; }

public BPABPARelayCommand<object> EditCommand { get; set; }
public BPARelayCommand<object> EditCommand { get; set; }

public BPABPARelayCommand<object> DetailsCommand { get; set; }
public BPARelayCommand<object> DetailsCommand { get; set; }

public BPABPARelayCommand<object> RemoveCommand { get; set; }
public BPARelayCommand<object> RemoveCommand { get; set; }

public ObservableCollection<RecipeModel> Recipes { get; set; }
}


+ 1
- 1
TestDemo/Form1.cs 查看文件

@@ -1,6 +1,6 @@
using BPASmartClient.AGV.Feedback;
using BPA.Helper;
using BPASmartClient.Http;
using BPASmartClient.HubHelper;
using Newtonsoft.Json;
using BPASmartClient.S7Net;


正在加载...
取消
保存