From dc34e9d0690456225cabf79a40192de1abdf8dde Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期五, 08 八月 2025 11:31:10 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/WebAPIController.cs | 1235 +++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 1,001 insertions(+), 234 deletions(-)

diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index b3f5f39..73e2772 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -6,6 +6,7 @@
 using Newtonsoft.Json.Linq;
 using SQLHelper;
 using System;
+using System.Text;
 using System.Collections.Generic;
 using System.Data;
 using System.IO;
@@ -89,7 +90,7 @@
         }
 
 
-       
+
         /// <summary>
         /// 鏍规嵁鏃堕棿鑾峰彇浜ч噺姹囨姤鍗曢泦鍚�
         /// </summary>
@@ -343,6 +344,8 @@
         {
             try
             {
+                string sErrMsg = "";
+                oSystemParameter.ShowBill(ref sErrMsg);
                 DataSet ds = null;
                 ClsCN oCnLoc = new ClsCN();
                 DAL.ClsUser oUser = new DAL.ClsUser();
@@ -356,7 +359,7 @@
                     return objjson;
                 }
                 //鍒ゆ柇鐢ㄦ埛鏁版槸鍚﹀ぇ浜庡鎴疯处鍙锋暟
-                DataSet ds1 = oCN.RunProcReturn("Exec h_p_Xt_BaseInfo ", "h_p_Xt_BaseInfo");               
+                DataSet ds1 = oCN.RunProcReturn("Exec h_p_Xt_BaseInfo ", "h_p_Xt_BaseInfo");
                 if (DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBack"]) != "0")
                 {
                     objjson.code = "0";
@@ -368,14 +371,18 @@
                 string sql = string.Format(@" select a.* from Gy_UserByOrgRelation a
                                               where a.HUserID = '{0}' and a.HOrgID = '{1}'", UserName, HOrgName);
                 DataSet _ds = oCnLoc.RunProcReturn(sql, "h_p_Xt_UserRelationOrg_Check");
-                //if (_ds == null || _ds.Tables[0].Rows.Count == 0)
-                //{
-                //    objjson.code = "0";
-                //    objjson.count = 0;
-                //    objjson.Message = "鐢ㄦ埛" + UserName + "娌℃湁璇ョ粍缁囨潈闄�";
-                //    objjson.data = null;
-                //    return objjson;
-                //}
+
+                if (oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏂帿灏�")
+                {
+                    if (_ds == null || _ds.Tables[0].Rows.Count == 0)
+                    {
+                        objjson.code = "0";
+                        objjson.count = 0;
+                        objjson.Message = "鐢ㄦ埛" + UserName + "娌℃湁璇ョ粍缁囨潈闄�";
+                        objjson.data = null;
+                        return objjson;
+                    }
+                }
 
                 objjson.code = "0";
                 objjson.count = 1;
@@ -490,15 +497,15 @@
         /// <returns></returns>
         [Route("Web/GetXGPassword")]
         [HttpGet]
-        public object GetXGPassword(string UserName, string oldPassword, string PassWord, string Repassword,string HCloudUserName,string HCloudUserPsd)
+        public object GetXGPassword(string UserName, string oldPassword, string PassWord, string Repassword, string HCloudUserName, string HCloudUserPsd)
         {
             try
             {
                 ClsCN oCn = new ClsCN();
                 DataSet oDs = new DataSet();
                 //==========
-                
-                if(PassWord!=null)
+
+                if (PassWord != null)
                 {
                     oDs = oCn.RunProcReturn("select Czmm from  Gy_Czygl where Czybm='" + UserName + "'", "Gy_Czygl");
                     if (PassWord.Trim() != Repassword.Trim())
@@ -518,12 +525,12 @@
                         objjson.data = null;
                         return objjson; ;
                     }
-                    oCn.RunProc("update  Gy_Czygl set Czmm='" + ClsPub.StrToPsd(PassWord.Trim()) + "',HCloudUserName = '" + HCloudUserName+ "',HCloudUserPsd = '" + HCloudUserPsd+ "' where Czybm='" + UserName.Trim() + "'");
+                    oCn.RunProc("update  Gy_Czygl set Czmm='" + ClsPub.StrToPsd(PassWord.Trim()) + "',HCloudUserName = '" + HCloudUserName + "',HCloudUserPsd = '" + HCloudUserPsd + "' where Czybm='" + UserName.Trim() + "'");
                     objjson.code = "0";
                     objjson.count = 1;
                     objjson.Message = "* 瀵嗙爜淇敼鎴愬姛锛�";
                     objjson.data = null;
-                    return objjson; 
+                    return objjson;
                 }
                 else
                 {
@@ -1207,7 +1214,7 @@
                 return objjson;
             }
         }
-     
+
         /// <summary>
         /// 鑾峰彇浠撲綅鍒楄〃
         /// </summary>
@@ -2219,6 +2226,103 @@
         }
 
         /// <summary>
+        /// 鑾峰彇鐜妫�楠屾柟妗堝垪琛�
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Web/Gy_EnvironmentTestSchemeBillList_Json")]
+        [HttpGet]
+        public object Gy_EnvironmentTestSchemeBillList_Json(string sWhere)
+        {
+            DataSet ds;
+
+            if (sWhere != "")
+            {
+                sWhere = " and ( 鐢熶骇閮ㄩ棬 like '%" + sWhere + "%' or 宸ヤ綔涓績 like '%" + sWhere + "%' or 宸ュ簭鍚嶇О like '%" + sWhere + "%' or 妫�娴嬮」鐩� like '%" + sWhere + "%' ) ";
+            }
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                ds = oCN.RunProcReturn("select  * from h_v_Gy_EnvironmentTestSchemeBillList_PDA where 瀹℃牳浜� !='' and 鍏抽棴浜�=''  " + sWhere + " Order by 鍗曟嵁鍙� ", "h_v_Gy_EnvironmentTestSchemeBillList_PDA");
+                if (ds == null || ds.Tables[0].Rows.Count <= 0)
+                {
+                    objjson.code = "0";
+                    objjson.count = 0;
+                    objjson.Message = "鑾峰彇澶辫触";
+                    objjson.data = null;
+                    return objjson;
+                }
+                else
+                {
+                    objjson.code = "0";
+                    objjson.count = 1;
+                    objjson.Message = "鑾峰彇鎴愬姛!";
+                    objjson.data = ds.Tables[0];
+                    return objjson;
+                }
+            }
+            catch (Exception e)
+            {
+
+                objjson.code = "0";
+                objjson.count = 0;
+                objjson.Message = "鑾峰彇澶辫触" + e.ToString();
+                objjson.data = null;
+                return objjson;
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇鐜妫�娴嬮」鐩垪琛�
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Web/Gy_EnvironmentTestItemList_Json")]
+        [HttpGet]
+        public object Gy_EnvironmentTestItemList_Json(string sWhere)
+        {
+            DataSet ds;
+
+            if (sWhere != "")
+            {
+                sWhere = " and ( HNumber like '%" + sWhere + "%' or HName like '%" + sWhere + "%'  ) ";
+            }
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                ds = oCN.RunProcReturn("select HItemID ,HName 鐜妫�娴嬮」鐩�,HNumber 鐜妫�娴嬩唬鐮� from Gy_EnvironmentTestItem where ISNULL(HCheckTime,'')!='' and HStopflag =0  " + sWhere + " Order by HNumber ", "Gy_EnvironmentTestItem");
+                if (ds == null || ds.Tables[0].Rows.Count <= 0)
+                {
+                    objjson.code = "0";
+                    objjson.count = 0;
+                    objjson.Message = "鑾峰彇澶辫触";
+                    objjson.data = null;
+                    return objjson;
+                }
+                else
+                {
+                    objjson.code = "0";
+                    objjson.count = 1;
+                    objjson.Message = "鑾峰彇鎴愬姛!";
+                    objjson.data = ds.Tables[0];
+                    return objjson;
+                }
+            }
+            catch (Exception e)
+            {
+
+                objjson.code = "0";
+                objjson.count = 0;
+                objjson.Message = "鑾峰彇澶辫触" + e.ToString();
+                objjson.data = null;
+                return objjson;
+            }
+        }
+
+
+        /// <summary>
         /// 鑾峰彇閾惰鍒楄〃
         /// <summary>
         ///鍙傛暟锛歴tring sql銆�
@@ -2587,7 +2691,7 @@
                     }
                     //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
 
-                    ds = oCN.RunProcReturn("select * from  Gy_BadReason where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_BadReason");
+                    ds = oCN.RunProcReturn("select * from  Gy_BadReason where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID='" + oItem.HUSEORGID + "'", "Gy_BadReason");
                     if (oItem.HNumber.Trim() == "")
                     {
                         objJsonResult.code = "0";
@@ -2607,7 +2711,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -2658,6 +2762,23 @@
                                 return objJsonResult;
                             }
                         }
+                        if (ds.Tables[0].Rows.Count > 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
+                    //宸插鏍哥殑涓嶅厑璁镐繚瀛�
+                    if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜淇濆瓨锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
                     }
                     //寰楀埌鐭唬鐮�
                     string sShortNumber;
@@ -2692,7 +2813,7 @@
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
-                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; ;
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -2768,18 +2889,22 @@
                     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;
-                //}
-
-
+                if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
                 //鍒犻櫎鍓嶆帶鍒�=========================================      
                 string sql1 = "exec h_p_Gy_BadReason_BeforeDelCtrl " + HItemID + ",'" + user + "'";
                 ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadReason_BeforeDelCtrl");
@@ -2832,7 +2957,7 @@
                 }
                 //================================================================================== 
 
-               
+
                 oCN.Commit();//鎻愪氦浜嬪姟
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
@@ -3142,7 +3267,7 @@
 
                     if (ds.Tables[0].Rows.Count == 0)
                     {
-                        oCN.RunProc("Insert into "  + "Gy_BadReason " +
+                        oCN.RunProc("Insert into " + "Gy_BadReason " +
                         " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                         ",HDeptID,HProcID" +
                         ",HLevel,HEndFlag,HStopflag,HRemark,HBadTypeID) " +
@@ -3152,7 +3277,7 @@
                     }
                     else
                     {
-                        oCN.RunProc("Update Gy_BadReason"+ " set " +
+                        oCN.RunProc("Update Gy_BadReason" + " set " +
                         "HName='" + HName + "'" +
                         ",HShortNumber='" + sShortNumber + "'" +
                         ",HHelpCode='" + HHelpCode + "'" +
@@ -3263,7 +3388,7 @@
                     }
                     //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
 
-                    ds = oCN.RunProcReturn("select * from  Gy_BadType where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_BadType");
+                    ds = oCN.RunProcReturn("select * from  Gy_BadType where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID= '" + oItem.HUSEORGID + "' ", "Gy_BadType");
                     if (oItem.HNumber.Trim() == "")
                     {
                         objJsonResult.code = "0";
@@ -3283,7 +3408,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -3334,7 +3459,26 @@
                                 return objJsonResult;
                             }
                         }
+                        if (ds.Tables[0].Rows.Count > 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
                     }
+
+                    //宸插鏍哥殑涓嶅厑璁镐繚瀛�
+                    if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜淇濆瓨锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
                     //寰楀埌鐭唬鐮�
                     string sShortNumber;
                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
@@ -3414,7 +3558,6 @@
         public object DeltetGy_BadType(string HItemID, string user)
         {
             DataSet ds;
-            //string ModRightNameCheck = "Sc_ProcessReport_check";
             try
             {
                 //鍒犻櫎鏉冮檺
@@ -3446,17 +3589,22 @@
                     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;
-                //}
-
+                if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
                 //鍒犻櫎鍓嶆帶鍒�=========================================      
                 string sql1 = "exec h_p_Gy_BadType_BeforeDelCtrl " + HItemID + ",'" + user + "'";
                 ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadType_BeforeDelCtrl");
@@ -3509,7 +3657,7 @@
                 }
                 //================================================================================== 
 
-              
+
                 oCN.Commit();//鎻愪氦浜嬪姟
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
@@ -3646,7 +3794,7 @@
                         {
                             tb2.Rows[i]["HOrgID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
                         }
-                        if(HGroupNumber != "")
+                        if (HGroupNumber != "")
                         {
                             //鏌ヨ鐝粍
                             ds = oCN.RunProcReturn("select * from Gy_Group where  HNumber='" + HGroupNumber + "' and Hname='" + HGroupName + "'", "Gy_Group");
@@ -3788,13 +3936,13 @@
 
                     if (ds.Tables[0].Rows.Count == 0)
                     {
-                            oCN.RunProc("Insert into Gy_BadType" + " " +
-                        " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
-                        ",HGroupID" +
-                        ",HLevel,HEndFlag,HStopflag,HRemark,HUSEORGID,HCREATEORGID,HUseFlag,HMakeEmp,HMakeTime) " +
-                        " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + sShortNumber + "'," + 0 +
-                        "," + HGroupID.ToString() +
-                        "," + HLevel.ToString() + "," + HEndFlag + "," + 0 + ",'" + HRemark + "'," + HOrgID + "," + HOrgID + ",'" + "鏈娴�" + "','" + user + "',getdate())", ref DBUtility.ClsPub.sExeReturnInfo);
+                        oCN.RunProc("Insert into Gy_BadType" + " " +
+                    " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
+                    ",HGroupID" +
+                    ",HLevel,HEndFlag,HStopflag,HRemark,HUSEORGID,HCREATEORGID,HUseFlag,HMakeEmp,HMakeTime) " +
+                    " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + sShortNumber + "'," + 0 +
+                    "," + HGroupID.ToString() +
+                    "," + HLevel.ToString() + "," + HEndFlag + "," + 0 + ",'" + HRemark + "'," + HOrgID + "," + HOrgID + ",'" + "鏈娴�" + "','" + user + "',getdate())", ref DBUtility.ClsPub.sExeReturnInfo);
 
                     }
                     else
@@ -3983,6 +4131,17 @@
                             }
                         }
                     }
+
+                    //宸插鏍哥殑涓嶅厑璁镐繚瀛�
+                    if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜淇濆瓨锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
                     //寰楀埌鐭唬鐮�
                     string sShortNumber;
                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
@@ -4018,7 +4177,6 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -4553,7 +4711,7 @@
                     }
                     //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
 
-                    ds = oCN.RunProcReturn("select * from  Gy_BadResult where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_BadResult");
+                    ds = oCN.RunProcReturn("select * from  Gy_BadResult where   HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID= '" + oItem.HUSEORGID + "'  ", "Gy_BadResult");
                     if (oItem.HNumber.Trim() == "")
                     {
                         objJsonResult.code = "0";
@@ -4562,6 +4720,7 @@
                         objJsonResult.data = 1;
                         return objJsonResult;
                     }
+
                     //鏂板鏃跺垽鏂�
                     if (oItem.HItemID == 0)
                     {
@@ -4573,7 +4732,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -4624,7 +4783,26 @@
                                 return objJsonResult;
                             }
                         }
+                        if (ds.Tables[0].Rows.Count > 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
                     }
+
+                    //宸插鏍哥殑涓嶅厑璁镐繚瀛�
+                    if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜淇濆瓨锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
                     //寰楀埌鐭唬鐮�
                     string sShortNumber;
                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
@@ -4648,7 +4826,7 @@
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
                 if (oBill.oModel.HItemID == 0)
-                {                    
+                {
                     bResult = oBill.AddNew(ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 else
@@ -4660,7 +4838,6 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -4735,16 +4912,23 @@
                     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;
-                //}
+
+                if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 //鍒犻櫎鍓嶆帶鍒�=========================================      
                 string sql1 = "exec h_p_Gy_BadResult_BeforeDelCtrl " + HItemID + ",'" + user + "'";
@@ -4797,7 +4981,7 @@
                     return objJsonResult;
                 }
                 //================================================================================== 
-               
+
                 oCN.Commit();//鎻愪氦浜嬪姟
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
@@ -5043,7 +5227,7 @@
 
                     if (ds.Tables[0].Rows.Count == 0)
                     {
-                        oCN.RunProc("Insert into Gy_BadResult"  +
+                        oCN.RunProc("Insert into Gy_BadResult" +
                         " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                         ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HISsystemSet,HCREATEORGID,HERPItemID) " +
                         " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + sShortNumber + "'," + 0 +
@@ -5162,7 +5346,7 @@
                     }
                     //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
 
-                    ds = oCN.RunProcReturn("select * from  Gy_InspectValue where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_InspectValue");
+                    ds = oCN.RunProcReturn("select * from  Gy_InspectValue where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID='" + oItem.HUSEORGID + "'", "Gy_InspectValue");
                     if (oItem.HNumber.Trim() == "")
                     {
                         objJsonResult.code = "0";
@@ -5182,7 +5366,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -5234,6 +5418,14 @@
                             }
                         }
                     }
+                    if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佸凡瀹℃牳涓嶅厑璁镐慨鏀癸紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
                     //寰楀埌鐭唬鐮�
                     string sShortNumber;
                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
@@ -5259,7 +5451,6 @@
                 string sExeReturnInfo = "";
                 if (oBill.oModel.HItemID == 0)
                 {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     bResult = oBill.AddNew(ref sExeReturnInfo);
                 }
                 else
@@ -5271,7 +5462,6 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -5347,16 +5537,22 @@
                     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;
-                //}
+                if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍩虹璧勬枡宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍩虹璧勬枡宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
 
                 //鍒犻櫎鍓嶆帶鍒�=========================================
@@ -5701,7 +5897,7 @@
                     }
                     //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
 
-                    ds = oCN.RunProcReturn("select * from  Gy_InspectMethod where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_InspectMethod");
+                    ds = oCN.RunProcReturn("select * from  Gy_InspectMethod where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID='" + oItem.HUSEORGID + "'", "Gy_InspectMethod");
                     if (oItem.HNumber.Trim() == "")
                     {
                         objJsonResult.code = "0";
@@ -5721,7 +5917,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -5773,6 +5969,14 @@
                             }
                         }
                     }
+                    if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佸凡瀹℃牳涓嶅厑璁镐慨鏀癸紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
                     //寰楀埌鐭唬鐮�
                     string sShortNumber;
                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
@@ -5797,7 +6001,6 @@
                 bool bResult;
                 if (oBill.oModel.HItemID == 0)
                 {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     bResult = oBill.AddNew();
                 }
                 else
@@ -5809,7 +6012,6 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -5885,16 +6087,22 @@
                     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;
-                //}
+                if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍩虹璧勬枡宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍩虹璧勬枡宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 oCN.RunProc("delete Gy_InspectMethod where HItemID=" + HItemID);
                 oCN.Commit();//鎻愪氦浜嬪姟
@@ -5990,7 +6198,7 @@
                     }
                     //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
 
