Пример #1
0
        //放弃认领
        private void btnUnClaim_Click(object sender, EventArgs e)
        {
            var holdCursor = this.Cursor;

            this.Cursor = Cursors.WaitCursor;
            try
            {
                var wfRuntime = new WorkFlowRuntime
                {
                    UserId             = UserInfo.Id,
                    WorkTaskInstanceId = BusinessLogic.ConvertToString(DTToDoList.Rows[dgvToDoTask.SelectedRows[0].Index]["WORKTASKINSID"]) ?? "",
                    OperatorInstanceId = BusinessLogic.ConvertToString(DTToDoList.Rows[dgvToDoTask.SelectedRows[0].Index]["OPERATORINSID"]) ?? "",
                    CurrentUser        = this.UserInfo
                };
                string statusCode = wfRuntime.TaskUnClaim();
                if (statusCode != WorkFlowConst.SuccessCode)
                {
                    MessageBoxHelper.ShowWarningMsg("放弃任务认领错误");
                }
                else
                {
                    MessageBoxHelper.ShowSuccessMsg("放弃任务认领成功!");
                    this.Search();
                }
            }
            catch (Exception ex)
            {
                this.ProcessException(ex);
            }
            finally
            {
                this.Cursor = holdCursor;
            }
        }
 /// <summary>
 /// 控制流程流转的命令按钮,如提交等
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void RunButtonEvent(object sender, EventArgs e)
 {
     if (SaveUserControl(false))
     {
         string command   = (sender as Button).Text;
         var    wfruntime = new WorkFlowRuntime
         {
             UserId             = UserInfo.Id,
             WorkFlowId         = workflowId,
             WorkTaskId         = worktaskId,
             WorkFlowInstanceId = workflowInsId,
             WorkTaskInstanceId = worktaskInsId,
             WorkFlowNo         = tbxFlowNo.Text,
             CommandName        = command,
             Priority           = drpPriority.SelectedValue,
             WorkflowInsCaption = tbxWorkflowCaption.Text,
             Description        = tbxWorkflowDes.Text,
             IsDraft            = false,
             CurrentUser        = this.UserInfo
         };
         //wfruntime.RunSuccess += WFRuntime_RunSuccess;//流程成功启动时执行的事件
         //wfruntime.RunFail += WFRuntime_RunFail;//流程启动失败时执行的事件
         string returnStatusCode = wfruntime.Start();
         //if (returnStatusCode == WorkFlowConst.SuccessCode)
         //{
         //    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('提交成功,请关闭窗体!');window.close();", true);
         //}
         Response.Redirect("OperTips.aspx?worktaskInsId=" + worktaskInsId);
     }
 }
Пример #3
0
        private void btnAssign_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.SelectedId))
            {
                MessageBoxHelper.ShowWarningMsg("请选择待指派的用户!");
                return;
            }

            try
            {
                var wfRuntime = new WorkFlowRuntime
                {
                    UserId             = this.UserInfo.Id,
                    AssignUserId       = this.SelectedId,
                    OperatorInstanceId = OperatorInstanceId,
                    CurrentUser        = this.UserInfo
                };
                string statusCode = wfRuntime.TaskAssign();
                if (statusCode == WorkFlowConst.SuccessCode)
                {
                    MessageBoxHelper.ShowSuccessMsg("指派成功!");
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBoxHelper.ShowErrorMsg("指派失败,请检查传递的参数是否正确!");
                }
            }
            catch (Exception ex)
            {
                this.ProcessException(ex);
            }
        }
