From 4dc2dbda4150c7c74a26435a75308789dc359b99 Mon Sep 17 00:00:00 2001
From: cdk <2441919651@qq.com>
Date: 星期六, 01 十一月 2025 17:06:41 +0800
Subject: [PATCH] 增加批量打印功能,增加组织分开维护

---
 DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemTbl.cs |  177 +++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 135 insertions(+), 42 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemTbl.cs b/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemTbl.cs
index 0fe4a98..021e7e4 100644
--- a/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemTbl.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemTbl.cs
@@ -34,6 +34,8 @@
             toolBarMenu1.btnFPiZhunClick += ToolBarMenu1_btnFPiZhunClick;
             toolBarMenu1.btnPiZhunClick += ToolBarMenu1_btnPiZhunClick;
             toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
+            toolBarMenu1.btnPingZhiClick += ToolBarMenu1_btnPingZhiClick;
+            toolBarMenu1.btnFPingZhiClick += ToolBarMenu1_btnFPingZhiClick;
             this.toolBarMenu1.getXmlConfig();
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2);
@@ -66,10 +68,12 @@
                 txt_workName.Text = txt_tbl002.GetWorkName();
                 txt_itemName.Text = txt_tbl002.GetPrdName();
                 txt_itemNo.Text = txt_tbl002.GetPrdNo();
+                txt_line.Text = txt_tbl002.GetWorkXb();
             };
             //閫夋嫨闇�瑕佸叆搴撶殑鏄庣粏
             btnSelect.Click += (s, e) =>
             {
+                tabMx.SelectedTabPageIndex = 0;
                 string _tbl002 = txt_tbl002.GetId();
                 if (string.IsNullOrEmpty(_tbl002))
                 {
@@ -103,7 +107,7 @@
                         gvMx1.CloseEditor();
                         gvMx1.PostEditor();
                         gvMx1.UpdateCurrentRow();
-                        gridView1.BestFitColumns();
+                        gvMx1.BestFitColumns();
                     }
                     catch (Exception ex)
                     {
@@ -112,46 +116,17 @@
                 };
                 frm.ShowDialog();
             };
-            //鎵撳嵃浜嬩欢
+            #region 鎵撳嵃鐩稿叧
+            //棰勮鎵撳嵃浜嬩欢
             this.ucBtnPrint1.btnPrintClick += (s, e) =>
             {
-                string rowGuid = lbMxGuid.Text.Trim();
-                ucBtnPrint1.guidKey = rowGuid;
-                if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_iCount_1.Text.Trim(), txt_yuliang_1.Text.Trim()))
-                {
-                    Gs.DevApp.ToolBox.MsgHelper.ShowError("璇疯緭鍏ユ纭殑鏉$爜鏁伴噺锛�");
-                    txt_iCount_1.Focus();
-                    this.ucBtnPrint1.rptParameter = "return false";
-                    return;
-                }
-                if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_psnQty_1.Text.Trim()))
-                {
-                    Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鎵撳嵃鏉$爜鏁伴噺锛�");
-                    txt_psnQty_1.Focus();
-                    this.ucBtnPrint1.rptParameter = "return false";
-                    return;
-                }
-                if (lbMxGuid.Text.Trim().Length < 10)
-                {
-                    Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鎵撳嵃鐨勮锛�");
-                    this.ucBtnPrint1.rptParameter = "return false";
-                    return;
-                }
-                this.ucBtnPrint1.rptParameter = "rpt_SCTL{"
-                       + lbMxGuid.Text.Trim()//鍏宠仈涓婚敭
-                       + "," + ""
-                       + "," + Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(txt_yuliang_1.Text.Trim())//浣欐暟
-                       + "," + txt_iCount_1.Text.Trim()//寮犳暟
-                       + "," + txt_psnQty_1.Text.Trim()//姣忓紶鏉$爜鏁伴噺
-                       + "}";
-                txt_iCount_1.Text = "";
-                txt_psnQty_1.Text = "";
+                _print(0);
             };
             //鎵撳嵃鎵归噺鎿嶄綔浜嬩欢
             this.ucBtnPrint1.btnAllClick += (s, e) =>
             {
                 string rowGuid = lbMxGuid.Text.Trim();
-                SelectDeleteBar frm = new SelectDeleteBar(rowGuid, "閲囪喘鍏ュ簱");
+                SelectDeleteBar frm = new SelectDeleteBar(rowGuid, "鐢熶骇閫�鏂�");
                 string strCodeList = "";
                 string strAction = "";
                 frm.UpdateParent += (ss, ee) =>
@@ -186,6 +161,11 @@
                     }
                 }
             };
