SVN-Revision: r510
This commit is contained in:
wyf
2025-04-29 03:45:31 +00:00
parent 7708c7ef48
commit a0697b4b95
3 changed files with 812 additions and 95 deletions
+107 -5
View File
@@ -80,7 +80,7 @@ namespace Lskj.PubBomImport
InitGridColumns();
InitMulitControl();
InitDataSource();
if (showTypeValue == 0 || showTypeValue == 3 || (showTypeValue > 0 && showType))
if (showTypeValue == 0 || showTypeValue == 3 || showTypeValue == 5 || showTypeValue == 55 || (showTypeValue > 0 && showType))
{
OnBtnImportClick(null, null);
}
@@ -131,6 +131,35 @@ namespace Lskj.PubBomImport
this.Close();
}
}
else if (Model.ShowType.Equals("00"))//选择文件夹并返回文件列表到表中
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.SelectedPath = Properties.Settings.Default.LastSelectFolder;
dialog.Description = "选择导入文件夹";
DialogResult dialogResult = dialog.ShowDialog();
if (dialogResult == DialogResult.OK)
{
Properties.Settings.Default.LastSelectFolder = dialog.SelectedPath;
string[] fileNames = Directory.GetFiles(dialog.SelectedPath);
BomImpRtnModel bomImpRtnModel = new BomImpRtnModel()
{
ShowType = Model.ShowType,
AfterBomFieldName = Model.AfterBomFieldName,
FileNames = fileNames
};
FormDialogModel dialogModel = new FormDialogModel()
{
DialogDllName = "Lskj.PubBomImport.dll",
PubDialogType = DialogType.PubAddRecord,
ReturnTag = bomImpRtnModel
};
this.Tag = dialogModel;
}
else
{
this.Close();
}
}
else if (Model.ShowType.Equals("1"))
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
@@ -217,10 +246,7 @@ namespace Lskj.PubBomImport
continue;
}
parentInfo = new FileInfo(dirPath);
if (parentInfo != null && (parentInfo.Name.Trim().StartsWith("QD") || parentInfo.Name.Trim().StartsWith("ZZQD")))
{
selectRows.Add(sourceRow);
}
selectRows.Add(sourceRow);
}
if (selectRows.Count > 0)
{
@@ -272,6 +298,82 @@ namespace Lskj.PubBomImport
this.Close();
}
}
else if (Model.ShowType.Equals("5"))//通过文件名进行文件上传和逻辑记录
{
BomImpRtnModel bomImpRtnModel = new BomImpRtnModel()
{
ShowType = Model.ShowType,
AfterBomFieldName = Model.AfterBomFieldName,
CanSave = true
};
FormDialogModel dialogModel = new FormDialogModel()
{
DialogDllName = "Lskj.PubBomImport.dll",
PubDialogType = DialogType.PubAddRecord,
ReturnTag = bomImpRtnModel
};
this.Tag = dialogModel;
DataTable sourceTable = StaticControl.RightMenuGridView.GridControl.DataSourceTable();
if (sourceTable.Columns.Contains("BomFieldNameDir"))
{
List<DataRow> selectRows = new List<DataRow>();
foreach (DataRow sourceRow in sourceTable.Rows)
{
if (sourceRow.RowState == DataRowState.Deleted)
{
continue;
}
string fileName = sourceRow[Model.AfterBomFieldName] + "";
string dirPath = sourceRow["BomFieldNameDir"] + "";
FileInfo parentInfo = null;
if (string.IsNullOrEmpty(dirPath))
{
continue;
}
parentInfo = new FileInfo(dirPath);
selectRows.Add(sourceRow);
}
if (selectRows.Count > 0)
{
FrmProgress frmProgress = new FrmProgress();
frmProgress.frmMain = this;
frmProgress.Model = Model;
frmProgress.ImportTimer.Tick += (ts, te) =>
{
frmProgress.ImportTimer.Enabled = false;
frmProgress.StartImportInFiles(selectRows);
};
frmProgress.ImportTimer.Enabled = true;
DialogResult dialogResult = frmProgress.ShowDialog();
bomImpRtnModel.CanSave = dialogResult == DialogResult.OK;
frmProgress.Dispose();
}
else
{
this.Close();
}
}
else
{
this.Close();
}
}
else if (Model.ShowType.Equals("55"))//通过已经上传的数据来解析并且建立BOM
{
FrmProgress frmProgress = new FrmProgress();
frmProgress.frmMain = this;
frmProgress.Model = Model;
frmProgress.ImportTimer.Tick += (ts, te) =>
{
frmProgress.ImportTimer.Enabled = false;
string productId = Model.MaintabFocusedRow != null && Model.MaintabFocusedRow.Table.Columns.Contains("ProductId") ? Model.MaintabFocusedRow["ProductId"] + "" : "";
frmProgress.StartCreateBom(productId);
};
frmProgress.ImportTimer.Enabled = true;
frmProgress.ShowDialog();
frmProgress.Dispose();
}
}
catch (Exception ex)
{