cnf
2025-11-29 7ac850b8ec68e0a36b1e27d526918b18a6e4e1cb
DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs
@@ -1,9 +1,7 @@
using DevExpress.Data;
using DevExpress.Utils;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.RichEdit.Export;
using DevExpress.XtraPivotGrid.Data;
using DevExpress.XtraRichEdit.Model;
using Gs.DevApp.DevFrm.Rpt;
using Gs.DevApp.DevFrm.Sys;
using Gs.DevApp.DevFrm.WOM;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Gs.DevApp.UserControl;
@@ -11,8 +9,11 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -25,7 +26,16 @@
        public Frm_Womdaa()
        {
            InitializeComponent();
            //先隐藏4种打印
            //加入checkbox begin
            this.gvMx2.CustomDrawColumnHeader += (s, e) => { Gs.DevApp.ToolBox.UtilityHelper.CustomDrawColumnHeader(s, e); };
            this.gvMx2.MouseUp += (s, e) => { Gs.DevApp.ToolBox.UtilityHelper.CustomMouseUp(s, e, gcMx2, gvMx2); };
            this.colChkInt.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False;
            this.colChkInt.OptionsFilter.AllowAutoFilter = false;
            this.colChkInt.OptionsFilter.AllowFilter = false;
            this.colChkInt.OptionsFilter.AllowInHeaderSearch = DevExpress.Utils.DefaultBoolean.False;
            //加入checkbox end
            this.splitMx99.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Panel2;
            this.splitMx98.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Panel2;
            this.splitMx100.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Panel2;
@@ -41,22 +51,24 @@
            toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
            this.toolBarMenu1.btnShouJianClick += ToolBarMenu1_btnShouJianClick;
            this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick;
            this.toolBarMenu1.btnGxClick += ToolBarMenu1_btnGxClick;
            //this.toolBarMenu1.btnChbgClick += ToolBarMenu1_btnChbgClick;
            toolBarMenu1.btnPrintClick += ToolBarMenu1_btnPrintClick;
            this.toolBarMenu1.btnOutClick += ToolBarMenu1_btnOutClick;
            //this.toolBarMenu1.btnDcClick += ToolBarMenu1_btnDcClick;
            this.toolBarMenu1.btnBDLingLiaoClick += ToolBarMenu1_btnBDLingLiaoClick;
            this.toolBarMenu1.getXmlConfig();
            gvMx1.Columns["barbl"].DisplayFormat.FormatType = FormatType.Numeric;
            gvMx1.Columns["barbl"].DisplayFormat.FormatString = "p0";
            Gs.DevApp.ToolBox.UtilityHelper.CustomProgressBarColumn(gvMx1, "barbl", 90, Brushes.OrangeRed, Brushes.DodgerBlue);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx3);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx4);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx6);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx7);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx8);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMxL1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMxL2);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", (value) =>
           {
               Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
           }, tips);
           }, tips, true, (strGuid) => {
               getModelList(strGuid);
           });
            Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
            {
                getModel(value);
@@ -74,10 +86,15 @@
            {
                Gs.DevApp.ToolBox.UtilityHelper.PrintAuto(txt_psnQty_1, txt_iCount_1, radOut, txt_yuliang_1);
            };
            //这是托板码
            this.ucBtnPrint1.btnZhiJieClick += (s, e) =>
            {
                _print(1);
            };
            this.ucBtnPrint1.btnPrintClick += (s, e) =>
            {
                _print();
                _print(0);
            };
            this.ucBtnPrint1.btnAllClick += (s, e) =>
            {
@@ -131,37 +148,32 @@
                    lbGuid, txt_daa001, gridView1);
                SelectDeleteBar frm = new SelectDeleteBar(rowGuid, "追溯码");
                string strCodeList = "";
                string strAction = "";
                frm.UpdateParent += (ss, ee) =>
                {
                    strCodeList = ee.StringSingle;
                    strAction = ee.Data;
                };
                frm.ShowDialog();
                if (string.IsNullOrEmpty(strCodeList))
                    return;
                if (strAction == "print")
                try
                {
                    try
                    string rptParameter = "rpt_trace{"
                    + "100"
                    + "," + ""
                    + "," + ""
                    + "," + ""
                    + "," + ""
                    + "," + strCodeList
                    + "}";
                    using (Form rpt = new RptPreview(rowGuid, rptParameter))
                    {
                        string rptParameter = "rpt_trace{"
                        + "100"
                        + "," + ""
                        + "," + ""
                        + "," + ""
                        + "," + ""
                        + "," + strCodeList
                        + "}";
                        using (Form rpt = new RptPreview(rowGuid, rptParameter))
                        {
                            rpt.ShowDialog();
                        }
                        frm.Close();
                        rpt.ShowDialog();
                    }
                    catch (Exception ex)
                    {
                        MsgHelper.ShowError(ex.Message);
                    }
                    frm.Close();
                }
                catch (Exception ex)
                {
                    MsgHelper.ShowError(ex.Message);
                }
            };
            //这是后盖码
