From e69d3f70d1c82fdbf5cc0b39f55882a10361c0d6 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期日, 29 六月 2025 18:43:59 +0800
Subject: [PATCH] 小车锁定;排时根据产品器具清单获取模具;

---
 WebAPI/Controllers/BaseSet/Gy_ProcessController.cs |  711 ++++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 603 insertions(+), 108 deletions(-)

diff --git a/WebAPI/Controllers/BaseSet/Gy_ProcessController.cs b/WebAPI/Controllers/BaseSet/Gy_ProcessController.cs
index 899915b..baf872b 100644
--- a/WebAPI/Controllers/BaseSet/Gy_ProcessController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_ProcessController.cs
@@ -20,6 +20,7 @@
         private json objJsonResult = new json();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         DataSet ds;
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
 
         #region 宸ュ簭 鏂囦欢涓婁紶
         [Route("Gy_Process/Gy_Process_Excel")]
@@ -28,6 +29,9 @@
         {
             try
             {
+                string Ret = "";
+                oSystemParameter.ShowBill(ref Ret);
+
                 //鑾峰彇鏂囦欢鍚嶇О
                 var file = HttpContext.Current.Request.Files[0];
                 //鑾峰彇鏂囦欢鐗╃悊璺緞
@@ -114,6 +118,8 @@
 
                 if (!tb2.Columns.Contains("宸℃璐ㄦ鏂规鍚嶇О"))
                     error += "娌℃湁鎵惧埌銆愬贰妫�璐ㄦ鏂规鍚嶇О銆戠殑鏍囬,";
+                if (!tb2.Columns.Contains("宸ュ簭鍒嗙被"))
+                    error += "娌℃湁鎵惧埌銆愬伐搴忓垎绫汇�戠殑鏍囬,";
 
 
                 if (error.Length > 0)
@@ -129,6 +135,7 @@
                 {
                     string HProcessName = "";
                     string HProcessNum = "";
+                    string HProcType = "";
                     string HORGNumber = "";
                     string HORGName = "";
                     string HDeptNum = "";
@@ -144,6 +151,7 @@
 
                     HProcessName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["宸ュ簭鍚嶇О"].ToString());
                     HProcessNum = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["宸ュ簭浠g爜"].ToString());
+                    HProcType = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["宸ュ簭鍒嗙被"].ToString());
                     HORGNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["缁勭粐浠g爜"].ToString());
                     HORGName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["缁勭粐鍚嶇О"].ToString());
                     HDeptNum = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["閮ㄩ棬浠g爜"].ToString());
@@ -182,83 +190,166 @@
                         }
                         string HORGid = ds.Tables[0].Rows[0]["HItemID"].ToString();
 
