From 2bb4e8c477e83df7bd16585b523e532fb258e685 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期一, 24 六月 2024 15:50:46 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs | 1174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 1,168 insertions(+), 6 deletions(-) diff --git a/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs index 9542814..3f55bdf 100644 --- a/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs +++ b/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs @@ -1,4 +1,6 @@ -锘縰sing DBUtility; +锘縰sing DAL; +using DBUtility; +using DLL; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; @@ -7,8 +9,11 @@ using System.Linq; using System.Net; using System.Net.Http; +using System.Timers; +using System.Threading.Tasks; using System.Web.Http; using WebAPI.Models; +using System.Threading; namespace WebAPI.Controllers.SCGL { @@ -31,6 +36,9 @@ public DAL.ClsOA_AndengFlowRuleBill BillOld1 = new DAL.ClsOA_AndengFlowRuleBill(); //瀵瑰簲鍗曟嵁绫� 瀹夌伅閫愮骇鍛煎彨瑙勫垯 public DAL.ClsOA_AndengFlowRuleBill BillNew1 = new DAL.ClsOA_AndengFlowRuleBill(); //瀵瑰簲鍗曟嵁绫� 瀹夌伅閫愮骇鍛煎彨瑙勫垯 + public DAL.ClsOA_WorkLinkBill BillOld2 = new DAL.ClsOA_WorkLinkBill(); //瀵瑰簲鍗曟嵁绫� 宸ヤ綔鑱旂郴鍗� + public DAL.ClsOA_WorkLinkBill BillNew2 = new DAL.ClsOA_WorkLinkBill(); //瀵瑰簲鍗曟嵁绫� 宸ヤ綔鑱旂郴鍗� + #region 鎶ュ伐骞冲彴寮傚父鍙嶉鍗曚繚瀛�/缂栬緫 /// <summary> @@ -40,7 +48,7 @@ /// <returns></returns> [Route("Sc_MESTransFerWorkBill/SaveGetMESTransFerWorkFrom")] [HttpPost] - public object SaveGetMESTransFerWorkFrom([FromBody] JObject msg) + public object SaveGetMESTransFerWorkFromAsync([FromBody] JObject msg) { var _value = msg["msg"].ToString(); @@ -148,7 +156,7 @@ objJsonResult.data = 1; return objJsonResult; } - + //string[] arrStr = oItem.HSendMan.Split(','); //鍙戦�佷汉 //arrStr = oItem.HReceiveMan.Split(','); //鎺ユ敹浜� string[] arrStr = oItem.HCopyMan.Split(','); //鎶勯�佷汉 @@ -162,7 +170,7 @@ Models.ClsOA_ErrMsgBackBillSub2 sb = new Models.ClsOA_ErrMsgBackBillSub2(); sb.HEntryID = i; sb.HReceiveMan = arrStr[i - 1]; - if (arrStr[i-1].ToString() == oItem.HSendMan) + if (arrStr[i - 1].ToString() == oItem.HSendMan) { sb.HReadFlag = true; } @@ -195,6 +203,7 @@ } } } + SaveOA_ErrMsgBackBillSub(msg2);//绗竴娆′繚瀛樺彂閫侀拤閽� } else @@ -393,7 +402,7 @@ if (sWhere == null || sWhere.Equals("")) { string sql = "select * from h_v_OA_ErrMsgBackBillList order by 鍗曟嵁鍙� desc"; - ds = oCN.RunProcReturn(sql, "p_v_OA_ErrMsgBackBillList"); + ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackBillList"); } else { @@ -515,10 +524,12 @@ A.HReceiveMan,A.HCopyMan,A.HHasten, A.HLevel,A.HMaterName,A.HMaterModel, B.HReadFlag, A.HMaker,A.HMakeDate,A.HUpDater,A.HUpDateDate,A.HChecker,A.HCheckDate,A.HCloseMan,A.HCloseDate,A.HDeleteMan,A.HDeleteDate, - A.HSourceInterID,A.HSourceEntryID,A.HSourceBillNo,A.HSourceBillType + A.HSourceInterID,A.HSourceEntryID,A.HSourceBillNo,A.HSourceBillType, + A.HHandleEmpID,f.HName HHandleEmpName from OA_ErrMsgBackBillMain A inner join OA_ErrMsgBackBillSub2 B on A.HInterID=B.HInterID left join Gy_Department D on A.HDeptID=D.HItemID + left join Gy_Employee f on A.HHandleEmpID=f.HItemID where A.HInterID='" + HID + "' and b.HEntryID='" + HEntryID + "'"); var dataSet = oCN.RunProcReturn(sql, "OA_ErrMsgBackBillMain"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) @@ -5486,5 +5497,1156 @@ #endregion #endregion + + #region 宸ヤ綔鑱旂郴鍗� + + #region 宸ヤ綔鑱旂郴鍗曚繚瀛�/缂栬緫 + /// <summary> + /// 宸ヤ綔鑱旂郴鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MESTransFerWorkBill/SaveOA_WorkLinkBill")] + [HttpPost] + public object SaveOA_WorkLinkBill([FromBody] JObject msg) + { + + var _value = msg["msg"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString();//涓昏〃鍐呭 + string UserName = sArray[1].ToString(); + string refSav = sArray[2].ToString(); + DBUtility.ClsPub.CurUserName = UserName; + + //淇濆瓨鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("OA_WorkLinkBill_Edit", 1, false, DBUtility.ClsPub.CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + //int sYear = 0; + //int sPeriod = 0; + //if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Now, ref sYear, ref sPeriod, ref s) == false) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = s; + // objJsonResult.data = null; + // return objJsonResult; + //} + + ListModels oListModels = new ListModels(); + try + { + DAL.ClsOA_WorkLinkBill oBill = new DAL.ClsOA_WorkLinkBill(); + List<Model.ClsOA_WorkLinkBillMain> lsmain = new List<Model.ClsOA_WorkLinkBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + var jsonString = "[" + msg2.ToString() + "]"; + lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsOA_WorkLinkBillMain>>(jsonString); + foreach (Model.ClsOA_WorkLinkBillMain oItem in lsmain) + { + if (refSav == "Add") + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew2.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = 1; + return objJsonResult; + } + } + if (refSav == "Update") + { + if (BillOld2.ShowBill(oItem.HInterID, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹湁璇紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鍒ゆ柇鏄惁鍙紪杈� + if (BillOld2.omodel.HChecker != "" && BillOld2.omodel.HChecker != null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + if (BillOld2.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld2, ref s)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s + "锛屼笉鍏佽淇敼"; + objJsonResult.data = 1; + return objJsonResult; + } + } + + DBUtility.ClsPub.CurUserName = oItem.HMaker; + oItem.HBillType = "4501"; + oItem.HBillSubType = "4501"; + oItem.HBillStatus = 1; //鍗曟嵁鐘舵�侊紙1鏈锛�2瀹℃牳閫氳繃锛�3鍏抽棴锛�4浣滃簾锛�5瀹℃牳閫�鍥�,6瀹℃牳涓�,7宸查槄锛�8宸插洖澶嶏紝9缁撴锛�10楠岃瘉,11涓嬭揪锛�12寮�宸�,13鐢宠瀹℃壒,15鐢宠妫�楠岋紝16 鍒ゅ畾鍚堟牸锛�17鍒ゅ畾涓嶅悎鏍硷級 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + + //string[] arrStr = oItem.HSendMan.Split(','); //鍙戦�佷汉 + //arrStr = oItem.HReceiveMan.Split(','); //鎺ユ敹浜� + string[] arrStr = oItem.HCopyMan.Split(','); //鎶勯�佷汉 + if (!string.IsNullOrEmpty(oItem.HCopyMan)) + { + arrStr = oItem.HCopyMan.Split(','); // 鎶勯�佷汉 + List<string> b = new List<string>(arrStr); + b.Add(oItem.HReceiveMan); + arrStr = b.ToArray(); + } + else + { + arrStr = oItem.HReceiveMan.Split(',');//鎺ユ敹浜� + } + //鎶勯�佷汉琛ㄤ綋鏁版嵁 + for (int i = 1; i <= arrStr.Length; i++) + { + Model.ClsOA_WorkLinkBillSub2 sb = new Model.ClsOA_WorkLinkBillSub2(); + sb.HEntryID = i; + sb.HReceiveMan = arrStr[i - 1]; + if (arrStr[i - 1].ToString() == oItem.HSendMan) + { + sb.HReadFlag = true; + } + oBill.DetailColl2.Add(sb); + } + oBill.omodel = oItem; + } + + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (refSav == "Add") + { + bResult = oBill.AddBillNew(ref DBUtility.ClsPub.sExeReturnInfo); + + } + else + { + bResult = oBill.ModifyBillNew(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + 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.Message; + objJsonResult.data = 1; + return objJsonResult; + } + } + #endregion + + #region 宸ヤ綔鑱旂郴鍗曞垪琛� + [Route("Sc_MESTransFerWorkBill/GetOA_WorkLinkBillList")] + [HttpGet] + public object GetOA_WorkLinkBillList(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("OA_WorkLinkBillList", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (sWhere == null || sWhere.Equals("")) + { + string sql = "select * from h_v_OA_WorkLinkBillAllList order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_OA_WorkLinkBillAllList"); + } + else + { + string sql1 = "select * from h_v_OA_WorkLinkBillAllList where 1 = 1 "; + string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_OA_WorkLinkBillAllList"); + } + + //娣诲姞鍒楀悕 + 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鍒楀璞$殑鍒楀悕 + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 宸ヤ綔鑱旂郴鍗曠紪杈戣幏鍙栨暟鎹� + [Route("Sc_MESTransFerWorkBill/GetOA_WorkLinkBillListCheckDetai")] + [HttpGet] + public object GetOA_WorkLinkBillListCheckDetai(string HID) + { + try + { + List<object> columnNameList = new List<object>(); + + string sql = string.Format(@"select A.*,D.HName HDeptName,e.HName HEvaluateStatusName + from OA_WorkLinkBillMain A + left join Gy_Department D on A.HDeptID=D.HItemID + left join Gy_EvaluateStatus AS e ON A.HEvaluateStatusID = e.HItemID + where A.HInterID='" + HID + "'" ); ; + ds = oCN.RunProcReturn(sql, "OA_WorkLinkBillMain"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + + } + #endregion + + #region[鏇存敼宸ヤ綔鑱旂郴鍗曢槄璇荤姸鎬乚 + [Route("Sc_MESTransFerWorkBill/UpdateOA_WorkLinkBillFlagMessage")] + [HttpGet] + public object UpdateOA_WorkLinkBillFlagMessage(string HInterID, string HEntryID) + { + oCN.BeginTran(); + oCN.RunProc("Update OA_WorkLinkBillSub2 set HReadFlag=1 where HInterID='" + HInterID + "' and HEntryID='" + HEntryID + "'", ref ClsPub.sExeReturnInfo); + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; ; + } + #endregion + + #region 宸ヤ綔鑱旂郴鍗曞垹闄� + /// <summary> + ///鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("Sc_MESTransFerWorkBill/DeltetOA_WorkLinkBill")] + [HttpGet] + public object DeltetOA_WorkLinkBill(string HInterID, string user) + { + try + { + + string s = ""; + DAL.ClsOA_WorkLinkBill BillOld = new DAL.ClsOA_WorkLinkBill(); + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("OA_WorkLinkBill_Delete", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (HInterID == null || HInterID.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹湁璇紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鍒ゆ柇鏄惁鍙垹闄� + if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽鍒犻櫎锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oCN.BeginTran(); + oCN.RunProc("Delete From OA_WorkLinkBillMain where HInterID = " + HInterID); + oCN.RunProc("Delete From OA_WorkLinkBillSub2 where HInterID = " + HInterID); + oCN.RunProc("Delete From OA_WorkLinkBillSub where HInterID = " + HInterID); + oCN.Commit(); + + + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 宸ヤ綔鑱旂郴鍗� 瀹℃牳/鍙嶅鏍� + /// <summary> + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param> + /// <param name="CurUserName">瀹℃牳浜�</param> + /// <returns></returns> + [Route("Sc_MESTransFerWorkBill/AuditOA_WorkLinkBill")] + [HttpGet] + public object AuditOA_WorkLinkBill(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "OA_WorkLinkBill_Check"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + if (HInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsOA_WorkLinkBill oBill = new DAL.ClsOA_WorkLinkBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍稿垽鏂� + { + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran(); + + //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣� + if (IsAudit == 0) //瀹℃牳鎻愪氦 + { + //瀹℃牳鍗曟嵁 + if (!oBill.CheckBill(HInterID, ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍告彁浜� + { + //鍙嶅鏍稿崟鎹� + if (!oBill.AbandonCheck(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 + + #region 宸ヤ綔鑱旂郴鍗� 鍏抽棴/鍙嶅叧闂� + /// <summary> + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">鍏抽棴(0),鍙嶅叧闂�(1)</param> + /// <param name="CurUserName">鍏抽棴浜�</param> + /// <returns></returns> + [Route("Sc_MESTransFerWorkBill/CloseOA_WorkLinkBill")] + [HttpGet] + public object CloseOA_WorkLinkBill(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "OA_WorkLinkBill_Close"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //妫�鏌ユ潈闄� + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍏抽棴澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + if (HInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsOA_WorkLinkBill oBill = new DAL.ClsOA_WorkLinkBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //鍏抽棴鍒ゆ柇 + { + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅叧闂垽鏂� + { + if (oBill.omodel.HCloseMan.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸弽鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + //杩涜闇�瑕佽繘琛岀殑鍏抽棴/鍙嶅叧闂搷浣� + if (IsAudit == 0) //鍏抽棴鎻愪氦 + { + //鍏抽棴鎻愪氦 + if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍏抽棴鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅叧闂彁浜� + { + //鍙嶅叧闂彁浜� + if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅叧闂垚鍔�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + 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="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">浣滃簾(0),鍙嶄綔搴�(1)</param> + /// <param name="CurUserName">浣滃簾浜�</param> + /// <returns></returns> + [Route("Sc_MESTransFerWorkBill/DropOA_WorkLinkBill")] + [HttpGet] + public object DropOA_WorkLinkBill(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "OA_WorkLinkBill_Delete"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //妫�鏌ユ潈闄� + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浣滃簾澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + if (HInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsOA_WorkLinkBill oBill = new DAL.ClsOA_WorkLinkBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //浣滃簾鍒ゆ柇 + { + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶄綔搴燂紒"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶄綔搴熷垽鏂� + { + if (oBill.omodel.HDeleteMan.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈綔搴�!涓嶉渶瑕佸弽浣滃簾锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + + + //杩涜闇�瑕佽繘琛岀殑浣滃簾/鍙嶄綔搴熸搷浣� + if (IsAudit == 0) //浣滃簾鎻愪氦 + { + //浣滃簾鎻愪氦 + if (oBill.Cancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "浣滃簾鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅叧闂彁浜� + { + //鍙嶅叧闂彁浜� + if (oBill.AbandonCancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶄綔搴熸垚鍔�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + 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("Sc_MESTransFerWorkBill/ReplyOA_WorkLinkBill")] + [HttpPost] + public object ReplyOA_WorkLinkBill([FromBody] JObject msg) + { + + var _value = msg["msg"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); + string UserName = sArray[1].ToString(); + //string refSav = sArray[2].ToString(); + DBUtility.ClsPub.CurUserName = UserName; + + //淇濆瓨鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("OA_WorkLinkBill_Edit", 1, false, DBUtility.ClsPub.CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + //int sYear = 0; + //int sPeriod = 0; + //if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Now, ref sYear, ref sPeriod, ref s) == false) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = s; + // objJsonResult.data = null; + // return objJsonResult; + //} + + ListModels oListModels = new ListModels(); + try + { + DAL.ClsOA_WorkLinkBill oBill = new DAL.ClsOA_WorkLinkBill(); + List<Model.ClsOA_WorkLinkBillSub> lsmain = new List<Model.ClsOA_WorkLinkBillSub>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + + var jsonString = "[" + msg2.ToString() + "]"; + lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsOA_WorkLinkBillSub>>(jsonString); + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + if (lsmain[0].HInterID != 0) + { + + oCN.BeginTran(); + + DataSet Ds = oCN.RunProcReturn("select count(HInterID) as num from OA_WorkLinkBillSub where HInterID = " + lsmain[0].HInterID + " group by HInterID ", "OA_WorkLinkBillSub"); + + Int64 num = 0; + + if (Ds.Tables[0].Rows.Count == 0) + { + num = 1; + } + else + { + num = Convert.ToInt64(Ds.Tables[0].Rows[0]["num"]) + 1; + } + + //涓昏〃 + oCN.RunProc("Insert Into OA_WorkLinkBillSub " + + "(HInterID,HEntryID,HRemark,HSendStatus,HSendMan" + + ",HDescription,HDate" + + ",HCloseMan,HEntryCloseDate,HCloseType,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ") " + + " values(" + lsmain[0].HInterID + "," + num + ",'" + lsmain[0].HRemark + "'," + 1 + ",'" + lsmain[0].HSendMan + "'" + + ",'" + lsmain[0].HDescription + "','" + lsmain[0].HDate + "','" + lsmain[0].HCloseMan + "','" + "" + "'" + + "," + 0 + "," + lsmain[0].HSourceInterID + "," + lsmain[0].HSourceEntryID + ",'" + lsmain[0].HSourceBillNo + "'" + + ",'" + lsmain[0].HSourceBillType + "'," + lsmain[0].HRelationQty + "," + lsmain[0].HRelationMoney + + ") "); + + oCN.Commit(); + 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.Message; + objJsonResult.data = 1; + return objJsonResult; + } + } + #endregion + + #region 宸ヤ綔鑱旂郴鍗曞洖澶嶈幏鍙栨暟鎹� + [Route("Sc_MESTransFerWorkBill/GetOA_WorkLinkBillSub")] + [HttpGet] + public object GetOA_WorkLinkBillSub(string HInterID, string user) + { + try + { + + string sql = "select * from OA_WorkLinkBillSub where HInterID = '" + HInterID + "'order by HDate desc"; + ds = oCN.RunProcReturn(sql, "OA_WorkLinkBillSub"); + + 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("Sc_MESTransFerWorkBill/UpdateOA_WorkLinkBillSubStatus")] + [HttpGet] + public object UpdateOA_WorkLinkBillSubStatus(Int64 HInterID, string HEntryID, Int64 Type) + { + try + { + string sql = ""; + switch (Type) + { + case 9: + sql = "update OA_WorkLinkBillSub set HSendStatus = 9 where HInterID = " + HInterID + " and HEntryID in (" + HEntryID + ")"; + break; + case 10: + sql = "update OA_WorkLinkBillSub set HSendStatus = 10 where HInterID = " + HInterID + " and HEntryID in (" + HEntryID + ")"; + break; + } + + oCN.RunProc(sql); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 宸ヤ綔鑱旂郴鍗曞偓淇� + [Route("Sc_MESTransFerWorkBill/UpdateOA_WorkLinkBillHHasten")] + [HttpGet] + public object UpdateOA_WorkLinkBillHHasten(Int64 HInterID,string CurUserName) + { + try + { + //鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("OA_WorkLinkBill_Edit", 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + if (HInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); + DAL.ClsOA_WorkLinkBill oBill = new DAL.ClsOA_WorkLinkBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍌績锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍌績锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + string sql = "update OA_WorkLinkBillMain set HHasten = HHasten + 1 where HInterID = " + HInterID ; + + oCN.RunProc(sql); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 宸ヤ綔鑱旂郴鍗曟牴鎹簮鍗旾D鏌ョ湅鏄惁鏈夊搴旇仈绯诲崟 + [Route("Sc_MESTransFerWorkBill/GetOA_WorkLinkBillListBySourceID")] + [HttpGet] + public object GetOA_WorkLinkBillListBySourceID(string HRelationInterID, string HRelationEntryID) + { + try + { + List<object> columnNameList = new List<object>(); + + string sql = string.Format(@"select A.*,D.HName HDeptName,e.HName HEvaluateStatusName + from OA_WorkLinkBillMain A + left join Gy_Department D on A.HDeptID=D.HItemID + left join Gy_EvaluateStatus AS e ON A.HEvaluateStatusID = e.HItemID + where A.HRelationInterID='" + HRelationInterID + "' and A.HRelationEntryID= '"+ HRelationEntryID+"'"); ; + ds = oCN.RunProcReturn(sql, "OA_WorkLinkBillMain"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + + } + #endregion + + #endregion + + #region 寮傚父鍙嶉鍗曚繚瀛樺悗,寰�瀛愯〃閲岄潰鍘绘彃鍏ユ暟鎹� + public object SaveOA_ErrMsgBackBillSub(string msg2) + { + msg2 = "[" + msg2.ToString() + "]"; + List<ClsOA_ErrMsgBackBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsOA_ErrMsgBackBillMain>>(msg2); + + long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D + string HReceiveMan = mainList[0].HReceiveMan;//鎺ユ敹浜� + string HDescription = mainList[0].HDescription;//鍐呭 + int HEntryID = 1; + + string sql = "insert into OA_ErrMsgBackBillSub2 values('" + HInterID + "','" + HEntryID + "','" + HReceiveMan + "','0')"; + oCN.RunProcReturn(sql, "OA_ErrMsgBackBillSub2"); + //鐩存帴鍙戦�侀拤閽夋秷鎭� s + FistDingDingMesAsync(HReceiveMan, HDescription); + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎻掑叆鎴愬姛,寮�濮嬫墽琛屽畾鏃朵换鍔�,閽夐拤鍙戦�佹秷鎭�"; + objJsonResult.data = 1; + return objJsonResult; + } + + /// <summary> + /// 寮傚父鍙嶉鍗曠涓�娆′繚瀛樼殑鏃跺�欒繘琛屽彂閫佹秷鎭� + /// </summary> + /// <param name="HReceiveMan"></param> + /// <param name="HDescription"></param> + public async void FistDingDingMesAsync(string HReceiveMan, string HDescription) + { + + ds = oCN.RunProcReturn("select * from Gy_Czygl where Czymc='" + HReceiveMan + "'", "Gy_Czygl"); + string DDUserID = ds.Tables[0].Rows[0]["DDUserID"].ToString(); //閽夐拤鐢ㄦ埛鐨刬d + Cls_DDMsg msg = new Cls_DDMsg(); + string appKey = "dingrsrzhdyn3mlaof95"; + string appSecret = "RAqH6YtZnPLCpDbuqfaYQkKkVtVdS0wqfC8I26X6qiS-8eoCJCNrzx3fubGND4Sq"; + //鑾峰彇浼佷笟鐨刟ccess_token鐨勫�� + string response = msg.GetAccessToken(appKey, appSecret); + JObject responseJson = JObject.Parse(response); + // 鑾峰彇access_token鐨勫�� + string accessToken = responseJson["accessToken"].ToString(); + //璋冪敤鏂规硶鍙戦�佹秷鎭� + string agentId = "3118119317"; //浼佷笟鍐呴儴灏忕▼搴廼d + string deptIdList = "0"; // 绌哄瓧绗︿覆琛ㄧず涓嶆寚瀹氶儴闂� + string toAllUser = "false"; + string message = HDescription;//寮傚父鍙嶉鍗曠殑鍐呭 + response = await msg.SendTextMessage(accessToken, agentId, DDUserID, deptIdList, toAllUser, message); + Console.WriteLine($"鍒濆娑堟伅鍙戦�佺粨鏋�: {response}"); + } + + #endregion } } \ No newline at end of file -- Gitblit v1.9.1