@@ -176,42 +188,35 @@
                    lbGuid, txt_daa001, gridView1);
                SelectDeleteBar frm = new SelectDeleteBar(rowGuid, "后盖码");
                string strCodeList = "";
                string strAction = "";
                frm.UpdateParent += (ss, ee) =>
                {
                    strCodeList = ee.StringSingle;
                    strAction = ee.Data;
                };
                frm.ShowDialog();
                if (string.IsNullOrEmpty(strCodeList))
                    return;
                if (strAction.StartsWith("print"))
                try
                {
                    string printParm = strAction.Replace("print", "");
                    try
                    string rptParameter = "rpt_hgm{"
                    + "100"
                    + "," + ""
                    + "," + ""
                    + "," + ""
                    + "," + ""
                    + "," + strCodeList
                    + "}";
                    using (Form rpt = new RptPreview(rowGuid, rptParameter))
                    {
                        string rptParameter = printParm + "{"
                        + "100"
                        + "," + ""
                        + "," + ""
                        + "," + ""
                        + "," + ""
                        + "," + strCodeList
                        + "}";
                        using (Form rpt = new RptPreview(rowGuid, rptParameter))
                        {
                            rpt.ShowDialog();
                        }
                        frm.Close();
                        rpt.ShowDialog();
                    }
                    catch (Exception ex)
                    {
                        MsgHelper.ShowError(ex.Message);
                    }
                    frm.Close();
                }
                catch (Exception ex)
                {
                    MsgHelper.ShowError(ex.Message);
                }
            };
            //这是齐套标识卡,仅仅打印
            this.ucBtnPrint101.SetPlButton(false);
            this.ucBtnPrint101.btnPrintClick += (s, e) =>
            {
                _print101();
@@ -236,27 +241,16 @@
                              "XlsInOut/" + strService,
                              JsonConvert.SerializeObject(_obj));
                        var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                        if (_rtn.rtnCode > 0)
                            MsgHelper.ShowInformation("提示:" + _rtn.rtnMsg);
                        else
                            MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
                        MsgHelper.ShowInformation("提示:" + _rtn.rtnMsg);
                    }
                    catch (Exception ex)
                    {
                        MsgHelper.ShowError("提示:" + ex.Message);
                        MsgHelper.Warning("提示:" + ex.Message);
                    }
                };
                frm.ShowDialog();
            };
            //维护客户模版
            this.btnDesign.Click += (s, e) =>
            {
                EasyRptEdtShow frm = new EasyRptEdtShow();
                frm.UpdateParent += (ss, ee) =>
                {
                };
                frm.ShowDialog();
            };
        }
        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
@@ -275,6 +269,17 @@
        {
            getPageList(curPage);
        }
        /// <summary>
        ///     撤回报工事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnChbgClick(object sender, EventArgs e)
        {
            _toolChbg(1);
        }
        /// <summary>
        /// 查询事件
        /// </summary>