-                    ds = oCN.RunProcReturn("select * from  Gy_QualityStd where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_QualityStd");
+                    ds = oCN.RunProcReturn("select * from  Gy_QualityStd where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID='" + oItem.HUSEORGID + "'", "Gy_QualityStd");
                     if (oItem.HNumber.Trim() == "")
                     {
                         objJsonResult.code = "0";
@@ -6010,7 +6218,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚岀粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -6061,6 +6269,16 @@
                                 return objJsonResult;
                             }
                         }
+                    }
+
+                    //宸插鏍镐笉鍏佽淇濆瓨
+                    if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佸凡瀹℃牳涓嶅厑璁镐慨鏀癸紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
                     }
                     //寰楀埌鐭唬鐮�
                     string sShortNumber;
@@ -6174,16 +6392,22 @@
                     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;
-                //}
+                if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍩虹璧勬枡宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍩虹璧勬枡宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 oCN.RunProc("delete Gy_QualityStd where HItemID=" + HItemID);
                 oCN.Commit();//鎻愪氦浜嬪姟
@@ -6279,7 +6503,7 @@
                     }
                     //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
 
-                    ds = oCN.RunProcReturn("select * from  Gy_InspectInstruMent where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_InspectInstruMent");
+                    ds = oCN.RunProcReturn("select * from  Gy_InspectInstruMent where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID='" + oItem.HUSEORGID + "'", "Gy_InspectInstruMent");
                     if (oItem.HNumber.Trim() == "")
                     {
                         objJsonResult.code = "0";
@@ -6299,7 +6523,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -6351,6 +6575,16 @@
                             }
                         }
                     }
