From f47d0d2d6c2896ec7aae74a428cd084ffefc1dca Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期二, 25 三月 2025 08:45:46 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/MJGL/Sc_MouldLifeUseBillController.cs |  458 +++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 392 insertions(+), 66 deletions(-)

diff --git a/WebAPI/Controllers/MJGL/Sc_MouldLifeUseBillController.cs b/WebAPI/Controllers/MJGL/Sc_MouldLifeUseBillController.cs
index e56f844..9f434a5 100644
--- a/WebAPI/Controllers/MJGL/Sc_MouldLifeUseBillController.cs
+++ b/WebAPI/Controllers/MJGL/Sc_MouldLifeUseBillController.cs
@@ -3,6 +3,7 @@
 using Newtonsoft.Json;
 using Newtonsoft.Json.Converters;
 using Newtonsoft.Json.Linq;
+using SyntacticSugar.constant;
 using System;
 using System.Collections.Generic;
 using System.Data;
@@ -67,6 +68,61 @@
         }
         #endregion
 
+        #region 鍣ㄥ叿瀵垮懡鑰楃敤鍗曞垎椤靛垪琛�
+        [Route("Sc_MouldLifeUseBill/page")]
+        [HttpGet]
+        public object Sc_MouldLifeUseBillPage(string sWhere, string user, int page, int size)
+        {
+            DataSet ds;
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Sc_MouldLifeUseBill_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                sWhere = sWhere.Replace("'", "''");
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Sc_MouldLifeUseBillList_Query " + page + "," + size + ",''", "h_p_Sc_MouldLifeUseBillList_Query");
+                }
+                else
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Sc_MouldLifeUseBillList_Query " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldLifeUseBillList_Query");
+                }
+
+                //娣诲姞鍒楀悕
+                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 = CodeConstant.SUCCEED;
+                objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.list = columnNameList;
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = CodeConstant.FAIL;
+                objJsonResult.count = CountConstant.FAIL;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region [鏍规嵁ID鏌ユ壘璁板綍]
         [Route("Sc_MouldLifeUseBill/cx")]
         [HttpGet]
