From 871bc633a7daf1893acc98a84c64c93c9a30aaff Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期二, 10 十二月 2024 15:28:13 +0800
Subject: [PATCH] 器具保养规程、器具点检规程、设备点检规程导出添加

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

diff --git a/WebAPI/Controllers/CJGL/Sc_KeyElementBindingController.cs b/WebAPI/Controllers/CJGL/Sc_KeyElementBindingController.cs
index f32471c..67195a9 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,187 @@
             }
         }
         #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
+
+        [Route("Sc_KeyElementBinding/UpdatePartsCode")]
+        [HttpGet]
+        /// <summary>
+        /// 鏇挎崲閰嶄欢鐮佺粦瀹�
+        /// </summary>
+        /// <param name=""></param>
+        /// <returns></returns>
+        public object UpdatePartsCode(string HInterID, string HEntryID, string HPartsCode,string HPartsOld,string HOrgID,string user)
+        {
+            try
+            {
+                if (HInterID == null || HInterID == "" || HInterID == "undefined" || HEntryID == null || HEntryID == "" || HEntryID == "undefined")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎿嶄綔澶辫触锛佷富鍐呯爜鎴栧瓙鍐呯爜涓虹┖";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+
+                string sql = "exec h_p_Sc_KeyElementBinding_Change '" + HInterID + "','" + HEntryID + "','" + HPartsCode + "','" + HPartsOld + "','" + HOrgID + "','" + user + "'";
+
+                ds = oCN.RunProcReturn(sql, "h_p_Sc_KeyElementBinding_Replace");
+
+                if (ds != null && ds.Tables[0].Rows.Count > 0)
+                {
+                    if (ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                        objJsonResult.data = "";
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                        objJsonResult.data = ds.Tables[0];
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "";
+                    objJsonResult.data = "娌℃湁杩斿洖鏁版嵁锛�" + sql;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
     }
 }

--
Gitblit v1.9.1