SVN-Revision: r675
This commit is contained in:
wyf
2025-06-05 09:31:20 +00:00
parent fa5de16576
commit e210554f61
2 changed files with 278 additions and 1 deletions
+90
View File
@@ -259,6 +259,36 @@ namespace Lskj.PubBomImport
this.Close();
}
}
if (Model.ShowType.Equals("000"))//单选文件并返回到表中
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.Multiselect = false;
dialog.InitialDirectory = Properties.Settings.Default.LastSelectFolder;
dialog.Title = "选择导入文件";
//dialog.Filter = "Excel文件(*.xlsx)|*.xlsx|Excel文件(*.xls)|*.xls";
DialogResult dialogResult = dialog.ShowDialog();
if (dialogResult == DialogResult.OK)
{
Properties.Settings.Default.LastSelectFolder = Path.GetDirectoryName(dialog.FileName);
BomImpRtnModel bomImpRtnModel = new BomImpRtnModel()
{
ShowType = Model.ShowType,
AfterBomFieldName = Model.AfterBomFieldName,
FileNames = dialog.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"))//新增多个其它文件
{
BomImpRtnModel bomImpRtnModel = new BomImpRtnModel()
@@ -623,6 +653,66 @@ namespace Lskj.PubBomImport
this.Close();
}
}
else if (Model.ShowType.Equals("7"))//修改单个其它文件
{
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.StartUpdateInOtherFile(selectRows);
};
frmProgress.ImportTimer.Enabled = true;
DialogResult dialogResult = frmProgress.ShowDialog();
bomImpRtnModel.CanSave = dialogResult == DialogResult.OK;
frmProgress.Dispose();
}
else
{
this.Close();
}
}
else
{
this.Close();
}
}
}
catch (Exception ex)
{