wbc
2025-11-13 4ed9b85875542aa93d573b03ef2bf41aae13328c
托板打印多张
已修改4个文件
已添加3个文件
295 ■■■■■ 文件已修改
DevApp/Gs.DevApp/DevFrm/Rpt/CKTmkc.Designer.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Rpt/CKTmkc.cs 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/Gs.DevApp.csproj 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/UserControl/UcPrintPanel.Designer.cs 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/UserControl/UcPrintPanel.cs 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/UserControl/UcPrintPanel.resx 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Rpt/CKTmkc.Designer.cs
@@ -90,6 +90,7 @@
            this.layoutControlItem10 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem12 = new DevExpress.XtraLayout.LayoutControlItem();
            this.layoutControlItem11 = new DevExpress.XtraLayout.LayoutControlItem();
            this.gridColumn7 = new DevExpress.XtraGrid.Columns.GridColumn();
            ((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).BeginInit();
            this.xtraTabControl1.SuspendLayout();
            this.xtraTabPage1.SuspendLayout();
@@ -224,7 +225,8 @@
            this.gv_ownerId,
            this.gridColumn5,
            this.gv_indepUserCode,
            this.gv_indepDate});
            this.gv_indepDate,
            this.gridColumn7});
            this.gridView1.GridControl = this.gcMain1;
            this.gridView1.IndicatorWidth = 50;
            this.gridView1.Name = "gridView1";
@@ -832,6 +834,15 @@
            this.layoutControlItem11.Text = "入库日期";
            this.layoutControlItem11.TextSize = new System.Drawing.Size(60, 18);
            // 
            // gridColumn7
            //
            this.gridColumn7.Caption = "仓库编码";
            this.gridColumn7.MinWidth = 25;
            this.gridColumn7.Name = "gridColumn7";
            this.gridColumn7.Visible = true;
            this.gridColumn7.VisibleIndex = 12;
            this.gridColumn7.Width = 94;
            //
            // CKTmkc
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F);
@@ -943,5 +954,6 @@
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem24;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem11;
        private DevExpress.XtraGrid.Columns.GridColumn colChkInt;
        private DevExpress.XtraGrid.Columns.GridColumn gridColumn7;
    }
}
DevApp/Gs.DevApp/DevFrm/Rpt/CKTmkc.cs
@@ -15,9 +15,13 @@
    {
        string _webServiceName = "Ck/";
        List<FilterEntity> _filterList = new List<FilterEntity>();
        // æ‰˜æ¿æ‰“印面板(复用输入弹窗与参数构造)
        private Gs.DevApp.UserControl.UcPrintPanel _palletPrintPanel;
        public CKTmkc()
        {
            InitializeComponent();
            // åˆå§‹åŒ–托板打印面板(不必可视化添加,仅复用其逻辑)
            _palletPrintPanel = new Gs.DevApp.UserControl.UcPrintPanel();
            this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
            this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
            toolBarMenu1.btnPrintClick += ToolBarMenu1_btnPrintClick;
@@ -259,24 +263,22 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnTBPrintClick(object sender, EventArgs e)
        {
            //System.Text.StringBuilder sb = new System.Text.StringBuilder();
            gridView1.PostEditor();
            gridView1.UpdateCurrentRow();
            /*if (string.IsNullOrEmpty(sb.ToString()))
            // èŽ·å–å½“å‰é€‰ä¸­è¡Œ guid
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_itemBarcode, gridView1);
            if (rowGuid.Length < 36)
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowError("提示:请先选择物料!");
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择你要打印的行!");
                this.toolBarMenu1.rptParameter = "return false";
                return;
            }*/
            this.toolBarMenu1.rptParameter = "rpt_TB_Print{"
                                               + ""
                                               + "," + ""
                                               + "," + ""
                                                + "," + ""
                                               + "," + ""
                                               + "," + ""
                                               + "}";
            }
            // å¤ç”¨ UcPrintPanel çš„弹窗与打印逻辑
            _palletPrintPanel.TriggerPalletPrint(rowGuid);
            // é˜»æ­¢å·¥å…·æ é»˜è®¤çš„再次打印流程
            this.toolBarMenu1.rptParameter = "return false";
            this.toolBarMenu1.guidKey = null;
        }
    }
DevApp/Gs.DevApp/Gs.DevApp.csproj
@@ -1,4 +1,4 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="..\packages\CefSharp.Common.109.1.110\build\CefSharp.Common.props" Condition="Exists('..\packages\CefSharp.Common.109.1.110\build\CefSharp.Common.props')" />
  <Import Project="..\packages\cef.redist.x86.109.1.11\build\cef.redist.x86.props" Condition="Exists('..\packages\cef.redist.x86.109.1.11\build\cef.redist.x86.props')" />
  <Import Project="..\packages\cef.redist.x64.109.1.11\build\cef.redist.x64.props" Condition="Exists('..\packages\cef.redist.x64.109.1.11\build\cef.redist.x64.props')" />