+
+                    if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佸凡瀹℃牳涓嶅厑璁镐慨鏀癸紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+
                     //寰楀埌鐭唬鐮�
                     string sShortNumber;
                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
@@ -6376,7 +6610,6 @@
                 string sExeReturnInfo = "";
                 if (oBill.oModel.HItemID == 0)
                 {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     bResult = oBill.AddNew(ref sExeReturnInfo);
                 }
                 else
@@ -6388,7 +6621,6 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -6464,16 +6696,22 @@
                     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;
-                //}
+                if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍩虹璧勬枡宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍩虹璧勬枡宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 //鍒犻櫎鍓嶆帶鍒�=========================================
                 ds = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_InspectInstruMent_BeforeDelCtrl");
@@ -6799,7 +7037,7 @@
                     }
                     //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
 
-                    ds = oCN.RunProcReturn("select * from  Gy_InspectBasis where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_InspectBasis");
+                    ds = oCN.RunProcReturn("select * from  Gy_InspectBasis where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID='" + oItem.HUSEORGID + "'", "Gy_InspectBasis");
                     if (oItem.HNumber.Trim() == "")
                     {
                         objJsonResult.code = "0";
@@ -6819,7 +7057,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚岀粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -6871,6 +7109,14 @@
                             }
                         }
                     }
+                    if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佸凡瀹℃牳涓嶅厑璁镐慨鏀癸紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
                     //寰楀埌鐭唬鐮�
                     string sShortNumber;
                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
@@ -6895,7 +7141,7 @@
                 bool bResult;
                 if (oBill.oModel.HItemID == 0)
                 {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+
                     bResult = oBill.AddNew();
                 }
                 else
@@ -6907,7 +7153,6 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -6983,16 +7228,22 @@
                     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;
-                //}
+                if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍩虹璧勬枡宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍩虹璧勬枡宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 oCN.RunProc("delete Gy_InspectBasis where HItemID=" + HItemID);
                 oCN.Commit();//鎻愪氦浜嬪姟
