From 56270ee3a189c0dbd42446fbd726341c9f4e8efd Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期二, 07 十二月 2021 09:11:20 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/DLL/ClsOA_ErrMsgBackBill.cs                          |   31 ++++++++++
 WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs |   98 ++++++++++++++++++++++++++++++++
 2 files changed, 129 insertions(+), 0 deletions(-)

diff --git a/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
index 0f1321a..db285b7 100644
--- a/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
@@ -448,5 +448,103 @@
             return objJsonResult; ;
         }
         #endregion
+
+        #region [妯″叿鏀瑰埗鐢宠鍗曞垹闄ゅ姛鑳絔
+        /// <summary>
+        /// 妯″叿鏀瑰埗鐢宠鍗曞垹闄ゅ姛鑳�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Sc_MESTransFerWorkBill/Get_DeleteTransFerBill")]
+        [HttpGet]
+        public object Get_DeleteTransFerBill(string HInterID,string HEntryID, string user)
+        {
+            //缂栬緫鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackBill_Delete", 1, true, user))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            string s = "";
+            Int64 lngBillKey = 0;
+            try
+            {
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+                if (lngBillKey == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                DLL.ClsOA_ErrMsgBackBill oBill = new DLL.ClsOA_ErrMsgBackBill();
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    if (oBill.omodel.HBillStatus > 1)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (!DBUtility.Xt_BaseBillFun.Fun_AllowDeleteBill(oBill, ref s))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    bool IsDete = oBill.DeleteBill(lngBillKey, HEntryID, ref DBUtility.ClsPub.sExeReturnInfo);
+                    if (IsDete)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁鏈壘鍒�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+        }
+
+        #endregion
     }
 }
\ No newline at end of file
diff --git a/WebAPI/DLL/ClsOA_ErrMsgBackBill.cs b/WebAPI/DLL/ClsOA_ErrMsgBackBill.cs
index f2b911d..ef44bae 100644
--- a/WebAPI/DLL/ClsOA_ErrMsgBackBill.cs
+++ b/WebAPI/DLL/ClsOA_ErrMsgBackBill.cs
@@ -192,6 +192,37 @@
                 throw (e);
             }
         }
+
+        //鍒犻櫎鍗曟嵁
+        public virtual bool DeleteBill(Int64 lngBillKey,string HEntryID, ref string sReturn)
+        {
+            try
+            {
+                oCn.BeginTran();
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                string sql = string.Format(@"select *  from "+MvarItemKeySub+ " where HInterID=" + lngBillKey.ToString() + " and HEntryID='" + HEntryID + "'");
+                var dataSet = oCN.RunProcReturn(sql, ""+ MvarItemKeySub + "");               
+                //鍒犻櫎鍏宠仈
+                DeleteRelation(ref sReturn, lngBillKey);
+                //鍒犻櫎鏄庣粏琛�
+                oCn.RunProc("Delete From " + MvarItemKeySub + "  where HInterID=" + lngBillKey.ToString()+" and HEntryID='"+HEntryID+"'");
+                //鍒犻櫎涓昏〃
+                if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
+                {
+                    DeleteBillMain(lngBillKey);
+                }
+                sReturn = "鍒犻櫎鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+
         //鏄剧ず鍗曟嵁
         public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
         {

--
Gitblit v1.9.1