From dbafcedefd3840d48b978de50141a15cffcc1e09 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期五, 25 十月 2024 09:59:33 +0800
Subject: [PATCH] Merge branch 'master' of http://43.142.96.171:8080/r/~tjx/GsMesClient

---
 DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.cs |  224 +++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 132 insertions(+), 92 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.cs b/DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.cs
index 25acef1..99d12cc 100644
--- a/DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.cs
@@ -1,27 +1,28 @@
-锘縰sing DevExpress.XtraEditors.Controls;
-using Gs.DevApp.Entity;
-using Gs.DevApp.ToolBox;
-using Newtonsoft.Json;
-using System;
+锘縰sing System;
 using System.Collections.Generic;
 using System.Data;
 using System.Windows.Forms;
+using DevExpress.XtraEditors;
+using DevExpress.XtraEditors.Controls;
+using Gs.DevApp.Entity;
+using Gs.DevApp.ToolBox;
+using Newtonsoft.Json;
 
 namespace Gs.DevApp.DevFrm.Sys
 {
-    public partial class DocNoRule : DevExpress.XtraEditors.XtraForm
+    public partial class DocNoRule : XtraForm
     {
         public DocNoRule()
         {
             InitializeComponent();
-            this.toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick;
-            this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick;
-            this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick;
-            this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
-            this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
-            this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
-            this.toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
-            this.toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
+            toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick;
+            toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick;
+            toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick;
+            toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
+            toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
+            toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
+            toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
+            toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
             gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
             getPageList(1, UtilityHelper.GetPageSize());
             pageBar1.PagerEvent += PageBar1_PagerEvent;
@@ -32,26 +33,31 @@
             txxtItem3.EditValueChanged += TxxtItem1_EditValueChanged;
             txxtItem4.EditValueChanged += TxxtItem1_EditValueChanged;
             txt_noLength.ValueChanged += Txt_noLength_ValueChanged;
-            txt_isIncludeDoc.CheckedChanged += Txt_flagIncludeDocCode_CheckedChanged;
-            txt_isSpilit.CheckedChanged += Txt_flagIncludeDocCode_CheckedChanged;
+            txt_isIncludeDoc.CheckedChanged +=
+                Txt_flagIncludeDocCode_CheckedChanged;
+            txt_isSpilit.CheckedChanged +=
+                Txt_flagIncludeDocCode_CheckedChanged;
         }
+
         /// <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");
+            var rowGuid =
+                UtilityHelper.GetCurrentDoubleRow(gridView1, e, "guid");
             if (!string.IsNullOrEmpty(rowGuid))
             {
                 getModel(rowGuid, false, 999);
-                txxtItem1.Enabled = txxtItem2.Enabled = txxtItem3.Enabled = txxtItem4.Enabled = false;
-
+                txxtItem1.Enabled = txxtItem2.Enabled =
+                    txxtItem3.Enabled = txxtItem4.Enabled = false;
             }
         }
+
         /// <summary>
-        /// 鍒嗛〉浜嬩欢
+        ///     鍒嗛〉浜嬩欢
         /// </summary>
         /// <param name="curPage"></param>
         /// <param name="pageSize"></param>
@@ -59,33 +65,38 @@
         {
             getPageList(curPage, pageSize);
         }
+
         /// <summary>
-        /// 鍙嶅鏍�
+        ///     鍙嶅鏍�
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
         /// <exception cref="NotImplementedException"></exception>
         private void ToolBarMenu1_btnFChkClick(object sender, EventArgs e)
         {
-            this.toolBarMenu1.guidKey = "";
+            toolBarMenu1.guidKey = "";
             string rowGuid, rowName;
-            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_docCode, gridView1);
-            this.toolBarMenu1.guidKey = rowGuid;
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
+                lbGuid, txt_docCode, gridView1);
+            toolBarMenu1.guidKey = rowGuid;
         }
+
         /// <summary>
-        /// 瀹℃牳浜嬩欢
+        ///     瀹℃牳浜嬩欢
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
         private void ToolBarMenu1_btnChkClick(object sender, EventArgs e)
         {
-            this.toolBarMenu1.guidKey = "";
+            toolBarMenu1.guidKey = "";
             string rowGuid, rowName;
-            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_docCode, gridView1);
-            this.toolBarMenu1.guidKey = rowGuid;
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
+                lbGuid, txt_docCode, gridView1);
+            toolBarMenu1.guidKey = rowGuid;
         }
