private void btnQuery_Click(object sender, System.Windows.RoutedEventArgs e) { if (starttime.Value == null || endtime.Value == null || starttime.Value > endtime.Value) { MessageBox.Show("请选择正确的时间!");//应限制输入超过12小时的上班间隔 return; } var list = viewModel.GetHistoryData((DateTime)starttime.Value, (DateTime)endtime.Value, cmbProduct.Text); ReportDataSource ds = new ReportDataSource("DataSet1", list); rvProcess.LocalReport.DataSources.Clear(); rvProcess.LocalReport.DataSources.Add(ds); rvProcess.RefreshReport(); }