Пример #4
0
        private void btnAudit_Click(object sender, EventArgs e)
        {
            //保存数据到数据库
            if (string.IsNullOrEmpty(txtBillName.Text))
            {
                MessageBoxHelper.ShowInformationMsg("单据名称不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(txtWFInstanceName.Text))
            {
                MessageBoxHelper.ShowInformationMsg("流程实例名称不能为空!");
                return;
            }
            saveData();
            var wfRunTime = new WorkFlowRuntime();

            wfRunTime.RunSuccess        += WFRuntime_RunSuccess;   //流程成功启动时执行的事件
            wfRunTime.RunFail           += WFRuntime_RunFail;      //流程启动失败时执行的事件
            wfRunTime.UserId             = UserInfo.Id;            //当前操作人id
            wfRunTime.WorkFlowInstanceId = WorkFlowInsId;          //必须保持与业务数据中的该值相同
            wfRunTime.WorkTaskInstanceId = WorkTaskInsId;          //必须保持与业务数据中的该值相同
            wfRunTime.WorkFlowId         = WorkFlowId;             //必须保持与业务数据中的该值相同
            wfRunTime.WorkTaskId         = WorkTaskId;             //必须保持与业务数据中的该值相同
            wfRunTime.WorkFlowNo         = WorkFlowNo;             //流程编号,可以自定义
            wfRunTime.CommandName        = "提交";                   //命令分支,必须与建模中的命令定义名相同,否则无法流转
            wfRunTime.WorkflowInsCaption = txtWFInstanceName.Text; //可以自定义
            wfRunTime.IsDraft            = false;                  // 表示保存草稿,执行start方法的时候流程不流转
            wfRunTime.CurrentUser        = this.UserInfo;          //传递当前用户
            label2.Text = wfRunTime.Start();                       //启动流程
        }
Пример #5
0
 /// <summary>
 /// 任务指派
 /// </summary>
 /// <param name="ctx"></param>
 private void AssignTask(HttpContext ctx)
 {
     try
     {
         var vUser = Utils.UserInfo;
         var operatorInstanceId = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("operatorInsId"));
         var assginUserId       = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("assginUserId"));
         if (!string.IsNullOrEmpty(operatorInstanceId))
         {
             var wfRuntime = new WorkFlowRuntime
             {
                 UserId             = vUser.Id,
                 AssignUserId       = assginUserId,
                 OperatorInstanceId = operatorInstanceId,
                 CurrentUser        = vUser
             };
             ctx.Response.Write(wfRuntime.TaskAssign() == WorkFlowConst.SuccessCode
                 ? new JsonMessage {
                 Success = true, Data = "1", Message = "指派成功!"
             }.ToString()
                 : new JsonMessage {
                 Success = false, Data = "0", Message = "指派失败!"
             }.ToString());
         }
     }
     catch (Exception ex)
     {
         ctx.Response.Write(new JsonMessage {
             Success = false, Data = "-1", Message = RDIFrameworkMessage.MSG3020 + ex.Message
         }.ToString());
     }
 }
Пример #6
0
        private void GiveupClaimTask(HttpContext ctx)
        {
            var operatorId    = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("operatorId"));
            var workTaskInsId = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("workTaskInsId"));
            var vUser         = Utils.UserInfo;

            try
            {
                var wfruntime = new WorkFlowRuntime
                {
                    UserId             = vUser.Id,
                    WorkTaskInstanceId = workTaskInsId,
                    OperatorInstanceId = operatorId,
                    CurrentUser        = vUser
                };

                ctx.Response.Write(wfruntime.TaskUnClaim() == WorkFlowConst.SuccessCode
                    ? new JsonMessage {
                    Success = true, Data = "1", Message = RDIFrameworkMessage.MSG3010
                }.ToString()
                    : new JsonMessage {
                    Success = false, Data = "0", Message = RDIFrameworkMessage.MSG3020
                }.ToString());
            }
            catch (Exception ex)
            {
                ctx.Response.Write(new JsonMessage {
                    Success = false, Data = "-1", Message = RDIFrameworkMessage.MSG3020 + ex.Message
                }.ToString());
            }
        }
        private void btnClaimTask_Click(object sender, EventArgs e)
        {
            var holdCursor = this.Cursor;

            this.Cursor = Cursors.WaitCursor;
            try
            {
                string operatorId    = BusinessLogic.ConvertToString(DTUnClaimedTaskList.Rows[dgvUnClaimedTask.SelectedRows[0].Index]["OPERATORINSID"]) ?? "";
                string workTaskInsId = BusinessLogic.ConvertToString(DTUnClaimedTaskList.Rows[dgvUnClaimedTask.SelectedRows[0].Index]["WORKTASKINSID"]) ?? "";
                var    wfruntime     = new WorkFlowRuntime
                {
                    UserId             = UserInfo.Id,
                    WorkTaskInstanceId = workTaskInsId,
                    OperatorInstanceId = operatorId,
                    CurrentUser        = this.UserInfo
                };
                if (wfruntime.TaskClaim() == WorkFlowConst.SuccessCode)
                {
                    MessageBoxHelper.ShowSuccessMsg("认领成功!");
                }
                this.Search();
            }
            catch (Exception ex)
            {
                this.ProcessException(ex);
            }
            finally
            {
                this.Cursor = holdCursor;
            }
        }
