From f23d33d0cf77a73d449cd7c38effda9e50c8fda4 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期四, 06 三月 2025 08:13:37 +0800
Subject: [PATCH] 版面

---
 DevApp/Gs.DevApp/DevFrm/Sys/Frm_PrintInfo.cs |  106 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 67 insertions(+), 39 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Sys/Frm_PrintInfo.cs b/DevApp/Gs.DevApp/DevFrm/Sys/Frm_PrintInfo.cs
index 2ae8ef1..ea1b9b7 100644
--- a/DevApp/Gs.DevApp/DevFrm/Sys/Frm_PrintInfo.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Sys/Frm_PrintInfo.cs
@@ -6,6 +6,8 @@
 using System;
 using System.Collections.Generic;
 using System.Data;
+using System.Net;
+using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 
@@ -26,28 +28,30 @@
             this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
             this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
             this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
-            gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
+            List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
+            gvList.Add(gridView1);
+            Gs.DevApp.ToolBox.UtilityHelper.getGridViewConfig(this.GetType().FullName, gvList);
+            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1,null, null, "", "", (value) =>
+            {
+                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
+            });
+            Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
+            {
+                getModel(value);
+            }, (value) =>
+            {
+                getPageList(this.pageBar1.CurrentPage);
+            });
             getPageList(1);
             pageBar1.PagerEvent += PageBar1_PagerEvent;
-            Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1);
         }
         private async void GridView1_ColumnFilterChanged(object sender, EventArgs e)
         {
-            _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns);
+            Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
             await Task.Delay(100);
             getPageList(1);
         }
-        /// <summary>
-        /// 鍙屽嚮浜嬩欢
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e)
-        {
-            string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gridView1, e, "guid");
-            if (!string.IsNullOrEmpty(rowGuid))
-                getModel(rowGuid, false, 999);
-        }
+       
         /// <summary>
         /// 鍒嗛〉浜嬩欢
         /// </summary>
@@ -89,7 +93,7 @@
         /// <param name="e"></param>
         private void ToolBarMenu1_btnEscClick(object sender, EventArgs e)
         {
-            UtilityHelper.JumpToTab(xtraTabControl1, 0);
+            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 1);
         }
 
         /// <summary>
@@ -100,7 +104,7 @@
         private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
         {
             string rowGuid = "", rowName = "";
-           (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_printNo, gridView1);
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_printNo, gridView1);
             if (string.IsNullOrEmpty(rowGuid))
             {
                 ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
@@ -117,8 +121,11 @@
                 ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                 if (_rtn.rtnCode > 0)
                 {
-                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
-                    getPageList(1);
+                    if (xtraTabControl1.SelectedTabPageIndex == 0)
+                    { }
+                    else
+                        Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2);
+                    getPageList(this.pageBar1.CurrentPage);
                 }
                 ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
             }
@@ -136,17 +143,18 @@
         private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
         {
             if (xtraTabControl1.SelectedTabPageIndex == 1)
-                getModel(lbGuid.Text.Trim(), false, 999);
+                getModel(lbGuid.Text.Trim());
             else
             {
-                _filterList.Clear();
-                if (gridView1.ActiveFilter.Count > 0)
-                {
-                    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
-                    gridView1.ActiveFilter.Clear();
-                    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
-                }
-                getPageList(1);
+                //_filterList.Clear();
+                //if (gridView1.ActiveFilter.Count > 0)
+                //{
+                //    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
+                //    gridView1.ActiveFilter.Clear();
+                //    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
+                //}
+                //getPageList(1);
+                getPageList(this.pageBar1.CurrentPage);
             }
         }
         /// <summary>
@@ -157,13 +165,21 @@
         private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e)
         {
             string rowGuid = "", rowName = "";
-           (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_printNo, gridView1);
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_printNo, gridView1);
             if (string.IsNullOrEmpty(rowGuid))
             {
                 ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
-            getModel(rowGuid, true, 1);
+            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
+            if (xtraTabControl1.SelectedTabPageIndex == 1)
+            {
+                getModel(lbGuid.Text.Trim());
+            }
+            else
+            {
+                UtilityHelper.ChangeEnableByControl(panel1.Controls, true);
+            }
         }
         /// <summary>
         /// 鏂板浜嬩欢
@@ -172,9 +188,9 @@
         /// <param name="e"></param>
         private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
         {
-            UtilityHelper.JumpToTab(xtraTabControl1, 1);
             lbGuid.Text = "";
-            UtilityHelper.CleanValueByControl(this.panel1.Controls, true);
+            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4);
+            UtilityHelper.CleanValueByControl(panel1.Controls, true);
 
         }
         /// <summary>
@@ -194,21 +210,26 @@
             if (string.IsNullOrEmpty(txt_ip.Text.Trim()))
             {
                 Gs.DevApp.ToolBox.MsgHelper.Warning("IP涓嶈兘涓虹┖锛�");
-                txt_printNo.Focus();
+                txt_ip.Focus();
                 return;
             }
             if (string.IsNullOrEmpty(txt_port.Text.Trim()))
             {
                 Gs.DevApp.ToolBox.MsgHelper.Warning("绔彛涓嶈兘涓虹┖锛�");
-                txt_printNo.Focus();
+                txt_port.Focus();
+                return;
+            }
+            if (!validateIpAddress(txt_ip.Text.Trim())) {
+                MessageBox.Show("璇疯緭鍏ユ纭殑IP鍦板潃");
+                txt_ip.Focus();
                 return;
             }
             var _obj = new PrintInfo
             {
                 Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓
-                PrintNo= txt_printNo.Text.Trim(),
+                PrintNo = txt_printNo.Text.Trim(),
                 Ip = txt_ip.Text.Trim(),
-                Port= txt_port.Text.Trim(),
+                Port = txt_port.Text.Trim(),
                 Remark = txt_remark.Text.Trim(),
             };
             try
@@ -234,7 +255,7 @@
         /// </summary>
         /// <param name="curPage">绗嚑椤�</param>
         /// <param name="pageSize">姣忛〉鍑犳潯</param>
-        private  void getPageList(int curPage)
+        private void getPageList(int curPage)
         {
             var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
             var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.print_no",
@@ -242,7 +263,7 @@
             var json = JsonConvert.SerializeObject(pgq);
             try
             {
-                var strReturn =  UtilityHelper.HttpPost("",
+                var strReturn = UtilityHelper.HttpPost("",
                     _webServiceName + "GetListPage", json);
                 var dd = UtilityHelper.ReturnToTablePage(strReturn);
                 if (dd.rtnCode > 0)
@@ -278,14 +299,16 @@
         /// <param name="strGuid">涓婚敭</param>
         /// <param name="isEdit">鏄惁鍙紪杈�</param>
         /// <param name="tabIdx">閫夐」鍗″簭鍙�</param>
-        private void getModel(string strGuid, bool isEdit, int tabIdx)
+        private void getModel(string strGuid)
         {
+            bool isEdit = false;
+            if (toolBarMenu1.currentAction == "add") return;
+            if (toolBarMenu1.currentAction == "edit") isEdit = true;
             if (string.IsNullOrEmpty(strGuid))
             {
                 ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
-            UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
             var _obj = new
             {
                 guid = strGuid,//涓诲缓
@@ -308,5 +331,10 @@
                 ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
         }
+        private bool validateIpAddress(string ip)
+        {
+            string pattern = @"^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
+            return Regex.IsMatch(ip, pattern);
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3