@@ -7137,6 +7388,18 @@
                     }
                     else//缂栬緫鏃跺垽鏂�
                     {
+                        //宸插鏍镐笉鍏佽淇敼
+                        DataSet dss;
+                        dss = oCN.RunProcReturn("select * from Gy_PostSkill where HItemID=" + oItem.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 sParent;
                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
@@ -7237,7 +7500,7 @@
         [HttpGet]
         public object DeltetGy_PostSkill(string HItemID, string user)
         {
-            DataSet ds;           
+            DataSet ds;
             try
             {
                 //鍒犻櫎鏉冮檺
@@ -7321,7 +7584,7 @@
                     return objJsonResult;
                 }
                 //================================================================================== 
-                
+
                 oCN.Commit();//鎻愪氦浜嬪姟
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
@@ -7463,7 +7726,7 @@
                         }
                         string HORGid = ds.Tables[0].Rows[0]["HItemID"].ToString();
                         //鏌ヨ宀椾綅
-                        ds = oCN.RunProcReturn("select * from Gy_Post where  HNumber='" + HPostNumber + "' and Hname='" + HPostName + "' and HUSEORGID = "+ HORGid, "Gy_Post");
+                        ds = oCN.RunProcReturn("select * from Gy_Post where  HNumber='" + HPostNumber + "' and Hname='" + HPostName + "' and HUSEORGID = " + HORGid, "Gy_Post");
 
                         if (ds.Tables[0].Rows.Count == 0)
                         {
@@ -7767,6 +8030,18 @@
                     }
                     else//缂栬緫鏃跺垽鏂�
                     {
+                        //宸插鏍镐笉鍏佽淇敼
+                        DataSet dss;
+                        dss = oCN.RunProcReturn("select * from Gy_Post where HItemID=" + oItem.HItemID, "Gy_Post");
+                        //鍒ゆ柇鏄惁鍙紪杈�
+                        if (dss.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹姸鎬佸凡缁忓鏍革紝涓嶅厑璁镐慨鏀癸紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                         //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
                         string sParent;
                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
@@ -7952,7 +8227,7 @@
                 }
                 //================================================================================== 
 
-               
+
                 oCN.Commit();//鎻愪氦浜嬪姟
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
@@ -10431,11 +10706,11 @@
 
                     if (ds.Tables[0].Rows.Count == 0)
                     {
-                            oCN.RunProc("Insert into "  + "Gy_SupType " +
-                        " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
-                        ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID) " +
-                        " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + sShortNumber + "'," + 0 +
-                        "," + HLevel.ToString() + "," + HEndFlag + "," + 0 + ",'" + HRemark + "','" + DateTime.Now + "','" + HOrgID + "','" + "鏈娴�" + "','" + user + "','" + HOrgID + "')", ref DBUtility.ClsPub.sExeReturnInfo);
+                        oCN.RunProc("Insert into " + "Gy_SupType " +
+                    " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
+                    ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID) " +
+                    " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + sShortNumber + "'," + 0 +
+                    "," + HLevel.ToString() + "," + HEndFlag + "," + 0 + ",'" + HRemark + "','" + DateTime.Now + "','" + HOrgID + "','" + "鏈娴�" + "','" + user + "','" + HOrgID + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                     }
                     else
                     {
@@ -10773,7 +11048,7 @@
                 }
                 //================================================================================== 
 
-              
+
                 oCN.Commit();//鎻愪氦浜嬪姟
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
@@ -11809,7 +12084,7 @@
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
                 if (oBill.oModel.HItemID == 0)
-                {                   
+                {
                     bResult = oBill.AddNew();
                 }
                 else
@@ -11968,7 +12243,7 @@
                     return objJsonResult;
                 }
                 //================================================================================== 
-               
+
                 oCN.Commit();//鎻愪氦浜嬪姟
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
@@ -12911,10 +13186,10 @@
 
                     if (ds.Tables[0].Rows.Count == 0)
                     {
-                        oCN.RunProc("Insert into "  + "Gy_ErrMsgBackType " +
+                        oCN.RunProc("Insert into " + "Gy_ErrMsgBackType " +
                     " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                     ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID) " +
-                    " Values('" + HProcessNum + "','" + HProcessName + "','" +  "','" + sShortNumber + "'," + 0 +
+                    " Values('" + HProcessNum + "','" + HProcessName + "','" + "','" + sShortNumber + "'," + 0 +
                     "," + HLevel + "," + HEndFlag + "," + 0 + ",'" + HRemark + "','" + DateTime.Now + "','" + HOrgID + "','" + "鏈娴�" + "','" + user + "','" + HOrgID + "')");
                     }
                     else
@@ -13021,7 +13296,7 @@
                     }
                     //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
 
-                    ds = oCN.RunProcReturn("select * from  Gy_BadPhenomena where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_BadPhenomena");
+                    ds = oCN.RunProcReturn("select * from  Gy_BadPhenomena where  HNumber='" + oItem.HNumber.Trim() + "'  and HUSEORGID= '" + oItem.HUSEORGID + "' ", "Gy_BadPhenomena");
                     if (oItem.HNumber.Trim() == "")
                     {
                         objJsonResult.code = "0";
@@ -13030,6 +13305,7 @@
                         objJsonResult.data = 1;
                         return objJsonResult;
                     }
+
                     //鏂板鏃跺垽鏂�
                     if (oItem.HItemID == 0)
                     {
@@ -13041,7 +13317,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -13092,7 +13368,27 @@
                                 return objJsonResult;
                             }
                         }
+
+                        if (ds.Tables[0].Rows.Count > 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
                     }
+
+                    //宸插鏍哥殑涓嶅厑璁镐繚瀛�
+                    if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜淇濆瓨锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
                     //寰楀埌鐭唬鐮�
                     string sShortNumber;
                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
@@ -13117,19 +13413,17 @@
                 bool bResult;
                 if (oBill.oModel.HItemID == 0)
                 {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     bResult = oBill.AddNew(ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 else
                 {
-                    bResult = oBill.ModifyByID(oBill.oModel.HItemID,ref DBUtility.ClsPub.sExeReturnInfo);
+                    bResult = oBill.ModifyByID(oBill.oModel.HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 if (bResult)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -13278,7 +13572,7 @@
                 }
                 //================================================================================== 
 
-              
+
                 oCN.Commit();//鎻愪氦浜嬪姟
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
@@ -14516,7 +14810,7 @@
                     }
                     //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
 
-                    ds = oCN.RunProcReturn("select * from  Gy_PreventErrMould where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PreventErrMould");
+                    //ds = oCN.RunProcReturn("select * from  Gy_PreventErrMould where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PreventErrMould");
                     if (oItem.HNumber.Trim() == "")
                     {
                         objJsonResult.code = "0";
@@ -14525,21 +14819,32 @@
                         objJsonResult.data = 1;
                         return objJsonResult;
                     }
+                    //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
+                    ds = oCN.RunProcReturn("Select HItemID from Gy_PreventErrMould  Where HItemID<>" + oItem.HItemID + " and HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID=" + oItem.HUSEORGID, "Gy_PreventErrMould");
+
+                    if (ds.Tables[0].Rows.Count > 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
                     //鏂板鏃跺垽鏂�
                     if (oItem.HItemID == 0)
                     {
-                        if (ds == null || ds.Tables[0].Rows.Count == 0)
-                        {
+                        //if (ds == null || ds.Tables[0].Rows.Count == 0)
+                        //{
 
-                        }
-                        else
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
-                            objJsonResult.data = 1;
-                            return objJsonResult;
-                        }
+                        //}
+                        //else
+                        //{
+                        //    objJsonResult.code = "0";
+                        //    objJsonResult.count = 0;
+                        //    objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                        //    objJsonResult.data = 1;
+                        //    return objJsonResult;
+                        //}
                         //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
                         string sParent;
                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
@@ -14565,6 +14870,18 @@
                     }
                     else//缂栬緫鏃跺垽鏂�
                     {
+                        //宸插鏍镐笉鍏佽淇敼
+                        DataSet dss;
+                        dss = oCN.RunProcReturn("select * from Gy_PreventErrMould where HItemID=" + oItem.HItemID, "Gy_PreventErrMould");
+                        //鍒ゆ柇鏄惁鍙紪杈�
+                        if (dss.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹姸鎬佸凡缁忓鏍革紝涓嶅厑璁镐慨鏀癸紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                         //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
                         string sParent;
                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
@@ -14741,7 +15058,7 @@
                     return objJsonResult;
                 }
                 //================================================================================== 
-               
+
                 oCN.Commit();//鎻愪氦浜嬪姟
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
@@ -14984,7 +15301,7 @@
         [Route("DeltetGy_MaintainLev")]
         [HttpGet]
         public object DeltetGy_MaintainLev(string HItemID, string user)
-        {            
+        {
             try
             {
                 //鍒犻櫎鏉冮檺
@@ -15154,7 +15471,7 @@
                     }
                     //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
 
-                    ds = oCN.RunProcReturn("select * from  Gy_CheckNoteItem where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CheckNoteItem");
+                    //ds = oCN.RunProcReturn("select * from  Gy_CheckNoteItem where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CheckNoteItem");
                     if (oItem.HNumber.Trim() == "")
                     {
                         objJsonResult.code = "0";
@@ -15163,21 +15480,21 @@
                         objJsonResult.data = 1;
                         return objJsonResult;
                     }
+                    //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
+                    ds = oCN.RunProcReturn("Select HItemID from Gy_CheckNoteItem  Where HItemID<>" + oItem.HItemID + " and HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID=" + oItem.HUSEORGID, "Gy_CheckNoteItem");
+
+                    if (ds.Tables[0].Rows.Count > 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
                     //鏂板鏃跺垽鏂�
                     if (oItem.HItemID == 0)
                     {
-                        if (ds == null || ds.Tables[0].Rows.Count == 0)
-                        {
 
-                        }
-                        else
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
-                            objJsonResult.data = 1;
-                            return objJsonResult;
-                        }
                         //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
                         string sParent;
                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
@@ -15203,6 +15520,18 @@
                     }
                     else//缂栬緫鏃跺垽鏂�
                     {
+                        //宸插鏍镐笉鍏佽淇敼
+                        DataSet dss;
+                        dss = oCN.RunProcReturn("select * from Gy_CheckNoteItem where HItemID=" + oItem.HItemID, "Gy_CheckNoteItem");
+                        //鍒ゆ柇鏄惁鍙紪杈�
+                        if (dss.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹姸鎬佸凡缁忓鏍革紝涓嶅厑璁镐慨鏀癸紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                         //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
                         string sParent;
                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
@@ -15378,7 +15707,7 @@
                     return objJsonResult;
                 }
                 //================================================================================== 
-               
+
                 oCN.Commit();//鎻愪氦浜嬪姟
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
@@ -15626,7 +15955,7 @@
 
                     if (ds.Tables[0].Rows.Count == 0)
                     {
-                        oCN.RunProc("Insert into " + "Gy_CheckNoteItem" + 
+                        oCN.RunProc("Insert into " + "Gy_CheckNoteItem" +
                     " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                     ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID,HCheckPostID) " +
                     " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + 0 +
@@ -15637,7 +15966,7 @@
                     else
                     {
                         oCN.RunProc("Update " + "Gy_CheckNoteItem" + " set " +
-                        
+
                         "HName='" + HName + "'" +
                         ",HShortNumber='" + HShortNumber + "'" +
                         ",HHelpCode='" + HHelpCode + "'" +
@@ -15764,7 +16093,7 @@
                     // 瀹氫箟鏄熸湡鍑犵殑涓枃鏄犲皠鍏崇郴
                     Dictionary<DayOfWeek, string> chineseDayOfWeek = new Dictionary<DayOfWeek, string>
                     {
-                        { DayOfWeek.Sunday, "鏄熸湡鏃�" },                      
+                        { DayOfWeek.Sunday, "鏄熸湡鏃�" },
                         { DayOfWeek.Saturday, "鏄熸湡鍏�" }
                     };
 
@@ -15841,18 +16170,18 @@
 
             JObject msgObj = JObject.Parse(msg1);
             string HYear = msgObj["HYear"].ToString();
-            string HNumber1 = msgObj["HDeptNumber"].ToString()+'-' + msgObj["HOrgNumber"].ToString();
-            string HName1 = msgObj["HDeptName"].ToString()+'-'+msgObj["HOrgName"].ToString();
+            string HNumber1 = msgObj["HDeptNumber"].ToString() + '-' + msgObj["HOrgNumber"].ToString();
+            string HName1 = msgObj["HDeptName"].ToString() + '-' + msgObj["HOrgName"].ToString();
             string HOrgID = msgObj["HOrgID"].ToString();
-            string HDeptID = msgObj["HDeptID"].ToString();   
+            string HDeptID = msgObj["HDeptID"].ToString();
             bool HStopflag = bool.Parse(msgObj["HStopflag"].ToString());
-            string HRemark= msgObj["HRemark"].ToString();
-            string HUSEORGID= msgObj["HUSEORGID"].ToString();
-            string HHelpCode= msgObj["HHelpCode"].ToString();
+            string HRemark = msgObj["HRemark"].ToString();
+            string HUSEORGID = msgObj["HUSEORGID"].ToString();
+            string HHelpCode = msgObj["HHelpCode"].ToString();
             string HMakeEmp = msg2; //鍒涘缓浜�
             bool Sunday = Convert.ToBoolean(msgObj["Sunday"]);
             bool Saturday = Convert.ToBoolean(msgObj["Saturday"]);
-            List<Tuple<DateTime, string>> sundaysInYear = GetSundaysInYear(Convert.ToInt32(HYear),  Sunday,  Saturday);
+            List<Tuple<DateTime, string>> sundaysInYear = GetSundaysInYear(Convert.ToInt32(HYear), Sunday, Saturday);
 
             foreach (var oItem in sundaysInYear)
             {
@@ -15873,11 +16202,11 @@
                 string HNumber = "";
                 string HName = "";
                 HNumber = HNumber1 + '-' + HDate;
-              
-                 HName = HName1 + '-' + HDate;
+
+                HName = HName1 + '-' + HDate;
                 //鍏堟煡鐪嬫暟鎹簱鏈夋病鏈�
                 ds = oCN.RunProcReturn("select * from Gy_RestDay where HRestDay='" + HRestDay + "' and HOrgID='" + HOrgID + "' and HDeptID='" + HDeptID + "'", "Gy_RestDay");
-                if (ds.Tables[0].Rows.Count<1)
+                if (ds.Tables[0].Rows.Count < 1)
                 {
                     oCN.RunProc("Insert into Gy_RestDay " +
                    " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
@@ -15886,7 +16215,7 @@
                    " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "',''," + 0 +
                    "," + 0 + "," + 0 + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "','" + DateTime.Now + "','" + HUSEORGID + "',' 鏈娴�','" + HMakeEmp + "','" + HUSEORGID + "'" +
                    ",'" + HOrgID.ToString() + "','" + HDeptID.ToString() + "','" + HRestDay.ToString() + "','" + HWeekDay.ToString() + "')");
-                }                
+                }
             }
             objJsonResult.code = "0";
             objJsonResult.count = 1;
@@ -15972,7 +16301,7 @@
         }
 
         //鑾峰彇涓�骞翠腑鐨勫懆鍏�,鍛ㄦ棩鎴栬�呬袱涓悓鏃惰幏鍙�
-        public List<Tuple<DateTime, string>> GetSundaysInYear(int HYear, bool Sunday,bool Saturday)
+        public List<Tuple<DateTime, string>> GetSundaysInYear(int HYear, bool Sunday, bool Saturday)
         {
             List<Tuple<DateTime, string>> Days = new List<Tuple<DateTime, string>>();
             DateTime startDate = new DateTime(HYear, 1, 1);
@@ -16012,16 +16341,16 @@
                         {
                             weekdayChinese = "鏄熸湡澶�";
                             Days.Add(Tuple.Create(startDate, weekdayChinese));
-                        }                       
+                        }
                         else if (startDate.DayOfWeek == DayOfWeek.Saturday)
                         {
                             weekdayChinese = "鏄熸湡鍏�";
                             Days.Add(Tuple.Create(startDate, weekdayChinese));
-                        }                       
+                        }
                     }
                     startDate = startDate.AddDays(1);
                 }
-            }                     
+            }
             return Days;
         }
 
@@ -16833,7 +17162,7 @@
                     }
                     //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
 
-                    ds = oCN.RunProcReturn("select * from  Gy_EnvironmentTestItem where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_EnvironmentTestItem");
+                    ds = oCN.RunProcReturn("select * from  Gy_EnvironmentTestItem where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID='" + oItem.HUSEORGID + "'", "Gy_EnvironmentTestItem");
                     if (oItem.HNumber.Trim() == "")
                     {
                         objJsonResult.code = "0";
@@ -16853,7 +17182,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚岀粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -16905,6 +17234,16 @@
                             }
                         }
                     }
+                    //宸插鏍镐笉鍏佽淇敼
+                    if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佸凡瀹℃牳涓嶅厑璁镐慨鏀癸紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+
                     //寰楀埌鐭唬鐮�
                     string sShortNumber;
                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
@@ -17014,6 +17353,24 @@
                     objJsonResult.data = null;
                     return objJsonResult; ;
                 }
