private async Task ExecuteRefresh() { try { int?wmsid = Selected?.WMSID; var cmdswms = await _dbservicewms.GetCommandOrders(DateTime.Now.AddHours(-1), DateTime.MaxValue, (int)EnumCommandWMSStatus.Active); DataList.Clear(); foreach (var p in cmdswms) { DataList.Add(new CommandWMSViewModel { WMSID = p.ID, OrderID = p.Order_ID, TUID = p.TU_ID, Source = p.Source, Target = p.Target, Status = (EnumCommandWMSStatus)p.Status, Time = p.Time, OrderERPID = p.OrderERPID, OrderOrderID = p.OrderOrderID, OrderSubOrderID = p.OrderSubOrderID, OrderSubOrderERPID = p.OrderSubOrderERPID, OrderSubOrderName = p.OrderSubOrderName, OrderSKUID = p.OrderSKUID, OrderSKUBatch = p.OrderSKUBatch }); } foreach (var l in DataList) { l.Initialize(_warehouse); } if (wmsid != null) { Selected = DataList.FirstOrDefault(p => p.WMSID == wmsid); } } catch (Exception e) { _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception, string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message)); } }