SVN-Revision: r409
This commit is contained in:
wyf
2025-03-27 05:05:45 +00:00
parent f5d29694bb
commit d3fee8afb9
3 changed files with 42 additions and 35 deletions
+36 -33
View File
@@ -74,7 +74,7 @@ namespace Lskj.PubBomImport
if (code.StartsWith("QD") || code.StartsWith("ZZQD"))
{
stringBuilder.AppendLine($"if not exists (select productid from p_ProductTab where productid = '{dataRow[""] + ""}')");
stringBuilder.AppendLine($"begin insert into p_ProductTab (productid,appellation,bak) values ('{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}') end;");
stringBuilder.AppendLine($"begin insert into p_ProductTab (productid,appellation,bak,SpeciesNo) values ('{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}','0199') end;");
}
}
if (!string.IsNullOrEmpty(stringBuilder.ToString()))
@@ -142,46 +142,49 @@ namespace Lskj.PubBomImport
int.TryParse(dataRow["套数"] + "", out int tamount);
string code = (dataRow["图号"] + "").Trim();
FileInfo childInfo = fileInfos.Where(n => n.Name.StartsWith(code)).FirstOrDefault();
if (childInfo != null && (code.StartsWith("QD") || code.StartsWith("ZZQD")))
if (childInfo != null)
{
SetProcessBar(0, allCount);
SetProcessMsg($"正在导入:{Path.GetFileName(childInfo.FullName)}");
DataTable detailTable = new DataTable();
frmMain.Invoke(new Action(() =>
if ((code.StartsWith("QD") || code.StartsWith("ZZQD")))
{
detailTable = frmMain.ToExcelDataTable(childInfo.FullName, out int count, out int errorCount, true);
}));
foreach (DataRow detailRow in detailTable.Rows)
SetProcessBar(0, allCount);
SetProcessMsg($"正在导入:{Path.GetFileName(childInfo.FullName)}");
DataTable detailTable = new DataTable();
frmMain.Invoke(new Action(() =>
{
detailTable = frmMain.ToExcelDataTable(childInfo.FullName, out int count, out int errorCount, true);
}));
foreach (DataRow detailRow in detailTable.Rows)
{
int.TryParse(detailRow["amount"] + "", out int lastAmount);
detailRow["tamount"] = tamount;
detailRow["amount"] = tamount > 0 ? (lastAmount * tamount) + "" : lastAmount + "";
}
frmBillInfo.GcMainView.GridControl.DataSource = detailTable;
SetProcessBar(20, allCount);
frmBillInfo.InitializeHeader(dataRow, Model.BillMasterSql);
SetProcessBar(40, allCount);
frmBillInfo.BillSave();
SetProcessBar(60, allCount);
frmBillInfo.OnBillAdd();
string updateChildVerSql = @"update bom_BillListTab set Ver = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{0}') where Billdocument_Id = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{1}') and ProductId='{0}'";
SqlHelper.ExecuteNonQuery(string.Format(updateChildVerSql, code, productId));
SetProcessBar(80, allCount);
isUpload = UploadFile(childInfo.FullName, idValue, out msg);
SetProcessBar(100, finishCount);
SetProcessLabelAllMsg($"总进度:{nowCount + 1}/{parentTable.Rows.Count + 1}");
}
else
{
int.TryParse(detailRow["amount"] + "", out int lastAmount);
detailRow["tamount"] = tamount;
detailRow["amount"] = tamount > 0 ? (lastAmount * tamount) + "" : lastAmount + "";
isUpload = UploadFile(childInfo.FullName, idValue, out msg);
SetProcessBar(100, finishCount);
SetProcessLabelAllMsg($"总进度:{nowCount + 1}/{parentTable.Rows.Count + 1}");
}
frmBillInfo.GcMainView.GridControl.DataSource = detailTable;
SetProcessBar(20, allCount);
frmBillInfo.InitializeHeader(dataRow, Model.BillMasterSql);
SetProcessBar(40, allCount);
frmBillInfo.BillSave();
SetProcessBar(60, allCount);
frmBillInfo.OnBillAdd();
string updateChildVerSql = @"update bom_BillListTab set Ver = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{0}') where Billdocument_Id = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{1}') and ProductId='{0}'";
SqlHelper.ExecuteNonQuery(string.Format(updateChildVerSql, code, productId));
SetProcessBar(80, allCount);
isUpload = UploadFile(childInfo.FullName, idValue, out msg);
SetProcessBar(100, finishCount);
SetProcessLabelAllMsg($"总进度:{nowCount + 1}/{parentTable.Rows.Count + 1}");
}
else
{
isUpload = UploadFile(childInfo.FullName, idValue, out msg);
SetProcessBar(100, finishCount);
SetProcessLabelAllMsg($"总进度:{nowCount + 1}/{parentTable.Rows.Count + 1}");
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
MessageUtil.Show(ex.Message);
}
finally
{
@@ -268,7 +271,7 @@ namespace Lskj.PubBomImport
if (code.StartsWith("QD") || code.StartsWith("ZZQD"))
{
stringBuilder.AppendLine($"if not exists (select productid from p_ProductTab where productid = '{dataRow[""] + ""}')");
stringBuilder.AppendLine($"begin insert into p_ProductTab (productid,appellation,bak) values ('{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}') end;");
stringBuilder.AppendLine($"begin insert into p_ProductTab (productid,appellation,bak,SpeciesNo) values ('{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}','{(dataRow[""] + "").Replace("'", "''")}','0199') end;");
}
}
if (!string.IsNullOrEmpty(stringBuilder.ToString()))