+
+                if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍩虹璧勬枡宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍩虹璧勬枡宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 //鍒犻櫎鍓嶆帶鍒�=========================================      
                 string sql1 = "exec h_p_Gy_EnvironmentTestItem_BeforeDelCtrl " + HItemID + ",'" + user + "'";
                 ds = oCN.RunProcReturn(sql1, "h_p_Gy_EnvironmentTestItem_BeforeDelCtrl");
@@ -17065,7 +17422,7 @@
                     return objJsonResult;
                 }
                 //================================================================================== 
-               
+
                 oCN.Commit();//鎻愪氦浜嬪姟
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
@@ -17791,6 +18148,193 @@
         }
         #endregion
 
+        #region  璁惧鑺傛媿缁存姢  璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
+        /// <summary>
+        ///  椤圭洰璐圭敤鍒嗙被 淇濆瓨
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("SaveSb_EqiupMaterWorkTime")]
+        [HttpPost]
+        public object SaveSb_EqiupMaterWorkTime([FromBody] JObject msg)
+        {
+            DataSet ds;
+            var _value = msg["msg"].ToString();
+            string msg3 = _value.ToString();
+            string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg1 = sArray[0].ToString();
+            string msg2 = sArray[1].ToString();
+
+
+            Int64 HItemID = 0;
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            //鑾峰彇鏈�澶D鍊艰祴鍊�
+            DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from EqiupMaterWorkTimes ", "EqiupMaterWorkTimes");
+            if (Maxds != null || Maxds.Tables[0].Rows.Count > 0)
+            {
+                //HItemID= Maxds.Tables[0].Rows[0]["HItemID"]
+                var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]);
+                maxid += 1;
+                HItemID = maxid;
+            }
+            ListModels oListModels = new ListModels();
+            try
+            {
+                //淇濆瓨鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("EqiupMaterWorkTimes_Edit", 1, false, msg2))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                WebAPI.DLL.ClsEqiupMaterWorkTimes_Ctl oBill = new WebAPI.DLL.ClsEqiupMaterWorkTimes_Ctl();
+                List<Model.ClsEqiupMaterWorkTimes_Model> lsmain = new List<Model.ClsEqiupMaterWorkTimes_Model>();
+                msg1 = msg1.Replace("\\", "");
+                msg1 = msg1.Replace("\n", "");
+                lsmain = oListModels.getObjectByJson_EqiupMaterWorkTimes(msg1);
+                foreach (ClsEqiupMaterWorkTimes_Model item in lsmain)
+                {
+                    oBill.oModel = item;
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (oBill.oModel.HItemID == 0)
+                {
+                    bResult = oBill.AddNew();
+                }
+                else
+                {
+                    bResult = oBill.ModifyByID(oBill.oModel.HItemID);
+                }
+                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;
+            }
+        }
+
+        /// <summary>
+        /// 璁惧鑺傛媿缁存姢 鑾峰彇淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        [Route("GetEqiupMaterWorkTimeDetail")]
+        [HttpGet]
+        public ApiResult<DataSet> GetEqiupMaterWorkTimeDetail(string HID)
+        {
+            var model = LuBaoSevice.GetEqiupMaterWorkTimeDetail(HID);
+            return model;
+        }
+
+        /// <summary>
+        /// 璁惧鑺傛媿缁存姢 鍒犻櫎鍔熻兘
+        /// </summary>
+        /// <returns></returns>
+        [Route("DeltetEqiupMaterWorkTime")]
+        [HttpGet]
+        public object DeltetEqiupMaterWorkTime(string HItemID, string user)
+        {
+            DataSet ds;
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("EqiupMaterWorkTimes_Delete", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (string.IsNullOrWhiteSpace(HItemID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HItemID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                ds = oCN.RunProcReturn("select * from EqiupMaterWorkTimes where HItemID=" + HItemID, "EqiupMaterWorkTimes");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                oCN.RunProc("delete from EqiupMaterWorkTimes where HItemID=" + HItemID);
+
+
+                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
+
 
         /// <summary>
         /// 鐢ㄥ叧鑱斿伐搴忚幏鍙栦俊鎭�
@@ -18063,7 +18607,7 @@
                 ClsCN oCn = new ClsCN();
                 DataSet oDs = new DataSet();
                 //==========
-                oDs = oCn.RunProcReturn("select HItemID ID,Hname Name,HStopflag Stopflag from Xt_ORGANIZATIONS", "Xt_ORGANIZATIONS");
+                oDs = oCn.RunProcReturn("select HItemID ID,Hname Name,HStopflag Stopflag from Xt_ORGANIZATIONS with(nolock)", "Xt_ORGANIZATIONS");
                 objjson.code = "1";
                 objjson.count = 1;
                 objjson.Message = "鑾峰彇鎴愬姛锛�";
@@ -18109,7 +18653,7 @@
                     objjson.data = ds.Tables[0];
                     return objjson;
                 }
-            }catch(Exception e)
+            } catch (Exception e)
             {
                 objjson.code = "0";
                 objjson.count = 0;
@@ -18683,6 +19227,60 @@
         }
 
         /// <summary>
+        /// 鏍规嵁妯″叿浠撳簱缂栧彿鑾峰彇妯″叿鏁版嵁
+        /// </summary>
+        /// <param name="sWhere">绛涢�夋潯浠�</param>
+        /// <param name="user">鎿嶄綔鐢ㄦ埛</param>
+        /// <param name="Organization">缁勭粐</param>
+        /// <returns>妯″叿鏁版嵁娓呭崟</returns>
+        [Route("Web/Get_Sc_MouldStatusAnalysisList")]
+        [HttpGet]
+        public object Get_Sc_MouldStatusAnalysisList(string sWhere, string user, string Organization)
+        {
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("Select * from h_v_Sc_MouldStatusAnalysisList where 1=1 Order by HInterID DESC", "h_v_Sc_MouldStatusAnalysisList");
+                }
+                else
+                {
+                    string sql1 = "Select * from h_v_Sc_MouldStatusAnalysisList where 1=1  ";
+                    string sql = sql1 + sWhere + " Order by HInterID DESC";
+                    ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldStatusAnalysisList");
+                }
+
+
+                if (ds == null || ds.Tables[0].Rows.Count <= 0)
+                {
+                    objjson.code = "0";
+                    objjson.count = 0;
+                    objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo;
+                    objjson.data = null;
+                    return objjson;
+                }
+                else
+                {
+                    objjson.code = "0";
+                    objjson.count = 1;
+                    objjson.Message = "鑾峰彇鎴愬姛!";
+                    objjson.data = ds.Tables[0];
+                    return objjson;
+                }
+            }
+            catch (Exception ex)
+            {
+
+                objjson.code = "0";
+                objjson.count = 0;
+                objjson.Message = "鑾峰彇澶辫触" + ex.ToString();
+                objjson.data = null;
+                return objjson;
+            }
+        }
+
+        /// <summary>
         /// 鑾峰彇鍣ㄥ叿鍒楄〃
         /// </summary>
         /// <returns></returns>
