huawei
2025-12-04 0bd6795c9962fcbc3b332a4fe0f42276bd484c4f
Merge branch 'master' of http://43.142.96.171:8080/r/~cnf/JH/JH_MesCilent
已修改2个文件
已添加3个文件
815 ■■■■■ 文件已修改
DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesDbck.cs 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesDbck_Print_Select.Designer.cs 139 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesDbck_Print_Select.cs 476 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesDbck_Print_Select.resx 150 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/Gs.DevApp.csproj 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesDbck.cs
@@ -1,5 +1,6 @@
using DevExpress.XtraEditors;
using DevExpress.XtraPrinting.Native;
using Gs.DevApp.DevFrm.WOM;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Gs.DevApp.UserControl;
@@ -315,23 +316,39 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnPrintClick(object sender, EventArgs e)
        {
            //guidKey, rptParameter
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_fBillNo, gridView1, "fBillNo");
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_fBillNo, gridView1);
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.ShowError("请先选择你要操作的行!");
                this.toolBarMenu1.rptParameter = "return false";
                MsgHelper.Warning("请先选择你要打印的单据!");
                return;
            }
            this.toolBarMenu1.rptParameter = "rpt_sdzjdb{"
                                               + "100"
                                               + "," + ""
                                               + "," + ""
                                               + "," + ""
                                               + "," + ""
                                               + "}";
            this.toolBarMenu1.guidKey = rowGuid;
            Frm_MesDbck_Print_Select frm = new Frm_MesDbck_Print_Select(rowGuid);
            DialogResult result = frm.ShowDialog();
            if (result == DialogResult.Cancel || result == DialogResult.None)
            {
                // ç”¨æˆ·ç‚¹å‡»äº†å–消按钮或直接关闭窗口
                this.toolBarMenu1.rptParameter = "return false";
            }
            ////guidKey, rptParameter
            //string rowGuid, rowName;
            //(rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
            //    lbGuid, txt_fBillNo, gridView1, "fBillNo");
            //if (string.IsNullOrEmpty(rowGuid))
            //{
            //    MsgHelper.ShowError("请先选择你要操作的行!");
            //    return;
            //}
            //this.toolBarMenu1.rptParameter = "rpt_sdzjdb{"
            //                                   + "100"
            //                                   + "," + ""
            //                                   + "," + ""
            //                                   + "," + ""
            //                                   + "," + ""
            //                                   + "}";
            //this.toolBarMenu1.guidKey = rowGuid;
        }
DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesDbck_Print_Select.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,139 @@
namespace Gs.DevApp.DevFrm.WOM
{
    partial class Frm_MesDbck_Print_Select
    {
        /// <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 Windows Form 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()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Frm_MesDbck_Print_Select));
            this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
            this.btnCancel = new DevExpress.XtraEditors.SimpleButton();
            this.btnSave = new DevExpress.XtraEditors.SimpleButton();
            this.radioGroup1 = new DevExpress.XtraEditors.RadioGroup();
            this.simpleButton1 = new DevExpress.XtraEditors.SimpleButton();
            ((System.ComponentModel.ISupportInitialize)(this.radioGroup1.Properties)).BeginInit();
            this.SuspendLayout();
            //
            // labelControl1
            //
            this.labelControl1.Location = new System.Drawing.Point(33, 25);
            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new System.Drawing.Size(12, 14);
            this.labelControl1.TabIndex = 0;
            this.labelControl1.Text = "   ";
            //
            // labelControl2
            //
            this.labelControl2.Location = new System.Drawing.Point(33, 22);
            this.labelControl2.Name = "labelControl2";
            this.labelControl2.Size = new System.Drawing.Size(84, 14);
            this.labelControl2.TabIndex = 2;
            this.labelControl2.Text = "请选择打印模版";
            //
            // btnCancel
            //
            this.btnCancel.Appearance.Options.UseFont = true;
            this.btnCancel.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.HotFlat;
            this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
            this.btnCancel.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnCancel.ImageOptions.Image")));
            this.btnCancel.Location = new System.Drawing.Point(219, 161);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new System.Drawing.Size(76, 29);
            this.btnCancel.TabIndex = 240;
            this.btnCancel.Text = "取消 (&C)";
            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
            //
            // btnSave
            //
            this.btnSave.Appearance.Options.UseFont = true;
            this.btnSave.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.HotFlat;
            this.btnSave.Cursor = System.Windows.Forms.Cursors.Hand;
            this.btnSave.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnSave.ImageOptions.Image")));
            this.btnSave.Location = new System.Drawing.Point(127, 161);
            this.btnSave.Name = "btnSave";
            this.btnSave.Size = new System.Drawing.Size(76, 29);
            this.btnSave.TabIndex = 239;
            this.btnSave.Text = "直接打印";
            this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
            //
            // radioGroup1
            //
            this.radioGroup1.EditValue = "0";
            this.radioGroup1.Location = new System.Drawing.Point(33, 56);
            this.radioGroup1.Name = "radioGroup1";
            this.radioGroup1.Properties.Items.AddRange(new DevExpress.XtraEditors.Controls.RadioGroupItem[] {
            new DevExpress.XtraEditors.Controls.RadioGroupItem("0", "直接调拨单"),
            new DevExpress.XtraEditors.Controls.RadioGroupItem("1", "调拨用料清单")});
            this.radioGroup1.Size = new System.Drawing.Size(255, 64);
            this.radioGroup1.TabIndex = 3;
            //
            // simpleButton1
            //
            this.simpleButton1.Appearance.Options.UseFont = true;
            this.simpleButton1.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.HotFlat;
            this.simpleButton1.Cursor = System.Windows.Forms.Cursors.Hand;
            this.simpleButton1.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("simpleButton1.ImageOptions.Image")));
            this.simpleButton1.Location = new System.Drawing.Point(33, 161);
            this.simpleButton1.Name = "simpleButton1";
            this.simpleButton1.Size = new System.Drawing.Size(76, 29);
            this.simpleButton1.TabIndex = 241;
            this.simpleButton1.Text = "预览打印";
            this.simpleButton1.Click += new System.EventHandler(this.simpleButton1_Click);
            //
            // Frm_MesDbck_Print_Select
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(317, 212);
            this.Controls.Add(this.simpleButton1);
            this.Controls.Add(this.btnCancel);
            this.Controls.Add(this.btnSave);
            this.Controls.Add(this.radioGroup1);
            this.Controls.Add(this.labelControl2);
            this.Controls.Add(this.labelControl1);
            this.IconOptions.Image = global::Gs.DevApp.Properties.Resources.logo_png_black;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "Frm_MesDbck_Print_Select";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "请需要打印参数";
            ((System.ComponentModel.ISupportInitialize)(this.radioGroup1.Properties)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
        }
        #endregion
        private DevExpress.XtraEditors.LabelControl labelControl1;
        private DevExpress.XtraEditors.LabelControl labelControl2;
        private DevExpress.XtraEditors.RadioGroup radioGroup1;
        private DevExpress.XtraEditors.SimpleButton btnCancel;
        private DevExpress.XtraEditors.SimpleButton btnSave;
        private DevExpress.XtraEditors.SimpleButton simpleButton1;
    }
}
DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesDbck_Print_Select.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,476 @@
using DevExpress.Utils.DirectXPaint;
using DevExpress.Utils.VisualEffects;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraGrid.Views.Base.ViewInfo;
using FastReport;
using Gs.DevApp.DevFrm.Rpt;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlTypes;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Gs.DevApp.DevFrm.WOM
{
    public partial class Frm_MesDbck_Print_Select : DevExpress.XtraEditors.XtraForm
    {
        public string rowGuid = "";
        private List<string> _selectedBlyIds = new List<string>(); // å­˜å‚¨é€‰ä¸­çš„备料员ID
        public Frm_MesDbck_Print_Select(string _rowGuid)
        {
            rowGuid = _rowGuid;
            InitializeComponent();
            //getBly();
            //// ç»‘定选择事件
            //this.checkedListBoxControl1.ItemCheck += CheckedListBoxControl1_ItemCheck;
        }
        ///// <summary>
        ///// é€‰é¡¹å‹¾é€‰/取消事件
        ///// </summary>
        //private void CheckedListBoxControl1_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
        //{
        //    if (e.Index >= 0 && e.Index < checkedListBoxControl1.Items.Count)
        //    {
        //        var item = checkedListBoxControl1.Items[e.Index] as CheckedListBoxItem;
        //        if (item != null)
        //        {
        //            string blyId = item.Value?.ToString();
        //            if (e.State == CheckState.Checked)
        //            {
        //                // æ·»åŠ é€‰ä¸­çš„ID
        //                if (!string.IsNullOrEmpty(blyId) && !_selectedBlyIds.Contains(blyId))
        //                {
        //                    _selectedBlyIds.Add(blyId);
        //                }
        //            }
        //            else if (e.State == CheckState.Unchecked)
        //            {
        //                // ç§»é™¤å–消的ID
        //                if (!string.IsNullOrEmpty(blyId))
        //                {
        //                    _selectedBlyIds.Remove(blyId);
        //                }
        //            }
        //        }
        //    }
        //}
        ///// <summary>
        ///// è¯»å–备料员
        ///// </summary>
        //private void getBly()
        //{
        //    this.checkedListBoxControl1.Items.Clear();
        //    _selectedBlyIds.Clear(); // æ¸…空选中的ID列表
        //    //string userGuid = LoginInfoModel.CurrentUser.LoginUserGuid;
        //    //var pgq = new PageQueryModel(1, 999999, "FID", "asc", userGuid, " and IS_STATUS=1");
        //    //var json = JsonConvert.SerializeObject(pgq);
        //    var _obj = new
        //    {
        //        currentPage = 1,
        //        everyPageSize = 999999,
        //        guid = this.rowGuid,//主建
        //        sortName = "",
        //        keyWhere = ""
        //    };
        //    try
        //    {
        //        var strReturn = UtilityHelper.HttpPost("", "WomdaaManager/Getbly", JsonConvert.SerializeObject(_obj));
        //        var _rtn = UtilityHelper.ReturnToTablePage(strReturn);
        //        DataTable tb = _rtn.rtnData.list;
        //        // æ–¹æ³•1:使用构造函数直接设置Description和Value
        //        foreach (DataRow row in tb.Rows)
        //        {
        //            string blyId = row["blyId"]?.ToString(); // å‡è®¾ID字段名为blyId
        //            string blyName = row["blyName"]?.ToString();
        //            if (!string.IsNullOrEmpty(blyId) && !string.IsNullOrEmpty(blyName))
        //            {
        //                // åˆ›å»ºCheckedListBoxItem,将名称存储在Description,ID存储在Value
        //                var item = new CheckedListBoxItem(blyName, blyId)
        //                {
        //                    Description = blyName,  // æ˜¾ç¤ºåç§°
        //                    Value = blyId           // å­˜å‚¨ID
        //                };
        //                this.checkedListBoxControl1.Items.Add(item);
        //            }
        //        }
        //        // æ–¹æ³•2:或者使用AddRange的方式(如果数据量较大)
        //        /*
        //        var items = new List<CheckedListBoxItem>();
        //        foreach (DataRow row in tb.Rows)
        //        {
        //            string blyId = row["blyId"]?.ToString();
        //            string blyName = row["blyName"]?.ToString();
        //            if (!string.IsNullOrEmpty(blyId) && !string.IsNullOrEmpty(blyName))
        //            {
        //                var item = new CheckedListBoxItem(blyName, blyId);
        //                items.Add(item);
        //            }
        //        }
        //        this.checkedListBoxControl1.Items.AddRange(items.ToArray());
        //        */
        //        // å¯é€‰ï¼šè®¾ç½®æ˜¾ç¤ºæ ¼å¼ï¼Œä½¿æ˜¾ç¤ºæ›´æ¸…æ™°
        //        this.checkedListBoxControl1.DisplayMember = "Description"; // æ˜¾ç¤ºDescription属性
        //        this.checkedListBoxControl1.ValueMember = "Value";         // å€¼ä½¿ç”¨Value属性
        //        // å¯é€‰ï¼šæ‰“印调试信息
        //        DebugPrintLoadedItems();
        //    }
        //    catch (Exception ex)
        //    {
        //        MsgHelper.Warning("提示:" + ex.Message);
        //    }
        //}
        ///// <summary>
        ///// è°ƒè¯•:打印已加载的项目信息
        ///// </summary>
        //private void DebugPrintLoadedItems()
        //{
        //    StringBuilder sb = new StringBuilder();
        //    sb.AppendLine("已加载的备料员列表:");
        //    foreach (var itemObj in this.checkedListBoxControl1.Items)
        //    {
        //        if (itemObj is CheckedListBoxItem item)
        //        {
        //            sb.AppendLine($"名称:{item.Description}, ID:{item.Value}, é€‰ä¸­çŠ¶æ€ï¼š{item.CheckState}");
        //        }
        //    }
        //    // å¯ä»¥å†™å…¥æ—¥å¿—或显示在调试窗口
        //    // Console.WriteLine(sb.ToString());
        //}
        ///// <summary>
        ///// èŽ·å–æ‰€æœ‰é€‰ä¸­çš„å¤‡æ–™å‘˜ID
        ///// </summary>
        //private List<string> GetSelectedBlyIds()
        //{
        //    var selectedIds = new List<string>();
        //    // æ–¹æ³•1:使用存储的_selectedBlyIds列表
        //    // return _selectedBlyIds.ToList();
        //    // æ–¹æ³•2:直接从控件获取
        //    foreach (var itemObj in this.checkedListBoxControl1.CheckedItems)
        //    {
        //        if (itemObj is CheckedListBoxItem item && item.Value != null)
        //        {
        //            selectedIds.Add(item.Value.ToString());
        //        }
        //    }
        //    return selectedIds;
        //}
        ///// <summary>
        ///// èŽ·å–æ‰€æœ‰é€‰ä¸­çš„å¤‡æ–™å‘˜åç§°
        ///// </summary>
        //private List<string> GetSelectedBlyNames()
        //{
        //    var selectedNames = new List<string>();
        //    foreach (var itemObj in this.checkedListBoxControl1.CheckedItems)
        //    {
        //        if (itemObj is CheckedListBoxItem item && item.Description != null)
        //        {
        //            selectedNames.Add(item.Description.ToString());
        //        }
        //    }
        //    return selectedNames;
        //}
        /// <summary>
        /// å…³é—­
        /// </summary>
        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;  // å…ˆè®¾ç½®DialogResult
            this.Close();
        }
        /// <summary>
        /// ç›´æŽ¥æ‰“印
        /// </summary>
        private void btnSave_Click(object sender, EventArgs e)
        {
            int dylx = radioGroup1.SelectedIndex; // æ‰“印类型
            if (dylx == 0) // é€ä¸ªå¤‡æ–™å‘˜æ‰“印
            {
                printDj("", 1, "0");
                //// èŽ·å–é€‰ä¸­çš„å¤‡æ–™å‘˜ID列表
                //var selectedBlyIds = GetSelectedBlyIds();
                //// æç¤º1:检查是否选择了备料员
                //if (selectedBlyIds.Count == 0)
                //{
                //    MsgHelper.ShowInformation("请至少选择一个备料员!");
                //    return;
                //}
                //// èŽ·å–é€‰ä¸­çš„å¤‡æ–™å‘˜åç§°ï¼ˆç”¨äºŽæ˜¾ç¤ºï¼‰
                //var selectedBlyNames = GetSelectedBlyNames();
                //// æç¤º2:确认对话框
                //if (!MsgHelper.AskQuestion($"您选择了 {selectedBlyNames.Count} ä¸ªå¤‡æ–™å‘˜ï¼š\n{string.Join(", ", selectedBlyNames)}\n\n确定要打印吗?"))
                //    return;
                //// é€ä¸ªæ‰“印
                //for (int i = 0; i < selectedBlyIds.Count; i++)
                //{
                //    string blyId = selectedBlyIds[i];
                //    string blyName = selectedBlyNames[i];
                //    // æ‰“印,传递备料员ID
                //    printDj(blyId, 1,blyName);
                //    Thread.Sleep(50); // é˜²æ­¢æ‰“印过快
                //}
            }
            else if(dylx == -1)
            {
                MsgHelper.ShowInformation("请至少选择一种打印方式!");
                return;
            }
            else // æ‰¹é‡æ‰“印(不指定具体备料员)
            {
                // æ‰¹é‡æ‰“印,传递空ID
                printDj("",1, "1");
            }
        }
        /// <summary>
        /// é¢„览打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            int dylx = radioGroup1.SelectedIndex; // æ‰“印类型
            if (dylx == 0) // é€ä¸ªå¤‡æ–™å‘˜æ‰“印
            {
                printDj("", 0, "0");
                //// èŽ·å–é€‰ä¸­çš„å¤‡æ–™å‘˜ID列表
                //var selectedBlyIds = GetSelectedBlyIds();
                //// æç¤º1:检查是否选择了备料员
                //if (selectedBlyIds.Count == 0)
                //{
                //    MsgHelper.ShowInformation("请至少选择一个备料员!");
                //    return;
                //}
                //// èŽ·å–é€‰ä¸­çš„å¤‡æ–™å‘˜åç§°ï¼ˆç”¨äºŽæ˜¾ç¤ºï¼‰
                //var selectedBlyNames = GetSelectedBlyNames();
                //// æç¤º2:确认对话框
                //if (!MsgHelper.AskQuestion($"您选择了 {selectedBlyNames.Count} ä¸ªå¤‡æ–™å‘˜ï¼š\n{string.Join(", ", selectedBlyNames)}\n\n确定要打印吗?"))
                //    return;
                //// é€ä¸ªæ‰“印
                //for (int i = 0; i < selectedBlyIds.Count; i++)
                //{
                //    string blyId = selectedBlyIds[i];
                //    string blyName = selectedBlyNames[i];
                //    // æ‰“印,传递备料员ID
                //    printDj(blyId, 0, "0");
                //    Thread.Sleep(50); // é˜²æ­¢æ‰“印过快
                //}
            }
            else if (dylx == -1)
            {
                MsgHelper.ShowInformation("请至少选择一种打印方式!");
                return;
            }
            else // æ‰¹é‡æ‰“印(不指定具体备料员)
            {
                // æ‰¹é‡æ‰“印,传递空ID
                printDj("", 0,"1");
            }
        }
        /// <summary>
        /// è°ƒç”¨æ‰“印接口
        /// </summary>
        /// <param name="blyId">备料员ID</param>
        /// <param name="blyName">备料员名称(用于日志)></param>
        /// <param name="printType">1直接打印,0预览打印</param>
        private void printDj(string blyId, int printType, string blyName = "")
        {
            try
            {
                // æž„建打印参数,传递备料员ID
                string rptParameter = "";
                if(blyName=="0")
                {
                    rptParameter = "rpt_sdzjdb{"
                                               + "100"
                                               + "," + ""
                                               + "," + ""
                                               + "," + ""
                                               + "," + ""
                                               + "}";
                }
                else
                {
                    rptParameter = "rpt_dbylqd{"
                                               + "100"
                                               + "," + ""
                                               + "," + ""
                                               + "," + ""
                                               + "," + ""
                                               + "}";
                }
                    var _obj = new
                    {
                        rptParameter = rptParameter,
                        guid = this.rowGuid,
                        isDesign = 0
                    };
                var strJson = UtilityHelper.HttpPost("", "Report/GetRptData",
                    JsonConvert.SerializeObject(_obj));
                var _job = JObject.Parse(strJson);
                var rtnCode = _job["rtnCode"].ToString();
                if (int.Parse(rtnCode) > 0)
                {
                    // æ¨¡æ¿
                    var report = new FastReport.Report();
                    EnvironmentSettings eSet = new EnvironmentSettings();
                    eSet.ReportSettings.ShowProgress = false;
                    report = new FastReport.Report();
                    var buffer = (byte[])_job["rtnData"]["reportTemplateData"];
                    using (var Stream = new MemoryStream(buffer))
                    {
                        report.Load(Stream);
                    }
                    // ä¸»è¡¨
                    var array = new JArray();
                    foreach (var a in _job["rtnData"]["zb"]) array.Add(a);
                    var _zb = JsonConvert.DeserializeObject<DataTable>(array.ToString());
                    _zb.TableName = "zb";
                    // æ˜Žç»†è¡¨1
                    var array1 = new JArray();
                    foreach (var a in _job["rtnData"]["mx1"]) array1.Add(a);
                    var _mx1 = JsonConvert.DeserializeObject<DataTable>(array1.ToString());
                    _mx1.TableName = "mx1";
                    // æ˜Žç»†è¡¨2
                    var array2 = new JArray();
                    foreach (var a in _job["rtnData"]["mx2"]) array2.Add(a);
                    var _mx2 = JsonConvert.DeserializeObject<DataTable>(array2.ToString());
                    _mx2.TableName = "mx2";
                    // åŠ åˆ°æ•°æ®é›†ä¸­
                    var ds = new DataSet();
                    ds.Tables.Add(_zb);
                    ds.Tables.Add(_mx1);
                    ds.Tables.Add(_mx2);
                    // å¯é€‰ï¼šæ·»åŠ å¤‡æ–™å‘˜ä¿¡æ¯åˆ°æŠ¥è¡¨æ•°æ®æº
                    if (!string.IsNullOrEmpty(blyName))
                    {
                        // å¯ä»¥åœ¨æŠ¥è¡¨æ•°æ®æºä¸­æ·»åŠ å¤‡æ–™å‘˜ä¿¡æ¯
                        DataTable blyTable = new DataTable("BlyInfo");
                        blyTable.Columns.Add("BlyId", typeof(string));
                        blyTable.Columns.Add("BlyName", typeof(string));
                        blyTable.Rows.Add(blyId, blyName);
                        ds.Tables.Add(blyTable);
                    }
                    report.RegisterData(ds);
                    report.PrintSettings.ShowDialog = false;
                    if (printType == 1)
                        report.Print();
                    else
                    {
                        try
                        {
                            using (Form frm = new RptPreview(this.rowGuid, rptParameter))
                            {
                                frm.ShowDialog();
                            }
                        }
                        catch (Exception)
                        {
                        }
                    }
                    report.Dispose();
                    // è®°å½•打印日志
                    LogPrintOperation(blyId, blyName, true, "打印成功");
                }
                else
                {
                    string errorMsg = _job["rtnMsg"]?.ToString() ?? "打印失败";
                    LogPrintOperation(blyId, blyName, false, errorMsg);
                    MsgHelper.ShowError($"打印失败:{errorMsg}");
                }
            }
            catch (Exception ex)
            {
                LogPrintOperation(blyId, blyName, false, ex.Message);
                MsgHelper.ShowError($"打印异常:{ex.Message}");
            }
        }
        /// <summary>
        /// è®°å½•打印操作日志
        /// </summary>
        private void LogPrintOperation(string blyId, string blyName, bool isSuccess, string message)
        {
            // è¿™é‡Œå¯ä»¥è®°å½•打印日志到数据库或文件
            string logMessage = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} - " +
                               $"单据GUID: {rowGuid}, " +
                               $"备料员ID: {blyId}, " +
                               $"备料员名称: {blyName}, " +
                               $"结果: {(isSuccess ? "成功" : "失败")}, " +
                               $"消息: {message}";
            // å†™å…¥æ—¥å¿—文件或数据库
            // File.AppendAllText("PrintLog.txt", logMessage + Environment.NewLine);
            // æˆ–者输出到调试窗口
            Console.WriteLine(logMessage);
        }
    }
}
DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesDbck_Print_Select.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,150 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <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>
  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  <data name="btnCancel.ImageOptions.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    <value>
        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABF0RVh0VGl0
        bGUAQ2xvc2U7RXhpdDsFGf+FAAAArElEQVQ4T7XSOwoCQRCE4c0E8XEDQTMRA+/gTTykGBuYGm6olxBE
        tP1LHGl1WoZVg2+DYrqYZrYys6/cPvVibk38teBUkkUFNcbYuGyFCXYuyxYcMYSyPlSi4fY9m+KMsECW
        aEF5D2m4gzUeZ6MC8SXZYflU4K8taZ2nc1GBH+4i3eStJFdwwABpWNf268xwQVggW4zgd1aJnnbvsrBA
        9JyvWfGPVOx3Bc1ZdQWpA3U147gCvgAAAABJRU5ErkJggg==
