/// <summary> /// 传递流消息(走流程) /// </summary> /// <param name="msgContent">消息内容</param> /// <param name="receivedRole">接收方角色</param> void PassFlowMessage(string msgContent, CE_RoleEnum receivedRole) { try { Flow_BillFlowMessage msg = m_billFlowMsg.GetMessage(BasicInfo.LoginID, labelTitle.Text, txtBill_ID.Text); if (msg == null) { return; } msg.发起方用户编码 = BasicInfo.LoginID; msg.发起方消息 = msgContent; msg.接收方类型 = BillFlowMessage_ReceivedUserType.角色.ToString(); msg.接收方 = receivedRole.ToString(); msg.期望的处理完成时间 = null; m_billFlowMsg.ContinueMessage(BasicInfo.LoginID, msg); SendFinishedFlagToMessagePromptForm(txtBill_ID.Text); } catch (Exception exce) { Console.WriteLine(exce.Message); } }
/// <summary> /// 初始化已处理单据 /// </summary> /// <param name="mode">初始化模式</param> private void InitFinishedBill(InitMode mode) { IQueryable <Flow_BillFlowMessage> result = m_billMsg.GetMessage(BasicInfo.LoginID); List <Flow_BillFlowMessage> dataSource = (from r in result where r.单据状态 == BillStatus.已完成.ToString() orderby r.单据类型, r.发起时间 select r).ToList(); treeView.Nodes.Find("任务_已处理_单据", true)[0].Text = string.Format("单据({0})", dataSource.Count); if (mode == InitMode.刷新数据显示) { m_curNodeType = NodeType.已处理单据节点; dataGridView1.DataSource = new BindingCollection <Flow_BillFlowMessage>(dataSource); dataGridView1.Columns[0].Width = 60; dataGridView1.Columns[1].Width = 80; dataGridView1.Columns[3].Width = 80; dataGridView1.Columns[4].Width = 80; dataGridView1.Tag = dataSource; } }
/// <summary> /// 传递流消息(走流程) /// </summary> /// <param name="msgContent">消息内容</param> /// <param name="receivedRole">接收方角色</param> void PassFlowMessage(string msgContent, CE_RoleEnum receivedRole) { Flow_BillFlowMessage msg = m_billFlowMsg.GetMessage(BasicInfo.LoginID, labelTitle.Text, m_strBillID); if (msg == null) { return; } msg.发起方用户编码 = BasicInfo.LoginID; msg.发起方消息 = msgContent; msg.接收方类型 = BillFlowMessage_ReceivedUserType.角色.ToString(); msg.接收方 = receivedRole.ToString(); msg.期望的处理完成时间 = null; m_billFlowMsg.ContinueMessage(BasicInfo.LoginID, msg); SendFinishedFlagToMessagePromptForm(m_strBillID); }
/// <summary> /// 传递流消息(走流程) /// </summary> /// <param name="billNo">单据号</param> /// <param name="msgContent">消息内容</param> /// <param name="receivedRole">接收方角色</param> void PassFlowMessage(string billNo, string msgContent, CE_RoleEnum receivedRole) { Flow_BillFlowMessage msg = m_billFlowMsg.GetMessage(BasicInfo.LoginID, labelTitle.Text, billNo); if (msg == null) { return; } msg.发起方用户编码 = BasicInfo.LoginID; msg.发起方消息 = string.Format("【用途】:{0} 【退库类别】:{1} 【申请人】:{2} ※※※ 等待【{3}】处理", txtPurpose.Text, cmbType.Text, txtProposer.Text, receivedRole.ToString()); msg.接收方类型 = BillFlowMessage_ReceivedUserType.角色.ToString(); msg.接收方 = receivedRole.ToString(); msg.期望的处理完成时间 = null; m_billFlowMsg.ContinueMessage(BasicInfo.LoginID, msg); SendFinishedFlagToMessagePromptForm(billNo); }
/// <summary> /// 重新窗体消息处理函数 /// </summary> /// <param name="m">窗体消息</param> protected override void DefWndProc(ref Message m) { switch (m.Msg) { //接收自定义消息,放弃未提交的单据号 case WndMsgSender.CloseMsg: break; case WndMsgSender.PositioningMsg: WndMsgData msg = new WndMsgData(); //这是创建自定义信息的结构 Type dataType = msg.GetType(); msg = (WndMsgData)m.GetLParam(dataType); //这里获取的就是作为LParam参数发送来的信息的结构 DataTable dtMessage = UniversalFunction.PositioningOneRecord(msg.MessageContent, "重新打印"); if (dtMessage.Rows.Count == 0) { Flow_BillFlowMessage billmsg = m_billFlowMsg.GetMessage(BasicInfo.LoginID, "重新打印", msg.MessageContent); m_billFlowMsg.DestroyMessage(BasicInfo.LoginID, billmsg.序号); MessageDialog.ShowPromptMessage("未找到相关记录"); } else { dgvShowInfo.DataSource = dtMessage; dgvShowInfo.Rows[0].Selected = true; } break; default: base.DefWndProc(ref m); break; } }
/// <summary> /// 获取消息 /// </summary> /// <param name="billNo">单据号</param> /// <returns>成功返回获取到的消息,失败返回null</returns> private Flow_BillFlowMessage GetMessage(string billNo) { if (m_billType == null || m_billType == "") { m_billType = GetBillType(billNo); } Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(m_billType), "单据类别不能为空"); Debug.Assert(!GlobalObject.GeneralFunction.IsNullOrEmpty(billNo), "单据号不能为空"); try { Flow_BillFlowMessage msg = m_billFlowMsg.GetMessage(BasicInfo.LoginID, m_billType, billNo); if (msg == null) { m_logManagement.WriteException(string.Format("没有找到对应的单据消息,类型【{0}】,单据号【{1}】,操作人【{2},{3}】", m_billType, billNo, BasicInfo.LoginID, BasicInfo.LoginName), out m_error); } //if (msg == null) //{ // StackTrace st = new StackTrace(); // for (int i = 0; i < st.FrameCount; i++) // { // if (st.GetFrame(st.FrameCount - 1 - i).GetMethod().Name.Contains("SaveData")) // { // return null; // } // } // m_logManagement.WriteException( // string.Format("没有找到对应的单据消息:{0},{1}", BasicInfo.LoginID, billNo), out m_error); // return null; //} return(msg); } catch (Exception exce) { m_logManagement.WriteException(exce.Message + "\t\r" + exce.StackTrace, out m_error); return(null); } }