SVN-Revision: r470
This commit is contained in:
wyf
2025-04-10 02:57:24 +00:00
parent ed3970aba7
commit 54bfc1eae3
3 changed files with 54 additions and 59 deletions
+47 -52
View File
@@ -2590,7 +2590,7 @@ namespace Lskj.PubBill
/// 动态链接库执行完成后
/// </summary>
/// <param name="e"></param>
protected void OnDynamicLinkAfter(ApplyArgs e)
protected void OnDynamicLinkAfter(object sender, ApplyArgs e)
{
try
{
@@ -2625,66 +2625,54 @@ namespace Lskj.PubBill
{
if (e.DialogModel.ReturnTag != null && e.DialogModel.ReturnTag is BomImpRtnModel impRtnModel)
{
DataTable sourceTable = gcMain.gridControl.DataSourceTable();
if (sourceTable != null && impRtnModel.ShowType.Equals("0") && impRtnModel.FileNames != null)
if (impRtnModel.ShowType.Equals("3"))//执行保存
{
string afterBomFieldName = impRtnModel.AfterBomFieldName;
DataTable dataTable = new DataTable();
dataTable.Columns.Add(afterBomFieldName);
IEnumerable<DataRow> rowsIEnumerable = sourceTable.Rows.Cast<DataRow>();
string namepattern = @"^(.+?)\s+(.+)$";
Dictionary<string, string> filesDic = new Dictionary<string, string>();
foreach (string fileName in impRtnModel.FileNames)
CommonMenu menu = (CommonMenu)sender;
menu.issuccess = impRtnModel.CanSave;
}
else if (impRtnModel.ShowType.Equals("0"))//返回文件
{
DataTable sourceTable = gcMain.gridControl.DataSourceTable();
if (sourceTable != null && impRtnModel.FileNames != null)
{
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName).Trim();
if (fileNameWithoutExtension.StartsWith("QD") || fileNameWithoutExtension.StartsWith("ZZQD"))
string afterBomFieldName = impRtnModel.AfterBomFieldName;
DataTable dataTable = new DataTable();
dataTable.Columns.Add(afterBomFieldName);
dataTable.Columns.Add("BomFieldNameDir");
IEnumerable<DataRow> rowsIEnumerable = sourceTable.Rows.Cast<DataRow>();
string namepattern = @"^(.+?)\s+(.+)$";
Dictionary<DataRow, string> filesDic = new Dictionary<DataRow, string>();
foreach (string fileName in impRtnModel.FileNames)
{
Match namematch = Regex.Match(fileNameWithoutExtension, namepattern);
if (namematch.Success)
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName).Trim();
if (fileNameWithoutExtension.StartsWith("QD") || fileNameWithoutExtension.StartsWith("ZZQD"))
{
string code = namematch.Groups[1].Value;
string name = namematch.Groups[2].Value;
//找到code相同的行
DataRow selectRow = rowsIEnumerable.Where(n => (n[afterBomFieldName] + "").Trim().StartsWith(code, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (selectRow == null)
Match namematch = Regex.Match(fileNameWithoutExtension, namepattern);
if (namematch.Success)
{
DataRow addRow = dataTable.NewRow();
addRow[afterBomFieldName] = fileNameWithoutExtension;
dataTable.Rows.Add(addRow);
filesDic.Add(fileNameWithoutExtension, fileName);
string code = namematch.Groups[1].Value;
string name = namematch.Groups[2].Value;
//找到code相同的行
DataRow selectRow = rowsIEnumerable.Where(n => (n[afterBomFieldName] + "").Trim().StartsWith(code, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (selectRow == null)
{
DataRow addRow = dataTable.NewRow();
addRow[afterBomFieldName] = fileNameWithoutExtension;
addRow["BomFieldNameDir"] = fileName;
dataTable.Rows.Add(addRow);
}
}
}
}
}
gcMain.GridView.Tag = filesDic;
foreach (DataRow item in dataTable.Rows)
{
this.AddRowToGridView(item, true);
foreach (DataRow item in dataTable.Rows)
{
DataRow sourceRow = this.AddRowToGridView(item, true);
filesDic.Add(sourceRow, item["BomFieldNameDir"] + "");
}
gcMain.GridView.Tag = filesDic;
}
}
//else if (impRtnModel.ShowType.Equals("3"))
//{
// //刷新明细
// string billNo = this.lblOrderNo.Text;
// this.SetBillStatus(BillImpl.GetDataRowResult(string.Format("select * from {0} where {1}='{2}'", BillModel.MasterTable, BillModel.PrimaryKey, billNo)));
//}
}
//DataRow dataRow = this.gcMain.GridView.GetFocusedDataRow();
//string[] strArrlist = resultSql.Split('^');
//if (strArrlist.Count() != 3) return;
//string selectSql = ReplaceHelper.ReplaceRowParam(dataRow, strArrlist[0]);
//string isUpadSql = ReplaceHelper.ReplaceRowParam(dataRow, strArrlist[1]);
//DataRow fileRow = BaseImpl.GetDataRowResult(selectSql);
//string Billdocument_Id = fileRow != null ? fileRow["Billdocument_Id"] + "" : string.Empty;
//dataRow["qms_laddf_RelatedId"] = Billdocument_Id;
//if (fileRow != null && BaseImpl.GetDataRowResult(isUpadSql) != null)
//{
// string upadSql = ReplaceHelper.ReplaceRowParam(fileRow, strArrlist[2]);
// upadSql = ReplaceHelper.ReplaceRowParam(dataRow, strArrlist[2]);
// SqlHelper.ExecuteNonQuery(upadSql);
//}
//this.gcMain.GridView.UpdateCurrentRow();
//this.gcMain.GridView.ShowEditor();
}
}
catch (Exception)
@@ -3377,7 +3365,7 @@ namespace Lskj.PubBill
/// </summary>
/// <param name="rowItem">The row item.</param>
/// <param name="unionModel">The union model.</param>
private void AddRowToGridView(DataRow rowItem, bool dataProcessing = true)
private DataRow AddRowToGridView(DataRow rowItem, bool dataProcessing = true)
{
GridColumnCollection gridColumns = this.gcMain.GridView.Columns;
DataTable gridTable = (this.gcMain.GridControl.DataSource as DataTable).TrimDeleteRows();
@@ -3399,7 +3387,9 @@ namespace Lskj.PubBill
{
DialogResult dialog = MessageUtil.Show(ResourceKeys.ProductIsRepet, MessageBoxButtons.YesNo);
if (dialog != DialogResult.Yes)
return;
{
return null;
}
}
}
}
@@ -3558,6 +3548,7 @@ namespace Lskj.PubBill
gridTable.OrderBy(this.BillModel.DetailOrderField);
this.gcMain.GridView.UpdateCurrentRow();
this.gcMain.GridView.ShowEditor();
return newRow;
}
/// <summary>
/// <para>说明:添加多行到单据明细中</para>
@@ -4512,6 +4503,10 @@ namespace Lskj.PubBill
menu.DynamicLinkAfter += new CommonToolAfterDynamicLinkEventHandler(OnDynamicLinkAfter);
StaticControl.RightMenuGridView = gcMain.GridView;
menu.Apply(menuRow);
if (!menu.issuccess)
{
return false;
}
}
}
//虚构一个保存存储过程