</value>
  </data>
  <data name="btnSave.ImageOptions.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    <value>
        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACB0RVh0VGl0
        bGUATmV3O05ld0VtcGxveWVlO05ld1BlcnNvbjveWVScAAAA3ElEQVQ4T5WOPQ5BQRSF3wYsgohCJXRq
        PRWJJaktgFLUOjsQ0egURKEgaj/NOEfuyJl5E4/iy8y5c7+Tyc6LruI0O+cKUbEVnUkhxhd4ycOcDUdL
        cgVjULKcK1AxyCbwJBPLuYKiH/iCm+VkgZf0VJlcKJNUgRZ9sshkRpkEBRr8AmiCJ/Ay75z9XED64GQM
        bPZGnSDYAsUjqFgmZXAAPWZ1goDHBngAfnsDqqAGtjbjW12duGBui9+YqhMXnKPlFCd14oJ9tJxip05c
        0AFrcLdlhbMVaKsTFPyPy16LX4vunIH/egAAAABJRU5ErkJggg==
</value>
  </data>
  <data name="simpleButton1.ImageOptions.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    <value>
        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACB0RVh0VGl0
        bGUATmV3O05ld0VtcGxveWVlO05ld1BlcnNvbjveWVScAAAA3ElEQVQ4T5WOPQ5BQRSF3wYsgohCJXRq
        PRWJJaktgFLUOjsQ0egURKEgaj/NOEfuyJl5E4/iy8y5c7+Tyc6LruI0O+cKUbEVnUkhxhd4ycOcDUdL
        cgVjULKcK1AxyCbwJBPLuYKiH/iCm+VkgZf0VJlcKJNUgRZ9sshkRpkEBRr8AmiCJ/Ay75z9XED64GQM
        bPZGnSDYAsUjqFgmZXAAPWZ1goDHBngAfnsDqqAGtjbjW12duGBui9+YqhMXnKPlFCd14oJ9tJxip05c
        0AFrcLdlhbMVaKsTFPyPy16LX4vunIH/egAAAABJRU5ErkJggg==