@@ -75,7 +131,7 @@
             try
             {
 
-                ds = oCN.RunProcReturn("select * from h_v_Sc_MouldLifeUseBillList where HMainID =" + HInterID, "h_v_Sc_MouldLifeUseBillList");
+                ds = oCN.RunProcReturn("select * from h_v_Sc_MouldLifeUseBill_Edit where HMainID =" + HInterID, "h_v_Sc_MouldLifeUseBill_Edit");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -151,75 +207,82 @@
             string msg3 = sArray[1].ToString(); //瀛愯〃鏁版嵁
             int OperationType = int.Parse(sArray[2].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 3淇敼
             string user = sArray[3].ToString();
+            ListModels oListModels = new ListModels();
 
             try
-            {
-                msg2 = "[" + msg2.ToString() + "]";
-                List<ClsSc_MouldLifeUseBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLifeUseBillMain>>(msg2);
+            {                
+                DAL.ClsSc_MouldLifeUseBill oBill = new DAL.ClsSc_MouldLifeUseBill();
+                List<Model.ClsSc_MouldLifeUseBillMain> lsmain = new List<Model.ClsSc_MouldLifeUseBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_MouldLifeUseBillMain(msg2);
+                foreach (Model.ClsSc_MouldLifeUseBillMain oItem in lsmain)
+                {
+                    oItem.HBillType = "3845";
+                    oItem.HBillSubType = "3845";
+                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+                    oItem.HMaker = user;
+                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oBill.omodel = oItem;
+                }
 
-                long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
-                string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿
-                long HBillStatus = 1;//鍗曟嵁鐘舵��
-                DateTime HDate = mainList[0].HDate;//鏃ユ湡
-                string HRemark = mainList[0].HRemark;//澶囨敞
-                long HMangerID = mainList[0].HMangerID;//璐熻矗浜�
-                long HDeptID = mainList[0].HDeptID;//閮ㄩ棬
-                string HReason = mainList[0].HReason;//鍙樻洿鍘熷洜
-                string HExplanation = mainList[0].HExplanation;//鎽樿
-                string HMaker = user;//鍒跺崟浜�
+                //琛ㄤ綋鏁版嵁
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg3 = msg3.Substring(1, msg3.Length - 2);
+                msg3 = msg3.Replace("\\", "");
+                msg3 = msg3.Replace("\n", "");  //\n
+                //msg2 = msg2.Replace("'", "鈥�");
+                List<Model.ClsSc_MouldLifeUseBillSub> ls = new List<Model.ClsSc_MouldLifeUseBillSub>();
+                ls = oListModels.getObjectByJson_Gy_MouldLifeUseBillSub(msg3);
+                int i = 0;
+                foreach (Model.ClsSc_MouldLifeUseBillSub oItemSub in ls)
+                {
 
-                DateTime dt = DateTime.Now;
+                    i++;
+                    oItemSub.HEntryID = i;
+                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+                    oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+                    oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
+                    oBill.DetailColl.Add(oItemSub);
 
+                }
 
-
-                //ds = oCN.RunProcReturn("select * from h_v_IF_POOrderBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_POOrderBillList");
+                bool bResult = false;
 
                 if ((OperationType == 1 || OperationType == 2))//鏂板   && ds.Tables[0].Rows.Count == 0
-                {
-                    //DataSet Ds;
-                    //Int64 NewHInterID = 1;
-                    //Ds = oCN.RunProcReturn("select MAX(HInterID)HInterID from Cg_POOrderBillMain", "Cg_POOrderBillMain");
-                    //if (Ds.Tables[0].Rows.Count != 0 && ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString()) != 0)
-                    //{
-                    //    NewHInterID = ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString());
-                    //    NewHInterID += 1;
-                    //}
-                    //涓昏〃
-                    oCN.RunProc(@"Insert Into Sc_MouldLifeUseBillMain   
-                        (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus
-	                    ,HRemark,HBackRemark,HMaker,HMakeDate,HMainSourceBillType,HMainSourceInterID
-	                    ,HMainSourceEntryID,HMainSourceBillNo,HPrintQty,HMangerID,HDeptID,HReason,HExplanation,HInnerBillNo)
-                        values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 3845 + "','" +
-                    mainList[0].HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + mainList[0].HRemark +
-                    "','" + mainList[0].HBackRemark + "','" + mainList[0].HMaker + "','" + dt + "','" + mainList[0].HMainSourceBillType + "'," + mainList[0].HMainSourceInterID +
-                    "," + mainList[0].HMainSourceEntryID + ",'" + mainList[0].HMainSourceBillNo + "'," + mainList[0].HPrintQty + "," + mainList[0].HMangerID + "," + mainList[0].HDeptID + ",'" + HReason + "','" + HExplanation + "','" + mainList[0].HInnerBillNo + "'" + ")");
+                {                   
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 else if (OperationType == 3)//|| ds.Tables[0].Rows.Count != 0
-                { //淇敼
-                    oCN.RunProc("update Sc_MouldLifeUseBillMain  set " +
-                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + ",HReason='" + HReason +
-                                "',HExplanation='" + HExplanation + "',HMangerID=" + HMangerID + ",HDeptID=" + HDeptID + " where HInterID=" + HInterID);
-
-                    //鍒犻櫎瀛愯〃
-                    oCN.RunProc("delete from Sc_MouldLifeUseBillSub where HInterID='" + HInterID + "'");
+                { 
+                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                 }
-                //淇濆瓨瀛愯〃
-                objJsonResult = AddBillSub(msg3, HInterID, OperationType, HBillNo);
 
-                if (objJsonResult.code == "0")
+                if (bResult)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = objJsonResult.Message;
-                    objJsonResult.data = null;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
                     return objJsonResult;
                 }
-
-                objJsonResult.code = "1";
-                objJsonResult.count = 1;
-                objJsonResult.Message = null;
-                objJsonResult.data = null;
-                return objJsonResult;
             }
             catch (Exception e)
             {
@@ -266,29 +329,103 @@
         }
         #endregion
 
-        #region [鍒犻櫎]
+        #region [妯″叿瀵垮懡鑰楃敤鍗曞垹闄ゅ姛鑳絔
+        /// <summary>
+        /// 妯″叿澶勭悊鑰楃敤鍗曞垹闄ゅ姛鑳�
+        /// </summary>
+        /// <returns></returns>
         [Route("Sc_MouldLifeUseBill/Delete")]
         [HttpGet]
-        public object Delete(string HInterID, string user)
+        public object DeltetMouldLifeUseBill(string HInterID, string user)
         {
-            try
+            //缂栬緫鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log("Sc_MouldLifeUseBill_Delete", 1, false, user))
             {
-                oCN.BeginTran();
-                oCN.RunProc("Delete From Sc_MouldLifeUseBillMain where HInterID = " + HInterID);
-                oCN.RunProc("Delete From Sc_MouldLifeUseBillSub where HInterID = " + HInterID);
-                oCN.Commit();
-                objJsonResult.code = "1";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
                 objJsonResult.data = null;
                 return objJsonResult;
             }
-            catch (Exception e)
+
+
+            Int64 lngBillKey = 0;
+            lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+            if (lngBillKey == 0)
             {
-                oCN.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            DAL.ClsSc_MouldLifeUseBill oBill = new DAL.ClsSc_MouldLifeUseBill();
+            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 != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒犻櫎鍓嶆帶鍒�=========================================      
+                string sql1 = "exec h_p_Sc_MouldLifeUseBill_BeforeDelCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'";
+                ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldLifeUseBill_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;
+                }
+                //==================================================================================  
+
+                bool IsDete = oBill.DeleteBill(lngBillKey, oBill.omodel.HBillNo, "h_p_Sc_MouldLifeUseBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo);
+
+                if (IsDete)
+                {
+                    objJsonResult.code = "0";
+                    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;
             }
@@ -537,8 +674,197 @@
         }
         #endregion
 
+        #region 鍣ㄥ叿瀵垮懡鑰楃敤 鍏抽棴/鍙嶅叧闂�
+        /// <summary>
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">鍏抽棴(0),鍙嶅叧闂�(1)</param>
+        /// <param name="CurUserName">鍏抽棴浜�</param>
+        /// <returns></returns>
+        [Route("Sc_MouldLifeUseBill/CloseSc_MouldLifeUseBill")]
+        [HttpGet]
+        public object CloseSc_MouldLifeUseBill(int HInterID, int IsAudit, string CurUserName)
+        {
+            string ModRightNameCheck = "Sc_MouldLifeUseBill_Close";
+            DBUtility.ClsPub.CurUserName = CurUserName;
+            try
+            {
+                //妫�鏌ユ潈闄�
+                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍏抽棴澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //HInterID鏁版嵁鍒ゆ柇
+                if (HInterID <= 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID灏忎簬0锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
 
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+                DAL.ClsSc_MouldLifeUseBill oBill = new DAL.ClsSc_MouldLifeUseBill();           //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+                {
+                    if (oBill.omodel.HDeleteMan.Trim() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (oBill.omodel.HChecker.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (IsAudit == 0)  //鍏抽棴鍒ゆ柇
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅叧闂垽鏂�
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸弽鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                //杩涜闇�瑕佽繘琛岀殑鍏抽棴/鍙嶅叧闂搷浣�
+                if (IsAudit == 0) //鍏抽棴鎻愪氦
+                {
+                    string sql = "";
+                    //鍏抽棴鍓嶆帶鍒�===============================================Begin===================================================================
+                    sql = "exec h_p_Sc_MouldLifeUseBill_BeforeCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldLifeUseBill_BeforeCloseCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:鍏抽棴鍓嶅墠鍒ゆ柇澶辫触锛屾棤杩斿洖淇℃伅锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+
+                    }
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //鍏抽棴鍓嶆帶鍒�===============================================End===================================================================
+
+                    //鍏抽棴鎻愪氦
+                    if (oBill.CloseBill(lngBillKey, oBill.omodel.HBillNo, "h_p_Sc_MouldLifeUseBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍏抽棴鎴愬姛";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                if (IsAudit == 1) //鍙嶅叧闂彁浜�
+                {
+                    string sql = "";
+                    //鍙嶅叧闂墠鎺у埗===============================================Begin===================================================================
+                    sql = "exec h_p_Sc_MouldLifeUseBill_BeforeUnCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldLifeUseBill_BeforeUnCloseCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:鍙嶅叧闂墠鍓嶅垽鏂け璐ワ紝鏃犺繑鍥炰俊鎭紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+
+                    }
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //鍙嶅叧闂墠鎺у埗===============================================End===================================================================
+
+                    //鍙嶅叧闂彁浜�
+                    if (oBill.CancelClose(lngBillKey, oBill.omodel.HBillNo, "h_p_Sc_MouldLifeUseBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅叧闂垚鍔�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍏抽棴澶辫触鎴栬�呭弽鍏抽棴澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
 
         #region 鍣ㄥ叿瀵垮懡瓒嬪娍鍒嗘瀽鎶ヨ〃 鏌ヨ
         /// <summary>

--
Gitblit v1.9.1