@@ -299,26 +304,37 @@
            _filterList = e.FilterList;
            getPageList(1);
        }
        /// <summary>
        /// 工序变更
        /// 这是备料单打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void ToolBarMenu1_btnGxClick(object sender, EventArgs e)
        private void ToolBarMenu1_btnPrintClick(object sender, EventArgs e)
        {
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_daa001, gridView1, "daa001");
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_daa001, gridView1);
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.ShowError("请先选择你要操作的行!");
                this.toolBarMenu1.rptParameter = "return false";
                MsgHelper.Warning("请先选择你要打印的单据!");
                return;
            }
            var frm = new ShowGx(rowGuid);
            frm.ShowDialog();
            string rptParameter = "rpt_Womdab{"
            + rowGuid  // @inOrderGuid - 单据guid
            + "," + "100"  // @isDesign - 重打都是传100
            + "," + ""  // @in1 - 入库时间(扩展用)
            + "," + ""  // @in2 - 特采(扩展用)
            + "," + ""  // @in3 - 供应商id(扩展用)
            + "," + ""  // @in4 - 张数(扩展用)
            + "," + ""  // @in5 - 数量(扩展用)
            + "," + ""  // @in6 - 扩展用
            + "}";
            this.toolBarMenu1.rptParameter = rptParameter;
            this.toolBarMenu1.guidKey = rowGuid;
        }
        /// <summary>
        /// 删除工单
        /// </summary>
@@ -331,7 +347,7 @@
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_daa001, gridView1, "daa001");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.ShowError("请先选择你要操作的行!");
                MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定删除吗?"))
@@ -349,19 +365,17 @@
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    MsgHelper.ShowInformation("提示:" + _rtn.rtnMsg);
                    if (xtraTabControl1.SelectedTabPageIndex == 0)
                    { }
                    else
                        Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2);
                    getPageList(this.pageBar1.CurrentPage);
                }
                else
                    MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
                MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                MsgHelper.ShowError("提示:" + ex.Message);
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
@@ -377,7 +391,7 @@
                lbGuid, txt_daa001, gridView1, "daa001");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.ShowError("请先选择你要操作的行!");
                MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定重新生成首检吗?"))