</value>
  </data>
</root>
DevApp/Gs.DevApp/Gs.DevApp.csproj
@@ -1199,6 +1199,12 @@
    <Compile Include="DevFrm\Warehouse\Frm_MesShouTuiDj.Designer.cs">
      <DependentUpon>Frm_MesShouTuiDj.cs</DependentUpon>
    </Compile>
    <Compile Include="DevFrm\Warehouse\Frm_MesDbck_Print_Select.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="DevFrm\Warehouse\Frm_MesDbck_Print_Select.Designer.cs">
      <DependentUpon>Frm_MesDbck_Print_Select.cs</DependentUpon>
    </Compile>
    <Compile Include="DevFrm\Warehouse\Models\MesDepots.cs" />
    <Compile Include="DevFrm\Warehouse\Models\MesDepotSections.cs" />
    <Compile Include="DevFrm\Warehouse\Models\MesInvItemOutCDetails.cs" />
@@ -2247,6 +2253,9 @@
    <EmbeddedResource Include="DevFrm\Warehouse\Frm_MesShouTuiDj.resx">
      <DependentUpon>Frm_MesShouTuiDj.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="DevFrm\Warehouse\Frm_MesDbck_Print_Select.resx">
      <DependentUpon>Frm_MesDbck_Print_Select.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="DevFrm\Warehouse\SelectSqmx.resx">
      <DependentUpon>SelectSqmx.cs</DependentUpon>
    </EmbeddedResource>