From 2c207987d291f7ab5f1f68e21c591dd98916294f Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期四, 16 十月 2025 11:17:06 +0800
Subject: [PATCH] 1

---
 Model/基础资料/基础资料/ClsGy_Property_Model.cs                  |    7 +++++++
 WebAPI/Controllers/Sc_MouldRepairInBillListController.cs |   46 ++++++++++++++++++++++++++++++++++++----------
 2 files changed, 43 insertions(+), 10 deletions(-)

diff --git "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_Property_Model.cs" "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_Property_Model.cs"
index ec04e8d..72f71be 100644
--- "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_Property_Model.cs"
+++ "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_Property_Model.cs"
@@ -14,5 +14,12 @@
 
         public Int64 HUSEORGID;//使用组织
         public Int64 HCREATEORGID;//创建组织
+
+        public string HAuxpuID;
+
+        public string HMaterID;
+        public string HISDefault;
+        public string HSno;
+
     }
 }
diff --git a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
index 62774c8..f77ca59 100644
--- a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
+++ b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -13326,8 +13326,8 @@
                     return objJsonResult;
                 }
 
-                sWhere = sWhere.Replace("'", "''");
-                if (sWhere == null || sWhere.Equals(""))
+                sWhere = sWhere?.Replace("'", "''") ?? "";
+                if (string.IsNullOrEmpty(sWhere))
                 {
                     ds = oCn.RunProcReturn("exec h_p_Sc_MouldLifeChangeBillList_Query " + page + "," + size + ",''", "h_p_Sc_MouldLifeChangeBillList_Query");
                 }
@@ -13336,19 +13336,45 @@
                     ds = oCn.RunProcReturn("exec h_p_Sc_MouldLifeChangeBillList_Query " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldLifeChangeBillList_Query");
                 }
 
-                //娣诲姞鍒楀悕
-                foreach (DataColumn col in ds.Tables[0].Columns)
+                // 娣诲姞绌哄�兼鏌�
+                if (ds == null || ds.Tables.Count == 0)
                 {
-                    Type dataType = col.DataType;
-                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
-                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                    objJsonResult.code = CodeConstant.SUCCEED;
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏌ヨ鎴愬姛锛屼絾鏃犳暟鎹紒";
+                    objJsonResult.list = columnNameList;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                // 妫�鏌ョ涓�涓〃
+                if (ds.Tables[0] != null)
+                {
+                    //娣诲姞鍒楀悕
+                    foreach (DataColumn col in ds.Tables[0].Columns)
+                    {
+                        Type dataType = col.DataType;
+                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));
+                    }
+                }
+
+                // 妫�鏌ョ浜屼釜琛ㄥ拰琛屾暟鎹�
+                int totalCount = 0;
+                if (ds.Tables.Count > 1 && ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0)
+                {
+                    var countRow = ds.Tables[1].Rows[0]["count"];
+                    if (countRow != null && countRow != DBNull.Value)
+                    {
+                        totalCount = int.Parse(countRow.ToString());
+                    }
                 }
 
                 objJsonResult.code = CodeConstant.SUCCEED;
-                objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
-                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.count = totalCount;
+                objJsonResult.Message = "Success锛�";
                 objJsonResult.list = columnNameList;
-                objJsonResult.data = ds.Tables[0];
+                objJsonResult.data = ds.Tables[0] ?? new DataTable(); // 纭繚涓嶄负null
                 return objJsonResult;
             }
             catch (Exception e)

--
Gitblit v1.9.1