@@ -393,16 +407,82 @@
                    _webServiceName + "EditModelSubmitShouJian",
                    JsonConvert.SerializeObject(_obj));
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                MsgHelper.Warning(_rtn.rtnData.outMsg.ToString());
                if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                {
                    MsgHelper.ShowInformation(_rtn.rtnData.outMsg.ToString());
                    //if (xtraTabControl1.SelectedTabPageIndex == 1)
                    //{
                    //    getModel(lbGuid.Text.Trim());
                    //}
                    //else
                    //{
                    //    //注意,这里和其它页面有点不一样
                    //    getPageList(this.pageBar1.CurrentPage);
                    //    int rowHandle = gridView1.LocateByValue("guid", rowGuid);
                    //    gridView1.FocusedRowHandle = rowHandle;
                    //}
                }
                else
                    MsgHelper.ShowError(_rtn.rtnData.outMsg.ToString());
            }
            catch (Exception ex)
            {
                MsgHelper.ShowError("提示:" + ex.Message);
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 导出xls
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void ToolBarMenu1_btnOutClick(object sender, EventArgs e)
        {
            System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
            _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
            using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
            {
                folderBrowserDialog.Description = "选择导出文件的保存路径";
                DialogResult dialogResult = folderBrowserDialog.ShowDialog();
                if (dialogResult == DialogResult.OK)
                {
                    string _folder = folderBrowserDialog.SelectedPath;
                    var _params = new
                    {
                        inQueryWhere = _sbSqlWhere.ToString(),//查询条件
                        inFid = "",//备用
                        inP1 = "",//备用
                        inP2 = "",//备用备用
                        inP3 = "",//备用
                        inP4 = ""
                    };
                    var _obj = new Gs.DevApp.Entity.XlsOutModel("xlsOutDaa", "", "", "", _params);
                    try
                    {
                        string strJson = UtilityHelper.HttpPost("", "XlsInOut/XlsOutView_NEW", JsonConvert.SerializeObject(_obj));
                        ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                        if (_rtn.rtnCode > 0)
                        {
                            string _file = _rtn.rtnData.fileUrl.ToString();
                            string _folderName = _folder + "\\" + _file.Replace("down/", "");
                            string _url = ConfigurationManager.AppSettings["WebApiUrl"].ToString() + _file;
                            using (WebClient client = new WebClient())
                            {
                                client.DownloadFile(_url, _folderName);
                            }
                            var frm = new Gs.DevApp.DevFrm.QC.Xls(_folderName);
                            frm.ShowDialog();
                        }
                        else
                        {
                            ToolBox.MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
                        }
                    }
                    catch (Exception ex)
                    {
                        ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
                    }
                }
            }
        }
@@ -418,6 +498,11 @@
        {
            _toolCk(9);
        }
        private void ToolBarMenu1_btnDcClick(object sender, EventArgs e)
        {
            _toolCk(12);
        }
        /// <summary>
        /// 工单状态,根据分号把中文去了
        /// </summary>
@@ -488,21 +573,23 @@
            toolBarMenu1.currentAction = "edit";
            string rowGuid = "", rowName = "";
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_daa001, gridView1);
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.ShowError("请先选择你要操作的行!");
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
            if (xtraTabControl1.SelectedTabPageIndex == 1)
            {
                getModel(rowGuid);
                txt_dptNo.ReadOnly = true;
            }
            else
            {
                List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                //gvList.Add(gvMx1);
                //gvList.Add(gvMx2);
                gvList.Add(gvMx1);
                gvList.Add(gvMx2);
                UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList);
            }
        }
@@ -514,13 +601,19 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
        {
            toolBarMenu1.isSetBtn = false;
            if (string.IsNullOrEmpty(txt_daa015.GetId()))
            {
                ToolBox.MsgHelper.ShowError("提示:线体不能为空!");
                return;
            }
            var _obj = new
            {
                guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建
                sjxt = txt_daa015.GetId(), //线体
                sclx = txt_daa025.Text.Trim(),//生产类型
                bz = txt_daa009.Text.Trim()//备注
                bz = txt_daa009.Text.Trim(),//备注
                xgdate = txt_xgdate.Text.Trim(),
            };
            try
            {
@@ -533,12 +626,13 @@
                    toolBarMenu1.isSetBtn = true;
                    List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                    //gvList.Add(gvMx1);
                    UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false, gvList);
                    UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false);
                    //toolBarMenu1.currentAction = "";
                    //txt_printRemark.Enabled = txt_psnQty_1.Enabled = txt_iCount_1.Enabled = true;
                    //txt_printRemark.ReadOnly = txt_psnQty_1.ReadOnly = txt_iCount_1.ReadOnly = false;
                    //toolBarMenu1.currentAction = "";
                    Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6);
                    toolBarMenu1.currentAction = "";
                }
                else
                    ToolBox.MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