+            //鐩存帴鎵撳嵃浜嬩欢
+            this.ucBtnPrint1.btnZhiJieClick += (s, e) =>
+            {
+                _print(1);
+            };
             gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged;
             //鎵撳嵃鑷姩璁$畻
             txt_psnQty_1.TextChanged += (s, e) =>
@@ -196,8 +176,86 @@
             {
                 Gs.DevApp.ToolBox.UtilityHelper.PrintAuto(txt_psnQty_1, txt_iCount_1, radOut, txt_yuliang_1);
             };
-        }
+            //鍏ㄩ儴鎵撳嵃
+            ucBtnPrintAll1.btnPrintClick += (s, e) =>
+            {
+                this.ucBtnPrintAll1.rptType = "";
+                this.ucBtnPrintAll1.mxList = null;
+                if (string.IsNullOrEmpty(lbGuid.Text.Trim()))
+                {
+                    MsgHelper.ShowError("鎻愮ず锛氭墦鍗板墠璇峰厛淇濆瓨鍗曟嵁锛�");
+                    return;
+                }
+                getModel(lbGuid.Text.Trim());
+                List<dynamic> lst = new List<dynamic>();
+                DataTable dt = (DataTable)gcMx1.DataSource;
+                foreach (DataRow row in dt.Rows)
+                {
+                    string guid = row["guid"].ToString();
+                    string psnQty = row["kdy"].ToString();
+                    if (string.IsNullOrEmpty(psnQty))
+                    {
+                        continue;
+                    }
+                    if (psnQty == "0")
+                    {
+                        continue;
+                    }
+                    lst.Add(new
+                    {
+                        guid = guid,
+                        kdy = psnQty,
+                    });
+                }
+                if (lst.Count <= 0)
+                {
+                    MsgHelper.ShowError("鎻愮ず锛氭殏鏃犲彲鎵撳嵃鐨勭墿鏂欙紒");
+                    return;
+                }
+                this.ucBtnPrintAll1.rptType = "rpt_SCTL";
+                this.ucBtnPrintAll1.mxList = lst;
+            };
+            #endregion
 
+        }
+        /// <summary>
+        /// 鎵撳嵃
+        /// </summary>
+        /// <param name="type">0琛ㄧず棰勮鎵撳嵃锛�1琛ㄧず鐩存帴鎵撳嵃</param>
+        private void _print(int type)
+        {
+            string rowGuid = lbMxGuid.Text.Trim();
+            ucBtnPrint1.guidKey = rowGuid;
+            if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_iCount_1.Text.Trim(), txt_yuliang_1.Text.Trim()))
+            {
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("璇疯緭鍏ユ纭殑鏉$爜鏁伴噺锛�");
+                txt_iCount_1.Focus();
+                this.ucBtnPrint1.rptParameter = "return false";
+                return;
+            }
+            if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_psnQty_1.Text.Trim()))
+            {
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鎵撳嵃鏉$爜鏁伴噺锛�");
+                txt_psnQty_1.Focus();
+                this.ucBtnPrint1.rptParameter = "return false";
+                return;
+            }
+            if (lbMxGuid.Text.Trim().Length < 10)
+            {
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鎵撳嵃鐨勮锛�");
+                this.ucBtnPrint1.rptParameter = "return false";
+                return;
+            }
+            this.ucBtnPrint1.rptParameter = "rpt_SCTL{"
+                   + lbMxGuid.Text.Trim()//鍏宠仈涓婚敭
+                   + "," + ""
+                   + "," + Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(txt_yuliang_1.Text.Trim())//浣欐暟
+                   + "," + txt_iCount_1.Text.Trim()//寮犳暟
+                   + "," + txt_psnQty_1.Text.Trim()//姣忓紶鏉$爜鏁伴噺
+                   + "}";
+            txt_iCount_1.Text = "";
+            txt_psnQty_1.Text = "";
+        }
         private async void GridView1_ColumnFilterChanged(object sender, EventArgs e)
         {
             _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
@@ -270,6 +328,25 @@
         {
             _toolCk(3);
         }
+        /// <summary>
+        /// 鍙嶅搧璐�
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void ToolBarMenu1_btnPingZhiClick(object sender, EventArgs e)
+        {
+            _toolCk(4);
+        }
+        /// <summary>
+        /// 鍝佽川
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void ToolBarMenu1_btnFPingZhiClick(object sender, EventArgs e)
+        {
+            _toolCk(5);
+        }
+
         /// <summary>
         ///     瀹℃牳浜嬩欢
         /// </summary>
@@ -439,15 +516,21 @@
                 txt_tbl002.Focus();
                 return;
             }
