Merge branch 'master' of github.com:KJD2025/KJD

This commit is contained in:
wule committed 2026-10-12 14:37:26 +08:00
commit d656ef270c
1 file changed
+47 -33
@@ -525,7 +525,7 @@ namespace TemuKJD.WXForms.ProductForms
} }
if (isNotCount) if (isNotCount)
data += "&is_not_count=true"; data += "&is_not_count=true";
})); }));
var html = GetHtml.PostUtf8(url, data); var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
@@ -1205,7 +1205,7 @@ namespace TemuKJD.WXForms.ProductForms
bool isCollectAuthorityUser = true; bool isCollectAuthorityUser = true;
Get1688ProductForm.Out1688ProductImport(isCollectAuthorityUser, this.statusBar, this.pbLoading, OutProdSaveDbCallBack); Get1688ProductForm.Out1688ProductImport(isCollectAuthorityUser, this.statusBar, this.pbLoading, OutProdSaveDbCallBack);
} }
private void bt_import_wx_Click(object sender, EventArgs e) private async void bt_import_wx_Click(object sender, EventArgs e)
{ {
OpenFileDialog openFileDialog = new OpenFileDialog(); OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Multiselect = true; openFileDialog.Multiselect = true;
@@ -1214,44 +1214,58 @@ namespace TemuKJD.WXForms.ProductForms
// 显示对话框并获取结果 // 显示对话框并获取结果
if (openFileDialog.ShowDialog() == DialogResult.OK) if (openFileDialog.ShowDialog() == DialogResult.OK)
{ {
var filePathLst = openFileDialog.FileNames.ToList(); try
int successNum = 0;
int failedNum = 0;
var pddtoWxFactory = new PDDProdFormConverter();
foreach (var filePath in filePathLst)
{ {
string sourceContent = ""; btn_import_wx.Enabled = false;
string content = ""; var filePathLst = openFileDialog.FileNames.ToList();
string rst = "商品未识别"; int successNum = 0;
int day = txt_listing_time.Text.ParseToInt(0) * -1; int failedNum = 0;
try var pddtoWxFactory = new PDDProdFormConverter();
{
rst = pddtoWxFactory.PddFrontToPddBackConvertFactory(filePath, true, null, true, listingTime: DateTime.Now.AddDays(day));
}
catch (Exception ex)
{
rst = ex.Message;
}
if (string.IsNullOrEmpty(rst))
successNum++;
else
failedNum++;
await Task.Run(() =>
{
foreach (var filePath in filePathLst)
{
string sourceContent = "";
string content = "";
string rst = "商品未识别";
int day = txt_listing_time.Text.ParseToInt(0) * -1;
try
{
rst = pddtoWxFactory.PddFrontToPddBackConvertFactory(filePath, true, null, true, listingTime: DateTime.Now.AddDays(day));
}
catch (Exception ex)
{
rst = ex.Message;
}
if (string.IsNullOrEmpty(rst))
successNum++;
else
failedNum++;
Invoke(new Action(() =>
{
this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1);
this.statusBar.lblTaskStatus.Text = "正在导入,尝试导入" + (successNum + failedNum) + ",成功" + successNum + ",失败" + failedNum;
}));
}
});
SearchDbProd(1, " 导入完成,尝试导入" + (successNum + failedNum) + ",成功" + successNum + ",失败" + failedNum);
Invoke(new Action(() => Invoke(new Action(() =>
{ {
this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1); btn_import_wx.Enabled = true;
this.statusBar.lblTaskStatus.Text = "正在导入,尝试导入" + (successNum + failedNum) + ",成功" + successNum + ",失败" + failedNum; pbLoading.Visible = false;
this.statusBar.lblTaskStatus.Text = "导入完成,尝试导入" + (successNum + failedNum) + ",成功" + successNum + ",失败" + failedNum;
BaseMsgForm.ShowInfo("导入完成!");
})); }));
} }
finally
SearchDbProd(1, " 导入完成,尝试导入" + (successNum + failedNum) + ",成功" + successNum + ",失败" + failedNum);
Invoke(new Action(() =>
{ {
pbLoading.Visible = false; Invoke(new Action(() =>
this.statusBar.lblTaskStatus.Text = "导入完成,尝试导入" + (successNum + failedNum) + ",成功" + successNum + ",失败" + failedNum; {
BaseMsgForm.ShowInfo("导入完成!"); btn_import_wx.Enabled = true;
})); }));
}
} }
} }