From e9017904e6895720b37e8ecea71316c01d8eb8ba Mon Sep 17 00:00:00 2001
From: kyy <3283105747@qq.com>
Date: 星期六, 20 十二月 2025 09:47:20 +0800
Subject: [PATCH] 到货单新增查询按钮

---
 DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs |  382 ++++++++++++++++++++++++-----------------------------
 1 files changed, 174 insertions(+), 208 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs b/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs
index ff01d88..62c73bf 100644
--- a/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs
@@ -23,6 +23,8 @@
             InitializeComponent();
             this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
             this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
+            toolBarMenu1.btnQueryChkClick += ToolBarMenu1_btnQueryChkClick;
+            toolBarMenu1.btnQueryFchkClick += ToolBarMenu1_btnQueryFchkClick;
             this.toolBarMenu1.getXmlConfig();
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2);
@@ -53,80 +55,50 @@
 
             #region 鎵撳嵃鐩稿叧 2025-10-18 
 
+            // -------------------- gvMx1 鎵撳嵃浜嬩欢 --------------------
             //娴忚鎵撳嵃浜嬩欢
             this.ucBtnPrint1.btnPrintClick += (s, e) =>
             {
-                  _print(0);
+                _print(0);
               
             };
-           
+            //鐩存帴鎵撳嵃浜嬩欢
+            this.ucBtnPrint1.btnZhiJieClick += (s, e) =>
+            {
+                _print(1);
+            };
+
             //鎵撳嵃鎵归噺鎿嶄綔浜嬩欢
             this.ucBtnPrint1.btnAllClick += (s, e) =>
             {
                 string rowGuid = lbMxGuid.Text.Trim();
                 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
-                    {
-                        string rptParameter = "rpt_Arrival{"
-                        + "100"//閲嶆墦閮芥槸浼�100锛�
-                        + "," + ""
-                        + "," + ""
-                        + "," + ""
-                        + "," + ""
-                        + "," + strCodeList
-                        + "}";
-                        using (Form rpt = new RptPreview(rowGuid, rptParameter))
-                        {
-                            rpt.ShowDialog();
-                        }
-                        frm.Close();
-                    }
-                    catch (Exception ex)
-                    {
-                        MsgHelper.ShowError(ex.Message);
-                    }
-                }
-
+                _print100(rowGuid, frm);//閲嶆墦閮芥槸浼�100锛�  
             };
 
-            //鐩存帴鎵撳嵃浜嬩欢
-            this.ucBtnPrint1.btnZhiJieClick += (s, e) =>
-            {
-                  _print(1);
-          
-            };
+      
 
             // -------------------- gvMx3 鎵撳嵃浜嬩欢 --------------------
             this.ucBtnPrint2.btnPrintClick += (s, e) =>
             {
                 _print2(0);
             };
-
             //鐩存帴鎵撳嵃浜嬩欢
             this.ucBtnPrint2.btnZhiJieClick += (s, e) =>
             {
                 _print2(1);
-
             };
-
-            // gvMx3 鎵归噺鎵撳嵃浜嬩欢
+            // gvMx1 1鎵撳嵃浜嬩欢
             this.ucBtnPrint2.btnAllClick += (s, e) =>
             {
                 // string rowGuid = lbMxGuid3.Text.Trim(); // 浣跨敤gvMx3鐨凣UID
                 string rowGuid = txt_releaseNo.Text.Trim();
                 SelectDeleteBar frm = new SelectDeleteBar(rowGuid, "鍒拌揣鏉$爜锛堝悎骞讹級鐮�"); // 鏍囬鍖哄垎鏉ユ簮
+
+
+              //  _print100(rowGuid, frm);//閲嶆墦閮芥槸浼�100锛�
+
+
                 string strCodeList = "";
                 string strAction = "";
                 frm.UpdateParent += (ss, ee) =>
@@ -161,178 +133,36 @@
                     }
                 }
 
+
             };