Пример #8
0
        /// <summary>
        /// 任务退回
        /// </summary>
        /// <param name="ctx"></param>
        private void TaskBack(HttpContext ctx)
        {
            try
            {
                var vUser              = Utils.UserInfo;
                var workFlowInsId      = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("workFlowInsId"));
                var backCause          = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("backCause"));
                var operatorInstanceId = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("operatorInsId"));
                if (!string.IsNullOrEmpty(operatorInstanceId) && !string.IsNullOrEmpty(backCause) && workFlowInsId == "退回到上一步")
                {
                    var wfruntime = new WorkFlowRuntime
                    {
                        UserId             = vUser.Id,
                        backyy             = backCause,
                        OperatorInstanceId = operatorInstanceId,
                        CurrentUser        = vUser
                    };
                    ctx.Response.Write(wfruntime.TaskBack() == WorkFlowConst.SuccessCode
                        ? new JsonMessage {
                        Success = true, Data = "1", Message = "退回成功!"
                    }.ToString()
                        : new JsonMessage {
                        Success = false, Data = "0", Message = "退回失败!"
                    }.ToString());
                }

                //任意退回
                if (!string.IsNullOrEmpty(operatorInstanceId) && !string.IsNullOrEmpty(backCause) && !string.IsNullOrEmpty(workFlowInsId) && workFlowInsId != "退回到上一步")
                {
                    var wfRuntime = new WorkFlowRuntime
                    {
                        UserId             = vUser.Id,
                        backyy             = backCause,
                        OperatorInstanceId = operatorInstanceId,
                        //WorkTaskId = selectWorkFlowInsId,
                        WorkFlowInstanceId = workFlowInsId,
                        CurrentUser        = vUser
                    };
                    ctx.Response.Write(wfRuntime.TaskBackry() == WorkFlowConst.SuccessCode
                        ? new JsonMessage {
                        Success = true, Data = "1", Message = "任意退回成功!"
                    }.ToString()
                        : new JsonMessage {
                        Success = false, Data = "0", Message = "任意退回失败!"
                    }.ToString());
                }
            }
            catch (Exception ex)
            {
                ctx.Response.Write(new JsonMessage {
                    Success = false, Data = "-1", Message = RDIFrameworkMessage.MSG3020 + ex.Message
                }.ToString());
            }
        }
Пример #9
0
        /// <summary>
        /// 认领任务
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ClaimButtonEvent(object sender, EventArgs e)
        {
            var wfRuntime = new WorkFlowRuntime {
                UserId = userId, OperatorInstanceId = OperatorInsId
            };

            wfRuntime.TaskClaim();
            wfRuntime.CurrentUser = this.UserInfo;
            this.DialogResult     = DialogResult.OK;
            this.Close();
        }
        /// <summary>
        /// 认领任务
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ClaimButtonEvent(object sender, EventArgs e)
        {
            var wfruntime = new WorkFlowRuntime
            {
                UserId             = this.UserInfo.Id,
                OperatorInstanceId = operatorInsId,
                CurrentUser        = this.UserInfo
            };

            wfruntime.TaskClaim();
            Response.Redirect(Request.RawUrl);//刷新页面
        }
        private void button1_Click(object sender, EventArgs e)
        {
            //保存数据到数据库
            saveData();
            var wfruntime = new WorkFlowRuntime();

            wfruntime.RunSuccess += wfruntime_RunSuccess;
            wfruntime.RunFail    += wfruntime_RunFail;
            wfruntime.IsDraft     = false;                   //true 表示保存草稿,执行Run方法的时候流程不流转
            wfruntime.CurrentUser = this.UserInfo;
            wfruntime.Run(UserInfo.Id, operatorInsId, "提交"); //命令分支,必须与建模中的命令定义名相同,否则无法流转
        }
        /// <summary>
        /// 任务放弃认领
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TaskAbnegateButtonEvent(object sender, EventArgs e)
        {
            var wfruntime = new WorkFlowRuntime
            {
                UserId             = this.UserInfo.Id,
                OperatorInstanceId = operatorInsId,
                CurrentUser        = this.UserInfo
            };

            wfruntime.TaskUnClaim();
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('放弃认领成功!');", true);
            Response.Redirect(Request.RawUrl);//刷新页面
        }
