From 5466e02176f2acf2f08ef1c16315c3185bae903f Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期一, 19 五月 2025 15:53:34 +0800
Subject: [PATCH] 异常反馈单,快捷开工接口调整

---
 WebAPI/Controllers/CJGL/Gy_MaterPreventErrMouldBillController.cs |  887 +++++++++-------------------------------------------------
 1 files changed, 142 insertions(+), 745 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Gy_MaterPreventErrMouldBillController.cs b/WebAPI/Controllers/CJGL/Gy_MaterPreventErrMouldBillController.cs
index 63ec32a..8d4ef40 100644
--- a/WebAPI/Controllers/CJGL/Gy_MaterPreventErrMouldBillController.cs
+++ b/WebAPI/Controllers/CJGL/Gy_MaterPreventErrMouldBillController.cs
@@ -20,6 +20,7 @@
         public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
         private json objJsonResult = new json();
         public DataSet ds = new DataSet();
+        public DataSet ds1 = new DataSet();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         public DAL.ClsGy_MaterPreventErrMouldBillMain OBill = new DAL.ClsGy_MaterPreventErrMouldBillMain();
         public DAL.ClsGy_MaterPreventErrMouldBillMain BillOld = new DAL.ClsGy_MaterPreventErrMouldBillMain();
@@ -373,9 +374,53 @@
 
                 oCN.BeginTran();
 
-                oCN.RunProc("delete from Gy_MaterPreventErrMouldBillMain where HInterID = " + HInterID);
+                //鍒ゆ柇瀛樺湪鎬�
+                if (BillOld.ShowBill(Int64.Parse(HInterID), ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒犻櫎鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_Gy_MaterPreventErrMouldBill_BeforeDelCtrl  " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPreventErrMouldBill_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;
+                    }
+                    //==================================================================================  
+
+                    //鍒犻櫎鍗曟嵁锛堝寘鍚垹闄ゅ悗鎺у埗銆佸啓鍏ユ棩蹇楋級
+                    if (!BillOld.DeleteBill(BillOld.omodel.HInterID, BillOld.omodel.HBillNo, "h_p_Gy_MaterPreventErrMouldBill_AfterDelCtrl", user, ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                }
 
                 oCN.Commit();
+
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -428,7 +473,6 @@
                 if (Type == 1)
                 {
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
-                    DataSet ds;
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                     ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds == null || ds.Tables[0].Rows.Count == 0)
@@ -465,8 +509,32 @@
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
+                        //瀹℃牳鍓嶆帶鍒�=========================================      
+                        string sql1 = "exec h_p_Gy_MaterPreventErrMouldBill_BeforeCheckCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'";
+                        ds1 = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPreventErrMouldBill_BeforeCheckCtrl");
+                        if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                            objJsonResult.data = null;
+                            oCN.RollBack();
+                            return objJsonResult;
+                        }
+
+                        if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds1.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                            objJsonResult.data = null;
+                            oCN.RollBack();
+                            return objJsonResult;
+                        }
+                        //==================================================================================      
+
                         //瀹℃牳鍗曟嵁
