Esempio n. 1
0
        private void DoWorkItem(Hashtable p_nvAttributes, Boolean p_blnIsProcessCreated)
        {
            B_FormsData l_busFormsData = null;

            try
            {
                if (!p_blnIsProcessCreated)
                {
                    //创建流程
                    WorkFlowBase.CreateProcess(this.TemplateName, this.ProcessID, p_nvAttributes);

                    //获取第一个节点并且完成。
                    l_busFormsData  = new B_FormsData();
                    this.WorkItemID = l_busFormsData.GetFirstWorkItemID(this.ProcessID);

                    UpdateDBWorkItem(this.WorkItemID, true, "", "", "", this.StepName, true);

                    if (base.TemplateName.Contains("收文"))
                    {
                        WorkFlowBase.CompleteWorkItem(this.WorkItemID, p_nvAttributes);//完成第一个节点
                    }
                    if (base.TemplateName.Contains("会务费用报销单") || base.TemplateName.Contains("招待费报销单"))
                    {
                        WorkFlowBase.CompleteWorkItem(this.WorkItemID, p_nvAttributes);//完成第一个节点
                    }
                }
                else
                {
                    WorkFlowBase.CompleteWorkItem(this.WorkItemID, p_nvAttributes);//完成当前节点

                    if (base.TemplateName == ProcessConstString.TemplateName.PROGRAM_FILE &&
                        (base.StepName == ProcessConstString.StepName.ProgramFile.STEP_DEPTSIGN ||
                         base.StepName == ProcessConstString.StepName.ProgramFile.STEP_LEADERSIGN))
                    {
                        EntityBase entitybase = ControlToEntity(false);

                        B_PF          pfEntity = entitybase != null ? entitybase as B_PF : new B_PF();
                        List <String> strIDs   = B_FormsData.GetMultiParapllelInfo(TableName.WorkItemsTableName.T_OA_HN_PF_WorkItems, base.ProcessID, base.StepName, pfEntity.TimesFlag);
                        foreach (String strID in strIDs)
                        {
                            B_PF entity = new B_PF();
                            //更新其它会签记录
                            entity.ID             = Convert.ToInt32(strID);
                            entity                = XmlUtility.DeSerializeXml <B_PF>(entity.FormsData);
                            entity.ID             = Convert.ToInt32(strID);
                            entity.LeaderSignList = pfEntity.LeaderSignList;                           //领导已会签意见内容
                            entity.DeptSignList   = B_PF.GetDeptSignList(entity.DeptSignList, strIDs); //部门已会签意见内容
                            entity.IsSignReject   = pfEntity.IsSignReject;                             //是否否决

                            if (entity.WorkItemID == pfEntity.WorkItemID)
                            {
                                entity.D_StepStatus = "Completed";
                                entity.SubmitAction = this.SubAction;
                                entity.CommentList  = pfEntity.CommentList;
                                //entity.DeptSignList = B_PF.GetDeptSignList(entity.DeptSignList, strIDs);
                            }//更新当前节点用户
                            entity.FormsData = XmlUtility.SerializeXml(entity);
                            if (!entity.Save())
                            {
                                throw new Exception(entity.ErrMsgs.ToString());
                            }
                        }
                        pfEntity.ID = int.MinValue;//清空ID
                    }

                    if (base.TemplateName == ProcessConstString.TemplateName.AFFILIATION &&
                        (base.StepName == ProcessConstString.StepName.WorkRelationStepName.STEP_DEPTSIGN))
                    {
                        EntityBase entitybase = ControlToEntity(false);

                        B_WorkRelation wrEntity = entitybase != null ? entitybase as B_WorkRelation : new B_WorkRelation();
                        List <String>  strIDs   = B_FormsData.GetMultiParapllelInfo(TableName.WorkItemsTableName.T_OA_WR_WorkItems, base.ProcessID, base.StepName, wrEntity.TimesFlag);
                        foreach (String strID in strIDs)
                        {
                            B_WorkRelation entity = new B_WorkRelation();
                            //更新其它会签记录
                            entity.ID           = Convert.ToInt32(strID);
                            entity              = XmlUtility.DeSerializeXml <B_WorkRelation>(entity.FormsData);
                            entity.ID           = Convert.ToInt32(strID);
                            entity.DeptSignList = B_WorkRelation.GetDeptSignList(entity.DeptSignList, strIDs); //部门已会签意见内容
                            entity.IsSignReject = wrEntity.IsSignReject;                                       //是否否决

                            if (entity.WorkItemID == wrEntity.WorkItemID)
                            {
                                if (base.SubAction == ProcessConstString.SubmitAction.ACTION_SUBMIT)
                                {
                                    entity.D_StepStatus = "Completed";
                                }
                                entity.SubmitAction = this.SubAction;
                                entity.CommentList  = wrEntity.CommentList;
                            }//更新当前节点用户
                            entity.FormsData = XmlUtility.SerializeXml(entity);
                            if (!entity.Save())
                            {
                                throw new Exception(entity.ErrMsgs.ToString());
                            }
                        }
                        wrEntity.ID = int.MinValue;//清空ID
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 程序文件 交办动作处理
        /// </summary>
        /// <param name="p_strActionName"></param>
        /// <param name="entity"></param>
        protected ReturnInfo FormSubmitForProFile(Boolean bIsSave, String strActionName, String strParentTbID, String strStepStatus, EntityBase entity)
        {
            User       l_objUser       = null;
            ReturnInfo l_objReturnInfo = FormSave.SaveEntity(entity, this, bIsSave, this.SubAction, this.TemplateName);

            if (!l_objReturnInfo.IsSucess)
            {
                this.ShowMsgBox(this.Page, MsgType.VbExclamation, "表单保存出错,后续操作不能进行!" + l_objReturnInfo.ErrMessage);
                return(l_objReturnInfo);
            }

            if (!bIsSave)
            {
                //处理交办人相关信息
                if (String.IsNullOrEmpty(strParentTbID))
                {
                    DataTable  dt         = B_PF.GetNextWorkItemIdForAssign(base.ProcessID);//当前ProcessID 父流程ID
                    EntityBase entitybase = base.EntityData != null ? base.EntityData : new EntityBase();
                    entitybase.AgentUserID   = String.Empty;
                    entitybase.AgentUserName = String.Empty;
                    EntityBase entitybase2 = EntityFactory.CreateEntity2(base.TemplateName);;
                    base.EntityData.Clone(entitybase2);
                    entitybase2.AgentUserID   = String.Empty;
                    entitybase2.AgentUserName = String.Empty;

                    entitybase2.ProcessID = dt.Rows[0]["PROC_INST_ID"].ToString();
                    entitybase.ProcessID  = dt.Rows[0]["PROC_INST_ID"].ToString();

                    entitybase2.WorkItemID = dt.Rows[0]["WORK_ITEM_ID"].ToString();
                    entitybase.WorkItemID  = dt.Rows[0]["WORK_ITEM_ID"].ToString();

                    entitybase2.D_StepStatus = dt.Rows[0]["STATUS"].ToString();
                    entitybase.D_StepStatus  = dt.Rows[0]["STATUS"].ToString();

                    entitybase2.ReceiveUserID = dt.Rows[0]["USER_ID"].ToString();
                    entitybase.ReceiveUserID  = dt.Rows[0]["USER_ID"].ToString();

                    entitybase2.StepName = dt.Rows[0]["NAME"].ToString();
                    entitybase.StepName  = dt.Rows[0]["NAME"].ToString();

                    entitybase2.SubmitAction = strActionName;
                    entitybase.SubmitAction  = strActionName;

                    //接收人姓名
                    l_objUser = OAUser.GetUser(entitybase.ReceiveUserID);
                    if (l_objUser != null)
                    {
                        entitybase2.ReceiveUserName = l_objUser.Name;
                        entitybase.ReceiveUserName  = l_objUser.Name;
                    }

                    entitybase2.FormsData = XmlUtility.SerializeXml(entitybase);
                    if (!entitybase2.Save())
                    {
                        l_objReturnInfo.IsSucess   = false;
                        l_objReturnInfo.ErrMessage = SysString.GetErrorMsgs(entitybase2.ErrMsgs);

                        ILogger log = LoggerFactory.GetLogger(LogType.TxtFile, @"Log", "程序文件");
                        log.WriteLog("保存实体出错:" + l_objReturnInfo.ErrMessage);

                        return(l_objReturnInfo);
                    }
                }//新增协助会签节点数据
                else
                {
                    B_PF pfEntity = new B_PF();
                    pfEntity.ID = int.Parse(strParentTbID);
                    pfEntity    = XmlUtility.DeSerializeXml <B_PF>(pfEntity.FormsData);
                    pfEntity.ID = int.Parse(strParentTbID);
                    //清空子流程ProcessID,用于标识当部门领导自己提交表单撤销子流程(如果不为空,则需要注销子流程)
                    pfEntity.ChildProcessID = String.Empty;
                    pfEntity.AssistContent  = (entity as B_PF).AssistContent;
                    pfEntity.FormsData      = XmlUtility.SerializeXml(pfEntity);//.Replace("<ID>" + pfEntity.ID + "</ID>", "<ID>" + int.MinValue.ToString() + "</ID>");
                    if (!pfEntity.Save())
                    {
                        throw new Exception(pfEntity.ErrMsgs.ToString());
                    }
                    WorkFlowBase.CompleteWorkItem(base.WorkItemID, null);
                }//更新交办会签节点数据
            }

            l_objReturnInfo.IsSucess = true;
            return(l_objReturnInfo);
        }