Пример #13
0
        /// <summary>
        /// 控制流程流转的命令按钮,如提交等
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RunToolStriptButtonEvent(object sender, EventArgs e)
        {
            //if (SaveFormData(false))
            //{
            string command  = (sender as ToolStripButton).Text;
            string priority = "1";

            switch (BusinessLogic.ConvertToString(cboPriority.SelectedItem))
            {
            case "普通":
                priority = "1";
                break;

            case "紧急":
                priority = "2";
                break;

            case "特急":
                priority = "3";
                break;

            default:
                priority = "1";
                break;
            }

            var wfruntime = new WorkFlowRuntime
            {
                UserId             = UserInfo.Id,
                WorkFlowId         = WorkFlowId,
                WorkTaskId         = WorkTaskId,
                WorkFlowInstanceId = WorkFlowInsId,
                WorkTaskInstanceId = WorkTaskInsId,
                WorkFlowNo         = txtBizWorkFlowNo.Text,
                CommandName        = command,
                Priority           = priority,
                WorkflowInsCaption = txtBizWorkFlowName.Text,
                Description        = txtBizWorkFlowDescription.Text,
                IsDraft            = false,
                CurrentUser        = this.UserInfo
            };

            wfruntime.RunSuccess += WFRuntime_RunSuccess; //流程成功启动时执行的事件
            wfruntime.RunFail    += WFRuntime_RunFail;    //流程启动失败时执行的事件
            wfruntime.Start();
            //}
        }
Пример #14
0
        /// <summary>
        /// 撤回任务事件代码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RevokeTaskButtonEvent(object sender, EventArgs e)
        {
            var wfruntime = new WorkFlowRuntime {
                UserId = userId, MainWorktaskInsId = WorkTaskInsId, CurrentUser = this.UserInfo
            };
            var msg = wfruntime.TaskRevoke();

            if (msg == "1")
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBoxHelper.ShowWarningMsg("对方已认领的任务不能撤回!");
            }
        }
Пример #15
0
        private void btnHandleTask_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.Default;
            if (dgvToDoTask.SelectedRows.Count < 1)
            {
                return;
            }
            string operatorId    = BusinessLogic.ConvertToString(DTToDoList.Rows[dgvToDoTask.SelectedRows[0].Index]["OPERATORINSID"]) ?? "";
            string workTaskInsId = BusinessLogic.ConvertToString(DTToDoList.Rows[dgvToDoTask.SelectedRows[0].Index]["WORKTASKINSID"]) ?? "";
            string status        = BusinessLogic.ConvertToString(DTToDoList.Rows[dgvToDoTask.SelectedRows[0].Index]["STATUS"]) ?? "";

            if (status == "1")//如果是新任务首先要认领任务
            {
                var wfRuntime = new WorkFlowRuntime
                {
                    UserId             = UserInfo.Id,
                    WorkTaskInstanceId = workTaskInsId,
                    OperatorInstanceId = operatorId,
                    CurrentUser        = this.UserInfo
                };
                wfRuntime.TaskClaim();
            }

            //根据流程模板中配置的表单加载业务表单,如销售单。这里先固定的加载销售单。
            //var frm = new FrmCommTestAuditWF {operatorInsId = operatorId};
            //if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            //{
            //    Search(); //刷新列表
            //}

            var frmProcessTask = new FrmProcessingTask
            {
                WorkFlowId    = BusinessLogic.ConvertToString(DTToDoList.Rows[dgvToDoTask.SelectedRows[0].Index]["WorkFlowId"]) ?? "",
                WorkFlowInsId = BusinessLogic.ConvertToString(DTToDoList.Rows[dgvToDoTask.SelectedRows[0].Index]["WorkFlowInsId"]) ?? "",
                WorkTaskId    = BusinessLogic.ConvertToString(DTToDoList.Rows[dgvToDoTask.SelectedRows[0].Index]["WorkTaskId"]) ?? "",
                WorkTaskInsId = BusinessLogic.ConvertToString(DTToDoList.Rows[dgvToDoTask.SelectedRows[0].Index]["WorkTaskInsId"]) ?? "",
                OperatorInsId = BusinessLogic.ConvertToString(DTToDoList.Rows[dgvToDoTask.SelectedRows[0].Index]["operatorInsId"]) ?? "",
                PageState     = WorkConst.STATE_MOD,
                OperStatus    = "3"
            };

            if (frmProcessTask.ShowDialog() == DialogResult.OK)
            {
                Search(); //刷新列表
            }
        }
