| | |
| | | |
| | | //string[] arrStr = oItem.HSendMan.Split(','); //发送人 |
| | | //arrStr = oItem.HReceiveMan.Split(','); //接收人 |
| | | string[] arrStr = oItem.HCopyMan.Split(','); //抄送人 |
| | | string[] arrStr; |
| | | |
| | | if (string.IsNullOrEmpty(oItem.HCopyMan)) |
| | | { |
| | | arrStr = new string[0]; // 如果 oItem.HCopyMan 为空,则赋值为空数组 |
| | | } |
| | | else |
| | | { |
| | | arrStr = oItem.HCopyMan.Split(','); // 否则,使用 Split(',') 方法拆分字符串 |
| | | } |
| | | List<string> b = new List<string>(arrStr); |
| | | b.Add(oItem.HSendMan); |
| | | b.Add(oItem.HReceiveMan); |
| | |
| | | } |
| | | oBill.DetailColl2.Add(sb); |
| | | } |
| | | |
| | | oBill.omodel = oItem; |
| | | } |
| | | |
| | |
| | | bool bResult; |
| | | if (refSav == "Add") |
| | | { |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (bResult) |
| | | { |
| | | objJsonResult.HInterID = DBUtility.ClsPub.sExeReturnInfo; //返回主ID |
| | |
| | | { |
| | | objJsonResult.Verify = "N"; |
| | | } |
| | | } |
| | | } |
| | | SaveOA_ErrMsgBackBillSub(msg2);//第一次保存发送钉钉 |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | |
| | | A.HQty,A.HSendType, |
| | | A.HDeptID,D.HName HDeptName, A.HSendMan, |
| | | A.HReceiveMan,A.HCopyMan,A.HHasten, |
| | | A.HLevel,A.HMaterName,A.HMaterModel, |
| | | A.HLevel,A.HMaterNumber,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.HHandleEmpID,f.HName HHandleEmpName |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 异常反馈单保存后,往子表里面去插入数据 |
| | | public object SaveOA_ErrMsgBackBillSub(string msg2) |
| | | |
| | | |
| | | #region 异常反馈单查询(接收的,发送的,抄送的) |
| | | |
| | | [Route("Sc_MESTransFerWorkBill/GetSc_MESTransFerWorkBillQuery")] |
| | | [HttpGet] |
| | | public object GetSc_MESTransFerWorkBillQuery(string user) |
| | | { |
| | | msg2 = "[" + msg2.ToString() + "]"; |
| | | List<ClsOA_ErrMsgBackBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsOA_ErrMsgBackBillMain>>(msg2); |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | long HInterID = mainList[0].HInterID;//递入type得到的单据ID |
| | | string HReceiveMan = mainList[0].HReceiveMan;//接收人 |
| | | string HDescription = mainList[0].HDescription;//内容 |
| | | int HEntryID = 1; |
| | | ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackSelfQuery " + user, "h_p_OA_ErrMsgBackSelfQuery"); |
| | | |
| | | string sql = "insert into OA_ErrMsgBackBillSub2 values('" + HInterID + "','" + HEntryID + "','" + HReceiveMan + "','0')"; |
| | | oCN.RunProcReturn(sql, "OA_ErrMsgBackBillSub2"); |
| | | //直接发送钉钉消息 s |
| | | FistDingDingMesAsync(HReceiveMan, HDescription); |
| | | if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | { |
| | | //添加列名 |
| | | 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));//获取到DataColumn列对象的列名 |
| | | } |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无数据"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | 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(); //钉钉用户的id |
| | | Cls_DDMsg msg = new Cls_DDMsg(); |
| | | string appKey = "dingrsrzhdyn3mlaof95"; |
| | | string appSecret = "RAqH6YtZnPLCpDbuqfaYQkKkVtVdS0wqfC8I26X6qiS-8eoCJCNrzx3fubGND4Sq"; |
| | | //获取企业的access_token的值 |
| | | string response = msg.GetAccessToken(appKey, appSecret); |
| | | JObject responseJson = JObject.Parse(response); |
| | | // 获取access_token的值 |
| | | string accessToken = responseJson["accessToken"].ToString(); |
| | | //调用方法发送消息 |
| | | string agentId = "3118119317"; //企业内部小程序id |
| | | string deptIdList = "0"; // 空字符串表示不指定部门 |
| | | string toAllUser = "false"; |
| | | string message = HDescription;//异常反馈单的内容 |
| | | response = await msg.SendTextMessage(accessToken, agentId, DDUserID, deptIdList, toAllUser, message); |
| | | Console.WriteLine($"初始消息发送结果: {response}"); |
| | | } |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |