SVN-Revision: r659
This commit is contained in:
wyf
2025-06-03 08:54:17 +00:00
parent d239cbc4d8
commit 6c9154e516
2 changed files with 210 additions and 28 deletions
+62 -28
View File
@@ -64,7 +64,7 @@ namespace Lskj.PubBomImport
private void FrmMain_Load(object sender, EventArgs e)
{
int.TryParse(Model.ShowType, out int showTypeValue);
bool showType = Model != null && showTypeValue > 0 && !ERPInfo.Instance.UserName.Equals("管理员");
bool showType = Model != null && showTypeValue >= 0;
try
{
if (showType)
@@ -80,7 +80,7 @@ namespace Lskj.PubBomImport
InitGridColumns();
InitMulitControl();
InitDataSource();
if (showTypeValue == 0 || showTypeValue == 2 || showTypeValue == 3 || showTypeValue == 33 || showTypeValue == 4 || showTypeValue == 44 || showTypeValue == 5 || showTypeValue == 55 || (showTypeValue > 0 && showType))
if (showType)
{
OnBtnImportClick(null, null);
}
@@ -260,32 +260,66 @@ namespace Lskj.PubBomImport
this.Close();
}
}
//else if (Model.ShowType.Equals("1"))
//{
// 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 dirPath = dialog.SelectedPath;
// FrmProgress frmProgress = new FrmProgress();
// frmProgress.frmMain = this;
// frmProgress.ImportTimer.Tick += (ts, te) =>
// {
// frmProgress.ImportTimer.Enabled = false;
// frmProgress.StartImportInDir(dirPath);
// };
// frmProgress.ImportTimer.Enabled = true;
// frmProgress.ShowDialog();
// frmProgress.Dispose();
// }
// else
// {
// this.Close();
// }
//}
else if (Model.ShowType.Equals("1"))//新增多个其它文件,无版次版本验证,关联到物料编码下
{
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.StartImportInOtherFiles(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("2"))//一级BOM上传
{
BomImpRtnModel bomImpRtnModel = new BomImpRtnModel()