SVN-Revision: r465
This commit is contained in:
wyf
2025-04-09 09:46:51 +00:00
parent ffa4627f8f
commit acdaa6dc8a
+95 -29
View File
@@ -955,9 +955,13 @@ namespace Lskj.PubBill
DataRow rowItem = btn.Tag as DataRow;
if (rowItem["dllname"].Equals("Lskj.PubBomImport.dll"))
{
if (!this.BillSave(0, false))
GridRightMenuModel model = new GridRightMenuModel(rowItem);
if ((model.ParamList[7] + "").Equals("3"))
{
return;
if (!this.BillSave(0, false))
{
return;
}
}
}
CommonMenu menu = new CommonMenu(this.SysModel, this.ControlObj, this.gcMain);
@@ -2593,25 +2597,6 @@ namespace Lskj.PubBill
if (!string.IsNullOrWhiteSpace(e.MemuModel.ResultSQL))
{
string resultSql = e.MemuModel.ResultSQL;
if (e.DialogModel != null && e.DialogModel.DialogDllName.Equals("Lskj.PubBomImport.dll", StringComparison.OrdinalIgnoreCase)&& e.DialogModel.ReturnTag.ToString()=="3")
{
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();
}else
if (e.DialogModel != null && e.DialogModel.DialogDllName.Equals("lskj.pubadd.dll", StringComparison.OrdinalIgnoreCase) && e.DialogModel.PubDialogType == DialogType.PubAddRecord)
{
if (e.DialogModel.ReturnTag != null && e.DialogModel.ReturnTag is MyControl)
@@ -2625,7 +2610,7 @@ namespace Lskj.PubBill
{
this.AddRowToGridView(item);
}
}
}
else
{
resultSql = this.ControlObj.ReplaceControlValue(resultSql);
@@ -2635,8 +2620,71 @@ namespace Lskj.PubBill
this.AddRowToGridView(item, false);
}
}
}
if (e.DialogModel != null && e.DialogModel.DialogDllName.Equals("Lskj.PubBomImport.dll", StringComparison.OrdinalIgnoreCase))
{
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)
{
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)
{
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName).Trim();
if (fileNameWithoutExtension.StartsWith("QD") || fileNameWithoutExtension.StartsWith("ZZQD"))
{
Match namematch = Regex.Match(fileNameWithoutExtension, namepattern);
if (namematch.Success)
{
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;
dataTable.Rows.Add(addRow);
filesDic.Add(fileNameWithoutExtension, fileName);
}
}
}
}
gcMain.GridView.Tag = filesDic;
foreach (DataRow item in dataTable.Rows)
{
this.AddRowToGridView(item, true);
}
}
//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)
@@ -3141,7 +3189,9 @@ namespace Lskj.PubBill
{
unionValues = ReplaceHelper.ReplaceRowParam(rowItem, unionValues.Replace("{" + model.FieldName + "}", fieldValue));
if (this.ControlObj != null)
{
unionValues = ControlObj.ReplaceParentControlValue(unionValues);
}
try
{
string[] fields = model.UnionFields.Trim(',').Split(',');
@@ -3421,9 +3471,9 @@ namespace Lskj.PubBill
{
if (!string.IsNullOrEmpty(model.UnionFields))
{
this.SetUnionValue(model, fieldValue + "", newRow);
this.SetUnionValue(model, newRow[col.FieldName] + "", newRow);
}
SetCalcValue(model, fieldValue + "", newRow);
SetCalcValue(model, newRow[col.FieldName] + "", newRow);
}
//计算规则配置在结果字段上,所以无需验证当前操作控件
//this.gcMain.GridView.SetFocusedRowCellValue(col, fieldValue);
@@ -3431,14 +3481,17 @@ namespace Lskj.PubBill
}
else if (!string.IsNullOrEmpty(model.DefaultValue))
{
newRow[col.FieldName] = fieldValue;
if (string.IsNullOrEmpty(newRow[col.FieldName] + ""))
{
newRow[col.FieldName] = fieldValue;
}
if (dataProcessing)
{
if (!string.IsNullOrEmpty(model.UnionFields))
{
this.SetUnionValue(model, fieldValue + "", newRow);
this.SetUnionValue(model, newRow[col.FieldName] + "", newRow);
}
SetCalcValue(model, fieldValue + "", newRow);
SetCalcValue(model, newRow[col.FieldName] + "", newRow);
//this.gcMain.GridView.SetFocusedRowCellValue(col, fieldValue);
}
}
@@ -4448,6 +4501,19 @@ namespace Lskj.PubBill
bool saveResult = false;
if (this.ControlObj.VerifyNull())
{
//保存前执行某个右键
if (!string.IsNullOrEmpty(BillModel.BeforeBillSaveExec))
{
DataRow menuRow = BaseModuleImpl.GetBaseGridRightMenuById(BillModel.BeforeBillSaveExec);
if (menuRow != null)
{
CommonMenu menu = new CommonMenu(this.SysModel, this.ControlObj, this.gcMain);
menu.ApplyBefore += new CommonToolApplyEventHandler(OnMenuApplyBefore);
menu.DynamicLinkAfter += new CommonToolAfterDynamicLinkEventHandler(OnDynamicLinkAfter);
StaticControl.RightMenuGridView = gcMain.GridView;
menu.Apply(menuRow);
}
}
//虚构一个保存存储过程
DataTable tvp = new DataTable();
//更新前进行数据源筛选