-            if (string.IsNullOrEmpty(txt_tbl005.Text.Trim()))
+            if (txt_tbl005.SelectedIndex <= 0)
             {
-                Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鍘熷洜锛�");
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨绫诲瀷锛�");
                 txt_tbl005.Focus();
                 return;
             }
-            if ((txt_tbl005.Text.Trim()=="鑹搧閫�鏂�") && txt_chkOut.Checked)
+            if ((txt_tbl005.Text.Trim() == "鑹搧閫�鏂�") && txt_chkOut.Checked)
             {
-                Gs.DevApp.ToolBox.MsgHelper.ShowError("鑹搧閫�鏂欎笉鑳借嚜鍔ㄧ敓鎴愯ˉ鏂欏崟锛岃妫�鏌ワ紒");
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("鑹搧閫�鏂欎笉鑳借嚜鍔ㄧ敓鎴愯ˉ鏂欏崟锛孿n鍙湁浣滀笟涓嶈壇绫诲瀷鎵嶈兘鐢熸垚琛ユ枡鍗曪紝\n 璇锋鏌ワ紒");
+                txt_tbl005.Focus();
+                return;
+            }
+            if ((txt_tbl005.Text.Trim() == "鏉ユ枡涓嶈壇閫�鏂�") && txt_chkOut.Checked)
+            {
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("鏉ユ枡涓嶈壇閫�鏂欎笉鑳借嚜鍔ㄧ敓鎴愯ˉ鏂欏崟锛孿n鍙湁浣滀笟涓嶈壇绫诲瀷鎵嶈兘鐢熸垚琛ユ枡鍗曪紝\n 璇锋鏌ワ紒");
                 txt_tbl005.Focus();
                 return;
             }
@@ -531,7 +614,11 @@
         /// <param name="pageSize">姣忛〉鍑犳潯</param>
         private void getPageList(int curPage)
         {
-            gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
+            gcMain1.DataSource = null;
+            System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
+            _sbSqlWhere.Append(" and a.tbl023 in");
+            _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
+            _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
             PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "create_date", "asc", "", _sbSqlWhere.ToString());
             string json = JsonConvert.SerializeObject(pgq);
             try
@@ -681,7 +768,7 @@
                         getModel(lbGuid.Text);
                     }
                     else
-                    MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
+                        MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
                 }
                 catch (Exception ex)
                 {
@@ -711,6 +798,12 @@
                 case 3:
                     strMsg = "鍙嶆壒鍑�";
                     break;
+                case 4:
+                    strMsg = "鍝佽川瀹℃牳";
+                    break;
+                case 5:
+                    strMsg = "鍝佽川鍙嶅鏍�";
+                    break;
             }
             ;
             toolBarMenu1.guidKey = "";
@@ -727,7 +820,7 @@
             {
                 guid = rowGuid,
                 inFieldValue = _inFieldValue,
-             
+
             };
             try
             {

--
Gitblit v1.9.3