private async Task ExecuteRefreshCommandWMS() { try { if (_commandid == null) { _commandid = SelectedCommand?.WMSID; } DataListCommand.Clear(); if (SelectedSubOrder != null) { var cmds = await _dbservicewms.GetCommandsWMSForSubOrder(SelectedSubOrder.ID); DataListCommand.Clear(); foreach (var cmd in cmds) { DataListCommand.Add(new CommandWMSViewModel { WMSID = cmd.ID, OrderERPID = cmd.OrderERPID, OrderID = cmd.Order_ID, OrderOrderID = cmd.OrderOrderID, OrderSubOrderID = cmd.OrderSubOrderID, OrderSubOrderERPID = cmd.OrderSubOrderERPID, OrderSubOrderName = cmd.OrderSubOrderName, OrderSKUID = cmd.OrderSKUID, OrderSKUBatch = cmd.OrderSKUBatch, Source = cmd.Source, Target = cmd.Target, TUID = cmd.TU_ID, Time = cmd.Time, Status = (EnumCommandWMSStatus)cmd.Status, }); } foreach (var l in DataListCommand) { l.Initialize(_warehouse); } if (_commandid != null) { SelectedCommand = DataListCommand.FirstOrDefault(p => p.WMSID == _commandid.Value); } } } 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)); } }