SVN r469
SVN-Revision: r469
This commit is contained in:
@@ -186,33 +186,65 @@ namespace Lskj.PubBomImport
|
|||||||
}
|
}
|
||||||
else if (Model.ShowType.Equals("3"))
|
else if (Model.ShowType.Equals("3"))
|
||||||
{
|
{
|
||||||
DataTable sourceTable = StaticControl.RightMenuGridView.GridControl.DataSourceTable();
|
BomImpRtnModel bomImpRtnModel = new BomImpRtnModel()
|
||||||
if (StaticControl.RightMenuGridView.Tag is Dictionary<string, string> filesDic)
|
|
||||||
{
|
{
|
||||||
FrmProgress frmProgress = new FrmProgress();
|
ShowType = Model.ShowType,
|
||||||
frmProgress.frmMain = this;
|
AfterBomFieldName = Model.AfterBomFieldName,
|
||||||
frmProgress.Model = Model;
|
CanSave = true
|
||||||
frmProgress.ImportTimer.Tick += (ts, te) =>
|
};
|
||||||
|
FormDialogModel dialogModel = new FormDialogModel()
|
||||||
|
{
|
||||||
|
DialogDllName = "Lskj.PubBomImport.dll",
|
||||||
|
PubDialogType = DialogType.PubAddRecord,
|
||||||
|
ReturnTag = bomImpRtnModel
|
||||||
|
};
|
||||||
|
this.Tag = dialogModel;
|
||||||
|
if (StaticControl.RightMenuGridView.Tag is Dictionary<DataRow, string> filesDic)
|
||||||
|
{
|
||||||
|
DataTable sourceTable = StaticControl.RightMenuGridView.GridControl.DataSourceTable();
|
||||||
|
List<DataRow> selectRows = new List<DataRow>();
|
||||||
|
foreach (DataRow sourceRow in sourceTable.Rows)
|
||||||
{
|
{
|
||||||
frmProgress.ImportTimer.Enabled = false;
|
if (sourceRow.RowState == DataRowState.Deleted)
|
||||||
frmProgress.StartImportInQDFile(sourceTable, filesDic);
|
{
|
||||||
};
|
continue;
|
||||||
frmProgress.ImportTimer.Enabled = true;
|
}
|
||||||
DialogResult dialogResult = frmProgress.ShowDialog();
|
string fileName = sourceRow[Model.AfterBomFieldName] + "";
|
||||||
BomImpRtnModel bomImpRtnModel = new BomImpRtnModel()
|
string dirPath = filesDic.ContainsKey(sourceRow) ? filesDic[sourceRow] : "";
|
||||||
|
FileInfo parentInfo = null;
|
||||||
|
if (string.IsNullOrEmpty(dirPath))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
parentInfo = new FileInfo(dirPath);
|
||||||
|
if (parentInfo != null && (parentInfo.Name.Trim().StartsWith("QD") || parentInfo.Name.Trim().StartsWith("ZZQD")))
|
||||||
|
{
|
||||||
|
selectRows.Add(sourceRow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selectRows.Count > 0)
|
||||||
{
|
{
|
||||||
ShowType = Model.ShowType,
|
FrmProgress frmProgress = new FrmProgress();
|
||||||
AfterBomFieldName = Model.AfterBomFieldName,
|
frmProgress.frmMain = this;
|
||||||
CanSave = dialogResult == DialogResult.OK
|
frmProgress.Model = Model;
|
||||||
};
|
frmProgress.ImportTimer.Tick += (ts, te) =>
|
||||||
FormDialogModel dialogModel = new FormDialogModel()
|
{
|
||||||
|
frmProgress.ImportTimer.Enabled = false;
|
||||||
|
frmProgress.StartImportInQDFile(selectRows, filesDic);
|
||||||
|
};
|
||||||
|
frmProgress.ImportTimer.Enabled = true;
|
||||||
|
DialogResult dialogResult = frmProgress.ShowDialog();
|
||||||
|
bomImpRtnModel.CanSave = dialogResult == DialogResult.OK;
|
||||||
|
frmProgress.Dispose();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
DialogDllName = "Lskj.PubBomImport.dll",
|
this.Close();
|
||||||
PubDialogType = DialogType.PubAddRecord,
|
}
|
||||||
ReturnTag = bomImpRtnModel
|
}
|
||||||
};
|
else
|
||||||
this.Tag = dialogModel;
|
{
|
||||||
frmProgress.Dispose();
|
this.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -505,18 +505,18 @@ namespace Lskj.PubBomImport
|
|||||||
/// 开始导入3
|
/// 开始导入3
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dirPaths"></param>
|
/// <param name="dirPaths"></param>
|
||||||
public void StartImportInQDFile(DataTable sourceTable, Dictionary<string, string> filesDic)
|
public void StartImportInQDFile(List<DataRow> selectRows, Dictionary<DataRow, string> filesDic)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (DataRow sourceRow in sourceTable.Rows)
|
foreach (DataRow sourceRow in selectRows)
|
||||||
{
|
{
|
||||||
if (sourceRow.RowState == DataRowState.Deleted)
|
if (sourceRow.RowState == DataRowState.Deleted)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
string fileName = sourceRow[Model.AfterBomFieldName] + "";
|
string fileName = sourceRow[Model.AfterBomFieldName] + "";
|
||||||
string dirPath = filesDic.ContainsKey(fileName) ? filesDic[fileName] : "";
|
string dirPath = filesDic.ContainsKey(sourceRow) ? filesDic[sourceRow] : "";
|
||||||
FileInfo parentInfo = null;
|
FileInfo parentInfo = null;
|
||||||
if (string.IsNullOrEmpty(dirPath))
|
if (string.IsNullOrEmpty(dirPath))
|
||||||
{
|
{
|
||||||
@@ -553,17 +553,17 @@ namespace Lskj.PubBomImport
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (DataRow sourceRow in sourceTable.Rows)
|
foreach (DataRow sourceRow in selectRows)
|
||||||
{
|
{
|
||||||
if (sourceRow.RowState == DataRowState.Deleted)
|
if (sourceRow.RowState == DataRowState.Deleted)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int childIndex = sourceTable.Rows.IndexOf(sourceRow);
|
int childIndex = selectRows.IndexOf(sourceRow);
|
||||||
int allCount = (int)((decimal)(childIndex) / (sourceTable.Rows.Count) * 100);
|
int allCount = (int)((decimal)(childIndex) / (selectRows.Count) * 100);
|
||||||
int finishCount = (int)((decimal)(1 + childIndex) / (sourceTable.Rows.Count) * 100);
|
int finishCount = (int)((decimal)(1 + childIndex) / (selectRows.Count) * 100);
|
||||||
string fileName = sourceRow[Model.AfterBomFieldName] + "";
|
string fileName = sourceRow[Model.AfterBomFieldName] + "";
|
||||||
string dirPath = filesDic.ContainsKey(fileName) ? filesDic[fileName] : "";
|
string dirPath = filesDic.ContainsKey(sourceRow) ? filesDic[sourceRow] : "";
|
||||||
FileInfo parentInfo = null;
|
FileInfo parentInfo = null;
|
||||||
if (string.IsNullOrEmpty(dirPath))
|
if (string.IsNullOrEmpty(dirPath))
|
||||||
{
|
{
|
||||||
@@ -652,7 +652,7 @@ namespace Lskj.PubBomImport
|
|||||||
//上传文件
|
//上传文件
|
||||||
bool isUpload = UploadFile(childInfo.FullName, billNo, out string msg);
|
bool isUpload = UploadFile(childInfo.FullName, billNo, out string msg);
|
||||||
SetProcessBar(100, finishCount);
|
SetProcessBar(100, finishCount);
|
||||||
SetProcessLabelAllMsg($"总进度:{childIndex + 1}/{sourceTable.Rows.Count }");
|
SetProcessLabelAllMsg($"总进度:{childIndex + 1}/{selectRows.Count }");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -667,10 +667,7 @@ namespace Lskj.PubBomImport
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageUtil.Show("不是QD或ZZQD文件");
|
throw new Exception($"{parentInfo.Name}不是QD或ZZQD文件");
|
||||||
this.DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
ImportTimer?.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1193,5 +1190,6 @@ namespace Lskj.PubBomImport
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
returnMsg = ex.Message;
|
returnMsg = ex.Message;
|
||||||
|
throw new Exception($"文件{Path.GetFileName(filePath)}上传失败\r\n{ex.Message}");
|
||||||
isUpload = false;
|
isUpload = false;
|
||||||
|
|
||||||
Reference in New Issue
Block a user