+
         /// <summary>
-        /// 鍙栨秷浜嬩欢
+        ///     鍙栨秷浜嬩欢
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
@@ -93,44 +104,50 @@
         {
             UtilityHelper.JumpToTab(xtraTabControl1, 0);
         }
+
         /// <summary>
-        /// 鍒犻櫎浜嬩欢
+        ///     鍒犻櫎浜嬩欢
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
         private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
         {
             string rowGuid, rowName;
-            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_docCode, gridView1);
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
+                lbGuid, txt_docCode, gridView1);
             if (string.IsNullOrEmpty(rowGuid))
             {
-                ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
+
             if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鍒犻櫎鍚楋紵"))
                 return;
 
-            List<string> lst = new List<string>();
+            var lst = new List<string>();
             lst.Add(rowGuid);
             var _obj = lst;
             try
             {
-                string strJson = UtilityHelper.HttpPost("", "DocNoRule/DeleteModel", JsonConvert.SerializeObject(_obj));
-                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
+                var strJson = UtilityHelper.HttpPost("",
+                    "DocNoRule/DeleteModel", JsonConvert.SerializeObject(_obj));
+                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                 if (_rtn.rtnCode > 0)
                 {
                     UtilityHelper.JumpToTab(xtraTabControl1, 0);
                     getPageList(1, UtilityHelper.GetPageSize());
                 }
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+
+                MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
             }
             catch (Exception ex)
             {
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
         }
+
         /// <summary>
-        /// 鍒锋柊浜嬩欢
+        ///     鍒锋柊浜嬩欢
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
@@ -139,25 +156,30 @@
             UtilityHelper.JumpToTab(xtraTabControl1, 0);
             getPageList(1, UtilityHelper.GetPageSize());
         }
+
         /// <summary>
-        /// 淇敼浜嬩欢
+        ///     淇敼浜嬩欢
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
         private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e)
         {
             string rowGuid, rowName;
-            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_docCode, gridView1);
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
+                lbGuid, txt_docCode, gridView1);
             if (string.IsNullOrEmpty(rowGuid))
             {
-                ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
+
             getModel(rowGuid, true, 1);
-            txxtItem1.Enabled = txxtItem2.Enabled = txxtItem3.Enabled = txxtItem4.Enabled = panelControl1.Enabled = true;
+            txxtItem1.Enabled = txxtItem2.Enabled = txxtItem3.Enabled =
+                txxtItem4.Enabled = panelControl1.Enabled = true;
         }
+
         /// <summary>
-        /// 鏂板浜嬩欢
+        ///     鏂板浜嬩欢
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
@@ -165,116 +187,130 @@
         {
             UtilityHelper.JumpToTab(xtraTabControl1, 1);
             lbGuid.Text = "";
-            UtilityHelper.CleanValueByControl(this.panel1.Controls, true);
-            txxtItem1.SelectedIndex = txxtItem2.SelectedIndex = txxtItem3.SelectedIndex = txxtItem4.SelectedIndex = 0;
-            txxtItem1.Enabled = txxtItem2.Enabled = txxtItem3.Enabled = txxtItem4.Enabled = panelControl1.Enabled = true;
+            UtilityHelper.CleanValueByControl(panel1.Controls, true);
+            txxtItem1.SelectedIndex = txxtItem2.SelectedIndex =
+                txxtItem3.SelectedIndex = txxtItem4.SelectedIndex = 0;
+            txxtItem1.Enabled = txxtItem2.Enabled = txxtItem3.Enabled =
+                txxtItem4.Enabled = panelControl1.Enabled = true;
         }
+
         /// <summary>
