From 5ab9042018ef35071d3d1b6ab6ef1ef1decd2560 Mon Sep 17 00:00:00 2001 From: cyf Date: Fri, 30 Jan 2026 07:55:48 +0000 Subject: [PATCH] SVN r1109 SVN-Revision: r1109 --- 插件库/Lskj.PubBill/BillModule.cs | 249 ++++++++++++++++++++++-------- 插件库/Lskj.PubBill/FrmMain.cs | 3 +- 2 files changed, 184 insertions(+), 68 deletions(-) diff --git a/插件库/Lskj.PubBill/BillModule.cs b/插件库/Lskj.PubBill/BillModule.cs index 3a3746d..2ff7e8b 100644 --- a/插件库/Lskj.PubBill/BillModule.cs +++ b/插件库/Lskj.PubBill/BillModule.cs @@ -763,6 +763,8 @@ namespace Lskj.PubBill if (this.BillModel != null) { this.BillModel.TypeName = string.IsNullOrEmpty(SysModel.BillMasterSql) ? this.SysModel.FormText : this.BillModel.TypeName;// 模块名称 + if (!string.IsNullOrWhiteSpace(this.SysModel.DocumentName)) this.BillModel.TypeName = this.SysModel.DocumentName; + if (!dataCaches.GetValue(this, "MasterPreFix", out string masterPreFix)) { masterPreFix = BaseImpl.GetColumnPrefix(this.BillModel.MasterTable);// 主表列前缀 @@ -999,6 +1001,7 @@ namespace Lskj.PubBill itemCommon.Location = new Point(x + 6 + inputWidth, 6); pl_main_bottom.Controls.Add(itemCommon); x += itemCommon.Width + 6; + if (tableCommon.Columns.Contains("menuCond")) { itemCommon.Enabled = ValidateCond(item["menuCond"] + "", null); @@ -1027,6 +1030,14 @@ namespace Lskj.PubBill SimpleButton btn = sender as SimpleButton; DataRow rowItem = btn.Tag as DataRow; GridRightMenuModel model = new GridRightMenuModel(rowItem); + + if (!string.IsNullOrWhiteSpace(model.ClickCond)) + { + string clickCond = this.ControlObj.ReplaceControlValue(model.ClickCond) + ""; + bool condResult = ValidateCond(clickCond, null); + if (!condResult) return; + } + if (rowItem["dllname"].Equals("Lskj.PubBomImport.dll")) { if ((model.ParamList[7] + "").Equals("3")) @@ -1037,11 +1048,29 @@ namespace Lskj.PubBill } } } - + StaticControl.RightMenuGridView = gcMain.GridView; + StaticControl.Comprefix = this.BillModel.DetailPreFix; CommonMenu menu = new CommonMenu(this.SysModel, this.ControlObj, this.gcMain); menu.ApplyBefore += new CommonToolApplyEventHandler(OnMenuApplyBefore); menu.DynamicLinkAfter += new CommonToolAfterDynamicLinkEventHandler(OnDynamicLinkAfter); menu.Apply(rowItem); + + if (StaticControl.ReturnRowLisy.Count > 0) + { + DataRow[] dataRows = StaticControl.ReturnRowLisy.ToArray(); + foreach (DataRow item in dataRows) + { + if (this.BillModel.DetailTreeTable) + { + this.AddRowToTreeGridControl(item, "0"); + } + else + { + this.AddRowToGridView(item); + } + } + } + if (model != null && model.Refresh) { string billNo = this.lblOrderNo.Text.Trim(); @@ -2745,7 +2774,7 @@ namespace Lskj.PubBill this.cb_input.Enabled = this.btn_input.Enabled = this.txt_input.Enabled = true; this._itemImport.Enabled = this._itemImportUpdate.Enabled = true; this.cb_templete.Enabled = true; - this.ControlObj.CopyControlValue(); + this.ControlObj.CopyControlValue(this.BillModel.CancelCopyAssociation); this.ControlObj.SetReadOnlyAllControl(false); if (this.BillModel.DetailTreeTable) @@ -2792,7 +2821,7 @@ namespace Lskj.PubBill this.cb_input.Enabled = this.btn_input.Enabled = this.txt_input.Enabled = true; this._itemImport.Enabled = this._itemImportUpdate.Enabled = true; this.cb_templete.Enabled = true; - this.ControlObj.CopyControlValue(); + this.ControlObj.CopyControlValue(this.BillModel.CancelCopyAssociation); this.ControlObj.SetReadOnlyAllControl(false); this._waterMark = new WaterMark(this.BillModel.MasterPreFix, null); if (!gridTable.Columns.Contains(ERPInfo.Instance.isAddRows)) @@ -4698,7 +4727,8 @@ namespace Lskj.PubBill //return false; } // 检测是否为提交或者终审模块 - if (_waterMark.Text.Contains("已终审")) + string text = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText("已终审") : "已终审"; + if (_waterMark.Text.Contains(text)) { MessageUtil.Show(ResourceKeys.AddBillDetailed); return false; @@ -5273,6 +5303,7 @@ namespace Lskj.PubBill menu.ApplyBefore += new CommonToolApplyEventHandler(OnMenuApplyBefore); menu.DynamicLinkAfter += new CommonToolAfterDynamicLinkEventHandler(OnDynamicLinkAfter); StaticControl.RightMenuGridView = gcMain.GridView; + StaticControl.Comprefix = this.BillModel.DetailPreFix; StaticControl.RightMenuMyControl = ControlObj; menu.Apply(menuRow); if (!menu.issuccess) @@ -5418,6 +5449,9 @@ namespace Lskj.PubBill saveResult = true; SaveRefreshSource(); RefreshPrindMenu(); + //刷新下方配置的附件模块 + if (this.BillModel.SaveRefreshAdditional) this.OngcMainRowCellClick(null, null); + //保存完成后所有数据源进行拼接执行保存 if (tvp != null && tvp.Rows.Count > 0) { @@ -6607,7 +6641,17 @@ namespace Lskj.PubBill XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage; BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel; DataRow rowItem = unionModel.GridDetailControlObj.GridView.GetFocusedDataRow(); - if (rowItem != null) this.AddMultiRowToGridView(new DataRow[] { rowItem }); + if (rowItem != null) + { + if (!this.BillModel.IsFastDragAddDetail) + { + this.AddMultiRowToGridView(new DataRow[] { rowItem }); + } + else + { + this.AddRowsToGridViewFast(new DataRow[] { rowItem }); + } + } } } } @@ -6817,33 +6861,90 @@ namespace Lskj.PubBill // 绘制单据状态文本 if (!string.IsNullOrEmpty(this._waterMark.Text)) { - graphicsText.DrawString(this._waterMark.Text, new Font("宋体", 12, FontStyle.Bold), new SolidBrush(Color.Red), new PointF(50, 21), format, -15f); + - e.Graphics.TranslateTransform(0, 0); - e.Graphics.RotateTransform(-15f); - e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(14, 20, 55, 21)); + if (Business.Impl.LanguageTranslation.Translatable) + { + graphicsText.DrawString(this._waterMark.Text, new Font("宋体", 12, FontStyle.Bold), new SolidBrush(Color.Red), new PointF(50, 21), format,0f); + // 测量文本实际尺寸(含字体和格式影响) + SizeF textSize = e.Graphics.MeasureString(this._waterMark.Text, new Font("宋体", 12, FontStyle.Bold), new SizeF(float.MaxValue, float.MaxValue), format); + int rectWidth = (int)textSize.Width + 10; + int rectHeight = (int)textSize.Height + 5; + // 文本中心点是(50,21),计算边框左上角坐标(确保边框围绕文本居中) + int rectX = 50 - rectWidth / 2; + int rectY = 21 - rectHeight / 2; + + e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(rectX, rectY, rectWidth, 21)); + } + else + { + graphicsText.DrawString(this._waterMark.Text, new Font("宋体", 12, FontStyle.Bold), new SolidBrush(Color.Red), new PointF(50, 21), format, -15f); + + e.Graphics.TranslateTransform(0, 0); + e.Graphics.RotateTransform(-15f); + e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(14, 20, 55, 21)); + } + } // 绘制打印次数文本 e.Graphics.ResetTransform(); if (!string.IsNullOrEmpty(this._waterMark.Print)) { - graphicsText.DrawString(this._waterMark.Print, new Font("宋体", 11, FontStyle.Bold), new SolidBrush(Color.Red), new PointF((this.lbTitle.Width - 70), 21), format, -15f); + - e.Graphics.TranslateTransform(this.lbTitle.Width - 70, 21); - e.Graphics.RotateTransform(-15f); - e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(-35, -14, 70, 21)); + if (Business.Impl.LanguageTranslation.Translatable) + { + graphicsText.DrawString(this._waterMark.Print, new Font("宋体", 11, FontStyle.Bold), new SolidBrush(Color.Red), new PointF((this.lbTitle.Width - 70), 21), format, 0f); + // 测量文本实际尺寸(含字体和格式影响) + SizeF textSize = e.Graphics.MeasureString(this._waterMark.Print, new Font("宋体", 11, FontStyle.Bold), new SizeF(float.MaxValue, float.MaxValue), format); + int rectWidth = (int)textSize.Width + 10; + int rectHeight = (int)textSize.Height + 5; + // 文本中心点是(this.lbTitle.Width - 70,21),计算边框左上角坐标(确保边框围绕文本居中) + int rectX = (this.lbTitle.Width - 70) - rectWidth / 2; + int rectY = 21 - rectHeight / 2; + + e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(rectX, rectY, rectWidth, 21)); + } + else + { + graphicsText.DrawString(this._waterMark.Print, new Font("宋体", 11, FontStyle.Bold), new SolidBrush(Color.Red), new PointF((this.lbTitle.Width - 70), 21), format, -15f); + e.Graphics.TranslateTransform(this.lbTitle.Width - 70, 21); + e.Graphics.RotateTransform(-15f); + e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(-35, -14, 70, 21)); + } + } // 绘制收款文本 e.Graphics.ResetTransform(); if (!string.IsNullOrEmpty(this._waterMark.Collect)) { - graphicsText.DrawString(this._waterMark.Collect, new Font("宋体", 12, FontStyle.Bold), new SolidBrush(Color.Red), new PointF((this.lbTitle.Width - 170), 21), format, -15f); + - e.Graphics.TranslateTransform(this.lbTitle.Width - 100, 21); - e.Graphics.RotateTransform(-15f); - e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(-100, -32, 55, 21)); + if (Business.Impl.LanguageTranslation.Translatable) + { + graphicsText.DrawString(this._waterMark.Collect, new Font("宋体", 12, FontStyle.Bold), new SolidBrush(Color.Red), new PointF((this.lbTitle.Width - 170), 21), format, 0f); + // 测量文本实际尺寸(含字体和格式影响) + SizeF textSize = e.Graphics.MeasureString(this._waterMark.Collect, new Font("宋体", 12, FontStyle.Bold), new SizeF(float.MaxValue, float.MaxValue), format); + int rectWidth = (int)textSize.Width + 10; + int rectHeight = (int)textSize.Height + 5; + // 文本中心点是(this.lbTitle.Width - 170,21),计算边框左上角坐标(确保边框围绕文本居中) + int rectX = (this.lbTitle.Width - 170) - rectWidth / 2; + int rectY = 21 - rectHeight / 2; + + e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(rectX, rectY, rectWidth, 21)); + } + else + { + graphicsText.DrawString(this._waterMark.Collect, new Font("宋体", 12, FontStyle.Bold), new SolidBrush(Color.Red), new PointF((this.lbTitle.Width - 170), 21), format, -15f); + + e.Graphics.TranslateTransform(this.lbTitle.Width - 100, 21); + e.Graphics.RotateTransform(-15f); + e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(-100, -32, 55, 21)); + } + + } } } @@ -6860,30 +6961,34 @@ namespace Lskj.PubBill /// The e. private void OnDragDetailGridCompleted(object sender, GridDragGridArgs e) { - List dragRows = new List(); - int[] rowHandles = e.SourceGridViewObj.GetSelectedRows(); - foreach (int handle in rowHandles) + if (this.CanAddDetailRow()) { - DataRow row = e.SourceGridViewObj.GetDataRow(handle); - dragRows.Add(row); - } - if (dragRows != null && dragRows.Count > 0) - { - if (!this.BillModel.IsFastDragAddDetail) + List dragRows = new List(); + int[] rowHandles = e.SourceGridViewObj.GetSelectedRows(); + foreach (int handle in rowHandles) { - this.AddMultiRowToGridView(dragRows.ToArray()); + DataRow row = e.SourceGridViewObj.GetDataRow(handle); + dragRows.Add(row); } - else + if (dragRows != null && dragRows.Count > 0) { - this.AddRowsToGridViewFast(dragRows.ToArray()); - } - //拖拽后清除所有复选框 - if (e.SourceGridViewObj != null && e.SourceGridViewObj.OptionsSelection.MultiSelectMode == GridMultiSelectMode.CheckBoxRowSelect) - { - e.SourceGridViewObj.ClearSelection(); - } + if (!this.BillModel.IsFastDragAddDetail) + { + this.AddMultiRowToGridView(dragRows.ToArray()); + } + else + { + this.AddRowsToGridViewFast(dragRows.ToArray()); + } + //拖拽后清除所有复选框 + if (e.SourceGridViewObj != null && e.SourceGridViewObj.OptionsSelection.MultiSelectMode == GridMultiSelectMode.CheckBoxRowSelect) + { + e.SourceGridViewObj.ClearSelection(); + } + } } + } /// @@ -8121,7 +8226,15 @@ namespace Lskj.PubBill { WaitForm.ShowForm(); //主表明细 - this.gcMain.RefreshDataSource(); + if (this.gcMain is TreeGridControlEx) + { + (this.gcMain as TreeGridControlEx).RefreshDataSource(); + } + else + { + this.gcMain.RefreshDataSource(); + } + //来源明细 foreach (XtraTabPage tabPage in this.xtc_left_container.TabPages) { @@ -8318,40 +8431,41 @@ namespace Lskj.PubBill /// private void DragDetailGrid_OnDragComplete(object sender, GridDragTreeGridArgs e) { - string Pid = "0";//必须父节点必须有默认值,不然如果新增后没有值的话,无法自动展开当前节点 - if (e.SelectTreeNode != null) + if (this.CanAddTreeDetailRow()) { - Pid = e.SelectTreeNode[(this.gcMain as TreeGridControlEx).TreeListObj.KeyFieldName] + ""; - - DataRow SelectRow = (this.gcMain as TreeGridControlEx).GetViewSpecifyDataRow(e.SelectTreeNode); - if (!string.IsNullOrWhiteSpace(this.BillModel.TreeTableDragCondition)&&!ReplaceHelper.EvalCond(ReplaceHelper.ReplaceRowParam(SelectRow, this.BillModel.TreeTableDragCondition))) + string Pid = "0";//必须父节点必须有默认值,不然如果新增后没有值的话,无法自动展开当前节点 + if (e.SelectTreeNode != null) { - return; + Pid = e.SelectTreeNode[(this.gcMain as TreeGridControlEx).TreeListObj.KeyFieldName] + ""; + + DataRow SelectRow = (this.gcMain as TreeGridControlEx).GetViewSpecifyDataRow(e.SelectTreeNode); + if (!string.IsNullOrWhiteSpace(this.BillModel.TreeTableDragCondition) && !ReplaceHelper.EvalCond(ReplaceHelper.ReplaceRowParam(SelectRow, this.BillModel.TreeTableDragCondition))) + { + return; + } + } + XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage; + BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel; + int oldRowHandle = this.gcMain.GridView.FocusedRowHandle; + foreach (DataRow rowItem in e.GridViewSelectRows) + { + //添加拖拽行 + this.AddMultiRowTreeGridControl(new DataRow[] { rowItem }, Pid); + if (!string.IsNullOrWhiteSpace(unionModel.AddDataSql) && !string.IsNullOrWhiteSpace(unionModel.AddDataCondition) && this.ValidateCond(unionModel.AddDataCondition, rowItem)) + { + //添加拖拽行对应的数据源 + string addSql = ReplaceHelper.ReplaceRowParam(e.GridViewSelectRows, ReplaceHelper.ReplaceUserInfo(unionModel.AddDataSql)); + DataTable dataTable = MainImpl.GetDataTableResult(addSql); + DragAddTable(dataTable, (int.Parse((this.gcMain as TreeGridControlEx).GetNewNodesId()) - 1) + "");//上方的新增行的id默认是最大的 + } + } + this.gcMain.GridView.SelectRowHandler(oldRowHandle); + + if (e.SelectTreeNode != null) + { + e.SelectTreeNode.Expanded = true; } } - XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage; - BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel; - int oldRowHandle = this.gcMain.GridView.FocusedRowHandle; - foreach (DataRow rowItem in e.GridViewSelectRows) - { - //添加拖拽行 - this.AddMultiRowTreeGridControl(new DataRow[] { rowItem }, Pid); - if (!string.IsNullOrWhiteSpace(unionModel.AddDataSql) && !string.IsNullOrWhiteSpace(unionModel.AddDataCondition) && this.ValidateCond(unionModel.AddDataCondition, rowItem)) - { - //添加拖拽行对应的数据源 - string addSql = ReplaceHelper.ReplaceRowParam(e.GridViewSelectRows, ReplaceHelper.ReplaceUserInfo(unionModel.AddDataSql)); - DataTable dataTable = MainImpl.GetDataTableResult(addSql); - DragAddTable(dataTable, (int.Parse((this.gcMain as TreeGridControlEx).GetNewNodesId()) - 1) + "");//上方的新增行的id默认是最大的 - } - } - this.gcMain.GridView.SelectRowHandler(oldRowHandle); - - if (e.SelectTreeNode != null) - { - e.SelectTreeNode.Expanded = true; - } - - } /// @@ -9053,7 +9167,8 @@ namespace Lskj.PubBill (this.gcMain as TreeGridControlEx).ClearAllSort(); } // 检测是否为提交或者终审模块 - if (_waterMark.Text.Contains("已终审")) + string text = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText("已终审") : "已终审"; + if (_waterMark.Text.Contains(text)) { MessageUtil.Show(ResourceKeys.AddBillDetailed); return false; diff --git a/插件库/Lskj.PubBill/FrmMain.cs b/插件库/Lskj.PubBill/FrmMain.cs index 031a0ea..23ca886 100644 --- a/插件库/Lskj.PubBill/FrmMain.cs +++ b/插件库/Lskj.PubBill/FrmMain.cs @@ -103,8 +103,8 @@ namespace Lskj.PubBill if (this.billModule1.MainBottomInputObj.Visible && this.billModule1.txtinputobj.Enabled) { this.Activated += FrmMain_Activated; - } + } catch (Exception ex) { @@ -115,6 +115,7 @@ namespace Lskj.PubBill } finally { + Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this); WaitForm.HideForm(); }