Пример #16
0
        /// <summary>
        /// 控制流程流转的命令按钮,如提交等
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RunToolStriptButtonEvent(object sender, EventArgs e)
        {
            this.SaveDyAssignNextOper();
            string command   = (sender as ToolStripButton).Text;
            var    wfRuntime = new WorkFlowRuntime
            {
                UserId             = UserInfo.Id,
                WorkFlowId         = WorkFlowId,
                WorkTaskId         = WorkTaskId,
                WorkFlowInstanceId = WorkFlowInsId,
                WorkTaskInstanceId = WorkTaskInsId,
                CurrentUser        = this.UserInfo
            };

            wfRuntime.RunSuccess += WFRuntime_RunSuccess;
            wfRuntime.RunFail    += WFRuntime_RunFail;
            wfRuntime.Run(UserInfo.Id, OperatorInsId, command);
        }
        /// <summary>
        /// 撤回任务
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RevokeTaskButtonEvent(object sender, EventArgs e)
        {
            var wfruntime = new WorkFlowRuntime
            {
                UserId            = this.UserInfo.Id,
                MainWorktaskInsId = workTaskInsId,
                CurrentUser       = this.UserInfo
            };
            string msg = wfruntime.TaskRevoke();

            if (msg == "1")
            {
                Response.Redirect("OperTips.aspx?worktaskInsId=" + workTaskInsId);
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('您好,对方已认领的任务不能撤回!');", true);
            }
        }
        /// <summary>
        /// 控制流程流转的命令按钮,如提交等
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RunButtonEvent(object sender, EventArgs e)
        {
            if (SaveUserControl(false))
            {
                string command   = (sender as Button).Text;
                var    wfruntime = new WorkFlowRuntime
                {
                    CurrentUser = this.UserInfo
                };

                string returnStatusCode = wfruntime.Run(this.UserInfo.Id, operatorInsId, command);

                Response.Redirect("OperTips.aspx?worktaskInsId=" + workTaskInsId);
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('您好!出现以下错误未能提交流程。" + eorr + "');", true);
            }
        }
Пример #19
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            string selectWorkFlowInsId = BusinessLogic.ConvertToString(cboWorkStep.SelectedValue);

            if (!this.CheckInput())
            {
                return;
            }

            if (this.OperatorInstanceId != null && selectWorkFlowInsId == "退回到上一步")
            {
                OperatorInstanceId = this.OperatorInstanceId;
                var wfRuntime = new WorkFlowRuntime
                {
                    UserId             = this.UserInfo.Id,
                    backyy             = txtBackCause.Text,
                    OperatorInstanceId = OperatorInstanceId,
                    CurrentUser        = this.UserInfo
                };
                wfRuntime.TaskBack();
                MessageBoxHelper.ShowSuccessMsg("退回成功");
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            //任意退回
            if (this.OperatorInstanceId != null && !string.IsNullOrEmpty(txtBackCause.Text) && selectWorkFlowInsId != "退回到上一步")
            {
                OperatorInstanceId = this.OperatorInstanceId;
                WorkFlowInsId      = selectWorkFlowInsId;
                var wfRuntime = new WorkFlowRuntime
                {
                    UserId             = this.UserInfo.Id,
                    backyy             = txtBackCause.Text,
                    OperatorInstanceId = OperatorInstanceId,
                    //WorkTaskId = selectWorkFlowInsId,
                    WorkFlowInstanceId = WorkFlowInsId,
                    CurrentUser        = this.UserInfo
                };
                wfRuntime.TaskBackry();
                MessageBoxHelper.ShowSuccessMsg("任意退回成功");
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
        }