SVN r403
SVN-Revision: r403
This commit is contained in:
@@ -67,6 +67,28 @@ namespace Lskj.PubBomImport
|
||||
FrmBillInfo frmBillInfo = new FrmBillInfo();
|
||||
DataTable parentTable = ExcelToDatatable(parentInfo.FullName, Model, "", 5);
|
||||
parentTable = parentTable.Rows.Cast<DataRow>().Where(n => int.TryParse(n["序号"] + "", out _) && !string.IsNullOrEmpty(n["图号"] + "")).ToList().CopyToDataTable();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
foreach (DataRow dataRow in parentTable.Rows)
|
||||
{
|
||||
string code = (dataRow["图号"] + "").Trim();
|
||||
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;");
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(stringBuilder.ToString()))
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(stringBuilder.ToString());
|
||||
}
|
||||
frmBillInfo.OnControlSourceBind += (s, args) =>
|
||||
{
|
||||
Task task = new Task(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
SetProcessBar(0, 0);
|
||||
SetProcessMsg($"正在导入:{Path.GetFileName(parentInfo.FullName)}");
|
||||
DataTable childTable = new DataTable();
|
||||
foreach (GridColumn gridColumn in frmBillInfo.GcMainView.Columns)
|
||||
{
|
||||
@@ -90,28 +112,6 @@ namespace Lskj.PubBomImport
|
||||
childTable.Rows.Add(childRow);
|
||||
}
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
foreach (DataRow dataRow in parentTable.Rows)
|
||||
{
|
||||
string code = (dataRow["图号"] + "").Trim();
|
||||
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;");
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(stringBuilder.ToString()))
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(stringBuilder.ToString());
|
||||
}
|
||||
frmBillInfo.OnControlSourceBind += (s, args) =>
|
||||
{
|
||||
Task task = new Task(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
SetProcessBar(0, 0);
|
||||
SetProcessMsg($"正在导入:{Path.GetFileName(parentInfo.FullName)}");
|
||||
SetProcessBar(20, 0);
|
||||
frmBillInfo.GcMainView.GridControl.DataSource = childTable;
|
||||
SetProcessBar(40, 0);
|
||||
|
||||
Reference in New Issue
Block a user