From 4b51c3551c3957ddd5236a18dd480637835cf7d6 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周一, 01 9月 2025 08:57:40 +0800
Subject: [PATCH] 优化查询

---
 WMS/WMS/UI/Basic/material.cs |   50 +++++++++++++++++++++++++-------------------------
 1 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/WMS/WMS/UI/Basic/material.cs b/WMS/WMS/UI/Basic/material.cs
index 54bb592..d036368 100644
--- a/WMS/WMS/UI/Basic/material.cs
+++ b/WMS/WMS/UI/Basic/material.cs
@@ -84,7 +84,7 @@
                 }
                 else
                 {
-                    this.dataGridView1.DataSource = null;
+                    this.dataGridView1.DataSource = new List<WMS.yunneiWCS.material>();
                     this.toolStripLabel5.Text = "/" + 0;
                     MessageBox.Show("鑾峰彇澶辫触");
                 }
@@ -99,8 +99,8 @@
 
         private void materialAdd_Click(object sender, EventArgs e)
         {
-            addMaterial addmaterial = new addMaterial(1,0,"","",3,"");
-            
+            addMaterial addmaterial = new addMaterial(1, 0, "", "", 3, "");
+
             addmaterial.ShowDialog();
             if (addmaterial.DialogResult == DialogResult.OK)
             {
@@ -111,8 +111,8 @@
 
         private void btnFind_Click(object sender, EventArgs e)
         {
-        name=   textBoxMaterialName.Text.Trim();
-           code=  textBoxMaterialCode.Text.Trim();
+            name = textBoxMaterialName.Text.Trim();
+            code = textBoxMaterialCode.Text.Trim();
             try
             {
                 paging paga = new paging();
@@ -150,8 +150,8 @@
                 ms.Show();
             }
         }
-      
-     
+
+
         /// <summary>鍒嗛〉鍥炶溅閿�
         /// 
         /// </summary>
@@ -161,13 +161,13 @@
         {
             try
             {
-                if (e.KeyCode==Keys.Enter)
+                if (e.KeyCode == Keys.Enter)
                 {
                     int numPapg = 0;
                     int.TryParse(toolStripTextBox1.Text.Trim(), out numPapg);
                     int sizetatol = 0;
-                    int a=this.toolStripLabel5.Text.Trim().Length;
-                    string size = this.toolStripLabel5.Text.Trim().Substring(1, a-1);
+                    int a = this.toolStripLabel5.Text.Trim().Length;
+                    string size = this.toolStripLabel5.Text.Trim().Substring(1, a - 1);
                     int.TryParse(size, out sizetatol);
                     if (numPapg > 0 && numPapg <= sizetatol)
                     {
@@ -198,8 +198,8 @@
                 if (dataGridView1.Columns[e.ColumnIndex].Name == "edit")
                 {
                     int i = dataGridView1.CurrentRow.Index;
-                    int id =Convert.ToInt32( dataGridView1.Rows[i].Cells["materialId"].Value.ToString());
-                    if (id==3||id==4)
+                    int id = Convert.ToInt32(dataGridView1.Rows[i].Cells["materialId"].Value.ToString());
+                    if (id == 3 || id == 4)
                     {
                         WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "绌烘墭鐩樹笉鍏佽缂栬緫");
                         ms.Show();
@@ -207,7 +207,7 @@
                     }
                     string code = dataGridView1.Rows[i].Cells["materialCode"].Value.ToString();
                     string name = dataGridView1.Rows[i].Cells["materialName"].Value.ToString();
-                    int type = dataGridView1.Rows[i].Cells["materialType"].Value.ToString()=="1"?1:0;
+                    int type = dataGridView1.Rows[i].Cells["materialType"].Value.ToString() == "1" ? 1 : 0;
                     string version = dataGridView1.Rows[i].Cells["version"].Value == null ? "" : dataGridView1.Rows[i].Cells["version"].Value.ToString();
                     addMaterial addmaterial = new addMaterial(2, id, code, name, type, version);
 
@@ -223,7 +223,7 @@
                         this.btnReset_Click(null, null);//鍒锋柊涓荤獥浣�
                         WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "淇敼澶辫触");
                         ms.Show();
-                    } 
+                    }
                 }
                 if (dataGridView1.Columns[e.ColumnIndex].Name == "delete")
                 {
@@ -235,12 +235,12 @@
                         ms.Show();
                         return;
                     }
-                    string res = FLogin.wcsWcf.materialOP(3, id, "", "", 0,"");
-                    if (res=="")
+                    string res = FLogin.wcsWcf.materialOP(3, id, "", "", 0, "");
+                    if (res == "")
                     {
                         WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(1, "鍒犻櫎鎴愬姛");
                         ms.Show();
-                        btnReset_Click(null,null);
+                        btnReset_Click(null, null);
                     }
                     else
                     {
@@ -267,13 +267,13 @@
                     switch (dgv.Columns[e.ColumnIndex].Name)
                     {
                         case "materialType":
-                            if ((int)e.Value<2)
+                            if ((int)e.Value < 2)
                             {
                                 e.Value = (int)e.Value == 1 ? "缂镐綋" : "缂哥洊";
                             }
                             else
                             {
-                                e.Value =  "绌烘墭鐩�";
+                                e.Value = "绌烘墭鐩�";
                             }
                             e.FormattingApplied = true;
                             break;
@@ -308,12 +308,12 @@
                 int.TryParse(size, out sizetatol);
                 toolStripLabel4.Enabled = true;
                 if (numPapg <= sizetatol)
-                {  
+                {
 
                     paging paga = new paging();
                     paga.pagenum = numPapg;
                     paga.pagesize = pagesize;
-                    findData(paga,name,code );
+                    findData(paga, name, code);
                     toolStripLabel1.Enabled = true;
                     if (numPapg == sizetatol)
                     {
@@ -458,13 +458,13 @@
         {
             SolidBrush b = new SolidBrush(this.dataGridView1.RowHeadersDefaultCellStyle.ForeColor);
             e.Graphics.DrawString((e.RowIndex + 1).ToString(System.Globalization.CultureInfo.CurrentUICulture), this.dataGridView1.DefaultCellStyle.Font, b, e.RowBounds.Location.X + 20, e.RowBounds.Location.Y + 4);
- 
+
         }
 
-       
 
-   
-      
+
+
+
 
 
 

--
Gitblit v1.9.3