From 2bee82c2ae0ac09a7ba324cd75ac46def5c1fde1 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期三, 02 四月 2025 13:54:56 +0800
Subject: [PATCH] 工艺路线:保存时,增加如果客户是 宝工,则不需要添加额外的 数据校验

---
 WebAPI/Controllers/WebAPIController.cs | 1261 +++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 1,125 insertions(+), 136 deletions(-)

diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index 06816a8..310e994 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -1207,74 +1207,7 @@
                 return objjson;
             }
         }
-
-
-        ///// <summary>
-        ///// 鑾峰彇浠撲綅鍒楄〃
-        ///// </summary>
-        ///// <returns></returns>
-        //[Route("Web/GetStockPlaceList_Json_NEW")]
-        //[HttpGet]
-        //public object GetStockPlaceList_Json_NEW(string StockPlace, Int64 HWhID, Int64 HOrgID)
-        //{
-        //    WebS.WebService1 oWeb = new WebS.WebService1();
-        //    sWhere = " Where HStopFlag=0  and HEndFlag=1 and HUSEORGID = " + HOrgID + "";
-        //    //sWhere = " Where HStopFlag=0  and HEndFlag=1  and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
-        //    if (HWhID == 0)
-        //    {
-        //        if (StockPlace != "")
-        //        {
-        //            sWhere = " Where HStopFlag=0 and HUSEORGID = " + HOrgID + "  and ( HNumber like '%" + StockPlace + "%' or HName like '%" + StockPlace + "%' ) ";
-        //        }
-        //        else
-        //        {
-        //            sWhere = " Where HStopFlag=0 ";
-        //        }
-        //    }
-        //    else
-        //    {
-        //        if (StockPlace != "")
-        //        {
-        //            sWhere = " Where HStopFlag=0 and HWHID=" + HWhID.ToString() + " and HWHID=" + HWhID.ToString() + " and ( HNumber like '%" + StockPlace + "%' or HName like '%" + StockPlace + "%' ) ";
-        //        }
-        //        else
-        //        {
-        //            sWhere = " Where HStopFlag=0 and HWHID=" + HWhID.ToString();
-        //        }
-        //    }
-        //    try
-        //    {
-        //        //ds = webserver.GetStockPlaceList(sWhere, ref DBUtility.ClsPub.sErrInfo);
-        //        ds = oWeb.GetStockPlaceList(sWhere, ref DBUtility.ClsPub.sErrInfo);
-        //        if (ds == null || ds.Tables[0].Rows.Count <= 0)
-        //        {
-        //            objjson.code = "0";
-        //            objjson.count = 0;
-        //            objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo;
-        //            objjson.data = null;
-        //            return objjson;
-        //        }
-        //        else
-        //        {
-        //            objjson.code = "0";
-        //            objjson.count = 1;
-        //            objjson.Message = "鑾峰彇鎴愬姛!";
-        //            objjson.data = ds.Tables[0];
-        //            return objjson;
-        //        }
-        //    }
-        //    catch (Exception ex)
-        //    {
-
-        //        objjson.code = "0";
-        //        objjson.count = 0;
-        //        objjson.Message = "鑾峰彇澶辫触" + ex.ToString();
-        //        objjson.data = null;
-        //        return objjson;
-        //    }
-        //}
-
-
+     
         /// <summary>
         /// 鑾峰彇浠撲綅鍒楄〃
         /// </summary>
@@ -4546,7 +4479,6 @@
         #endregion
         #endregion
 
-
         #region 涓嶈壇鍚庢灉 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
         /// <summary>
         /// 淇濆瓨涓嶈壇鍚庢灉
@@ -4716,8 +4648,7 @@
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
                 if (oBill.oModel.HItemID == 0)