-
-                        //鏌ヨ閮ㄩ棬
-                        ds = oCN.RunProcReturn("select * from Gy_Department where  HNumber='" + HDeptNum + "'  and HUSEORGID=" + HORGid + "", "Gy_Department");
-
-                        if (ds.Tables[0].Rows.Count == 0)
+                        if (oSystemParameter.omodel.WMS_CampanyName == "瀹濆伐")
                         {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,閮ㄩ棬:" + HDeptName + ",涓嶅瓨鍦紒";
-                            objJsonResult.data = null;
-                            return objJsonResult;
+                            if (HProcType == "")
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "绗�" + index + "琛�,宸ュ簭鍒嗙被涓嶈兘涓虹┖锛�";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+
+                            //鏌ヨ閮ㄩ棬
+                            ds = oCN.RunProcReturn("select * from Gy_Department where  HNumber='" + HDeptNum + "'  and HUSEORGID=" + HORGid + "", "Gy_Department");
+
+                            if (ds.Tables[0].Rows.Count == 0)
+                            {
+                                tb2.Rows[i]["HDeptID"] = 0;
+                            }
+                            else
+                            {
+                                tb2.Rows[i]["HDeptID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                            }
+
+                            //鏌ヨ棣栦欢璐ㄦ鏂规
+                            ds = oCN.RunProcReturn("select * from Gy_QCCheckProjectMain where  HBillNo='" + HQCSchemeNum_Fst + "' and HUSEORGID=" + HORGid + "", "Gy_QCCheckProjectMain");
+
+                            if (ds.Tables[0].Rows.Count == 0)
+                            {
+                                tb2.Rows[i]["HQCSchemeID_Fst"] = 0;
+                            }
+                            else
+                            {
+                                tb2.Rows[i]["HQCSchemeID_Fst"] = ds.Tables[0].Rows[0]["HInterID"].ToString();
+                            }
+
+                            //鏌ヨ宸ュ簭璐ㄦ鏂规
+                            ds = oCN.RunProcReturn("select * from Gy_QCCheckProjectMain where  HBillNo='" + HQCSchemeNum_Proc + "' and HUSEORGID=" + HORGid + "", "Gy_QCCheckProjectMain");
+
+                            if (ds.Tables[0].Rows.Count == 0)
+                            {
+                                tb2.Rows[i]["HQCSchemeID_Proc"] = 0;
+                            }
+                            else
+                            {
+                                tb2.Rows[i]["HQCSchemeID_Proc"] = ds.Tables[0].Rows[0]["HInterID"].ToString();
+                            }
+
+                            //鏌ヨ宸℃璐ㄦ鏂规
+                            ds = oCN.RunProcReturn("select * from Gy_QCCheckProjectMain where  HBillNo='" + HQCSchemeNum_Patrol + "' and HUSEORGID=" + HORGid + "", "Gy_QCCheckProjectMain");
+
+                            if (ds.Tables[0].Rows.Count == 0)
+                            {
+                                tb2.Rows[i]["HQCSchemeID_Patrol"] = 0;
+                            }
+                            else
+                            {
+                                tb2.Rows[i]["HQCSchemeID_Patrol"] = ds.Tables[0].Rows[0]["HInterID"].ToString();
+                            }
+                            //鏌ヨ宸ヤ綔涓績
+                            ds = oCN.RunProcReturn("select * from Gy_WorkCenter where  HNumber='" + HCentNum + "' and HUSEORGID=" + HORGid + "", "Gy_WorkCenter"); //
+
+                            if (ds.Tables[0].Rows.Count == 0)
+                            {
+                                tb2.Rows[i]["HWorkCenterID"] = 0;
+                            }
+                            else
+                            {
+                                tb2.Rows[i]["HWorkCenterID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                            }
                         }
                         else
                         {
-                            tb2.Rows[i]["HDeptID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
-                        }
+                            //鏌ヨ閮ㄩ棬
+                            ds = oCN.RunProcReturn("select * from Gy_Department where  HNumber='" + HDeptNum + "'  and HUSEORGID=" + HORGid + "", "Gy_Department");
 
-                        //鏌ヨ棣栦欢璐ㄦ鏂规
-                        ds = oCN.RunProcReturn("select * from Gy_QCCheckProjectMain where  HBillNo='" + HQCSchemeNum_Fst + "' and HUSEORGID=" + HORGid + "", "Gy_QCCheckProjectMain");
+                            if (ds.Tables[0].Rows.Count == 0)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,閮ㄩ棬:" + HDeptName + ",涓嶅瓨鍦紒";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                            else
+                            {
+                                tb2.Rows[i]["HDeptID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                            }
 
-                        if (ds.Tables[0].Rows.Count == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,棣栦欢璐ㄦ鏂规:" + HQCSchemeName_Fst + ",涓嶅瓨鍦紒";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        else
-                        {
-                            tb2.Rows[i]["HQCSchemeID_Fst"] = ds.Tables[0].Rows[0]["HInterID"].ToString();
-                        }
-                        //鏌ヨ宸ュ簭璐ㄦ鏂规
-                        ds = oCN.RunProcReturn("select * from Gy_QCCheckProjectMain where  HBillNo='" + HQCSchemeNum_Proc + "' and HUSEORGID=" + HORGid + "", "Gy_QCCheckProjectMain");
+                            //鏌ヨ棣栦欢璐ㄦ鏂规
+                            ds = oCN.RunProcReturn("select * from Gy_QCCheckProjectMain where  HBillNo='" + HQCSchemeNum_Fst + "' and HUSEORGID=" + HORGid + "", "Gy_QCCheckProjectMain");
 
-                        if (ds.Tables[0].Rows.Count == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,宸ュ簭璐ㄦ鏂规:" + HQCSchemeName_Proc + ",涓嶅瓨鍦紒";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        else
-                        {
-                            tb2.Rows[i]["HQCSchemeID_Proc"] = ds.Tables[0].Rows[0]["HInterID"].ToString();
-                        }
-                        //鏌ヨ宸℃璐ㄦ鏂规
-                        ds = oCN.RunProcReturn("select * from Gy_QCCheckProjectMain where  HBillNo='" + HQCSchemeNum_Patrol + "' and HUSEORGID=" + HORGid + "", "Gy_QCCheckProjectMain");
+                            if (ds.Tables[0].Rows.Count == 0)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,棣栦欢璐ㄦ鏂规:" + HQCSchemeName_Fst + ",涓嶅瓨鍦紒";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                            else
+                            {
+                                tb2.Rows[i]["HQCSchemeID_Fst"] = ds.Tables[0].Rows[0]["HInterID"].ToString();
+                            }
 
-                        if (ds.Tables[0].Rows.Count == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,宸℃璐ㄦ鏂规:" + HQCSchemeName_Patrol + ",涓嶅瓨鍦紒";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        else
-                        {
-                            tb2.Rows[i]["HQCSchemeID_Patrol"] = ds.Tables[0].Rows[0]["HInterID"].ToString();
-                        }
+                            //鏌ヨ宸ュ簭璐ㄦ鏂规
+                            ds = oCN.RunProcReturn("select * from Gy_QCCheckProjectMain where  HBillNo='" + HQCSchemeNum_Proc + "' and HUSEORGID=" + HORGid + "", "Gy_QCCheckProjectMain");
 
-                        //鏌ヨ宸ヤ綔涓績
-                        ds = oCN.RunProcReturn("select * from Gy_WorkCenter where  HNumber='" + HCentNum + "' and HUSEORGID=" + HORGid + "", "Gy_WorkCenter"); //
+                            if (ds.Tables[0].Rows.Count == 0)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,宸ュ簭璐ㄦ鏂规:" + HQCSchemeName_Proc + ",涓嶅瓨鍦紒";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                            else
+                            {
+                                tb2.Rows[i]["HQCSchemeID_Proc"] = ds.Tables[0].Rows[0]["HInterID"].ToString();
+                            }
 
-                        if (ds.Tables[0].Rows.Count == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,宸ヤ綔涓績:" + HCentName + ",涓嶅瓨鍦紒";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        else
-                        {
-                            tb2.Rows[i]["HWorkCenterID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                            //鏌ヨ宸℃璐ㄦ鏂规
+                            ds = oCN.RunProcReturn("select * from Gy_QCCheckProjectMain where  HBillNo='" + HQCSchemeNum_Patrol + "' and HUSEORGID=" + HORGid + "", "Gy_QCCheckProjectMain");
+
+                            if (ds.Tables[0].Rows.Count == 0)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,宸℃璐ㄦ鏂规:" + HQCSchemeName_Patrol + ",涓嶅瓨鍦紒";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                            else
+                            {
+                                tb2.Rows[i]["HQCSchemeID_Patrol"] = ds.Tables[0].Rows[0]["HInterID"].ToString();
+                            }
+                            //鏌ヨ宸ヤ綔涓績
+                            ds = oCN.RunProcReturn("select * from Gy_WorkCenter where  HNumber='" + HCentNum + "' and HUSEORGID=" + HORGid + "", "Gy_WorkCenter"); //
+
+                            if (ds.Tables[0].Rows.Count == 0)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,宸ヤ綔涓績:" + HCentName + ",涓嶅瓨鍦紒";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                            else
+                            {
+                                tb2.Rows[i]["HWorkCenterID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                            }
+
+                            //宸ュ簭浠g爜
+                            if (HProcessNum == "")
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "绗�" + index + "琛�,宸ュ簭璧勬簮浠g爜涓嶈兘涓虹┖锛�";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
                         }
 
                         //宸ュ簭鍚嶇О
@@ -271,15 +362,7 @@
                             return objJsonResult;
                         }
 
-                        //宸ュ簭浠g爜
-                        if (HProcessNum == "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "绗�" + index + "琛�,宸ュ簭璧勬簮浠g爜涓嶈兘涓虹┖锛�";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
+                        
                     }
                     else
                     {
@@ -320,6 +403,9 @@
             string user = sArray[1].ToString();
             try
             {
+                string Ret = "";
+                oSystemParameter.ShowBill(ref Ret);
+
                 if (!DBUtility.ClsPub.Security_Log("Gy_Porcess_Edit", 1, false, user))
                 {
                     objJsonResult.code = "0";
@@ -354,6 +440,7 @@
                     string HQCSchemeID_Patrol = item["HQCSchemeID_Patrol"].ToString();//宸℃璐ㄦ鏂规ID
                     string HProcessName = item["宸ュ簭鍚嶇О"].ToString();
                     string HProcessNum = item["宸ュ簭浠g爜"].ToString();
+                    string HProcType = item["宸ュ簭鍒嗙被"].ToString();
                     string sShortNumber;
                     sShortNumber = DBUtility.ClsPub.GetShortNumber(HProcessNum);//鐭唬鐮�
                     if (sShortNumber.Trim() == "")
@@ -377,18 +464,32 @@
                         return objJsonResult;
                     }
 
-                    ds = oCN.RunProcReturn("select * from Gy_Process where HNumber='" + HProcessNum + "'", "Gy_Source");
+                    if (oSystemParameter.omodel.WMS_CampanyName == "瀹濆伐")
+                    {
+                        ds = oCN.RunProcReturn("select * from Gy_Process where HName='" + HProcessName + "'", "Gy_Process");
+                    }
+                    else
+                    {
+                        ds = oCN.RunProcReturn("select * from Gy_Process where HNumber='" + HProcessNum + "'", "Gy_Source");
+                    }
 
                     if (ds.Tables[0].Rows.Count == 0)
                     {
 
-                        string sql = "insert into Gy_Process(HName,HNumber,HDeptID,HUSEORGID,HCREATEORGID,HWorkCenterID,HShortNumber,HQCSchemeID_Fst,HQCSchemeID_Proc,HQCSchemeID_Patrol,HEndFlag,HLevel,HHelpCode,HParentID,HStopflag,HRemark,HTypeFlow,HTypeCount)" +
-                            $"values('{HProcessName}', '{HProcessNum}',{HDeptID}, {HOrgID}, {HOrgID}, {HWorkCenterID}, '{sShortNumber}',{HQCSchemeID_Fst},{HQCSchemeID_Proc},{HQCSchemeID_Patrol},{HEndFlag},{HLevel},'',0,0,'',0,0)";
+                        string sql = "insert into Gy_Process(HName,HNumber,HDeptID,HUSEORGID,HCREATEORGID,HWorkCenterID,HShortNumber,HQCSchemeID_Fst,HQCSchemeID_Proc,HQCSchemeID_Patrol,HEndFlag,HLevel,HHelpCode,HParentID,HStopflag,HRemark,HTypeFlow,HTypeCount,HProcType)" +
+                            $"values('{HProcessName}', '{HProcessNum}',{HDeptID}, {HOrgID}, {HOrgID}, {HWorkCenterID}, '{sShortNumber}',{HQCSchemeID_Fst},{HQCSchemeID_Proc},{HQCSchemeID_Patrol},{HEndFlag},{HLevel},'',0,0,'',0,0,'{HProcType}')";
                         oCN.RunProc(sql);
                     }
                     else
                     {
-                        oCN.RunProc("	update  Gy_Process set HWorkCenterID=" + HWorkCenterID + ",HDeptID=" + HDeptID + ",HQCSchemeID_Fst=" + HQCSchemeID_Fst + ",HQCSchemeID_Proc=" + HQCSchemeID_Proc + ",HQCSchemeID_Patrol=" + HQCSchemeID_Patrol + "  where HNumber='" + HProcessNum + "'");
+                        if (oSystemParameter.omodel.WMS_CampanyName == "瀹濆伐")
+                        {
+                            oCN.RunProc("	update  Gy_Process set HWorkCenterID=" + HWorkCenterID + ",HDeptID=" + HDeptID + ",HQCSchemeID_Fst=" + HQCSchemeID_Fst + ",HQCSchemeID_Proc=" + HQCSchemeID_Proc + ",HQCSchemeID_Patrol=" + HQCSchemeID_Patrol + ",HProcType = '" + HProcType + "'  where HNumber='" + HProcessName + "'");
+                        }
+                        else
+                        {
+                            oCN.RunProc("	update  Gy_Process set HWorkCenterID=" + HWorkCenterID + ",HDeptID=" + HDeptID + ",HQCSchemeID_Fst=" + HQCSchemeID_Fst + ",HQCSchemeID_Proc=" + HQCSchemeID_Proc + ",HQCSchemeID_Patrol=" + HQCSchemeID_Patrol + ",HProcType = '" + HProcType + "'  where HNumber='" + HProcessNum + "'");
+                        }
                     }
 
                     i++;
@@ -695,6 +796,7 @@
                 long HItemID = list[0].HItemID;
                 string HNumber = list[0].HNumber;
                 string HName = list[0].HName;
+                string HProcType = list[0].HProcType;
                 string HShortNumber = list[0].HNumber;
                 long HParentID = list[0].HParentID;
                 string HHelpCode = list[0].HHelpCode;
@@ -720,13 +822,11 @@
                 long HDeptID = list[0].HDeptID;
                 long HProcID = list[0].HProcID;
                 int HUSEORGID = list[0].HUSEORGID;
+                int HCREATEORGID = list[0].HCREATEORGID;
                 bool HTProcessFlag = list[0].HTProcessFlag;
                 int HQCSchemeID_Fst = list[0].HQCSchemeID_Fst;
                 int HQCSchemeID_Proc = list[0].HQCSchemeID_Proc;
                 int HQCSchemeID_Patrol = list[0].HQCSchemeID_Patrol;
-
-
-
 
                 long HWorkCenterID = list[0].HWorkCenterID;    //宸ヤ綔涓績
 
@@ -736,6 +836,9 @@
                 long HWWBadWHID = list[0].HWWBadWHID; //濮斿涓嶈壇浠撳簱
                 long HWWWasterWHID = list[0].HWWWasterWHID; //濮斿鎶ュ簾浠撳簱
                 long HWHID = list[0].HWHID; //鑹搧浠撳簱
+                string HMakeEmp = user;
+                string HPayMentType = list[0].HPayMentType; //璁′欢宸ヨ祫绫诲瀷
+                decimal HStandardWages = list[0].HStandardWages; //鏍囧噯宸ヤ环
 
 
                 //鍒ゆ柇鏉冮檺
@@ -770,27 +873,128 @@
                 if (HItemID == 0)
                 {
                     oCN.BeginTran();
+                    //鍒ゆ柇浠g爜鏄惁閲嶅
+                    DataSet dss;
+                    dss = oCN.RunProcReturn("select * from Gy_Process 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_Process_BeforeSaveCtrl " + HMakeEmp + ",'" + 1 + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Process_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_Process  " +
-                        " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
-                        ",HTypeFlow,HTypeCount,HDeptNumber,HSNo" +
-                        ",HLevel,HEndFlag,HStopflag,HRemark,HDeptID,HBarCodeForBase,HProcessID_K3,HBillSubType,HAutoTrunFlag" +
-                        ",HFixPrice,HOverFixPrice,HProcMulID,HProcCheckNote" +
-                        ",HUSEORGID,HWorkCenterID,HBadWHID,HWasterWHID,HBadCountDevelopWHID,HWWBadWHID,HWWWasterWHID,HWHID,HTProcessFlag" +
-                        ",HQCSchemeID_Fst,HQCSchemeID_Proc,HQCSchemeID_Patrol) " +
-                        " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID.ToString() +
-                        "," + Convert.ToString(HTypeFlow ? 1 : 0) + "," + Convert.ToString(HTypeCount ? 1 : 0) + ",'" + HDeptNumber + "','" + HSNo.ToString() +
-                        "'," + HLevel.ToString() + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "'," + HDeptID +
-                        ",'" + HBarCode + "'," + HProcessID_K3 + ",'" + HBillSubType + "'," + Convert.ToString(HAutoTrunFlag ? 1 : 0) +
-                        ",'" + HFixPrice.ToString() + "'," + HOverFixPrice.ToString() + "," + HProcMulID.ToString() + ",'" + HProcCheckNote.ToString() + "'" +
-                        "," + HUSEORGID + "," + HWorkCenterID + "," + HBadWHID + "," + HWasterWHID + "," + HBadCountDevelopWHID + "," + HWWBadWHID + "," + HWWWasterWHID + "," + HWHID + "," + Convert.ToString(HTProcessFlag ? 1 : 0) + "," + HQCSchemeID_Fst + "," + HQCSchemeID_Proc + "," + HQCSchemeID_Patrol + ")", ref DBUtility.ClsPub.sExeReturnInfo);
+                         " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
+                         ",HTypeFlow,HTypeCount,HDeptNumber,HSNo,HUseFlag" +
+                         ",HLevel,HEndFlag,HStopflag,HRemark,HDeptID,HBarCodeForBase,HProcessID_K3,HBillSubType,HAutoTrunFlag" +
+                         ",HFixPrice,HOverFixPrice,HProcMulID,HProcCheckNote" +
+                         ",HUSEORGID,HCREATEORGID,HWorkCenterID,HBadWHID,HWasterWHID,HBadCountDevelopWHID,HWWBadWHID,HWWWasterWHID,HWHID,HTProcessFlag" +
+                         ",HQCSchemeID_Fst,HQCSchemeID_Proc,HQCSchemeID_Patrol,HPayMentType,HMakeTime,HMakeEmp,HStandardWages,HProcType) " +
+                         " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID.ToString() +
+                         "," + Convert.ToString(HTypeFlow ? 1 : 0) + "," + Convert.ToString(HTypeCount ? 1 : 0) + ",'" + HDeptNumber + "','" + HSNo.ToString() + "','" + HUseFlag.ToString() +
+                         "'," + HLevel.ToString() + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "'," + HDeptID +
+                         ",'" + HBarCodeForBase + "'," + HProcessID_K3 + ",'" + HBillSubType + "'," + Convert.ToString(HAutoTrunFlag ? 1 : 0) +
+                         ",'" + HFixPrice.ToString() + "'," + HOverFixPrice.ToString() + "," + HProcMulID.ToString() + ",'" + HProcCheckNote.ToString() + "'" +
+                         "," + HUSEORGID + "," + HCREATEORGID + "," + HWorkCenterID + "," + HBadWHID + "," + HWasterWHID + "," + HBadCountDevelopWHID + "," + HWWBadWHID + "," + HWWWasterWHID + "," + HWHID + "," + Convert.ToString(HTProcessFlag ? 1 : 0) + "," + HQCSchemeID_Fst + "," + HQCSchemeID_Proc + "," + HQCSchemeID_Patrol
+                         + ",'" + HPayMentType + "',getdate(),'" + HMakeEmp + "'," + HStandardWages + ",'" + HProcType + "' )", ref DBUtility.ClsPub.sExeReturnInfo);
+                       
                     //淇敼涓婄骇涓洪潪鏈骇浠g爜
                     oCN.RunProc("Update Gy_Process set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+
+
+                    //淇濆瓨鍚庢帶鍒�=========================================      
+                    string sql2 = "exec h_p_Gy_Process_AfterSaveCtrl " + HMakeEmp + ",'" + 1 + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Process_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();
+                    //宸插鏍镐笉鍏佽淇敼
+                    DataSet dss;
+                    dss = oCN.RunProcReturn("select * from Gy_Process where HItemID=" + HItemID, "Gy_Process");
+                    //鍒ゆ柇鏄惁鍙紪杈�
+                    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_Process_BeforeSaveCtrl " + HMakeEmp + ",'" + 2 + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Process_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_Process set " +
                         " HNumber='" + HNumber + "'" +
                         ",HName='" + HName + "'" +
@@ -801,13 +1005,16 @@
                         ",HTypeCount= '" + HTypeCount + "'" +
                         ",HDeptNumber='" + HDeptNumber + "'" +
                         ",HSNo= " + HSNo +
+                        ",HUseFlag= '" + HUseFlag + "'" +
                         ",HLevel= " + HLevel +
                         ",HEndFlag= '" + HEndFlag + "'" +
                         ",HTProcessFlag= '" + HTProcessFlag + "'" +
                         ",HStopflag= '" + HStopflag + "'" +
                         ",HRemark='" + HRemark + "'" +
                         ",HDeptID= " + HDeptID +
-                        ",HBarCodeForBase='" + HBarCode + "'" +
+                        ",HUSEORGID='" + HUSEORGID + "'" +
+                        ",HCREATEORGID='" + HCREATEORGID + "'" +
+                        ",HBarCodeForBase='" + HBarCodeForBase + "'" +
                         ",HProcessID_K3= " + HProcessID_K3 +
                         ",HBillSubType='" + HBillSubType + "'" +
                         ",HAutoTrunFlag= '" + HAutoTrunFlag + "'" +
@@ -824,10 +1031,42 @@
                         ",HQCSchemeID_Fst= " + HQCSchemeID_Fst +
                         ",HQCSchemeID_Proc= " + HQCSchemeID_Proc +
                         ",HQCSchemeID_Patrol= " + HQCSchemeID_Patrol +
-                        ",HProcCheckNote='" + HProcCheckNote + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
+                        ",HPayMentType= '" + HPayMentType + "'" +
+                        ",HStandardWages= " + HStandardWages +                        
+                        ",HModifyTime= getdate()" +
+                        ",HModifyEmp='" + HMakeEmp + "'" +
+                        ",HProcCheckNote='" + HProcCheckNote + "' " +
+                        ",HProcType = '" + HProcType + "' " +
+                        " Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                     //淇敼涓婄骇涓洪潪鏈骇浠g爜
                     oCN.RunProc("Update Gy_Process set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
-                    //
+                    
+
+                    //淇濆瓨鍚庢帶鍒�=========================================      
+                    string sql2 = "exec h_p_Gy_Process_AfterSaveCtrl " + HMakeEmp + ",'" + 2 + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Process_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";
@@ -997,16 +1236,14 @@
                     objJsonResult.data = null;
                     return objJsonResult; ;
                 }
-                //var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]);
-                //if (HStopflag)
-                //{
-                //    oCN.RollBack();//鍥炴粴浜嬪姟
-                //    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; ;
+                }             
                 ds1 = oCN.RunProcReturn("Select HItemID from  Gy_Process  Where HParentID='" + HItemID + "'", " Gy_Process");
                 if (ds1.Tables[0].Rows.Count != 0)
                 {
@@ -1027,7 +1264,58 @@
                     return objJsonResult;
                 }
 
+                //鍒犻櫎鍓嶆帶鍒�=========================================      
+                string sql1 = "exec h_p_Gy_Process_BeforeDelCtrl " + HItemID + ",'" + user + "'";
+                ds = oCN.RunProcReturn(sql1, "h_p_Gy_Process_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_Process  where HItemID=" + HItemID);
+
+
+                //鍒犻櫎鍚庢帶鍒�=========================================      
+                string sql2 = "exec h_p_Gy_Process_AfterDelCtrl " + HItemID + ",'" + user + "'";
+                ds = oCN.RunProcReturn(sql2, "h_p_Gy_Process_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;
@@ -1111,7 +1399,59 @@
 
                 if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
                 {
+
+                    //瀹℃牳鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_Gy_Process_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Process_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_Process set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
+
+
+                    //瀹℃牳鍚庢帶鍒�=========================================      
+                    string sql2 = "exec h_p_Gy_Process_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Process_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;
@@ -1120,7 +1460,59 @@
                 }
                 if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
                 {
+
+                    //鍙嶅鏍稿墠鎺у埗=========================================      
+                    string sql1 = "exec h_p_Gy_Process_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Process_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_Process set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
+
+
+                    //鍙嶅鏍稿悗鎺у埗=========================================      
+                    string sql2 = "exec h_p_Gy_Process_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Process_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;
@@ -1206,7 +1598,58 @@
 
                 if (IsStop == 0)  //绂佺敤鍒ゆ柇
                 {
+                    //绂佺敤鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_Gy_Process_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Process_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_Process set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
+
+
+                    //绂佺敤鍚庢帶鍒�=========================================      
+                    string sql2 = "exec h_p_Gy_Process_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Process_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;
@@ -1215,8 +1658,60 @@
                 }
                 if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂�
                 {
+
+                    //鍙嶇鐢ㄥ墠鎺у埗=========================================      
+                    string sql1 = "exec h_p_Gy_Process_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Process_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_Process set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
 
+
+                    //鍙嶇鐢ㄥ悗鎺у埗=========================================      
+                    string sql2 = "exec h_p_Gy_Process_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Process_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;
                     objJsonResult.Message = "鍙嶇鐢ㄦ垚鍔�";

--
Gitblit v1.9.1