-            // --------------------gvMx3 ucBtnPrintOne1 鎵归噺鎵撳嵃浜嬩欢锛堜紭鍖栫増锛�--------------------
+
+            // --------------------gvMx1 ucBtnPrintOne1  鏄庣粏鎵撳嵃浜嬩欢锛堜紭鍖栫増锛�--------------------
+
+            //涓�閿墦鍗颁簨浠�
             this.ucBtnPrintOne1.btnPrintClick += (s, e) =>
             {
-                // 1. 鍩虹楠岃瘉锛氫富琛ㄨ閫夋嫨
-                string mainGuid = lbGuid.Text.Trim();
-                if (string.IsNullOrEmpty(mainGuid) || mainGuid.Length < 10)
-                {
-                    Gs.DevApp.ToolBox.MsgHelper.ShowError("璇峰厛鍦ㄤ富琛ㄤ腑閫夋嫨鏁版嵁琛岋紒");
-                    this.ucBtnPrintOne1.rptParameter = "return false";
-                    return;
-                }
-
-                // 2. 鑾峰彇鏄庣粏鏁版嵁婧�
-                DataTable dtDetails = gcMx3.DataSource as DataTable;
-                if (dtDetails == null || dtDetails.Rows.Count == 0)
-                {
-                    Gs.DevApp.ToolBox.MsgHelper.ShowError("褰撳墠涓昏〃鏃犲叧鑱旂殑鏄庣粏鏁版嵁锛岃鍏堝姞杞芥槑缁嗭紒");
-                    this.ucBtnPrintOne1.rptParameter = "return false";
-                    return;
-                }
-
-                // 3. 绛涢�夊彲鎵撳嵃鏄庣粏锛堥�昏緫涓嶅彉锛�
-                List<string> validReleaseNos = new List<string>();
-                List<string> validPrintQtys = new List<string>();
-                string releaseNoField = "releaseNo";
-
-                if (!dtDetails.Columns.Contains(releaseNoField))
-                {
-                    Gs.DevApp.ToolBox.MsgHelper.ShowError($"鏄庣粏鏁版嵁婧愮己灏戝繀瑕佸瓧娈碉細{releaseNoField}");
-                    this.ucBtnPrintOne1.rptParameter = "return false";
-                    return;
-                }
-
-                foreach (DataRow row in dtDetails.Rows)
-                {
-                    string rowReleaseNo = row[releaseNoField]?.ToString()?.Trim() ?? "";
-                    if (string.IsNullOrEmpty(rowReleaseNo) || rowReleaseNo.Length < 5)
-                    {
-                        Gs.DevApp.ToolBox.MsgHelper.ShowError($"璺宠繃鏃犳晥鏄庣粏琛岋細缂哄皯鎴栨棤鏁堢殑releaseNo");
-                        continue;
-                    }
-
-                    string kQtyStr = row["kQty"]?.ToString()?.Trim() ?? "0";
-                    if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(kQtyStr)
-                        || !decimal.TryParse(kQtyStr, out decimal kQty)
-                        || kQty <= 0)
-                    {
-                        Gs.DevApp.ToolBox.MsgHelper.ShowError($"璺宠繃鏄庣粏琛岋紙releaseNo锛歿rowReleaseNo}锛夛細鍙墦鍗版暟閲忔棤鏁堟垨<=0");
-                        continue;
-                    }
-
-                    if (!validReleaseNos.Contains(rowReleaseNo))
-                    {
-                        validReleaseNos.Add(rowReleaseNo);
-                        validPrintQtys.Add(kQty.ToString("F2"));
-                    }
-                    else
-                    {
-                        Gs.DevApp.ToolBox.MsgHelper.ShowError($"璺宠繃閲嶅鏄庣粏琛岋紙releaseNo锛歿rowReleaseNo}锛夛細宸插寘鍚releaseNo");
-                    }
-                }
-
-                if (validReleaseNos.Count == 0)
-                {
-                    Gs.DevApp.ToolBox.MsgHelper.ShowError("娌℃湁鍙壒閲忔墦鍗扮殑鏄庣粏琛岋紙鎵�鏈夎鍧囦负鏃犳晥鏁版嵁鎴栧彲鎵撳嵃鏁伴噺<=0锛�");
-                    this.ucBtnPrintOne1.rptParameter = "return false";
-                    return;
-                }
-
-                // 4. 缁勮鍙傛暟锛堥�傞厤_rptGetParameterP瑙f瀽閫昏緫锛�
-                string releaseNosStr = string.Join("|", validReleaseNos);
-                string printQtysStr = string.Join("|", validPrintQtys);
-
-                // 浠呬紶6涓叧閿弬鏁帮紝瀵瑰簲瑙f瀽鏂规硶鐨剆0-s5
-                string[] reportParams = new string[]
-                {
-        "batch",       // s0 鈫� @in1锛氭壒閲忔爣璇�
-        "0",           // s1 鈫� @in2锛氬崰浣�
-        "0",           // s2 鈫� @in3锛氫綑閲�
-        "1",           // s3 鈫� @in4锛氬紶鏁�
-        printQtysStr,  // s4 鈫� @in5锛氭暟閲忓垪琛�
-        releaseNosStr  // s5 鈫� @in6锛歳eleaseNo鍒楄〃
-                };
-
-                /*string paramContent = string.Join(",", reportParams);
-                string rptParam = $"rpt_Arrival_One{{{paramContent}}}";
-
-                this.ucBtnPrintOne1.guidKey = mainGuid;
-                this.ucBtnPrintOne1.rptParameter = rptParam;
-
-                // 5. 璋冪敤棰勮锛堥�昏緫涓嶅彉锛�
-                try
-                {
-                    using (Form rptPreviewForm = new RptPreview(mainGuid, rptParam))
-                    {
-                        DialogResult previewResult = rptPreviewForm.ShowDialog();
-                        if (previewResult == DialogResult.OK)
-                        {
-                            getModel(mainGuid);
-                            Gs.DevApp.ToolBox.MsgHelper.ShowError($"鎵归噺鎵撳嵃瀹屾垚锛佸叡鎵撳嵃 {validReleaseNos.Count} 鏉℃湁鏁堟槑缁�");
-                        }
-                        else if (previewResult == DialogResult.Cancel)
-                        {
-                            Gs.DevApp.ToolBox.MsgHelper.ShowError("鐢ㄦ埛鍙栨秷鎵归噺鎵撳嵃鎿嶄綔");
-                        }
-                    }
-                }
-                catch (Exception ex)
-                {
-                    string errorMsg = $"鎵归噺鎵撳嵃寮傚父锛歿ex.Message}";
-                    if (ex.InnerException != null)
-                    {
-                        errorMsg += $"\n鍐呴儴閿欒锛歿ex.InnerException.Message}";
-                    }
-                    Gs.DevApp.ToolBox.MsgHelper.ShowError(errorMsg);
-                    this.ucBtnPrintOne1.rptParameter = "return false";
-                }
-*/
-
-                this.ucBtnPrintOne1.guidKey = mainGuid;
-                this.ucBtnPrintOne1.rptParameter = "rpt_Arrival{"
-                    + string.Join(",", reportParams)  // 鎷兼帴reportParams鏁扮粍鍏冪礌
-                    + "}";
-                // 6. 娓呯┖鎺т欢
-                txt_iCount_2.Text = "";
-                txt_psnQty_2.Text = "";
-                txt_releaseNo.Text = "";
+                _print3(101); //涓�閿墦鍗�101
             };