-                        if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        if (!BillOld.CheckBill(Int64.Parse(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Gy_MaterPreventErrMouldBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 1;
@@ -479,7 +547,6 @@
                 else
                 {
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍�
-                    DataSet ds;
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                     ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
@@ -508,8 +575,29 @@
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
+                        //鍙嶅鏍稿墠鎺у埗=========================================        
+                        string sql1 = "exec h_p_Gy_MaterPreventErrMouldBill_BeforeUnCheckCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'";
+                        ds1 = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPreventErrMouldBill_BeforeUnCheckCtrl");
+                        if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+
+                        }
+                        if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds1.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //===========================================================  
                         //鍙嶅鏍稿崟鎹�
-                        if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Gy_MaterPreventErrMouldBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 1;
@@ -721,7 +809,6 @@
                 if (Type == 1)
                 {
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾
-                    DataSet ds;
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                     ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds == null || ds.Tables[0].Rows.Count == 0)
@@ -750,8 +837,31 @@
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
+                        //浣滃簾鍓嶆帶鍒�=========================================      
+                        string sql1 = "exec h_p_Gy_MaterPreventErrMouldBill_BeforeDropCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'";
+                        ds1 = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPreventErrMouldBill_BeforeDropCtrl");
+                        if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                            objJsonResult.data = null;
+                            oCN.RollBack();
+                            return objJsonResult;
+                        }
+
+                        if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds1.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                            objJsonResult.data = null;
+                            oCN.RollBack();
+                            return objJsonResult;
+                        }
+                        //==================================================================================  
                         //浣滃簾鍗曟嵁
-                        if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        if (!BillOld.Cancelltion(Int64.Parse(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Gy_MaterPreventErrMouldBill_AfterDropCtrl", user, ref ClsPub.sExeReturnInfo))
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 1;
@@ -764,7 +874,6 @@
                 else
                 {
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶄綔搴�
-                    DataSet ds;
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                     ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
@@ -785,8 +894,31 @@
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
+                        //鍙嶄綔搴熷墠鎺у埗=========================================      
+                        string sql1 = "exec h_p_Gy_MaterPreventErrMouldBill_BeforeUnDropCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'";
+                        ds1 = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPreventErrMouldBill_BeforeUnDropCtrl");
+                        if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:鍙嶄綔搴熷墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                            objJsonResult.data = null;
+                            oCN.RollBack();
+                            return objJsonResult;
+                        }
+
+                        if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ds1.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                            objJsonResult.data = null;
+                            oCN.RollBack();
+                            return objJsonResult;
+                        }
+                        //==================================================================================  
                         //鍙嶄綔搴熷崟鎹�
-                        if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Gy_MaterPreventErrMouldBill_AfterDropCtrl", user, ref ClsPub.sExeReturnInfo))
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 1;
@@ -1230,742 +1362,7 @@
         }
         #endregion
         #endregion
-
-        #region 鐜妫�娴嬮」鐩� 鏌ヨ       
-        [Route("Gy_MaterPreventErrMouldBill/get锘縂y_EnvironmentTestSchemeBillMainList")]
-        [HttpGet]
-        public object get锘縂y_EnvironmentTestSchemeBillMainList(string sWhere, string user)
-        {
-            try
-            {
-                List<object> columnNameList = new List<object>();
-
-                //鏌ョ湅鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log_second("Gy_EnvironmentTestSchemeBillMain_Check", 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_Gy_EnvironmentTestSchemeBillMainList order by 鍗曟嵁鍙� desc", "锘縣_v_Gy_EnvironmentTestSchemeBillMainList");
-                }
-                else
-                {
-                    string sql1 = "select * from  h_v_Gy_EnvironmentTestSchemeBillMainList  where 1 = 1 ";
-                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
-                    ds = oCN.RunProcReturn(sql, "锘縣_v_Gy_EnvironmentTestSchemeBillMainList");
-                }
-
-                //娣诲姞鍒楀悕
-                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 鐜妫�娴嬮」鐩� 鑾峰彇缂栬緫鍒楄〃鏁版嵁
-        [Route("Gy_MaterPreventErrMouldBill/锘縂y_EnvironmentTestSchemeBillMainEditList")]
-        [HttpGet]
-        public object Gy_EnvironmentTestSchemeBillMainEditList(string HInterID, string User)
-        {
-            try
-            {
-                List<DataTable> tableList = new List<DataTable>();
-
-                //鏌ョ湅鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log("Gy_EnvironmentTestSchemeBillMain_Edit", 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;
-                }
-
-                ds = oCN.RunProcReturn("select * from h_v_Gy_EnvironmentTestSchemeBillMainList where HInterID = " + HInterID, " h_v_Gy_EnvironmentTestSchemeBillMainList");
-
-                objJsonResult.code = "1";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鏌ヨ鎴愬姛锛�";
-                objJsonResult.data = ds.Tables[0];
-                return objJsonResult;
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "Exception锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-
-        #region 鐜妫�娴嬮」鐩� 淇濆瓨/缂栬緫      
-        [Route("Gy_MaterPreventErrMouldBill/Save锘縂y_EnvironmentTestSchemeBillMain")]
-        [HttpPost]
-        public object Save锘縂y_EnvironmentTestSchemeBillMain([FromBody] JObject sMainSub)
-        {
-            var _value = sMainSub["sMainSub"].ToString();
-            string msg1 = _value.ToString();
-            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
-            string msg2 = sArray[0].ToString();
-            string msg3 = sArray[1].ToString();
-            string refSav = sArray[2].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
-            string user = sArray[3].ToString();//鐢ㄦ埛鍚�
-
-            string UserName = "";
-            string s = "";
-            ListModels oListModels = new ListModels();
-            try
-            {
-                //淇濆瓨鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log_second("Gy_EnvironmentTestSchemeBillMain_Edit", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "淇濆瓨澶辫触锛佹棤鏉冮檺锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-
-                DAL.ClsGy_EnvironmentTestSchemeBillMain oBill = new DAL.ClsGy_EnvironmentTestSchemeBillMain();
-                List<Model.Cls锘縂y_EnvironmentTestSchemeBillMain> lsmain = new List<Model.Cls锘縂y_EnvironmentTestSchemeBillMain>();
-                msg2 = msg2.Replace("\\", "");
-                msg2 = msg2.Replace("\n", "");  //\n
-                lsmain = oListModels.getObjectByJson_锘縂y_EnvironmentTestSchemeBillMain(msg2);
-                foreach (Model.Cls锘縂y_EnvironmentTestSchemeBillMain oItem in lsmain)
-                {
-                    if (refSav == "Add")
-                    {
-                        //鍗曟嵁鍙锋槸鍚﹂噸澶�
-                        if (OBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, OBill.omodel.HInterID))
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
-                            objJsonResult.data = 1;
-                            return objJsonResult;
-                        }
-                    }
-                    if (refSav == "Update")
-                    {
-                        if (OBill.ShowBill(oItem.HInterID, ref s) == false)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
-                            objJsonResult.data = 1;
-                            return objJsonResult;
-                        }
-                        //鍒ゆ柇鏄惁鍙紪杈�
-                        if (OBill.omodel.HChecker != "" && OBill.omodel.HChecker != null)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
-                            objJsonResult.data = 1;
-                            return objJsonResult;
-                        }
-                        if (OBill.omodel.HBillStatus > 1)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
-                            objJsonResult.data = 1;
-                            return objJsonResult;
-                        }
-
-                    }
-                    UserName = oItem.HMaker;  //鍒跺崟浜�
-                    oItem.HBillType = "7516";
-                    oItem.HBillSubType = "7516";
-
-
-
-                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
-                    oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
-                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
-
-                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
-                        objJsonResult.data = 1;
-                        return objJsonResult;
-                    }
-                    oBill.omodel = oItem;
-                }
-                // 琛ㄤ綋鏁版嵁
-                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
-                msg3 = msg3.Substring(1, msg3.Length - 2);
-                msg3 = msg3.Replace("\\", "");
-                msg3 = msg3.Replace("\n", "");  //\n
-                List<Model.ClsGy_EnvironmentTestSchemeBillSub> ls = new List<Model.ClsGy_EnvironmentTestSchemeBillSub>();
-                ls = oListModels.getObjectByJson_Gy_EnvironmentTestSchemeBillSub(msg3);
-                int i = 0;
-                foreach (Model.ClsGy_EnvironmentTestSchemeBillSub oItemSub in ls)
-                {
-                    i++;
-                    oItemSub.HEntryID = i;
-
-
-                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
-                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
-
-                    oBill.DetailColl.Add(oItemSub);
-
-                }
-                //淇濆瓨
-                //淇濆瓨瀹屾瘯鍚庡鐞�
-                bool bResult;
-                if (refSav == "Add")
-                {
-
-                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
-                }
-                else if (refSav == "Update")
-                {
-                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
-                }
-                else
-                {
-                    bResult = false;
-                }
-                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;
-            }
-        }
-        #endregion
-
-        #region 鐜妫�娴嬮」鐩� 鍒犻櫎     
-        [Route("Gy_MaterPreventErrMouldBill/Delete锘縂y_EnvironmentTestSchemeBill")]
-        [HttpGet]
-        public object Delete锘縂y_EnvironmentTestSchemeBill(string HInterID, string user)
-        {
-            try
-            {
-                //鏌ョ湅鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log("Gy_EnvironmentTestSchemeBillMain_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;
-                }
-
-                oCN.BeginTran();
-
-                oCN.RunProc("delete from Gy_EnvironmentTestSchemeBillMain where HInterID = " + HInterID);
-
-                oCN.Commit();
-
-                objJsonResult.code = "1";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "Sucess锛�";
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "Exception锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-
-        #region 鐜妫�娴嬮」鐩� 瀹℃牳/鍙嶅鏍�     
-        [Route("Gy_MaterPreventErrMouldBill/AuditGy_EnvironmentTestSchemeBill")]
-        [HttpGet]
-        public object AuditGy_EnvironmentTestSchemeBill(string HInterID, int Type, string user)
-        {
-            try
-            {
-                //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Gy_EnvironmentTestSchemeBillMain_Check", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愬鏍�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-
-                if (string.IsNullOrWhiteSpace(HInterID))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "HInterID涓虹┖锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-
-                ClsPub.CurUserName = user;
-                BillOld.MvarItemKey = "Gy_EnvironmentTestSchemeBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-
-                //Type 1 瀹℃牳  2  鍙嶅鏍�
-                if (Type == 1)
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
-                    DataSet ds;
-                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
-                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
-                    if (ds == null || ds.Tables[0].Rows.Count == 0)
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
-                    {
-                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        //瀹℃牳鍗曟嵁
-                        if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 1;
-                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                    }
-                }
-                else
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍�
-                    DataSet ds;
-                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
-                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
-                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
-                    {
-                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘杩涜鍙嶅鏍革紒";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍙嶅鏍革紒";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        //鍙嶅鏍稿崟鎹�
-                        if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 1;
-                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                            objJsonResult.data = null;
-                            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 鐜妫�娴嬮」鐩� 鍏抽棴/鍙嶅叧闂姛鑳�
-        [Route("Gy_MaterPreventErrMouldBill/CloseGy_EnvironmentTestSchemeBill")]
-        [HttpGet]
-        public object CloseGy_EnvironmentTestSchemeBill(string HInterID, int Type, string user)
-        {
-            try
-            {
-                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Gy_EnvironmentTestSchemeBillMain_Close", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-
-                if (string.IsNullOrWhiteSpace(HInterID))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "HInterID涓虹┖锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-
-                ClsPub.CurUserName = user;
-                BillOld.MvarItemKey = "Gy_EnvironmentTestSchemeBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-
-                //Type 1 鍏抽棴  2  鍙嶅叧闂�
-                if (Type == 1)
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴
-                    DataSet ds;
-                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
-                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
-                    if (ds == null || ds.Tables[0].Rows.Count == 0)
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
-                    {
-                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        //鍏抽棴鍗曟嵁
-                        if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 1;
-                            objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                    }
-                }
-                else
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅叧闂�
-                    DataSet ds;
-                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
-                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
-                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
-                    {
-                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸啀鍙嶅叧闂�!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        //鍙嶅叧闂崟鎹�
-                        if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 1;
-                            objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                            objJsonResult.data = null;
-                            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 鐜妫�娴嬮」鐩� 浣滃簾/鍙嶄綔搴熷姛鑳�
-        [Route("Gy_MaterPreventErrMouldBill/DropGy_EnvironmentTestSchemeBill")]
-        [HttpGet]
-        public object DropGy_EnvironmentTestSchemeBill(string HInterID, int Type, string user)
-        {
-            try
-            {
-                //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Gy_EnvironmentTestSchemeBillMain_Drop", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愪綔搴�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-
-                if (string.IsNullOrWhiteSpace(HInterID))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "HInterID涓虹┖锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-
-                ClsPub.CurUserName = user;
-                BillOld.MvarItemKey = "Gy_EnvironmentTestSchemeBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-
-                //Type 1 浣滃簾  2  鍙嶄綔搴�
-                if (Type == 1)
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾
-                    DataSet ds;
-                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
-                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
-                    if (ds == null || ds.Tables[0].Rows.Count == 0)
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
-                    {
-                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶉渶瑕佸啀浣滃簾!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        //浣滃簾鍗曟嵁
-                        if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 1;
-                            objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                    }
-                }
-                else
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶄綔搴�
-                    DataSet ds;
-                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
-                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
-                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
-                    {
-                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁鏈綔搴�!涓嶉渶瑕佸啀鍙嶄綔搴�!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        //鍙嶄綔搴熷崟鎹�
-                        if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 1;
-                            objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                            objJsonResult.data = null;
-                            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     
+     
 
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1