@@ -30,6 +30,8 @@ namespace BPASmartClient.Business | |||
public UriConfig uriConfig { get; set; } | |||
public ObservableCollection<DeviceConfigModelJson> deviceConfigModelJsons { get; set; } | |||
//Apollo地址 | |||
private string apolloUri; | |||
private string apoid; | |||
@@ -42,12 +44,21 @@ namespace BPASmartClient.Business | |||
public void Initialize() | |||
{ | |||
ClientId = int.Parse(System.Configuration.ConfigurationManager.AppSettings["ClientId"]); | |||
var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig"); | |||
string path = $"{LocaPath.GetInstance().GetDeviceConfigPath}{text}.json"; | |||
if (File.Exists(path)) | |||
{ | |||
string JsonString = File.ReadAllText(path); | |||
deviceConfigModelJsons = JsonConvert.DeserializeObject<ObservableCollection<DeviceConfigModelJson>>(JsonString); | |||
} | |||
if (deviceConfigModelJsons?.Count > 0) | |||
{ | |||
ClientId = int.Parse(deviceConfigModelJsons.ElementAt(0).ShopId); | |||
} | |||
//ClientId = int.Parse(System.Configuration.ConfigurationManager.AppSettings["ClientId"]); | |||
apolloUri = System.Configuration.ConfigurationManager.AppSettings["ApolloUri"].ToString(); | |||
apoid = System.Configuration.ConfigurationManager.AppSettings["AppId"].ToString(); | |||
namespa = System.Configuration.ConfigurationManager.AppSettings["Namespaces"].ToString(); | |||
//InternetInfo.OrderServer = System.Configuration.ConfigurationManager.AppSettings["OrderServiceUri"].ToString(); | |||
//InternetInfo.StockServer = System.Configuration.ConfigurationManager.AppSettings["StockServiceUri"].ToString(); | |||
InternetInfo.IsEnableTest = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["IsEnableTest"].ToString()); | |||
InitDeviceModel(); | |||
InitConfig(); | |||
@@ -65,92 +76,8 @@ namespace BPASmartClient.Business | |||
/// </summary> | |||
private void InitDeviceModel() | |||
{ | |||
//var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig"); | |||
//string path = $"{LocaPath.GetInstance().GetDeviceConfigPath}{text}.json"; | |||
//deviceConfigs = new List<DeviceConfig>(); | |||
//if (File.Exists(path)) | |||
//{ | |||
// string JsonString = File.ReadAllText(path); | |||
// var result = JsonConvert.DeserializeObject<ObservableCollection<DeviceConfigModelJson>>(JsonString); | |||
// if (result != null) | |||
// { | |||
// foreach (var shop in result) | |||
// { | |||
// foreach (var device in shop.deviceModels) | |||
// { | |||
// DeviceConfig deviceConfig = new DeviceConfig(); | |||
// deviceConfig.Name = device.DeviceName; | |||
// deviceConfig.Module = device.DeviceNamespace; | |||
// deviceConfig.DeviceId = int.Parse(device.DeviceId); | |||
// foreach (var comms in device.communicationDevcies) | |||
// { | |||
// BPASmartClient.Model.Peripheral peripheral = new BPASmartClient.Model.Peripheral(); | |||
// peripheral.Module = comms.CommunicationNamespace; | |||
// } | |||
// deviceConfigs.Add(deviceConfig); | |||
// } | |||
// } | |||
// } | |||
//} | |||
//deviceConfigs = new List<DeviceConfig>(); | |||
//var devicePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DeviceInfo.xml"); | |||
//var xdoc = XDocument.Load(devicePath); | |||
//var devices = xdoc.XPathSelectElements("//Device"); | |||
//foreach (var device in devices) | |||
//{ | |||
// DeviceConfig deviceConfig = new DeviceConfig(); | |||
// deviceConfig.Name = device.Attribute("Name").Value; | |||
// deviceConfig.Module = device.Attribute("Module").Value; | |||
// deviceConfig.DeviceId = int.Parse(device.Attribute("DeviceId").Value); | |||
// var Peripherals = device.XPathSelectElements("Peripherals/Peripheral"); | |||
// if (Peripherals != null) | |||
// { | |||
// foreach (var Per in Peripherals) | |||
// { | |||
// BPASmartClient.Model.Peripheral peripheral = new BPASmartClient.Model.Peripheral(); | |||
// peripheral.Module = Per.Attribute("Module").Value; | |||
// var Parameters = Per.Element("Parameters").Elements(); | |||
// if (Parameters != null) | |||
// { | |||
// foreach (var item in Parameters) | |||
// { | |||
// peripheral.Parameters.Add(item.Name.LocalName, item.Value); | |||
// } | |||
// } | |||
// deviceConfig.Peripherals.Add(peripheral); | |||
// } | |||
// } | |||
// deviceConfigs.Add(deviceConfig); | |||
//} | |||
} | |||
/// <summary> | |||
/// 加载MQTT配置 | |||
/// </summary> | |||
//private void InitMQTT() | |||
//{ | |||
// IConfigurationBuilder configurationBuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()); | |||
// configurationBuilder.AddApolloConfiguration(p => | |||
// { | |||
// p.AppId = apoid; | |||
// p.MetaServer = apolloUri; | |||
// p.Namespaces = new List<string>() { namespa }; | |||
// }); | |||
// IConfiguration config = configurationBuilder.Build(); | |||
// var mqttBroker = config.GetSection("BrokerHostSettings"); | |||
// MQTT_Config = mqttBroker.Value.FromJSON<MQTT_Entity>(); | |||
// if (MQTT_Config == null) MessageLog.GetInstance.Show("获取配置数据为空!"); | |||
//} | |||
} | |||
public void InitConfig() | |||
{ | |||
@@ -48,73 +48,41 @@ namespace BPASmartClient.Business | |||
/// </summary> | |||
private void LoadDevice() | |||
{ | |||
#region 启动设备对象 | |||
var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig"); | |||
string path = $"{LocaPath.GetInstance().GetDeviceConfigPath}{text}.json"; | |||
if (File.Exists(path)) | |||
var result = Plugin.GetInstance().GetPlugin<ConfigMgr>()?.deviceConfigModelJsons; | |||
//var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig"); | |||
//string path = $"{LocaPath.GetInstance().GetDeviceConfigPath}{text}.json"; | |||
//if (File.Exists(path)) | |||
//{ | |||
//string JsonString = File.ReadAllText(path); | |||
//var result = JsonConvert.DeserializeObject<ObservableCollection<DeviceConfigModelJson>>(JsonString); | |||
if (result != null) | |||
{ | |||
string JsonString = File.ReadAllText(path); | |||
var result = JsonConvert.DeserializeObject<ObservableCollection<DeviceConfigModelJson>>(JsonString); | |||
if (result != null) | |||
foreach (var shop in result)//店铺集合 | |||
{ | |||
foreach (var shop in result)//店铺集合 | |||
foreach (var device in shop.deviceModels)//设备集合 | |||
{ | |||
foreach (var device in shop.deviceModels)//设备集合 | |||
{ | |||
string Namespace = device.DeviceNamespace.Substring(0, device.DeviceNamespace.LastIndexOf('.')); | |||
var deviceTemp = Assembly.Load(Namespace).CreateInstance(device.DeviceNamespace) as IDevice; | |||
deviceTemp.Name = device?.DeviceName; | |||
deviceTemp.DeviceId = int.Parse(device.DeviceId); | |||
string Namespace = device.DeviceNamespace.Substring(0, device.DeviceNamespace.LastIndexOf('.')); | |||
var deviceTemp = Assembly.Load(Namespace).CreateInstance(device.DeviceNamespace) as IDevice; | |||
deviceTemp.Name = device?.DeviceName; | |||
deviceTemp.DeviceId = int.Parse(device.DeviceId); | |||
//通讯模块 | |||
List<IPeripheral> peripherals = new List<IPeripheral>(); | |||
foreach (var comms in device.communicationDevcies)//通讯集合 | |||
{ | |||
string IPeripheralNamespace = comms.CommunicationNamespace.Substring(0, comms.CommunicationNamespace.LastIndexOf('.')); | |||
var peripheralTemp = Assembly.Load(IPeripheralNamespace).CreateInstance(comms.CommunicationNamespace) as IPeripheral; | |||
peripheralTemp.variables = comms.variables; | |||
peripheralTemp.communicationPar = comms.communicationPar; | |||
peripherals.Add(peripheralTemp); | |||
} | |||
deviceTemp.Initliaze(peripherals); | |||
this.devices.Add(deviceTemp); | |||
//通讯模块 | |||
List<IPeripheral> peripherals = new List<IPeripheral>(); | |||
foreach (var comms in device.communicationDevcies)//通讯集合 | |||
{ | |||
string IPeripheralNamespace = comms.CommunicationNamespace.Substring(0, comms.CommunicationNamespace.LastIndexOf('.')); | |||
var peripheralTemp = Assembly.Load(IPeripheralNamespace).CreateInstance(comms.CommunicationNamespace) as IPeripheral; | |||
peripheralTemp.variables = comms.variables; | |||
peripheralTemp.communicationPar = comms.communicationPar; | |||
peripherals.Add(peripheralTemp); | |||
} | |||
deviceTemp.Initliaze(peripherals); | |||
this.devices.Add(deviceTemp); | |||
} | |||
} | |||
} | |||
#endregion | |||
//var devices = Plugin.GetInstance().GetPlugin<ConfigMgr>().GetDeviceConfigs(); | |||
//foreach (var device in devices) | |||
//{ | |||
// var deviceTemp = Assembly.Load(device.Module.Substring(0, device.Module.LastIndexOf('.'))).CreateInstance(device.Module) as IDevice; | |||
// deviceTemp.Name = device.Name; | |||
// deviceTemp.DeviceId = device.DeviceId; | |||
// foreach (var pars in device.Parameters) | |||
// { | |||
// deviceTemp.GetType().GetProperty(pars.Key).SetValue(deviceTemp, Convert.ChangeType(pars.Value, deviceTemp.GetType().GetProperty(pars.Key).PropertyType)); | |||
// } | |||
// List<IPeripheral> peripherals = new List<IPeripheral>(); | |||
// foreach (var peripheral in device.Peripherals) | |||
// { | |||
// var peripheralTemp = Assembly.Load(peripheral.Module.Substring(0, peripheral.Module.LastIndexOf('.'))).CreateInstance(peripheral.Module) as IPeripheral; | |||
// foreach (var pars in peripheral.Parameters) | |||
// { | |||
// peripheralTemp.GetType().GetProperty(pars.Key).SetValue(peripheralTemp, Convert.ChangeType(pars.Value, peripheralTemp.GetType().GetProperty(pars.Key).PropertyType)); | |||
// } | |||
// peripherals.Add(peripheralTemp); | |||
// } | |||
// deviceTemp.Initliaze(peripherals); | |||
// this.devices.Add(deviceTemp); | |||
//} | |||
} | |||
@@ -145,19 +145,24 @@ namespace BPASmartClient.Business | |||
}; | |||
#region API 订单状态修改 | |||
try | |||
if (orderStatusChange.CookingStatus != ORDER_STATUS.WAIT) | |||
{ | |||
string header = $"[{InternetInfo.OrderServer}/order/robotstatuschange]_[{DateTime.Now.Ticks}]".AESEncrypt(); | |||
string url = $"{InternetInfo.OrderServer}order/robotstatuschange"; | |||
result = APIHelper.GetInstance.HttpRequest(url, header, orderStatusChange, RequestType.POST); | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||
try | |||
{ | |||
string header = $"[{InternetInfo.OrderServer}/order/robotstatuschange]_[{DateTime.Now.Ticks}]".AESEncrypt(); | |||
string url = $"{InternetInfo.OrderServer}order/robotstatuschange"; | |||
result = APIHelper.GetInstance.HttpRequest(url, header, orderStatusChange, RequestType.POST); | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||
} | |||
var res = JsonConvert.DeserializeObject<OrderStatusRsp>(result); | |||
ActionManage.GetInstance.Send("OrderStatusChange", orderStatusChangedEvent); | |||
bool isSuccess = res == null ? false : res.isSuccess; | |||
MessageLog.GetInstance.Show($"订单:{orderStatusChange.SuborderId} 状态:{orderStatusChange.CookingStatus} 执行结果:{isSuccess}"); | |||
//MessageLog.GetInstance.Show(string.Format("订单状态改变,调用API执行结果{0}", res == null ? false : res.isSuccess)); | |||
} | |||
var res = JsonConvert.DeserializeObject<OrderStatusRsp>(result); | |||
ActionManage.GetInstance.Send("OrderStatusChange", orderStatusChangedEvent); | |||
MessageLog.GetInstance.Show(string.Format("订单状态改变,调用API执行结果{0}", res == null ? false : res.isSuccess)); | |||
#endregion | |||
@@ -35,14 +35,15 @@ namespace BPASmartClient.IoT | |||
public DataVClient() | |||
{ | |||
DataVApiAddress = InternetInfo.DataVApiAddress; | |||
ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString(); | |||
//ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString(); | |||
ClientId = Plugin.GetInstance().GetPlugin<ConfigMgr>().ClientId.ToString(); | |||
DeviceName = System.Configuration.ConfigurationManager.AppSettings["DeviceName"].ToString(); | |||
ProductKey = System.Configuration.ConfigurationManager.AppSettings["ProductKey"].ToString(); | |||
DeviceSecret = System.Configuration.ConfigurationManager.AppSettings["DeviceSecret"].ToString(); | |||
StartupMode = System.Configuration.ConfigurationManager.AppSettings["StartupMode"].ToString(); | |||
BroadcastPubTopic = InternetInfo.BroadcastPubTopic; | |||
//MaintainTable maintainTable = new MaintainTable(); | |||
//maintainTable.Id = Guid.NewGuid().ToString(); | |||
//maintainTable.MaintainTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); | |||
@@ -85,11 +86,28 @@ namespace BPASmartClient.IoT | |||
/// <summary> | |||
/// 维保通知 | |||
/// </summary> | |||
public List<MaintainTable> maintainTables = new List<MaintainTable>(); | |||
public List<MaintainTable> maintainTables = new List<MaintainTable>(); | |||
#endregion | |||
#region API调用 | |||
/// <summary> | |||
/// 刷新店铺列表 | |||
/// </summary> | |||
public void RefreshTheListOfStores() | |||
{ | |||
try | |||
{ | |||
if (DeviceDataV != null && DeviceDataV.GetIsConnected() && DeviceDataV.deviceTable != null) | |||
{ | |||
DeviceDataV.IOT_Publish(BroadcastPubTopic, Tools.JsonConvertTools("刷新店铺列表")); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.Show(ex.Message); | |||
} | |||
} | |||
/// <summary> | |||
/// 增加告警信息 | |||
/// </summary> | |||
/// <param name="alarmTable"></param> | |||
@@ -122,7 +140,7 @@ namespace BPASmartClient.IoT | |||
{ | |||
if (DeviceDataV != null && DeviceDataV.GetIsConnected() && DeviceDataV.deviceTable != null) | |||
{ | |||
maintainTable.Id=Guid.NewGuid().ToString(); | |||
maintainTable.Id = Guid.NewGuid().ToString(); | |||
//maintainTable.MaintainTime = DateTime.Now.ToString(); | |||
//maintainTable.MaintainType = "一般"; | |||
//maintainTable.MaintainVla = "MorkS"; | |||
@@ -288,18 +288,18 @@ namespace BPASmartClient.MorkS | |||
else | |||
IsHealth = true; | |||
if (mORKS.AllowRun) | |||
{ | |||
TakeBowlTask(); | |||
//if (mORKS.AllowRun) | |||
//{ | |||
TakeBowlTask(); | |||
TakeNoodleTask(); | |||
TakeNoodleTask(); | |||
OutNoodleTask(); | |||
OutNoodleTask(); | |||
SingleDetect(); | |||
SingleDetect(); | |||
TurntableControl(); | |||
} | |||
TurntableControl(); | |||
//} | |||
} | |||
private void BowlControl(OrderLocInfo orderLocInfo) | |||
@@ -516,7 +516,7 @@ namespace BPASmartClient.MorkS | |||
mORKS.OutMealId = mORKS.IngredientsCompleteId; | |||
mORKS.IngredientsCompleteId = string.Empty; | |||
mORKS.CookNodelId[loc] = string.Empty; | |||
DeviceProcessLogShow($"{loc + 1}号位置出餐控制"); | |||
DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{ mORKS.OutMealId}"); | |||
mORKS.OutNoodleing = true; | |||
} | |||
} | |||
@@ -542,15 +542,25 @@ namespace BPASmartClient.MorkS | |||
{ | |||
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_COOK); | |||
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】制作完成"); | |||
mORKS.CookCompleteFlatBit = true; | |||
mORKS.OutNoodleing = false; | |||
} | |||
//取餐完成逻辑处理 | |||
if (DelayRTrig.GetInstance("CompleteChange1").Start(mORKS.RbOutMealComplete && !mORKS.TakeMealDetect, 2)) | |||
//if (DelayRTrig.GetInstance("CompleteChange1").Start(mORKS.RbOutMealComplete && !mORKS.TakeMealDetect, 2)) | |||
//{ | |||
// OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE); | |||
// DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成"); | |||
// ResetCookComplete(); | |||
// mORKS.OutMealId = string.Empty; | |||
//} | |||
if (DelayRTrig.GetInstance("CompleteChange1").Start(mORKS.CookCompleteFlatBit && !mORKS.TakeMealDetect, 2)) | |||
{ | |||
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE); | |||
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成"); | |||
ResetCookComplete(); | |||
mORKS.CookCompleteFlatBit = false; | |||
mORKS.OutMealId = string.Empty; | |||
} | |||
@@ -311,6 +311,11 @@ namespace BPASmartClient.MorkS | |||
/// </summary> | |||
public bool IsNoodles { get; set; } = true; | |||
/// <summary> | |||
/// 制作完成标志 | |||
/// </summary> | |||
[VariableMonitor("制作完成标志")] | |||
public bool CookCompleteFlatBit { get; set; } | |||
#region 订单ID记录 | |||
@@ -12,6 +12,7 @@ using BPASmartClient.Model; | |||
using System.Reflection; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System.Windows; | |||
using BPASmartClient.Business; | |||
namespace BPASmartClient.ViewModel | |||
{ | |||
@@ -49,23 +50,38 @@ namespace BPASmartClient.ViewModel | |||
private void GetData() | |||
{ | |||
var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig"); | |||
string path = $"{LocaPath.GetInstance().GetDeviceConfigPath}{text}.json"; | |||
if (File.Exists(path)) | |||
//var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig"); | |||
//string path = $"{LocaPath.GetInstance().GetDeviceConfigPath}{text}.json"; | |||
//if (File.Exists(path)) | |||
//{ | |||
// string JsonString = File.ReadAllText(path); | |||
// var result = JsonConvert.DeserializeObject<ObservableCollection<DeviceConfigModelJson>>(JsonString); | |||
// if (result != null) | |||
// { | |||
// foreach (var shop in result)//店铺集合 | |||
// { | |||
// foreach (var device in shop.deviceModels)//设备集合 | |||
// { | |||
// Devices.Add(new Device() { Name = device.DeviceName, Namespace = device.DeviceNamespace }); | |||
// } | |||
// } | |||
// } | |||
//} | |||
var result = Plugin.GetInstance().GetPlugin<ConfigMgr>()?.deviceConfigModelJsons; | |||
if (result != null) | |||
{ | |||
string JsonString = File.ReadAllText(path); | |||
var result = JsonConvert.DeserializeObject<ObservableCollection<DeviceConfigModelJson>>(JsonString); | |||
if (result != null) | |||
foreach (var shop in result)//店铺集合 | |||
{ | |||
foreach (var shop in result)//店铺集合 | |||
foreach (var device in shop.deviceModels)//设备集合 | |||
{ | |||
foreach (var device in shop.deviceModels)//设备集合 | |||
{ | |||
Devices.Add(new Device() { Name = device.DeviceName, Namespace = device.DeviceNamespace }); | |||
} | |||
Devices.Add(new Device() { Name = device.DeviceName, Namespace = device.DeviceNamespace }); | |||
} | |||
} | |||
} | |||
if (Devices.Count > 0) | |||
{ | |||
Devices.ElementAt(0).IsChecked = true; | |||
@@ -115,6 +115,11 @@ namespace BPASmartClient.ViewModel | |||
OnPropertyChanged("LogDataGrid"); | |||
} | |||
} | |||
public string SearchText { get { return _mSearchText; } set { _mSearchText = value; OnPropertyChanged(); } } | |||
private string _mSearchText; | |||
#endregion | |||
#region Command | |||
@@ -132,7 +137,7 @@ namespace BPASmartClient.ViewModel | |||
BookExs.Add(new BookEx(new Book() { Name = "错误日志条件", Tag = "Error" }) { IsChecked = true }); | |||
BookExs.Add(new BookEx(new Book() { Name = "设备告警条件", Tag = "DeviceAlarm" }) { IsChecked = true }); | |||
SelectBookExs = new ObservableCollection<BookEx>(); | |||
ItemPropertyChanged(new BookEx(new Book()) { IsChecked = true },new PropertyChangedEventArgs("IsChecked")); | |||
ItemPropertyChanged(new BookEx(new Book()) { IsChecked = true }, new PropertyChangedEventArgs("IsChecked")); | |||
//查询 | |||
QueryCommand = new RelayCommand(() => | |||
{ | |||
@@ -157,7 +162,7 @@ namespace BPASmartClient.ViewModel | |||
//2.根据选中查询日志 | |||
DataTable dataTable = ReadFile(path); | |||
List<DataRow> datas = dataTable.Select($"({sql})").OrderByDescending(o => o["TIME"])?.ToList(); | |||
if (datas==null || datas.Count() <= 0) | |||
if (datas == null || datas.Count() <= 0) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, MainViewModel.GetInstance().window, "提示", $"查询结果为空!"); | |||
return; | |||
@@ -169,9 +174,19 @@ namespace BPASmartClient.ViewModel | |||
time = item["TIME"].ToString(), | |||
type = item["LOGGER"].ToString(), | |||
message = item["MESSAGE"].ToString() | |||
// foreground = (item["LOGGER"].ToString() == "ERROR" || item["LOGGER"].ToString() == "DEVICEALARM") ? new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#ed0032")) : new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#21bb2e")) | |||
// foreground = (item["LOGGER"].ToString() == "ERROR" || item["LOGGER"].ToString() == "DEVICEALARM") ? new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#ed0032")) : new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#21bb2e")) | |||
}); | |||
} | |||
if (SearchText?.Length > 0) | |||
{ | |||
var SearchList = LogDataGrid.Where(p => p.message.Contains(SearchText)).ToList(); | |||
if (SearchList != null && SearchList.Count > 0) | |||
{ | |||
LogDataGrid.Clear(); | |||
SearchList.ForEach((item) => { LogDataGrid.Add(item); }); | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
@@ -1,4 +1,5 @@ | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Business; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.IoT; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Model; | |||
@@ -30,9 +31,9 @@ namespace BPASmartClient.ViewModel | |||
public DispatcherTimer UpDataFileTimer; | |||
//定时清除界面日志 | |||
public DispatcherTimer dispatcherTimer; | |||
public string ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString(); | |||
//public string ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString(); | |||
public ObservableCollection<LogModel> LogDataGridData { get; set; } | |||
private ObservableCollection<LogModel> _LogModels;public ObservableCollection<LogModel> LogDataGrid | |||
private ObservableCollection<LogModel> _LogModels; public ObservableCollection<LogModel> LogDataGrid | |||
{ | |||
get | |||
{ | |||
@@ -46,7 +47,7 @@ namespace BPASmartClient.ViewModel | |||
OnPropertyChanged("LogDataGrid"); | |||
} | |||
} | |||
private bool _RealTimeModel = true;public bool RealTimeModel | |||
private bool _RealTimeModel = true; public bool RealTimeModel | |||
{ | |||
get | |||
{ | |||
@@ -60,7 +61,7 @@ namespace BPASmartClient.ViewModel | |||
OnPropertyChanged("RealTimeModel"); | |||
} | |||
} | |||
private bool _TimedClear = true;public bool TimedClear | |||
private bool _TimedClear = true; public bool TimedClear | |||
{ | |||
get | |||
{ | |||
@@ -192,7 +193,7 @@ namespace BPASmartClient.ViewModel | |||
logHelper.GetLogConfigInstance().WriteLog(LogLevel.ERROR, s); | |||
DataVClient.GetInstance().HttpAddLog(new LogTable | |||
{ | |||
ClientId = ClientId, | |||
ClientId = Plugin.GetInstance().GetPlugin<ConfigMgr>().ClientId.ToString(), | |||
LogTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), | |||
LogType = "严重", | |||
LogMessage = s, | |||
@@ -225,7 +226,7 @@ namespace BPASmartClient.ViewModel | |||
{ | |||
if (LogDataGridData.Count > 200) | |||
{ | |||
LogModel logModel= LogDataGridData.Last(); | |||
LogModel logModel = LogDataGridData.Last(); | |||
DeleteLog(logModel); | |||
LogDataGridData.Remove(logModel); | |||
} | |||
@@ -247,7 +248,7 @@ namespace BPASmartClient.ViewModel | |||
/// </summary> | |||
public void AddLog(LogModel logModel) | |||
{ | |||
BookEx book= SelectBookExs?.ToList().Find(par => par.IsChecked && par.BookN.Tag == logModel.type); | |||
BookEx book = SelectBookExs?.ToList().Find(par => par.IsChecked && par.BookN.Tag == logModel.type); | |||
if (book != null) | |||
{ | |||
LogDataGrid.Insert(0, logModel); | |||
@@ -260,7 +261,8 @@ namespace BPASmartClient.ViewModel | |||
public void RefreshLog() | |||
{ | |||
LogDataGrid.Clear(); | |||
LogDataGridData?.ToList().ForEach(b => { | |||
LogDataGridData?.ToList().ForEach(b => | |||
{ | |||
BookEx book = SelectBookExs?.ToList().Find(par => par.IsChecked && par.BookN.Tag == b.type); | |||
if (book != null) | |||
@@ -268,15 +270,15 @@ namespace BPASmartClient.ViewModel | |||
LogDataGrid.Add(b); | |||
} | |||
}); | |||
} | |||
/// <summary> | |||
/// 删除日志 | |||
/// </summary> | |||
public void DeleteLog(LogModel logModel) | |||
{ | |||
LogModel log= LogDataGrid?.ToList().Find(par => par == logModel); | |||
if(log!=null) LogDataGrid.Remove(log); | |||
LogModel log = LogDataGrid?.ToList().Find(par => par == logModel); | |||
if (log != null) LogDataGrid.Remove(log); | |||
} | |||
/// <summary> | |||
@@ -344,7 +346,7 @@ namespace BPASmartClient.ViewModel | |||
SelectBookExs.Clear(); | |||
foreach (BookEx item in bookExs) | |||
{ | |||
builder.Append(item.BookN.Name.Replace("日志","") + ","); | |||
builder.Append(item.BookN.Name.Replace("日志", "") + ","); | |||
SelectBookExs.Add((BookEx)item); | |||
} | |||
SelectedText = builder == null ? string.Empty : builder.ToString(); | |||
@@ -77,9 +77,9 @@ namespace BPASmartClient.ViewModel | |||
dispatcherTimer.Start(); | |||
} | |||
public int CurrentOrderCount { get { return Json<KeepDataBase>.Data.orderLists.Count; } set { OnPropertyChanged(); } } | |||
public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } } | |||
@@ -3,9 +3,8 @@ | |||
<appSettings> | |||
<!--通用配置--> | |||
<add key="ClientId" value="43"/> | |||
<!--<add key="ClientId" value="43"/>--> | |||
<add key="IsEnableTest" value="false"/> | |||
<add key="IsVerify" value="false"/> | |||
<!--开发环境--> | |||
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
@@ -85,7 +85,9 @@ | |||
<Button Margin="80,0,0,0" Tag="Save" Click="Button_Click" >保存text</Button> | |||
<Button Margin="20,0,0,0" Tag="Insert" Click="Button_Click" >导入text</Button> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Margin="0,20,0,0" > | |||
<Button Margin="80,0,0,0" Tag="刷新" Click="Button_Click" >刷新大屏列表</Button> | |||
</StackPanel> | |||
</StackPanel> | |||
<Grid Grid.Column="1" Margin="10"> | |||
@@ -134,6 +134,9 @@ namespace BPASmartClient.Control | |||
else | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, MainViewModel.GetInstance().window, "提示", $"密码输入错误!"); | |||
break; | |||
case "刷新": | |||
DataVClient.GetInstance().RefreshTheListOfStores(); | |||
break; | |||
} | |||
} | |||
} | |||
@@ -34,6 +34,8 @@ | |||
</ComboBox.ItemTemplate> | |||
</ComboBox> | |||
<DatePicker Margin="10,0,10,0" Text="{Binding DateTimeStr,Mode=TwoWay,NotifyOnTargetUpdated=True}"></DatePicker> | |||
<TextBlock Text="请输入关键字:" FontSize="16"/> | |||
<TextBox Text="{Binding SearchText}" Width="300" Margin="10,0,10,0" /> | |||
<Button Margin="10,0,0,0" Cursor="Hand" Command="{Binding QueryCommand}" >查询数据</Button> | |||
<Button Margin="10,0,0,0" Cursor="Hand" Command="{Binding OpenCommand}" >打开文件目录</Button> | |||
</StackPanel> | |||
@@ -276,6 +276,12 @@ | |||
</TextBlock> | |||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> | |||
<TextBlock FontSize="16" Text="当前订单量:" /> | |||
<TextBlock | |||
Margin="0,0,5,0" | |||
FontSize="16" | |||
Text="{Binding CurrentOrderCount}" /> | |||
<Button | |||
Name="login" | |||
Grid.Row="0" | |||