From 20879fb51927c6a192fe50b6fe5ab19600d83641 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期四, 24 十月 2024 20:04:10 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/CJGL/Sc_KeyElementBindingController.cs |  181 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 181 insertions(+), 0 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Sc_KeyElementBindingController.cs b/WebAPI/Controllers/CJGL/Sc_KeyElementBindingController.cs
index f32471c..e1d9db7 100644
--- a/WebAPI/Controllers/CJGL/Sc_KeyElementBindingController.cs
+++ b/WebAPI/Controllers/CJGL/Sc_KeyElementBindingController.cs
@@ -14,9 +14,70 @@
     public class Sc_KeyElementBindingController : ApiController
     {
         Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+        public DAL.ClsSc_AssemblyBill BillOld = new DAL.ClsSc_AssemblyBill();
         private json objJsonResult = new json();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         DataSet ds;
+
+        #region 鍏抽敭浠剁粦瀹氬垪琛� 鏌ヨ
+        /// <summary>
+        /// 杩斿洖鍏抽敭浠剁粦瀹氬垪琛�
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Sc_KeyElementBinding/list")]
+        [HttpGet]
+        public object list(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Sc_AssemblyBill_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_Sc_AssemblyBillList order by 鍗曟嵁鍙� desc", "h_v_Sc_AssemblyBillList");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_Sc_AssemblyBillList where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_Sc_AssemblyBillList");
+                }
+
+                //娣诲姞鍒楀悕
+                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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
 
         #region 宸ュ簭娴佽浆鍗$淮鎶�-鏌ヨ
         /// <summary>
@@ -373,5 +434,125 @@
             }
         }
         #endregion
+
+        #region 鍏抽敭浠剁粦瀹� 鍒犻櫎
+        [Route("Sc_KeyElementBinding/Del")]
+        [HttpGet]
+        public object Del(string HInterID, string user)
+        {
+            try
+            {
+                string s = "";
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Sc_AssemblyBill_Delete", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (HInterID == null || HInterID.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                //鍒ゆ柇鏄惁鍙紪杈�
+                if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽鍒犻櫎锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+
+                //鍒犻櫎鍓嶆帶鍒�=========================================      
+                //string sql1 = "exec h_p_Sc_QualityReportBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                //ds = oCN.RunProcReturn(sql1, "h_p_Sc_QualityReportBill_BeforeDelCtrl");
+                //if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 1;
+                //    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                //if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 1;
+                //    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                //==================================================================================      
+
+                oCN.BeginTran();
+
+                oCN.RunProc("delete from Sc_AssemblyBillMain where HInterID = " + HInterID);
+                oCN.RunProc("delete from Sc_AssemblyBillSub where HInterID='" + HInterID + "'");
+
+                //鍒犻櫎鍚庢帶鍒�==================================================================================      
+                //string sql2 = "exec h_p_Sc_QualityReportBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                //ds = oCN.RunProcReturn(sql2, "h_p_Sc_QualityReportBill_AfterDelCtrl");
+                //if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                //{
+                //    s = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 1;
+                //    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s;
+                //    objJsonResult.data = null;
+                //    oCN.RollBack();
+                //    return objJsonResult;
+                //}
+                //if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                //{
+                //    s = ds.Tables[0].Rows[0]["HRemark"].ToString();
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 1;
+                //    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s;
+                //    objJsonResult.data = null;
+                //    oCN.RollBack();
+                //    return objJsonResult;
+                //}
+                //==============================================================================================
+
+
+                oCN.Commit();
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎮ㄥ凡鍒犻櫎鍗曟嵁鍙蜂负" + BillOld.omodel.HBillNo + "鐨勫叧閿欢缁戝畾淇℃伅锛�";
+                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;
+            }
+        }
+        #endregion
+
     }
 }

--
Gitblit v1.9.1