-
-
             this.ucBtnPrintOne1.btnAllClick += (s, e) =>
             {
                 string mainGuid = lbGuid.Text.Trim();
                 SelectDeleteBar frm = new SelectDeleteBar(mainGuid, "鎵归噺鏉$爜"); // 鏍囬鍖哄垎鏉ユ簮
-                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
-                    {
-                        string rptParameter = "rpt_Arrival{"
-                        + "100"//閲嶆墦閮芥槸浼�100锛�
-                        + "," + ""
-                        + "," + ""
-                        + "," + ""
-                        + "," + ""
-                        + "," + strCodeList
-                        + "}";
-                        using (Form rpt = new RptPreview(mainGuid, rptParameter))
-                        {
-                            rpt.ShowDialog();
-                        }
-                        frm.Close();
-                    }
-                    catch (Exception ex)
-                    {
-                        MsgHelper.ShowError(ex.Message);
-                    }
-                }
+                _print100(mainGuid, frm);//閲嶆墦閮芥槸浼�100锛�
             };
 
+            // --------------------gvMx3 ucBtnPrintOne2 鍚堝苟鎵归噺鎵撳嵃浜嬩欢锛堜紭鍖栫増锛�--------------------
 
-
+            //涓�閿墦鍗颁簨浠�
+            this.ucBtnPrintOne2.btnPrintClick += (s, e) =>
+            {
+                _print4(102); //涓�閿悎骞舵墦鍗�102
+            };
+            this.ucBtnPrintOne2.btnAllClick += (s, e) =>
+            {
+                string mainGuid = lbGuid.Text.Trim();
+                SelectDeleteBar frm = new SelectDeleteBar(mainGuid, "鎵归噺鏉$爜"); // 鏍囬鍖哄垎鏉ユ簮
+                _print100(mainGuid, frm);//閲嶆墦閮芥槸浼�100锛�
+            };
 
             //鏄庣粏琛屽垏鎹簨浠�
             // 鍏抽敭锛氱粦瀹歡vMx1鍜実vMx3鐨勭劍鐐硅鍙樺寲浜嬩欢
