Ejemplo n.º 1
0
        protected override string GetCurrentActiveName(string sn)
        {
            var    info = DBContext.GetBizContext().OA_CustomWorkFlowInstance.FirstOrDefault(x => x.FormID == _BPMContext.ProcInst.FormId);
            var    list = CustomWorkflowDataProcess.GetWorkItemsData(_BPMContext.ProcID, _BPMContext.ProcInst.FormId);
            string currentActivityName = DBContext.GetSysContext().WF_Custom_InstanceItems.FirstOrDefault(x => x.StepID == info.CurrentStepId).StepName;

            return(currentActivityName);
        }
Ejemplo n.º 2
0
    private void InitFlowData()
    {
        List <Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems> itemInfos = CustomWorkflowDataProcess.GetWorkItemsData(_BPMContext.ProcID, FormId);

        if (itemInfos != null)
        {
            rptList.DataSource = itemInfos;
            rptList.DataBind();
        }
    }
Ejemplo n.º 3
0
    protected override bool AfterWorkflowApproval(string action, string option, bool isSuccess)
    {
        if (isSuccess)
        {
            ///对于加签
            if (action == "提交")
            {
                return(true);
            }

            ///更新当前步骤审批人处理记录
            var currentStep = SysContext.WF_Custom_InstanceItems.FirstOrDefault(x => x.StepID == CurrentStep);
            List <CustomWorkflowUserInfo> userinfos = currentStep.PartUsers.ToUserList();
            var currentParter = userinfos.FirstOrDefault(x => x.UserInfo.LoginName == _BPMContext.CurrentUser.LoginId);
            if (currentParter != null)
            {
                currentParter.IsApproval = true;
                currentStep.PartUsers    = userinfos.ToXml();
                SysContext.SubmitChanges();
            }

            if (userinfos.Count(x => !x.IsApproval) == 0)
            {
                //本步骤所有人已经执行审批

                ///更新当前自定义实例步骤
                if (action == "同意")
                {
                    var list       = CustomWorkflowDataProcess.GetWorkItemsData(_BPMContext.ProcID, FormId);
                    var nextInfo   = list.Where(x => x.StepID > CurrentStep && !string.IsNullOrEmpty(x.PartUsers)).OrderBy(x => x.OrderId).FirstOrDefault();
                    var updateInfo = BizContext.OA_CustomWorkFlowInstance.FirstOrDefault(x => x.FormID == FormId);
                    if (nextInfo != null)
                    {
                        updateInfo.CurrentStepId = nextInfo.StepID;
                    }
                    else
                    {
                        updateInfo.CurrentStepId = -1;//没有后续节点,流程结束
                    }
                    BizContext.SubmitChanges();
                }
                else
                {
                    var updateInfo = BizContext.OA_CustomWorkFlowInstance.FirstOrDefault(x => x.FormID == FormId);

                    updateInfo.CurrentStepId = -1;//不同意,流程结束

                    BizContext.SubmitChanges();
                }
            }
        }


        return(true);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 流程发起前操作
    /// </summary>
    /// <returns></returns>
    protected override bool BeforeWorkflowStart()
    {
        List <Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems> itemInfos = CustomWorkflowDataProcess.GetWorkItemsData(FormId);

        if (itemInfos == null || itemInfos.Count == 0)
        {
            Alert("没有设置流程步骤!");
            return(false);
        }

        return(true);
    }
Ejemplo n.º 5
0
    private void SetCurrentStep(long stepId)
    {
        var list = CustomWorkflowDataProcess.GetWorkItemsData(_BPMContext.ProcID, FormId);

        if (stepId <= 1)
        {
            CurrentStep = list.OrderBy(x => x.OrderId).FirstOrDefault().StepID;
        }
        else
        {
            CurrentStep = stepId;
        }
    }
Ejemplo n.º 6
0
        protected override bool AfterApproval(string instanceId, string option, string action)
        {
            ///对于加签
            if (IsAddSign())
            {
                return(true);
            }
            var context    = DBContext.GetSysContext();
            var bizContext = DBContext.GetBizContext();
            ///更新当前步骤审批人处理记录
            ///
            var bizInfo = bizContext.OA_CustomWorkFlowInstance.FirstOrDefault(x => x.FormID == _BPMContext.ProcInst.FormId);

            var currentStep = context.WF_Custom_InstanceItems.FirstOrDefault(x => x.StepID == bizInfo.CurrentStepId.Value);
            List <CustomWorkflowUserInfo> userinfos = currentStep.PartUsers.ToUserList();
            var currentParter = userinfos.FirstOrDefault(x => x.UserInfo.LoginName == _BPMContext.CurrentUser.LoginId);

            if (currentParter != null)
            {
                currentParter.IsApproval = true;
                currentStep.PartUsers    = userinfos.ToXml();
                context.SubmitChanges();
            }

            if (userinfos.Count(x => !x.IsApproval) == 0)
            {
                //本步骤所有人已经执行审批

                ///更新当前自定义实例步骤
                if (action == "同意")
                {
                    var list     = CustomWorkflowDataProcess.GetWorkItemsData(_BPMContext.ProcID, "");
                    var nextInfo = list.Where(x => x.StepID > bizInfo.CurrentStepId.Value && !string.IsNullOrEmpty(x.PartUsers)).OrderBy(x => x.OrderId).FirstOrDefault();
                    if (nextInfo != null)
                    {
                        bizInfo.CurrentStepId = nextInfo.StepID;
                    }
                    else
                    {
                        bizInfo.CurrentStepId = -1;//没有后续节点,流程结束
                    }
                }
                else
                {
                    bizInfo.CurrentStepId = -1;//不同意,流程结束
                }
                bizContext.SubmitChanges();
            }
            return(true);
        }
Ejemplo n.º 7
0
    private void LoadWorkItemsData()
    {
        List <Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems> itemInfos = CustomWorkflowDataProcess.GetWorkItemsData(FormId);

        if (itemInfos != null)
        {
            rptList.DataSource = itemInfos;
            rptList.DataBind();
            Div_NoStepsTip.Visible = false;
        }
        else
        {
            Div_NoStepsTip.Visible = true;
        }
    }
Ejemplo n.º 8
0
    public string GetCurrentNodeName(string stepId)
    {
        string currentNodeName     = "";
        var    list                = CustomWorkflowDataProcess.GetWorkItemsData(_BPMContext.ProcID, FormId);
        string currentActivityName = list.FirstOrDefault(x => x.StepID.ToString() == stepId).StepName;

        if (stepId == CurrentStep.ToString())
        {
            CustomActivityName = currentActivityName;
            currentNodeName    = CustomWorkflowHelper.SuperNodeName + "," + currentActivityName;
        }
        else
        {
            currentNodeName = currentActivityName;
        }
        //}

        return(currentNodeName);
    }
Ejemplo n.º 9
0
    protected override void AfterSaveInstance()
    {
        bool isSaveSuccess = SaveWorkItemsData(_BPMContext.ProcID);

        if (!isSaveSuccess)
        {
            Alert("没有步骤数据,请先设置步骤再保存!");
            return;
        }
        List <Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems> itemInfos = CustomWorkflowDataProcess.GetWorkItemsData(FormId);

        var info = BizContext.OA_CustomWorkFlowInstance.FirstOrDefault(x => x.FormID == FormId);

        if (info != null)
        {
            var firstDept = itemInfos.Where(x => !string.IsNullOrEmpty(x.PartUsers)).OrderBy(x => x.OrderId).FirstOrDefault();
            info.CurrentStepId = firstDept == null ? -1 : firstDept.StepID;
        }
        BizContext.SubmitChanges();
    }
Ejemplo n.º 10
0
    private void SaveWorkItemData()//Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems itemInfo)
    {
        //if (string.IsNullOrEmpty(ShowUserNames1.UserList))
        //{
        //    DisplayMessage.ExecuteJs("alert('没有设置审批人员!')");
        //    return;
        //}

        string FormId = Request["FormId"];
        List <Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems> itemInfos = CustomWorkflowDataProcess.GetWorkItemsData(FormId);

        if (itemInfos != null && itemInfos.Exists(x => x.StepName.ToLower() == tbStepName.Text))
        {
            DisplayMessage.ExecuteJs("alert('该步骤名称与已有步骤重名,请更换步骤名称!')");
            return;
        }

        int result = 0;

        try
        {
            CustomWorkflowDataProcess.SaveWorkItemData(new Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems()
            {
                StepID    = StepID,
                StepName  = tbStepName.Text,
                PartUsers = ShowUserNames1.UserList
            },
                                                       FormId);
            result = 1;
        }
        catch (Exception)
        {
            //
        }
        DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", result));
    }
Ejemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string FormId = Request["FormId"];
            if (string.IsNullOrWhiteSpace(FormId) && string.IsNullOrWhiteSpace(_BPMContext.ProcID))
            {
                DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", 0));
                return;
            }
            else
            {
                long   newId       = -1;
                string newIdString = Request["stepId"];
                if (!string.IsNullOrWhiteSpace(newIdString))
                {
                    long.TryParse(newIdString, out newId);
                }
                StepID = newId;
                if (StepID > 0)
                {
                    List <Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems> itemInfos = CustomWorkflowDataProcess.GetWorkItemsData(FormId);
                    if (itemInfos != null)
                    {
                        var currentInfo = itemInfos.FirstOrDefault(x => x.StepID == StepID);
                        if (currentInfo == null)
                        {
                            DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", 0));
                            return;
                        }
                        tbStepName.Text         = currentInfo.StepName;
                        ShowUserNames1.UserList = currentInfo.PartUsers;
                    }
                }

                Refresh("", "");
            }
        }
    }
