From 908a189a83797f2e2037aa55f1841d2496137672 Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期二, 16 七月 2024 09:24:01 +0800 Subject: [PATCH] 增加休息日后端保存和批量保存 --- WebAPI/Controllers/WebAPIController.cs | 9440 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 9,375 insertions(+), 65 deletions(-) diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs index 02166d4..1c84ba2 100644 --- a/WebAPI/Controllers/WebAPIController.cs +++ b/WebAPI/Controllers/WebAPIController.cs @@ -119,13 +119,63 @@ //----------鍒涘缓铏氳〃------------------------ DataTable dt_Main = new DataTable("Json"); dt_Main.Columns.Add("HBillNo", typeof(string)); - dt_Main.Columns.Add("HInterID", typeof(int)); + dt_Main.Columns.Add("HInterID", typeof(Int64)); //---------鍒涘缓鏂拌------------------------ DataRow dr_main = dt_Main.NewRow();//鍒涘缓鏂拌 dt_Main.Rows.Add(dr_main);//灏嗘柊琛屽姞鍏ュ埌琛ㄤ腑 dr_main["HBillNo"] = DBUtility.ClsPub.isStrNull(HBillNo); dr_main["HInterID"] = DBUtility.ClsPub.isLong(HInterID); //杩斿洖鏁版嵁 + objjson.code = "0"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛"; + objjson.data = dt_Main; + return objjson; + } + } + catch (Exception e) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + e.ToString(); + objjson.data = null; + return objjson; + } + } + + /// <summary> + /// 鑷姩鑾峰彇鍩虹璧勬枡 娴佹按鍙� 灏辨槸浠g爜 + /// </summary> + /// <param name="HBillType"></param> + /// <returns></returns> + [Route("Web/GetMAXNumber")] + [HttpGet] + public object GetMAXNumber(string HBillType, string HName, string TableName) + { + try + { + string HNumber = ""; + HNumber = DBUtility.ClsPub.CreateHNumber(HBillType, HName, TableName, ref DBUtility.ClsPub.sExeReturnInfo, true); + //----------鍒涘缓铏氳〃------------------------ + DataTable dt_Main = new DataTable("Json"); + dt_Main.Columns.Add("HNumber", typeof(string)); + + //---------鍒涘缓鏂拌------------------------ + DataRow dr_main = dt_Main.NewRow();//鍒涘缓鏂拌 + dt_Main.Rows.Add(dr_main);//灏嗘柊琛屽姞鍏ュ埌琛ㄤ腑 + dr_main["HNumber"] = DBUtility.ClsPub.isStrNull(HNumber); + + + if (HNumber == null) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触"; + objjson.data = null; + return objjson; + } + else + { objjson.code = "0"; objjson.count = 1; objjson.Message = "鑾峰彇鎴愬姛"; @@ -202,7 +252,7 @@ public object GetUser(string UserName, string PassWord, string HOrgName) { try - { + { DataSet ds = null; ClsCN oCnLoc = new ClsCN(); DAL.ClsUser oUser = new DAL.ClsUser(); @@ -271,7 +321,7 @@ return objjson; } } - } + } objjson.code = "0"; objjson.count = 1; objjson.Message = "灞曞紑鎴愬姛锛�"; @@ -340,6 +390,122 @@ return objjson; ; } } + + + #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 @@ -1072,16 +1238,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) { @@ -1110,6 +1281,55 @@ return objjson; } } + + + /// <summary> + /// 鑾峰彇鐢熶骇璧勬簮鍒楄〃 + /// </summary> + /// <returns></returns> + [Route("Web/GetSouceList_Json")] + [HttpGet] + public object GetSouceList_Json(string HMaterID, string Value, Int64 HOrgID) + { + sWhere = " and HStopFlag=0 and HUSEORGID =" + HOrgID + ""; + if (Value != "" && Value != null) + { + sWhere = sWhere + " and ( HNumber like '%" + Value + "%' or HName like '%" + Value + "%' or HUSEORGID like '%" + HOrgID + "%' ) "; + } + try + { + string sql = "EXEC h_p_Gy_SouceViewList " + HMaterID + ",'" + sWhere + "'"; + ds = oCN.RunProcReturn(sql, "h_p_Gy_SouceViewList"); + + 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> @@ -1489,7 +1709,7 @@ string sql1 = "Select HItemID,HNumber ,HName from Gy_SellStyle where HStopflag=0 and HEndFlag=1 "; string sql = sql1 + sWhere; ds = oCN.RunProcReturn(sql, "Gy_SellStyle"); - } + } if (ds == null || ds.Tables[0].Rows.Count <= 0) { @@ -1516,7 +1736,7 @@ objjson.Message = "鑾峰彇澶辫触" + ex.ToString(); objjson.data = null; return objjson; - } + } } /// <summary> @@ -1635,7 +1855,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 +1894,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 +1955,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 +1983,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> /// 鑾峰彇鐗╂枡鍒楄〃 @@ -1905,7 +2219,7 @@ #endregion - #region 涓嶈壇鍘熷洜璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + #region 涓嶈壇鍘熷洜 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 /// <summary> /// 鑾峰彇涓嶈壇鍘熷洜鍒楄〃 /// </summary> @@ -2170,6 +2484,679 @@ } } + + /// <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> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_ErrType")] + [HttpPost] + public object SaveGy_ErrType([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_ErrType_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 isnull(MAX(HItemID),0) HItemID from Gy_ErrType ", "Gy_ErrType"); + 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_ErrType_Ctl oBill = new DAL.ClsGy_ErrType_Ctl(); + List<Model.ClsGy_ErrType_Model> lsmain = new List<Model.ClsGy_ErrType_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_ErrType(msg1); + foreach (Model.ClsGy_ErrType_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_ErrType where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_ErrType"); + 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_ErrTypeDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_ErrTypeDetail(string HID) + { + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_ErrTypeList where HItemID= " + HID + " ", "h_v_Gy_ErrTypeList"); + 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_ErrType")] + [HttpGet] + public object DeltetGy_ErrType(string HItemID, string user) + { + DataSet ds; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_ErrType_Delete", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (string.IsNullOrWhiteSpace(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HItemID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran();//寮�濮嬩簨鍔� + ds = oCN.RunProcReturn("select * from Gy_ErrType where HItemID=" + HItemID, "Gy_ErrType"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + + oCN.RunProc("delete Gy_ErrType 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; + } + } + + #region 寮傚父绫诲瀷瀹℃牳/鍙嶅鏍� + [Route("Gy_ErrType/AuditGy_ErrType")] + [HttpGet] + public object AuditGy_ErrType(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊鏍告潈闄� + if (!DBUtility.ClsPub.Security_Log("Gy_ErrType_Check", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬鏍�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + DAL.ClsGy_ErrType_Ctl oBill = new DAL.ClsGy_ErrType_Ctl(); + ClsPub.CurUserName = user; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 瀹℃牳 2 鍙嶅鏍� + if (Type == 1) + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳 + DataSet ds; + string sql = "select * from Gy_ErrType where HItemID = " + HInterID; + ds = oCN.RunProcReturn(sql, oBill.MvarItemKey); + if (ds.Tables[0].Rows[0]["HCheckEmp"] != null && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //瀹℃牳鍗曟嵁 + if (!oBill.AuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + + else + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍� + DataSet ds; + string sql = "select * from Gy_ErrType where HItemID = " + HInterID; + ds = oCN.RunProcReturn(sql, oBill.MvarItemKey); + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCheckEmp"] == null || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + //鍙嶅鏍稿崟鎹� + if (!oBill.DeAuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + } + + oCN.Commit();//鎻愪氦浜嬪姟 + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + /// <summary> + /// 涓嶈壇绫诲瀷鑾峰彇淇℃伅 + /// </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; + } + } + /// <summary> /// 涓嶈壇鍘熷洜鑾峰彇淇℃伅 /// </summary> @@ -2254,6 +3241,7642 @@ } #endregion + + + #region 涓嶈壇鍚庢灉 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 淇濆瓨涓嶈壇鍚庢灉 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_BadResultList")] + [HttpPost] + public object SaveGy_BadResultList([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_BadResult_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_BadResult ", "Gy_BadResult"); + 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 + { + WebAPI.DLL.ClsGy_BadResult_Ctl oBill = new WebAPI.DLL.ClsGy_BadResult_Ctl(); + List<Model.ClsGy_BadResult_Model> lsmain = new List<Model.ClsGy_BadResult_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_BadResult(msg1); + foreach (Model.ClsGy_BadResult_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_BadResult where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_BadResult"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_BadResultDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_BadResultDetail(string HID) + { + var model = LuBaoSevice.GetGy_BadResultBillDetail(HID); + return model; + } + + /// <summary> + /// 涓嶈壇鍘熷洜鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_BadResult")] + [HttpGet] + public object DeltetGy_BadResult(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_BadResult_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_BadResult where HItemID=" + HItemID, "Gy_BadResult"); + 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_BadResult where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + + #region 妫�娴嬪�� 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 淇濆瓨妫�娴嬪�� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_InspectValueList")] + [HttpPost] + public object SaveGy_InspectValueList([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_InspectValue_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_InspectValue ", "Gy_InspectValue"); + 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 + { + WebAPI.DLL.ClsGy_InspectValue_Ctl oBill = new WebAPI.DLL.ClsGy_InspectValue_Ctl(); + List<Model.ClsGy_InspectValue_Model> lsmain = new List<Model.ClsGy_InspectValue_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_InspectValue(msg1); + foreach (Model.ClsGy_InspectValue_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_InspectValue where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_InspectValue"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_InspectValueDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_InspectValueDetail(string HID) + { + var model = LuBaoSevice.GetGy_InspectValueBillDetail(HID); + return model; + } + + /// <summary> + /// 妫�娴嬪�煎垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("DeltetGy_InspectValue")] + [HttpGet] + public object DeltetGy_InspectValue(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_InspectValue_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_InspectValue where HItemID=" + HItemID, "Gy_InspectValue"); + 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_InspectValue where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 妫�楠屾柟娉� 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 淇濆瓨妫�楠屾柟娉� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_InspectMethodList")] + [HttpPost] + public object SaveGy_InspectMethodList([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_InspectMethod_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_InspectMethod ", "Gy_InspectMethod"); + 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 + { + WebAPI.DLL.ClsGy_InspectMethod_Ctl oBill = new WebAPI.DLL.ClsGy_InspectMethod_Ctl(); + List<Model.ClsGy_InspectMethod_Model> lsmain = new List<Model.ClsGy_InspectMethod_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_InspectMethod(msg1); + foreach (Model.ClsGy_InspectMethod_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_InspectMethod where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_InspectMethod"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_InspectMethodDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_InspectMethodDetail(string HID) + { + var model = LuBaoSevice.GetGy_InspectMethodBillDetail(HID); + return model; + } + + /// <summary> + /// 妫�楠屾柟娉曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("DeltetGy_InspectMethod")] + [HttpGet] + public object DeltetGy_InspectMethod(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_InspectMethod_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_InspectMethod where HItemID=" + HItemID, "Gy_InspectMethod"); + 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_InspectMethod where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 璐ㄩ噺鏍囧噯 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 淇濆瓨璐ㄩ噺鏍囧噯 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_QualityStdList")] + [HttpPost] + public object SaveGy_QualityStdList([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_QualityStd_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_QualityStd ", "Gy_QualityStd"); + 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 + { + WebAPI.DLL.ClsGy_QualityStd_Ctl oBill = new WebAPI.DLL.ClsGy_QualityStd_Ctl(); + List<Model.ClsGy_QualityStd_Model> lsmain = new List<Model.ClsGy_QualityStd_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_QualityStd(msg1); + foreach (Model.ClsGy_QualityStd_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_QualityStd where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_QualityStd"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_QualityStdDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_QualityStdDetail(string HID) + { + var model = LuBaoSevice.GetGy_QualityStdBillDetail(HID); + return model; + } + + /// <summary> + /// 璐ㄩ噺鏍囧噯鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_QualityStd")] + [HttpGet] + public object DeltetGy_QualityStd(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_QualityStd_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_QualityStd where HItemID=" + HItemID, "Gy_QualityStd"); + 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_QualityStd where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 妫�楠屼华鍣� 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 淇濆瓨妫�楠屼华鍣� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_InspectInstruMentList")] + [HttpPost] + public object SaveGy_InspectInstruMentList([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_InspectInstruMent_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_InspectInstruMent ", "Gy_InspectInstruMent"); + 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 + { + WebAPI.DLL.ClsGy_InspectInstruMent_Ctl oBill = new WebAPI.DLL.ClsGy_InspectInstruMent_Ctl(); + List<Model.ClsGy_InspectInstruMent_Model> lsmain = new List<Model.ClsGy_InspectInstruMent_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_InspectInstruMent(msg1); + foreach (Model.ClsGy_InspectInstruMent_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_InspectInstruMent where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_InspectInstruMent"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_InspectInstruMentDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_InspectInstruMentDetail(string HID) + { + var model = LuBaoSevice.GetGy_InspectInstruMentBillDetail(HID); + return model; + } + + /// <summary> + /// 妫�楠屼华鍣ㄥ垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("DeltetGy_InspectInstruMent")] + [HttpGet] + public object DeltetGy_InspectInstruMent(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_InspectInstruMent_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_InspectInstruMent where HItemID=" + HItemID, "Gy_InspectInstruMent"); + 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_InspectInstruMent where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 妫�楠屼緷鎹� 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 淇濆瓨妫�楠屼緷鎹� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_InspectBasisList")] + [HttpPost] + public object SaveGy_InspectBasisList([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_InspectBasis_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 isNull(MAX(HItemID),0) HItemID from Gy_InspectBasis ", "Gy_InspectBasis"); + 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 + { + WebAPI.DLL.ClsGy_InspectBasis_Ctl oBill = new WebAPI.DLL.ClsGy_InspectBasis_Ctl(); + List<Model.ClsGy_InspectBasis_Model> lsmain = new List<Model.ClsGy_InspectBasis_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_InspectBasis(msg1); + foreach (Model.ClsGy_InspectBasis_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_InspectBasis where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_InspectBasis"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_InspectBasisDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_InspectBasisDetail(string HID) + { + var model = LuBaoSevice.GetGy_InspectBasisBillDetail(HID); + return model; + } + + /// <summary> + /// 妫�楠屼緷鎹垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("DeltetGy_InspectBasis")] + [HttpGet] + public object DeltetGy_InspectBasis(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_InspectBasis_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_InspectBasis where HItemID=" + HItemID, "Gy_InspectBasis"); + 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_InspectBasis where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + + #region 宀椾綅鎶�鑳� 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 淇濆瓨宀椾綅鎶�鑳� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_PostSkillList")] + [HttpPost] + public object SaveGy_PostSkillList([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_PostSkill_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 isNull(MAX(HItemID),0) HItemID from Gy_PostSkill ", "Gy_PostSkill"); + 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 + { + WebAPI.DLL.ClsGy_PostSkill_Ctl oBill = new WebAPI.DLL.ClsGy_PostSkill_Ctl(); + List<Model.ClsGy_PostSkill_Model> lsmain = new List<Model.ClsGy_PostSkill_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_PostSkill(msg1); + foreach (Model.ClsGy_PostSkill_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_PostSkill where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PostSkill"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_PostSkillDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_PostSkillDetail(string HID) + { + var model = LuBaoSevice.GetGy_PostSkillDetail(HID); + return model; + } + + /// <summary> + /// 宀椾綅鎶�鑳藉垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("DeltetGy_PostSkill")] + [HttpGet] + public object DeltetGy_PostSkill(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_PostSkill_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_PostSkill where HItemID=" + HItemID, "Gy_PostSkill"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + + oCN.RunProc("delete Gy_PostSkill where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + + #region 宀椾綅 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 淇濆瓨宀椾綅 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_PostList")] + [HttpPost] + public object SaveGy_PostList([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_Post_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 isNull(MAX(HItemID),0) HItemID from Gy_Post ", "Gy_Post"); + 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 + { + WebAPI.DLL.ClsGy_Post_Ctl oBill = new WebAPI.DLL.ClsGy_Post_Ctl(); + List<Model.ClsGy_Post_Model> lsmain = new List<Model.ClsGy_Post_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_Post(msg1); + foreach (Model.ClsGy_Post_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_Post where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_Post"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_PostDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_PostDetail(string HID) + { + var model = LuBaoSevice.GetGy_PostDetail(HID); + return model; + } + + /// <summary> + /// 宀椾綅鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_Post")] + [HttpGet] + public object DeltetGy_Post(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_Post_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_Post where HItemID=" + HItemID, "Gy_Post"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + + oCN.RunProc("delete Gy_Post where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 璋冩嫧绫诲瀷 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 淇濆瓨璋冩嫧绫诲瀷 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_StockMoveStyleList")] + [HttpPost] + public object SaveGy_StockMoveStyleList([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_StockMoveStyle_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 isNull(MAX(HItemID),0) HItemID from Gy_StockMoveStyle ", "Gy_StockMoveStyle"); + 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 + { + WebAPI.DLL.ClsGy_StockMoveStyle_Ctl oBill = new WebAPI.DLL.ClsGy_StockMoveStyle_Ctl(); + List<Model.ClsGy_StockMoveStyle_Model> lsmain = new List<Model.ClsGy_StockMoveStyle_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_StockMoveStyle(msg1); + foreach (Model.ClsGy_StockMoveStyle_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_StockMoveStyle where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_StockMoveStyle"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_StockMoveStyleDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_StockMoveStyleDetail(string HID) + { + var model = LuBaoSevice.GetGy_StockMoveStyleDetail(HID); + return model; + } + + /// <summary> + /// 璋冩嫧绫诲瀷鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_StockMoveStyle")] + [HttpGet] + public object DeltetGy_StockMoveStyle(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_StockMoveStyle_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_StockMoveStyle where HItemID=" + HItemID, "Gy_StockMoveStyle"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + + oCN.RunProc("delete Gy_StockMoveStyle where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 鍏ュ簱绫诲瀷 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 淇濆瓨鍏ュ簱绫诲瀷 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_StockInStyleList")] + [HttpPost] + public object SaveGy_StockInStyleList([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_StockInStyle_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 isNull(MAX(HItemID),0) HItemID from Gy_StockInStyle ", "Gy_StockInStyle"); + 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 + { + WebAPI.DLL.ClsGy_StockInStyle_Ctl oBill = new WebAPI.DLL.ClsGy_StockInStyle_Ctl(); + List<Model.ClsGy_StockInStyle_Model> lsmain = new List<Model.ClsGy_StockInStyle_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_StockInStyle(msg1); + foreach (Model.ClsGy_StockInStyle_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_StockInStyle where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_StockInStyle"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_StockInStyleDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_StockInStyleDetail(string HID) + { + var model = LuBaoSevice.GetGy_StockInStyleDetail(HID); + return model; + } + + /// <summary> + /// 鍏ュ簱绫诲瀷鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_StockInStyle")] + [HttpGet] + public object DeltetGy_StockInStyle(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_StockInStyle_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_StockInStyle where HItemID=" + HItemID, "Gy_StockInStyle"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + + oCN.RunProc("delete Gy_StockInStyle where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 鍑哄簱绫诲瀷 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 淇濆瓨鍑哄簱绫诲瀷 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_StockOutStyleList")] + [HttpPost] + public object SaveGy_StockOutStyleList([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_StockOutStyle_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 isNull(MAX(HItemID),0) HItemID from Gy_StockOutStyle ", "Gy_StockOutStyle"); + 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 + { + WebAPI.DLL.ClsGy_StockOutStyle_Ctl oBill = new WebAPI.DLL.ClsGy_StockOutStyle_Ctl(); + List<Model.ClsGy_StockOutStyle_Model> lsmain = new List<Model.ClsGy_StockOutStyle_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_StockOutStyle(msg1); + foreach (Model.ClsGy_StockOutStyle_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_StockOutStyle where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_StockOutStyle"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_StockOutStyleDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_StockOutStyleDetail(string HID) + { + var model = LuBaoSevice.GetGy_StockOutStyleDetail(HID); + return model; + } + + /// <summary> + /// 鍑哄簱绫诲瀷鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_StockOutStyle")] + [HttpGet] + public object DeltetGy_StockOutStyle(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_StockOutStyle_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_StockOutStyle where HItemID=" + HItemID, "Gy_StockOutStyle"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + + oCN.RunProc("delete Gy_StockOutStyle where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 鍦板尯 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 鍦板尯 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_AreaSetList")] + [HttpPost] + public object SaveGy_AreaSetList([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_AreaSet_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 isNull(MAX(HItemID),0) HItemID from Gy_AreaSet ", "Gy_AreaSet"); + 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 + { + WebAPI.DLL.ClsGy_AreaSet_Ctl oBill = new WebAPI.DLL.ClsGy_AreaSet_Ctl(); + List<Model.ClsGy_AreaSet_Model> lsmain = new List<Model.ClsGy_AreaSet_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_AreaSet(msg1); + foreach (Model.ClsGy_AreaSet_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_AreaSet where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_AreaSet"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_AreaSetDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_AreaSetDetail(string HID) + { + var model = LuBaoSevice.GetGy_AreaSetDetail(HID); + return model; + } + + /// <summary> + /// 鍦板尯鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_AreaSet")] + [HttpGet] + public object DeltetGy_AreaSet(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_AreaSet_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_AreaSet where HItemID=" + HItemID, "Gy_AreaSet"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + + oCN.RunProc("delete Gy_AreaSet where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 閿�鍞柟寮� 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 閿�鍞柟寮忎繚瀛� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_SellStyleList")] + [HttpPost] + public object SaveGy_SellStyleList([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_SellStyle_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 isNull(MAX(HItemID),0) HItemID from Gy_SellStyle ", "Gy_SellStyle"); + 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 + { + WebAPI.DLL.ClsGy_SellStyle_Ctl oBill = new WebAPI.DLL.ClsGy_SellStyle_Ctl(); + List<Model.ClsGy_SellStyle_Model> lsmain = new List<Model.ClsGy_SellStyle_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_SellStyle(msg1); + foreach (Model.ClsGy_SellStyle_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_SellStyle where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_SellStyle"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_SellStyleDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_SellStyleDetail(string HID) + { + var model = LuBaoSevice.GetGy_SellStyleDetail(HID); + return model; + } + + /// <summary> + /// 閿�鍞柟寮忓垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("DeltetGy_SellStyle")] + [HttpGet] + public object DeltetGy_SellStyle(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_SellStyle_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_SellStyle where HItemID=" + HItemID, "Gy_SellStyle"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + + oCN.RunProc("delete Gy_SellStyle where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 閲囪喘鏂瑰紡 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 閲囪喘鏂瑰紡 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_PoStockStyleList")] + [HttpPost] + public object SaveGy_PoStockStyleList([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_PoStockStyle_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 isNull(MAX(HItemID),0) HItemID from Gy_PoStockStyle ", "Gy_PoStockStyle"); + 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 + { + WebAPI.DLL.ClsGy_PoStockStyle_Ctl oBill = new WebAPI.DLL.ClsGy_PoStockStyle_Ctl(); + List<Model.ClsGy_PoStockStyle_Model> lsmain = new List<Model.ClsGy_PoStockStyle_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_PoStockStyle(msg1); + foreach (Model.ClsGy_PoStockStyle_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_PoStockStyle where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PoStockStyle"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_PoStockStyleDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_PoStockStyleDetail(string HID) + { + var model = LuBaoSevice.GetGy_PoStockStyleDetail(HID); + return model; + } + + /// <summary> + /// 閲囪喘鏂瑰紡鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_PoStockStyle")] + [HttpGet] + public object DeltetGy_PoStockStyle(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_PoStockStyle_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_PoStockStyle where HItemID=" + HItemID, "Gy_PoStockStyle"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + + oCN.RunProc("delete Gy_PoStockStyle where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 渚涘簲鍟嗗垎绫� 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 渚涘簲鍟嗗垎绫� 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_SupTypeList")] + [HttpPost] + public object SaveGy_SupTypeList([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_SupType_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 isNull(MAX(HItemID),0) HItemID from Gy_SupType ", "Gy_SupType"); + 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 + { + WebAPI.DLL.ClsGy_SupType_Ctl oBill = new WebAPI.DLL.ClsGy_SupType_Ctl(); + List<Model.ClsGy_SupType_Model> lsmain = new List<Model.ClsGy_SupType_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_SupType(msg1); + foreach (Model.ClsGy_SupType_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_SupType where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_SupType"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_SupTypeDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_SupTypeDetail(string HID) + { + var model = LuBaoSevice.GetGy_SupTypeDetail(HID); + return model; + } + + /// <summary> + /// 渚涘簲鍟嗗垎绫诲垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("DeltetGy_SupType")] + [HttpGet] + public object DeltetGy_SupType(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_SupType_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_SupType where HItemID=" + HItemID, "Gy_SupType"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + + oCN.RunProc("delete Gy_SupType where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 瀹㈡埛鍒嗙被 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 瀹㈡埛鍒嗙被 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_CusTypeList")] + [HttpPost] + public object SaveGy_CusTypeList([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_CusType_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 isNull(MAX(HItemID),0) HItemID from Gy_CusType ", "Gy_CusType"); + 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 + { + WebAPI.DLL.ClsGy_CusType_Ctl oBill = new WebAPI.DLL.ClsGy_CusType_Ctl(); + List<Model.ClsGy_CusType_Model> lsmain = new List<Model.ClsGy_CusType_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_CusType(msg1); + foreach (Model.ClsGy_CusType_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_CusType where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CusType"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_CusTypeDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_CusTypeDetail(string HID) + { + var model = LuBaoSevice.GetGy_CusTypeDetail(HID); + return model; + } + + /// <summary> + /// 瀹㈡埛鍒嗙被鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_CusType")] + [HttpGet] + public object DeltetGy_CusType(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_CusType_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_CusType where HItemID=" + HItemID, "Gy_CusType"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + + oCN.RunProc("delete Gy_CusType where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 鐩樼偣鏂规 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 鐩樼偣鏂规 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_StockCheckItemList")] + [HttpPost] + public object SaveGy_StockCheckItemList([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_StockCheckItem_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 isNull(MAX(HItemID),0) HItemID from Gy_StockCheckItem ", "Gy_StockCheckItem"); + 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 + { + WebAPI.DLL.ClsGy_StockCheckItem_Ctl oBill = new WebAPI.DLL.ClsGy_StockCheckItem_Ctl(); + List<Model.ClsGy_StockCheckItem_Model> lsmain = new List<Model.ClsGy_StockCheckItem_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_StockCheckItems(msg1); + foreach (Model.ClsGy_StockCheckItem_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_StockCheckItem where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_StockCheckItem"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_StockCheckItemDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_StockCheckItemDetail(string HID) + { + var model = LuBaoSevice.GetGy_StockCheckItemDetail(HID); + return model; + } + + /// <summary> + /// 鐩樼偣鏂规鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_StockCheckItem")] + [HttpGet] + public object DeltetGy_StockCheckItem(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_StockCheckItem_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_StockCheckItem where HItemID=" + HItemID, "Gy_StockCheckItem"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + + oCN.RunProc("delete Gy_StockCheckItem where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 椤圭洰璐圭敤 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 椤圭洰璐圭敤 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_ProjectMoneyList")] + [HttpPost] + public object SaveGy_ProjectMoneyList([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_ProjectMoney_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 isNull(MAX(HItemID),0) HItemID from Gy_ProjectMoney ", "Gy_ProjectMoney"); + 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 + { + + WebAPI.DLL.ClsGy_ProjectMoney_Ctl oBill = new WebAPI.DLL.ClsGy_ProjectMoney_Ctl(); + List<Model.ClsGy_ProjectMoney_Model> lsmain = new List<Model.ClsGy_ProjectMoney_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_ProjectMoney(msg1); + foreach (Model.ClsGy_ProjectMoney_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_ProjectMoney where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_ProjectMoney"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_ProjectMoneyDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_ProjectMoneyDetail(string HID) + { + var model = LuBaoSevice.GetGy_ProjectMoneyDetail(HID); + return model; + } + + /// <summary> + /// 椤圭洰璐圭敤 鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_ProjectMoney")] + [HttpGet] + public object DeltetGy_ProjectMoney(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_ProjectMoney_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_ProjectMoney where HItemID=" + HItemID, "Gy_ProjectMoney"); + if (ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!"; + objJsonResult.data = null; + return objJsonResult; + } + + + oCN.RunProc("delete Gy_ProjectMoney where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 寮傚父鍙嶉绫诲瀷 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 寮傚父鍙嶉绫诲瀷 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_ErrMsgBackType")] + [HttpPost] + public object SaveGy_ErrMsgBackType([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_ErrMsgBackType_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 isNull(MAX(HItemID),0) HItemID from Gy_ErrMsgBackType ", "Gy_ErrMsgBackType"); + 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 + { + + WebAPI.DLL.ClsGy_ErrMsgBackType_Ctl oBill = new WebAPI.DLL.ClsGy_ErrMsgBackType_Ctl(); + List<Model.ClsGy_ErrMsgBackType_Model> lsmain = new List<Model.ClsGy_ErrMsgBackType_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_ErrMsgBackType(msg1); + foreach (Model.ClsGy_ErrMsgBackType_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_ErrMsgBackType where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_ErrMsgBackType"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_ErrMsgBackTypeDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_ErrMsgBackTypeDetail(string HID) + { + var model = LuBaoSevice.GetGy_ErrMsgBackTypeDetail(HID); + return model; + } + + /// <summary> + /// 寮傚父鍙嶉绫诲瀷 鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_ErrMsgBackType")] + [HttpGet] + public object DeltetGy_ErrMsgBackType(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_ErrMsgBackType_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_ErrMsgBackType where HItemID=" + HItemID, "Gy_ErrMsgBackType"); + if (ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!"; + objJsonResult.data = null; + return objJsonResult; + } + + + oCN.RunProc("delete Gy_ErrMsgBackType where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 涓嶈壇鐜拌薄 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 涓嶈壇鐜拌薄 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_BadPhenomenaList")] + [HttpPost] + public object SaveGy_BadPhenomenaList([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_BadPhenomena_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 isNull(MAX(HItemID),0) HItemID from Gy_BadPhenomena ", "Gy_BadPhenomena"); + 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 + { + + WebAPI.DLL.ClsGy_BadPhenomena_Ctl oBill = new WebAPI.DLL.ClsGy_BadPhenomena_Ctl(); + List<Model.ClsGy_BadPhenomena_Model> lsmain = new List<Model.ClsGy_BadPhenomena_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_BadPhenomena(msg1); + foreach (Model.ClsGy_BadPhenomena_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_BadPhenomena where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_BadPhenomena"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_BadPhenomenaDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_BadPhenomenaDetail(string HID) + { + var model = LuBaoSevice.GetGy_BadPhenomenaDetail(HID); + return model; + } + + /// <summary> + /// 涓嶈壇鐜拌薄 鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_BadPhenomena")] + [HttpGet] + public object DeltetGy_BadPhenomena(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_BadPhenomena_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_BadPhenomena where HItemID=" + HItemID, "Gy_BadPhenomena"); + if (ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!"; + objJsonResult.data = null; + return objJsonResult; + } + + + oCN.RunProc("delete Gy_BadPhenomena where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 椤圭洰绫诲埆 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 椤圭洰绫诲埆 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_ProjectClassList")] + [HttpPost] + public object SaveGy_ProjectClassList([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_ProjectClass_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 isNull(MAX(HItemID),0) HItemID from Gy_ProjectClass ", "Gy_ProjectClass"); + 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 + { + + WebAPI.DLL.ClsGy_ProjectClass_Ctl oBill = new WebAPI.DLL.ClsGy_ProjectClass_Ctl(); + List<Model.ClsGy_ProjectClass_Model> lsmain = new List<Model.ClsGy_ProjectClass_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_ProjectClass(msg1); + foreach (Model.ClsGy_ProjectClass_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_ProjectClass where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_ProjectClass"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_ProjectClassDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_ProjectClassDetail(string HID) + { + var model = LuBaoSevice.GetGy_ProjectClassDetail(HID); + return model; + } + + /// <summary> + /// 椤圭洰绫诲埆 鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_ProjectClass")] + [HttpGet] + public object DeltetGy_ProjectClass(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_ProjectClass_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_ProjectClass where HItemID=" + HItemID, "Gy_ProjectClass"); + if (ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!"; + objJsonResult.data = null; + return objJsonResult; + } + + + oCN.RunProc("delete Gy_ProjectClass where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 浠诲姟绫诲埆 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 浠诲姟绫诲埆 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_TaskClassList")] + [HttpPost] + public object SaveGy_TaskClassList([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_TaskClass_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 isNull(MAX(HItemID),0) HItemID from Gy_TaskClass ", "Gy_TaskClass"); + 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 + { + + WebAPI.DLL.ClsGy_TaskClass_Ctl oBill = new WebAPI.DLL.ClsGy_TaskClass_Ctl(); + List<Model.ClsGy_TaskClass_Model> lsmain = new List<Model.ClsGy_TaskClass_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_TaskClass(msg1); + foreach (Model.ClsGy_TaskClass_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_TaskClass where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_TaskClass"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_TaskClassDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_TaskClassDetail(string HID) + { + var model = LuBaoSevice.GetGy_TaskClassDetail(HID); + return model; + } + + /// <summary> + /// 浠诲姟绫诲埆 鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_TaskClass")] + [HttpGet] + public object DeltetGy_TaskClass(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_TaskClass_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_TaskClass where HItemID=" + HItemID, "Gy_TaskClass"); + if (ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!"; + objJsonResult.data = null; + return objJsonResult; + } + + + oCN.RunProc("delete Gy_TaskClass where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 闃查敊瑁呯疆 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 闃查敊瑁呯疆 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_PreventErrMouldList")] + [HttpPost] + public object SaveGy_PreventErrMouldList([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_PreventErrMould_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 isNull(MAX(HItemID),0) HItemID from Gy_PreventErrMould ", "Gy_PreventErrMould"); + 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 + { + + WebAPI.DLL.ClsGy_PreventErrMould_Ctl oBill = new WebAPI.DLL.ClsGy_PreventErrMould_Ctl(); + List<Model.ClsGy_PreventErrMould_Model> lsmain = new List<Model.ClsGy_PreventErrMould_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_PreventErrMould(msg1); + foreach (Model.ClsGy_PreventErrMould_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_PreventErrMould where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PreventErrMould"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_PreventErrMouldDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_PreventErrMouldDetail(string HID) + { + var model = LuBaoSevice.GetGy_PreventErrMouldDetail(HID); + return model; + } + + /// <summary> + /// 闃查敊瑁呯疆 鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_PreventErrMould")] + [HttpGet] + public object DeltetGy_PreventErrMould(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_PreventErrMould_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();//寮�濮嬩簨鍔� + + + oCN.RunProc("delete Gy_PreventErrMould where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 淇濆吇绾у埆 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 淇濆吇绾у埆 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_MaintainLevList")] + [HttpPost] + public object SaveGy_MaintainLevList([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_MaintainLev_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 isNull(MAX(HItemID),0) HItemID from Gy_MaintainLev ", "Gy_MaintainLev"); + 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 + { + + WebAPI.DLL.ClsGy_MaintainLev_Ctl oBill = new WebAPI.DLL.ClsGy_MaintainLev_Ctl(); + List<Model.ClsGy_MaintainLev_Model> lsmain = new List<Model.ClsGy_MaintainLev_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_MaintainLev(msg1); + foreach (Model.ClsGy_MaintainLev_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_MaintainLev where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_MaintainLev"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + 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_MaintainLevDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_MaintainLevDetail(string HID) + { + var model = LuBaoSevice.GetGy_MaintainLevDetail(HID); + return model; + } + + /// <summary> + ///淇濆吇绾у埆 鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_MaintainLev")] + [HttpGet] + public object DeltetGy_MaintainLev(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_MaintainLev_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();//寮�濮嬩簨鍔� + + + oCN.RunProc("delete Gy_MaintainLev where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 鍚姩妫�鏌ラ」鐩� 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 鍚姩妫�鏌ラ」鐩� 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_CheckNoteItemList")] + [HttpPost] + public object SaveGy_CheckNoteItemList([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_CheckNoteItem_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 isNull(MAX(HItemID),0) HItemID from Gy_CheckNoteItem ", "Gy_CheckNoteItem"); + if (Maxds != null || Maxds.Tables[0].Rows.Count > 0) + { + var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]); + maxid += 1; + HItemID = maxid; + } + ListModels oListModels = new ListModels(); + try + { + + WebAPI.DLL.ClsGy_CheckNoteItem_Ctl oBill = new WebAPI.DLL.ClsGy_CheckNoteItem_Ctl(); + List<Model.ClsGy_CheckNoteItem_Model> lsmain = new List<Model.ClsGy_CheckNoteItem_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_CheckNoteItem(msg1); + foreach (Model.ClsGy_CheckNoteItem_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_CheckNoteItem where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CheckNoteItem"); + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + oBill.oModel = oItem; + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.oModel.HItemID == 0) + { + bResult = oBill.AddNew(); + } + else + { + bResult = oBill.ModifyByID(oBill.oModel.HItemID); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = 1; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + + /// <summary> + ///鍚姩妫�鏌ラ」鐩� 鑾峰彇淇℃伅 + /// </summary> + /// <returns></returns> + [Route("GetGy_CheckNoteItemDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_CheckNoteItemDetail(string HID) + { + var model = LuBaoSevice.GetGy_CheckNoteItemDetail(HID); + return model; + } + + /// <summary> + ///鍚姩妫�鏌ラ」鐩� 鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_CheckNoteItem")] + [HttpGet] + public object DeltetGy_CheckNoteItem(string HItemID, string user) + { + DataSet ds; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_CheckNoteItem_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();//寮�濮嬩簨鍔� + + + oCN.RunProc("delete Gy_CheckNoteItem where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 浼戞伅鏃� 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 浼戞伅鏃� 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_RestDayList")] + [HttpPost] + public object SaveGy_RestDayList([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_RestDay_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 isNull(MAX(HItemID),0) HItemID from Gy_RestDay ", "Gy_RestDay"); + 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 + { + + WebAPI.DLL.ClsGy_RestDay_Ctl oBill = new WebAPI.DLL.ClsGy_RestDay_Ctl(); + List<Model.ClsGy_RestDay_Model> lsmain = new List<Model.ClsGy_RestDay_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_RestDay(msg1); + foreach (Model.ClsGy_RestDay_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; + } + //寰楀埌鐭唬鐮� + 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()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + DayOfWeek dayOfWeek = oItem.HRestDay.DayOfWeek; + + // 瀹氫箟鏄熸湡鍑犵殑涓枃鏄犲皠鍏崇郴 + Dictionary<DayOfWeek, string> chineseDayOfWeek = new Dictionary<DayOfWeek, string> + { + { DayOfWeek.Sunday, "鏄熸湡鏃�" }, + { DayOfWeek.Saturday, "鏄熸湡鍏�" } + }; + + // 鑾峰彇涓枃鏄熸湡鍑犲悕绉� + oItem.HWeekDay = chineseDayOfWeek[dayOfWeek]; + 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> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveSumGy_RestDayList")] + [HttpPost] + public object SaveSumGy_RestDayList([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_RestDay_Edit", 1, false, msg2)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + + JObject msgObj = JObject.Parse(msg1); + string HYear = msgObj["HYear"].ToString(); + string HNumber1 = msgObj["HDeptNumber"].ToString()+'-' + msgObj["HOrgNumber"].ToString(); + string HName1 = msgObj["HDeptName"].ToString()+'-'+msgObj["HOrgName"].ToString(); + string HOrgID = msgObj["HOrgID"].ToString(); + string HDeptID = msgObj["HDeptID"].ToString(); + bool HStopflag = bool.Parse(msgObj["HStopflag"].ToString()); + string HRemark= msgObj["HRemark"].ToString(); + string HUSEORGID= msgObj["HUSEORGID"].ToString(); + string HHelpCode= msgObj["HHelpCode"].ToString(); + string HMakeEmp = msg2; //鍒涘缓浜� + bool Sunday = Convert.ToBoolean(msgObj["Sunday"]); + bool Saturday = Convert.ToBoolean(msgObj["Saturday"]); + List<Tuple<DateTime, string>> sundaysInYear = GetSundaysInYear(Convert.ToInt32(HYear), Sunday, Saturday); + + foreach (var oItem in sundaysInYear) + { + Int64 HItemID = 0; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + //鑾峰彇鏈�澶D鍊艰祴鍊� + DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_RestDay ", "Gy_RestDay"); + 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; + } + DateTime HRestDay = oItem.Item1; + string HWeekDay = oItem.Item2; // 鑾峰彇鏄熸湡瀛楃涓� + string HDate = oItem.Item1.ToString("yyyyMMdd"); + string HNumber = ""; + string HName = ""; + HNumber = HNumber1 + '-' + HDate; + + HName = HName1 + '-' + HDate; + //鍏堟煡鐪嬫暟鎹簱鏈夋病鏈� + ds = oCN.RunProcReturn("select * from Gy_RestDay where HRestDay='" + HRestDay + "' and HOrgID='" + HOrgID + "' and HDeptID='" + HDeptID + "'", "Gy_RestDay"); + if (ds.Tables[0].Rows.Count<1) + { + oCN.RunProc("Insert into Gy_RestDay " + + " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + + ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID," + + "HOrgID,HDeptID,HRestDay,HWeekDay) " + + " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "',''," + 0 + + "," + 0 + "," + 0 + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "','" + DateTime.Now + "','" + HUSEORGID + "',' 鏈娴�','" + HMakeEmp + "','" + HUSEORGID + "'" + + ",'" + HOrgID.ToString() + "','" + HDeptID.ToString() + "','" + HRestDay.ToString() + "','" + HWeekDay.ToString() + "')"); + } + } + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + + /// <summary> + /// 浼戞伅鏃� 鑾峰彇淇℃伅 + /// </summary> + /// <returns></returns> + [Route("GetGy_RestDayDetailEdit")] + [HttpGet] + public ApiResult<DataSet> GetGy_RestDayDetailEdit(string HID) + { + var model = LuBaoSevice.GetGy_RestDayDetailEdit(HID); + return model; + } + + /// <summary> + /// 浼戞伅鏃� 鑾峰彇淇℃伅 + /// </summary> + /// <returns></returns> + [Route("GetGy_RestDayDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_RestDayDetail(string HName) + { + var model = LuBaoSevice.GetGy_RestDayDetail(HName); + return model; + } + + /// <summary> + /// 浼戞伅鏃� 鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_RestDay")] + [HttpGet] + public object DeltetGy_RestDay(string HItemID, string user) + { + DataSet ds; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_RestDay_Delete", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (string.IsNullOrWhiteSpace(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HItemID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran();//寮�濮嬩簨鍔� + + + oCN.RunProc("delete Gy_RestDay 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; + } + } + + //鑾峰彇涓�骞翠腑鐨勫懆鍏�,鍛ㄦ棩鎴栬�呬袱涓悓鏃惰幏鍙� + public List<Tuple<DateTime, string>> GetSundaysInYear(int HYear, bool Sunday,bool Saturday) + { + List<Tuple<DateTime, string>> Days = new List<Tuple<DateTime, string>>(); + DateTime startDate = new DateTime(HYear, 1, 1); + DateTime endDate = new DateTime(HYear, 12, 31); + //鏄熸湡澶╁嬀閫� + if (Sunday && !Saturday) + { + while (startDate <= endDate) + { + if (startDate.DayOfWeek == DayOfWeek.Sunday) + { + Days.Add(Tuple.Create(startDate, "鏄熸湡澶�")); + } + startDate = startDate.AddDays(1); + } + } + //鏄熸湡鍏� 鍕鹃�� + else if (!Sunday && Saturday) + { + while (startDate <= endDate) + { + if (startDate.DayOfWeek == DayOfWeek.Saturday) + { + Days.Add(Tuple.Create(startDate, "鏄熸湡鍏�")); + } + startDate = startDate.AddDays(1); + } + } + else if (Sunday && Saturday) + { + while (startDate <= endDate) + { + if (startDate.DayOfWeek == DayOfWeek.Saturday || startDate.DayOfWeek == DayOfWeek.Sunday) + { + string weekdayChinese; + if (startDate.DayOfWeek == DayOfWeek.Sunday) + { + weekdayChinese = "鏄熸湡澶�"; + Days.Add(Tuple.Create(startDate, weekdayChinese)); + } + else if (startDate.DayOfWeek == DayOfWeek.Saturday) + { + weekdayChinese = "鏄熸湡鍏�"; + Days.Add(Tuple.Create(startDate, weekdayChinese)); + } + } + startDate = startDate.AddDays(1); + } + } + return Days; + } + + //杩斿洖鐨勫瓧娈� + public class DayOfWeekInfo + { + public DateTime Date { get; set; } + public string DayOfWeekText { get; set; } + } + #endregion + + /// <summary> + /// 鐢ㄥ叧鑱斿伐搴忚幏鍙栦俊鎭� + /// </summary> + /// <returns></returns> + [Route("GetGy_UserProcessDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_UserProcessDetail(string HID) + { + var model = LuBaoSevice.GetGy_UserProcessBillDetail(HID); + return model; + } + + /// <summary> + /// 鐢ㄦ埛鍏宠仈鐢ㄦ埛鍒犻櫎 + /// </summary> + /// <returns></returns> + [Route("Xt_User/Gy_UserByUserListDrop")] + [HttpGet] + public object DeltetGy_Material(string HItemID, string user) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_UserByUser_Drop", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犲垹闄ゆ潈闄�"; + objJsonResult.data = null; + return objJsonResult; + } + 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_UserByUserRelation where HItemID=" + HItemID, "Gy_UserByUserRelation"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + oCN.RollBack();//鍥炴粴浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + oCN.RunProc("delete from Gy_UserByUserRelation where HItemID=" + HItemID); + + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "* 鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + oCN.RollBack();//鍥炴粴浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + + /// <summary> + /// 鐢ㄥ叧鑱旂墿鏂欒幏鍙栦俊鎭� + /// </summary> + /// <returns></returns> + [Route("GetGy_UserMaterDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_UserMaterDetail(string HID) + { + var model = LuBaoSevice.GetGy_UserMaterDetail(HID); + return model; + } + + + /// <summary> + /// 鐢ㄥ叧鑱斾粨搴撹幏鍙栦俊鎭� + /// </summary> + /// <returns></returns> + [Route("GetGy_UserStockRelationDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_UserStockRelationDetail(string HID) + { + var model = LuBaoSevice.GetGy_UserStockRelationDetail(HID); + return model; + } + + /// <summary> + /// 鐢ㄥ叧鑱旂敤鎴疯幏鍙栦俊鎭� + /// </summary> + /// <returns></returns> + [Route("Gy_UserByUserEdit")] + [HttpGet] + public ApiResult<DataSet> Gy_UserByUserEdit(string HID) + { + var model = LuBaoSevice.Gy_UserByUserEdit(HID); + return model; + } + + /// <summary> + /// 鐢ㄦ埛鍏宠仈鐝粍鑾峰彇淇℃伅 + /// </summary> + /// <returns></returns> + [Route("GetGy_UserGroupDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_UserGroupDetail(string HID) + { + var model = LuBaoSevice.GetGy_UserGroupBillDetail(HID); + return model; + } + + /// <summary> + /// 鐢ㄦ埛鍏宠仈渚涘簲鍟嗚幏鍙栦俊鎭� + /// </summary> + /// <returns></returns> + [Route("GetGy_UserSupplierDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_UserSupplierDetail(string HID) + { + var model = LuBaoSevice.GetGy_UserSupplierBillDetail(HID); + return model; + } + /// <summary> /// 鎶ュ簾鍘熷洜 @@ -2663,7 +11286,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"); @@ -2927,11 +11550,11 @@ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("Select HInterID,HEquipFileNumber,HName from Gy_EquipFileBillMain where 0=0 Order by HInterID ", "Gy_EquipFileBillMain"); + ds = oCN.RunProcReturn("Select HInterID,HEquipFileNumber,HName,HModel2 from Gy_EquipFileBillMain where 0=0 Order by HInterID ", "Gy_EquipFileBillMain"); } else { - string sql1 = "Select HInterID,HEquipFileNumber,HName from Gy_EquipFileBillMain where 0=0 "; + string sql1 = "Select HInterID,HEquipFileNumber,HName,HModel2 from Gy_EquipFileBillMain where 0=0 "; string sql = sql1 + sWhere; ds = oCN.RunProcReturn(sql, "Gy_EquipFileBillMain"); } @@ -3232,6 +11855,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> @@ -3300,11 +11976,11 @@ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("Select HItemID,HNumber 浠g爜,HName 鍚嶇О ,HQCCheckClassID 妫�楠岄」鐩被鍒� from Gy_QCCheckItem where HStopflag=0 Order by HItemID ", "Gy_QCCheckItem"); + ds = oCN.RunProcReturn("Select HItemID,HNumber 浠g爜,HName 鍚嶇О ,HQCCheckClassID 妫�楠岄」鐩被鍒�,HDefaultResult 榛樿缁撹 from Gy_QCCheckItem where HStopflag=0 Order by HItemID ", "Gy_QCCheckItem"); } else { - string sql = "Select HItemID,HNumber 浠g爜,HName 鍚嶇О ,HQCCheckClassID 妫�楠岄」鐩被鍒� from Gy_QCCheckItem where HStopflag=0 " + sWhere + "Order by HItemID "; + string sql = "Select HItemID,HNumber 浠g爜,HName 鍚嶇О ,HQCCheckClassID 妫�楠岄」鐩被鍒�,HDefaultResult 榛樿缁撹 from Gy_QCCheckItem where HStopflag=0 " + sWhere + "Order by HItemID "; ds = oCN.RunProcReturn(sql, "Gy_QCCheckItem"); } if (ds == null || ds.Tables[0].Rows.Count <= 0) @@ -3552,7 +12228,7 @@ /// <returns></returns> [Route("Web/GetCheckItemByCheckProjectID")] [HttpGet] - public object GetCheckItemByCheckProjectID(int CheckProjectID) + public object GetCheckItemByCheckProjectID(int CheckProjectID, int HBatchQty) { if (CheckProjectID <= 0) { @@ -3565,8 +12241,8 @@ try { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); - string sql = "select c.HItemID HQCCheckItemID,c.HName 妫�楠岄」鐩�,b.HQCStd,b.HQCUnit HUnit,b.HAnalysisMethod,b.HStatus HResult 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"; @@ -3670,19 +12346,24 @@ List<object> list = new List<object>(); DataSet ds2; DataSet ds1; - string sql1 = string.Format(@"select t.HMaintainItemID ,m.HNumber HMaintainItemNumber,t.HMaintainItem,t.HMaintainPart,t.HClaim,t.HManagerID,e.HNumber HManagerNumber,e.HName HManagerName,a.HRemark - from Sc_MouldMaintainRuleBillMain a left join Sc_MouldMaintainRuleBillSub_Item t on a.HInterID=t.HInterID - left join Gy_Maintain m on m.HItemID=t.HMaintainItemID - left join Gy_Employee e on e.HItemID=t.HManagerID - where a.HInterID=" + MouldMaintainRuleID); - string sql2 = string.Format(@"select b.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName, m.HModel HMaterSpec,b.HUnitID,u.HNumber HUnitNumber,u.HName HUnitName,b.HQty,b.HQtyMust,b.HRemark from Sc_MouldMaintainRuleBillMain a - left join Sc_MouldMaintainRuleBillSub b on a.HInterID=b.HInterID - left join h_v_IF_Material m on b.HMaterID=m.HItemID - left join h_v_IF_Unit u on b.HUnitID=u.HItemID - where a.HInterID=" + MouldMaintainRuleID); - ds1 = oCN.RunProcReturn(sql1, "Sc_MouldMaintainRuleBillMain");//淇濆吇 - ds2 = oCN.RunProcReturn(sql2, "Sc_MouldMaintainRuleBillMain");//閰嶄欢 + // string sql1 = string.Format(@"select t.HMaintainItemID ,m.HNumber HMaintainItemNumber,t.HMaintainItem,t.HMaintainPart,t.HClaim,t.HManagerID,e.HNumber HManagerNumber,e.HName HManagerName,a.HRemark + // from Sc_MouldMaintainRuleBillMain a left join Sc_MouldMaintainRuleBillSub_Item t on a.HInterID=t.HInterID + // left join Gy_Maintain m on m.HItemID=t.HMaintainItemID + // left join Gy_Employee e on e.HItemID=t.HManagerID + // where a.HInterID=" + MouldMaintainRuleID); + + // string sql2 = string.Format(@"select b.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName, m.HModel HMaterSpec,b.HUnitID,u.HNumber HUnitNumber,u.HName HUnitName,b.HQty,b.HQtyMust,b.HRemark from Sc_MouldMaintainRuleBillMain a + //left join Sc_MouldMaintainRuleBillSub b on a.HInterID=b.HInterID + // left join h_v_IF_Material m on b.HMaterID=m.HItemID + //left join h_v_IF_Unit u on b.HUnitID=u.HItemID + // where a.HInterID=" + MouldMaintainRuleID); + + string sql1 = string.Format(@"select * from h_v_Sc_MouldMaintainRuleBillSub_Item where hmainid=" + MouldMaintainRuleID); + string sql2 = string.Format(@"select * from h_v_Sc_MouldMaintainRuleBillSub where hmainid=" + MouldMaintainRuleID); + + ds1 = oCN.RunProcReturn(sql1, "h_v_Sc_MouldMaintainRuleBillSub_Item");//淇濆吇 + ds2 = oCN.RunProcReturn(sql2, "h_v_Sc_MouldMaintainRuleBillSub");//閰嶄欢 list.Add(ds1.Tables[0]); list.Add(ds2.Tables[0]); objJsonResult.code = "0"; @@ -3816,19 +12497,22 @@ List<object> list = new List<object>(); DataSet ds2; DataSet ds1; - string sql1 = string.Format(@"select t.HMaintainItemID HMaintainItemID,m.HNumber HMaintainItemNumber,t.HMaintainItem HMaintainItem,t.HMaintainPart HMaintainPart,t.HClaim HClaim,t.HManagerID HManagerID,e.HNumber HManagerNumber,e.HName HManagerName,a.HRemark - from Sb_EquipMaintainRuleBillMain a left join Sb_EquipMaintainRuleBillSub_Item t on a.HInterID=t.HInterID - left join Gy_Maintain m on m.HItemID=t.HMaintainItemID - left join Gy_Employee e on e.HItemID=t.HManagerID - where a.HInterID=" + EquipProjectID); - string sql2 = string.Format(@"select b.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName,b.HUnitID,u.HNumber HUnitNumber,u.HName HUnitName,b.HQty,b.HRemark from Sb_EquipMaintainRuleBillMain a - left join Sb_EquipMaintainRuleBillSub b on a.HInterID=b.HInterID - left join h_v_IF_Material m on b.HMaterID=m.HItemID - left join h_v_IF_Unit u on b.HUnitID=u.HItemID - where a.HInterID=" + EquipProjectID); + // string sql1 = string.Format(@"select t.HMaintainItemID HMaintainItemID,m.HNumber HMaintainItemNumber,t.HMaintainItem HMaintainItem,t.HMaintainPart HMaintainPart,t.HClaim HClaim,t.HManagerID HManagerID,e.HNumber HManagerNumber,e.HName HManagerName,a.HRemark + // from Sb_EquipMaintainRuleBillMain a left join Sb_EquipMaintainRuleBillSub_Item t on a.HInterID=t.HInterID + // left join Gy_Maintain m on m.HItemID=t.HMaintainItemID + // left join Gy_Employee e on e.HItemID=t.HManagerID + // where a.HInterID=" + EquipProjectID); + // string sql2 = string.Format(@"select b.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName,b.HUnitID,u.HNumber HUnitNumber,u.HName HUnitName,b.HQty,b.HRemark from Sb_EquipMaintainRuleBillMain a + //left join Sb_EquipMaintainRuleBillSub b on a.HInterID=b.HInterID + // left join h_v_IF_Material m on b.HMaterID=m.HItemID + //left join h_v_IF_Unit u on b.HUnitID=u.HItemID + // where a.HInterID=" + EquipProjectID); - ds1 = oCN.RunProcReturn(sql1, "Sb_EquipMaintainRuleBillMain");//淇濆吇 - ds2 = oCN.RunProcReturn(sql2, "Sc_MouldMaintainRuleBillMain");//閰嶄欢 + string sql1 = string.Format(@"select * from h_v_Sb_EquipMaintainRuleBillList where HInterID=" + EquipProjectID); + string sql2 = string.Format(@"select * from h_v_Sb_EquipMaintainRuleSub where hmainid=" + EquipProjectID); + + ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipMaintainRuleBillList");//淇濆吇 + ds2 = oCN.RunProcReturn(sql2, "h_v_Sb_EquipMaintainRuleSub");//閰嶄欢 list.Add(ds1.Tables[0]); list.Add(ds2.Tables[0]); objJsonResult.code = "0"; @@ -3900,6 +12584,269 @@ return objjson; } } + + /// <summary> + /// 鏍规嵁璁惧甯﹀嚭椤圭洰 + /// </summary> + /// <returns></returns> + [Route("Web/GetItemByEquipFile")] + [HttpGet] + public object GetItemByEquipFile(int EquipProjectID, string Type, string HDate) + { + 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); + string sql = string.Format(@"Exec h_p_Sb_GetCheckItem_PDA '" + EquipProjectID + "','" + Type + "','" + HDate + "'"); + 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/GetItemByMouldFile")] + [HttpGet] + public object GetItemByMouldFile(int MouldProjectID, string Type, string HDate) + { + if (MouldProjectID <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "浜у搧鍣ㄥ叿鏈�夋嫨"; + objjson.data = null; + return objjson; + } + try + { + string HView = ""; + switch (Type) + { + case "DJ": + HView = "h_v_QJ_GetDotCheckItemList"; + 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); + string sql = string.Format(@"Exec h_p_Sb_GetCheckItem_PDA '" + MouldProjectID + "','" + Type + "','" + HDate + "'"); + 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/GetItemByMouldDotCheckPlan")] + [HttpGet] + public object GetItemByMouldDotCheckPlan(int HInterID) + { + if (HInterID <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "浜у搧鍣ㄥ叿鐐规璁″垝鏈�夋嫨"; + objjson.data = null; + return objjson; + } + try + { + + string sql = string.Format(@"select * from h_v_QJ_GetDotCheckItemList where 鐐规璁″垝ID = " + HInterID); + ds = oCN.RunProcReturn(sql, "h_v_QJ_GetDotCheckItemList"); + 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, string user) + { + 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_EquipRepairWorkBillList"; + 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(); + + ds = oCN.RunProcReturn("select ManagerFlag from gy_czygl where czymc='" + user.Trim() + "'", "gy_czygl"); + if (!(bool)ds.Tables[0].Rows[0]["ManagerFlag"]) //鏄惁绠$悊鍛� + { + //涓嶆槸绠$悊鍛� + sWhere += " and 鍒跺崟浜� = '" + user + "'"; + } + + + 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> @@ -3919,13 +12866,8 @@ try { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); - string sql = string.Format(@"select b.HDotCheckItemID HDotCheckItemID,c.HNumber HDotCheckCode,b.HDotCheckItem,b.HDotCheckPart,b.HClaim, - b.HManagerID,e.HNumber HManagerCode,e.HName HManagerName,b.HRemark from Sb_EquipDotCheckRuleBillMain a - left join Sb_EquipDotCheckRuleBillSub b on a.HInterID=b.HInterID - left join Gy_QCCheckItem c on c.HItemID=b.HDotCheckItemID - left join Gy_Employee e on e.HItemID=b.HManagerID - where a.HInterID=" + HDotCheckRuleInterID); - ds = oCN.RunProcReturn(sql, "Sb_EquipDotCheckRuleBillMain"); + string sql = string.Format(@"select * from h_v_Sb_EquipDotCheckRuleBillList_PDA where HInterID=" + HDotCheckRuleInterID); + ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckRuleBillList_PDA"); if (ds == null || ds.Tables[0].Rows.Count <= 0) { objjson.code = "0"; @@ -3953,6 +12895,149 @@ } } + /// <summary> + /// 鏍规嵁璁惧淇濆吇瑙勭▼鏄剧ず璁惧淇濆吇绋嬮」鐩� + /// </summary> + /// <returns></returns> + [Route("Web/GetMaintainItemByMaintainRuleID")] + [HttpGet] + public object GetMaintainItemByMaintainRuleID(int HEquipMaintainRuleInterID) + { + if (HEquipMaintainRuleInterID <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "璁惧淇濆吇瑙勭▼鏈�夋嫨"; + objjson.data = null; + return objjson; + } + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + string sql = string.Format(@"select * from h_v_Sb_EquipMaintainRuleBillList_PDA where HInterID=" + HEquipMaintainRuleInterID); + ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainRuleBillList_PDA"); + 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/GetDotCheckRuleItemByDotCheckRuleID/Mould")] + [HttpGet] + public object GetDotCheckRuleItemByDotCheckRuleIDForMould(int HDotCheckRuleInterID) + { + if (HDotCheckRuleInterID <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鍣ㄥ叿鐐规瑙勭▼鏈�夋嫨"; + objjson.data = null; + return objjson; + } + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + string sql = string.Format(@"select * from h_v_Sc_MouldDotCheckRuleBillList_PDA where HInterID=" + HDotCheckRuleInterID); + ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldDotCheckRuleBillList_PDA"); + 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/GetMaintainItemByMaintainRuleID/Mould")] + [HttpGet] + public object GetMaintainItemByMaintainRuleIDForMould(int HMouldMaintainRuleInterID) + { + if (HMouldMaintainRuleInterID <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鍣ㄥ叿淇濆吇瑙勭▼鏈�夋嫨"; + objjson.data = null; + return objjson; + } + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + string sql = string.Format(@"select * from h_v_Sb_MouldMaintainRuleBillList_PDA where HInterID=" + HMouldMaintainRuleInterID); + ds = oCN.RunProcReturn(sql, "h_v_Sb_MouldMaintainRuleBillList_PDA"); + 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> /// 鑾峰彇缁翠慨椤圭洰鍒楄〃 @@ -4078,6 +13163,82 @@ } + + /// <summary> + /// 鑾峰彇閫夊崟鍙风殑婧愬崟绫诲瀷 + /// </summary> + /// <returns></returns> + [Route("Web/GetHSourceBillType")] + [HttpGet] + public object GetHSourceBillType(string HName, int Num) + { + try + { + ClsCN oCn = new ClsCN(); + DataSet oDs = new DataSet(); + //鏈夌殑鍗曞瓙婧愬崟鍒嗕负绾㈣摑鍗� 0浠h〃钃濆崟 1浠h〃绾㈠崟 + if (Num == 0) + { //婧愬崟涓鸿摑鍗� + oDs = oCn.RunProcReturn("select * from Xt_BillSourceSet where HName='" + HName + "'and HRedBlueFlag ='" + Num + "' ", "Xt_BillSourceSet"); + } + else if (Num == 1) + { //婧愬崟涓虹孩鍗� + oDs = oCn.RunProcReturn("select * from Xt_BillSourceSet where HName='" + HName + "' and HRedBlueFlag ='" + Num + "' ", "Xt_BillSourceSet"); + } + else if (Num == 2) + { //涓嶅垎绾㈣摑鍗� + oDs = oCn.RunProcReturn("select * from Xt_BillSourceSet where HName='" + HName + "'", "Xt_BillSourceSet"); + } + + objjson.code = "1"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛锛�"; + objjson.data = oDs.Tables[0]; + return objjson; ; + } + catch (Exception e) + { + + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触锛佸紓甯�" + e.ToString(); + objjson.data = null; + return objjson; ; + } + } + + + /// <summary> + /// 鑾峰彇閫夊崟鍙风殑婧愬崟绫诲瀷 + /// </summary> + /// <returns></returns> + [Route("Web/GetHSourceBillName")] + [HttpGet] + public object GetHSourceBillName(string HBillType) + { + try + { + ClsCN oCn = new ClsCN(); + DataSet oDs = new DataSet(); + //========== + oDs = oCn.RunProcReturn("select * from xt_BillType where HNumber='" + HBillType + "'", "xt_BillType"); + objjson.code = "1"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛锛�"; + objjson.data = oDs.Tables[0]; + return objjson; ; + } + catch (Exception e) + { + + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触锛佸紓甯�" + e.ToString(); + objjson.data = null; + return objjson; ; + } + } + #region [浠庢暟鎹簱鍔犺浇鑿滃崟] public class MenuLoad { @@ -4103,9 +13264,9 @@ SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //鏁版嵁搴撴搷浣滃伐鍏� 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锛屽垯娌℃湁璁剧疆杩囷紝鍔犺浇鎵�鏈夌殑鑿滃崟淇℃伅 + if (ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0) //鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁鏈夎缃繃鑷畾涔変俊鎭紝鑻ヨ褰曟暟涓�0锛屽垯娌℃湁璁剧疆杩囷紝鍔犺浇鎵�鏈夌殑鑿滃崟淇℃伅 { - sql = "Select * from Gy_Menu_1 where HType = '" + HType + "' Order by HPosition "; + sql = "Select * from Gy_Menu_1 where HType = '" + HType + "' Order by HPosition,len(HitemID),HitemID "; ds = oCn.RunProcReturn(sql, "Gy_Menu"); } @@ -4228,7 +13389,7 @@ List<MenuInit> menuInitList = new List<MenuInit>(); //鐢ㄤ互鑾峰彇Gy_Menu_1涓殑鎵�鏈夎彍鍗曚俊鎭紝浠ュ強瀵瑰簲鑺傜偣鏄惁琚�変腑闇�瑕佸姞杞芥樉绀� SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); - ds = oCn.RunProcReturn("Select * from Gy_Menu_1 where HType = '" +HType + "' 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鍒楄〃涓紝 @@ -4325,16 +13486,16 @@ //璁剧疆鏁版嵁搴撴搷浣滅殑鍥炴粴鐐癸紝鑻ュ湪鎻愪氦鍓嶆姤閿欙紝鍒欏洖婊氬埌璇ョ偣锛屾湡闂存搷浣滃彇娑� oCN.BeginTran(); - + //鍒犻櫎褰撳墠鐢ㄦ埛鐨勮嚜瀹氫箟鏁版嵁 string sql = "delete from Gy_MenuDefineSet where HMakeName = '" + HMakeName + "' and HType = '" + HTypes + "'"; oCN.RunProc(sql); //鎻掑叆褰撳墠鐢ㄦ埛鏈�鏂扮殑鑷畾涔夋暟鎹� - for(int i=0;i< saveDataList.Count; i++) + for (int i = 0; i < saveDataList.Count; i++) { sql = "select * from Gy_Menu_1 where HItemID = '" + saveDataList[i].HItemID + "'"; - ds = oCn.RunProcReturn(sql,"Gy_Menu_1"); + ds = oCn.RunProcReturn(sql, "Gy_Menu_1"); if (ds.Tables[0].Rows.Count > 0) { string HPartentID = ds.Tables[0].Rows[0]["HPartentID"].ToString(); @@ -4344,7 +13505,7 @@ string HType = ds.Tables[0].Rows[0]["HType"].ToString(); string HPicNum = ds.Tables[0].Rows[0]["HPicNum"].ToString(); - if(HPartentID == "0" || HPartentID == ds.Tables[0].Rows[0]["HItemID"].ToString()) + 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 + "')"; @@ -4355,12 +13516,12 @@ 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); } - + } } //鎻愪氦鏁版嵁搴撴搷浣� oCN.Commit(); - + objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; @@ -4793,15 +13954,15 @@ /// <returns></returns> [Route("Web/GetOtherInBillMain_TempList_New")] [HttpGet] - public object GetOtherInBillMain_TempList_New (string HBillType, string sHMaker, Int64 HOrgID) + public object GetOtherInBillMain_TempList_New(string HBillType, string sHMaker, Int64 HOrgID) { WebS.WebService1 oWebs = new WebS.WebService1(); try { List<object> columnNameList = new List<object>(); - + DataSet ds = oCN.RunProcReturn("exec h_p_KF_GetPonderationBillMain_TempList_New1 '" + HBillType + "','" + sHMaker + "'," + HOrgID.ToString(), "h_p_KF_GetPonderationBillMain_TempList_New1"); - + //娣诲姞鍒楀悕 foreach (DataColumn col in ds.Tables[0].Columns) { @@ -4847,12 +14008,12 @@ /// <returns></returns> [Route("Web/GetProcNoList")] [HttpGet] - public object GetProcNoList(int HInterID,string sWhere,string UserID) + public object GetProcNoList(int HInterID, string sWhere, string UserID) { List<object> columnNameList = new List<object>(); try { - ds = oCN.RunProcReturn("exec h_p_Sc_ProcNoList '" + HInterID + "','" + sWhere + "','" + UserID + "'" , "h_p_Sc_ProcNoList"); + ds = oCN.RunProcReturn("exec h_p_Sc_ProcNoList '" + HInterID + "','" + sWhere + "','" + UserID + "'", "h_p_Sc_ProcNoList"); objJsonResult.code = "1"; objJsonResult.count = 1; @@ -4871,6 +14032,155 @@ 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; + } + } + + /// <summary> + /// 鑾峰彇鍗曟嵁妯″潡鍚嶇О + /// </summary> + /// <returns></returns> + [Route("Web/GetModuleName")] + [HttpGet] + public object GetModuleName(string HModuleType) + { + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + ds = oCN.RunProcReturn("Select * from Xt_BillType where HNumber = '" + HModuleType + "'", "Xt_BillType"); + + 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; + } + } + } } -- Gitblit v1.9.1