@@ -18793,6 +19391,51 @@
 
 
 
+        }
+
+        /// <summary>
+        /// 鑾峰彇宸℃椤圭洰鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        [Route("Web/GetPatrolCheckItemList_Json")]
+        [HttpGet]
+        public object GetPatrolCheckItemList_Json(string CheckItem)
+        {
+            DataSet ds;
+            try
+            {
+                sWhere = " Where HStopFlag=0 and HEndFlag=1";
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (CheckItem != "" && CheckItem != null)
+                {
+                    sWhere = sWhere + " and ( HNumber like '%" + CheckItem + "%' or HName like '%" + CheckItem + "%' ) ";
+                }
+                ds = oCN.RunProcReturn("Select HItemID,HNumber,HName  from Gy_PatrolCheck " + sWhere + " Order by HItemID ", "Gy_DotCheck");
+                if (ds == null)
+                {
+                    objjson.code = "0";
+                    objjson.count = 0;
+                    objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo;
+                    objjson.data = null;
+                    return objjson;
+                }
+                else
+                {
+                    objjson.code = "1";
+                    objjson.count = 1;
+                    objjson.Message = "鑾峰彇鎴愬姛";
+                    objjson.data = ds.Tables[0];
+                    return objjson;
+                }
+            }
+            catch (Exception ex)
+            {
+                objjson.code = "0";
+                objjson.count = 0;
+                objjson.Message = "鑾峰彇澶辫触" + ex.ToString();
+                objjson.data = null;
+                return objjson;
+            }
         }
 
         /// <summary>
@@ -19007,23 +19650,19 @@
         /// <returns></returns>
         [Route("Web/GetSc_ProcessExchangeBillListView")]
         [HttpGet]
