From 56a9ece7e0394587d60f0ea78293c03b63db95d0 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期四, 07 八月 2025 13:07:24 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/WebAPIController.cs |  704 ++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 536 insertions(+), 168 deletions(-)

diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index f894687..ab5325f 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -343,6 +343,8 @@
         {
             try
             {
+                string sErrMsg = "";
+                oSystemParameter.ShowBill(ref sErrMsg);
                 DataSet ds = null;
                 ClsCN oCnLoc = new ClsCN();
                 DAL.ClsUser oUser = new DAL.ClsUser();
@@ -368,14 +370,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;
@@ -2684,7 +2690,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";
@@ -2692,7 +2698,7 @@
                         objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷负绌猴紒";
                         objJsonResult.data = 1;
                         return objJsonResult;
-                    }
+                    }                                 
                     //鏂板鏃跺垽鏂�
                     if (oItem.HItemID == 0)
                     {
@@ -2704,7 +2710,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -2755,6 +2761,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;
@@ -2865,18 +2888,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");
@@ -3360,7 +3387,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";
@@ -3368,7 +3395,7 @@
                         objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷负绌猴紒";
                         objJsonResult.data = 1;
                         return objJsonResult;
-                    }
+                    }                                    
                     //鏂板鏃跺垽鏂�
                     if (oItem.HItemID == 0)
                     {
@@ -3380,7 +3407,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -3431,7 +3458,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());
@@ -3510,8 +3556,7 @@
         [HttpGet]
         public object DeltetGy_BadType(string HItemID, string user)
         {
-            DataSet ds;
-            //string ModRightNameCheck = "Sc_ProcessReport_check";
+            DataSet ds;          
             try
             {
                 //鍒犻櫎鏉冮檺
@@ -3543,17 +3588,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");
@@ -4080,6 +4130,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());
@@ -4115,7 +4176,6 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -4650,7 +4710,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";
@@ -4659,6 +4719,7 @@
                         objJsonResult.data = 1;
                         return objJsonResult;
                     }
+
                     //鏂板鏃跺垽鏂�
                     if (oItem.HItemID == 0)
                     {
@@ -4670,7 +4731,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -4721,7 +4782,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());
@@ -4757,7 +4837,6 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -4832,16 +4911,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 + "'";
@@ -5259,7 +5345,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";
@@ -5279,7 +5365,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -5331,6 +5417,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());
@@ -5356,7 +5450,6 @@
                 string sExeReturnInfo = "";
                 if (oBill.oModel.HItemID == 0)
                 {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     bResult = oBill.AddNew(ref sExeReturnInfo);
                 }
                 else
@@ -5368,7 +5461,6 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -5444,16 +5536,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;
+                }
 
 
                 //鍒犻櫎鍓嶆帶鍒�=========================================
@@ -5798,7 +5896,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";
@@ -5818,7 +5916,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -5870,6 +5968,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());
@@ -5894,7 +6000,6 @@
                 bool bResult;
                 if (oBill.oModel.HItemID == 0)
                 {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     bResult = oBill.AddNew();
                 }
                 else
@@ -5906,7 +6011,6 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -5982,16 +6086,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();//鎻愪氦浜嬪姟
@@ -6087,7 +6197,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";
@@ -6107,7 +6217,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚岀粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -6159,6 +6269,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());
@@ -6176,7 +6296,7 @@
                     oItem.HMakeEmp = msg2; //鍒涘缓浜�
 
                     oBill.oModel = oItem;
-                }
+                }               
 
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
@@ -6271,16 +6391,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();//鎻愪氦浜嬪姟
@@ -6376,7 +6502,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";
@@ -6396,7 +6522,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -6448,6 +6574,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());
@@ -6473,7 +6609,6 @@
                 string sExeReturnInfo = "";
                 if (oBill.oModel.HItemID == 0)
                 {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     bResult = oBill.AddNew(ref sExeReturnInfo);
                 }
                 else