-                {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                {                    
                     bResult = oBill.AddNew(ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 else
@@ -4773,7 +4704,6 @@
         public object DeltetGy_BadResult(string HItemID, string user)
         {
             DataSet ds;
-            //string ModRightNameCheck = "Sc_ProcessReport_check";
             try
             {
                 //鍒犻櫎鏉冮檺
@@ -5157,7 +5087,6 @@
         #endregion
 
         #endregion
-
 
         #region 妫�娴嬪��  璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
         /// <summary>
@@ -7085,7 +7014,6 @@
         }
         #endregion
 
-
         #region  宀椾綅鎶�鑳�  璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
         /// <summary>
         /// 淇濆瓨宀椾綅鎶�鑳�
@@ -7412,7 +7340,6 @@
             }
         }
         #endregion
-
 
         #region 宀椾綅鎶�鑳� 鏂囦欢瀵煎叆淇濆瓨
         #region 宀椾綅鎶�鑳� 鏂囦欢涓婁紶
@@ -11882,8 +11809,7 @@
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
                 if (oBill.oModel.HItemID == 0)
-                {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                {                   
                     bResult = oBill.AddNew();
                 }
                 else
@@ -11895,7 +11821,6 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -11939,7 +11864,6 @@
         public object DeltetGy_ProjectMoney(string HItemID, string user)
         {
             DataSet ds;
-            //string ModRightNameCheck = "Sc_ProcessReport_check";
             try
             {
                 //鍒犻櫎鏉冮檺
@@ -11993,7 +11917,412 @@
                 }
 
 
+                //鍒犻櫎鍓嶆帶鍒�=========================================      
+                string sql1 = "exec h_p_Gy_ProjectMoney_BeforeDelCtrl " + HItemID + ",'" + user + "'";
+                ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoney_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;
+                    oCN.RollBack();
+                    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;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                //================================================================================== 
+
+
                 oCN.RunProc("delete Gy_ProjectMoney where HItemID=" + HItemID);
+
+
+                //鍒犻櫎鍚庢帶鍒�=========================================      
+                string sql2 = "exec h_p_Gy_ProjectMoney_AfterDelCtrl " + HItemID + ",'" + user + "'";
+                ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoney_AfterDelCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜锛氬垹闄ゅ悗鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    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;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                //================================================================================== 
+               
+                oCN.Commit();//鎻愪氦浜嬪姟
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region  椤圭洰璐圭敤鍒嗙被  璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
+        /// <summary>
+        ///  椤圭洰璐圭敤鍒嗙被 淇濆瓨
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("SaveGy_ProjectMoneyClassList")]
+        [HttpPost]
+        public object SaveGy_ProjectMoneyClassList([FromBody] JObject msg)
+        {
+            DataSet ds;
+            var _value = msg["msg"].ToString();
+            string msg3 = _value.ToString();
+            string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg1 = sArray[0].ToString();
+            string msg2 = sArray[1].ToString();
+
+            //鏌ョ湅鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log("Gy_ProjectMoneyClass_Edit", 1, false, msg2))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+            Int64 HItemID = 0;
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            //鑾峰彇鏈�澶D鍊艰祴鍊�
+            DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_ProjectMoneyClass ", "Gy_ProjectMoneyClass");
+            if (Maxds != null || Maxds.Tables[0].Rows.Count > 0)
+            {
+                //HItemID= Maxds.Tables[0].Rows[0]["HItemID"]
+                var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]);
+                maxid += 1;
+                HItemID = maxid;
+            }
+            ListModels oListModels = new ListModels();
+            try
+            {
+
+                WebAPI.DLL.ClsGy_ProjectMoneyClass_Ctl oBill = new WebAPI.DLL.ClsGy_ProjectMoneyClass_Ctl();
+                List<Model.ClsGy_ProjectMoneyClass_Model> lsmain = new List<Model.ClsGy_ProjectMoneyClass_Model>();
+                msg1 = msg1.Replace("\\", "");
+                msg1 = msg1.Replace("\n", "");
+                lsmain = oListModels.getObjectByJson_Gy_ProjectMoneyClass(msg1);
+                foreach (Model.ClsGy_ProjectMoneyClass_Model oItem in lsmain)
+                {
+                    if (oItem.HNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (oItem.HName.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim()))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
+
+                    ds = oCN.RunProcReturn("select * from  Gy_ProjectMoneyClass where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_ProjectMoneyClass");
+                    if (oItem.HNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    //鏂板鏃跺垽鏂�
+                    if (oItem.HItemID == 0)
+                    {
+                        if (ds == null || ds.Tables[0].Rows.Count == 0)
+                        {
+
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
+                        string sParent;
+                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
+                        if (sParent.Trim() == "")
+                        {
+                            oBill.oModel.HParentID = 0;
+                        }
+                        else
+                        {
+                            if (oBill.HavParentCode(sParent.Trim(), HItemID))
+                            {
+                                oBill.oModel.HParentID = oBill.oModel.HItemID;
+                            }
+                            else
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+                                objJsonResult.data = 1;
+                                return objJsonResult;
+                            }
+                        }
+                    }
+                    else//缂栬緫鏃跺垽鏂�
+                    {
+                        //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
+                        string sParent;
+                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
+                        if (sParent.Trim() == "")
+                        {
+                            oBill.oModel.HParentID = 0;
+                        }
+                        else
+                        {
+                            if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID))
+                            {
+                                oBill.oModel.HParentID = oBill.oModel.HItemID;
+                            }
+                            else
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+                                objJsonResult.data = 1;
+                                return objJsonResult;
+                            }
+                        }
+                    }
+                    //寰楀埌鐭唬鐮�
+                    string sShortNumber;
+                    sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
+                    if (sShortNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oItem.HShortNumber = sShortNumber;//鐭唬鐮�
+                    oItem.HEndFlag = true;//鏈骇鏍囧織
+                    DataSet ds2 = oCN.RunProcReturn("select HLevel from  Gy_MaterType where HItemID =" + oItem.HParentID, "Gy_MaterType");//鎼滅储鐖剁被绛夌骇                 
+                    if (ds2.Tables[0].Rows.Count > 0)
+                    {
+                        oItem.HLevel = (int)ds2.Tables[0].Rows[0]["HLevel"] + 1;
+                    }
+                    else
+                    {
+                        oItem.HLevel = 1;
+                    }
+                    oItem.HMakeEmp = msg2; //鍒涘缓浜�
+
+                    oBill.oModel = oItem;
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (oBill.oModel.HItemID == 0)
+                {
+                    bResult = oBill.AddNew();
+                }
+                else
+                {
+                    bResult = oBill.ModifyByID(oBill.oModel.HItemID);
+                }
+                if (bResult)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 椤圭洰璐圭敤鍒嗙被 鑾峰彇淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        [Route("GetGy_ProjectMoneyClassDetail")]
+        [HttpGet]
+        public ApiResult<DataSet> GetGy_ProjectMoneyClassDetail(string HID)
+        {
+            var model = LuBaoSevice.GetGy_ProjectMoneyClassDetail(HID);
+            return model;
+        }
+
+        /// <summary>
+        /// 椤圭洰璐圭敤鍒嗙被 鍒犻櫎鍔熻兘
+        /// </summary>
+        /// <returns></returns>
+        [Route("DeltetGy_ProjectMoneyClass")]
+        [HttpGet]
+        public object DeltetGy_ProjectMoneyClass(string HItemID, string user)
+        {
+            DataSet ds;
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_ProjectMoneyClass_Drop", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (string.IsNullOrWhiteSpace(HItemID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HItemID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                ds = oCN.RunProcReturn("select * from Gy_ProjectMoneyClass where HItemID=" + HItemID, "Gy_ProjectMoneyClass");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒犻櫎鍓嶆帶鍒�=========================================      
+                string sql1 = "exec h_p_Gy_ProjectMoneyClass_BeforeDelCtrl " + HItemID + ",'" + user + "'";
+                ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoneyClass_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;
+                    oCN.RollBack();
+                    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;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                //================================================================================== 
+
+
+                oCN.RunProc("delete Gy_ProjectMoneyClass where HItemID=" + HItemID);
+
+                //鍒犻櫎鍚庢帶鍒�=========================================      
+                string sql2 = "exec h_p_Gy_ProjectMoneyClass_AfterDelCtrl " + HItemID + ",'" + user + "'";
+                ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoneyClass_AfterDelCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜锛氬垹闄ゅ悗鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    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;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                //==================================================================================              
                 oCN.Commit();//鎻愪氦浜嬪姟
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
@@ -16756,6 +17085,712 @@
         }
         #endregion
 
+        #region  绠″緞  璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
+        /// <summary>
+        ///  绠″緞 淇濆瓨
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("SaveGy_PiPeList")]
+        [HttpPost]
+        public object SaveGy_PiPeList([FromBody] JObject msg)
+        {
+            DataSet ds;
+            var _value = msg["msg"].ToString();
+            string msg3 = _value.ToString();
+            string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg1 = sArray[0].ToString();
+            string msg2 = sArray[1].ToString();
+
+            //鏌ョ湅鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log("Gy_PiPe_Edit", 1, false, msg2))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+            Int64 HItemID = 0;
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            //鑾峰彇鏈�澶D鍊艰祴鍊�
+            DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_PiPe ", "Gy_PiPe");
+            if (Maxds != null || Maxds.Tables[0].Rows.Count > 0)
+            {
+                var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]);
+                maxid += 1;
+                HItemID = maxid;
+            }
+            ListModels oListModels = new ListModels();
+            try
+            {
+
+                WebAPI.DLL.ClsGy_PiPe_Ctl oBill = new WebAPI.DLL.ClsGy_PiPe_Ctl();
+                List<Model.ClsGy_PiPe_Model> lsmain = new List<Model.ClsGy_PiPe_Model>();
+                msg1 = msg1.Replace("\\", "");
+                msg1 = msg1.Replace("\n", "");
+                lsmain = oListModels.getObjectByJson_Gy_PiPe(msg1);
+                foreach (Model.ClsGy_PiPe_Model oItem in lsmain)
+                {
+                    if (oItem.HNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (oItem.HName.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim()))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
+
+                    ds = oCN.RunProcReturn("select * from  Gy_PiPe where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PiPe");
+                    if (oItem.HNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    //鏂板鏃跺垽鏂�
+                    if (oItem.HItemID == 0)
+                    {
+                        if (ds == null || ds.Tables[0].Rows.Count == 0)
+                        {
+
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
+                        string sParent;
+                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
+                        if (sParent.Trim() == "")
+                        {
+                            oBill.oModel.HParentID = 0;
+                        }
+                        else
+                        {
+                            if (oBill.HavParentCode(sParent.Trim(), HItemID))
+                            {
+                                oBill.oModel.HParentID = oBill.oModel.HItemID;
+                            }
+                            else
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+                                objJsonResult.data = 1;
+                                return objJsonResult;
+                            }
+                        }
+                    }
+                    else//缂栬緫鏃跺垽鏂�
+                    {
+                        //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
+                        string sParent;
+                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
+                        if (sParent.Trim() == "")
+                        {
+                            oBill.oModel.HParentID = 0;
+                        }
+                        else
+                        {
+                            if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID))
+                            {
+                                oBill.oModel.HParentID = oBill.oModel.HItemID;
+                            }
+                            else
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+                                objJsonResult.data = 1;
+                                return objJsonResult;
+                            }
+                        }
+                    }
+                    //寰楀埌鐭唬鐮�
+                    string sShortNumber;
+                    sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
+                    if (sShortNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oItem.HShortNumber = sShortNumber;//鐭唬鐮�
+                    oItem.HEndFlag = true;//鏈骇鏍囧織
+                    DataSet ds2 = oCN.RunProcReturn("select HLevel from  Gy_PiPe where HItemID =" + oItem.HParentID, "Gy_PiPe");//鎼滅储鐖剁被绛夌骇                 
+                    if (ds2.Tables[0].Rows.Count > 0)
+                    {
+                        oItem.HLevel = (int)ds2.Tables[0].Rows[0]["HLevel"] + 1;
+                    }
+                    else
+                    {
+                        oItem.HLevel = 1;
+                    }
+                    oItem.HMakeEmp = msg2; //鍒涘缓浜�
+
+                    oBill.oModel = oItem;
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (oBill.oModel.HItemID == 0)
+                {
+                    bResult = oBill.AddNew();
+                }
+                else
+                {
+                    bResult = oBill.ModifyByID(oBill.oModel.HItemID);
+                }
+                if (bResult)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 绠″緞 鑾峰彇淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        [Route("GetGy_PiPeDetail")]
+        [HttpGet]
+        public ApiResult<DataSet> GetGy_PiPeDetail(string HID)
+        {
+            var model = LuBaoSevice.GetGy_PiPeDetail(HID);
+            return model;
+        }
+
+        /// <summary>
+        /// 绠″緞 鍒犻櫎鍔熻兘
+        /// </summary>
+        /// <returns></returns>
+        [Route("DeltetGy_PiPe")]
+        [HttpGet]
+        public object DeltetGy_PiPe(string HItemID, string user)
+        {
+            DataSet ds;
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_PiPe_Drop", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (string.IsNullOrWhiteSpace(HItemID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HItemID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                ds = oCN.RunProcReturn("select * from Gy_PiPe where HItemID=" + HItemID, "Gy_PiPe");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒犻櫎鍓嶆帶鍒�=========================================      
+                string sql1 = "exec h_p_Gy_PiPe_BeforeDelCtrl " + HItemID + ",'" + user + "'";
+                ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPe_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;
+                    oCN.RollBack();
+                    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;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                //================================================================================== 
+
+
+                oCN.RunProc("delete Gy_PiPe where HItemID=" + HItemID);
+
+                //鍒犻櫎鍚庢帶鍒�=========================================      
+                string sql2 = "exec h_p_Gy_PiPe_AfterDelCtrl " + HItemID + ",'" + user + "'";
+                ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPe_AfterDelCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜锛氬垹闄ゅ悗鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    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;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                //==================================================================================              
+                oCN.Commit();//鎻愪氦浜嬪姟
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region  绠″緞鏉愯川  璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
+        /// <summary>
+        ///  绠″緞鏉愯川 淇濆瓨
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("SaveGy_PiPeMaterialList")]
+        [HttpPost]
+        public object SaveGy_PiPeMaterialList([FromBody] JObject msg)
+        {
+            DataSet ds;
+            var _value = msg["msg"].ToString();
+            string msg3 = _value.ToString();
+            string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg1 = sArray[0].ToString();
+            string msg2 = sArray[1].ToString();
+
+            //鏌ョ湅鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log("Gy_PiPeMaterial_Edit", 1, false, msg2))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+            Int64 HItemID = 0;
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            //鑾峰彇鏈�澶D鍊艰祴鍊�
+            DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_PiPeMaterial ", "Gy_PiPeMaterial");
+            if (Maxds != null || Maxds.Tables[0].Rows.Count > 0)
+            {
+                //HItemID= Maxds.Tables[0].Rows[0]["HItemID"]
+                var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]);
+                maxid += 1;
+                HItemID = maxid;
+            }
+            ListModels oListModels = new ListModels();
+            try
+            {
+
+                WebAPI.DLL.ClsGy_PiPeMaterial_Ctl oBill = new WebAPI.DLL.ClsGy_PiPeMaterial_Ctl();
+                List<Model.ClsGy_PiPeMaterial_Model> lsmain = new List<Model.ClsGy_PiPeMaterial_Model>();
+                msg1 = msg1.Replace("\\", "");
+                msg1 = msg1.Replace("\n", "");
+                lsmain = oListModels.getObjectByJson_Gy_PiPeMaterial(msg1);
+                foreach (Model.ClsGy_PiPeMaterial_Model oItem in lsmain)
+                {
+                    if (oItem.HNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (oItem.HName.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim()))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
+
+                    ds = oCN.RunProcReturn("select * from  Gy_PiPeMaterial where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PiPeMaterial");
+                    if (oItem.HNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    //鏂板鏃跺垽鏂�
+                    if (oItem.HItemID == 0)
+                    {
+                        if (ds == null || ds.Tables[0].Rows.Count == 0)
+                        {
+
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
+                        string sParent;
+                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
+                        if (sParent.Trim() == "")
+                        {
+                            oBill.oModel.HParentID = 0;
+                        }
+                        else
+                        {
+                            if (oBill.HavParentCode(sParent.Trim(), HItemID))
+                            {
+                                oBill.oModel.HParentID = oBill.oModel.HItemID;
+                            }
+                            else
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+                                objJsonResult.data = 1;
+                                return objJsonResult;
+                            }
+                        }
+                    }
+                    else//缂栬緫鏃跺垽鏂�
+                    {
+                        //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
+                        string sParent;
+                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
+                        if (sParent.Trim() == "")
+                        {
+                            oBill.oModel.HParentID = 0;
+                        }
+                        else
+                        {
+                            if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID))
+                            {
+                                oBill.oModel.HParentID = oBill.oModel.HItemID;
+                            }
+                            else
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+                                objJsonResult.data = 1;
+                                return objJsonResult;
+                            }
+                        }
+                    }
+                    //寰楀埌鐭唬鐮�
+                    string sShortNumber;
+                    sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
+                    if (sShortNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oItem.HShortNumber = sShortNumber;//鐭唬鐮�
+                    oItem.HEndFlag = true;//鏈骇鏍囧織
+                    DataSet ds2 = oCN.RunProcReturn("select HLevel from  Gy_PiPeMaterial where HItemID =" + oItem.HParentID, "Gy_PiPeMaterial");//鎼滅储鐖剁被绛夌骇                 
+                    if (ds2.Tables[0].Rows.Count > 0)
+                    {
+                        oItem.HLevel = (int)ds2.Tables[0].Rows[0]["HLevel"] + 1;
+                    }
+                    else
+                    {
+                        oItem.HLevel = 1;
+                    }
+                    oItem.HMakeEmp = msg2; //鍒涘缓浜�
+
+                    oBill.oModel = oItem;
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (oBill.oModel.HItemID == 0)
+                {
+                    bResult = oBill.AddNew();
+                }
+                else
+                {
+                    bResult = oBill.ModifyByID(oBill.oModel.HItemID);
+                }
+                if (bResult)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 绠″緞鏉愯川 鑾峰彇淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        [Route("GetGy_PiPeMaterialDetail")]
+        [HttpGet]
+        public ApiResult<DataSet> GetGy_PiPeMaterialDetail(string HID)
+        {
+            var model = LuBaoSevice.GetGy_PiPeMaterialDetail(HID);
+            return model;
+        }
+
+        /// <summary>
+        /// 绠″緞鏉愯川 鍒犻櫎鍔熻兘
+        /// </summary>
+        /// <returns></returns>
+        [Route("DeltetGy_PiPeMaterial")]
+        [HttpGet]
+        public object DeltetGy_PiPeMaterial(string HItemID, string user)
+        {
+            DataSet ds;
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_PiPeMaterial_Drop", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (string.IsNullOrWhiteSpace(HItemID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HItemID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                ds = oCN.RunProcReturn("select * from Gy_PiPeMaterial where HItemID=" + HItemID, "Gy_PiPeMaterial");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒犻櫎鍓嶆帶鍒�=========================================      
+                string sql1 = "exec h_p_Gy_PiPeMaterial_BeforeDelCtrl " + HItemID + ",'" + user + "'";
+                ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPeMaterial_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;
+                    oCN.RollBack();
+                    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;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                //================================================================================== 
+
+                oCN.RunProc("delete Gy_PiPeMaterial where HItemID=" + HItemID);
+
+                //鍒犻櫎鍚庢帶鍒�=========================================      
+                string sql2 = "exec h_p_Gy_PiPeMaterial_AfterDelCtrl " + HItemID + ",'" + user + "'";
+                ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPeMaterial_AfterDelCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜锛氬垹闄ゅ悗鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    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;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                //==================================================================================              
+                oCN.Commit();//鎻愪氦浜嬪姟
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
 
         /// <summary>
         /// 鐢ㄥ叧鑱斿伐搴忚幏鍙栦俊鎭�
@@ -17263,6 +18298,8 @@
             }
         }
 
+        #region 鏍哥畻鏂瑰紡缁�
+
         /// <summary>
         /// 鑾峰彇鏍哥畻鏂瑰紡缁勫垪琛�
         /// </summary>
@@ -17378,6 +18415,7 @@
                 return objjson;
             }
         }
