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> /// </summary>
/// <param name="e"></param> /// <param name="e"></param>
protected void OnDynamicLinkAfter(ApplyArgs e) protected void OnDynamicLinkAfter(object sender, ApplyArgs e)
{ {
try try
{ {
@@ -2625,66 +2625,54 @@ namespace Lskj.PubBill
{ {
if (e.DialogModel.ReturnTag != null && e.DialogModel.ReturnTag is BomImpRtnModel impRtnModel) if (e.DialogModel.ReturnTag != null && e.DialogModel.ReturnTag is BomImpRtnModel impRtnModel)
{ {
DataTable sourceTable = gcMain.gridControl.DataSourceTable(); if (impRtnModel.ShowType.Equals("3"))//执行保存
if (sourceTable != null && impRtnModel.ShowType.Equals("0") && impRtnModel.FileNames != null)
{ {
string afterBomFieldName = impRtnModel.AfterBomFieldName; CommonMenu menu = (CommonMenu)sender;
DataTable dataTable = new DataTable(); menu.issuccess = impRtnModel.CanSave;
dataTable.Columns.Add(afterBomFieldName); }
IEnumerable<DataRow> rowsIEnumerable = sourceTable.Rows.Cast<DataRow>(); else if (impRtnModel.ShowType.Equals("0"))//返回文件
string namepattern = @"^(.+?)\s+(.+)$"; {
Dictionary<string, string> filesDic = new Dictionary<string, string>(); DataTable sourceTable = gcMain.gridControl.DataSourceTable();
foreach (string fileName in impRtnModel.FileNames) if (sourceTable != null && impRtnModel.FileNames != null)
{ {
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName).Trim(); string afterBomFieldName = impRtnModel.AfterBomFieldName;
if (fileNameWithoutExtension.StartsWith("QD") || fileNameWithoutExtension.StartsWith("ZZQD")) 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); string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName).Trim();
if (namematch.Success) if (fileNameWithoutExtension.StartsWith("QD") || fileNameWithoutExtension.StartsWith("ZZQD"))
{ {
string code = namematch.Groups[1].Value; Match namematch = Regex.Match(fileNameWithoutExtension, namepattern);
string name = namematch.Groups[2].Value; if (namematch.Success)
//找到code相同的行
DataRow selectRow = rowsIEnumerable.Where(n => (n[afterBomFieldName] + "").Trim().StartsWith(code, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (selectRow == null)
{ {
DataRow addRow = dataTable.NewRow(); string code = namematch.Groups[1].Value;
addRow[afterBomFieldName] = fileNameWithoutExtension; string name = namematch.Groups[2].Value;
dataTable.Rows.Add(addRow); //找到code相同的行
filesDic.Add(fileNameWithoutExtension, fileName); 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);
}
} }
} }
} }
} foreach (DataRow item in dataTable.Rows)
gcMain.GridView.Tag = filesDic; {
foreach (DataRow item in dataTable.Rows) DataRow sourceRow = this.AddRowToGridView(item, true);
{ filesDic.Add(sourceRow, item["BomFieldNameDir"] + "");
this.AddRowToGridView(item, true); }
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) catch (Exception)
@@ -3377,7 +3365,7 @@ namespace Lskj.PubBill
/// </summary> /// </summary>
/// <param name="rowItem">The row item.</param> /// <param name="rowItem">The row item.</param>
/// <param name="unionModel">The union model.</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; GridColumnCollection gridColumns = this.gcMain.GridView.Columns;
DataTable gridTable = (this.gcMain.GridControl.DataSource as DataTable).TrimDeleteRows(); DataTable gridTable = (this.gcMain.GridControl.DataSource as DataTable).TrimDeleteRows();
@@ -3399,7 +3387,9 @@ namespace Lskj.PubBill
{ {
DialogResult dialog = MessageUtil.Show(ResourceKeys.ProductIsRepet, MessageBoxButtons.YesNo); DialogResult dialog = MessageUtil.Show(ResourceKeys.ProductIsRepet, MessageBoxButtons.YesNo);
if (dialog != DialogResult.Yes) if (dialog != DialogResult.Yes)
return; {
return null;
}
} }
} }
} }
@@ -3558,6 +3548,7 @@ namespace Lskj.PubBill
gridTable.OrderBy(this.BillModel.DetailOrderField); gridTable.OrderBy(this.BillModel.DetailOrderField);
this.gcMain.GridView.UpdateCurrentRow(); this.gcMain.GridView.UpdateCurrentRow();
this.gcMain.GridView.ShowEditor(); this.gcMain.GridView.ShowEditor();
return newRow;
} }
/// <summary> /// <summary>
/// <para>说明:添加多行到单据明细中</para> /// <para>说明:添加多行到单据明细中</para>
@@ -4512,6 +4503,10 @@ namespace Lskj.PubBill
menu.DynamicLinkAfter += new CommonToolAfterDynamicLinkEventHandler(OnDynamicLinkAfter); menu.DynamicLinkAfter += new CommonToolAfterDynamicLinkEventHandler(OnDynamicLinkAfter);
StaticControl.RightMenuGridView = gcMain.GridView; StaticControl.RightMenuGridView = gcMain.GridView;
menu.Apply(menuRow); menu.Apply(menuRow);
if (!menu.issuccess)
{
return false;
}
} }
} }
//虚构一个保存存储过程 //虚构一个保存存储过程
+1 -1
View File
@@ -35,4 +35,4 @@ namespace Lskj.PubBill
try try
{ {
FrmMain main = new FrmMain(); FrmMain main = new FrmMain();
DynamicBillModel D
+6 -6
View File
@@ -49,7 +49,7 @@ namespace Lskj.PubBill
/// <summary> /// <summary>
/// 第一次进入页面 /// 第一次进入页面
/// </summary> /// </summary>
public bool isInitialization=true; public bool isInitialization = true;
public FrmMain() public FrmMain()
@@ -92,7 +92,7 @@ namespace Lskj.PubBill
DataRow rowItem = BaseImpl.GetDataRowResult(sqlValue); DataRow rowItem = BaseImpl.GetDataRowResult(sqlValue);
if (rowItem != null) if (rowItem != null)
{ {
CommonMenu menu = new CommonMenu(this.SysModel, this.billModule1.ControlObj,this.billModule1.gcMainDetilObj); CommonMenu menu = new CommonMenu(this.SysModel, this.billModule1.ControlObj, this.billModule1.gcMainDetilObj);
menu.DynamicLinkAfter += new CommonToolAfterDynamicLinkEventHandler(OnDynamicLinkAfter); menu.DynamicLinkAfter += new CommonToolAfterDynamicLinkEventHandler(OnDynamicLinkAfter);
menu.Apply(rowItem); menu.Apply(rowItem);
} }
@@ -123,9 +123,9 @@ namespace Lskj.PubBill
/// 执行完成后若是取消状态则关闭当前界面 /// 执行完成后若是取消状态则关闭当前界面
/// </summary> /// </summary>
/// <param name="e"></param> /// <param name="e"></param>
private void OnDynamicLinkAfter(ApplyArgs e) private void OnDynamicLinkAfter(object sender, ApplyArgs e)
{ {
if(e.DialogModel!= null && e.DialogModel.PubDialogType== DialogType.Pubcolsed) if (e.DialogModel != null && e.DialogModel.PubDialogType == DialogType.Pubcolsed)
{ {
this.Close(); this.Close();
} }
@@ -175,6 +175,6 @@ namespace Lskj.PubBill
private void FrmMain_Activated(object sender, EventArgs e) private void FrmMain_Activated(object sender, EventArgs e)
{ {
if (isInitialization) if (isInitialization)
{ {
this.billModule1.txtinputobj.Fo