-        public object GetSc_ProcessExchangeBillListView(string ICMOBill, int OrganizationID)
+        public object GetSc_ProcessExchangeBillListView(string sWhere, int OrganizationID)
         {
-            if (ICMOBill != "" & ICMOBill != null)
-            {
-                sWhere = " where 1=1 and 鍗曟嵁鍙� like '%" + ICMOBill + "%' ";
-            }
             try
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select top 500 * from h_v_Sc_ProcessExchangeBillList where 1=1  order by 鍗曟嵁鍙� desc,hsubid", "h_v_Sc_ProcessExchangeBillList");
+                    ds = oCN.RunProcReturn("select top 300 * from h_v_Sc_ProcessExchangeBillList_PDA where 1=1  order by 鍗曟嵁鍙� desc,hsubid", "h_v_Sc_ProcessExchangeBillList_PDA");
                 }
                 else
                 {
-                    string sql = "select * from h_v_Sc_ProcessExchangeBillList " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid ";
-                    ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessExchangeBillList");
+                    string sql = "select * from h_v_Sc_ProcessExchangeBillList_PDA  where 1=1 " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid ";
+                    ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessExchangeBillList_PDA");
                 }
                 if (ds == null || ds.Tables[0].Rows.Count <= 0)
                 {
@@ -19322,12 +19961,12 @@
         /// <returns></returns>
         [Route("Web/GetCheckItemID")]
         [HttpGet]
-        public object GetCheckItemID(string HName,string HProName,string HSourceID)
-        {         
+        public object GetCheckItemID(string HName, string HProName, string HSourceID)
+        {
             try
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                ds = oCN.RunProcReturn("select  top 1 * from h_v_Gy_QCCheckProjectList_Main where 鐗╂枡鍚嶇О='"+HName+ "' and 宸ュ簭鍚嶇О='" + HProName + "' and HSourceID='" + HSourceID + "'   order by 鏃ユ湡 desc ", "h_v_Gy_QCCheckProjectList_Main");
+                ds = oCN.RunProcReturn("select  top 1 * from h_v_Gy_QCCheckProjectList_Main where 鐗╂枡鍚嶇О='" + HName + "' and 宸ュ簭鍚嶇О='" + HProName + "' and HSourceID='" + HSourceID + "'   order by 鏃ユ湡 desc ", "h_v_Gy_QCCheckProjectList_Main");
                 if (ds == null || ds.Tables[0].Rows.Count <= 0)
                 {
                     ds = oCN.RunProcReturn("select  top 1 * from h_v_Gy_QCCheckProjectList_Main where 鐗╂枡鍚嶇О='" + HName + "' and 宸ュ簭鍚嶇О ='" + HProName + "'  order by 鏃ユ湡 desc ", "h_v_Gy_QCCheckProjectList_Main");
@@ -19336,7 +19975,7 @@
                 {
                     objjson.code = "0";
                     objjson.count = 0;
-                    objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo;
+                    objjson.Message = "鑾峰彇澶辫触,鏈缃粯璁ゆ楠屾柟妗�";
                     objjson.data = null;
                     return objjson;
                 }
@@ -19896,7 +20535,7 @@
                 {
                     objjson.code = "0";
                     objjson.count = 0;
-                    objjson.Message = "鑾峰彇澶辫触,鏌ユ棤鏁版嵁" + DBUtility.ClsPub.sErrInfo;
+                    objjson.Message = "鑾峰彇澶辫触,鏄庣粏鏌ユ棤鏁版嵁";
                     objjson.data = null;
                     return objjson;
                 }
@@ -20006,6 +20645,9 @@
                         break;
                     case "QD":
                         HView = "h_v_Sb_EquipRepairSignBillList";
+                        break;
+                    case "XJ":
+                        HView = "h_v_Sb_EquipPatrolCheckBillList";
                         break;
                     default:
                         objjson.code = "0";
@@ -20454,6 +21096,79 @@
                 return objjson; ;
             }
         }
+        #region [浠庢暟鎹簱鍔犺浇鑿滃崟 APP]
+
+        //public class AppMenuLoad {
+        //    public string HitemID { get; set; } // 涓婚敭
+        //    public string HPartentID { get; set; } = "0"; // 鐖惰妭鐐笽D
+        //    public string HEntryID { get; set; } // 鑿滃崟鑺傜偣id
+        //    public string HIndex { get; set; }
+        //    public string HName { get; set; }
+        //    public string HMenuName { get; set; }
+        //    public string HPicNum { get; set; }
+        //    public string HShowMode { get; set; }
+        //    public string HTranslationText_English { get; set; }
+        //    public string HTranslationText_Spain { get; set; }
+        //    public string HMaker { get; set; }
+        //    public List<MenuLoad> childMenus { get; set; }
+        //}
+        //[Route("Web/MenuList_APP")]
+        //[HttpGet]
+        //public object MenuList_APP()
+        //{
+        //    return null;
+        //}
+
+        //[Route("Web/SetMenuList_APP")]
+        //[HttpPost]
+        //public object SetMenuList_APP([FromBody] JObject oMain)
+        //{
+        //    var _value = oMain["oMain"].ToString();
+        //    string msg1 = _value.ToString();
+        //    string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+        //    try
+        //    {
+        //        string msg2 = sArray[0];
+        //        string user = sArray[1].ToString();
+        //        string MenuName = sArray[2].ToString();
+        //        string type = sArray[3].ToString();
+
+        //        if(String.Equals(type, "APP", StringComparison.InvariantCultureIgnoreCase))
+        //        {
+        //            List<AppMenuLoad> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<AppMenuLoad>>(msg2);
+        //            string sql2 = "";
+
+        //            foreach (AppMenuLoad one in list)
+        //            {
+        //                StringBuilder sqlFragment = new StringBuilder();
+        //                sqlFragment.Append("insert into Gy_MenuDefineSet(");
+        //                var oneType = one.GetType();
+        //            }
+
+
+        //            return null;
+        //        }
+        //        else
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "鏆備笉鏀寔璇ュ钩鍙拌缃嚜瀹氫箟鑿滃崟锛�";
+        //            objJsonResult.data = null;
+        //            return objJsonResult;
+        //        }
+
+        //    }
+        //    catch(Exception e)
+        //    {
+        //        objJsonResult.code = "0";
+        //        objJsonResult.count = 0;
+        //        objJsonResult.Message = e.ToString();
+        //        objJsonResult.data = null;
+        //        return objJsonResult;
+        //    }
+        //}
+        #endregion
+
 
         #region [浠庢暟鎹簱鍔犺浇鑿滃崟]
         public class MenuLoad
@@ -20491,8 +21206,14 @@
                     ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet");        //鏌ヨ鐢ㄦ埛缁戝畾鐨勮鑹� 鏄惁璁剧疆鑿滃崟淇℃伅 鍙栬鑹插悕绉版渶鐭殑涓�涓�
                     if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0))
                     {
-                        sql = "Select HitemID,HNumber,HName,HPartentID,HLevel,Hurl,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain,HPicNum from Gy_Menu_1 where HType = '" + HType + "' Order by HPosition,len(HitemID),HitemID  ";
-                        ds = oCn.RunProcReturn(sql, "Gy_Menu_1");
+                        sql1 = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain  from Gy_MenuDefineSet where HMakeName = 'admin' and HType = '" + HType + "' order by HPosition";
+                        ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet");   //鏌ヨadmin 鏄惁璁剧疆鑿滃崟淇℃伅
+                        if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0))
+                        {
+                            sql = "Select HitemID,HNumber,HName,HPartentID,HLevel,Hurl,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain,HPicNum from Gy_Menu_1 where HType = '" + HType + "' Order by HPosition,len(HitemID),HitemID  ";
+                            ds = oCn.RunProcReturn(sql, "Gy_Menu_1");
+                        }
+                            
                     }                 
                 }
 
@@ -20687,6 +21408,51 @@
                 return objJsonResult;
             }
         }
