From 94c437fea114e923bc5f9fb9c7145dd43e9b78e8 Mon Sep 17 00:00:00 2001
From: wbc <2597324127@qq.com>
Date: 星期四, 11 十二月 2025 23:28:11 +0800
Subject: [PATCH] 优化更新

---
 DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs |  768 ++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 574 insertions(+), 194 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs
index 94b88c2..4613fe1 100644
--- a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs
+++ b/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 - 渚涘簲鍟唅d锛堟墿灞曠敤锛�
+            + "," + ""  // @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);
             }
         }
 
@@ -816,9 +854,9 @@
             string strMsg = "";
             switch (_inFieldValue)
             {
-                //case 1:
-                //    strMsg = "寰呭紑宸�";
-                //    break;
+                case 1:
+                    strMsg = "寰呭紑宸�";
+                    break;
                 case 2:
                     strMsg = "宸ュ崟鏆傚仠";
                     break;
@@ -837,11 +875,14 @@
                 case 7:
                     strMsg = "閫氱煡澶囨枡";
                     break;
-                //case 8:
-                //    strMsg = "寮�宸�";
-                //    break;
+                case 8:
+                    strMsg = "寮�宸�";
+                    break;
                 case 9:
                     strMsg = "鎵嬪姩瀹屽伐";
+                    break;
+                case 12:
+                    strMsg = "鍊掑啿棰嗘枡";
                     break;
             }
             ;
@@ -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,30 @@
         /// <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 (gdzt != "M:鐢熶骇涓�")
+            {
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("鏈紑宸ヤ笉鍙墦鍗版潯鐮侊紒");
+                this.ucBtnPrint1.rptParameter = "return false";
+                return;
+            }
+
+
+
             if (rowGuid.Length < 36)
             {
                 Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨浣犺鎵撳嵃鐨勮锛�");
@@ -1019,27 +1144,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;
+
+            // 鏀堕泦鎵�鏈夐�変腑鐨刧uid鍜屽伐鍗曞彿
+            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寰幆鏉ュ悓鏃堕亶鍘唃uid鍜屽搴旂殑宸ュ崟鍙�
+            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
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3