From e9beac86f7a46e49452584d09a51fbd78b6f3fdc Mon Sep 17 00:00:00 2001
From: YL <YL@LAPTOP-SE03PLUR>
Date: 星期二, 12 十月 2021 16:34:07 +0800
Subject: [PATCH] nothing

---
 WebAPI/Controllers/Pay_SingleBalBillController.cs |  143 +++++++++++++++++++++++++----------------------
 1 files changed, 75 insertions(+), 68 deletions(-)

diff --git a/WebAPI/Controllers/Pay_SingleBalBillController.cs b/WebAPI/Controllers/Pay_SingleBalBillController.cs
index 206cecf..9a209c8 100644
--- a/WebAPI/Controllers/Pay_SingleBalBillController.cs
+++ b/WebAPI/Controllers/Pay_SingleBalBillController.cs
@@ -27,48 +27,45 @@
         ///鍙傛暟锛歴tring sql銆�
         ///杩斿洖鍊硷細object銆�
         /// </summary>
-        [Route("Pay_SingleBalBill/list")]
+       [Route("Pay_SingleBalBill/GetSingleBalBill")]
         [HttpGet]
-        public object list(string sWhere)
+        public object GetSingleBalBill(string sWhere)
         {
             try
             {
-                if (sWhere == null || sWhere.Equals(""))
-                {
-                    ds = oCN.RunProcReturn("select * from h_v_Pay_SingleBalBillList " + sWhere, "h_v_Pay_SingleBalBillList");
-                }
-                else
-                {
-                    string sql1 = "select * from h_v_Pay_SingleBalBillList where 1 = 1 ";
-                    string sql = sql1 + sWhere;
-                    ds = oCN.RunProcReturn(sql, "h_v_Pay_SingleBalBillList");
-                }
-                if (ds == null || ds.Tables[0].Rows.Count == 0)
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "false锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "Sucess锛�";
-                    objJsonResult.data = ds.Tables[0];
-                    return objJsonResult;
-                }
+
+                ds = Sc_GetSingleBalBill(sWhere);
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
             }
-            catch (Exception e)
+            catch (Exception ex)
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString();
                 objJsonResult.data = null;
                 return objJsonResult;
             }
         }
+
+        public static DataSet Sc_GetSingleBalBill(string sWhere)
+        {
+            if (sWhere == null || sWhere.Equals(""))
+            {
+                return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Pay_SingleBalBillList order by 鏃ユ湡 desc", "h_v_Pay_SingleBalBillList");
+            }
+            else
+            {
+                string sql1 = "select * from h_v_Pay_SingleBalBillList where 1 = 1 ";
+                string sql = sql1 + sWhere + "order by 鏃ユ湡 desc";
+                return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Pay_SingleBalBillList");
+            }
+
+        }
+       
         #region[宸ヨ祫缁撶畻涓汉鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁]
         [Route("Pay_SingleBalBill/Pay_SingleBalBillListCheckDetail")]
         [HttpGet]
