修复税务统计导出可能失败的问题

This commit is contained in:
wule committed 2026-09-04 17:07:40 +08:00
1 parent 15f5735e07
commit 53c38e8e3a
1 file changed
+10 -10
+10 -10
View File
@@ -620,7 +620,7 @@ namespace TemuKJD.WXForms.ShopForms
}
}
private void btnExportCSV_Click(object sender, EventArgs e)
private async void btnExportCSV_Click(object sender, EventArgs e)
{
var selectRows = dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true).ToList();
if (selectRows.Count == 0)
@@ -644,6 +644,7 @@ namespace TemuKJD.WXForms.ShopForms
dialog.FileName = "用户 " + BaseClass.NickName + DateTime.Now.ToString(" 订单流水yyyyMMddHHmmss") + ".csv";
if (dialog.ShowDialog() != DialogResult.OK)
return;
var path = dialog.FileName;
//FolderBrowserDialog dialog = new FolderBrowserDialog();
@@ -657,16 +658,12 @@ namespace TemuKJD.WXForms.ShopForms
this.btnExport.Enabled = false;
this.btnSearch.Enabled = false;
Task.Run(() => {
Thread.Sleep(5000);
Invoke(new Action(() =>
{
this.btnExport.Enabled = true;
this.btnSearch.Enabled = true;
}));
});
Task.Run(() =>
if (cancellationTokenSource != null)
cancellationTokenSource.Cancel();
cancellationTokenSource = new CancellationTokenSource();
await Task.Run(() =>
{
int num = 0;
foreach (var row in selectRows)
@@ -706,6 +703,9 @@ namespace TemuKJD.WXForms.ShopForms
}
}));
}, cancellationTokenSource.Token);
this.btnExport.Enabled = true;
this.btnSearch.Enabled = true;
}
private void dgvDaRenProd_CellContentClick(object sender, DataGridViewCellEventArgs e)