+
         /// <summary>
         /// 鏍哥畻鏂瑰紡缁勭紪杈�
         /// </summary>
@@ -17471,6 +18509,7 @@
             }
         }
         #endregion
+
         /// <summary>
         /// 淇濆瓨鑾峰彇鏍哥畻鏂瑰紡缁�
         /// </summary>
@@ -17522,6 +18561,8 @@
                 return objJsonResult;
             }
         }
+
+        #endregion
 
         /// <summary>
         /// 鑾峰彇宀椾綅鍒楄〃
@@ -17753,6 +18794,7 @@
 
 
         }
+
         /// <summary>
         /// 鑾峰彇鐢熶骇浠诲姟鍗曞垪琛�
         /// </summary>
@@ -17804,6 +18846,7 @@
                 return objjson;
             }
         }
+
         /// <summary>
         /// 鑾峰彇鐢熶骇浠诲姟鍗曞垪琛�
         /// </summary>
@@ -18287,7 +19330,7 @@
                 ds = oCN.RunProcReturn("select  top 1 * from h_v_Gy_QCCheckProjectList_Main where 鐗╂枡鍚嶇О='"+HName+ "' and 宸ュ簭鍚嶇О='" + HProName + "' and HSourceID='" + HSourceID + "'   order by 鏃ユ湡 desc ", "h_v_Gy_QCCheckProjectList_Main");
                 if (ds == null || ds.Tables[0].Rows.Count <= 0)
                 {
-                    ds = oCN.RunProcReturn("select  top 1 * from h_v_Gy_QCCheckProjectList_Main where 鐗╂枡鍚嶇О='" + HName + "' and  ='" + HProName + "'  order by 鏃ユ湡 desc ", "h_v_Gy_QCCheckProjectList_Main");
+                    ds = oCN.RunProcReturn("select  top 1 * from h_v_Gy_QCCheckProjectList_Main where 鐗╂枡鍚嶇О='" + HName + "' and 宸ュ簭鍚嶇О ='" + HProName + "'  order by 鏃ユ湡 desc ", "h_v_Gy_QCCheckProjectList_Main");
                 }
                 if (ds == null || ds.Tables[0].Rows.Count <= 0)
                 {
@@ -18418,6 +19461,7 @@
                 return objjson;
             }
         }
