From f0f62ea833bfc14a427c9533bc45bce38014f3dd Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期一, 20 十一月 2023 11:17:46 +0800
Subject: [PATCH] 应收退库单:审核时增加信用控制,判断审核后客户余额是否为正,不为则审核失败

---
 WebAPI/Controllers/WebAPIController.cs | 1036 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 1,012 insertions(+), 24 deletions(-)

diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index b2c6c98..1455b61 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -342,6 +342,122 @@
         }
 
 
+        #region 鐢ㄦ埛璁剧疆
+        #region 鑾峰彇鐢ㄦ埛淇℃伅
+        [Route("Gy_USERSet_PDA/GetGy_Czygl_Info")]
+        [HttpGet]
+        public object GetGy_Czygl_Info(string Czybm, string user)
+        {
+            try
+            {
+                //鏌ョ湅鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log("Gy_ProjectStage_Query", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                string sql = @"select Czybm, Czymc, HWhID, HWhName, HSecManagerID, HSecManager, HKeeperID, HKeeper, HDeptID, HDept, HCloudUserName, HCloudUserPsd from Gy_Czygl where Czybm = '" + Czybm + "'";
+                ds = oCN.RunProcReturn(sql, "Gy_Czygl");
+
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈壘鍒扮浉鍏虫暟鎹紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+        #region 淇濆瓨鐢ㄦ埛淇℃伅
+        [Route("Gy_USERSet_PDA/SaveGy_Czygl_Info")]
+        [HttpPost]
+        public object SaveGy_Czygl_Info([FromBody] JObject sMainSub)
+        {
+            try
+            {
+                //鑾峰彇鍙傛暟
+                var _value = sMainSub["sMainSub"].ToString();
+                string msg1 = _value.ToString();
+                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+
+                Int64 HWhID = Int64.Parse(sArray[0].ToString());
+                string HWhName = sArray[1].ToString();
+                Int64 HSecManagerID = Int64.Parse(sArray[2].ToString());
+                string HSecManager = sArray[3].ToString();
+                Int64 HKeeperID = Int64.Parse(sArray[4].ToString());
+                string HKeeper = sArray[5].ToString();
+                Int64 HDeptID = Int64.Parse(sArray[6].ToString());
+                string HDept = sArray[7].ToString();
+                string HCloudUserName = sArray[8].ToString().Trim();
+                string HCloudUserPsd = sArray[9].ToString().Trim();
+
+                string Czybm = sArray[10].ToString();
+                string user = sArray[11].ToString();                     //鎿嶄綔鐢ㄦ埛鐨勭敤鎴峰悕
+
+                ////鍒ゆ柇鏄惁鏈夋柊澧炴潈闄�
+                //if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBillQualityStatus_Tmp_Edit", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳柊澧炴潈闄�!";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                string sql = "update Gy_Czygl set " + 
+                    "HWhID = " + HWhID + 
+                    ", HWhName = '" + HWhName +
+                    "', HSecManagerID = " + HSecManagerID +
+                    ", HSecManager = '" + HSecManager +
+                    "', HKeeperID = " + HKeeperID +
+                    ", HKeeper = '" + HKeeper +
+                    "', HDeptID = " + HDeptID +
+                    ", HDept = '" + HDept +
+                    "', HCloudUserName = '" + HCloudUserName +
+                    "', HCloudUserPsd = '" + HCloudUserPsd +
+                    "' where Czybm = '" + Czybm + "'";
+
+                oCN.RunProc(sql);
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+        #endregion
+
+
 
         //鎾ら攢缂撳瓨鍒楄〃璁板綍
         [Route("Web/Rescind_Json")]
@@ -1072,16 +1188,21 @@
         [HttpGet]
         public object GetSupplierList_Json(string Supplier, Int64 HOrgID)
         {
-            sWhere = " Where HStopFlag=0  and HEndFlag=1 and HUSEORGID =" + HOrgID + "";
+            sWhere = " Where HStopFlag=0 and HUSEORGID =" + HOrgID + "";
+            //sWhere = " Where HStopFlag=0  and HEndFlag=1 and HUSEORGID =" + HOrgID + "";
             //sWhere = " Where HStopFlag=0  and HEndFlag=1  and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
-            if (Supplier != "")
+            if (Supplier != "" && Supplier != null)
             {
                 sWhere = sWhere + " and ( HNumber like '%" + Supplier + "%' or HName like '%" + Supplier + "%' or HUSEORGID like '%" + HOrgID + "%' ) ";
+                //sWhere = sWhere + " and ( HNumber like '%" + Supplier + "%' or HName like '%" + Supplier + "%' or HUSEORGID like '%" + HOrgID + "%' ) ";
             }
             try
             {
-                WebS.WebService1 oWeb = new WebS.WebService1();
-                ds = oWeb.GetSupplierList(sWhere, ref DBUtility.ClsPub.sErrInfo);
+                string sql = "select HItemID,HNumber,HName from Gy_Supplier " + sWhere;
+                ds = oCN.RunProcReturn(sql, "Gy_Supplier");
+
+                //WebS.WebService1 oWeb = new WebS.WebService1();
+                //ds = oWeb.GetSupplierList(sWhere, ref DBUtility.ClsPub.sErrInfo);
                 //ds = webserver.GetSupplierList(sWhere, ref DBUtility.ClsPub.sErrInfo);
                 if (ds == null || ds.Tables[0].Rows.Count <= 0)
                 {
@@ -1635,7 +1756,8 @@
         [HttpGet]
         public object GetCustomerList_Json(string Customer)
         {
-            sWhere = " Where HStopFlag=0  and HEndFlag=1";
+            sWhere = " Where HStopFlag=0 ";
+            //sWhere = " Where HStopFlag=0  and HEndFlag=1";
             //sWhere = " Where HStopFlag=0  and HEndFlag=1  and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
             if (Customer != "")
             {
@@ -1673,6 +1795,48 @@
         }
 
         /// <summary>
+        /// 鑾峰彇瀹㈡埛鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        [Route("Web/GetCustomerList_Json_New1")]
+        [HttpGet]
+        public object GetCustomerList_Json_New1(string sWhere)
+        {
+            try
+            {
+                ds = webserver.GetCustomerList(sWhere, ref DBUtility.ClsPub.sErrInfo);
+                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>
         ///鍙傛暟锛歴tring sql銆�
@@ -1692,7 +1856,7 @@
             try
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                ds = oCN.RunProcReturn("Select p.HItemID,p.HNumber 宸ュ簭浠g爜,p.HName 宸ュ簭,w.HItemID 宸ヤ綔涓績ID,w.HNumber 宸ヤ綔涓績浠g爜,w.HName 宸ヤ綔涓績,d.HItemID 閮ㄩ棬ID,d.HNumber 閮ㄩ棬浠g爜,d.HName 閮ㄩ棬 from Gy_Process p left join Gy_WorkCenter w on p.HWorkCenterID = w.HItemID left join Gy_Department d on p.HDeptID = d.HItemID where p.HStopflag = 0 " + sWhere + " Order by HItemID ", "Gy_Process");
+                ds = oCN.RunProcReturn("Select p.HItemID,p.HNumber 宸ュ簭浠g爜,p.HName 宸ュ簭,w.HItemID 宸ヤ綔涓績ID,w.HNumber 宸ヤ綔涓績浠g爜,w.HName 宸ヤ綔涓績,d.HItemID 閮ㄩ棬ID,d.HNumber 閮ㄩ棬浠g爜,d.HName 閮ㄩ棬 from Gy_Process p left join Gy_WorkCenter w on p.HWorkCenterID = w.HItemID left join Gy_Department d on p.HDeptID = d.HItemID where p.HStopflag = 0 " + sWhere + " Order by p.HNumber ", "Gy_Process");
                 if (ds == null || ds.Tables[0].Rows.Count <= 0)
                 {
                     objjson.code = "0";
@@ -1720,6 +1884,57 @@
                 return objjson;
             }
         }
+
+        /// <summary>
+        /// 鑾峰彇閾惰鍒楄〃
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Web/GetBankList_Json")]
+        [HttpGet]
+        public object GetBankList_Json(string sWhere)
+        {
+            DataSet ds;
+            //sWhere = " Where HStopFlag=0  and HEndFlag=1";
+            //sWhere = " Where HStopFlag=0  and HEndFlag=1  and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
+            if (sWhere != "")
+            {
+                sWhere = " and ( HNumber like '%" + sWhere + "%' or HName like '%" + sWhere + "%' ) ";
+            }
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                string sql = "select HItemID,HNumber 閾惰浠g爜,HName 閾惰鍚嶇О,HStopflag from Gy_Bank where 1=1 " + sWhere;
+                ds = oCN.RunProcReturn(sql, "Gy_Bank");
+                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>
         /// 鑾峰彇鐗╂枡鍒楄〃
@@ -2166,6 +2381,295 @@
                 objJsonResult.count = 0;
                 objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
                 objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 淇濆瓨涓嶈壇绫诲瀷
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("SaveGy_BadType")]
+        [HttpPost]
+        public object SaveGy_BadType([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();
+
+            //鏌ョ湅鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log("Gy_BadType_Edit", 1, false, msg2))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+            Int64 HItemID = 0;
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            //鑾峰彇鏈�澶D鍊艰祴鍊�
+            DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_BadType ", "Gy_BadType");
+            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
+            {
+                DAL.ClsGy_BadType_Ctl oBill = new DAL.ClsGy_BadType_Ctl();
+                List<Model.ClsGy_BadType_Model> lsmain = new List<Model.ClsGy_BadType_Model>();
+                msg1 = msg1.Replace("\\", "");
+                msg1 = msg1.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_BadType(msg1);
+                foreach (Model.ClsGy_BadType_Model oItem in lsmain)
+                {
+                    if (oItem.HNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (oItem.HName.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim()))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
+
+                    ds = oCN.RunProcReturn("select * from  Gy_BadType where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_BadType");
+                    if (oItem.HNumber.Trim() == "")
+                    {
+                        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());
+                        if (sParent.Trim() == "")
+                        {
+                            oBill.oModel.HParentID = 0;
+                        }
+                        else
+                        {
+                            if (oBill.HavParentCode(sParent.Trim(), HItemID))
+                            {
+                                oBill.oModel.HParentID = oBill.oModel.HItemID;
+                            }
+                            else
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+                                objJsonResult.data = 1;
+                                return objJsonResult;
+                            }
+                        }
+                    }
+                    else//缂栬緫鏃跺垽鏂�
+                    {
+                        //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
+                        string sParent;
+                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
+                        if (sParent.Trim() == "")
+                        {
+                            oBill.oModel.HParentID = 0;
+                        }
+                        else
+                        {
+                            if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID))
+                            {
+                                oBill.oModel.HParentID = oBill.oModel.HItemID;
+                            }
+                            else
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+                                objJsonResult.data = 1;
+                                return objJsonResult;
+                            }
+                        }
+                    }
+                    //寰楀埌鐭唬鐮�
+                    string sShortNumber;
+                    sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
+                    if (sShortNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oItem.HShortNumber = sShortNumber;//鐭唬鐮�
+                    oItem.HEndFlag = true;//鏈骇鏍囧織
+                    oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //绛夌骇
+
+                    oBill.oModel = oItem;
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (oBill.oModel.HItemID == 0)
+                {
+                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    bResult = oBill.AddNew();
+                }
+                else
+                {
+                    bResult = oBill.ModifyByID(oBill.oModel.HItemID);
+                }
+                if (bResult)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                    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("GetGy_BadTypeDetail")]
+        [HttpGet]
+        public ApiResult<DataSet> GetGy_BadTypeDetail(string HID)
+        {
+            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_gy_BadTypeList  where HItemID= " + HID + " ", "h_v_gy_BadTypeList");
+            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
+                return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄤ笉鑹被鍨嬫暟鎹�" };
+            return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
+        }
+
+        /// <summary>
+        /// 涓嶈壇绫诲瀷鍒犻櫎鍔熻兘
+        /// </summary>
+        /// <returns></returns>
+        [Route("DeltetGy_BadType")]
+        [HttpGet]
+        public object DeltetGy_BadType(string HItemID, string user)
+        {
+            DataSet ds;
+            //string ModRightNameCheck = "Sc_ProcessReport_check";
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_BadType_Drop", 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 Gy_BadType where HItemID=" + HItemID, "Gy_BadType");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒";
+                    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;
+                //}
+
+                oCN.RunProc("delete Gy_BadType 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;
             }
         }
@@ -2663,7 +3167,7 @@
             try
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                string sql = "Select a.HItemID ,HNumber 鏍哥畻鏂瑰紡缁勪唬鐮�,HName 鏍哥畻鏂瑰紡缁勫悕绉�,HDeptID,b.閮ㄩ棬鍚嶇О 閮ㄩ棬 from Gy_ClassTimePrjGroup a left join h_v_Gy_Department b on a.HDeptID=b.HItemID";
+                string sql = "Select a.HItemID ,HNumber 鏍哥畻鏂瑰紡缁勪唬鐮�,HName 鏍哥畻鏂瑰紡缁勫悕绉�,HDeptID,b.閮ㄩ棬浠g爜,b.閮ㄩ棬鍚嶇О 閮ㄩ棬 from Gy_ClassTimePrjGroup a left join h_v_Gy_Department b on a.HDeptID=b.HItemID";
                 if (sWhere == null || sWhere.Equals(""))
                 {
                     ds = oCN.RunProcReturn(sql, "Gy_ClassTimePrjGroup");
@@ -3232,6 +3736,59 @@
         }
 
         /// <summary>
+        /// 鑾峰彇褰撳墠鐢熶骇璧勬簮涓嬪凡缁忓紑宸ョ殑鐢熶骇浠诲姟鍗曞垪琛�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Web/GetSc_ICMOBillListView3")]
+        [HttpGet]
+        public object GetSc_ICMOBillListView3(string ICMOBill, int OrganizationID,int HSourceID)
+        {
+            if (ICMOBill != "")
+            {
+                sWhere = " where 1=1 and (鍗曟嵁鍙� like '%" + ICMOBill + "%' or 浜у搧浠g爜 like '%" + ICMOBill + "%' or 浜у搧鍚嶇О like '%" + ICMOBill + "%' or 瑙勬牸鍨嬪彿 like '%" + ICMOBill + "%' )";
+            }
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where 1=1 and isnull(瀹℃牳浜�,'')<>'' and isnull(鍏抽棴浜�,'')='' and isnull(琛屽叧闂汉,'')=''  and 鐘舵�� = '寮�宸�' and HSourceID_b = " + HSourceID + " order by 鍗曟嵁鍙�,hsubid ", "h_v_IF_ICMOBillList");
+                }
+                else
+                {
+                    string sql = "select * from h_v_IF_ICMOBillList " + sWhere + " and isnull(瀹℃牳浜�,'')<>'' and isnull(鍏抽棴浜�,'')='' and isnull(琛屽叧闂汉,'')='' " +
+                        "and 鐘舵�� = '寮�宸�' and HSourceID_b = " + HSourceID + " order by 鍗曟嵁鍙�,hsubid ";
+                    ds = oCN.RunProcReturn(sql, "h_v_IF_ICMOBillList");
+                }
+                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>
@@ -3379,12 +3936,180 @@
         }
 
         /// <summary>
+        /// 鑾峰彇鎶芥牱鏂规鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        [Route("Web/GetGy_SampleScheme")]
+        [HttpGet]
+        public object GetSampleScheme(string SampleScheme, int OrganizationID)
+        {
+            if (SampleScheme != "")
+            {
+                sWhere = " and ( 鎶芥牱鏂规浠g爜 like '%" + SampleScheme + "%' or 鎶芥牱鏂规鍚嶇О like '%" + SampleScheme + "%' ) ";
+            }
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                string sql = "Select * from h_v_Gy_GetSampleSchemeListView where 1 = 1 " + sWhere + "Order by hmainid ";
+                ds = oCN.RunProcReturn(sql, "h_v_Gy_GetSampleSchemeListView");
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                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 = "1";
+                    objjson.count = 1;
+                    objjson.Message = "鑾峰彇鎴愬姛!";
+                    objjson.data = ds.Tables[0];
+                    objjson.list = columnNameList;
+                    return objjson;
+                }
+            }
+            catch (Exception ex)
+            {
+                objjson.code = "0";
+                objjson.count = 0;
+                objjson.Message = "鑾峰彇澶辫触" + ex.ToString();
+                objjson.data = null;
+                return objjson;
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇妫�楠屽�煎垪琛�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Web/GetGy_InspectValue")]
+        [HttpGet]
+        public object GetInspectValue(string InspectValue, int OrganizationID)
+        {
+            if (InspectValue != "")
+            {
+                sWhere = " and ( 妫�楠屽�间唬鐮� like '%" + InspectValue + "%' or 妫�楠屽�煎悕绉� like '%" + InspectValue + "%' ) ";
+            }
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                string sql = "Select * from h_v_Gy_GetInspectValueList where 1 = 1 " + sWhere + "Order by hmainid ";
+                ds = oCN.RunProcReturn(sql, "h_v_Gy_GetInspectValueList");
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                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 = "1";
+                    objjson.count = 1;
+                    objjson.Message = "鑾峰彇鎴愬姛!";
+                    objjson.data = ds.Tables[0];
+                    objjson.list = columnNameList;
+                    return objjson;
+                }
+            }
+            catch (Exception ex)
+            {
+                objjson.code = "0";
+                objjson.count = 0;
+                objjson.Message = "鑾峰彇澶辫触" + ex.ToString();
+                objjson.data = null;
+                return objjson;
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇妫�浠櫒鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        [Route("Web/GetGy_InspectInstruMent")]
+        [HttpGet]
+        public object GetGy_InspectInstruMent(string InspectInstruMent, int OrganizationID)
+        {
+            if (InspectInstruMent != "")
+            {
+                sWhere = " and ( 妫�楠屼华鍣ㄤ唬鐮� like '%" + InspectInstruMent + "%' or 妫�楠屼华鍣ㄥ悕绉� like '%" + InspectInstruMent + "%' ) ";
+            }
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                string sql = "Select * from h_v_Gy_InspectInstruMent where 1 = 1 " + sWhere + "Order by HItemID ";
+                ds = oCN.RunProcReturn(sql, "h_v_Gy_InspectInstruMent");
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                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 = "1";
+                    objjson.count = 1;
+                    objjson.Message = "鑾峰彇鎴愬姛!";
+                    objjson.data = ds.Tables[0];
+                    objjson.list = columnNameList;
+                    return objjson;
+                }
+            }
+            catch (Exception ex)
+            {
+                objjson.code = "0";
+                objjson.count = 0;
+                objjson.Message = "鑾峰彇澶辫触" + ex.ToString();
+                objjson.data = null;
+                return objjson;
+            }
+        }
+
+        /// <summary>
         /// 鏍规嵁妫�楠屾柟妗堜富鍐呯爜鑾峰彇妫�楠岄」鐩�
         /// </summary>
         /// <returns></returns>
         [Route("Web/GetCheckItemByCheckProjectID")]
         [HttpGet]
-        public object GetCheckItemByCheckProjectID(int CheckProjectID)
+        public object GetCheckItemByCheckProjectID(int CheckProjectID,int HBatchQty)
         {
             if (CheckProjectID <= 0)
             {
@@ -3397,8 +4122,8 @@
             try
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                string sql = "select c.HItemID HQCCheckItemID,c.HName 妫�楠岄」鐩�,b.HQCStd,b.HQCUnit HUnit from Gy_QCCheckProjectMain a left join Gy_QCCheckProjectSub b on a.HInterID = b.HInterID left join Gy_QCCheckItem c on b.HQCCheckItemID = c.HItemID where a.HInterID = " + CheckProjectID;
-                ds = oCN.RunProcReturn(sql, "Gy_QCCheckProjectMain");
+                string sql = "exec h_p_Gy_GetQCCheckItemByProject " + CheckProjectID + "," + HBatchQty;
+                ds = oCN.RunProcReturn(sql, "h_p_Gy_GetQCCheckItemByProject");
                 if (ds == null || ds.Tables[0].Rows.Count <= 0)
                 {
                     objjson.code = "0";
@@ -3732,6 +4457,148 @@
                 return objjson;
             }
         }
+
+        /// <summary>
+        /// 鏍规嵁璁惧甯﹀嚭椤圭洰
+        /// </summary>
+        /// <returns></returns>
+        [Route("Web/GetItemByEquipFile")]
+        [HttpGet]
+        public object GetItemByEquipFile(int EquipProjectID,string Type)
+        {
+            if (EquipProjectID <= 0)
+            {
+                objjson.code = "0";
+                objjson.count = 0;
+                objjson.Message = "浜у搧鍣ㄥ叿鏈�夋嫨";
+                objjson.data = null;
+                return objjson;
+            }
+            try
+            {
+                string HView = "";
+                switch (Type)
+                {
+                    case "DJ":
+                        HView = "h_v_Sb_GetDotCheckItemList";
+                        break;
+                    case "BY":
+                        HView = "h_v_Sb_GetMaintainItemList";
+                        break;
+                    default:
+                        objjson.code = "0";
+                        objjson.count = 0;
+                        objjson.Message = "璁惧妯″潡绫诲瀷閿欒锛�";
+                        objjson.data = null;
+                        return objjson;
+                }
+
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                string sql = string.Format(@"select * from " + HView + " where HInterID = " + EquipProjectID);
+                ds = oCN.RunProcReturn(sql, HView);
+                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 = "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>
+        /// 鏌ヨ鍚勭被璁惧鍗曟嵁鍒楄〃锛堣澶囩偣妫�锛岃澶囩淮淇紝璁惧淇濆吇......锛�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Web/GetEquipmentBillsList")]
+        [HttpGet]
+        public object GetEquipmentBillsList(string sWhere, string Type)
+        {            
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                string HView = "";
+                switch (Type)
+                {
+                    case "DJ":
+                        HView = "h_v_Sb_EquipDotCheckBillList";
+                        break;
+                    case "BY":
+                        HView = "h_v_Sb_EquipMaintainBillList";
+                        break;
+                    case "WX":
+                        HView = "h_v_Sb_EquipRepairCheckBillList";
+                        break;
+                    case "GZ":
+                        HView = "h_v_Sb_EquipConkBookBillList";
+                        break;
+                    case "YS":
+                        HView = "h_v_Sb_EquipRepairCheckBillList";
+                        break;
+                    default:
+                        objjson.code = "0";
+                        objjson.count = 0;
+                        objjson.Message = "璁惧妯″潡绫诲瀷閿欒锛�";
+                        objjson.data = null;
+                        return objjson;
+                }
+
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                string sql = string.Format(@"select * from " + HView + " where 1 = 1 " + sWhere);
+                ds = oCN.RunProcReturn(sql, HView);
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+                if (ds == null || ds.Tables[0].Rows.Count <= 0)
+                {
+                    objjson.code = "1";
+                    objjson.count = 1;
+                    objjson.Message = "鑾峰彇澶辫触,鏌ユ棤鏁版嵁";
+                    objjson.data = null;
+                    objjson.list = columnNameList;
+                    return objjson;
+                }
+                else
+                {
+                    objjson.code = "1";
+                    objjson.count = 1;
+                    objjson.Message = "鑾峰彇鎴愬姛!";
+                    objjson.data = ds.Tables[0];
+                    objjson.list = columnNameList;
+                    return objjson;
+                }
+            }
+            catch (Exception ex)
+            {
+                objjson.code = "0";
+                objjson.count = 0;
+                objjson.Message = "鑾峰彇澶辫触" + ex.ToString();
+                objjson.data = null;
+                return objjson;
+            }
+        }
+
         /// <summary>
         /// 鏍规嵁璁惧鐐规瑙勭▼鏄剧ず璁惧鐐规绋嬮」鐩�
         /// </summary>
@@ -3927,17 +4794,17 @@
 
         [Route("Web/MenuList")]
         [HttpGet]
-        public object MenuList(string HMakeName)
+        public object MenuList(string HMakeName, string HType)
         {
             try
             {
                 List<MenuLoad> mu = new List<MenuLoad>();                       //浠ョ埗瀛愮骇缁撴瀯瀛樻斁鑿滃崟娓呭崟淇℃伅
                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();            //鏁版嵁搴撴搷浣滃伐鍏�
-                string sql = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum from Gy_MenuDefineSet where HMakeName = '" + HMakeName + "' order by HItemID";
+                string sql = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum from Gy_MenuDefineSet where HMakeName = '" + HMakeName + "' and HType = '" + HType + "' order by HPosition";
                 ds = oCn.RunProcReturn(sql, "Gy_MenuDefineSet");        //鏌ヨ褰撳墠鐢ㄦ埛鐨勮嚜瀹氫箟鑿滃崟鏁版嵁
                 if (ds.Tables[0]==null || ds.Tables[0].Rows.Count == 0) //鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁鏈夎缃繃鑷畾涔変俊鎭紝鑻ヨ褰曟暟涓�0锛屽垯娌℃湁璁剧疆杩囷紝鍔犺浇鎵�鏈夌殑鑿滃崟淇℃伅
                 {
-                    sql = "Select * from Gy_Menu_1 Order by HItemID ";
+                    sql = "Select * from Gy_Menu_1 where HType = '" + HType + "' Order by HPosition ";
                     ds = oCn.RunProcReturn(sql, "Gy_Menu");
                 }
 
@@ -4052,7 +4919,7 @@
         //鑷畾涔夎彍鍗曪細鑾峰彇鏍戠粍浠舵暟鎹�
         [Route("Web/MenuDefineSet")]
         [HttpGet]
-        public object MenuDefineSet(string HMakeName)
+        public object MenuDefineSet(string HMakeName, string HType)
         {
             try
             {
@@ -4060,7 +4927,7 @@
                 List<MenuInit> menuInitList = new List<MenuInit>();                     //鐢ㄤ互鑾峰彇Gy_Menu_1涓殑鎵�鏈夎彍鍗曚俊鎭紝浠ュ強瀵瑰簲鑺傜偣鏄惁琚�変腑闇�瑕佸姞杞芥樉绀�
 
                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
-                ds = oCn.RunProcReturn("Select * from Gy_Menu_1 Order by HItemID ", "Gy_Menu");     //鑾峰彇Gy_Menu_1涓殑鎵�鏈夎彍鍗曚俊鎭紝鐢ㄤ簬涓簃enuInitList鍒楄〃鍏呭疄鏁版嵁
+                ds = oCn.RunProcReturn("Select * from Gy_Menu_1 where HType = '" +HType + "' Order by HItemID ", "Gy_Menu");     //鑾峰彇Gy_Menu_1涓殑鎵�鏈夎彍鍗曚俊鎭紝鐢ㄤ簬涓簃enuInitList鍒楄〃鍏呭疄鏁版嵁
 
                 DataSet ds1 = new DataSet();
                 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)                                   //灏咷y_Menu_1涓殑鑿滃崟淇℃伅鍙婇�変腑鎯呭喌淇濆瓨鍒癿enuInitList鍒楄〃涓紝
@@ -4149,6 +5016,7 @@
                 string[] sArray = msg.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                 string HMakeName = sArray[1].ToString();
                 string saveData = sArray[0].ToString();
+                string HTypes = sArray[2].ToString();
                 List<SaveDefineMenu> saveDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SaveDefineMenu>>(saveData);
 
                 //澹版槑鏁版嵁搴撴搷浣滃伐鍏�
@@ -4158,7 +5026,7 @@
                 oCN.BeginTran();
                 
                 //鍒犻櫎褰撳墠鐢ㄦ埛鐨勮嚜瀹氫箟鏁版嵁
-                string sql = "delete from Gy_MenuDefineSet where HMakeName = '" + HMakeName + "'";
+                string sql = "delete from Gy_MenuDefineSet where HMakeName = '" + HMakeName + "' and HType = '" + HTypes + "'";
                 oCN.RunProc(sql);
 
                 //鎻掑叆褰撳墠鐢ㄦ埛鏈�鏂扮殑鑷畾涔夋暟鎹�
@@ -4175,8 +5043,18 @@
                         string HType = ds.Tables[0].Rows[0]["HType"].ToString();
                         string HPicNum = ds.Tables[0].Rows[0]["HPicNum"].ToString();
 
-                        sql = "insert into Gy_MenuDefineSet(HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HMakeName,HPicNum) values('" + saveDataList[i].HItemID + "','" + HPartentID + "','" + HNumber + "','" + saveDataList[i].HName + "'," + HLevel + ",'" + Hurl + "','" + HType + "','" + HMakeName + "','" + HPicNum + "')";
-                        oCN.RunProc(sql);
+                        if(HPartentID == "0" || HPartentID == ds.Tables[0].Rows[0]["HItemID"].ToString())
+                        {
+                            string HPosition = ds.Tables[0].Rows[0]["HPosition"].ToString();
+                            sql = "insert into Gy_MenuDefineSet(HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HMakeName,HPicNum,HPosition) values('" + saveDataList[i].HItemID + "','" + HPartentID + "','" + HNumber + "','" + saveDataList[i].HName + "'," + HLevel + ",'" + Hurl + "','" + HType + "','" + HMakeName + "','" + HPicNum + "','" + HPosition + "')";
+                            oCN.RunProc(sql);
+                        }
+                        else
+                        {
+                            sql = "insert into Gy_MenuDefineSet(HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HMakeName,HPicNum,HPosition) values('" + saveDataList[i].HItemID + "','" + HPartentID + "','" + HNumber + "','" + saveDataList[i].HName + "'," + HLevel + ",'" + Hurl + "','" + HType + "','" + HMakeName + "','" + HPicNum + "','z')";
+                            oCN.RunProc(sql);
+                        }
+                        
                     }
                 }
                 //鎻愪氦鏁版嵁搴撴搷浣�
@@ -4212,7 +5090,7 @@
         //蹇嵎鏂瑰紡鑷畾涔夎彍鍗曪細鑾峰彇鏍戠粍浠舵暟鎹�
         [Route("Web/Xt_UserFastMenu_Display")]
         [HttpGet]
-        public object Xt_UserFastMenu_Display(string HMakeName)
+        public object Xt_UserFastMenu_Display(string HMakeName, string HType)
         {
             try
             {
@@ -4220,7 +5098,7 @@
                 List<MenuInit> menuInitList = new List<MenuInit>();                     //鐢ㄤ互鑾峰彇Gy_Menu_1涓殑鎵�鏈夎彍鍗曚俊鎭紝浠ュ強瀵瑰簲鑺傜偣鏄惁琚�変腑闇�瑕佸姞杞芥樉绀�
 
                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
-                ds = oCn.RunProcReturn("Select * from Gy_Menu_1 Order by HItemID ", "Gy_Menu");     //鑾峰彇Gy_Menu_1涓殑鎵�鏈夎彍鍗曚俊鎭紝鐢ㄤ簬涓簃enuInitList鍒楄〃鍏呭疄鏁版嵁
+                ds = oCn.RunProcReturn("Select * from Gy_Menu_1 where HType = '" + HType + "' Order by HItemID ", "Gy_Menu");     //鑾峰彇Gy_Menu_1涓殑鎵�鏈夎彍鍗曚俊鎭紝鐢ㄤ簬涓簃enuInitList鍒楄〃鍏呭疄鏁版嵁
 
                 DataSet ds1 = new DataSet();
                 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)                                   //灏咷y_Menu_1涓殑鑿滃崟淇℃伅鍙婇�変腑鎯呭喌淇濆瓨鍒癿enuInitList鍒楄〃涓紝
@@ -4304,6 +5182,7 @@
                 string[] sArray = msg.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                 string HMakeName = sArray[1].ToString();
                 string saveData = sArray[0].ToString();
+                string HTypes = sArray[2].ToString();
                 List<SaveDefineMenu> saveDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SaveDefineMenu>>(saveData);
 
                 //澹版槑鏁版嵁搴撴搷浣滃伐鍏�
@@ -4313,7 +5192,7 @@
                 oCN.BeginTran();
 
                 //鍒犻櫎褰撳墠鐢ㄦ埛鐨勮嚜瀹氫箟鏁版嵁
-                string sql = "delete from Xt_UserFastMenu where HUserID = '" + HMakeName + "'";
+                string sql = "delete from Xt_UserFastMenu where HUserID = '" + HMakeName + "' and HType = '" + HTypes + "'";
                 oCN.RunProc(sql);
 
                 //鎻掑叆褰撳墠鐢ㄦ埛鏈�鏂扮殑鑷畾涔夋暟鎹�
@@ -4330,8 +5209,9 @@
                             string HUserID = HMakeName;
                             string HSubFuncID = ds.Tables[0].Rows[0]["HItemID"].ToString();
                             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) values('" + HUserID + "','" + HSubFuncID + "','" + HCaption + "')";
+                            sql = "insert into Xt_UserFastMenu(HUserID,HSubFuncID,HCaption,HType) values('" + HUserID + "','" + HSubFuncID + "','" + HCaption + "','" + HType + "')";
                             oCN.RunProc(sql);
                         }
                     }
@@ -4361,12 +5241,12 @@
         //蹇嵎鏂瑰紡鑷畾涔夎彍鍗曪細鑾峰彇鏍戠粍浠舵暟鎹�
         [Route("Web/Xt_UserFastMenu_Init")]
         [HttpGet]
-        public object Xt_UserFastMenu_Init(string HMakeName)
+        public object Xt_UserFastMenu_Init(string HMakeName, string HType)
         {
             try
             {
                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
-                string sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl from Xt_UserFastMenu as a join Gy_Menu_1 as b on a.HSubFuncID = b.HItemID  where a.HUserID = '" + HMakeName + "' Order by a.HItemID";
+                string sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl 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";
                 ds = oCn.RunProcReturn(sql, "Xt_UserFastMenu");     //鑾峰彇Xt_UserFastMenu涓鐢ㄦ埛璁剧疆鐨勮嚜瀹氫箟鑿滃崟淇℃伅锛岀敤浜庡湪鍓嶇鍔犺浇
 
                 objJsonResult.code = "1";
@@ -4690,6 +5570,114 @@
             return objJsonResult;
         }
 
+        /// <summary>
+        /// 鑾峰彇杩愯緭鍏徃鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        [Route("Web/GetConveyCompList_Json")]
+        [HttpGet]
+        public object GetConveyCompList_Json(string ConveyComp)
+        {
+            if (ConveyComp != "")
+            {
+                sWhere = sWhere + " and ( HNumber like '%" + ConveyComp + "%' or HName like '%" + ConveyComp + "%' ) ";
+            }
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName  from Gy_ConveyComp where HStopflag=0 Order by HItemID ", "Gy_ConveyComp");
+                }
+                else
+                {
+                    string sql1 = "Select HItemID,HNumber ,HName  from Gy_ConveyComp where HStopflag=0 and HEndFlag=1 ";
+                    string sql = sql1 + sWhere;
+                    ds = oCN.RunProcReturn(sql, "Gy_ConveyComp");
+                }
+
+                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>
+        [Route("Web/GetConveyTypeList_Json")]
+        [HttpGet]
+        public object GetConveyTypeList_Json(string ConveyType)
+        {
+            if (ConveyType != "")
+            {
+                sWhere = sWhere + " and ( HNumber like '%" + ConveyType + "%' or HName like '%" + ConveyType + "%' ) ";
+            }
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName  from Gy_ConveyType where HStopflag=0 Order by HItemID ", "Gy_ConveyType");
+                }
+                else
+                {
+                    string sql1 = "Select HItemID,HNumber ,HName  from Gy_ConveyType where HStopflag=0 and HEndFlag=1 ";
+                    string sql = sql1 + sWhere;
+                    ds = oCN.RunProcReturn(sql, "Gy_ConveyType");
+                }
+
+                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;
+            }
+        }
+
     }
 
 }

--
Gitblit v1.9.1