diff --git a/BPASmartClient.Business/Plugin/ConfigMgr.cs b/BPASmartClient.Business/Plugin/ConfigMgr.cs index dd49de63..9d56d1e2 100644 --- a/BPASmartClient.Business/Plugin/ConfigMgr.cs +++ b/BPASmartClient.Business/Plugin/ConfigMgr.cs @@ -30,6 +30,8 @@ namespace BPASmartClient.Business public UriConfig uriConfig { get; set; } + public ObservableCollection 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>(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 /// private void InitDeviceModel() { - //var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig"); - //string path = $"{LocaPath.GetInstance().GetDeviceConfigPath}{text}.json"; - //deviceConfigs = new List(); - //if (File.Exists(path)) - //{ - // string JsonString = File.ReadAllText(path); - // var result = JsonConvert.DeserializeObject>(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(); - //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); - //} - } - /// - /// 加载MQTT配置 - /// - //private void InitMQTT() - //{ - // IConfigurationBuilder configurationBuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()); - // configurationBuilder.AddApolloConfiguration(p => - // { - // p.AppId = apoid; - // p.MetaServer = apolloUri; - // p.Namespaces = new List() { namespa }; - // }); - - // IConfiguration config = configurationBuilder.Build(); - // var mqttBroker = config.GetSection("BrokerHostSettings"); - // MQTT_Config = mqttBroker.Value.FromJSON(); - // if (MQTT_Config == null) MessageLog.GetInstance.Show("获取配置数据为空!"); - //} + } public void InitConfig() { diff --git a/BPASmartClient.Business/Plugin/DeviceMgr.cs b/BPASmartClient.Business/Plugin/DeviceMgr.cs index 3373ed91..cc2245e9 100644 --- a/BPASmartClient.Business/Plugin/DeviceMgr.cs +++ b/BPASmartClient.Business/Plugin/DeviceMgr.cs @@ -48,73 +48,41 @@ namespace BPASmartClient.Business /// 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()?.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>(JsonString); + if (result != null) { - string JsonString = File.ReadAllText(path); - var result = JsonConvert.DeserializeObject>(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 peripherals = new List(); - 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 peripherals = new List(); + 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().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 peripherals = new List(); - // 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); //} } diff --git a/BPASmartClient.Business/Plugin/OrderProxy.cs b/BPASmartClient.Business/Plugin/OrderProxy.cs index 00006f1a..a121565e 100644 --- a/BPASmartClient.Business/Plugin/OrderProxy.cs +++ b/BPASmartClient.Business/Plugin/OrderProxy.cs @@ -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(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(result); - ActionManage.GetInstance.Send("OrderStatusChange", orderStatusChangedEvent); - MessageLog.GetInstance.Show(string.Format("订单状态改变,调用API执行结果{0}", res == null ? false : res.isSuccess)); #endregion diff --git a/BPASmartClient.IoT/DataVClient.cs b/BPASmartClient.IoT/DataVClient.cs index a560ca08..c4ca8862 100644 --- a/BPASmartClient.IoT/DataVClient.cs +++ b/BPASmartClient.IoT/DataVClient.cs @@ -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().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 /// /// 维保通知 /// - public List maintainTables = new List(); + public List maintainTables = new List(); #endregion #region API调用 /// + /// 刷新店铺列表 + /// + 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); + } + } + /// /// 增加告警信息 /// /// @@ -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"; diff --git a/BPASmartClient.MorkS/Control_Morks.cs b/BPASmartClient.MorkS/Control_Morks.cs index fcc92580..99ed126a 100644 --- a/BPASmartClient.MorkS/Control_Morks.cs +++ b/BPASmartClient.MorkS/Control_Morks.cs @@ -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; } diff --git a/BPASmartClient.MorkS/GVL_MORKS.cs b/BPASmartClient.MorkS/GVL_MORKS.cs index 7d94b57e..a889adc4 100644 --- a/BPASmartClient.MorkS/GVL_MORKS.cs +++ b/BPASmartClient.MorkS/GVL_MORKS.cs @@ -311,6 +311,11 @@ namespace BPASmartClient.MorkS /// public bool IsNoodles { get; set; } = true; + /// + /// 制作完成标志 + /// + [VariableMonitor("制作完成标志")] + public bool CookCompleteFlatBit { get; set; } #region 订单ID记录 diff --git a/BPASmartClient.ViewModel/DeviceMonitorViewModel.cs b/BPASmartClient.ViewModel/DeviceMonitorViewModel.cs index fab22475..da038d99 100644 --- a/BPASmartClient.ViewModel/DeviceMonitorViewModel.cs +++ b/BPASmartClient.ViewModel/DeviceMonitorViewModel.cs @@ -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>(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()?.deviceConfigModelJsons; + if (result != null) { - string JsonString = File.ReadAllText(path); - var result = JsonConvert.DeserializeObject>(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; diff --git a/BPASmartClient.ViewModel/LogOrAlarmViewModel.cs b/BPASmartClient.ViewModel/LogOrAlarmViewModel.cs index c56566db..4cd4744d 100644 --- a/BPASmartClient.ViewModel/LogOrAlarmViewModel.cs +++ b/BPASmartClient.ViewModel/LogOrAlarmViewModel.cs @@ -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(); - 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 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 { diff --git a/BPASmartClient.ViewModel/LogViewModel.cs b/BPASmartClient.ViewModel/LogViewModel.cs index 31f47aaa..aeef16f1 100644 --- a/BPASmartClient.ViewModel/LogViewModel.cs +++ b/BPASmartClient.ViewModel/LogViewModel.cs @@ -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 LogDataGridData { get; set; } - private ObservableCollection _LogModels;public ObservableCollection LogDataGrid + private ObservableCollection _LogModels; public ObservableCollection 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().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 /// 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); } }); - + } /// /// 删除日志 /// 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); } /// @@ -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(); diff --git a/BPASmartClient.ViewModel/MainViewModel.cs b/BPASmartClient.ViewModel/MainViewModel.cs index c4bc8e03..47a3a476 100644 --- a/BPASmartClient.ViewModel/MainViewModel.cs +++ b/BPASmartClient.ViewModel/MainViewModel.cs @@ -77,9 +77,9 @@ namespace BPASmartClient.ViewModel dispatcherTimer.Start(); - } + public int CurrentOrderCount { get { return Json.Data.orderLists.Count; } set { OnPropertyChanged(); } } public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } } diff --git a/BPASmartClient/App.config b/BPASmartClient/App.config index dd930bf7..4e21d83c 100644 --- a/BPASmartClient/App.config +++ b/BPASmartClient/App.config @@ -3,9 +3,8 @@ - + -