SVN r601
SVN-Revision: r601
This commit is contained in:
@@ -80,7 +80,7 @@ namespace Lskj.PubBomImport
|
||||
InitGridColumns();
|
||||
InitMulitControl();
|
||||
InitDataSource();
|
||||
if (showTypeValue == 0 || showTypeValue == 3 || showTypeValue == 4 || showTypeValue == 44 || showTypeValue == 5 || showTypeValue == 55 || (showTypeValue > 0 && showType))
|
||||
if (showTypeValue == 0 || showTypeValue == 3 || showTypeValue == 33 || showTypeValue == 4 || showTypeValue == 44 || showTypeValue == 5 || showTypeValue == 55 || (showTypeValue > 0 && showType))
|
||||
{
|
||||
OnBtnImportClick(null, null);
|
||||
}
|
||||
@@ -112,6 +112,17 @@ namespace Lskj.PubBomImport
|
||||
if (dialogResult == DialogResult.OK)
|
||||
{
|
||||
Properties.Settings.Default.LastSelectFolder = Path.GetDirectoryName(dialog.FileName);
|
||||
string[] fileNames = dialog.FileNames;
|
||||
foreach (string fileName in fileNames)
|
||||
{
|
||||
string code = Path.GetFileNameWithoutExtension(fileName);
|
||||
GetFileCodeInfo(code, out string sourceCode, out string sourceName, out string sourceBB, out int sourceBC);
|
||||
int count = fileNames.Where(n => Path.GetFileNameWithoutExtension(n).Trim().StartsWith(code)).Count();
|
||||
if (count > 1)//只允许存在一个
|
||||
{
|
||||
throw new Exception($"{code}存在多条记录\r\n不允许重复");
|
||||
}
|
||||
}
|
||||
BomImpRtnModel bomImpRtnModel = new BomImpRtnModel()
|
||||
{
|
||||
ShowType = Model.ShowType,
|
||||
@@ -248,67 +259,83 @@ namespace Lskj.PubBomImport
|
||||
// this.Close();
|
||||
// }
|
||||
//}
|
||||
//else if (Model.ShowType.Equals("3"))//新增多个清单文件
|
||||
//{
|
||||
// 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.StartImportInQDFile(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("4"))//新增或修改单个清单文件
|
||||
else if (Model.ShowType.Equals("3"))//新增多个QD文件或图纸文件
|
||||
{
|
||||
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.StartImportInQDOrZZFiles(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("33"))//结构补充终审同步
|
||||
{
|
||||
|
||||
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.StartCreateBomAdd(productId);
|
||||
};
|
||||
frmProgress.ImportTimer.Enabled = true;
|
||||
frmProgress.ShowDialog();
|
||||
frmProgress.Dispose();
|
||||
}
|
||||
else if (Model.ShowType.Equals("4"))//修改单个文件
|
||||
{
|
||||
BomImpRtnModel bomImpRtnModel = new BomImpRtnModel()
|
||||
{
|
||||
@@ -336,7 +363,7 @@ namespace Lskj.PubBomImport
|
||||
bomImpRtnModel.CanSave = dialogResult == DialogResult.OK;
|
||||
frmProgress.Dispose();
|
||||
}
|
||||
else if (Model.ShowType.Equals("44"))//通过已经上传的数据来解析并且建立BOM
|
||||
else if (Model.ShowType.Equals("44"))//修改终审同步
|
||||
{
|
||||
|
||||
FrmProgress frmProgress = new FrmProgress();
|
||||
@@ -352,7 +379,7 @@ namespace Lskj.PubBomImport
|
||||
frmProgress.ShowDialog();
|
||||
frmProgress.Dispose();
|
||||
}
|
||||
else if (Model.ShowType.Equals("5"))//通过文件名进行文件上传和逻辑记录
|
||||
else if (Model.ShowType.Equals("5"))//bom结构上传
|
||||
{
|
||||
BomImpRtnModel bomImpRtnModel = new BomImpRtnModel()
|
||||
{
|
||||
@@ -412,7 +439,7 @@ namespace Lskj.PubBomImport
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
else if (Model.ShowType.Equals("55"))//通过已经上传的数据来解析并且建立BOM
|
||||
else if (Model.ShowType.Equals("55"))//结构上传终审同步
|
||||
{
|
||||
|
||||
FrmProgress frmProgress = new FrmProgress();
|
||||
|
||||
Reference in New Issue
Block a user