@@ -547,6 +641,7 @@
            {
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
        /// <summary>
@@ -556,11 +651,7 @@
        /// <param name="pageSize">每页几条</param>
        private void getPageList(int curPage)
        {
            gcMain1.DataSource = null;
            System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
            _sbSqlWhere.Append(" and a.ERP_SCZZ in");
            _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
            _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
            gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "create_date", "desc", "", _sbSqlWhere.ToString());
            string json = JsonConvert.SerializeObject(pgq);
            try
@@ -602,12 +693,12 @@
            if (toolBarMenu1.currentAction == "edit") isEdit = true;
            if (string.IsNullOrEmpty(strGuid))
            {
                MsgHelper.ShowError("请先选择你要操作的行!");
                MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            if (string.IsNullOrEmpty(strGuid))
            {
                ToolBox.MsgHelper.ShowError("请先选择你要操作的行!");
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            var _obj = new
@@ -621,6 +712,9 @@
                if (_rtn.rtnCode > 0)
                {
                    dynamic dy = _rtn.rtnData;
                    //string cjId = dy.daa013;
                    //string xjxt = dy.sjXt;
                    // txt_sjXt.getSuppler(cjId, xjxt);
                    string lineId = dy.daa013;
                    txt_daa015.getSuppler(txt_daa013.Text.Trim(), lineId);
                    //托板码
@@ -635,10 +729,11 @@
                    txt_zQty100.Text = dy.daa008;
                    txt_yQty100.Text = dy.yQty100;
                    txt_kQty100.Text = dy.kQty100;
                    lbGuid.Text = strGuid;
                    List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                    gvList.Add(gvMx1);
                    gvList.Add(gvMx2);
                   // gvList.Add(gvMx2);
                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList);
                    JObject _job = JObject.Parse(strJson);
                    JArray array = new JArray();
@@ -738,72 +833,15 @@
                            continue;
                        }
                    }
                    //2025-7-20加上产线确认记录
                    JArray array6 = new JArray();
                    foreach (var a in _job["rtnData"]["list6"])
                    {
                        array6.Add(a);
                    }
                    DataTable dt6 = JsonConvert.DeserializeObject<DataTable>(array6.ToString());
                    if (dt6.Rows.Count > 0)
                    {
                        gcMx6.BindingContext = new BindingContext();
                        gcMx6.DataSource = dt6;
                        gcMx6.ForceInitialize();
                        gvMx6.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx6);
                    }
                    else
                    {
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx6, gvMx6);
                    }
                    JArray array7 = new JArray();
                    foreach (var a in _job["rtnData"]["list7"])
                    {
                        array7.Add(a);
                    }
                    DataTable dt7 = JsonConvert.DeserializeObject<DataTable>(array7.ToString());
                    if (dt7.Rows.Count > 0)
                    {
                        gcMx7.BindingContext = new BindingContext();
                        gcMx7.DataSource = dt7;
                        gcMx7.ForceInitialize();
                        gvMx7.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx7);
                    }
                    else
                    {
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx7, gvMx7);
                    }
                    JArray array8 = new JArray();
                    foreach (var a in _job["rtnData"]["list8"])
                    {
                        array8.Add(a);
                    }
                    DataTable dt8 = JsonConvert.DeserializeObject<DataTable>(array8.ToString());
                    if (dt8.Rows.Count > 0)
                    {
                        gcMx8.BindingContext = new BindingContext();
                        gcMx8.DataSource = dt8;
                        gcMx8.ForceInitialize();
                        gvMx8.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx8);
                    }
                    else
                    {
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx8, gvMx8);
                    }
                    txt_psnQty_1.Text = txt_printRemark.Text = txt_iCount_1.Text = txt_printRemark98.Text = txt_iCount_98.Text = txt_yuliang_1.Text = "";
                    txt_iCount_98.Text = txt_kQty98.Text;//追溯码
                    txt_iCount_100.Text = txt_kQty100.Text;//后盖码
                    txt_psnQty_1.Text = txt_printRemark.Text = txt_iCount_1.Text = txt_printRemark98.Text = txt_iCount_98.Text = txt_yuliang_1.Text = "";
                }
                else
                    ToolBox.MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
                    ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
@@ -843,6 +881,9 @@
                case 9:
                    strMsg = "手动完工";
                    break;
                case 12:
                    strMsg = "倒冲领料";
                    break;
            }
            ;
            toolBarMenu1.guidKey = "";
@@ -851,7 +892,7 @@
                lbGuid, txt_daa001, gridView1, "daa001");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.ShowError("请先选择你要操作的行!");
                MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定" + strMsg + "吗?"))
