From c4c02944532a9bfda6de9a0cd85a9dfa631ed003 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期六, 17 五月 2025 15:28:19 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/BaseSet/Gy_GroupController.cs |  441 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 422 insertions(+), 19 deletions(-)

diff --git a/WebAPI/Controllers/BaseSet/Gy_GroupController.cs b/WebAPI/Controllers/BaseSet/Gy_GroupController.cs
index d84dd94..2e7ec97 100644
--- a/WebAPI/Controllers/BaseSet/Gy_GroupController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_GroupController.cs
@@ -27,8 +27,6 @@
 
         /// <summary>
         /// 杩斿洖鐝粍鍒楄〃
-        ///鍙傛暟锛歴tring sql銆�
-        ///杩斿洖鍊硷細object銆�
         /// </summary>
         [Route("Gy_Group/list")]
         [HttpGet]
@@ -46,6 +44,11 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
+                //鏍规嵁鐢ㄦ埛瀵瑰簲鐝粍鐨勫叧绯伙紝杩囨护鏉′欢涓鍔犲彧鏄剧ず瀵瑰簲鐨勭彮缁�
+                DataSet dsHitemID = oCN.RunProcReturn("exec h_p_Gy_GetSQLGroupByUser '" + user + "'", "h_p_Gy_GetSQLGroupByUser");
+                sWhere = sWhere + DBUtility.ClsPub.isStrNull(dsHitemID.Tables[0].Rows[0]["HBack"]);
+
                 if (sWhere == null || sWhere.Equals(""))
                 {
                     ds = oCN.RunProcReturn("select * from h_v_GroupList " + sWhere+ " order by 鐝粍浠g爜 ", "h_v_GroupList");
@@ -271,8 +274,6 @@
                 string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                 string msg2 = sArray[0].ToString();
                 string user = sArray[1].ToString();//鐢ㄦ埛鍚�
-                //string msg4 = sArray[2].ToString();
-                //string msg5 = sArray[3].ToString();
 
                 //鍒ゆ柇鏄惁鏈夌紪杈戞潈闄�
                 if (!DBUtility.ClsPub.Security_Log("Gy_Group_Edit", 1, false, user))
@@ -304,10 +305,17 @@
                 long HProcID = list[0].HProcID;
                 int HUSEORGID = list[0].HUSEORGID;
                 string HCompName = list[0].HCompName;
+                string HPayMentType = list[0].HPayMentType;
                 var HDeptNumber = "";
-                //var HEndFlag = 0;
                 long HLevel = 1;
-                //var HProcID = "";
+                string HMakeEmp = list[0].HMakeEmp;
+                string HCheckEmp = list[0].HCheckEmp;
+                string HCheckTime = list[0].HCheckTime;
+                string HModifyEmp = list[0].HModifyEmp;
+                string HModifyTime = list[0].HModifyTime;
+                string HStopEmp = list[0].HStopEmp;
+                string HStopTime = list[0].HStopTime;              
+                long HCREATEORGID = list[0].HCREATEORGID;
 
                 //鍒ゆ柇鏉冮檺
                 //if (!ClsPub.Security_Log(msg5, 1, false, msg4))
@@ -341,22 +349,123 @@
                 if (HItemID == 0)
                 {
                     oCN.BeginTran();
+                    //鍒ゆ柇浠g爜鏄惁閲嶅
+                    DataSet dss;
+                    dss = oCN.RunProcReturn("select * from Gy_Group where HNumber='" + HNumber + "'", "Gy_Process");
+                    //鍒ゆ柇鏄惁鍙紪杈�
+                    if (dss.Tables[0].Rows.Count != 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁浠g爜閲嶅涓嶅厑璁告柊澧�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //淇濆瓨鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_Gy_Group_BeforeSaveCtrl " + HMakeEmp + ",'" + 1 + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Group_BeforeSaveCtrl");
+                    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("Insert into Gy_Group " +
                     " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
-                    ",HEmpQty,HDeptID,HDeptNumber,HProcID" +
-                    ",HLevel,HEndFlag,HStopflag,HRemark,HBarCodeForBase,HUSEORGID,HCompName) " +
-                    " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID.ToString() +
-                    "," + HEmpQty.ToString() + "," + HDeptID.ToString() + ",'" + HDeptNumber + "'," + HProcID.ToString() +
-                    "," + HLevel.ToString() + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "','" + HBarCodeForBase + "',"+ HUSEORGID + ",'" + HCompName + "')", ref DBUtility.ClsPub.sExeReturnInfo);
+                    ",HEmpQty,HDeptID,HDeptNumber,HProcID,HUseFlag" +
+                    ",HLevel,HEndFlag,HStopflag,HRemark,HBarCodeForBase," +
+                    "HUSEORGID,HCREATEORGID,HCompName,HPayMentType,HMakeEmp,HMakeTime) " +
+                    " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "','" + HParentID.ToString() +
+                    "','" + HEmpQty.ToString() + "','" + HDeptID.ToString() + "','" + HDeptNumber + "','" + HProcID.ToString() + "','" + HUseFlag.ToString() +
+                    "','" + HLevel.ToString() + "'," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "','" + HBarCodeForBase + "'" +
+                    ",'" + HUSEORGID + "','" + HCREATEORGID + "','" + HCompName + "','" + HPayMentType + "','" + user + "',getdate())", ref DBUtility.ClsPub.sExeReturnInfo);
                     //淇敼涓婄骇涓洪潪鏈骇浠g爜
                     oCN.RunProc("Update Gy_Group set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+
+
+                    //淇濆瓨鍚庢帶鍒�=========================================      
+                    string sql2 = "exec h_p_Gy_Group_AfterSaveCtrl " + HMakeEmp + ",'" + 1 + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Group_AfterSaveCtrl");
+                    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();
                 }
                 else
                 {
                     //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
                     oCN.BeginTran();
-                    oCN.RunProc("Update Gy_Group set " + 
+                    //宸插鏍镐笉鍏佽淇敼
+                    DataSet dss;
+                    dss = oCN.RunProcReturn("select * from Gy_Group where HItemID=" + HItemID, "Gy_Group");
+                    //鍒ゆ柇鏄惁鍙紪杈�
+                    if (dss.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "姝ゅ崟鎹姸鎬佸凡缁忓鏍革紝涓嶅厑璁镐慨鏀癸紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //淇濆瓨鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_Gy_Group_BeforeSaveCtrl " + HMakeEmp + ",'" + 2 + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Group_BeforeSaveCtrl");
+                    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("Update Gy_Group set " +
                                  " HNumber='" + HNumber + "'" +
                                  ",HName='" + HName + "'" +
                                  ",HShortNumber='" + HShortNumber + "'" +
@@ -364,18 +473,50 @@
                                  ",HParentID=" + HParentID +
                                  ",HStopflag='" + HStopflag + "'" +
                                  ",HRemark= '" + HRemark + "'" +
+                                 ",HUseFlag= '" + HUseFlag + "'" +
+                                 ",HUSEORGID='" + HUSEORGID + "'" +
+                                 ",HCREATEORGID='" + HCREATEORGID + "'" +
+                                 ",HModifyEmp= '" + user + "'" +
+                                 ",HModifyTime= getdate()" +
                                  ",HDeptID=" + HDeptID +
                                  ",HEmpQty=" + HEmpQty +
-                                 ",HCompName='"+ HCompName+
+                                 ",HCompName='" + HCompName + "'" +
+                                 ",HPayMentType='" + HPayMentType +
                                  "',HBarCodeForBase='" + HBarCodeForBase + "' " +
                                  ", HProcID = '" + HProcID + "'  Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                     oCN.RunProc("Update Gy_Group set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+
+
+                    //淇濆瓨鍚庢帶鍒�=========================================      
+                    string sql2 = "exec h_p_Gy_Group_AfterSaveCtrl " + HMakeEmp + ",'" + 2 + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Group_AfterSaveCtrl");
+                    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 = "淇濆瓨鎴愬姛锛�";
-                //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                 objJsonResult.data = 1;
                 return objJsonResult;
             }
@@ -389,6 +530,8 @@
                 return objJsonResult;
             }
         }
+
+        #region
         ///// <summary>
         ///// 淇敼鍗曟嵁-淇濆瓨鎸夐挳
         /////鍙傛暟锛歴tring sql銆�
@@ -483,6 +626,9 @@
         //        return objJsonResult;
         //    }
         //}
+        #endregion
+
+
         /// <summary>
         /// 鐝粍鍒犻櫎鍔熻兘
         /// </summary>
@@ -493,7 +639,6 @@
         {
             DataSet ds;
             DataSet ds1;
-            string ModRightNameCheck = "Gy_Group_Delete";
             try
             {
                 //鍒犻櫎鏉冮檺
@@ -522,6 +667,14 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult; ;
+                }
+                else if (ds.Tables[0].Rows[0]["HCheckEmp"] != null && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "宸茬粡瀹℃牳涓嶈兘鍒犻櫎锛�";
                     objJsonResult.data = null;
                     return objJsonResult; ;
                 }
@@ -555,7 +708,59 @@
                     return objJsonResult;
                 }
 
+                //鍒犻櫎鍓嶆帶鍒�=========================================      
+                string sql1 = "exec h_p_Gy_Group_BeforeDelCtrl " + HItemID + ",'" + user + "'";
+                ds = oCN.RunProcReturn(sql1, "h_p_Gy_Group_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 from Gy_Group  where HItemID=" + HItemID);
+
+
+                //鍒犻櫎鍚庢帶鍒�=========================================      
+                string sql2 = "exec h_p_Gy_Group_AfterDelCtrl " + HItemID + ",'" + user + "'";
+                ds = oCN.RunProcReturn(sql2, "h_p_Gy_Group_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;
@@ -637,7 +842,57 @@
 
                 if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
                 {
+                    //瀹℃牳鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_Gy_Group_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Group_BeforeCheckCtrl");
+                    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("update Gy_Group set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
+
+                    //瀹℃牳鍚庢帶鍒�=========================================      
+                    string sql2 = "exec h_p_Gy_Group_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Group_AfterCheckCtrl");
+                    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;
+                    }
+                    //==================================================================================
+                   
 
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
@@ -646,7 +901,58 @@
                 }
                 if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
                 {
+                    //鍙嶅鏍稿墠鎺у埗=========================================      
+                    string sql1 = "exec h_p_Gy_Group_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Group_BeforeCheckCtrl");
+                    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("update Gy_Group set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
+
+
+                    //鍙嶅鏍稿悗鎺у埗=========================================      
+                    string sql2 = "exec h_p_Gy_Group_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Group_AfterCheckCtrl");
+                    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;
+                    }
+                    //==================================================================================        
+                   
 
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
@@ -732,7 +1038,55 @@
 
                 if (IsStop == 0)  //绂佺敤鍒ゆ柇
                 {
+                    //绂佺敤鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_Gy_Group_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Group_BeforeStopCtrl");
+                    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("update Gy_Group set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
+
+
+                    //绂佺敤鍚庢帶鍒�=========================================      
+                    string sql2 = "exec h_p_Gy_Group_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Group_AfterStopCtrl");
+                    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;
+                    }
+                    //==================================================================================       
 
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
@@ -741,7 +1095,56 @@
                 }
                 if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂�
                 {
+                    //鍙嶇鐢ㄥ墠鎺у埗=========================================      
+                    string sql1 = "exec h_p_Gy_Group_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Group_BeforeUnStopCtrl");
+                    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("update Gy_Group set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
+
+
+                    //鍙嶇鐢ㄥ悗鎺у埗=========================================      
+                    string sql2 = "exec h_p_Gy_Group_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Group_AfterUnStopCtrl");
+                    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;
+                    }
+                    //==================================================================================            
 
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
@@ -765,9 +1168,9 @@
         #endregion
 
         #region 鐢熶骇鐝粍 鏂囦欢涓婁紶
-        [Route("Gy_Group/Gy_Process_Excel")]
+        [Route("Gy_Group/Gy_Group_Excel")]
         [HttpPost]
-        public json Gy_Process_Excel()
+        public json Gy_Group_Excel()
         {
             json res = new json();
             try
@@ -966,8 +1369,8 @@
         }
         #endregion
 
-        #region 宸ュ簭椤圭洰 瀵煎叆(淇濆瓨)
-        [Route("Gy_Group/Gy_Process_btnSave")]
+        #region 鐢熶骇鐝粍 瀵煎叆(淇濆瓨)
+        [Route("Gy_Group/Gy_Group_btnSave")]
         [HttpPost]
         public object Gy_Group_btnSave([FromBody] JObject sMainSub)
         {

--
Gitblit v1.9.1