private async void TestLogDetailDelete() { if (this.radGridView1.RowCount < 1) { MessageBox.Show("没有可以清除的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (MessageBox.Show("是否确认清除当前所有数据?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.OK) { return; } //var returnRes = serviceClient.DeleteTestLogData(this.currentQueryCondition.Trim(),startTime,endTime); //List<MesService.TestLogResultHistory> testLogResultHistoryList = new List<MesService.TestLogResultHistory>(); //await Task.Run(() => //{ this.label_delStatus.Visible = true; this.label_delStatus.Text = "正在检索历史关联数据,请耐心等待..."; this.label_delStatus.ForeColor = Color.Red; this.tool_clearDB.Enabled = false; //this.refreshDeleteStatusTimer.Start(); //foreach (GridViewRowInfo rowInfo in this.radGridView1.Rows) //{ // var processName = rowInfo.Cells[3].Value.ToString(); // var pcbaSN = rowInfo.Cells[1].Value.ToString(); // var productSN = rowInfo.Cells[2].Value.ToString(); // AddCurrentRowStationInfo(rowInfo, testLogResultHistoryList,processName,pcbaSN,productSN); //} //}); //var delLogResult = testLogResultHistoryList.ToArray(); #region update select date if (rbtn_today.Checked) { startTime = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00"; endTime = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59"; } else if (rbtn_oneMonth.Checked) { startTime = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd") + " 00:00:00"; endTime = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59"; } else if (rbtn_threeMonth.Checked) { startTime = DateTime.Now.AddMonths(-3).ToString("yyyy-MM-dd") + " 00:00:00"; endTime = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59"; } else if (rbtn_oneYear.Checked) { startTime = DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd") + " 00:00:00"; endTime = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59"; } else if (rbtn_custom.Checked) { startTime = this.pickerStartTime.Text; endTime = this.pickerEndTime.Text; } #endregion var delRow = await serviceClient.DeleteTestLogHistoryAsync(this.tool_queryCondition.Text, startTime, endTime); if (delRow > 0) { this.label_delStatus.Text = "删除完成"; RefreshUI(); MessageBox.Show($"已清除数据{delRow}条!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("未清除任何数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.tool_clearDB.Enabled = true; this.refreshDeleteStatusTimer.Stop(); }