+
+        //鑾峰彇鎵�鏈夋ā鍧楅〉闈�
+        [Route("Web/ModePageList")]
+        [HttpGet]
+        public object ModePageList(string HMakeName, string HType)
+        {
+            try
+            {
+               
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+
+
+                string sql = "select *  from Gy_MenuDefineSet where HMakeName = '" + HMakeName + "' and HType = '" + HType + "' and isnull(Hurl,'')  like'%html%' order by HPosition";
+                ds = oCn.RunProcReturn(sql, "Gy_MenuDefineSet");        //鏌ヨ褰撳墠鐢ㄦ埛鐨勮嚜瀹氫箟鑿滃崟鏁版嵁
+                if (ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0) //鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁鏈夎缃繃鑷畾涔変俊鎭紝鑻ヨ褰曟暟涓�0锛屽垯娌℃湁璁剧疆杩囷紝鍔犺浇鎵�鏈夌殑鑿滃崟淇℃伅
+                {
+                    string sql1 = "select * from Gy_MenuDefineSet  where HMakeName=" +
+                        "(select   top 1 c.GroupName  from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId  " +
+                        "left join System_UserGroup c on b.GroupId = c.GroupID  where a.Czymc ='" + HMakeName + "' order by len(c.GroupName )) and isnull(Hurl,'')  like'%html%'";
+                    ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet");        //鏌ヨ鐢ㄦ埛缁戝畾鐨勮鑹� 鏄惁璁剧疆鑿滃崟淇℃伅 鍙栬鑹插悕绉版渶鐭殑涓�涓�
+                    if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0))
+                    {
+                        sql = "Select * from h_v_Gy_Menu_1   Order by HPosition,len(HitemID),HitemID  ";
+                        ds = oCn.RunProcReturn(sql, "Gy_Menu_1");
+                    }
+                }
+
+
+                //ds = oCn.RunProcReturn("Select * from Gy_Menu_1 where isnull(Hurl,'')  like'%html%'  Order by HItemID ", "Gy_Menu_1");     //鑾峰彇Gy_Menu_1涓殑鎵�鏈夎彍鍗曚俊鎭紝鐢ㄤ簬涓簃enuInitList鍒楄〃鍏�
+
+                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 = "鏌ヨ澶辫触锛�";
+                objJsonResult.data = e.ToString();
+                return objJsonResult;
+            }
+        }
         #endregion
 
         #region 淇濆瓨鑷畾涔夋暟鎹�
@@ -20786,7 +21552,7 @@
         //蹇嵎鏂瑰紡鑷畾涔夎彍鍗曪細鑾峰彇鏍戠粍浠舵暟鎹�
         [Route("Web/Xt_UserFastMenu_Display")]
         [HttpGet]
-        public object Xt_UserFastMenu_Display(string HMakeName, string HType)
+        public object Xt_UserFastMenu_Display(string HMakeName, string HType,string HModelAtributos)
         {
             try
             {
@@ -20811,7 +21577,7 @@
                     menuInit.HSelected = false;
 
                     //鍒ゆ柇鐢ㄦ埛鏄惁閫変腑鏄剧ず璇ヨ彍鍗�
-                    String sql = "Select * from Xt_UserFastMenu where HSubFuncID = '" + ds.Tables[0].Rows[i]["HItemID"] + "' and HUserID='" + HMakeName + "'";
+                    String sql = "Select * from Xt_UserFastMenu where HSubFuncID = '" + ds.Tables[0].Rows[i]["HItemID"] + "' and HUserID='" + HMakeName + "' and HModelAtributos='" + HModelAtributos + "'";
                     ds1 = oCn.RunProcReturn(sql, "Xt_UserFastMenu");
                     if (ds1.Tables[0].Rows.Count > 0)                           //瀵逛簬Gy_Menu_1琛ㄤ腑鐨勮彍鍗曡妭鐐癸紝閫氳繃妫�绱㈠湪Gy_MenuDefineSet琛ㄤ腑瀵瑰簲鐢ㄦ埛鏄惁瀛樺湪璇ヨ妭鐐圭殑淇℃伅锛屽垽鏂鐢ㄦ埛鏄惁閫変腑璇ヨ妭鐐归渶瑕佸姞杞芥樉绀哄湪渚ц彍鍗曟爮
                     {
@@ -20879,6 +21645,7 @@
                 string HMakeName = sArray[1].ToString();
                 string saveData = sArray[0].ToString();
                 string HTypes = sArray[2].ToString();
+                string HModelAtributos = sArray[3].ToString();
                 List<SaveDefineMenu> saveDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SaveDefineMenu>>(saveData);
 
                 //澹版槑鏁版嵁搴撴搷浣滃伐鍏�
@@ -20888,7 +21655,7 @@
                 oCN.BeginTran();
 
                 //鍒犻櫎褰撳墠鐢ㄦ埛鐨勮嚜瀹氫箟鏁版嵁
-                string sql = "delete from Xt_UserFastMenu where HUserID = '" + HMakeName + "' and HType = '" + HTypes + "'";
+                string sql = "delete from Xt_UserFastMenu where HUserID = '" + HMakeName + "' and HType = '" + HTypes + "' and HModelAtributos = '" + HModelAtributos + "'";
                 oCN.RunProc(sql);
 
                 //鎻掑叆褰撳墠鐢ㄦ埛鏈�鏂扮殑鑷畾涔夋暟鎹�
@@ -20907,7 +21674,7 @@
                             string HCaption = ds.Tables[0].Rows[0]["HName"].ToString();
                             string HType = ds.Tables[0].Rows[0]["HType"].ToString();
 
-                            sql = "insert into Xt_UserFastMenu(HUserID,HSubFuncID,HCaption,HType) values('" + HUserID + "','" + HSubFuncID + "','" + HCaption + "','" + HType + "')";
+                            sql = "insert into Xt_UserFastMenu(HUserID,HSubFuncID,HCaption,HType,HModelAtributos) values('" + HUserID + "','" + HSubFuncID + "','" + HCaption + "','" + HType + "','"+ HModelAtributos + "')";
                             oCN.RunProc(sql);
                         }
                     }
@@ -20937,17 +21704,17 @@
         //蹇嵎鏂瑰紡鑷畾涔夎彍鍗曪細鑾峰彇鏍戠粍浠舵暟鎹�
         [Route("Web/Xt_UserFastMenu_Init")]
         [HttpGet]
-        public object Xt_UserFastMenu_Init(string HMakeName, string HType)
+        public object Xt_UserFastMenu_Init(string HMakeName, string HType,string HModelAtributos)
         {
             try
             {
                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
-                string sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Xt_UserFastMenu as a join Gy_Menu_1 as b on a.HSubFuncID = b.HItemID  where a.HUserID = '" + HMakeName + "' and b.HType = '" + HType + "' Order by a.HItemID";
+                string sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Xt_UserFastMenu as a join Gy_Menu_1 as b on a.HSubFuncID = b.HItemID  where a.HUserID = '" + HMakeName + "' and b.HType = '" + HType + "'  and a.HModelAtributos = '" + HModelAtributos + "' Order by a.HItemID";
                 ds = oCn.RunProcReturn(sql, "Xt_UserFastMenu");     //鑾峰彇Xt_UserFastMenu涓鐢ㄦ埛璁剧疆鐨勮嚜瀹氫箟鑿滃崟淇℃伅锛岀敤浜庡湪鍓嶇鍔犺浇
 
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
-                    sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Xt_UserFastMenu as a join Gy_Menu_1 as b on a.HSubFuncID = b.HItemID  where a.HUserID = 'admin' and b.HType = '" + HType + "' Order by a.HItemID";
+                    sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Xt_UserFastMenu as a join Gy_Menu_1 as b on a.HSubFuncID = b.HItemID  where a.HUserID = 'admin' and b.HType = '" + HType + "' and a.HModelAtributos = '" + HModelAtributos + "' Order by a.HItemID";
                     ds = oCn.RunProcReturn(sql, "Xt_UserFastMenu");     //鑾峰彇Xt_UserFastMenu涓鐢ㄦ埛璁剧疆鐨勮嚜瀹氫箟鑿滃崟淇℃伅锛岀敤浜庡湪鍓嶇鍔犺浇
                 }
 

--
Gitblit v1.9.1