@@ -95,34 +92,16 @@
             try
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                if (sqlWhere == null || sqlWhere.Equals(""))
-                {
-                    ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID 鐗╂枡浠g爜,鐗╂枡鍚嶇О, HDeptID 閮ㄩ棬浠g爜,閮ㄩ棬,HGroupID 鐝粍浠g爜,鐝粍,宸ヨ祫绫诲瀷,鎽樿,鍐呴儴鍗曟嵁鍙�,
-		                                                    琛ㄥご澶囨敞,鍒跺崟浜�,鍒跺崟鏃ユ湡,瀹℃牳浜�,瀹℃牳鏃ユ湡,淇敼浜�,淇敼鏃ユ湡,鍏抽棴浜�, 鍏抽棴鏃ユ湡,HProcID 宸ュ簭浠g爜,宸ュ簭鍚嶇О,
-		                                                    HEmpID 鑱屽憳浠g爜,鑱屽憳,宸ユ椂,鏁伴噺,宸ヤ环,閲戦
-                                                           FROM h_v_Pay_SingleBalBillList"), "h_v_Pay_SingleBalBillList");
-
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
-                }
-                else
-                {
-
-                    //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark  from Sc_MouldRepairCheckBillSub where 1 = 1 ";
-                    string sql1 = string.Format(@"SELECT HMaterID 鐗╂枡浠g爜,鐗╂枡鍚嶇О, HDeptID 閮ㄩ棬浠g爜,閮ㄩ棬,HGroupID 鐝粍浠g爜,鐝粍,宸ヨ祫绫诲瀷,鎽樿,鍐呴儴鍗曟嵁鍙�,
-		                                                    琛ㄥご澶囨敞,鍒跺崟浜�,鍒跺崟鏃ユ湡,瀹℃牳浜�,瀹℃牳鏃ユ湡,淇敼浜�,淇敼鏃ユ湡,鍏抽棴浜�, 鍏抽棴鏃ユ湡,HProcID 宸ュ簭浠g爜,宸ュ簭鍚嶇О,
-		                                                    HEmpID 鑱屽憳浠g爜,鑱屽憳,宸ユ椂,鏁伴噺,宸ヤ环,閲戦
-                                                           FROM h_v_Pay_SingleBalBillList where 1 = 1 ");
-                    string sql = sql1 + sqlWhere;
-                    ds = oCN.RunProcReturn(sql, "h_v_Pay_SingleBalBillList");
-
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
-                }
+                string sql1 = "SELECT HMaterID,鐗╂枡浠g爜,鐗╂枡鍚嶇О, HDeptID,閮ㄩ棬浠g爜,閮ㄩ棬" +
+                    ",HGroupID,鐝粍浠g爜,鐝粍,宸ヨ祫绫诲瀷,鎽樿,鍐呴儴鍗曟嵁鍙�,琛ㄥご澶囨敞,鍒跺崟浜�,鍒跺崟鏃ユ湡" +
+                    ",瀹℃牳浜�,瀹℃牳鏃ユ湡,淇敼浜�,淇敼鏃ユ湡,鍏抽棴浜�, 鍏抽棴鏃ユ湡,HProcID,宸ュ簭浠g爜,宸ュ簭鍚嶇О" +
+                    ",HEmpID,鑱屽憳浠g爜,鑱屽憳,宸ユ椂,鏁伴噺,宸ヤ环,閲戦 FROM h_v_Pay_SingleBalBillList where 1 = 1 ";
+                string sql = sql1 + sqlWhere;
+                ds = oCN.RunProcReturn(sql, "h_v_Pay_SingleBalBillList");
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
             }
             catch (Exception e)
             {
@@ -195,15 +174,14 @@
                 int HPRDORGID = mainList[0].HPRDORGID;  //缁勭粐
 
                 //涓昏〃
-                oCN.RunProc("Insert Into Pay_SingleBalBillMain   " +
-                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
-                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
-                ",HGroupID,HDeptID,HEmpID,HPayType,HExplanation,HInnerBillNo" +
-                ") " +
-                " values('" + HBillType + "'," + HBillSubType + ",'" + HInterID + "','" + HBillNo + "','" + HDate + "'" +
-                "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()," + HGroupID + "," + HDeptID + "," + HEmpID + ","+
-                "," + HPayType + "," + HExplanation + ",'" + HInnerBillNo + "'," + 
-                ") ");
+                oCN.RunProc(" Insert Into Pay_SingleBalBillMain " + 
+                    "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + 
+                    ",HYear,HPeriod,HRemark,HMaker" + 
+                    ",HGroupID,HDeptID,HEmpID,HPayType,HExplanation,HInnerBillNo" + ")" +
+                    "values('" + HBillType + "'" + HBillSubType + "," + HInterID + ",'" + HBillNo + "','" + HDate +
+                    "',"+ HDeptID + "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "'," + HGroupID + 
+                    "," + HEmpID + ","+ HPayType +",'" + HInnerBillNo + "'" + HExplanation + 
+                   ") ");
 
                 //淇濆瓨瀛愯〃
                 objJsonResult = AddBillSub(msg3, HInterID);
@@ -316,7 +294,36 @@
             objJsonResult.data = null;
             return objJsonResult;
         }
-
+        /// <summary>
+        ///宸ヨ祫缁撶畻涓汉鍗曞垹闄ゅ姛鑳�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Pay_SingleBalBill/DeltetSingleBalBill")]
+        [HttpGet]
+        public object Pay_SingleBalBill(string HInterID)
+        {
+            try
+            {
+                oCN.BeginTran();
+                oCN.RunProc("Delete From Pay_SingleBalBillMain where HInterID = " + HInterID);
+                oCN.RunProc("Delete From Pay_SingleBalBillSub where HInterID = " + HInterID);
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
         //
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1