@@ -449,7 +279,6 @@
             txt_iCount_1.Text = "";
             txt_psnQty_1.Text = "";
         }
-
         private void _print2(int type)
         {
             string rowGuid = txt_releaseNo.Text.Trim(); // 鏂板lbMxGuid3鐢ㄤ簬瀛樺偍gvMx3鐨勯�変腑琛孏UID
@@ -490,7 +319,74 @@
             txt_iCount_2.Text = "";
             txt_psnQty_2.Text = "";
         }
+        private void _print3(int type)
+        {
+            string mainGuid = lbGuid.Text.Trim();
+            ucBtnPrintOne1.guidKey = mainGuid;
+            this.ucBtnPrintOne1.rptParameter = "rpt_Arrival{"
+            + type
+            + "," + ""
+            + "," + ""
+            + "," + ""
+            + "," + ""
+            + "}";
 
+            txt_iCount_1.Text = "";
+            txt_psnQty_1.Text = "";
+        }
+        private void _print4(int type)
+        {
+            string mainGuid = lbGuid.Text.Trim();
+            ucBtnPrintOne2.guidKey = mainGuid;
+            this.ucBtnPrintOne2.rptParameter = "rpt_Arrival{"
+            + type
+            + "," + ""
+            + "," + ""
+            + "," + ""
+            + "," + ""
+            + "}";
+
+            txt_iCount_1.Text = "";
+            txt_psnQty_1.Text = "";
+        }
+        private void _print100(string mainGuid, SelectDeleteBar frm)
+        {
+          
+            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
+                {
+                    string rptParameter = "rpt_Arrival{"
+                    + "100"//閲嶆墦閮芥槸浼�100锛�
+                    + "," + ""
+                    + "," + ""
+                    + "," + ""
+                    + "," + ""
+                    + "," + strCodeList
+                    + "}";
+                    using (Form rpt = new RptPreview(mainGuid, rptParameter))
+                    {
+                        rpt.ShowDialog();
+                    }
+                    frm.Close();
+                }
+                catch (Exception ex)
+                {
+                    MsgHelper.ShowError(ex.Message);
+                }
+            }
+        }
+      
         private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
         {
             _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
@@ -594,6 +490,28 @@
             _filterList = e.FilterList;
             getPageList(1);
         }
+        /// <summary>
+        ///     鏌ヨ宸插畬鎴�
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        /// <exception cref="NotImplementedException"></exception>
+        private void ToolBarMenu1_btnQueryChkClick(object sender, EventArgs e)
+        {
+            getPageQueryList(1);
+
+
+        }
+        /// <summary>
+        ///     鏌ヨ鏈畬鎴�
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        /// <exception cref="NotImplementedException"></exception>
+        private void ToolBarMenu1_btnQueryFchkClick(object sender, EventArgs e)
+        {
+            getPageQueryList(0);
+        }
 
         /// <summary>
         /// 鍒锋柊浜嬩欢
@@ -661,6 +579,54 @@
                 MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
         }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="curPage"></param>
+        /// <param name="pageSize"></param>
+        private void getPageQueryList(int curPage)
+        {
+            gcMain1.DataSource = null;
+            System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
+            _sbSqlWhere.Append(" and a.receiveOrgId in");
+            _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
+            _sbSqlWhere.Append(" and isnull(A.STATUS,0) =");
+            _sbSqlWhere.Append(curPage);
+            PageQueryModel pgq = new PageQueryModel(1, 1000, "create_date", "asc", "", _sbSqlWhere.ToString());
+            string json = JsonConvert.SerializeObject(pgq);
+            try
+            {
+                string strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json);
+                ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn);
+                if (dd.rtnCode > 0)
+                {
+                    DataTable dt = dd.rtnData.list;
+                    gcMain1.BindingContext = new BindingContext();
+                    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
+                    if (dt.Rows.Count > 0)
+                    {
+                        gcMain1.DataSource = dt;
+                        gcMain1.ForceInitialize();
+                        gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1);
+                    }
+                    else
+                        UtilityHelper.SetDefaultTable(gcMain1, gridView1);
+                    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
+                    pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉
+                    pageBar1.CurrentPage = curPage;//褰撳墠椤�
+                    pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟
+                }
+                else
+                {
+                    ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + dd.rtnMsg);
+                }
+            }
+            catch (Exception ex)
+            {
+                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+            }
+        }
+
         private void getModel(string strGuid)
         {
             gcMx3.DataSource = null;

--
Gitblit v1.9.3