@@ -868,10 +909,9 @@
                    _webServiceName + "EditModelSubmit",
                    JsonConvert.SerializeObject(_obj));
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                MsgHelper.Warning(_rtn.rtnData.outMsg.ToString());
                if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                {
                    MsgHelper.ShowInformation(_rtn.rtnData.outMsg.ToString());
                    if (xtraTabControl1.SelectedTabPageIndex == 1)
                    {
                        getModel(lbGuid.Text.Trim());
@@ -884,12 +924,79 @@
                        gridView1.FocusedRowHandle = rowHandle;
                    }
                }
                else
                    MsgHelper.ShowError(_rtn.rtnData.outMsg.ToString());
            }
            catch (Exception ex)
            {
                MsgHelper.ShowError("提示:" + ex.Message);
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        ///  新增方法:列表显示
        /// </summary>
        /// <param name="strGuid">主表id</param>
        private void getModelList(string strGuid)
        {
            gcMxL1.DataSource = null;
            gcMxL2.DataSource = null;
            var _obj = new
            {
                guid = strGuid,//主建
            };
            try
            {
                string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    dynamic dy = _rtn.rtnData;
                    JArray array1 = new JArray();
                    foreach (var a in dy["list"])
                    {
                        array1.Add(a);
                    }
                    DataTable dt1 = JsonConvert.DeserializeObject<DataTable>(array1.ToString());
                    if (dt1.Rows.Count > 0)
                    {
                        gcMxL1.BindingContext = new BindingContext();
                        gcMxL1.DataSource = dt1;
                        gcMxL1.ForceInitialize();
                        gvMxL1.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMxL1);
                    }
                    else
                    {
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMxL1, gvMxL1);
                    }
                    JArray array2 = new JArray();
                    foreach (var a in dy["list2"])
                    {
                        array2.Add(a);
                    }
                    DataTable dt2 = JsonConvert.DeserializeObject<DataTable>(array2.ToString());
                    if (dt2.Rows.Count > 0)
                    {
                        gcMxL2.BindingContext = new BindingContext();
                        gcMxL2.DataSource = dt2;
                        gcMxL2.ForceInitialize();
                        gvMxL2.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMxL2);
                    }
                    else
                    {
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMxL2, gvMxL2);
                    }
                }
                else
                    ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