@@ -6485,7 +6620,6 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -6561,16 +6695,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");
@@ -6896,7 +7036,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";
@@ -6916,7 +7056,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚岀粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -6968,6 +7108,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());
@@ -6992,7 +7140,7 @@
                 bool bResult;
                 if (oBill.oModel.HItemID == 0)
                 {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                   
                     bResult = oBill.AddNew();
                 }
                 else
@@ -7004,7 +7152,6 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -7080,16 +7227,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();//鎻愪氦浜嬪姟
@@ -7234,6 +7387,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());
@@ -7864,6 +8029,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());
@@ -13118,7 +13295,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";
@@ -13127,6 +13304,7 @@
                         objJsonResult.data = 1;
                         return objJsonResult;
                     }
+                  
                     //鏂板鏃跺垽鏂�
                     if (oItem.HItemID == 0)
                     {
@@ -13138,7 +13316,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚屼娇鐢ㄧ粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -13189,7 +13367,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());
@@ -13214,7 +13412,6 @@
                 bool bResult;
                 if (oBill.oModel.HItemID == 0)
                 {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     bResult = oBill.AddNew(ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 else
@@ -13226,7 +13423,6 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
                     objJsonResult.data = 1;
                     return objJsonResult;
                 }
@@ -14613,7 +14809,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";
@@ -14622,21 +14818,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());
@@ -14662,6 +14869,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());
@@ -15251,7 +15470,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";
@@ -15260,21 +15479,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());
@@ -15300,6 +15519,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());
@@ -16930,7 +17161,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";
@@ -16950,7 +17181,7 @@
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佺浉鍚岀粍缁囦笅浠g爜涓嶈兘閲嶅锛�";
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
@@ -17002,6 +17233,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());
@@ -17111,6 +17352,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");
@@ -18347,7 +18606,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 = "鑾峰彇鎴愬姛锛�";
@@ -18967,6 +19226,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>
@@ -19343,12 +19656,12 @@
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select top 300 * 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  where 1=1 " + 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)
                 {
@@ -19661,7 +19974,7 @@
                 {
                     objjson.code = "0";
                     objjson.count = 0;
-                    objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo;
+                    objjson.Message = "鑾峰彇澶辫触,鏈缃粯璁ゆ楠屾柟妗�";
                     objjson.data = null;
                     return objjson;
                 }
@@ -20221,7 +20534,7 @@
                 {
                     objjson.code = "0";
                     objjson.count = 0;
-                    objjson.Message = "鑾峰彇澶辫触,鏌ユ棤鏁版嵁" + DBUtility.ClsPub.sErrInfo;
+                    objjson.Message = "鑾峰彇澶辫触,鏄庣粏鏌ユ棤鏁版嵁";
                     objjson.data = null;
                     return objjson;
                 }
@@ -20331,6 +20644,9 @@
                         break;
                     case "QD":
                         HView = "h_v_Sb_EquipRepairSignBillList";
+                        break;
+                    case "XJ":
+                        HView = "h_v_Sb_EquipPatrolCheckBillList";
                         break;
                     default:
                         objjson.code = "0";
@@ -20816,8 +21132,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");
+                        }
+                            
                     }                 
                 }
 
@@ -21012,6 +21334,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 淇濆瓨鑷畾涔夋暟鎹�
@@ -21111,7 +21478,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
             {
@@ -21136,7 +21503,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琛ㄤ腑瀵瑰簲鐢ㄦ埛鏄惁瀛樺湪璇ヨ妭鐐圭殑淇℃伅锛屽垽鏂鐢ㄦ埛鏄惁閫変腑璇ヨ妭鐐归渶瑕佸姞杞芥樉绀哄湪渚ц彍鍗曟爮
                     {
@@ -21204,6 +21571,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);
 
                 //澹版槑鏁版嵁搴撴搷浣滃伐鍏�
@@ -21213,7 +21581,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);
 
                 //鎻掑叆褰撳墠鐢ㄦ埛鏈�鏂扮殑鑷畾涔夋暟鎹�
@@ -21232,7 +21600,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);
                         }
                     }
@@ -21262,17 +21630,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