@@ -1364,6 +1364,18 @@
    <Compile Include="UserControl\SelectSrm.Designer.cs">
      <DependentUpon>SelectSrm.cs</DependentUpon>
    </Compile>
    <Compile Include="UserControl\UcBtnPrintOne.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="UserControl\UcBtnPrintOne.Designer.cs">
      <DependentUpon>UcBtnPrintOne.cs</DependentUpon>
    </Compile>
    <Compile Include="UserControl\UcPrintPanel.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="UserControl\UcPrintPanel.Designer.cs">
      <DependentUpon>UcPrintPanel.cs</DependentUpon>
    </Compile>
    <Compile Include="UserControl\UcCheckFlow.cs">
      <SubType>UserControl</SubType>
    </Compile>
@@ -2301,6 +2313,12 @@
    <EmbeddedResource Include="UserControl\SelectSrm.resx">
      <DependentUpon>SelectSrm.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="UserControl\UcBtnPrintOne.resx">
      <DependentUpon>UcBtnPrintOne.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="UserControl\UcPrintPanel.resx">
      <DependentUpon>UcPrintPanel.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="UserControl\UcCheckFlow.resx">
      <DependentUpon>UcCheckFlow.cs</DependentUpon>
    </EmbeddedResource>
DevApp/Gs.DevApp/UserControl/UcBtnPrint.cs
@@ -1,4 +1,4 @@
using Gs.DevApp.DevFrm.Rpt;
using Gs.DevApp.DevFrm.Rpt;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
@@ -152,6 +152,38 @@
        }
        /// <summary>
        /// è®¾ç½®â€œç¡®å®šæ‰“印”按钮的显示文本
        /// </summary>
        /// <param name="text">按钮文本</param>
        public void SetPrintText(string text)
        {
            if (string.IsNullOrWhiteSpace(text)) return;
            this.btnPrint.Text = text;
        }
        /// <summary>
        /// å¤–部触发打印流程:执行 btnPrintClick é€»è¾‘并打印
        /// </summary>
        public void TriggerPrint()
        {
            // å¤ç”¨çŽ°æœ‰ç‚¹å‡»æŒ‰é’®é€»è¾‘
            if (btnPrintClick != null)
                btnPrintClick(this, EventArgs.Empty);
            else
                return;
            if (rptParameter == "return false")
                return;
            if (string.IsNullOrEmpty(rptParameter))
            {
                MsgHelper.ShowError("没有指定报表参数,请联系技术开发人员!");
                return;
            }
            _print();
        }
        /// <summary>
        /// 
        /// </summary>
        private void _print()
