/// <summary> /// 结束流消息(流程已经走完) /// </summary> /// <param name="billNo">单据号</param> /// <param name="msgContent">消息内容</param> void EndFlowMessage(string billNo, string msgContent) { Flow_BillFlowMessage msg = m_billFlowMsg.GetMessage(BasicInfo.LoginID, labelTitle.Text, billNo); if (msg == null) { return; } m_billFlowMsg.EndMessage(BasicInfo.LoginID, msg.序号, msgContent); SendFinishedFlagToMessagePromptForm(billNo); #region 发送知会消息 string content = string.Format("{0} 号采购退货单已经处理完毕", msg.单据流水号); List <string> noticeRoles = new List <string>(); noticeRoles.AddRange(m_billMessageServer.GetDeptDirectorRoleName( dataGridView1.SelectedRows[0].Cells["申请部门编码"].Value.ToString())); noticeRoles.Add(CE_RoleEnum.会计.ToString()); noticeRoles.Add(CE_RoleEnum.质量总监.ToString()); noticeRoles.Add(CE_RoleEnum.质控主管.ToString()); noticeRoles.Add(CE_RoleEnum.质量工程师.ToString()); m_billMessageServer.NotifyMessage(msg.单据类型, msg.单据号, content, BasicInfo.LoginID, noticeRoles, null); #endregion 发送知会消息 }
/// <summary> /// 结束流消息(流程已经走完) /// </summary> /// <param name="msgContent">消息内容</param> void EndFlowMessage(string msgContent) { Flow_BillFlowMessage msg = m_billFlowMsg.GetMessage(BasicInfo.LoginID, labelTitle.Text, m_strBillID); if (msg == null) { return; } m_billFlowMsg.EndMessage(BasicInfo.LoginID, msg.序号, msgContent); SendFinishedFlagToMessagePromptForm(m_strBillID); #region 发送知会消息 StringBuilder sb = new StringBuilder(); sb.AppendFormat("{0} 号自制件工装报检已经处理完毕, ", msg.单据流水号); List <string> noticeRoles = new List <string>(); noticeRoles.Add(CE_RoleEnum.工装管理员.ToString()); List <string> noticeUsers = new List <string>(); noticeUsers.Add(msg.初始发起方用户编码); m_billMessageServer.NotifyMessage(msg.单据类型, msg.单据号, sb.ToString(), BasicInfo.LoginID, noticeRoles, noticeUsers); #endregion 发送知会消息 }
/// <summary> /// 结束流消息(流程已经走完) /// </summary> /// <param name="msgContent">消息内容</param> void EndFlowMessage(string msgContent) { try { Flow_BillFlowMessage msg = m_billFlowMsg.GetMessage(BasicInfo.LoginID, labelTitle.Text, txtBill_ID.Text); if (msg == null) { return; } m_billFlowMsg.EndMessage(BasicInfo.LoginID, msg.序号, msgContent); SendFinishedFlagToMessagePromptForm(txtBill_ID.Text); #region 发送知会消息 List <string> noticeUsers = new List <string>(); noticeUsers.Add(msg.初始发起方用户编码); m_billMessageServer.NotifyMessage(msg.单据类型, msg.单据号, msgContent, BasicInfo.LoginID, null, noticeUsers); #endregion 发送知会消息 } catch (Exception exce) { Console.WriteLine(exce.Message); } }
/// <summary> /// 结束流消息(流程已经走完) /// </summary> /// <param name="billNo">单据号</param> /// <param name="message">消息内容</param> /// <param name="noticeRoles">要知会的角色列表</param> /// <param name="noticeUsers">要知会的用户列表</param> /// <returns>操作是否成功的标志</returns> public bool EndFlowMessage(string billNo, string message, List <string> noticeRoles, List <string> noticeUsers) { if (m_billType == null || m_billType == "") { m_billType = GetBillType(billNo); } Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(m_billType), "单据类别不能为空"); Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(billNo), "单据号不能为空"); Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(message), "消息不能为空"); //Debug.Assert(noticeRoles != null, "要知会的角色列表不能为空"); try { m_logManagement.WriteException(string.Format("进入EndFlowMessage, BillNo:{0},Msg:{1}", billNo, message), out m_error); Flow_BillFlowMessage msg = GetMessage(billNo); if (msg != null) { m_billFlowMsg.EndMessage(BasicInfo.LoginID, msg.序号, message); // 2014-11-17 14:55 增加判断,如果没有角色和知会用户时不发送知会消息 if ((noticeRoles != null && noticeRoles.Count > 0) || (noticeUsers != null && noticeUsers.Count > 0)) { // 获取要知会的用户编码 List <string> lstNoticeUser = GetUserCodes(noticeRoles, noticeUsers); if (!lstNoticeUser.Contains(msg.初始发起方用户编码)) { lstNoticeUser.Add(msg.初始发起方用户编码); } // 发送知会消息 NotifyMessage(msg.单据类型, msg.单据号, message, BasicInfo.LoginID, noticeRoles, lstNoticeUser); } SendFinishedFlagToMessagePromptForm(billNo); } else { m_logManagement.WriteException(string.Format("没有找到单据消息,主动添加消息。EndFlowMessage, BillNo:{0},Msg:{1}", billNo, message), out m_error); BillFlowMessage_ReceivedUserType receivedUserType = BillFlowMessage_ReceivedUserType.用户; if (noticeRoles != null && noticeRoles.Count > 0) { receivedUserType = BillFlowMessage_ReceivedUserType.角色; } msg = new Flow_BillFlowMessage(); msg.初始发起方用户编码 = BasicInfo.LoginID; msg.单据号 = billNo; msg.单据类型 = m_billType; msg.单据流水号 = billNo; msg.接收方类型 = receivedUserType.ToString(); msg.单据状态 = BillStatus.已完成.ToString(); msg.发起方消息 = message; msg.接收方 = StapleFunction.CreateSplitString(",", receivedUserType == BillFlowMessage_ReceivedUserType.角色 ? noticeRoles : noticeUsers); msg.期望的处理完成时间 = null; m_billFlowMsg.SendRequestMessage(BasicInfo.LoginID, msg); } return(true); } catch (Exception) { throw; } }