-        /// 淇濆瓨浜嬩欢
+        ///     淇濆瓨浜嬩欢
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
         private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
         {
             toolBarMenu1.isSetBtn = false;
-            if (txt_docCode.EditValue == null || string.IsNullOrEmpty(txt_docCode.EditValue.ToString()))
+            if (txt_docCode.EditValue == null ||
+                string.IsNullOrEmpty(txt_docCode.EditValue.ToString()))
             {
-                ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨鍗曟嵁绫诲瀷锛�");
+                MsgHelper.Warning("璇峰厛閫夋嫨鍗曟嵁绫诲瀷锛�");
                 txt_docCode.Focus();
                 return;
             }
-            if ((txxtItem1.SelectedIndex + txxtItem2.SelectedIndex + txxtItem3.SelectedIndex + txxtItem4.SelectedIndex) <= 0)
+
+            if (txxtItem1.SelectedIndex + txxtItem2.SelectedIndex +
+                txxtItem3.SelectedIndex + txxtItem4.SelectedIndex <= 0)
             {
-                ToolBox.MsgHelper.Warning("璇疯嚦灏戦�夋嫨涓�涓弬鏁帮紒");
+                MsgHelper.Warning("璇疯嚦灏戦�夋嫨涓�涓弬鏁帮紒");
                 txxtItem1.Focus();
                 return;
             }
+
             if (txt_docFormat.Text.Length <= 0)
             {
-                ToolBox.MsgHelper.Warning("璇峰厛閰嶇疆鍙傛暟锛�");
+                MsgHelper.Warning("璇峰厛閰嶇疆鍙傛暟锛�");
                 txt_docCode.Focus();
                 return;
             }
+
             var _obj = new
             {
-                guid = lbGuid.Text.Trim(),//涓诲缓
+                guid = lbGuid.Text.Trim(), //涓诲缓
                 docCode = txt_docCode.EditValue.ToString(),
-                docFormat = txt_docFormat.Text.ToString(),
+                docFormat = txt_docFormat.Text,
                 noLength = txt_noLength.Value.ToString(),
                 resetZero = txt_resetZero.Checked,
                 isSpilit = txt_isSpilit.Checked,
-                isIncludeDoc = txt_isIncludeDoc.Checked,
+                isIncludeDoc = txt_isIncludeDoc.Checked
             };
             try
             {
-                string strJson = UtilityHelper.HttpPost("", "DocNoRule/EditModel", JsonConvert.SerializeObject(_obj));
-                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+                var strJson = UtilityHelper.HttpPost("", "DocNoRule/EditModel",
+                    JsonConvert.SerializeObject(_obj));
+                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
+                MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
                 if (_rtn.rtnCode > 0)
                 {
                     lbGuid.Text = _rtn.rtnData;
                     toolBarMenu1.isSetBtn = true;
-                    UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false);
+                    UtilityHelper.ChangeEnableByControl(panel1.Controls, false);
                 }
             }
             catch (Exception ex)
             {
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
         }
+
         /// <summary>
-        /// 
         /// </summary>
         /// <param name="curPage">绗嚑椤�</param>
         /// <param name="pageSize">姣忛〉鍑犳潯</param>
         private void getPageList(int curPage, int pageSize)
         {
-            PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "doc_Code", "asc", "", "");
-            string json = JsonConvert.SerializeObject(pgq);
+            var pgq = new PageQueryModel(curPage, pageSize, "doc_Code");
+            var json = JsonConvert.SerializeObject(pgq);
             try
             {
-                string strReturn = UtilityHelper.HttpPost("", "DocNoRule/GetListPage", json);
-                ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn);
-                DataTable dt = dd.rtnData.list;
+                var strReturn =
+                    UtilityHelper.HttpPost("", "DocNoRule/GetListPage", json);
+                var dd = UtilityHelper.ReturnToTablePage(strReturn);
+                var dt = dd.rtnData.list;
                 gcMain.BindingContext = new BindingContext();
                 gcMain.DataSource = dt;
                 gcMain.ForceInitialize();
-                int dddd = dd.rtnData.pages;//鎬婚〉
+                var dddd = dd.rtnData.pages; //鎬婚〉
                 pageBar1.TotalPages = dddd;
-                pageBar1.RecordCount = dd.rtnData.total;//璁板綍鎬绘暟
-                pageBar1.CurrentPage = curPage;//褰撳墠椤�
-                pageBar1.RowsCount = pageSize;//姣忛〉鏄剧ず
+                pageBar1.RecordCount = dd.rtnData.total; //璁板綍鎬绘暟
+                pageBar1.CurrentPage = curPage; //褰撳墠椤�
+                pageBar1.RowsCount = pageSize; //姣忛〉鏄剧ず
                 pageBar1.setTxt();
             }
             catch (Exception ex)
             {
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
         }
+
         private void getModel(string strGuid, bool isEdit, int tabIdx)
         {
             if (string.IsNullOrEmpty(strGuid))
             {
-                ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
+
             UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
             var _obj = new
             {
-                guid = strGuid,//涓诲缓
+                guid = strGuid //涓诲缓
             };
             try
             {
-                string strJson = UtilityHelper.HttpPost("", "DocNoRule/GetModel", JsonConvert.SerializeObject(_obj));
-                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
+                var strJson = UtilityHelper.HttpPost("", "DocNoRule/GetModel",
+                    JsonConvert.SerializeObject(_obj));
+                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                 if (_rtn.rtnCode > 0)
                 {
-                    dynamic dy = _rtn.rtnData;
+                    var dy = _rtn.rtnData;
                     lbGuid.Text = strGuid;
-                    UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit);
+                    UtilityHelper.SetValueByObj(panel1.Controls, dy, isEdit);
                     txt_docCode.EditValue = dy.docCode.ToString();
                     string _rule = dy.docFormat.ToString();
-                    string[] _ary = _rule.Split(new char[] { '<' }, StringSplitOptions.RemoveEmptyEntries);
+                    var _ary = _rule.Split(new[] { '<' },
+                        StringSplitOptions.RemoveEmptyEntries);
                     if (_ary.Length > 0)
                         txxtItem1.Text = "<" + _ary[0];
                     if (_ary.Length > 1)
@@ -285,17 +321,19 @@
                         txxtItem4.Text = "<" + _ary[3];
                 }
                 else
-                    ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+                {
+                    MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+                }
             }
             catch (Exception ex)
             {
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
         }
 
         private void getTree()
         {
-            DataTable dataTable = new DataTable();
+            var dataTable = new DataTable();
             dataTable.Columns.Add("docCode", typeof(string));
             dataTable.Rows.Add("DH(鍒拌揣鍗�)");
             dataTable.Rows.Add("QO(鎶ヤ环鍗�)");
@@ -311,11 +349,13 @@
             dataTable.Rows.Add("PN(鐢熶骇搴�)");
             txt_docCode.Properties.DataSource = dataTable;
             txt_docCode.Properties.DisplayMember = "docCode"; // 鏄剧ず鐨勫垪
-            txt_docCode.Properties.ValueMember = "docCode";     // 瀹為檯鍊肩殑鍒�
-            txt_docCode.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
+            txt_docCode.Properties.ValueMember = "docCode"; // 瀹為檯鍊肩殑鍒�
+            txt_docCode.Properties.TextEditStyle =
+                TextEditStyles.DisableTextEditor;
         }
 
-        private void Txt_flagIncludeDocCode_CheckedChanged(object sender, EventArgs e)
+        private void Txt_flagIncludeDocCode_CheckedChanged(object sender,
+            EventArgs e)
         {
             DoPreviewCode();
         }
@@ -329,6 +369,7 @@
         {
             DoPreviewCode();
         }
+
         private void DoPreviewCode()
         {
             if (txt_docCode.Enabled == false
@@ -337,7 +378,8 @@
                 || txxtItem3.Enabled == false
                 || txxtItem4.Enabled == false)
                 return;
-            var text = txxtItem1.Text + txxtItem2.Text + txxtItem3.Text + txxtItem4.Text;
+            var text = txxtItem1.Text + txxtItem2.Text + txxtItem3.Text +
+                       txxtItem4.Text;
             txt_docFormat.Text = text;
             if (txt_docFormat.Text == "")
             {
@@ -350,24 +392,22 @@
                 var length = int.Parse(txt_noLength.Value.ToString());
                 var docCode = "";
                 if (txt_isIncludeDoc.Checked)
-                {
                     docCode = txt_docCode.EditValue.ToString();
-                }
                 preview = docCode + preview;
                 preview = preview.Replace("<鏃�>", "");
                 preview = preview.Replace("<骞村勾骞村勾>", "2024");
                 preview = preview.Replace("<骞村勾>", "24");
                 preview = preview.Replace("<鏈堟湀>", "06");
                 preview = preview.Replace("<鏃ユ棩>", "18");
-                preview = preview + (txt_isSpilit.Checked ? "-" : "") + "8".PadLeft(length, '0');
+                preview = preview + (txt_isSpilit.Checked ? "-" : "") +
+                          "8".PadLeft(length, '0');
                 lblPreview.Text = "鐢熸垚缂栧彿锛�" + preview;
             }
         }
+
         private void Txt_docCode_EditValueChanged(object sender, EventArgs e)
         {
             DoPreviewCode();
         }
-
     }
-}
-
+}
\ No newline at end of file

--
Gitblit v1.9.3