From 533029e0012fafd43eb7cad9c46f2ec7d16c27cb Mon Sep 17 00:00:00 2001 From: cyf Date: Sun, 28 Sep 2025 06:50:51 +0000 Subject: [PATCH] SVN r1000 SVN-Revision: r1000 --- 插件库/Lskj.Control/AuditPanel2.cs | 30 ++- 插件库/Lskj.Control/AuditPanelEx.cs | 26 +- 插件库/Lskj.Control/FrmExport.cs | 15 +- 插件库/Lskj.Control/FrmWebBrowser.cs | 5 +- 插件库/Lskj.Control/GridControlEx.cs | 252 ++++++++++++++++-- 插件库/Lskj.Control/Model/ControlModel.cs | 2 +- 插件库/Lskj.Control/Model/GridColumnModel.cs | 9 +- .../Model/MenuStrip/BaseMenuStrip.cs | 8 + 插件库/Lskj.Control/Model/MyControl.cs | 2 +- 插件库/Lskj.Control/ModuleGridDetailEx.cs | 117 ++++---- 10 files changed, 354 insertions(+), 112 deletions(-) diff --git a/插件库/Lskj.Control/AuditPanel2.cs b/插件库/Lskj.Control/AuditPanel2.cs index a883d98..7d0c604 100644 --- a/插件库/Lskj.Control/AuditPanel2.cs +++ b/插件库/Lskj.Control/AuditPanel2.cs @@ -1750,7 +1750,8 @@ namespace Lskj.Control if (isComplete) { 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", "", "批量审批同意"); + //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, item[this.BaseAccraditModelObj.TmpStepField] + "", item[this.BaseAccraditModelObj.TmpParmaryField] + "", "", this.AuditComModelObj.ProcedureName, "F", "", "批量审批同意"); + string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText,this.SysModel, item[this.BaseAccraditModelObj.TmpStepField] + "", item[this.BaseAccraditModelObj.TmpParmaryField] + "", "", this.AuditComModelObj.ProcedureName, "F", "", "批量审批同意"); if ("1".Equals(result)) { @@ -1759,7 +1760,7 @@ namespace Lskj.Control else { fault++; - tipMsg = result + "\r\n"; + tipMsg = msgText + "\r\n"; } } else @@ -1896,7 +1897,10 @@ namespace Lskj.Control { if (!SaveBillData(0, false)) return; - string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, frmExamine.txtRemark.EditText, remindOpers, confirmOpers); + //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, frmExamine.txtRemark.EditText, remindOpers, confirmOpers); + string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, frmExamine.txtRemark.EditText, remindOpers, confirmOpers); + + if ("1".Equals(result)) { MessageUtil.Show(ResourceKeys.AuditSuccess); @@ -1907,7 +1911,7 @@ namespace Lskj.Control } else { - MessageUtil.Show(ResourceKeys.AuditFail + "\r\n" + result); + MessageUtil.Show(ResourceKeys.AuditFail + "\r\n" + msgText); } } } @@ -2236,7 +2240,9 @@ namespace Lskj.Control string nextSelectStepCode = string.Empty; string nextSelectStepOper = string.Empty; WaitForm.ShowForm("正在返退[" + item[this.BaseAccraditModelObj.TmpParmaryField] + "]单据!"); - string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "R", "0", this._auditAdvice, "", "", true, ret); + //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "R", "0", this._auditAdvice, "", "", true, ret); + string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "R", "0", this._auditAdvice, "", "", true, ret); + if ("1".Equals(result)) { success++; @@ -2244,7 +2250,7 @@ namespace Lskj.Control else { fault++; - tipMsg = result + "\r\n"; + tipMsg = msgText + "\r\n"; } firstLoad = false; } @@ -2260,7 +2266,9 @@ namespace Lskj.Control { string nextSelectStepCode = string.Empty; string nextSelectStepOper = string.Empty; - string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "R", "0", this._auditAdvice, "", "", true, ret); + //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "R", "0", this._auditAdvice, "", "", true, ret); + string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "R", "0", this._auditAdvice, "", "", true, ret); + if (result == "1") { MessageUtil.Show(ResourceKeys.ForcedSuccess); @@ -2270,7 +2278,7 @@ namespace Lskj.Control } else { - MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, result)); + MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, msgText)); } } } @@ -2713,7 +2721,9 @@ namespace Lskj.Control Convert.ToInt32(stepCode) >= Convert.ToInt32(this.SectionAccradit["stepCode"] + ""); string prodouceName = isBack ? AuditComModelObj.ProcedureName + "back" : AuditComModelObj.ProcedureName; - string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, stepCode, billDocumentId, isBack ? string.Format(ResourceKeys.ForcedReturnBill, billDocumentId) + "" : "", prodouceName, "R", "0", hintMsg, "", "", !isBack, -1, 0, true); + // string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, stepCode, billDocumentId, isBack ? string.Format(ResourceKeys.ForcedReturnBill, billDocumentId) + "" : "", prodouceName, "R", "0", hintMsg, "", "", !isBack, -1, 0, true); + string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper,out string msgText, this.SysModel, stepCode, billDocumentId, isBack ? string.Format(ResourceKeys.ForcedReturnBill, billDocumentId) + "" : "", prodouceName, "R", "0", hintMsg, "", "", !isBack, -1, 0, true); + string tag = isBack ? "1" : "0"; if (result == "1") { @@ -2743,7 +2753,7 @@ namespace Lskj.Control } else { - MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, result)); + MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, msgText)); } } } diff --git a/插件库/Lskj.Control/AuditPanelEx.cs b/插件库/Lskj.Control/AuditPanelEx.cs index 61b1de0..2c396fc 100644 --- a/插件库/Lskj.Control/AuditPanelEx.cs +++ b/插件库/Lskj.Control/AuditPanelEx.cs @@ -949,7 +949,9 @@ namespace Lskj.Control return; } } - string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, stepCode, billDocumentId, isBack ? string.Format(ResourceKeys.ForcedReturnBill, billDocumentId) + "" : "", prodouceName, "R", "0", hintMsg, "", "", !isBack, -1, 0, true); + //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, stepCode, billDocumentId, isBack ? string.Format(ResourceKeys.ForcedReturnBill, billDocumentId) + "" : "", prodouceName, "R", "0", hintMsg, "", "", !isBack, -1, 0, true); + string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, stepCode, billDocumentId, isBack ? string.Format(ResourceKeys.ForcedReturnBill, billDocumentId) + "" : "", prodouceName, "R", "0", hintMsg, "", "", !isBack, -1, 0, true); + string tag = isBack ? "1" : "0"; if (result == "1") { @@ -988,7 +990,7 @@ namespace Lskj.Control } else { - MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, result)); + MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, msgText)); } } //if (MessageUtil.Show(string.Format(ResourceKeys.ForcedReturnBill, billDocumentId), MessageBoxButtons.YesNo) == DialogResult.Yes) @@ -1075,7 +1077,9 @@ namespace Lskj.Control } } } - string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, stepCode, billDocumentId, isBack ? string.Format(ResourceKeys.ForcedReturnBill, billDocumentId) + "" : "", prodouceName, "R", "0", hintMsg, "", "", !isBack, -1, 0, true); + //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, stepCode, billDocumentId, isBack ? string.Format(ResourceKeys.ForcedReturnBill, billDocumentId) + "" : "", prodouceName, "R", "0", hintMsg, "", "", !isBack, -1, 0, true); + string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, stepCode, billDocumentId, isBack ? string.Format(ResourceKeys.ForcedReturnBill, billDocumentId) + "" : "", prodouceName, "R", "0", hintMsg, "", "", !isBack, -1, 0, true); + tag = isBack ? "1" : "0"; if (result == "1") { @@ -1105,7 +1109,7 @@ namespace Lskj.Control { //MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, result)); fault++; - tipMsg += result + "\r\n"; + tipMsg += msgText + "\r\n"; } firstLoad = false; @@ -1322,7 +1326,9 @@ namespace Lskj.Control break; } } - string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, stepCode, BillDocumentId, "", this.AuditComModelObj.ProcedureName, "F", "", "批量审批同意"); + //string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, stepCode, BillDocumentId, "", this.AuditComModelObj.ProcedureName, "F", "", "批量审批同意"); + string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText, this.SysModel, stepCode, BillDocumentId, "", this.AuditComModelObj.ProcedureName, "F", "", "批量审批同意"); + if ("1".Equals(result)) { #region 审核成功后调用API @@ -1339,7 +1345,7 @@ namespace Lskj.Control else { fault++; - tipMsg += result + "\r\n"; + tipMsg += msgText + "\r\n"; } } else @@ -1471,8 +1477,10 @@ namespace Lskj.Control break; } } - string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, - this.SysModel, stepCode, billDocumentId, "", this.AuditComModelObj.ProcedureName, "R", "", _auditAdvice, remindOpers, confirmOpers, true, ret); + // string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, + //this.SysModel, stepCode, billDocumentId, "", this.AuditComModelObj.ProcedureName, "R", "", _auditAdvice, remindOpers, confirmOpers, true, ret); + string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, out string msgText, + this.SysModel, stepCode, billDocumentId, "", this.AuditComModelObj.ProcedureName, "R", "", _auditAdvice, remindOpers, confirmOpers, true, ret); string tag = isBack ? "1" : "0"; if (result == "1") { @@ -1500,7 +1508,7 @@ namespace Lskj.Control else { fault++; - tipMsg += result + "\r\n"; + tipMsg += msgText + "\r\n"; } firstLoad = false; } diff --git a/插件库/Lskj.Control/FrmExport.cs b/插件库/Lskj.Control/FrmExport.cs index 4dc775f..df0d7ea 100644 --- a/插件库/Lskj.Control/FrmExport.cs +++ b/插件库/Lskj.Control/FrmExport.cs @@ -133,7 +133,7 @@ namespace Lskj.Control hasBoolean = true; } GridColumnModel model = col.Tag as GridColumnModel; - if (model != null && (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabTreeLookValue || model.FieldType == ControlType.LabMultiSelectValueParam || model.FieldType == ControlType.LabSelectReturnId|| (model.FieldType == ControlType.LabSelectReturnIdNew && model.ModuleFrameDisplayText))) + if (model != null && (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabTreeLookValue || model.FieldType == ControlType.LabMultiSelectValueParam || model.FieldType == ControlType.LabSelectReturnId || (model.FieldType == ControlType.LabSelectReturnIdNew && model.ModuleFrameDisplayText))) { StoreValueList.Add(col.FieldName); hasBoolean = true; @@ -455,7 +455,7 @@ namespace Lskj.Control } GridColumnModel model = col.Tag as GridColumnModel; - if (model != null && (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabTreeLookValue || model.FieldType == ControlType.LabMultiSelectValueParam || model.FieldType == ControlType.LabSelectReturnId|| (model.FieldType == ControlType.LabSelectReturnIdNew && model.ModuleFrameDisplayText))) + if (model != null && (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabTreeLookValue || model.FieldType == ControlType.LabMultiSelectValueParam || model.FieldType == ControlType.LabSelectReturnId || (model.FieldType == ControlType.LabSelectReturnIdNew && model.ModuleFrameDisplayText))) { StoreValueList.Add(col.FieldName); hasBoolean = true; @@ -620,10 +620,10 @@ namespace Lskj.Control if (gridColumn.Tag is GridColumnModel) { GridColumnModel model = gridColumn.Tag as GridColumnModel; - + if ((model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabMultiSelectValueParam) && row[col.ColumnName].ToString().Contains(",") || - (model.FieldType == ControlType.LabSelectReturnId && !model.IsRadio) || + (model.FieldType == ControlType.LabSelectReturnId && !model.IsRadio) || (model.FieldType == ControlType.LabSelectReturnIdNew && !model.IsRadio && model.ModuleFrameDisplayText)) { string[] cellText = row[col.ColumnName].ToString().Split(','); @@ -750,7 +750,6 @@ namespace Lskj.Control { for (int i = 1; i < this.gridView1.Columns.Count; i++) { - string columnName = this.gridView1.Columns[i].FieldName; GridSummaryItem gsi = gridView.Columns[columnName].SummaryItem; if (gsi.SummaryType != DevExpress.Data.SummaryItemType.None) //gsi.SummaryValue!=null&& !string.IsNullOrEmpty(gsi.SummaryValue.ToString()) @@ -769,8 +768,6 @@ namespace Lskj.Control } } - - } } } @@ -975,10 +972,10 @@ namespace Lskj.Control } } - else if (model.FieldType == ControlType.LabSelectReturnId|| (model.FieldType == ControlType.LabSelectReturnIdNew&& model.ModuleFrameDisplayText)) + else if (model.FieldType == ControlType.LabSelectReturnId || (model.FieldType == ControlType.LabSelectReturnIdNew && model.ModuleFrameDisplayText)) { string sqlValue = model.SqlSource; - if ((model.IsRadio && !string.IsNullOrWhiteSpace(model.addModuleld))|| model.FieldType == ControlType.LabSelectReturnIdNew) + if ((model.IsRadio && !string.IsNullOrWhiteSpace(model.addModuleld)) || model.FieldType == ControlType.LabSelectReturnIdNew) { //单选模式数据源为模块sql 新版模块选中返回id固定位模块sql DataRow modelRow = Business.Impl.MainImpl.GetSystemdllTab(model.addModuleld); diff --git a/插件库/Lskj.Control/FrmWebBrowser.cs b/插件库/Lskj.Control/FrmWebBrowser.cs index c2a3b67..1fd4a22 100644 --- a/插件库/Lskj.Control/FrmWebBrowser.cs +++ b/插件库/Lskj.Control/FrmWebBrowser.cs @@ -116,4 +116,7 @@ namespace Lskj.Control } if (hasEn || eqParams[0].ToLower() == "username" || eqParams[0].ToLower() == "password") { - pms.Add(eqParams[0], \ No newline at end of file + pms.Add(eqParams[0], eqParams[1]); + } + else + \ No newline at end of file diff --git a/插件库/Lskj.Control/GridControlEx.cs b/插件库/Lskj.Control/GridControlEx.cs index 210761c..d001b98 100644 --- a/插件库/Lskj.Control/GridControlEx.cs +++ b/插件库/Lskj.Control/GridControlEx.cs @@ -480,23 +480,19 @@ namespace Lskj.Control } #region LabPicUrl控件实现事件 //this.gridView.CustomUnboundColumnData += OnGridViewCustomUnboundColumnData; - //this.gridView.DoubleClick += OnShowImageDoubleClick; + //this.gridView.DoubleClick += OnShowImageDoubleClick; LabPicUrlPreview.Attach(this.gridView); // 必须 LabPicUrlPreview.AttachPreview(this.gridView); // 新增(双击预览) #endregion if (SystemInfo.Instance.GroupSpecialMode) this.gridView.EndGrouping += GridView_EndGrouping; - //this.gridView.ShowingEditor += GridView_ShowingEditor; + this.gridView.ShowingEditor += GridView_ShowingEditor; + this.gridView.MouseDown += GridView_MouseDown; } - - - - - - + @@ -1306,7 +1302,8 @@ namespace Lskj.Control rightMentTab = BaseModuleImpl.GetBaseGridRightMenus(this.Model.ModuleCode); } } - if (this.Model != null && BaseModuleImpl.IsGridViewRightMenuBtnEdit(rightMentTab)) + //左侧如果配置表格,也和出现和主表一样的操作列。先限制为左侧固定不加载(要加载的话要获取左侧的fieldKey) + if (this.Model != null && BaseModuleImpl.IsGridViewRightMenuBtnEdit(rightMentTab)&&!customColumKey.Contains("BaseLeftGridView_")) { this.InitRightMenuBtnEdit(); } @@ -1707,7 +1704,8 @@ namespace Lskj.Control rightMentTab = BaseModuleImpl.GetBaseGridRightMenus(this.Model.ModuleCode); } } - if (this.Model != null && BaseModuleImpl.IsGridViewRightMenuBtnEdit(rightMentTab)) + //左侧如果配置表格,也和出现和主表一样的操作列。先限制为左侧固定不加载(要加载的话要获取左侧的fieldKey) + if (this.Model != null && BaseModuleImpl.IsGridViewRightMenuBtnEdit(rightMentTab) && !customColumKey.Contains("BaseLeftGridView_")) { this.InitRightMenuBtnEdit(); } @@ -4759,8 +4757,15 @@ namespace Lskj.Control editorButton.Kind = ButtonPredefines.Glyph; editorButton.Width = this.CalculateTextWidth(editorButton.Caption, editorButton.Appearance.Font); editorButton.Tag = menuModel; - ItemButtonEdit.Buttons.Add(editorButton); + editorButton.Appearance.BackColor = Color.FromArgb(240, 240, 240); // 浅灰背景 + editorButton.Appearance.BorderColor = Color.FromArgb(180, 180, 180); // 边框色 + editorButton.Appearance.ForeColor = Color.FromArgb(50, 50, 50); // 文本色 + editorButton.Appearance.Options.UseBackColor = true; + editorButton.Appearance.Options.UseBorderColor = true; + editorButton.Appearance.Options.UseForeColor = true; + + ItemButtonEdit.Buttons.Add(editorButton); ColumnWidth += editorButton.Width; } } @@ -4774,6 +4779,8 @@ namespace Lskj.Control gridColumn.MinWidth = ColumnWidth; gridColumn.Width = ColumnWidth; } + + private void OnHighBeater(object sender, ButtonPressedEventArgs e) { FrmHighBeater highBeater = new FrmHighBeater(); @@ -9537,17 +9544,232 @@ namespace Lskj.Control private void GridView_ShowingEditor(object sender, CancelEventArgs e) { GridColumn gridColumn = gridView.FocusedColumn; - if (gridColumn != null && gridColumn.Tag != null) + if (gridColumn != null && gridColumn.Tag != null&& gridColumn.Tag is GridColumnModel) { GridColumnModel model = (GridColumnModel)gridColumn.Tag; - if ((model.FieldType == ControlType.LabTextInt || model.FieldType == ControlType.LabCalcText || model.FieldType == ControlType.LabAccount)&& gridColumn.RealColumnEdit!=null) + if (model.FormatEditBox && (model.FieldType == ControlType.LabTextInt || model.FieldType == ControlType.LabCalcText || model.FieldType == ControlType.LabAccount)&& gridColumn.RealColumnEdit!=null&& !gridColumn.RealColumnEdit.EditFormat.FormatString.Equals(model.DataFormat)) { gridColumn.RealColumnEdit.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; gridColumn.RealColumnEdit.EditFormat.FormatString = model.DataFormat; - + + //编辑框输入的小数位数根据和格式一致 + //if (gridColumn.RealColumnEdit is RepositoryItemTextEdit textEditItem) + //{ + // // 从格式字符串中提取小数位数 + // int decimalPlaces = 0; + // if (model.DataFormat.Contains(".")) + // { + // string decimalPart = model.DataFormat.Split('.')[1]; + // decimalPlaces = decimalPart.Length; + // } + + // // 设置输入掩码(例如n4表示4位小数) + // if (decimalPlaces > 0) + // { + // textEditItem.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; + // textEditItem.Mask.EditMask = $"n{decimalPlaces}"; + // textEditItem.Mask.UseMaskAsDisplayFormat = true; + // } + //} + } + } } - /// 计 \ No newline at end of file + /// 计算EditorButton文本所需的精确宽度 + /// + /// 按钮文本 + /// 按钮字体 + /// 额外边距(像素) + /// 推荐的按钮宽度 + public int CalculateTextWidth(string caption, Font font, int padding = 15) + { + if (string.IsNullOrEmpty(caption)) + return 40; // 空文本默认宽度 + + using (Bitmap tempBitmap = new Bitmap(1, 1)) + using (Graphics g = Graphics.FromImage(tempBitmap)) + { + // 测量文本尺寸 + SizeF textSize = g.MeasureString(caption, font); + + // 计算总宽度 = 文本宽度 + 左右边距 + int width = (int)textSize.Width + padding; + + // 确保宽度不小于最小值 + return Math.Max(width, 40); // 最小宽度40像素 + } + } + + + #region 表格在设置为禁编状态时,点击右键列中的右键按钮事件 + + /// + /// 表格点击事件(处理表格禁编状态时的右键列点击逻辑) + /// + /// + /// + private void GridView_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) return; + + GridView view = sender as GridView; + if (view.OptionsBehavior.Editable) return; + GridHitInfo hitInfo = view.CalcHitInfo(e.Location); + + if (hitInfo.InRowCell && hitInfo.Column.ColumnEdit is RepositoryItemButtonEdit) + { + RepositoryItemButtonEdit repo = hitInfo.Column.ColumnEdit as RepositoryItemButtonEdit; + if (!hitInfo.Column.FieldName.Equals("RightMenuBtnEdit")) return; + int rowHandle = hitInfo.RowHandle; + this.gridView.SelectRowHandler(rowHandle); + int buttonIndex = this.GetClickedButtonIndex(repo, view, rowHandle, hitInfo.Column, e.Location, hitInfo.Column.Width); + + if (buttonIndex != -1) + { + // 成功获取按钮索引,触发原有逻辑 + EditorButton clickedButton = repo.Buttons[buttonIndex]; + if (clickedButton == null) return; + this.RightButtonClick(clickedButton); + } + } + } + + /// + /// 执行点击的右键按钮 + /// + /// + private void RightButtonClick(EditorButton editorButton) + { + + GridRightMenuModel menuModel = editorButton.Tag as GridRightMenuModel; + ToolStripMenuItem toolStripMenuItem = this.gridViewRightMenu.RightMenuBtnEdits.ContainsKey(menuModel.Id) ? this.gridViewRightMenu.RightMenuBtnEdits[menuModel.Id] : null; + if (toolStripMenuItem != null) + { + bool allowClick = true; + int[] mSelectRows = this.gridView.GetSelectedRows(); + DataRow mSelectRow = this.gridView.GetDataRow(mSelectRows[0]); + if (menuModel != null) + { + if (menuModel.PrivilegeOper.Length > 1 && !menuModel.PrivilegeOper.Contains(ERPInfo.Instance.UserName + ",")) + { + allowClick = false; + } + else + { + if (!string.IsNullOrWhiteSpace(menuModel.MenuCond)) + { + try + { + string cond = string.Empty; + if (this.gridViewRightMenu.ControlObj != null) + cond = this.gridViewRightMenu.ControlObj.ReplaceParentControlValue(menuModel.MenuCond); + cond = ReplaceHelper.ReplaceRowParam(mSelectRow, menuModel.MenuCond); + if (this.gridView != null) + { + GridCell[] cells = this.gridView.GetSelectedCells(); + if (cells != null && cells.Length > 0 && cond.Contains("{COLUMN_")) + { + GridCell cell = cells[0]; + DataRow focusedRow = this.gridView.GetFocusedDataRow(); + string colValue = focusedRow == null || !focusedRow.Table.Columns.Contains(cell.Column.Name) ? "" : focusedRow[cell.Column.Name] + ""; + cond = cond.ReplaceColumnParam(cell.Column.Name, cell.Column.Caption, colValue); + } + } + if (this.gridViewRightMenu.ControlObj != null) + cond = this.gridViewRightMenu.ControlObj.ReplaceParentControlValue(cond); + allowClick = ReplaceHelper.EvalCond(cond); + } + catch (Exception ex) + { + string Message = ErrorMessage.PromptErrorMessage(ex); + MessageUtil.Show(ResourceKeys.SetRightMenuCondFault + "\r\n" + Message); + } + } + } + } + if (allowClick) toolStripMenuItem.PerformClick(); + } + } + + /// + /// 计算点击是单元格中的第几个按钮 + /// + /// + /// + /// 点击行 + /// 点击列 + /// 点击位置 + /// 单元格宽度 + /// + /// + public int GetClickedButtonIndex(RepositoryItemButtonEdit repo, GridView view, int rowHandle, GridColumn column, Point clickPoint, int ColumnWidth, int buttonSpacing = 2) + { + // 1. 获取单元格在网格控件中的绝对区域(关键修正) + Rectangle cellRect = GetCellAbsoluteRect(view, rowHandle, column); + if (cellRect.IsEmpty) + return -1; + + // 2. 验证点击是否在单元格范围内(首要检查) + if (!cellRect.Contains(clickPoint)) + return -1; + + // 3. 计算单元格内的相对坐标(修正坐标转换) + Point relativePoint = new Point( + clickPoint.X - cellRect.Left, + clickPoint.Y - cellRect.Top + ); + + // 4. 计算按钮布局(针对固定宽度) + //int buttonWidth = repo.Buttons[0].Width; // 固定宽度 + int buttonWidth = ColumnWidth / repo.Buttons.Count; + int totalButtonsWidth = repo.Buttons.Count * buttonWidth + + (repo.Buttons.Count - 1) * buttonSpacing; + + // 5. 确定按钮排列方式(默认靠右对齐,可根据IsLeft调整) + int startX = GetButtonStartX(cellRect.Width, totalButtonsWidth, repo.Buttons[0].IsLeft); + + // 6. 精确匹配按钮区域(核心修正) + for (int i = 0; i < repo.Buttons.Count; i++) + { + // 计算当前按钮的区域(相对单元格) + Rectangle buttonRect = new Rectangle( + startX + i * (buttonWidth + buttonSpacing), + 0, + buttonWidth, + cellRect.Height + ); + + // 扩大1-2像素检测范围,解决边界点击问题 + Rectangle expandedRect = Rectangle.Inflate(buttonRect, 1, 1); + + if (expandedRect.Contains(relativePoint)) + { + return i; // 返回正确索引 + } + } + + return -1; + } + + // 获取单元格在网格控件中的绝对坐标区域 + private Rectangle GetCellAbsoluteRect(GridView view, int rowHandle, GridColumn column) + { + try + { + GridViewInfo viewInfo = view.GetViewInfo() as GridViewInfo; + if (viewInfo == null) + return Rectangle.Empty; + + GridDataRowInfo rowInfo = (GridDataRowInfo)viewInfo.RowsInfo.FindRow(rowHandle); + if (rowInfo == null) + return Rectangle.Empty; + + GridCellInfo cellInfo = rowInfo.Cells[column]; + if (cellInfo == null) + return Rectangle.Empty; + + // 转换为网格控件内的坐标(关键修正) + \ No newline at end of file diff --git a/插件库/Lskj.Control/Model/ControlModel.cs b/插件库/Lskj.Control/Model/ControlModel.cs index 43b6c8e..9bdcba1 100644 --- a/插件库/Lskj.Control/Model/ControlModel.cs +++ b/插件库/Lskj.Control/Model/ControlModel.cs @@ -112,7 +112,7 @@ namespace Lskj.Control.Model /// Gets or sets the field text. /// /// The field text. - public string Text { get; set; } + public string Text = string.Empty; /// /// Gets or sets the default value. /// diff --git a/插件库/Lskj.Control/Model/GridColumnModel.cs b/插件库/Lskj.Control/Model/GridColumnModel.cs index 805157d..b203935 100644 --- a/插件库/Lskj.Control/Model/GridColumnModel.cs +++ b/插件库/Lskj.Control/Model/GridColumnModel.cs @@ -371,6 +371,12 @@ namespace Lskj.Control.Model /// 新版模块返回框类型,显示对应text值(默认只显示数据库中对应内容) /// public bool ModuleFrameDisplayText; + /// + /// 编辑框格式化(和显示格式一致) + /// + public bool FormatEditBox; + + #endregion /// @@ -463,4 +469,5 @@ namespace Lskj.Control.Model this.IsCustomGroupField = item.Table.Columns.Contains("IsCustomGroupField")&&int.TryParse(item["IsCustomGroupField"] + "",out IsCustomGroupField) ? IsCustomGroupField : 0; this.ImportConversionFormat = item.Table.Columns.Contains("ImportConversionFormat") ? item["ImportConversionFormat"]+"" : string.Empty; this.PrivilegeView = item.Table.Columns.Contains("PrivilegeView") ? item["PrivilegeView"] + "" : string.Empty; - this.PrivilegeOper = item.Table.Columns \ No newline at end of file + this.PrivilegeOper = item.Table.Columns.Contains("PrivilegeOper") ? item["PrivilegeOper"] + "" : string.Empty; + this.AdditionalAssociations = item.Table.Col \ No newline at end of file diff --git a/插件库/Lskj.Control/Model/MenuStrip/BaseMenuStrip.cs b/插件库/Lskj.Control/Model/MenuStrip/BaseMenuStrip.cs index 4fb9318..ccf77ce 100644 --- a/插件库/Lskj.Control/Model/MenuStrip/BaseMenuStrip.cs +++ b/插件库/Lskj.Control/Model/MenuStrip/BaseMenuStrip.cs @@ -753,6 +753,10 @@ namespace Lskj.Control.Model catch (Exception) { result = 0; + if (result==0 && ERPInfo.Instance.UserName.Equals("管理员")) + { + SqlStoredProcedurepPrompt.GenerateProcedureExecutionScript(procName, paramList, isFirstFlag, comfirmFlag ); + } } finally { @@ -769,6 +773,10 @@ namespace Lskj.Control.Model switch (rValue) { case -1: + if (rValue == -1 && ERPInfo.Instance.UserName.Equals("管理员")) + { + SqlStoredProcedurepPrompt.GenerateProcedureExecutionScript(procName, paramList, isFirstFlag, comfirmFlag); + } MessageUtil.Show(string.IsNullOrEmpty(model.ErrorMsg) ? ResourceKeys.OperFault + "\n" + pMsg.Value : model.ErrorMsg); reaultValue = false; break; diff --git a/插件库/Lskj.Control/Model/MyControl.cs b/插件库/Lskj.Control/Model/MyControl.cs index 6267c09..85e1a60 100644 --- a/插件库/Lskj.Control/Model/MyControl.cs +++ b/插件库/Lskj.Control/Model/MyControl.cs @@ -5199,7 +5199,7 @@ namespace Lskj.Control.Model { ControlModel[] controls = this._models.Where(x => x.DisableCond.Contains("{" + model.FieldName + "}")).ToArray(); ControlModel[] requiredcontrols = this._models.Where(x => x.RequiredCond.Contains("{" + model.FieldName + "}")).ToArray(); - if (controls == null || controls.Length == 0) return; + if ((controls == null || controls.Length == 0)&&(requiredcontrols == null || requiredcontrols.Length == 0)) return; string fieldValue = GetControlValue(model); foreach (ControlModel item in requiredcontrols) diff --git a/插件库/Lskj.Control/ModuleGridDetailEx.cs b/插件库/Lskj.Control/ModuleGridDetailEx.cs index 0e11624..edb5215 100644 --- a/插件库/Lskj.Control/ModuleGridDetailEx.cs +++ b/插件库/Lskj.Control/ModuleGridDetailEx.cs @@ -354,17 +354,27 @@ namespace Lskj.Control } else { + //树结构默认为节点改变事件 + if (this.ModuleGridObj.GridControlObj is TreeGridControlEx) + { + (this.ModuleGridObj.GridControlObj as TreeGridControlEx).TreeListObj.FocusedNodeChanged += OnFocusedNodeChanged; + } + if (this.ModuleGridObj.GridControlObj is TreeBandedGridControlEx) + { + (this.ModuleGridObj.GridControlObj as TreeBandedGridControlEx).TreeListObj.FocusedNodeChanged += OnFocusedNodeChanged; + } + if (this.ModuleGridObj.GridControlObj.CustomGroupBandEx != null) + { + this.ModuleGridObj.GridControlObj.CustomGroupBandEx.GridView.DoubleClick += new EventHandler(OnGridViewDoubleClick); + } + if (this.ModuleGridObj.GridControlObj.CustomGroupTreeBandEx != null) + { + this.ModuleGridObj.GridControlObj.CustomGroupTreeBandEx.TreeListObj.FocusedNodeChanged += OnFocusedNodeChanged; + } + // 非拖拽模式 if (Model.IsBaseModule) { - if (this.ModuleGridObj.GridControlObj is TreeGridControlEx) - { - (this.ModuleGridObj.GridControlObj as TreeGridControlEx).TreeListObj.FocusedNodeChanged += OnFocusedNodeChanged; - } - if (this.ModuleGridObj.GridControlObj is TreeBandedGridControlEx) - { - (this.ModuleGridObj.GridControlObj as TreeBandedGridControlEx).TreeListObj.FocusedNodeChanged += OnFocusedNodeChanged; - } if (this.SysModel.DoubleClickDetail) { //双击刷新的话,和行改变事件冲突。 @@ -381,12 +391,6 @@ namespace Lskj.Control } else { - if (this.ModuleGridObj.GridControlObj.CustomGroupBandEx != null) - { - this.ModuleGridObj.GridControlObj.CustomGroupBandEx.GridView.DoubleClick += new EventHandler(OnGridViewDoubleClick); - //this.ModuleGridObj.GridControlObj.CustomGroupBandEx.GridView.MouseDown += new MouseEventHandler(GridView_MouseDown); - //this.ModuleGridObj.GridControlObj.CustomGroupBandEx.GridView.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(OnGridViewFocusedRowObjectChanged); - } this.ModuleGridObj.GridControlObj.GridView.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(OnGridViewFocusedRowObjectChanged); //this.ModuleGridObj.GridControlObj.GridView.RowCellClick += new RowCellClickEventHandler(GridView_RowCellClick); this.ModuleGridObj.GridControlObj.GridView.MouseDown += new MouseEventHandler(GridView_MouseDown); @@ -400,14 +404,7 @@ namespace Lskj.Control } else { - if (this.ModuleGridObj.GridControlObj is TreeGridControlEx) - { - (this.ModuleGridObj.GridControlObj as TreeGridControlEx).TreeListObj.FocusedNodeChanged += OnFocusedNodeChanged; - } - if (this.ModuleGridObj.GridControlObj is TreeBandedGridControlEx) - { - (this.ModuleGridObj.GridControlObj as TreeBandedGridControlEx).TreeListObj.FocusedNodeChanged += OnFocusedNodeChanged; - } + if (SystemInfo.Instance.ReportMainTabClickRefresh) { if (this.SysModel.DoubleClickDetail) @@ -453,10 +450,11 @@ namespace Lskj.Control else { DataRow rowItem = this.ModuleGridObj.GridControlObj.GetViewFocusedDataRow(); - if (this.ModuleGridObj.GridControlObj.CustomGroupBandEx != null) + if (this.ModuleGridObj.GridControlObj.CustomGroupSelectedRow != null) { - rowItem = this.ModuleGridObj.GridControlObj.CustomGroupBandEx.GetViewFocusedDataRow(); + rowItem = this.ModuleGridObj.GridControlObj.CustomGroupSelectedRow; } + if (RefreshDetail) { XtraTabPage RefreshPage = this.TabObj.SelectedTabPage; @@ -663,9 +661,9 @@ namespace Lskj.Control } DataRow rowItem = this.ModuleGridObj.GridControlObj.GetViewFocusedDataRow(); - if (this.ModuleGridObj.GridControlObj.CustomGroupBandEx != null) + if (this.ModuleGridObj.GridControlObj.CustomGroupSelectedRow != null) { - rowItem = this.ModuleGridObj.GridControlObj.CustomGroupBandEx.GetViewFocusedDataRow(); + rowItem = this.ModuleGridObj.GridControlObj.CustomGroupSelectedRow; } if (!string.IsNullOrEmpty(SysModel.PageVisbleCond)) { @@ -894,9 +892,9 @@ namespace Lskj.Control /* ② 如果启用了多表头(CustomGroupBandEx), * 尝试用 BandedGridColumn.OwnerBand 获取 Band 标题 */ - var bandEx = this.ModuleGridObj.GridControlObj.CustomGroupBandEx; - if (bandEx != null) + if (this.ModuleGridObj.GridControlObj.CustomGroupBandEx != null) { + var bandEx = this.ModuleGridObj.GridControlObj.CustomGroupBandEx; var bandedView = bandEx.GridView as DevExpress.XtraGrid.Views.BandedGrid.BandedGridView; GridColumn focusedColumn = null; //DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hitInfo = bandedView.CalcHitInfo(MousePosition.X, MousePosition.Y); @@ -914,7 +912,32 @@ namespace Lskj.Control columnCaption = band.Caption; // 用 Band 的标题 } } + } + else if (this.ModuleGridObj.GridControlObj.CustomGroupTreeBandEx != null) + { + var treeBandEx = this.ModuleGridObj.GridControlObj.CustomGroupTreeBandEx; + var treeBandedView = treeBandEx.TreeListObj as DevExpress.XtraTreeList.TreeList; + DevExpress.XtraTreeList.Columns.TreeListColumn focusedColumn = null; + //DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hitInfo = bandedView.CalcHitInfo(MousePosition.X, MousePosition.Y); + focusedColumn = treeBandedView.FocusedColumn; + if (treeBandedView != null && focusedColumn != null) + { + // 强转;成功才说明列属于 BandedGridView + var bcol = focusedColumn as DevExpress.XtraTreeList.Columns.TreeListColumn; + if (bcol != null && bcol.ParentBand != null) + { + // 若只想最顶层 Band,循环 ParentBand 至 null + var band = bcol.ParentBand; + while (band.ParentBand != null) band = band.ParentBand; + + columnCaption = band.Caption; // 用 Band 的标题 + } + } + + } + + // ③ 替换占位符(Replace 会返回新字符串) sqlValue = sqlValue.Replace("{COLUMN_TITLE}", columnCaption); @@ -1330,40 +1353,4 @@ namespace Lskj.Control } } - } - - /// - /// 判断是否有未保存的数据,并保存 - /// - /// - public bool VerificationInterface() - { - if (SystemInfo.Instance.EfficientVerification) - { - //页签验证 - if (!this.TcButtom.CheckIfSaved()) - { - return false; - } - //主表验证 - if (this.ModuleGridObj.GridControlObj.IsDataNotSaved()) - { - DialogResult dialog = MessageUtil.Show("主表有数据未保存,是否保存", MessageBoxButtons.YesNo); - if (dialog == DialogResult.Yes) - { - bool SaveResults = this.ModuleGridObj.SaveWhenSwitching(); - if (!SaveResults) return false; - } - } - - } - return true; - } - - - - - - - } -} \ No newline at end of file + \ No newline at end of file