@@ -1,7 +1,6 @@ | |||||
using BPA.ApolloClient; | using BPA.ApolloClient; | ||||
using BPA.Message; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using Microsoft.Extensions.Configuration; | using Microsoft.Extensions.Configuration; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
@@ -45,7 +44,7 @@ namespace BPASmartClient.Business | |||||
public void Initialize() | public void Initialize() | ||||
{ | { | ||||
var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig"); | var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig"); | ||||
string path = $"{LocaPath.GetInstance().GetDeviceConfigPath}{text}.json"; | |||||
string path = $"{LocaPath.GetDeviceConfigPath}{text}.json"; | |||||
if (File.Exists(path)) | if (File.Exists(path)) | ||||
{ | { | ||||
string JsonString = File.ReadAllText(path); | string JsonString = File.ReadAllText(path); | ||||
@@ -2,8 +2,7 @@ | |||||
using BPASmartClient.Device; | using BPASmartClient.Device; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Http; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.小炒机; | using BPASmartClient.Model.小炒机; | ||||
using BPASmartClient.Model.调酒机; | using BPASmartClient.Model.调酒机; | ||||
@@ -105,7 +104,7 @@ namespace BPASmartClient.Business | |||||
var jsondata = new { clientId, PushType }; | var jsondata = new { clientId, PushType }; | ||||
string header = $"[/stock/GetItemInfo]_[{DateTime.Now.Ticks}]".AESEncrypt(); | string header = $"[/stock/GetItemInfo]_[{DateTime.Now.Ticks}]".AESEncrypt(); | ||||
string url = $"{InternetInfo.StockServer}GetItemInfo"; | 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) | if (PushType == 1) | ||||
{ | { | ||||
@@ -5,7 +5,7 @@ using BPA.Models; | |||||
using BPASmartClient.Device; | using BPASmartClient.Device; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Http; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.小炒机; | using BPASmartClient.Model.小炒机; | ||||
@@ -186,7 +186,7 @@ namespace BPASmartClient.Business | |||||
{ | { | ||||
string header = $"[{InternetInfo.OrderServer}/order/robotstatuschange]_[{DateTime.Now.Ticks}]".AESEncrypt(); | string header = $"[{InternetInfo.OrderServer}/order/robotstatuschange]_[{DateTime.Now.Ticks}]".AESEncrypt(); | ||||
string url = $"{InternetInfo.OrderServer}order/robotstatuschange"; | 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) | catch (Exception ex) | ||||
{ | { | ||||
@@ -44,7 +44,7 @@ namespace BPASmartClient.Business | |||||
} | } | ||||
Thread.Sleep(50); | Thread.Sleep(50); | ||||
} | } | ||||
}, "设备状态收集", true); | |||||
}, "设备状态收集", isRestart: true); | |||||
deviceStatus.BatchingInfo = new List<BPA.Models.BatchingInfo>(); | 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.Healthy = device.IsHealth ? BPA.Message.Enum.DeviceHealthy.Health : BPA.Message.Enum.DeviceHealthy.UnHealth; | ||||
deviceStatus.DeviceType = device.DeviceType; | deviceStatus.DeviceType = device.DeviceType; | ||||
deviceStatus.BatchingInfo = device.BatchingInfos; | |||||
deviceStatus.BatchingInfo = device.BatchingInfos; | |||||
var msg = BPAPackage.Make(deviceStatus, device.DeviceId, device.DeviceType); | var msg = BPAPackage.Make(deviceStatus, device.DeviceId, device.DeviceType); | ||||
mqttMgr.Publish(TopicDefine.GetInstance().PushHeartbeatTopics[device.DeviceType], msg.Serialize()); | mqttMgr.Publish(TopicDefine.GetInstance().PushHeartbeatTopics[device.DeviceType], msg.Serialize()); | ||||
} | } | ||||
Thread.Sleep(1000); | Thread.Sleep(1000); | ||||
} | } | ||||
}, "设备心跳上报", true); | |||||
}, "设备心跳上报", isRestart: true); | |||||
} | } | ||||
public void Dispose() | public void Dispose() | ||||
@@ -1,4 +1,5 @@ | |||||
using BPASmartClient.CustomResource.Pages.ViewModel; | |||||
using BPA.Helper; | |||||
using BPASmartClient.CustomResource.Pages.ViewModel; | |||||
using BPASmartClient.Nfc; | using BPASmartClient.Nfc; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -28,10 +29,10 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||||
if (NFCHelper.GetInstance.GetReadResult?.CardNum.Length > 0) | if (NFCHelper.GetInstance.GetReadResult?.CardNum.Length > 0) | ||||
{ | { | ||||
string id = NFCHelper.GetInstance.GetReadResult?.CardNum; | 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) | if (res != null) | ||||
{ | { | ||||
BPASmartClient.Message.MessageLog.GetInstance.ShowDebugLog("NFC卡登录"); | |||||
MessageLog.GetInstance.Show("NFC卡登录"); | |||||
LoginViewModel.NfcLogin(id); | LoginViewModel.NfcLogin(id); | ||||
} | } | ||||
} | } | ||||
@@ -1,4 +1,5 @@ | |||||
| | ||||
using BPA.Helper; | |||||
using System; | using System; | ||||
using System.Collections.Concurrent; | using System.Collections.Concurrent; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -12,7 +12,7 @@ using BPASmartClient.CustomResource.Pages.Model; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
namespace BPASmartClient.CustomResource.Pages.ViewModel | namespace BPASmartClient.CustomResource.Pages.ViewModel | ||||
{ | { | ||||
@@ -21,24 +21,24 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||||
public MainViewModel() | public MainViewModel() | ||||
{ | { | ||||
NavChangedCommand = new BPARelayCommand<object>(DoNavChanged); | 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(() => | Application.Current?.Dispatcher?.Invoke(() => | ||||
{ | { | ||||
@@ -98,9 +98,9 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||||
ActionManage.GetInstance.Register(new Action<object>((c) => | 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() | private void PermissionChange() | ||||
@@ -160,14 +160,14 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||||
OnPropertyChanged(); | OnPropertyChanged(); | ||||
} | } | ||||
} | } | ||||
private bool _isAlarm=true; | |||||
private bool _isAlarm = true; | |||||
/// <summary> | /// <summary> | ||||
/// 心跳检测报警 | /// 心跳检测报警 | ||||
/// </summary> | /// </summary> | ||||
public bool IsAlarm | public bool IsAlarm | ||||
{ | { | ||||
get { return _isAlarm; } | get { return _isAlarm; } | ||||
set { _isAlarm = value;OnPropertyChanged(); } | |||||
set { _isAlarm = value; OnPropertyChanged(); } | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 开机自启 | /// 开机自启 | ||||
@@ -12,11 +12,11 @@ namespace BPASmartClient.DosingSystemSingle | |||||
public class ViewModelBase : NotifyBase | public class ViewModelBase : NotifyBase | ||||
{ | { | ||||
public int Index { get; set; } = -1; | 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> | /// <summary> | ||||
/// 错误信息 | /// 错误信息 | ||||
@@ -17,8 +17,8 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
if (o != null && o is string str) IpAddress = str; | if (o != null && o is string str) IpAddress = str; | ||||
}), "ChangeDeviceNameViewOpen"); | }), "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)) | if (string.IsNullOrEmpty(DeviceName)) | ||||
{ | { | ||||
@@ -14,7 +14,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
{ | { | ||||
public CommparSetViewModel() | public CommparSetViewModel() | ||||
{ | { | ||||
SaveCommand = new BPABPARelayCommand(() => | |||||
SaveCommand = new BPARelayCommand(() => | |||||
{ | { | ||||
if (!string.IsNullOrEmpty(CommBaseParModel.NetworkSegAddress)) | 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(); } } | public BasePar CommBaseParModel { get { return Json<DevicePar>.Data.BaseParModel; } set { Json<DevicePar>.Data.BaseParModel = value; OnPropertyChanged(); } } | ||||
//private BasePar _mCommBaseParModel; | //private BasePar _mCommBaseParModel; | ||||
public BPABPARelayCommand SaveCommand { get; set; } | |||||
public BPARelayCommand SaveCommand { get; set; } | |||||
} | } | ||||
} | } |
@@ -16,7 +16,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
{ | { | ||||
public DeviceListViewModel() | public DeviceListViewModel() | ||||
{ | { | ||||
DetailsCommand = new BPABPARelayCommand<object>((o) => | |||||
DetailsCommand = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
if (o != null && o is string str) | if (o != null && o is string str) | ||||
{ | { | ||||
@@ -28,7 +28,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
devices = DeviceInquire.GetInstance.devices; | 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 static ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>(); | ||||
public ObservableCollection<Devices> devices { get; set; } | public ObservableCollection<Devices> devices { get; set; } | ||||
@@ -16,15 +16,15 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
public DeviceMaterialParViewModel() | public DeviceMaterialParViewModel() | ||||
{ | { | ||||
deviceParModels = Json<DevicePar>.Data.deviceParModels; | deviceParModels = Json<DevicePar>.Data.deviceParModels; | ||||
RemoveCommand = new BPABPARelayCommand<object>((o) => | |||||
RemoveCommand = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
var res = deviceParModels.FirstOrDefault(p => p.MaterialName == o?.ToString()); | var res = deviceParModels.FirstOrDefault(p => p.MaterialName == o?.ToString()); | ||||
if (res != null) deviceParModels.Remove(res); | if (res != null) deviceParModels.Remove(res); | ||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{o.ToString()}:原料删除成功!"); | 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) | if (deviceParModels == null || deviceParModels.Count <= 0) | ||||
{ | { | ||||
@@ -57,10 +57,10 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
public ObservableCollection<DeviceParModel> deviceParModels { get; set; } | 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; } | |||||
} | } | ||||
} | } |
@@ -23,7 +23,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
// ConveyerBeltModels.Add(new ConveyerBeltModel() { Name = $"输送带{i}", Num = i++ }); | // 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) | // if (o != null && o is int tempCount) | ||||
// { | // { | ||||
@@ -62,7 +62,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
}), "输送带料仓状态监控"); | }), "输送带料仓状态监控"); | ||||
RecipeControlCommand = new BPABPARelayCommand<object>((o) => | |||||
RecipeControlCommand = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
if (o != null && o is DeviceCurrentStatus currentStatus) | 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 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> | /// <summary> | ||||
/// 输送带状态 | /// 输送带状态 | ||||
@@ -51,7 +51,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
OtherHandCylinders.Add(new CylinderModel() { Name = "上桶工位气缸" }); | OtherHandCylinders.Add(new CylinderModel() { Name = "上桶工位气缸" }); | ||||
OtherHandCylinders.Add(new CylinderModel() { Name = "下桶工位气缸" }); | OtherHandCylinders.Add(new CylinderModel() { Name = "下桶工位气缸" }); | ||||
Open = new BPABPARelayCommand<object>((o) => | |||||
Open = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
if (o != null) | if (o != null) | ||||
{ | { | ||||
@@ -76,7 +76,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
}); | }); | ||||
Close = new BPABPARelayCommand<object>((o) => | |||||
Close = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
if (o != null) | 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); | SiemensDevice.GetInstance.MySiemens.Write("M10.0", SystemControlText == "停止" ? false : true); | ||||
/*var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.0"); | /*var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.0"); | ||||
SystemControlText = res ? "停止" : "启动";*/ | SystemControlText = res ? "停止" : "启动";*/ | ||||
}); | }); | ||||
ModelSwitch = new BPABPARelayCommand(() => | |||||
ModelSwitch = new BPARelayCommand(() => | |||||
{ | { | ||||
SiemensDevice.GetInstance.MySiemens.Write("M10.1", ModelSwitchText == "手动" ? true : false); | SiemensDevice.GetInstance.MySiemens.Write("M10.1", ModelSwitchText == "手动" ? true : false); | ||||
/*var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.1"); | /*var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.1"); | ||||
@@ -166,12 +166,12 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
/// </summary> | /// </summary> | ||||
public ObservableCollection<CylinderModel> OtherHandCylinders { get; set; } = new ObservableCollection<CylinderModel>(); | 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(); } } | public string SystemControlText { get { return _mSystemControlText; } set { _mSystemControlText = value; OnPropertyChanged(); } } | ||||
@@ -22,9 +22,9 @@ public class NewMaterialViewModel : ViewModelBase | |||||
//public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | //public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | ||||
//private string _mErrorInfo; | //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() | 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 (MaterialName == String.Empty) { ErrorInfo = "原料名称不能为空"; return; } | ||||
if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == MaterialName) != null) { ErrorInfo = "设备中已存在该原料名称"; return; } | if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == MaterialName) != null) { ErrorInfo = "设备中已存在该原料名称"; return; } | ||||
@@ -29,9 +29,9 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
Index = Array.FindIndex(Json<DevicePar>.Data.OutletInfoModels.ToArray(), p => p.OutletName == tempOutletInfo.OutletName); | Index = Array.FindIndex(Json<DevicePar>.Data.OutletInfoModels.ToArray(), p => p.OutletName == tempOutletInfo.OutletName); | ||||
} | } | ||||
}), "OpenNewOutlet", true); | }), "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>(); | ObservableCollection<string> SileNames = new ObservableCollection<string>(); | ||||
SiloInfos.ToList()?.ForEach(item => { SileNames.Add(item.RawMaterialName); }); | SiloInfos.ToList()?.ForEach(item => { SileNames.Add(item.RawMaterialName); }); | ||||
@@ -82,7 +82,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
} | } | ||||
ActionManage.GetInstance.Send("NewOutletViewClose"); | ActionManage.GetInstance.Send("NewOutletViewClose"); | ||||
}); | }); | ||||
RemoveCommand = new BPABPARelayCommand<object>((o) => | |||||
RemoveCommand = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
if (!string.IsNullOrEmpty(o?.ToString())) | if (!string.IsNullOrEmpty(o?.ToString())) | ||||
{ | { | ||||
@@ -41,7 +41,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
} | } | ||||
}), "Details", true); | }), "Details", true); | ||||
AddCommand = new BPABPARelayCommand(() => | |||||
AddCommand = new BPARelayCommand(() => | |||||
{ | { | ||||
if (RawMaterials.Count >= DeviceInquire.GetInstance.devices.Count) | if (RawMaterials.Count >= DeviceInquire.GetInstance.devices.Count) | ||||
{ | { | ||||
@@ -62,7 +62,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
else goto p; | else goto p; | ||||
}); | }); | ||||
RemoveCommand = new BPABPARelayCommand<object>((obj) => | |||||
RemoveCommand = new BPARelayCommand<object>((obj) => | |||||
{ | { | ||||
if (obj is string rm) | 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; } | if (string.IsNullOrEmpty(RecipeName)) { MessageNotify.GetInstance.ShowDialog("请输入配方名称!", DialogType.Warning); ErrorInfo = "请输入配方名称"; return; } | ||||
var tempRes = RawMaterials.GroupBy(p => p.RawMaterialName); | 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(); } } | //public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | ||||
//private string _mErrorInfo; | //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>(); | public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>(); | ||||
@@ -14,14 +14,14 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
{ | { | ||||
public OutletManagementViewModel() | public OutletManagementViewModel() | ||||
{ | { | ||||
AddCommand = new BPABPARelayCommand(() => | |||||
AddCommand = new BPARelayCommand(() => | |||||
{ | { | ||||
NewOutletView newOutletView = new NewOutletView(); | NewOutletView newOutletView = new NewOutletView(); | ||||
newOutletView.ShowDialog(); | newOutletView.ShowDialog(); | ||||
}); | }); | ||||
SaveCommand = new BPABPARelayCommand(() => { Json<DevicePar>.Save(); }); | |||||
SaveCommand = new BPARelayCommand(() => { Json<DevicePar>.Save(); }); | |||||
OutletInfoModels = Json<DevicePar>.Data.OutletInfoModels; | OutletInfoModels = Json<DevicePar>.Data.OutletInfoModels; | ||||
RemoveCommand = new BPABPARelayCommand<object>((o) => | |||||
RemoveCommand = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
if (!string.IsNullOrEmpty(o?.ToString())) | 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())) | if (!string.IsNullOrEmpty(o?.ToString())) | ||||
{ | { | ||||
@@ -26,9 +26,9 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
static ObservableCollection<string> RawMaterialReset = new ObservableCollection<string>(); | static ObservableCollection<string> RawMaterialReset = new ObservableCollection<string>(); | ||||
public RecipeControlViewModel() | 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(); | RecipeRun(); | ||||
RecipeStatusInquire(); | RecipeStatusInquire(); | ||||
} | } | ||||
@@ -247,11 +247,11 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
}), "RecipeControlViewModelStatusInquire"); | }), "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; | public static ObservableCollection<RecipeModel> Recipes { get; set; } = Json<LocaPar>.Data.Recipes; | ||||
@@ -26,24 +26,24 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel | |||||
{ | { | ||||
Recipes = Json<LocaPar>.Data.Recipes; | Recipes = Json<LocaPar>.Data.Recipes; | ||||
NewMaterital = new BPABPARelayCommand(() => | |||||
NewMaterital = new BPARelayCommand(() => | |||||
{ | { | ||||
NewMaterialView newMateritalView = new NewMaterialView(); | NewMaterialView newMateritalView = new NewMaterialView(); | ||||
newMateritalView.ShowDialog(); | newMateritalView.ShowDialog(); | ||||
}); | }); | ||||
NewRecipe = new BPABPARelayCommand(() => | |||||
NewRecipe = new BPARelayCommand(() => | |||||
{ | { | ||||
NewRecipeView nrv = new NewRecipeView(); | NewRecipeView nrv = new NewRecipeView(); | ||||
nrv.ShowDialog(); | nrv.ShowDialog(); | ||||
MessageNotify.GetInstance.ShowUserLog("新建配方"); | MessageNotify.GetInstance.ShowUserLog("新建配方"); | ||||
}); | }); | ||||
SaveRecipe = new BPABPARelayCommand(() => | |||||
SaveRecipe = new BPARelayCommand(() => | |||||
{ | { | ||||
Json<LocaPar>.Save(); | Json<LocaPar>.Save(); | ||||
MessageNotify.GetInstance.ShowUserLog("保存配方"); | MessageNotify.GetInstance.ShowUserLog("保存配方"); | ||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!"); | NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!"); | ||||
}); | }); | ||||
RemoveCommand = new BPABPARelayCommand<object>((o) => | |||||
RemoveCommand = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
if (!string.IsNullOrEmpty(o?.ToString())) | 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())) | 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; } | public ObservableCollection<RecipeModel> Recipes { get; set; } | ||||
} | } | ||||
@@ -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 | |||||
// } | |||||
//} |
@@ -5,7 +5,7 @@ using BPASmartClient.Business; | |||||
using BPASmartClient.Device; | using BPASmartClient.Device; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.IoT.Model; | using BPASmartClient.IoT.Model; | ||||
using BPASmartDatavDeviceClient.IoT; | using BPASmartDatavDeviceClient.IoT; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -100,7 +100,8 @@ namespace BPASmartClient.IoT | |||||
if (DeviceDataV != null && DeviceDataV.GetIsConnected() && DeviceDataV.deviceTable != null) | if (DeviceDataV != null && DeviceDataV.GetIsConnected() && DeviceDataV.deviceTable != null) | ||||
{ | { | ||||
string api = DataVApiAddress + "/api/Device/FlushedDevice"; | 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("刷新店铺列表")); | //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; | ProductKey = DeviceDataV.deviceTable.productkey; | ||||
DeviceName = DeviceDataV.deviceTable.devicename; | DeviceName = DeviceDataV.deviceTable.devicename; | ||||
@@ -193,9 +193,11 @@ namespace BPASmartDatavDeviceClient.IoT | |||||
{ | { | ||||
string json = string.Empty; | string json = string.Empty; | ||||
if (string.IsNullOrEmpty(deviceId)) | 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 | 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); | 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) | ||||
{ | { | ||||
@@ -1,5 +1,5 @@ | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartDatavDeviceClient.IoT; | using BPASmartDatavDeviceClient.IoT; | ||||
using DataVAPI.Tool.IOT; | using DataVAPI.Tool.IOT; | ||||
using System; | using System; | ||||
@@ -27,7 +27,7 @@ namespace BPASmartClient.IoT.Model | |||||
/// <summary> | /// <summary> | ||||
/// 请求反馈信息 | /// 请求反馈信息 | ||||
/// </summary> | /// </summary> | ||||
public static FileUploadModelResult modelResult=null; | |||||
public static FileUploadModelResult modelResult = null; | |||||
/// <summary> | /// <summary> | ||||
/// 文件请求上传 | /// 文件请求上传 | ||||
/// </summary> | /// </summary> | ||||
@@ -37,8 +37,8 @@ namespace BPASmartClient.IoT.Model | |||||
{ | { | ||||
try | 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)//删除文件 | if (_data != null)//删除文件 | ||||
{ | { | ||||
MessageLog.GetInstance.Show("阿里云设备下文件已存在,准备删除续传..."); | MessageLog.GetInstance.Show("阿里云设备下文件已存在,准备删除续传..."); | ||||
@@ -66,12 +66,12 @@ namespace BPASmartClient.IoT.Model | |||||
FileUploadModel fileUpload = new FileUploadModel(); | FileUploadModel fileUpload = new FileUploadModel(); | ||||
fileUpload.@params.fileName = FileName; | 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.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()}"; | fileUpload.@params.initUid = $"ab{RandomHelper.GenerateRandomCode()}"; | ||||
//上传到阿里云物联网平台的OSS存储空间中 | //上传到阿里云物联网平台的OSS存储空间中 | ||||
@@ -92,7 +92,7 @@ namespace BPASmartClient.IoT.Model | |||||
if (count > 5) | if (count > 5) | ||||
{ | { | ||||
MessageLog.GetInstance.Show($"[阿里云上传]:超时上传、未知原因、退出线程."); | MessageLog.GetInstance.Show($"[阿里云上传]:超时上传、未知原因、退出线程."); | ||||
return; | return; | ||||
} | } | ||||
Thread.Sleep(3000); count++; | Thread.Sleep(3000); count++; | ||||
@@ -116,19 +116,19 @@ namespace BPASmartClient.IoT.Model | |||||
{ | { | ||||
MessageLog.GetInstance.ShowEx(ex.ToString()); | MessageLog.GetInstance.ShowEx(ex.ToString()); | ||||
} | } | ||||
}), "文件请求上传", false); | |||||
}), "文件请求上传", isRestart: false); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 文件上传 | /// 文件上传 | ||||
/// </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(); | FileSendModel fileSend = new FileSendModel(); | ||||
fileSend.@params.uploadId = uploadId; | fileSend.@params.uploadId = uploadId; | ||||
fileSend.@params.offset = offset; | fileSend.@params.offset = offset; | ||||
fileSend.@params.bSize = FileBlock.Count(); | 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 低 高" | //Header.length(高 低) + Header(字节数组UTF-8) + 文件分片的字节数组 + "分片校验值CrC16 低 高" | ||||
byte[] Header = Encoding.UTF8.GetBytes(Tools.JsonConvertTools(fileSend)); | byte[] Header = Encoding.UTF8.GetBytes(Tools.JsonConvertTools(fileSend)); | ||||
@@ -154,9 +154,10 @@ namespace DataVAPI.Tool.IOT | |||||
try | try | ||||
{ | { | ||||
//http://localhost:9092/api/Device/Query?chid=2 | //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); | 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(); | device = jsonMsg.obj.data.FirstOrDefault(); | ||||
if (device == null) return false; | if (device == null) return false; | ||||
@@ -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\\"; | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -16,6 +16,7 @@ using System.Collections.ObjectModel; | |||||
using BPASmartClient.Model.PLC; | using BPASmartClient.Model.PLC; | ||||
using BPASmartClient.MorkM.ViewModel; | using BPASmartClient.MorkM.ViewModel; | ||||
using BPA.Message; | using BPA.Message; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.MorkM | namespace BPASmartClient.MorkM | ||||
{ | { | ||||
@@ -59,7 +60,7 @@ namespace BPASmartClient.MorkM | |||||
Loc = 11, | Loc = 11, | ||||
SuborderId = subId, | SuborderId = subId, | ||||
MakeType = false | MakeType = false | ||||
}) ; | |||||
}); | |||||
mORKS.DishNumber = orders.Count;//订单中配菜的数量 | mORKS.DishNumber = orders.Count;//订单中配菜的数量 | ||||
while (orders.Count > 0) | while (orders.Count > 0) | ||||
{ | { | ||||
@@ -161,7 +162,7 @@ namespace BPASmartClient.MorkM | |||||
List<OrderLocInfo> locs = new List<OrderLocInfo>(); | List<OrderLocInfo> locs = new List<OrderLocInfo>(); | ||||
foreach (var item in order.MorkOrder.GoodBatchings) | 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 (res != null) | ||||
{ | { | ||||
if (ushort.TryParse(res.BatchingLoc, out ushort loc)) | if (ushort.TryParse(res.BatchingLoc, out ushort loc)) | ||||
@@ -269,7 +270,7 @@ namespace BPASmartClient.MorkM | |||||
TakeBowlControl(orderLocInfo.Loc); | TakeBowlControl(orderLocInfo.Loc); | ||||
SetRecipeNumber(orderLocInfo.RecipeNumber); | SetRecipeNumber(orderLocInfo.RecipeNumber); | ||||
OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING); | OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING); | ||||
DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]"); | |||||
DeviceProcessLogShow($"订单【{mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]"); | |||||
} | } | ||||
mORKS.TakeBowlInterlock = true; | mORKS.TakeBowlInterlock = true; | ||||
} | } | ||||
@@ -386,13 +387,13 @@ namespace BPASmartClient.MorkM | |||||
{ | { | ||||
values.Add(2);//分 | values.Add(2);//分 | ||||
values.Add(0);//秒 | 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 //荤菜 | else //荤菜 | ||||
{ | { | ||||
values.Add(4);//分 | values.Add(4);//分 | ||||
values.Add(0);//秒 | 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() | public override void DoMain() | ||||
{ | { | ||||
MonitorViewModel.DeviceId = DeviceId; | MonitorViewModel.DeviceId = DeviceId; | ||||
@@ -8,7 +8,7 @@ using BPASmartClient.Peripheral; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using System.Threading; | using System.Threading; | ||||
using BPA.Message; | using BPA.Message; | ||||
using System.Linq; | using System.Linq; | ||||
using BPASmartClient.Model.PLC; | using BPASmartClient.Model.PLC; | ||||
@@ -24,6 +24,7 @@ using System.Windows.Forms; | |||||
using System.Media; | using System.Media; | ||||
using BPASmartClient.CustomResource; | using BPASmartClient.CustomResource; | ||||
using Microsoft.EntityFrameworkCore.Metadata.Internal; | using Microsoft.EntityFrameworkCore.Metadata.Internal; | ||||
using static BPA.Helper.EventBus; | |||||
//using BPA.Helper; | //using BPA.Helper; | ||||
namespace BPASmartClient.MorkMV1 | namespace BPASmartClient.MorkMV1 | ||||
@@ -291,7 +292,7 @@ namespace BPASmartClient.MorkMV1 | |||||
{ | { | ||||
if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1) | 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++) | for (byte i = 0; i < 6; i++) | ||||
{ | { | ||||
@@ -4,9 +4,10 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading; | using System.Threading; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPASmartClient.MQTT; | |||||
using BPA.Message; | using BPA.Message; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPA.Communication; | |||||
namespace BPASmartClient.MorkMV1 | namespace BPASmartClient.MorkMV1 | ||||
{ | { | ||||
@@ -19,10 +20,10 @@ namespace BPASmartClient.MorkMV1 | |||||
public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS(); | public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS(); | ||||
MQTTProxy mQTTProxy = new MQTTProxy(); | |||||
MqttHelper mQTTProxy = new MqttHelper(); | |||||
public void Init() | public void Init() | ||||
{ | { | ||||
mQTTProxy.Connected = new Action(() => | |||||
mQTTProxy.ConnectOk = new Action(() => | |||||
{ | { | ||||
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机)); | mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机)); | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
@@ -35,7 +36,15 @@ namespace BPASmartClient.MorkMV1 | |||||
Thread.Sleep(100); | 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")}" | |||||
}); | |||||
} | } | ||||
//订单信息(正在制作,等待制作,制作完成) | //订单信息(正在制作,等待制作,制作完成) | ||||
@@ -2,13 +2,10 @@ | |||||
global using System.Collections.Generic; | global using System.Collections.Generic; | ||||
global using BPA.Message.Enum; | global using BPA.Message.Enum; | ||||
global using BPASmartClient.Device; | global using BPASmartClient.Device; | ||||
global | |||||
global using BPASmartClient.Model; | global using BPASmartClient.Model; | ||||
global using BPASmartClient.Peripheral; | global using BPASmartClient.Peripheral; | ||||
global | |||||
global using BPA.Helper; | global using BPA.Helper; | ||||
global using System.Threading; | global using System.Threading; | ||||
global | |||||
global using BPA.Message; | global using BPA.Message; | ||||
global using System.Linq; | global using System.Linq; | ||||
global using BPASmartClient.Model.PLC; | global using BPASmartClient.Model.PLC; | ||||
@@ -20,7 +20,7 @@ using System.Net.Http.Json; | |||||
using System.Reflection; | using System.Reflection; | ||||
using System.Threading; | using System.Threading; | ||||
using System.Windows.Documents; | using System.Windows.Documents; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.MorkMW | namespace BPASmartClient.MorkMW | ||||
{ | { | ||||
@@ -8,7 +8,7 @@ using BPASmartClient.Peripheral; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using System.Threading; | using System.Threading; | ||||
using BPA.Message; | using BPA.Message; | ||||
using System.Linq; | using System.Linq; | ||||
using BPASmartClient.Model.PLC; | using BPASmartClient.Model.PLC; | ||||
@@ -24,6 +24,7 @@ using System.Speech.Synthesis; | |||||
using System.Windows.Forms; | using System.Windows.Forms; | ||||
using System.Media; | using System.Media; | ||||
using BPASmartClient.CustomResource; | using BPASmartClient.CustomResource; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.MorkS | namespace BPASmartClient.MorkS | ||||
{ | { | ||||
@@ -5,9 +5,9 @@ using System.Text; | |||||
using System.Threading; | using System.Threading; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.MQTT; | |||||
using BPA.Message; | using BPA.Message; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPA.Communication; | |||||
namespace BPASmartClient.MorkS | namespace BPASmartClient.MorkS | ||||
{ | { | ||||
@@ -20,10 +20,10 @@ namespace BPASmartClient.MorkS | |||||
public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS(); | public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS(); | ||||
MQTTProxy mQTTProxy = new MQTTProxy(); | |||||
MqttHelper mQTTProxy = new MqttHelper(); | |||||
public void Init() | public void Init() | ||||
{ | { | ||||
mQTTProxy.Connected = new Action(() => | |||||
mQTTProxy.ConnectOk = new Action(() => | |||||
{ | { | ||||
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机)); | mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机)); | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
@@ -36,7 +36,15 @@ namespace BPASmartClient.MorkS | |||||
Thread.Sleep(100); | 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")}" | |||||
}); | |||||
} | } | ||||
//订单信息(正在制作,等待制作,制作完成) | //订单信息(正在制作,等待制作,制作完成) | ||||
@@ -8,7 +8,7 @@ using BPASmartClient.Peripheral; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using System.Threading; | using System.Threading; | ||||
using BPA.Message; | using BPA.Message; | ||||
using System.Linq; | using System.Linq; | ||||
using BPASmartClient.Model.PLC; | using BPASmartClient.Model.PLC; | ||||
@@ -23,6 +23,7 @@ using BPA.Models; | |||||
using System.Windows.Forms; | using System.Windows.Forms; | ||||
using System.Media; | using System.Media; | ||||
using BPASmartClient.CustomResource; | using BPASmartClient.CustomResource; | ||||
using static BPA.Helper.EventBus; | |||||
//using BPA.Helper; | //using BPA.Helper; | ||||
namespace BPASmartClient.MorkSUpgradedVer | namespace BPASmartClient.MorkSUpgradedVer | ||||
@@ -343,7 +344,7 @@ namespace BPASmartClient.MorkSUpgradedVer | |||||
{ | { | ||||
if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1) | 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++) | 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).Minute); | ||||
//values.Add(Json<MorksPar>.Data.parSets.ElementAt(loc).Second); | //values.Add(Json<MorksPar>.Data.parSets.ElementAt(loc).Second); | ||||
//WriteData($"VW{324 + (loc * 4)}", values.ToArray()); | //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()); | 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>(); | List<ushort> values = new List<ushort>(); | ||||
values.Add(x.Minute); | values.Add(x.Minute); | ||||
values.Add(x.Second); | values.Add(x.Second); | ||||
@@ -711,24 +714,26 @@ namespace BPASmartClient.MorkSUpgradedVer | |||||
//} | //} | ||||
#endregion | #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}】取餐完成"); | DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成"); | ||||
WriteData("M10.1", false); | 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; | mORKS.OutMealSortNum = orderEvent?.MorkOrder.SortNum ?? 0; | ||||
DeviceProcessLogShow($"出餐订单序号【{mORKS.OutMealSortNum}】"); | DeviceProcessLogShow($"出餐订单序号【{mORKS.OutMealSortNum}】"); | ||||
@@ -4,9 +4,9 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading; | using System.Threading; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPASmartClient.MQTT; | |||||
using BPA.Message; | using BPA.Message; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPA.Communication; | |||||
namespace BPASmartClient.MorkSUpgradedVer | namespace BPASmartClient.MorkSUpgradedVer | ||||
{ | { | ||||
@@ -19,10 +19,10 @@ namespace BPASmartClient.MorkSUpgradedVer | |||||
public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS(); | public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS(); | ||||
MQTTProxy mQTTProxy = new MQTTProxy(); | |||||
MqttHelper mQTTProxy = new MqttHelper(); | |||||
public void Init() | public void Init() | ||||
{ | { | ||||
mQTTProxy.Connected = new Action(() => | |||||
mQTTProxy.ConnectOk = new Action(() => | |||||
{ | { | ||||
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机)); | mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机)); | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
@@ -35,7 +35,15 @@ namespace BPASmartClient.MorkSUpgradedVer | |||||
Thread.Sleep(100); | 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")}" | |||||
}); | |||||
} | } | ||||
//订单信息(正在制作,等待制作,制作完成) | //订单信息(正在制作,等待制作,制作完成) | ||||
@@ -2,13 +2,10 @@ | |||||
global using System.Collections.Generic; | global using System.Collections.Generic; | ||||
global using BPA.Message.Enum; | global using BPA.Message.Enum; | ||||
global using BPASmartClient.Device; | global using BPASmartClient.Device; | ||||
global | |||||
global using BPASmartClient.Model; | global using BPASmartClient.Model; | ||||
global using BPASmartClient.Peripheral; | global using BPASmartClient.Peripheral; | ||||
global | |||||
global using BPA.Helper; | global using BPA.Helper; | ||||
global using System.Threading; | global using System.Threading; | ||||
global | |||||
global using BPA.Message; | global using BPA.Message; | ||||
global using System.Linq; | global using System.Linq; | ||||
global using BPASmartClient.Model.PLC; | global using BPASmartClient.Model.PLC; | ||||
@@ -17,6 +17,7 @@ using BPASmartClient.Model; | |||||
using BPASmartClient.Model.乐白机器人; | using BPASmartClient.Model.乐白机器人; | ||||
using BPASmartClient.Model.单片机; | using BPASmartClient.Model.单片机; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.MorkTLebaiJC | namespace BPASmartClient.MorkTLebaiJC | ||||
{ | { | ||||
@@ -6,7 +6,7 @@ using BPASmartClient.GSIceCream; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Lebai; | using BPASmartClient.Lebai; | ||||
using BPASmartClient.LebaiRobot; | using BPASmartClient.LebaiRobot; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.乐白机器人; | using BPASmartClient.Model.乐白机器人; | ||||
using BPASmartClient.Model.乐白机器人.Enum; | using BPASmartClient.Model.乐白机器人.Enum; | ||||
@@ -22,7 +22,7 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading; | using System.Threading; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.MorkT | namespace BPASmartClient.MorkT | ||||
{ | { | ||||
@@ -208,7 +208,7 @@ namespace BPASmartClient.MorkT | |||||
morkT.IceCreamError = error; | morkT.IceCreamError = error; | ||||
} | } | ||||
})); | })); | ||||
GetStatus("IceCreamDLCompleted", new Action<object>((o) => | GetStatus("IceCreamDLCompleted", new Action<object>((o) => | ||||
{ | { | ||||
if (o is bool b) | if (o is bool b) | ||||
@@ -420,7 +420,7 @@ namespace BPASmartClient.MorkT | |||||
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_接咖啡后回原点 }); //接咖啡后回原点 | EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_接咖啡后回原点 }); //接咖啡后回原点 | ||||
Wait(); | Wait(); | ||||
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | 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}!"); | DeviceProcessLogShow($"发送咖啡机制作{orderLoc.Loc}!"); | ||||
morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc; | morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc; | ||||
} | } | ||||
@@ -469,9 +469,9 @@ namespace BPASmartClient.MorkT | |||||
/// <param name="order"></param> | /// <param name="order"></param> | ||||
private void GetAndCheeckCoffe(OrderLocInfo order) | 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); | 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(); | Wait(); | ||||
// EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制 | // EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制 | ||||
@@ -489,10 +489,10 @@ namespace BPASmartClient.MorkT | |||||
int count = 1; | int count = 1; | ||||
bool result = true; | bool result = true; | ||||
p: | 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(); | Wait(); | ||||
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | 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) | if (o != null && o.Length > 0 && o[0] is bool resultValue) | ||||
{ | { | ||||
@@ -506,14 +506,14 @@ namespace BPASmartClient.MorkT | |||||
{ | { | ||||
//退出循环回到初始位置 | //退出循环回到初始位置 | ||||
DeviceProcessLogShow($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!"); | 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(); | Wait(); | ||||
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
morkT.GetCoffeeCup = false; | morkT.GetCoffeeCup = false; | ||||
return; | return; | ||||
} | } | ||||
DeviceProcessLogShow("执行二次取咖啡杯"); | 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(); | Wait(); | ||||
EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制 | EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制 | ||||
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
@@ -619,22 +619,22 @@ namespace BPASmartClient.MorkT | |||||
bool result = true; | bool result = true; | ||||
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
p: | 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(); | Wait(); | ||||
Thread.Sleep(500); | 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) | if (o != null && o.Length > 0 && o[0] is SignalResult res) | ||||
{ | { | ||||
MessageLog.GetInstance.Show(res.ToString()); | MessageLog.GetInstance.Show(res.ToString()); | ||||
} | } | ||||
}); | }); | ||||
while((int)peripheralStatus["RobotValue"] != 0) | |||||
while ((int)peripheralStatus["RobotValue"] != 0) | |||||
{ | { | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
} | } | ||||
MessageLog.GetInstance.Show($"乐白机器人信号值{peripheralStatus["RobotValue"].ToString()}"); | MessageLog.GetInstance.Show($"乐白机器人信号值{peripheralStatus["RobotValue"].ToString()}"); | ||||
//while ((ELebaiRModel)peripheralStatus["RobotMode"] !=ELebaiRModel.空闲状态) | //while ((ELebaiRModel)peripheralStatus["RobotMode"] !=ELebaiRModel.空闲状态) | ||||
//{ | //{ | ||||
// EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); | // EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); | ||||
@@ -656,12 +656,12 @@ namespace BPASmartClient.MorkT | |||||
DeviceProcessLogShow($"执行{count}次取冰淇淋杯,仍未成功,订单默认废弃,机器人回到初始位置!"); | 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(); | 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; | morkT.GetIceCreamCup = false; | ||||
return; | return; | ||||
} | } | ||||
DeviceProcessLogShow($"执行{count}次取冰淇淋杯!"); | 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 });//落碗控制 | EventBus.GetInstance().Equals(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制 | ||||
Wait(); | Wait(); | ||||
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
@@ -742,7 +742,7 @@ namespace BPASmartClient.MorkT | |||||
}); | }); | ||||
Thread.Sleep(500); | Thread.Sleep(500); | ||||
} | } | ||||
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(); | Wait(); | ||||
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
@@ -18,7 +18,8 @@ using BPASmartClient.Model.PLC; | |||||
using BPASmartClient.Model.单片机; | using BPASmartClient.Model.单片机; | ||||
using BPASmartClient.Business; | using BPASmartClient.Business; | ||||
using BPASmartClient.KLMCoffee.Protocal; | using BPASmartClient.KLMCoffee.Protocal; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.MorkTSingle | namespace BPASmartClient.MorkTSingle | ||||
{ | { | ||||
/* | /* | ||||
@@ -58,7 +59,7 @@ namespace BPASmartClient.MorkTSingle | |||||
} | } | ||||
ConcurrentQueue<MorkOrderPush> morkOrderPushes = new ConcurrentQueue<MorkOrderPush>(); | ConcurrentQueue<MorkOrderPush> morkOrderPushes = new ConcurrentQueue<MorkOrderPush>(); | ||||
/// <summary> | /// <summary> | ||||
/// | /// | ||||
/// </summary> | /// </summary> | ||||
@@ -83,7 +84,7 @@ namespace BPASmartClient.MorkTSingle | |||||
} | } | ||||
} | } | ||||
DateTime delayTimeOut_Coffee; | DateTime delayTimeOut_Coffee; | ||||
private void DoCoffee() | |||||
private void DoCoffee() | |||||
{ | { | ||||
if (IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && !morkT.IsCoffeeMake /*&& morkT.coffeeState== K95SysTemStatus.空闲状态*/) | 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.热水 | 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(); | new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); | ||||
} | } | ||||
morkT.IsCoffeeMake = true; | 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); | OrderChange(morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | ||||
DeviceProcessLogShow($"{morkT.morkOrderPushesCoffee.ElementAt(0).GoodName}制作完成"); | DeviceProcessLogShow($"{morkT.morkOrderPushesCoffee.ElementAt(0).GoodName}制作完成"); | ||||
@@ -171,7 +172,7 @@ namespace BPASmartClient.MorkTSingle | |||||
{ | { | ||||
//验证商品是做的某种饮料 | //验证商品是做的某种饮料 | ||||
if (ValidateGoodsByBatching(res.BatchingLoc) != GOODS_TYPE.NEITHER) | if (ValidateGoodsByBatching(res.BatchingLoc) != GOODS_TYPE.NEITHER) | ||||
{ | |||||
{ | |||||
//获取当前物料所属商品类型 | //获取当前物料所属商品类型 | ||||
currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc); | currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc); | ||||
} | } | ||||
@@ -235,7 +236,8 @@ namespace BPASmartClient.MorkTSingle | |||||
morkT.KLMCoffeeIsConnected = b; | morkT.KLMCoffeeIsConnected = b; | ||||
} | } | ||||
})); | })); | ||||
if ( morkT.morkOrderPushesCoffee.Count > 0) { | |||||
if (morkT.morkOrderPushesCoffee.Count > 0) | |||||
{ | |||||
if (morkT.KLMCoffeeIsConnected) | if (morkT.KLMCoffeeIsConnected) | ||||
{ | { | ||||
if (morkT.IsCoffeeMake) | if (morkT.IsCoffeeMake) | ||||
@@ -248,7 +250,7 @@ namespace BPASmartClient.MorkTSingle | |||||
morkT.MakeCoffeeFinish = true; | morkT.MakeCoffeeFinish = true; | ||||
}); | }); | ||||
} | } | ||||
else | |||||
else | |||||
{ | { | ||||
EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | 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 aa = calLrcCommon("01" + "01" + "0001"); | ||||
string bb = ":01010001" + aa + "\r\n";*/ | string bb = ":01010001" + aa + "\r\n";*/ | ||||
} | } | ||||
public static string calLrcCommon(string data) | public static string calLrcCommon(string data) | ||||
{ | { | ||||
@@ -14,7 +14,7 @@ using BPASmartClient.Model.咖啡机.Enum; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.乐白机器人; | using BPASmartClient.Model.乐白机器人; | ||||
using BPASmartClient.Model.单片机; | using BPASmartClient.Model.单片机; | ||||
using BPASmartClient.Model.PLC; | using BPASmartClient.Model.PLC; | ||||
@@ -23,6 +23,7 @@ using BPASmartClient.LebaiRobot; | |||||
using BPASmartClient.RobotGripper; | using BPASmartClient.RobotGripper; | ||||
using BPASmartClient.Model.电夹爪; | using BPASmartClient.Model.电夹爪; | ||||
using BPASmartClient.Model.奶茶味魔方; | using BPASmartClient.Model.奶茶味魔方; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.MorkT_BarCounter | namespace BPASmartClient.MorkT_BarCounter | ||||
{ | { | ||||
@@ -45,7 +46,7 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
private string mainMaterialLoc; | private string mainMaterialLoc; | ||||
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } } | 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> | /// <summary> | ||||
/// 果汁机做法,true:热饮,false:冷饮 | /// 果汁机做法,true:热饮,false:冷饮 | ||||
/// </summary> | /// </summary> | ||||
@@ -81,7 +82,7 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
} | } | ||||
private void DataParse() | private void DataParse() | ||||
{ | { | ||||
EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle) | EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle) | ||||
{ | { | ||||
if (@event == null) return; | if (@event == null) return; | ||||
@@ -117,14 +118,14 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
switch (currentGoodsType) | switch (currentGoodsType) | ||||
{ | { | ||||
case GOODS_TYPE.COFFEE: | case GOODS_TYPE.COFFEE: | ||||
if (morkT.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | if (morkT.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | ||||
{ | { | ||||
morkT.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() | morkT.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() | ||||
{ | { | ||||
SuborderId = order.MorkOrder.SuborderId, | SuborderId = order.MorkOrder.SuborderId, | ||||
BatchingId = res.BatchingId, | BatchingId = res.BatchingId, | ||||
Loc = ushort.Parse( mainMaterialLoc), | |||||
Loc = ushort.Parse(mainMaterialLoc), | |||||
GoodName = order.MorkOrder.GoodsName, | GoodName = order.MorkOrder.GoodsName, | ||||
}); | }); | ||||
morkT.morkOrderPushesAll.Enqueue(new OrderLocInfo() | morkT.morkOrderPushesAll.Enqueue(new OrderLocInfo() | ||||
@@ -134,7 +135,7 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
Loc = ushort.Parse(mainMaterialLoc), | Loc = ushort.Parse(mainMaterialLoc), | ||||
GoodName = order.MorkOrder.GoodsName, | GoodName = order.MorkOrder.GoodsName, | ||||
}); | }); | ||||
} | } | ||||
break; | break; | ||||
//case GOODS_TYPE.JUICE: | //case GOODS_TYPE.JUICE: | ||||
@@ -194,7 +195,7 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
/// 将空杯放好到接饮料的地方的标志位 | /// 将空杯放好到接饮料的地方的标志位 | ||||
/// </summary> | /// </summary> | ||||
private bool bFirstTrig_MilkTea = false; | private bool bFirstTrig_MilkTea = false; | ||||
private bool bFirstTrig_Coffee = false; | |||||
private bool bFirstTrig_Coffee = false; | |||||
/// <summary> | /// <summary> | ||||
/// 延迟的超时时间 | /// 延迟的超时时间 | ||||
/// </summary> | /// </summary> | ||||
@@ -206,7 +207,7 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
{ | { | ||||
if (morkT.IsHaveCoffeeCup && morkT.MakeCoffeeEnd != true) | if (morkT.IsHaveCoffeeCup && morkT.MakeCoffeeEnd != true) | ||||
morkT.MakeCoffeeEnd = true; | morkT.MakeCoffeeEnd = true; | ||||
bFirstTrig_Coffee = false; | |||||
bFirstTrig_Coffee = false; | |||||
}); | }); | ||||
if (morkT.IsHaveCoffeeCup && morkT.MakeCoffeeEnd != true) | if (morkT.IsHaveCoffeeCup && morkT.MakeCoffeeEnd != true) | ||||
{ | { | ||||
@@ -215,7 +216,7 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
bFirstTrig_Coffee = true; | bFirstTrig_Coffee = true; | ||||
delayTimeOut_Coffee = DateTime.Now; | 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("接咖啡超时,接咖啡结束,等待取咖啡"); | DeviceProcessLogShow("接咖啡超时,接咖啡结束,等待取咖啡"); | ||||
bFirstTrig_Coffee = false; | bFirstTrig_Coffee = false; | ||||
@@ -235,9 +236,9 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
DeviceProcessLogShow("接茶或水延迟时间结束"); | DeviceProcessLogShow("接茶或水延迟时间结束"); | ||||
morkT.MakeMilkTeaEnd = true; | 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) | if (morkT.IsHaveTeaMilkTeaCup && morkT.MakeMilkTeaEnd != true) | ||||
{ | { | ||||
@@ -284,9 +285,9 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
/// </summary> | /// </summary> | ||||
/// <param name="value"></param> | /// <param name="value"></param> | ||||
/// <param name="pin"></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) | private T GetStatus<T>(string key) | ||||
{ | { | ||||
@@ -304,14 +305,14 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
/// 传感器的输入信号 0:无意义 1:有信号 2:无信号 3:信号不正确 | /// 传感器的输入信号 0:无意义 1:有信号 2:无信号 3:信号不正确 | ||||
/// </summary> | /// </summary> | ||||
int bSensorInput; | int bSensorInput; | ||||
/// <summary> | /// <summary> | ||||
/// 判断是否有咖啡订单 | /// 判断是否有咖啡订单 | ||||
/// </summary> | /// </summary> | ||||
/// <returns></returns> | /// <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; | return bMake; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -320,7 +321,7 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
/// <returns></returns> | /// <returns></returns> | ||||
private bool IsMakeJuice() | 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; | return bMake; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -338,20 +339,20 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
/// <returns></returns> | /// <returns></returns> | ||||
private bool IsMakeWater() | 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; | return bMake; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 做咖啡流程 | /// 做咖啡流程 | ||||
/// </summary> | /// </summary> | ||||
private void DoCoffee() | |||||
private void DoCoffee() | |||||
{ | { | ||||
if (IsMakeCoffee()) | if (IsMakeCoffee()) | ||||
{ | { | ||||
Discharge_Control(Kind.咖啡);//接咖啡 | Discharge_Control(Kind.咖啡);//接咖啡 | ||||
morkT.IsHaveCoffeeCup = true; | morkT.IsHaveCoffeeCup = true; | ||||
} | } | ||||
else if(morkT.MakeCoffeeEnd) | |||||
else if (morkT.MakeCoffeeEnd) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
@@ -368,7 +369,7 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
} | } | ||||
} | } | ||||
} | } | ||||
private void DoMilkTea() | |||||
private void DoMilkTea() | |||||
{ | { | ||||
if (IsMakeMilkTea()) | if (IsMakeMilkTea()) | ||||
{ | { | ||||
@@ -414,7 +415,7 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
{ | { | ||||
if (kind == Kind.咖啡) | 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_取杯位_接咖啡位)); | JakaWait(int.Parse(JakaModel.SENCE_取杯位_接咖啡位)); | ||||
new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)(morkT.morkOrderPushesCoffee.ElementAt(0).Loc) }.Publish(); //控制咖啡出料 | new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)(morkT.morkOrderPushesCoffee.ElementAt(0).Loc) }.Publish(); //控制咖啡出料 | ||||
@@ -426,7 +427,7 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
//DeviceProcessLogShow("接咖啡杯动作完成"); | //DeviceProcessLogShow("接咖啡杯动作完成"); | ||||
} | } | ||||
else | |||||
else | |||||
{ | { | ||||
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_取杯位_接奶茶位)); | JakaWait(int.Parse(JakaModel.SENCE_取杯位_接奶茶位)); | ||||
@@ -608,7 +609,7 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
JakaWait(int.Parse(JakaModel.SENCE_初始位_取杯位)); | JakaWait(int.Parse(JakaModel.SENCE_初始位_取杯位)); | ||||
int cnt = 0; | 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_落杯)); | JakaWait(int.Parse(JakaModel.SENCE_落杯)); | ||||
cnt = cnt + 1; | cnt = cnt + 1; | ||||
if (!GetStatus<bool>("Get_JakaRobotDI5")) | if (!GetStatus<bool>("Get_JakaRobotDI5")) | ||||
@@ -647,7 +648,7 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
} | } | ||||
public void SimOrder<T>(T simOrder) | public void SimOrder<T>(T simOrder) | ||||
{ | { | ||||
} | } | ||||
private void JakaWait(int value) | private void JakaWait(int value) | ||||
{ | { | ||||
@@ -897,11 +898,11 @@ namespace BPASmartClient.MorkT_BarCounter | |||||
DeviceProcessLogShow("----开始模拟订单----"); | DeviceProcessLogShow("----开始模拟订单----"); | ||||
if (msm.OrderNum == 1) | 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) | 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) | else if (msm.OrderNum == 3) | ||||
{ | { | ||||
@@ -21,6 +21,7 @@ using BPASmartClient.Model.PLC; | |||||
using BPASmartClient.DRCoffee; | using BPASmartClient.DRCoffee; | ||||
using BPASmartClient.LebaiRobot; | using BPASmartClient.LebaiRobot; | ||||
using System.Text.RegularExpressions; | using System.Text.RegularExpressions; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.MorkT_Container | namespace BPASmartClient.MorkT_Container | ||||
{ | { | ||||
@@ -8,7 +8,7 @@ using BPA.Helper; | |||||
using BPASmartClient.KLMCoffee.Protocal; | using BPASmartClient.KLMCoffee.Protocal; | ||||
using BPASmartClient.Lebai; | using BPASmartClient.Lebai; | ||||
using BPASmartClient.LebaiRobot; | using BPASmartClient.LebaiRobot; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.乐白机器人; | using BPASmartClient.Model.乐白机器人; | ||||
using BPASmartClient.Model.冰淇淋.Enum; | using BPASmartClient.Model.冰淇淋.Enum; | ||||
@@ -22,7 +22,7 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading; | using System.Threading; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.MorkTHQ | namespace BPASmartClient.MorkTHQ | ||||
{ | { | ||||
@@ -35,7 +35,7 @@ namespace BPASmartClient.MorkTHQ | |||||
public override void DoMain() | public override void DoMain() | ||||
{ | { | ||||
if(Json<KeepDataBase>.Data.IsVerify) | |||||
if (Json<KeepDataBase>.Data.IsVerify) | |||||
{ | { | ||||
IsHealth = true; | IsHealth = true; | ||||
} | } | ||||
@@ -74,7 +74,7 @@ namespace BPASmartClient.MorkTHQ | |||||
public override void MainTask() | public override void MainTask() | ||||
{ | { | ||||
//制作咖啡 | |||||
//制作咖啡 | |||||
MakeCoffeeProcess(); | MakeCoffeeProcess(); | ||||
//制作果汁 | //制作果汁 | ||||
MakeJuiceProcess(); | MakeJuiceProcess(); | ||||
@@ -82,7 +82,7 @@ namespace BPASmartClient.MorkTHQ | |||||
MakeIceCreamProcess(); | MakeIceCreamProcess(); | ||||
//制作完取咖啡 | //制作完取咖啡 | ||||
MakeCoffeeComplete(); | MakeCoffeeComplete(); | ||||
} | } | ||||
@@ -99,7 +99,7 @@ namespace BPASmartClient.MorkTHQ | |||||
GetStatus("RobotMode", new Action<object>((o) => | GetStatus("RobotMode", new Action<object>((o) => | ||||
{ | { | ||||
if (o is ELebaiRModel eLebaiRModel) | |||||
if (o is ELebaiRModel eLebaiRModel) | |||||
{ | { | ||||
morkT.RobotMode = eLebaiRModel; | morkT.RobotMode = eLebaiRModel; | ||||
} | } | ||||
@@ -287,7 +287,7 @@ namespace BPASmartClient.MorkTHQ | |||||
morkT.batchings = PolymerBatching.BuildAll(); | morkT.batchings = PolymerBatching.BuildAll(); | ||||
//商品类型 | //商品类型 | ||||
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER; | GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER; | ||||
foreach (var item in order.MorkOrder.GoodBatchings) | 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); | ||||
@@ -333,7 +333,7 @@ namespace BPASmartClient.MorkTHQ | |||||
} | } | ||||
break; | break; | ||||
case GOODS_TYPE.JUICE: | 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.GuMake = order.MorkOrder.MakeID == "2"; | ||||
morkT.morkOrderPushesJuice.Enqueue(new OrderLocInfo() | morkT.morkOrderPushesJuice.Enqueue(new OrderLocInfo() | ||||
@@ -351,7 +351,7 @@ namespace BPASmartClient.MorkTHQ | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -367,9 +367,9 @@ namespace BPASmartClient.MorkTHQ | |||||
return morkT.batchings[batchingLoc].GoodsType; | return morkT.batchings[batchingLoc].GoodsType; | ||||
return GOODS_TYPE.NEITHER; | return GOODS_TYPE.NEITHER; | ||||
} | } | ||||
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) | private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) | ||||
{ | { | ||||
@@ -408,16 +408,16 @@ namespace BPASmartClient.MorkTHQ | |||||
DeviceProcessLogShow($"开始制作 [咖啡] 订单[{orderLoc.SortNum}]"); | DeviceProcessLogShow($"开始制作 [咖啡] 订单[{orderLoc.SortNum}]"); | ||||
GetAndCheeckCoffe(orderLoc);//取咖啡杯 | GetAndCheeckCoffe(orderLoc);//取咖啡杯 | ||||
if (!morkT.GetCoffeeCup) return; | 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(); | Wait(); | ||||
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | 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}!"); | DeviceProcessLogShow($"发送咖啡机制作{orderLoc.Loc}!"); | ||||
morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc; | morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -461,13 +461,13 @@ namespace BPASmartClient.MorkTHQ | |||||
/// <param name="order"></param> | /// <param name="order"></param> | ||||
private void GetAndCheeckCoffe(OrderLocInfo order) | 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); | OrderChange(order.SuborderId, ORDER_STATUS.COOKING); | ||||
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10031 }); //SENCE_取咖啡杯 | EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10031 }); //SENCE_取咖啡杯 | ||||
Wait(); | Wait(); | ||||
Thread.Sleep(500); | 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) => { }); | ||||
morkT.GetCoffeeCup = true; | morkT.GetCoffeeCup = true; | ||||
DeviceProcessLogShow("取咖啡杯完成"); | DeviceProcessLogShow("取咖啡杯完成"); | ||||
} | } | ||||
@@ -535,7 +535,7 @@ namespace BPASmartClient.MorkTHQ | |||||
//CheckICeCreaCup(); | //CheckICeCreaCup(); | ||||
GetIceCream(order); | GetIceCream(order); | ||||
PutIceCream(order); | PutIceCream(order); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -564,19 +564,19 @@ namespace BPASmartClient.MorkTHQ | |||||
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10034 }); //SENCE_冰淇淋杯检测 | EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10034 }); //SENCE_冰淇淋杯检测 | ||||
Wait(); | Wait(); | ||||
Thread.Sleep(500); | 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) | if (o != null && o.Length > 0 && o[0] is SignalResult res) | ||||
{ | { | ||||
MessageLog.GetInstance.Show(res.ToString()); | MessageLog.GetInstance.Show(res.ToString()); | ||||
} | } | ||||
}); | }); | ||||
while((int)peripheralStatus["RobotValue"] != 0) | |||||
while ((int)peripheralStatus["RobotValue"] != 0) | |||||
{ | { | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
} | } | ||||
MessageLog.GetInstance.Show($"乐白机器人信号值{peripheralStatus["RobotValue"].ToString()}"); | MessageLog.GetInstance.Show($"乐白机器人信号值{peripheralStatus["RobotValue"].ToString()}"); | ||||
//while ((ELebaiRModel)peripheralStatus["RobotMode"] !=ELebaiRModel.空闲状态) | //while ((ELebaiRModel)peripheralStatus["RobotMode"] !=ELebaiRModel.空闲状态) | ||||
//{ | //{ | ||||
// EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); | // EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); | ||||
@@ -598,7 +598,7 @@ namespace BPASmartClient.MorkTHQ | |||||
DeviceProcessLogShow($"执行{count}次取冰淇淋杯,仍未成功,订单默认废弃,机器人回到初始位置!"); | DeviceProcessLogShow($"执行{count}次取冰淇淋杯,仍未成功,订单默认废弃,机器人回到初始位置!"); | ||||
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10049 }); //SENCE_冰淇淋杯回原点 | EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10049 }); //SENCE_冰淇淋杯回原点 | ||||
Wait(); | 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; | morkT.GetIceCreamCup = false; | ||||
return; | return; | ||||
} | } | ||||
@@ -637,7 +637,7 @@ namespace BPASmartClient.MorkTHQ | |||||
//DeviceProcessLogShow("开始等待6s"); | //DeviceProcessLogShow("开始等待6s"); | ||||
//Thread.Sleep(5000); | //Thread.Sleep(5000); | ||||
// 出料 | |||||
// 出料 | |||||
EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId }, (o) => | EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId }, (o) => | ||||
{ | { | ||||
doItResult = (bool)o[0]; | doItResult = (bool)o[0]; | ||||
@@ -680,7 +680,7 @@ namespace BPASmartClient.MorkTHQ | |||||
}); | }); | ||||
Thread.Sleep(500); | Thread.Sleep(500); | ||||
} | } | ||||
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10056 }); //SENCE_放冰淇淋位置 | EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10056 }); //SENCE_放冰淇淋位置 | ||||
Wait(); | Wait(); | ||||
EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
@@ -700,7 +700,7 @@ namespace BPASmartClient.MorkTHQ | |||||
bool result = false; | bool result = false; | ||||
int retry = 3; | int retry = 3; | ||||
DateTime beginTime = DateTime.Now; | DateTime beginTime = DateTime.Now; | ||||
while (!result) | while (!result) | ||||
{ | { | ||||
EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) => | 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) | if (DateTime.Now.Subtract(beginTime).TotalSeconds > 5) | ||||
{ | { | ||||
DeviceProcessLogShow("超时未出料,重新发送打料指令"); | 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; | beginTime = DateTime.Now; | ||||
retry--; | retry--; | ||||
} | } | ||||
@@ -736,7 +736,7 @@ namespace BPASmartClient.MorkTHQ | |||||
/// </summary> | /// </summary> | ||||
private void MakeJuiceProcess() | 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); | OrderChange(order.SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | ||||
EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 11111 });//SENCE_取果汁杯位置 | EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 11111 });//SENCE_取果汁杯位置 | ||||
@@ -840,9 +840,9 @@ namespace BPASmartClient.MorkTHQ | |||||
MessageLog.GetInstance.Show("果汁制作完成"); | MessageLog.GetInstance.Show("果汁制作完成"); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
private T GetDeviceStatus<T>(string key) | private T GetDeviceStatus<T>(string key) | ||||
@@ -859,7 +859,7 @@ namespace BPASmartClient.MorkTHQ | |||||
#endregion | #endregion | ||||
public override void SimOrder() | public override void SimOrder() | ||||
{ | { | ||||
} | } | ||||
} | } | ||||
} | } |
@@ -16,7 +16,7 @@ using BPASmartClient.Model; | |||||
using BPASmartClient.Model.PLC; | using BPASmartClient.Model.PLC; | ||||
using BPASmartClient.Model.单片机; | using BPASmartClient.Model.单片机; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.MorktJAKAJC | namespace BPASmartClient.MorktJAKAJC | ||||
{ | { | ||||
@@ -252,7 +252,7 @@ namespace BPASmartClient.MorktJAKAJC | |||||
return batchings[batchingLoc].GoodsType; | return batchings[batchingLoc].GoodsType; | ||||
return GOODS_TYPE.NEITHER; | return GOODS_TYPE.NEITHER; | ||||
} | } | ||||
private AutoResetEvent are = new AutoResetEvent(false); | private AutoResetEvent are = new AutoResetEvent(false); | ||||
private T GetStatus<T>(string key) | private T GetStatus<T>(string key) | ||||
@@ -731,7 +731,7 @@ namespace BPASmartClient.MorktJAKAJC | |||||
Wait(0); | Wait(0); | ||||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | ||||
Wait(int.Parse(JakaModel.SENCE_初始位)); | 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); | Thread.Sleep(100); | ||||
new WriteJaka() { TagName = "Set_RobotAO1", Value = 0 }.Publish(); | new WriteJaka() { TagName = "Set_RobotAO1", Value = 0 }.Publish(); | ||||
Wait(0); | Wait(0); | ||||
@@ -739,7 +739,7 @@ namespace BPASmartClient.MorktJAKAJC | |||||
Wait(int.Parse(JakaModel.SENCE_取杯位检测_取杯位)); | Wait(int.Parse(JakaModel.SENCE_取杯位检测_取杯位)); | ||||
//取杯到位,使用落杯器 | //取杯到位,使用落杯器 | ||||
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 1, Value = true }.Publish(); | 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(); | new WriteJaka() { TagName = "JakaDOutput", DO_Index = 1, Value = false }.Publish(); | ||||
Thread.Sleep(2000); | Thread.Sleep(2000); | ||||
@@ -788,7 +788,7 @@ namespace BPASmartClient.MorktJAKAJC | |||||
} | } | ||||
} | } | ||||
} | } | ||||
return 1; | return 1; | ||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
@@ -899,8 +899,8 @@ namespace BPASmartClient.MorktJAKAJC | |||||
if (num == 0) | if (num == 0) | ||||
{ | { | ||||
bSensorInput = GetStatus<bool>("Get_RobotDI0") ? 1 : 2; | bSensorInput = GetStatus<bool>("Get_RobotDI0") ? 1 : 2; | ||||
} | |||||
else if (num == 1) | |||||
} | |||||
else if (num == 1) | |||||
{ | { | ||||
bSensorInput = GetStatus<bool>("Get_RobotDI1") ? 1 : 2; | bSensorInput = GetStatus<bool>("Get_RobotDI1") ? 1 : 2; | ||||
} | } | ||||
@@ -945,11 +945,11 @@ namespace BPASmartClient.MorktJAKAJC | |||||
public void SimOrder<T>(T simOrder) | public void SimOrder<T>(T simOrder) | ||||
{ | { | ||||
} | } | ||||
public override void Stop() | public override void Stop() | ||||
{ | { | ||||
@@ -957,7 +957,7 @@ namespace BPASmartClient.MorktJAKAJC | |||||
public override void ReadData() | public override void ReadData() | ||||
{ | { | ||||
} | } | ||||
@@ -96,7 +96,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||||
if (!string.IsNullOrEmpty(DataSouceInformation)) | if (!string.IsNullOrEmpty(DataSouceInformation)) | ||||
{ | { | ||||
Direction = 1; | Direction = 1; | ||||
FDataSouce = HttpRequestHelper.HttpPostRequest(DataSouceInformation,InterfaceParameters); | |||||
FDataSouce = APIHelper.GetInstance.HttpRequest(DataSouceInformation,InterfaceParameters); | |||||
} | } | ||||
break; | break; | ||||
@@ -105,7 +105,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||||
{ | { | ||||
Direction = 1; | Direction = 1; | ||||
string returndata=string.Empty; | 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); | Dictionary<string, object> obj = JsonConvert.DeserializeObject<Dictionary<string, object>>(obj_data); | ||||
if (obj.ContainsKey("data")) | if (obj.ContainsKey("data")) | ||||
{ | { | ||||
@@ -132,7 +132,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||||
if (!string.IsNullOrEmpty(DataSouceInformation)) | if (!string.IsNullOrEmpty(DataSouceInformation)) | ||||
{ | { | ||||
Direction = 1; | Direction = 1; | ||||
//string data = HttpRequestHelper.HttpPostRequest(DataSouceInformation,InterfaceParameters); | |||||
//string data = APIHelper.GetInstance.HttpRequest(DataSouceInformation,InterfaceParameters); | |||||
} | } | ||||
break; | break; | ||||
default: | default: | ||||
@@ -293,7 +293,7 @@ namespace BPASmartClient.ScreenLib | |||||
try | try | ||||
{ | { | ||||
string SaasRoute = System.Configuration.ConfigurationManager.AppSettings["SaasRoute"].ToString(); | string SaasRoute = System.Configuration.ConfigurationManager.AppSettings["SaasRoute"].ToString(); | ||||
string res = HttpRequestHelper.HttpGetRequest(SaasRoute); | |||||
string res = APIHelper.GetInstance.GetRequest(SaasRoute); | |||||
if (!string.IsNullOrEmpty(res)) | if (!string.IsNullOrEmpty(res)) | ||||
{ | { | ||||
HttpReturn httpReturn= JsonConvert.DeserializeObject<HttpReturn>(res); | HttpReturn httpReturn= JsonConvert.DeserializeObject<HttpReturn>(res); | ||||
@@ -6,7 +6,7 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="BPA.Helper" Version="1.0.66" /> | <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> | </ItemGroup> | ||||
</Project> | </Project> |
@@ -3,13 +3,12 @@ using System.Collections.Generic; | |||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Windows; | using System.Windows; | ||||
using System.Threading; | using System.Threading; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Device; | using BPASmartClient.Device; | ||||
using BPA.Helper; | |||||
using BPASmartClient.Business; | using BPASmartClient.Business; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
@@ -27,7 +26,7 @@ namespace BPASmartClient.ViewModel | |||||
} | } | ||||
if (ControlButText == "开始查询") | 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(); | var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList(); | ||||
if (res != null) | if (res != null) | ||||
{ | { | ||||
@@ -90,7 +89,7 @@ namespace BPASmartClient.ViewModel | |||||
private void GetHistoryAlarm() | private void GetHistoryAlarm() | ||||
{ | { | ||||
var data = Sqlite<Alarm>.GetInstance.GetData(); | |||||
var data = Sqlite<BPASmartClient.Model.Alarm>.GetInstance.GetData(); | |||||
if (data != null) | if (data != null) | ||||
{ | { | ||||
HistoryAlarm.Clear(); | HistoryAlarm.Clear(); | ||||
@@ -150,9 +149,9 @@ namespace BPASmartClient.ViewModel | |||||
private DateTime _mEndDateTime = DateTime.Now; | 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(); | |||||
} | } | ||||
} | } |
@@ -3,7 +3,6 @@ using BPASmartClient.Business; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.IoT; | using BPASmartClient.IoT; | ||||
using DataVAPI.Tool.IOT; | using DataVAPI.Tool.IOT; | ||||
using BPA.Helper; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -99,7 +98,7 @@ namespace BPASmartClient.ViewModel | |||||
{ | { | ||||
string url = ApiURL + "/api/Device/Query"; | string url = ApiURL + "/api/Device/Query"; | ||||
if (!string.IsNullOrEmpty(clientId)) url = ApiURL + "/api/Device/Query?clientId=" + clientId; | 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); | JsonMsg<List<DeviceTable>> jsonMsg = Tools.JsonToObjectTools<JsonMsg<List<DeviceTable>>>(json); | ||||
return jsonMsg.obj.data; | return jsonMsg.obj.data; | ||||
} | } | ||||
@@ -119,7 +118,7 @@ namespace BPASmartClient.ViewModel | |||||
try | try | ||||
{ | { | ||||
string url = ApiURL + "/api/Device/Modify"; | string url = ApiURL + "/api/Device/Modify"; | ||||
string json = HttpRequestHelper.HttpPostRequest(url, Tools.JsonConvertTools(device)); | |||||
string json = APIHelper.GetInstance.HttpRequest(url, device); | |||||
Refresh(); | Refresh(); | ||||
return true; | return true; | ||||
} | } | ||||
@@ -139,7 +138,7 @@ namespace BPASmartClient.ViewModel | |||||
try | try | ||||
{ | { | ||||
string url = ApiURL + "/api/Device/Create"; | string url = ApiURL + "/api/Device/Create"; | ||||
string json = HttpRequestHelper.HttpPostRequest(url, Tools.JsonConvertTools(device)); | |||||
string json = APIHelper.GetInstance.HttpRequest(url, device); | |||||
Refresh(); | Refresh(); | ||||
return true; | return true; | ||||
} | } | ||||
@@ -155,7 +154,7 @@ namespace BPASmartClient.ViewModel | |||||
try | try | ||||
{ | { | ||||
string url = ApiURL + "/api/Device/Create"; | string url = ApiURL + "/api/Device/Create"; | ||||
string json = HttpRequestHelper.HttpPostRequest(url, Tools.JsonConvertTools(deviceTable)); | |||||
string json = APIHelper.GetInstance.HttpRequest(url, Tools.JsonConvertTools(deviceTable)); | |||||
Refresh(); | Refresh(); | ||||
return true; | return true; | ||||
} | } | ||||
@@ -175,7 +174,7 @@ namespace BPASmartClient.ViewModel | |||||
try | try | ||||
{ | { | ||||
string url = ApiURL + "/api/Device/DeleteDate?id=" + device.Id; | string url = ApiURL + "/api/Device/DeleteDate?id=" + device.Id; | ||||
string json = HttpRequestHelper.HttpGetRequest(url); | |||||
string json = APIHelper.GetInstance.GetRequest(url); | |||||
Refresh(); | Refresh(); | ||||
return true; | return true; | ||||
} | } | ||||
@@ -5,7 +5,7 @@ using BPA.Helper; | |||||
using BPASmartClient.IoT; | using BPASmartClient.IoT; | ||||
using DataVAPI.Tool.IOT; | using DataVAPI.Tool.IOT; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -70,7 +70,7 @@ namespace BPASmartClient.ViewModel | |||||
{ | { | ||||
LogDataFile.Clear(); | LogDataFile.Clear(); | ||||
api = $"{DataVApiAddress}/api/Log/QueryLogFile?DeviceName={DataVClient.GetInstance().DeviceDataV.deviceTable.devicename}"; ; | 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<List<FileModel>> jsonMsg = Tools.JsonToObjectTools<JsonMsg<List<FileModel>>>(json); | ||||
jsonMsg.obj?.data?.ForEach(file => | jsonMsg.obj?.data?.ForEach(file => | ||||
{ | { | ||||
@@ -4,9 +4,6 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | |||||
using Microsoft.Toolkit.Mvvm.Messaging; | |||||
using System.Windows; | using System.Windows; | ||||
using System.IO; | using System.IO; | ||||
@@ -6,9 +6,6 @@ using BPA.Message; | |||||
using BPA.Message.Enum; | using BPA.Message.Enum; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPA.Helper; | |||||
using Microsoft.Toolkit.Mvvm.Messaging; | |||||
namespace BPASmartClient.ViewModel | namespace BPASmartClient.ViewModel | ||||
{ | { | ||||
@@ -27,11 +24,11 @@ namespace BPASmartClient.ViewModel | |||||
ConfirmButton(); | ConfirmButton(); | ||||
if (Json<KeepDataBase>.Data.orderLists.Count > 0) | 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(() => | ThreadManage.GetInstance().Start(new Action(() => | ||||
{ | { | ||||
Thread.Sleep(10000); | 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(() => | CloseCommand = new BPARelayCommand(() => | ||||
{ | { | ||||
Json<KeepDataBase>.Data.orderLists.Clear(); | Json<KeepDataBase>.Data.orderLists.Clear(); | ||||
WeakReferenceMessenger.Default.Send("false", "Close"); | |||||
ActionManage.GetInstance.Send("Close", false); | |||||
Json<KeepDataBase>.Save(); | Json<KeepDataBase>.Save(); | ||||
}); | }); | ||||
} | } | ||||
@@ -57,7 +54,7 @@ namespace BPASmartClient.ViewModel | |||||
CancelCommand = new BPARelayCommand(() => | CancelCommand = new BPARelayCommand(() => | ||||
{ | { | ||||
Json<KeepDataBase>.Data.orderLists.Clear(); | Json<KeepDataBase>.Data.orderLists.Clear(); | ||||
WeakReferenceMessenger.Default.Send("false", "Close"); | |||||
ActionManage.GetInstance.Send("Close", false); | |||||
Json<KeepDataBase>.Save(); | Json<KeepDataBase>.Save(); | ||||
}); | }); | ||||
} | } | ||||
@@ -89,17 +86,17 @@ namespace BPASmartClient.ViewModel | |||||
IsAllSelect = item.IsAllSelect, | IsAllSelect = item.IsAllSelect, | ||||
morkOrderPushes = morkOrders, | 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,7 +5,7 @@ using System.Text; | |||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.ComponentModel; | using System.ComponentModel; | ||||
using System.Runtime.CompilerServices; | 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)); | 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) | private void NewCommunication(object? obj) | ||||
@@ -111,7 +111,7 @@ namespace BPASmartClient.ViewModel | |||||
CommunicationName = $"Communication_{num}", | CommunicationName = $"Communication_{num}", | ||||
DeviceModelId = deviceConfig.ElementAt(0).deviceModels.FirstOrDefault(p => p.DeviceName == dm.DeviceName)?.Id, | DeviceModelId = deviceConfig.ElementAt(0).deviceModels.FirstOrDefault(p => p.DeviceName == dm.DeviceName)?.Id, | ||||
communicationPar = new CommunicationPar() { IsNetworkPort = false }, | communicationPar = new CommunicationPar() { IsNetworkPort = false }, | ||||
}); | }); | ||||
break; | break; | ||||
@@ -250,7 +250,7 @@ namespace BPASmartClient.ViewModel | |||||
}); | }); | ||||
Shops.Clear(); | Shops.Clear(); | ||||
DirectoryInfo directoryInfo = new DirectoryInfo(LocaPath.GetInstance().GetDeviceConfigPath); | |||||
DirectoryInfo directoryInfo = new DirectoryInfo(LocaPath.GetDeviceConfigPath); | |||||
var files = directoryInfo.GetFiles(); | var files = directoryInfo.GetFiles(); | ||||
foreach (var item in files) | foreach (var item in files) | ||||
{ | { | ||||
@@ -35,51 +35,83 @@ | |||||
<RowDefinition Height="8*" /> | <RowDefinition Height="8*" /> | ||||
<RowDefinition Height="20*" /> | <RowDefinition Height="20*" /> | ||||
</Grid.RowDefinitions> | </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 | <uc:UserKeyBoard | ||||
x:Name="myKeyboard" | x:Name="myKeyboard" | ||||
@@ -11,6 +11,7 @@ using System.Windows.Input; | |||||
using System.Windows.Media; | using System.Windows.Media; | ||||
using System.Windows.Media.Imaging; | using System.Windows.Media.Imaging; | ||||
using System.Windows.Shapes; | using System.Windows.Shapes; | ||||
using BPA.Helper; | |||||
using BPASmartClient.ViewModel; | using BPASmartClient.ViewModel; | ||||
using Microsoft.Toolkit.Mvvm.Messaging; | using Microsoft.Toolkit.Mvvm.Messaging; | ||||
@@ -29,14 +30,18 @@ namespace BPASmartClient | |||||
this.DragMove(); | 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; | int MoveCount = 0; | ||||
private void Window_MouseMove(object sender, MouseEventArgs e) | private void Window_MouseMove(object sender, MouseEventArgs e) | ||||
@@ -58,7 +58,7 @@ namespace BPASmartClient.DosingSystem | |||||
Environment.Exit(0); | Environment.Exit(0); | ||||
} | } | ||||
base.OnStartup(e); | base.OnStartup(e); | ||||
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut(); | |||||
SystemHelper.GetInstance.CreateDesktopShortcut(); | |||||
MenuInit(); | MenuInit(); | ||||
DataInit(); | DataInit(); | ||||
//SiemensTest.GetInstance.Init(); | //SiemensTest.GetInstance.Init(); | ||||
@@ -12,11 +12,11 @@ namespace BPASmartClient.DosingSystem | |||||
public class ViewModelBase : NotifyBase | public class ViewModelBase : NotifyBase | ||||
{ | { | ||||
public int Index { get; set; } = -1; | 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> | /// <summary> | ||||
/// 错误信息 | /// 错误信息 | ||||
@@ -17,8 +17,8 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
if (o != null && o is string str) IpAddress = str; | if (o != null && o is string str) IpAddress = str; | ||||
}), "ChangeDeviceNameViewOpen"); | }), "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)) | if (string.IsNullOrEmpty(DeviceName)) | ||||
{ | { | ||||
@@ -14,7 +14,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
{ | { | ||||
public CommparSetViewModel() | public CommparSetViewModel() | ||||
{ | { | ||||
SaveCommand = new BPABPARelayCommand(() => | |||||
SaveCommand = new BPARelayCommand(() => | |||||
{ | { | ||||
if (!string.IsNullOrEmpty(CommBaseParModel.NetworkSegAddress)) | 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(); } } | public BasePar CommBaseParModel { get { return Json<DevicePar>.Data.BaseParModel; } set { Json<DevicePar>.Data.BaseParModel = value; OnPropertyChanged(); } } | ||||
//private BasePar _mCommBaseParModel; | //private BasePar _mCommBaseParModel; | ||||
public BPABPARelayCommand SaveCommand { get; set; } | |||||
public BPARelayCommand SaveCommand { get; set; } | |||||
} | } | ||||
} | } |
@@ -16,7 +16,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
{ | { | ||||
public DeviceListViewModel() | public DeviceListViewModel() | ||||
{ | { | ||||
DetailsCommand = new BPABPARelayCommand<object>((o) => | |||||
DetailsCommand = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
if (o != null && o is string str) | if (o != null && o is string str) | ||||
{ | { | ||||
@@ -28,7 +28,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
devices = DeviceInquire.GetInstance.devices; | 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 static ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>(); | ||||
public ObservableCollection<Devices> devices { get; set; } | public ObservableCollection<Devices> devices { get; set; } | ||||
@@ -16,15 +16,15 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
public DeviceMaterialParViewModel() | public DeviceMaterialParViewModel() | ||||
{ | { | ||||
deviceParModels = Json<DevicePar>.Data.deviceParModels; | deviceParModels = Json<DevicePar>.Data.deviceParModels; | ||||
RemoveCommand = new BPABPARelayCommand<object>((o) => | |||||
RemoveCommand = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
var res = deviceParModels.FirstOrDefault(p => p.MaterialName == o?.ToString()); | var res = deviceParModels.FirstOrDefault(p => p.MaterialName == o?.ToString()); | ||||
if (res != null) deviceParModels.Remove(res); | if (res != null) deviceParModels.Remove(res); | ||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{o.ToString()}:原料删除成功!"); | 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) | if (deviceParModels == null || deviceParModels.Count <= 0) | ||||
{ | { | ||||
@@ -57,10 +57,10 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
public ObservableCollection<DeviceParModel> deviceParModels { get; set; } | 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; } | |||||
} | } | ||||
} | } |
@@ -23,7 +23,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
// ConveyerBeltModels.Add(new ConveyerBeltModel() { Name = $"输送带{i}", Num = i++ }); | // 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) | // if (o != null && o is int tempCount) | ||||
// { | // { | ||||
@@ -62,7 +62,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
}), "输送带料仓状态监控",true); | }), "输送带料仓状态监控",true); | ||||
RecipeControlCommand = new BPABPARelayCommand<object>((o) => | |||||
RecipeControlCommand = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
if (o != null && o is DeviceCurrentStatus currentStatus) | 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 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> | /// <summary> | ||||
/// 输送带状态 | /// 输送带状态 | ||||
@@ -51,7 +51,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
OtherHandCylinders.Add(new CylinderModel() { Name = "上桶工位气缸" }); | OtherHandCylinders.Add(new CylinderModel() { Name = "上桶工位气缸" }); | ||||
OtherHandCylinders.Add(new CylinderModel() { Name = "下桶工位气缸" }); | OtherHandCylinders.Add(new CylinderModel() { Name = "下桶工位气缸" }); | ||||
Open = new BPABPARelayCommand<object>((o) => | |||||
Open = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
if (o != null) | if (o != null) | ||||
{ | { | ||||
@@ -76,7 +76,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
}); | }); | ||||
Close = new BPABPARelayCommand<object>((o) => | |||||
Close = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
if (o != null) | 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); | SiemensDevice.GetInstance.MySiemens.Write("M10.0", SystemControlText == "停止" ? false : true); | ||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.0"); | var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.0"); | ||||
SystemControlText = res ? "停止" : "启动"; | SystemControlText = res ? "停止" : "启动"; | ||||
}); | }); | ||||
ModelSwitch = new BPABPARelayCommand(() => | |||||
ModelSwitch = new BPARelayCommand(() => | |||||
{ | { | ||||
SiemensDevice.GetInstance.MySiemens.Write("M10.1", ModelSwitchText == "手动" ? true : false); | SiemensDevice.GetInstance.MySiemens.Write("M10.1", ModelSwitchText == "手动" ? true : false); | ||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
@@ -170,12 +170,12 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
/// </summary> | /// </summary> | ||||
public ObservableCollection<CylinderModel> OtherHandCylinders { get; set; } = new ObservableCollection<CylinderModel>(); | 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(); } } | public string SystemControlText { get { return _mSystemControlText; } set { _mSystemControlText = value; OnPropertyChanged(); } } | ||||
@@ -22,9 +22,9 @@ public class NewMaterialViewModel : ViewModelBase | |||||
//public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | //public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | ||||
//private string _mErrorInfo; | //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() | 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 (MaterialName == String.Empty) { ErrorInfo = "原料名称不能为空"; return; } | ||||
if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == MaterialName) != null) { ErrorInfo = "设备中已存在该原料名称"; return; } | if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == MaterialName) != null) { ErrorInfo = "设备中已存在该原料名称"; return; } | ||||
@@ -29,9 +29,9 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
Index = Array.FindIndex(Json<DevicePar>.Data.OutletInfoModels.ToArray(), p => p.OutletName == tempOutletInfo.OutletName); | Index = Array.FindIndex(Json<DevicePar>.Data.OutletInfoModels.ToArray(), p => p.OutletName == tempOutletInfo.OutletName); | ||||
} | } | ||||
}), "OpenNewOutlet", true); | }), "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>(); | ObservableCollection<string> SileNames = new ObservableCollection<string>(); | ||||
SiloInfos.ToList()?.ForEach(item => { SileNames.Add(item.RawMaterialName); }); | SiloInfos.ToList()?.ForEach(item => { SileNames.Add(item.RawMaterialName); }); | ||||
@@ -82,7 +82,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
} | } | ||||
ActionManage.GetInstance.Send("NewOutletViewClose"); | ActionManage.GetInstance.Send("NewOutletViewClose"); | ||||
}); | }); | ||||
RemoveCommand = new BPABPARelayCommand<object>((o) => | |||||
RemoveCommand = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
if (!string.IsNullOrEmpty(o?.ToString())) | if (!string.IsNullOrEmpty(o?.ToString())) | ||||
{ | { | ||||
@@ -41,7 +41,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
} | } | ||||
}), "Details", true); | }), "Details", true); | ||||
AddCommand = new BPABPARelayCommand(() => | |||||
AddCommand = new BPARelayCommand(() => | |||||
{ | { | ||||
if (RawMaterials.Count >= DeviceInquire.GetInstance.devices.Count) | if (RawMaterials.Count >= DeviceInquire.GetInstance.devices.Count) | ||||
{ | { | ||||
@@ -62,7 +62,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
else goto p; | else goto p; | ||||
}); | }); | ||||
RemoveCommand = new BPABPARelayCommand<object>((obj) => | |||||
RemoveCommand = new BPARelayCommand<object>((obj) => | |||||
{ | { | ||||
if (obj is string rm) | 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; } | if (string.IsNullOrEmpty(RecipeName)) { MessageNotify.GetInstance.ShowDialog("请输入配方名称!", DialogType.Warning); ErrorInfo = "请输入配方名称"; return; } | ||||
var tempRes = RawMaterials.GroupBy(p => p.RawMaterialName); | 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(); } } | //public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | ||||
//private string _mErrorInfo; | //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>(); | public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>(); | ||||
@@ -14,14 +14,14 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
{ | { | ||||
public OutletManagementViewModel() | public OutletManagementViewModel() | ||||
{ | { | ||||
AddCommand = new BPABPARelayCommand(() => | |||||
AddCommand = new BPARelayCommand(() => | |||||
{ | { | ||||
NewOutletView newOutletView = new NewOutletView(); | NewOutletView newOutletView = new NewOutletView(); | ||||
newOutletView.ShowDialog(); | newOutletView.ShowDialog(); | ||||
}); | }); | ||||
SaveCommand = new BPABPARelayCommand(() => { Json<DevicePar>.Save(); }); | |||||
SaveCommand = new BPARelayCommand(() => { Json<DevicePar>.Save(); }); | |||||
OutletInfoModels = Json<DevicePar>.Data.OutletInfoModels; | OutletInfoModels = Json<DevicePar>.Data.OutletInfoModels; | ||||
RemoveCommand = new BPABPARelayCommand<object>((o) => | |||||
RemoveCommand = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
if (!string.IsNullOrEmpty(o?.ToString())) | 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())) | if (!string.IsNullOrEmpty(o?.ToString())) | ||||
{ | { | ||||
@@ -25,9 +25,9 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
static ObservableCollection<StockStatusModel> StockStatus = new ObservableCollection<StockStatusModel>(); | static ObservableCollection<StockStatusModel> StockStatus = new ObservableCollection<StockStatusModel>(); | ||||
public RecipeControlViewModel() | 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(); | RecipeRun(); | ||||
RecipeStatusInquire(); | RecipeStatusInquire(); | ||||
} | } | ||||
@@ -666,11 +666,11 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
}), "RecipeControlViewModelStatusInquire",true); | }), "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; | public static ObservableCollection<RecipeModel> Recipes { get; set; } = Json<LocalRecipe>.Data.Recipes; | ||||
@@ -26,24 +26,24 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
{ | { | ||||
Recipes = Json<LocalRecipe>.Data.Recipes; | Recipes = Json<LocalRecipe>.Data.Recipes; | ||||
NewMaterital = new BPABPARelayCommand(() => | |||||
NewMaterital = new BPARelayCommand(() => | |||||
{ | { | ||||
NewMaterialView newMateritalView = new NewMaterialView(); | NewMaterialView newMateritalView = new NewMaterialView(); | ||||
newMateritalView.ShowDialog(); | newMateritalView.ShowDialog(); | ||||
}); | }); | ||||
NewRecipe = new BPABPARelayCommand(() => | |||||
NewRecipe = new BPARelayCommand(() => | |||||
{ | { | ||||
NewRecipeView nrv = new NewRecipeView(); | NewRecipeView nrv = new NewRecipeView(); | ||||
nrv.ShowDialog(); | nrv.ShowDialog(); | ||||
MessageNotify.GetInstance.ShowUserLog("新建配方"); | MessageNotify.GetInstance.ShowUserLog("新建配方"); | ||||
}); | }); | ||||
SaveRecipe = new BPABPARelayCommand(() => | |||||
SaveRecipe = new BPARelayCommand(() => | |||||
{ | { | ||||
Json<LocalRecipe>.Save(); | Json<LocalRecipe>.Save(); | ||||
MessageNotify.GetInstance.ShowUserLog("保存配方"); | MessageNotify.GetInstance.ShowUserLog("保存配方"); | ||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!"); | NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!"); | ||||
}); | }); | ||||
RemoveCommand = new BPABPARelayCommand<object>((o) => | |||||
RemoveCommand = new BPARelayCommand<object>((o) => | |||||
{ | { | ||||
if (!string.IsNullOrEmpty(o?.ToString())) | 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())) | 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; } | public ObservableCollection<RecipeModel> Recipes { get; set; } | ||||
} | } | ||||
@@ -1,6 +1,6 @@ | |||||
using BPASmartClient.AGV.Feedback; | using BPASmartClient.AGV.Feedback; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Http; | |||||
using BPASmartClient.HubHelper; | using BPASmartClient.HubHelper; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using BPASmartClient.S7Net; | using BPASmartClient.S7Net; | ||||