@@ -899,12 +1006,21 @@
        /// <summary>
        /// 这是卡板码
        /// </summary>
        private void _print()
        private void _print(int type)
        {
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_daa001, gridView1);
            ucBtnPrint1.guidKey = rowGuid;
            string gdzt = txt_daa018Txt.Text.ToString();
            if (gdzt == "W:完工" || gdzt == "J:结案")
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowError("工单已经完工或结案!");
                this.ucBtnPrint1.rptParameter = "return false";
                return;
            }
            if (rowGuid.Length < 36)
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择你要打印的行!");
@@ -1019,27 +1135,282 @@
                   + "," + ""
                   + "}";
        }
        #endregion
        /// <summary>
        /// 变更内包装数量
        ///
        /// </summary>
        /// <param name="inFieldValue"></param>
        private void _toolChbg(int _inFieldValue)
        {
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_daa001, gridView1, "daa001");
            toolBarMenu1.guidKey = rowGuid;
            //if (string.IsNullOrEmpty(rowGuid))
            //{
            //    MsgHelper.Warning("请先选择你要操作的行!");
            //    return;
            //}
            //if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定操作吗?"))
            //    return;
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            gvMx2.PostEditor();
            gvMx2.UpdateCurrentRow();
            DataTable dt = this.gcMx2.DataSource as DataTable;
            {
                foreach (DataRow dr in dt.Rows)
                {
                    string checkBox = dr["chkInt"].ToString();
                    string _guid = dr["guid"].ToString();
                    if (Gs.DevApp.ToolBox.UtilityHelper.ToCheck(checkBox))
                    {
                        if (sb.Length > 0)
                            sb.Append(",");
                        sb.Append(_guid);
                    }
                }
            }
            if (string.IsNullOrEmpty(sb.ToString()))
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowError("提示:请先选择条码!");
                return;
            }
            //Gs.DevApp.ToolBox.MsgHelper.ShowError(sb.ToString());
            var _obj = new
            {
                billNo = sb.ToString(),
                inFieldValue = _inFieldValue.ToString()
            };
            try
            {
                var strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModelChbg", JsonConvert.SerializeObject(_obj));
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                MsgHelper.Warning(_rtn.rtnData.outMsg.ToString());
                if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                {
                    if (xtraTabControl1.SelectedTabPageIndex == 1)
                    {
                        getModel(lbGuid.Text.Trim());
                    }
                    int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid);
                    gridView1.FocusedRowHandle = rowHandle;
                    //UtilityHelper.SetCheckIco(gridView1, "checkStatus", "checkUser", "checkDate", picCheckBox, this, _inFieldValue.ToString());
                }
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 备单领料
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void rptTuoBanNbz_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        private void ToolBarMenu1_btnBDLingLiaoClick(object sender, EventArgs e)
        {
            var rowhandle = gvMx2.FocusedRowHandle;
            if (rowhandle < 0)
                return;
            if (e.Button.Index == 0)
            ExecuteBatchOperation(1, "备单领料");
        }
        /// <summary>
        /// 批量执行操作
        /// </summary>
        /// <param name="inFieldValue">操作类型值</param>
        /// <param name="operationName">操作名称</param>
        private void ExecuteBatchOperation(int inFieldValue, string operationName)
        {
            gridView1.PostEditor();
            gridView1.UpdateCurrentRow();
            DataTable dt = this.gcMain1.DataSource as DataTable;
            // 收集所有选中的guid和工单号
            List<string> selectedGuids = new List<string>();
            List<string> selectedDaa001s = new List<string>();
            foreach (DataRow dr in dt.Rows)
            {
                var dr = gvMx2.GetDataRow(rowhandle);
                var mxGuid = dr["guid"].ToString();
                if (!MsgHelper.AskQuestion("你选择了1条数据,确定变更内包装数量吗?"))
                    return;
                var frm = new Frm_WomdaaNbz(mxGuid);
                frm.ShowDialog();
                string checkBox = dr["fxk"].ToString();
                string _guid = dr["guid"].ToString();
                string _daa001 = dr["daa001"].ToString();
                if (Gs.DevApp.ToolBox.UtilityHelper.ToCheck(checkBox))
                {
                    selectedGuids.Add(_guid);
                    selectedDaa001s.Add(_daa001);
                }
            }
            // 如果没有选中的记录,直接返回
            if (selectedGuids.Count == 0)
            {
                MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            // 确认对话框
            if (!MsgHelper.AskQuestion($"你选择了 {selectedGuids.Count} 条记录,确定{operationName}吗?"))
                return;
            // 执行批量操作
            BatchExecuteOperation(selectedGuids, inFieldValue, operationName, selectedDaa001s);
        }
        /// <summary>
        /// 批量执行操作并统一返回结果
        /// </summary>
        private void BatchExecuteOperation(List<string> guids, int inFieldValue, string operationName, List<string> nos)
        {
            List<string> successMessages = new List<string>();
            List<string> errorMessages = new List<string>();
            string lastSuccessGuid = string.Empty;
            string _webServiceplace = "";
            switch (inFieldValue)
            {
                case 1:
                    _webServiceplace = "bdll";
                    break;
                //case 2:
                //    _webServiceplace = "强制结案";
                //    break;
                //case 3:
                //    _webServiceplace = "反结案(反执行至完工)";
                //    break;
                //case 8:
                //    _webServiceplace = "审核";
                //    break;
                //case 9:
                //    _webServiceplace = "反审核";
                //    break;
            }
            ;
            // 使用for循环来同时遍历guid和对应的工单号
            for (int i = 0; i < guids.Count; i++)
            {
                string rowGuid = guids[i];
                string workOrderNo = nos[i]; // 对应的工单号
                if (string.IsNullOrEmpty(rowGuid))
                {
                    errorMessages.Add($"工单 {workOrderNo}:遇到空GUID,跳过处理");
                    continue;
                }
                try
                {
                    var _obj = new
                    {
                        guid = rowGuid,
                        inFieldValue = inFieldValue,
                    };
                    var strJson = UtilityHelper.HttpPost("",
                        _webServiceName + _webServiceplace,
                        JsonConvert.SerializeObject(_obj));
                    var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                    if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                    {
                        // 成功消息中使用工单号
                        successMessages.Add($"工单 {workOrderNo}:{_rtn.rtnData.outMsg}");
                        lastSuccessGuid = rowGuid;
                        // 更新界面
                        UpdateUI(rowGuid, inFieldValue);
                    }
                    else
                    {
                        // 错误消息中使用工单号
                        errorMessages.Add($"工单 {workOrderNo}:{_rtn.rtnData.outMsg}");
                    }
                }
                catch (Exception ex)
                {
                    // 异常消息中使用工单号
                    errorMessages.Add($"工单 {workOrderNo}:处理失败 - {ex.Message}");
                }
            }
            // 统一显示结果
            ShowBatchResult(successMessages, errorMessages, operationName, lastSuccessGuid);
        }
        /// <summary>
        /// 更新界面
        /// </summary>
        private void UpdateUI(string rowGuid, int inFieldValue)
        {
            if (xtraTabControl1.SelectedTabPageIndex == 1)
            {
                getModel(lbGuid.Text.Trim());
                int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid);
                gridView1.FocusedRowHandle = rowHandle;
            }
            else
            {
                getPageList(this.pageBar1.CurrentPage);
                int rowHandle = gridView1.LocateByValue("guid", rowGuid);
                gridView1.FocusedRowHandle = rowHandle;
            }
        }
        /// <summary>
        /// 显示批量操作结果
        /// </summary>
        private void ShowBatchResult(List<string> successMessages, List<string> errorMessages, string operationName, string lastSuccessGuid)
        {
            StringBuilder resultMessage = new StringBuilder();
            resultMessage.AppendLine($"{operationName}操作完成:");
            resultMessage.AppendLine($"成功:{successMessages.Count} 条");
            resultMessage.AppendLine($"失败:{errorMessages.Count} 条");
            if (successMessages.Count > 0)
            {
                resultMessage.AppendLine();
                resultMessage.AppendLine("成功记录:");
                foreach (var msg in successMessages.Take(5)) // 只显示前5条成功信息
                {
                    resultMessage.AppendLine($"  ✓ {msg}");
                }
                if (successMessages.Count > 5)
                {
                    resultMessage.AppendLine($"  ... 还有 {successMessages.Count - 5} 条成功记录");
                }
            }
            if (errorMessages.Count > 0)
            {
                resultMessage.AppendLine();
                resultMessage.AppendLine("失败记录:");
                foreach (var msg in errorMessages.Take(5)) // 只显示前5条错误信息
                {
                    resultMessage.AppendLine($"  ✗ {msg}");
                }
                if (errorMessages.Count > 5)
                {
                    resultMessage.AppendLine($"  ... 还有 {errorMessages.Count - 5} 条失败记录");
                }
            }
            // 根据结果类型显示不同的消息框
            if (errorMessages.Count == 0)
            {
                MsgHelper.ShowInformation(resultMessage.ToString());
            }
            else if (successMessages.Count == 0)
            {
                MsgHelper.ShowError(resultMessage.ToString());
            }
            else
            {
                MsgHelper.ShowError(resultMessage.ToString());
            }
        }
        #endregion
    }
}