From 40b107eb82009a55192c15196d027c93fb488cb7 Mon Sep 17 00:00:00 2001 From: cyf Date: Wed, 12 Feb 2025 06:26:04 +0000 Subject: [PATCH] SVN r263 SVN-Revision: r263 --- 插件库/Lskj.Control/AuditPanel2.cs | 50 ++----------------- 插件库/Lskj.Control/GridControlEx.cs | 6 ++- .../Lskj.Control/LabelMultiAutoTextEdit4.cs | 7 ++- 插件库/Lskj.Control/Model/GridColumnModel.cs | 11 ++++ 插件库/Lskj.Control/Model/MyControl.cs | 44 ++++++++++++---- .../MultiModelLookUp/FrmModelLookUp2.cs | 49 +++++++++++++++--- 6 files changed, 101 insertions(+), 66 deletions(-) diff --git a/插件库/Lskj.Control/AuditPanel2.cs b/插件库/Lskj.Control/AuditPanel2.cs index 6ee0ebf..03759ce 100644 --- a/插件库/Lskj.Control/AuditPanel2.cs +++ b/插件库/Lskj.Control/AuditPanel2.cs @@ -1645,17 +1645,6 @@ namespace Lskj.Control foreach (DataRow item in rowItems) { WaitForm.ShowForm("正在审核[" + item[this.BaseAccraditModelObj.TmpParmaryField] + "]单据!"); - //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, item[this.BaseAccraditModelObj.TmpStepField] + "", item[this.BaseAccraditModelObj.TmpParmaryField] + "", "", this.AuditComModelObj.ProcedureName, "F", "", "批量审批同意"); - - //if ("1".Equals(result)) - //{ - // success++; - //} - //else - //{ - // fault++; - // tipMsg = result + "\r\n"; - //} bool isComplete = true;//判断必填项 string BillDocumentId = item[this.BaseAccraditModelObj.TmpParmaryField] + "";//单据号 //主表必填 @@ -1754,6 +1743,7 @@ namespace Lskj.Control if (SelectGridControlEx != null && oldRowHandle > 0) { SelectGridControlEx.GridView.SelectRowHandler(oldRowHandle); + OnPcgridRowCellClick(SelectGridControlEx.GridView, null); } } @@ -2673,6 +2663,9 @@ namespace Lskj.Control /// public void RefreshTabPage() { + DataTable detailTable = gcDetail.GridControl.DataSourceTable(); + detailTable.Clear(); + this.ControlObj.ResetControlValue(); foreach (TabPageObj tab in this._tabPageObjs) { int cnt = 0; @@ -2749,37 +2742,4 @@ namespace Lskj.Control } catch (Exception ex) { - string Message = ErrorMessage.PromptErrorMessage(ex); - MessageUtil.Show(Message, ex.Message); - } - - } - #endregion - /// - /// 优化加载速度 - /// - protected override CreateParams CreateParams - { - get - { - CreateParams cp = base.CreateParams; - cp.ExStyle |= 0x02000000; - return cp; - } - } - - public EventHandler GridView_DoubleClick { get; set; } - - - /// - /// 导出明细 - /// - /// - /// - private void simpleButton2_Click(object sender, EventArgs e) - { - LogUtil.WriteDebug(this.SysModel.ModuleCode, "导出数据", this.SysModel.FormText, "单据明细导出", this.SysModel.ModuleId + ""); - this.gcDetail.GridControl.ToExcel(this.SysModel.FormText); - } - } -} \ No newline at end of file + string M \ No newline at end of file diff --git a/插件库/Lskj.Control/GridControlEx.cs b/插件库/Lskj.Control/GridControlEx.cs index 1a1587e..c3a053d 100644 --- a/插件库/Lskj.Control/GridControlEx.cs +++ b/插件库/Lskj.Control/GridControlEx.cs @@ -669,7 +669,7 @@ namespace Lskj.Control return; } - if (!string.IsNullOrEmpty(model.SqlSource)) + if (!string.IsNullOrEmpty(model.SqlSource) && !(model.FieldType == ControlType.LabSelectReturnIdNew || model.FieldType == ControlType.LabSelectReturnTextNew)) { Task sourceTask = new Task(() => { @@ -1047,6 +1047,7 @@ namespace Lskj.Control mLoading = true; try { + if (this.OnDataSourceBindCallBack != null) this.OnDataSourceBindCallBack(null, null); SetColumnsSource(); } catch (Exception ex) @@ -1056,7 +1057,7 @@ namespace Lskj.Control finally { mControlSourceDic.Clear(); - if (this.OnDataSourceBindCallBack != null) this.OnDataSourceBindCallBack(null, null); + } } else @@ -1070,6 +1071,7 @@ namespace Lskj.Control foreach (GridColumnModel item in mControlList) { if (this.DisableFieldSources && item.isVislble) continue; + if(item.FieldType == ControlType.LabSelectReturnIdNew || item.FieldType == ControlType.LabSelectReturnTextNew) continue; if (!string.IsNullOrWhiteSpace(item.SqlSource)) { DataTable dataTable = new DataTable(); diff --git a/插件库/Lskj.Control/LabelMultiAutoTextEdit4.cs b/插件库/Lskj.Control/LabelMultiAutoTextEdit4.cs index 0b99a81..4af6475 100644 --- a/插件库/Lskj.Control/LabelMultiAutoTextEdit4.cs +++ b/插件库/Lskj.Control/LabelMultiAutoTextEdit4.cs @@ -346,4 +346,9 @@ namespace Lskj.Control _lookUpForm.NewSourceSQL = sqlValue; _lookUpForm.AddModuleResult = Model.AddModuleResult; _lookUpForm.InitControls(UnionModuleCodel); - Di \ No newline at end of file + DialogResult result = _lookUpForm.ShowDialog(); + if (result == DialogResult.OK) + { + string value = Model.FieldType == ControlType.LabSelectReturnIdNew ? _lookUpForm.EditValue : _lookUpForm.EditText; + this.EditValue = value; + \ No newline at end of file diff --git a/插件库/Lskj.Control/Model/GridColumnModel.cs b/插件库/Lskj.Control/Model/GridColumnModel.cs index e2e7c23..70cfb58 100644 --- a/插件库/Lskj.Control/Model/GridColumnModel.cs +++ b/插件库/Lskj.Control/Model/GridColumnModel.cs @@ -361,6 +361,17 @@ namespace Lskj.Control.Model this._bandTitle = item.Table.Columns.Contains("bandTitle") ? item["bandTitle"] + "" : string.Empty; this._bandFields = item.Table.Columns.Contains("bandFields") ? item["bandFields"] + "" : string.Empty; this._fieldtype = item.Table.Columns.Contains("fieldsqltag") && !string.IsNullOrWhiteSpace(item["fieldsqltag"] + "") ? Convert.ToInt32(item["fieldsqltag"] + "") : 0; + + //if (this._fieldtype==116) + //{ + // this._fieldtype = 160; + //} + //if (this._fieldtype == 117) + //{ + // this._fieldtype = 161; + //} + + this._sqlSource = item.Table.Columns.Contains("fieldsql") && !string.IsNullOrWhiteSpace(item["fieldsql"] + "") ? item["fieldsql"] + "" : string.Empty; this._valueMember = item.Table.Columns.Contains("fieldsqlid") && !string.IsNullOrWhiteSpace(item["fieldsqlid"] + "") ? item["fieldsqlid"] + "" : "dm"; this._textMember = item.Table.Columns.Contains("fieldsqlname") && !string.IsNullOrWhiteSpace(item["fieldsqlname"] + "") ? item["fieldsqlname"] + "" : "mc"; diff --git a/插件库/Lskj.Control/Model/MyControl.cs b/插件库/Lskj.Control/Model/MyControl.cs index 2f5cde9..8dbea7d 100644 --- a/插件库/Lskj.Control/Model/MyControl.cs +++ b/插件库/Lskj.Control/Model/MyControl.cs @@ -211,6 +211,12 @@ namespace Lskj.Control.Model /// 弹出框右键 /// public BarItemLinkCollection rightItemLinks; + /// + /// 模块选择框 选中后返回关联的字典 + /// + public Dictionary ModuleResultDic = new Dictionary(); + + /// /// 控件Panel对象 /// @@ -1399,14 +1405,17 @@ namespace Lskj.Control.Model { model.SourceSql += "and 1<>1"; } - DataTable table = (model.FieldType == ControlType.LabSelectReturnIdNew || model.FieldType == ControlType.LabSelectReturnTextNew) ? new DataTable() : BaseImpl.GetDataTableResult(model.SourceSql); - if (mControlSourceDic.ContainsKey(model)) + DataTable table = new DataTable(); + if (model.FieldType != ControlType.LabSelectReturnIdNew && model.FieldType != ControlType.LabSelectReturnTextNew) { - table = mControlSourceDic[model].Result; - } - else - { - table = BaseImpl.GetDataTableResult(model.SourceSql); + if (mControlSourceDic.ContainsKey(model)) + { + table = mControlSourceDic[model].Result; + } + else + { + table = BaseImpl.GetDataTableResult(model.SourceSql); + } } //if (model.FieldType != ControlType.LabAutoCompleteValueParam && model.FieldType != ControlType.LabAutoCompleteTextParam && model.FieldType != ControlType.LabAutoCompleteValue && model.FieldType != ControlType.LabAutoCompleteText) // table = MainImpl.GetDataTableResult(model.SourceSql); @@ -2497,7 +2506,7 @@ namespace Lskj.Control.Model foreach (ControlModel model in this.ControlModels) { BaseUserControl control = FindControl(model); - if (!model.IsFixedValue) continue;//清空时该控件是否忽略 + if (model.IsFixedValue) continue;//清空时该控件是否忽略 // 树结构节点不清空数据 if (control != null && model.FieldType != ControlType.LabTreeType) { @@ -2795,7 +2804,14 @@ namespace Lskj.Control.Model valueBuilder.AppendFormat("N'{0}',", ParentKey); } - + if (ModuleResultDic!=null&& ModuleResultDic.Count>0) + { + foreach (string resultKey in ModuleResultDic.Keys) + { + fieldBuilder.Append(resultKey + ","); + valueBuilder.AppendFormat("N'{0}',", ModuleResultDic[resultKey].Replace("'", "''")); + } + } execSql = string.Format("insert into {0}({1}) values ({2})", tableName, fieldBuilder.ToString().TrimEnd(','), valueBuilder.ToString().TrimEnd(',')); } else @@ -2826,6 +2842,13 @@ namespace Lskj.Control.Model updateBuilder.Append(string.IsNullOrEmpty(fieldValue) ? string.Format("{0}={1}", model.FieldName, GetNullValue(model)) : string.Format("{0}=N'{1}',", model.FieldName, fieldValue.Replace("'", "''"))); } } + if (ModuleResultDic != null && ModuleResultDic.Count > 0) + { + foreach (string resultKey in ModuleResultDic.Keys) + { + updateBuilder.Append(string.Format("{0}=N'{1}',", resultKey, ModuleResultDic[resultKey].Replace("'", "''"))); + } + } if (!string.IsNullOrWhiteSpace(updateBuilder.ToString())) { execSql = string.Format("update {0} set {1} where {2}='{3}'", tableName, updateBuilder.ToString().TrimEnd(','), primaryKey, primaryValue); @@ -3736,7 +3759,8 @@ namespace Lskj.Control.Model /// System.Windows.Forms.Control. private System.Windows.Forms.Control InitControl(ControlModel model, bool isLoadBorder = true) { - if (!string.IsNullOrEmpty(model.SourceSql) && model.Visible) + + if (!string.IsNullOrEmpty(model.SourceSql)&& !(model.FieldType == ControlType.LabSelectReturnIdNew || model.FieldType == ControlType.LabSelectReturnTextNew)) { Task sourceTask = null; if (StaticControl.AddParentGrid.Key != null && Model != null && StaticControl.AddParentGrid.Key.Equals(Model.ModuleCode)) diff --git a/插件库/Lskj.Control/MultiModelLookUp/FrmModelLookUp2.cs b/插件库/Lskj.Control/MultiModelLookUp/FrmModelLookUp2.cs index b9f5f3f..e9154ea 100644 --- a/插件库/Lskj.Control/MultiModelLookUp/FrmModelLookUp2.cs +++ b/插件库/Lskj.Control/MultiModelLookUp/FrmModelLookUp2.cs @@ -555,7 +555,7 @@ namespace Lskj.Control.MultiModelLookUp ReplaceHelper.ReplaceWhereCond(this.NewSourceSQL) + where; this.DataSource = MainImpl.GetDataTableResult(sqlValue); this.SetSelectionBox(); - this.SetDefaultValue(); + //this.SetDefaultValue(); } /// @@ -636,7 +636,7 @@ namespace Lskj.Control.MultiModelLookUp this.SearchObj.ParentUnionField = this.ParentUnionField; this.pl_top.Height = 0; this.pl_top.Height = this.SearchObj.InitSearchControl(queryTable, this.pl_top); - this.SearchObj.OnSearchAfterCallBack += SearchObj_OnSearchAfterCallBack; + //this.SearchObj.OnSearchAfterCallBack += SearchObj_OnSearchAfterCallBack; if (LeftTreeViewEx != null && LeftTreeViewEx.TreeView.Nodes.Count > 0) { @@ -659,7 +659,7 @@ namespace Lskj.Control.MultiModelLookUp this.SetDefaultValue(); //查询 - if(this.SysModel.CsHasDefultSearch) this.SearchObj.SearchGrid(); + if (this.SysModel.CsHasDefultSearch) this.SearchObj.SearchGrid(); //单选模式不需要设置下方表中选中行 //if (!SingleChoiceMode) this.SetDefaultValue(); @@ -671,12 +671,9 @@ namespace Lskj.Control.MultiModelLookUp { if (isFirstSearch) { - //this.SetSelectionBox(); this.SetDefaultValue(); } isFirstSearch = false; - //this.SetSelectionBox(); - //this.SetReadOnlyColumns(); } #endregion @@ -813,7 +810,7 @@ namespace Lskj.Control.MultiModelLookUp DataRow rowItem = this.gcMain.GridView.GetFocusedDataRow(); if (rowItem != null) { - DataRow Item = (this.gcDetail.GridControl.DataSource as DataTable).Rows.Cast().FirstOrDefault(x => x[ValueMember] + "" == rowItem[ValueMember]+""); + DataRow Item = (this.gcDetail.GridControl.DataSource as DataTable).Rows.Cast().FirstOrDefault(x => x[ValueMember] + "" == rowItem[ValueMember] + ""); if (Item == null) (this.gcDetail.GridControl.DataSource as DataTable).Rows.Add(rowItem.ItemArray); rowItem.AcceptChanges(); } @@ -833,13 +830,49 @@ namespace Lskj.Control.MultiModelLookUp /// The instance containing the event data. private void OnRowCellClickRadio(object sender, EventArgs e) { - + EditValue = string.Empty; + EditText = string.Empty; + ModuleResultDic.Clear(); DataRow dr = this.gcMain.GridView.GetFocusedDataRow(); if (dr != null) { this.EditValue = dr[ValueMember] + ""; this.EditText = dr[TextField] + ""; + if (!string.IsNullOrEmpty(AddModuleResult)) + { + string[] resultFields = AddModuleResult.Split(','); + foreach (string resultField in resultFields) + { + Match match = Regex.Match(resultField, @"^\s*([^\s]+)\s+AS\s+([^\s]+)\s*$", RegexOptions.IgnoreCase); + if (match.Success) + { + string beforeAs = match.Groups[1].Value.Trim(); + string afterAs = match.Groups[2].Value.Trim(); + string value = ""; + + if (dr.Table.Columns.Contains(beforeAs)) + { + value += dr[beforeAs] + ""; + } + + ModuleResultDic.Add(afterAs, value); + } + else + { + string value = ""; + + if (dr.Table.Columns.Contains(resultField)) + { + value += dr[resultField] + ""; + } + + ModuleResultDic.Add(resultField, value); + } + } + } + + this.DialogResult = DialogResult.OK; this.Close(); }