+
         /// <summary>
         /// 鏍规嵁鍣ㄥ叿涓诲唴鐮佽幏鍙栧櫒鍏蜂繚鍏绘楠岄」鐩�
         /// </summary>
@@ -18786,7 +19830,7 @@
                 {
                     objjson.code = "0";
                     objjson.count = 0;
-                    objjson.Message = "璇ヨ澶囨湁澶氫釜璁″垝鍗曟垨鐐规瑙勭▼,鎵嬪姩閫夌潃" ;
+                    objjson.Message = ds.Tables[0].Rows[0]["HRemark"].ToString();
                     objjson.data = null;
                     return objjson;
                 }
@@ -19972,61 +21016,6 @@
         }
         #endregion
         #endregion
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-        ///// <summary>
-        ///// 浜у搧鍏ュ簱缂撳瓨鍒楄〃鍒锋柊淇℃伅
-        ///// </summary>
-        ///// <returns></returns>
-        //[Route("Web/chanpinruk")]
-        //[HttpGet]
-        //public object chanpinruk(string HBillType, string sHMaker, Int64 HOrgID)
-        //{
-        //    try
-        //    {
-        //        ds = webserver.GetKf_PonderationBillMain_TempList_New(HBillType, sHMaker, HOrgID);
-        //        if (ds == null || ds.Tables[0].Rows.Count <= 0)
-        //        {
-        //            objJsonResult.code = "0";
-        //            objJsonResult.count = 0;
-        //            objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
-        //            objJsonResult.data = null;
-        //            return objJsonResult;
-        //            //DBUtility.ClsPub.MessageBeep((int)DBUtility.ClsPub.BeepType.Warning);
-        //        }
-        //        else
-        //        {
-        //            objJsonResult.code = "0";
-        //            objJsonResult.count = 1;
-        //            objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-        //            objJsonResult.data = ds.Tables[0];
-        //            return objJsonResult;
-        //        }
-        //    }
-        //    catch (Exception e)
-        //    {
-        //        objJsonResult.code = "0";
-        //        objJsonResult.count = 0;
-        //        objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
-        //        objJsonResult.data = null;
-        //        return objJsonResult;
-        //    }
-        //}
 
 
         /// <summary>

--
Gitblit v1.9.1