Ejemplo n.º 12
0
    private void SaveWorkItemDataToTemplation()//Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems itemInfo)
    {
        int result = 0;

        string FormId = Request["FormId"];

        try
        {
            var itemList = CustomWorkflowDataProcess.GetWorkItemsData(FormId);
            if (itemList == null)
            {
                DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", result));
                return;
            }
            string syncString = string.Empty;
            lock (syncString)
            {
                int maxId = 1;
                if (SysContext.WF_Custom_Templation.Count() > 0)
                {
                    maxId = SysContext.WF_Custom_Templation.Max(x => x.Id) + 1;
                    if (maxId <= 0)
                    {
                        maxId = 1;
                    }
                }

                SysContext.WF_Custom_Templation.InsertOnSubmit(new Pkurg.PWorldBPM.Business.Sys.WF_Custom_Templation()
                {
                    Id                 = maxId,
                    CreateTime         = DateTime.Now,
                    Name               = tbStepName.Text,
                    CreateUserID       = _BPMContext.CurrentPWordUser.EmployeeCode,
                    CreateUserDeptCode = _BPMContext.CurrentPWordUser.DepartCode,
                    CreateUserName     = _BPMContext.CurrentPWordUser.EmployeeName,
                    LastUpdateTime     = DateTime.Now,
                    IsOpen             = cbIsOpen.Checked ? 1 : 0,
                    RelationDeptCode   = GetCheckDept(),
                    Des                = tbDes.Text
                });


                long stepId = 1;
                if (SysContext.WF_Custom_TemplationItems.Count() > 0)
                {
                    stepId = SysContext.WF_Custom_TemplationItems.Max(x => x.StepID) + 1;
                }
                foreach (var item in itemList)
                {
                    SysContext.WF_Custom_TemplationItems.InsertOnSubmit(new Pkurg.PWorldBPM.Business.Sys.WF_Custom_TemplationItems()
                    {
                        TemplD     = maxId,
                        CreateTime = DateTime.Now,
                        PartUsers  = item.PartUsers,
                        OrderId    = item.OrderId,
                        StepID     = stepId++,
                        StepName   = item.StepName,
                        Condition  = item.Condition
                    });
                }
                SysContext.SubmitChanges();
            }
            result = 1;
        }
        catch (Exception)
        {
            //
        }
        DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", result));
    }