DevApp/Gs.DevApp/UserControl/UcPrintPanel.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,117 @@
namespace Gs.DevApp.UserControl
{
    partial class UcPrintPanel
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
        #region Component Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.layoutMain = new DevExpress.XtraLayout.LayoutControl();
            this.ucBtnPrint1 = new Gs.DevApp.UserControl.UcBtnPrint();
            this.layoutGroup = new DevExpress.XtraLayout.LayoutControlGroup();
            this.layPrint = new DevExpress.XtraLayout.LayoutControlItem();
            this.colDef1 = new DevExpress.XtraLayout.ColumnDefinition();
            this.rowDef1 = new DevExpress.XtraLayout.RowDefinition();
            ((System.ComponentModel.ISupportInitialize)(this.layoutMain)).BeginInit();
            this.layoutMain.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.layoutGroup)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.layPrint)).BeginInit();
            this.SuspendLayout();
            //
            // layoutMain
            //
            this.layoutMain.Controls.Add(this.ucBtnPrint1);
            this.layoutMain.Dock = System.Windows.Forms.DockStyle.Fill;
            this.layoutMain.Location = new System.Drawing.Point(0, 0);
            this.layoutMain.Margin = new System.Windows.Forms.Padding(0);
            this.layoutMain.Name = "layoutMain";
            this.layoutMain.Root = this.layoutGroup;
            this.layoutMain.Size = new System.Drawing.Size(261, 34);
            this.layoutMain.TabIndex = 0;
            this.layoutMain.Text = "layoutMain";
            //
            // ucBtnPrint1
            //
            this.ucBtnPrint1.Location = new System.Drawing.Point(0, 0);
            this.ucBtnPrint1.Margin = new System.Windows.Forms.Padding(0);
            this.ucBtnPrint1.Name = "ucBtnPrint1";
            this.ucBtnPrint1.Size = new System.Drawing.Size(261, 34);
            this.ucBtnPrint1.TabIndex = 0;
            //
            // layoutGroup
            //
            this.layoutGroup.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
            this.layoutGroup.GroupBordersVisible = false;
            this.layoutGroup.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
            this.layPrint});
            this.layoutGroup.LayoutMode = DevExpress.XtraLayout.Utils.LayoutMode.Table;
            this.layoutGroup.Name = "Root";
            this.colDef1.SizeType = System.Windows.Forms.SizeType.Percent;
            this.colDef1.Width = 100D;
            this.layoutGroup.OptionsTableLayoutGroup.ColumnDefinitions.AddRange(new DevExpress.XtraLayout.ColumnDefinition[] {
            this.colDef1});
            this.rowDef1.SizeType = System.Windows.Forms.SizeType.Percent;
            this.rowDef1.Height = 100D;
            this.layoutGroup.OptionsTableLayoutGroup.RowDefinitions.AddRange(new DevExpress.XtraLayout.RowDefinition[] {
            this.rowDef1});
            this.layoutGroup.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
            this.layoutGroup.Size = new System.Drawing.Size(261, 34);
            this.layoutGroup.TextVisible = false;
            //
            // layPrint
            //
            this.layPrint.Control = this.ucBtnPrint1;
            this.layPrint.Location = new System.Drawing.Point(0, 0);
            this.layPrint.Name = "layPrint";
            this.layPrint.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
            this.layPrint.Size = new System.Drawing.Size(261, 34);
            this.layPrint.TextSize = new System.Drawing.Size(0, 0);
            this.layPrint.TextVisible = false;
            //
            // UcPrintPanel
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.layoutMain);
            this.Name = "UcPrintPanel";
            this.Size = new System.Drawing.Size(261, 34);
            ((System.ComponentModel.ISupportInitialize)(this.layoutMain)).EndInit();
            this.layoutMain.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.layoutGroup)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.layPrint)).EndInit();
            this.ResumeLayout(false);
        }
        #endregion
        private DevExpress.XtraLayout.LayoutControl layoutMain;
        private DevExpress.XtraLayout.LayoutControlGroup layoutGroup;
        private Gs.DevApp.UserControl.UcBtnPrint ucBtnPrint1;
        private DevExpress.XtraLayout.LayoutControlItem layPrint;
        private DevExpress.XtraLayout.ColumnDefinition colDef1;
        private DevExpress.XtraLayout.RowDefinition rowDef1;
    }
}
DevApp/Gs.DevApp/UserControl/UcPrintPanel.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
using System;
using System.Windows.Forms;
using DevExpress.XtraEditors;
namespace Gs.DevApp.UserControl
{
    public partial class UcPrintPanel : DevExpress.XtraEditors.XtraUserControl
    {
        public UcPrintPanel()
        {
            InitializeComponent();
            // ä»…保留托板打印按钮
            ucBtnPrint1.SetPlButton(false);
            ucBtnPrint1.SetPrintButton(true);
            ucBtnPrint1.SetPrintText("托板打印");
            // ç‚¹å‡»æ‰˜æ¿æ‰“印,弹窗输入张数,默认1
            ucBtnPrint1.btnPrintClick += (s, e) =>
            {
                string input = XtraInputBox.Show("请输入打印张数", "托板打印", "1");
                if (input == null)
                {
                    ucBtnPrint1.rptParameter = "return false";
                    return;
                }
                input = input.Trim();
                if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(input))
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请输入正确的打印张数!");
                    ucBtnPrint1.rptParameter = "return false";
                    return;
                }
                int copies = Math.Max(1, int.Parse(input));
                // guidKey å¯ç”±å®¿ä¸»çª—体通过属性赋值;托板打印允许为空
                ucBtnPrint1.guidKey = this.guidKey;
                ucBtnPrint1.rptParameter = $"rpt_TB_Print{{,,,{copies},1,,}}";
            };
        }
        // å¯¹å¤–暴露的主键,用于部分报表需要传 guid
        private string _guidKey;
        public string guidKey
        {
            get => _guidKey;
            set => _guidKey = value ?? string.Empty;
        }
        public void SetPlButton(bool show) => ucBtnPrint1.SetPlButton(show);
        public void SetPrintButton(bool show) => ucBtnPrint1.SetPrintButton(show);
        /// <summary>
        /// è§¦å‘托板打印:设置 guid å¹¶è°ƒç”¨å†…部打印流程
        /// </summary>
        /// <param name="guid">当前选中行的 guid</param>
        public void TriggerPalletPrint(string guid)
        {
            this.guidKey = guid ?? string.Empty;
            ucBtnPrint1.guidKey = this.guidKey;
            ucBtnPrint1.TriggerPrint();
        }
    }
}
DevApp/Gs.DevApp/UserControl/UcPrintPanel.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>