Merge branch 'master' of github.com:KJD2025/KJD
This commit is contained in:
commit
d656ef270c
1 file changed
+46
-32
@@ -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;
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user