//private void ucPrint_OnBeforeClosed(object sender, EventArgs e)
        //{
        //    ucPrint.Write("共    页", "共" + ucPrint.Pages + "页", WordMgr.WriteMode.Shift, 1);
        //}
        #endregion

        #region 批量打印接口
        public override void InitPrint(UC_Print ucprint, string sProcName, string sStepName,
                                       string sStartTime, string sEndTime)
        {
            m_print = ucprint;

            m_print.OnBeginExport      += new UC_Print.ExportHandler(Print_OnBeginExport);
            m_print.OnCompletionExport += new UC_Print.ExportHandler(Print_OnCompletionExport);
            m_print.OnAttachExport     += new UC_Print.ExportHandler(Print_OnAttachExport);
            m_print.OnExtraExport      += new UC_Print.ExportHandler(Print_OnExtraExport);

            //打印
            m_print.UCTemplateName = sProcName;
            m_print.UCStepName     = sStepName;

            //m_print.m_ls = B_FormsData.GetEntities("FA3707F767DE49769DB675CD00278308",
            //    null, sProcName, sStepName, true);
            string[] sDateTimes = sStartTime.Split('-');
            DateTime dtStart    = new DateTime(Convert.ToInt32(sDateTimes[0]), Convert.ToInt32(sDateTimes[1]), Convert.ToInt32(sDateTimes[2]));

            sDateTimes = sEndTime.Split('-');
            DateTime dtEnd = new DateTime(Convert.ToInt32(sDateTimes[0]), Convert.ToInt32(sDateTimes[1]), Convert.ToInt32(sDateTimes[2]));

            m_print.m_ls = B_FormsData.GetEntities(sProcName, sStepName, dtStart, dtEnd, true);

            //m_print.Init();
            m_print.m_bBatch   = true;
            m_print.ExportPath = @"\Batch\";
            m_print.TmpAttachFilesDirectory = @"\Batch\tmp\";
        }
        string[] PF_Step = new string[] { "编制", "校核", "审核", "质保审查", "部门会签", "领导会签", "批准", "分发", "传阅" };                             // 程序文件
        //string[] MF_Step = new string[] { "拟稿", "审稿", "部门会签", "核稿", "领导会签", "签发", "分发", "校对" }; // 党政工团发文
        //string[] MS_Step = new string[] { "发起流程", "拟办", "收文处理中心", "领导批示", "收文处理中心归档", "传阅", "处室承办", "科室承办", "人员承办", "追加分发"}; // 党政工团收文

        protected void Page_Load(object sender, EventArgs e)
        {
            FormsUIBase ui;

            switch (ddlProc.Text)
            {
            case "公司发文":
                ui = new UC_CompanySend();
                ui.InitPrint(this.UC_Print1, ddlProc.Text, ddlStep.Text, CaleStart.Text, CaleEnd.Text);
                break;

            case "公司收文":
                ui = new UC_CompanyReceive();    //new B_GS_WorkItems();
                ui.InitPrint(this.UC_Print1, ddlProc.Text, ddlStep.Text, CaleStart.Text, CaleEnd.Text);
                break;

            case "函件发文":
                ui = new UC_LetterSend();    //new EntityLetterSend();
                ui.InitPrint(this.UC_Print1, ddlProc.Text, ddlStep.Text, CaleStart.Text, CaleEnd.Text);
                break;

            case "函件收文":
                ui = new UC_LetterReceived();    //new B_LetterReceive();
                ui.InitPrint(this.UC_Print1, ddlProc.Text, ddlStep.Text, CaleStart.Text, CaleEnd.Text);
                break;

            case "请示报告":
                ui = new UC_RequestReport();    //new B_RequestReport();
                ui.InitPrint(this.UC_Print1, ddlProc.Text, ddlStep.Text, CaleStart.Text, CaleEnd.Text);
                break;

            case "工作联系单":
                ui = new UC_WorkRelation();    //new B_WorkRelation();
                ui.InitPrint(this.UC_Print1, ddlProc.Text, ddlStep.Text, CaleStart.Text, CaleEnd.Text);
                break;

            case "程序文件":
                ui = new UC2_ProgramFile();    //new B_PF();
                ui.InitPrint(this.UC_Print1, ddlProc.Text, ddlStep.Text, CaleStart.Text, CaleEnd.Text);
                break;
                //case "党政工团发文":
                //    ui = new UC_Send();//new M_DJGTSend();
                //    ui.InitPrint(this.UC_Print1, ddlProc.Text, ddlStep.Text, CaleStart.Text, CaleEnd.Text);
                //    break;
                //case "党政工团收文":
                //    ui = new UC_Receive();//new M_MergeReceiveBase();
                //    ui.InitPrint(this.UC_Print1, ddlProc.Text, ddlStep.Text, CaleStart.Text, CaleEnd.Text);
                //    break;
            }

            List <EntityBase> ls = B_FormsData.GetEntities(ddlProc.Text,
                                                           ddlStep.Text,
                                                           DateTime.Parse(string.IsNullOrEmpty(CaleStart.Text) ? DateTime.MinValue.ToString() : CaleStart.Text),
                                                           DateTime.Parse(string.IsNullOrEmpty(CaleEnd.Text) ? DateTime.MinValue.ToString() : CaleEnd.Text),
                                                           true);

            this.TextBox1.Text = "当前满足条件的记录为:" + ls.Count.ToString();
        }
Example #3
0
        protected void btnQuery_Click(object sender, EventArgs e)
        {
            List <EntityBase> ls = B_FormsData.GetEntities(ddlProc.Text,
                                                           ddlStep.Text,
                                                           DateTime.Parse(string.IsNullOrEmpty(CaleStart.Text) ? DateTime.MinValue.ToString() : CaleStart.Text),
                                                           DateTime.Parse(string.IsNullOrEmpty(CaleEnd.Text) ? DateTime.MinValue.ToString() : CaleEnd.Text),
                                                           true);
            //ls[0].ID INT
            //ls[0].ProcessID STR
            //ls[0].WorkItemID STR
            DataTable dt = new DataTable();

            dt.Columns.Add("IsDevolved");
            dt.Columns.Add("ID");
            dt.Columns.Add("Title");
            dt.Columns.Add("ProcessID");
            dt.Columns.Add("WorkItemID");

            for (int i = 0; i < ls.Count; i++)
            {
                DataRow row = dt.NewRow();
                if (B_ProcessInstance.Is_Devolve(ls[i].ProcessID, ddlProc.Text).ToString().ToUpper() == "TRUE")
                {
                    row["IsDevolved"] = "已归档";
                }
                else
                {
                    row["IsDevolved"] = "未归档";
                }
                row["ID"]         = ls[i].ID.ToString();
                row["Title"]      = ls[i].DocumentTitle;
                row["ProcessID"]  = ls[i].ProcessID;
                row["WorkItemID"] = ls[i].WorkItemID;
                dt.Rows.Add(row);
            }

            this.FSGridView1.DataSource = dt;
            this.FSGridView1.DataBind();
        }
Example #4
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;
            }
        }
Example #5
0
        //更新流程第一个节点的WorkItemID
        private void UpdateDBWorkItem(String wid, Boolean isAddWorkItemID, String subaction, String strform, String stepstatus, String step, Boolean isChangStep)
        {
            B_FormsData l_busFormsData = new B_FormsData();

            l_busFormsData.UpdateWorkItemId(this.WorkItemTable, this.ProcessID, wid, isAddWorkItemID, subaction, strform, stepstatus, step, isChangStep);
        }
Example #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="p_blnIsSaveDraft"></param>
        /// <param name="p_strActionName"></param>
        /// <param name="p_htAttributes"></param>
        /// <param name="p_entEntityData"></param>
        protected void FormSubmit(Boolean p_blnIsSaveDraft, String p_strActionName, Hashtable p_htAttributes, EntityBase p_entEntityData)
        {
            String  l_strMessage          = String.Empty;
            User    l_objUser             = null;
            Boolean l_blnIsProcessCreated = true;

            try
            {
                ////M_20100406
                ////huangqi
                ////修改说明:流程与附件模板名称是否匹配
                ////Begin
                //if (p_entEntityData.FileList.Count > 0 && p_entEntityData.FileList[0].ProcessType != base.TemplateName)
                //{
                //    this.ShowMsgBox(this.Page, MsgType.VbInformation, "流程与附件模板名称不比配,请注销后重新处理该文件。", base.EntryAction);
                //    return;
                //}
                ////End

                if (String.IsNullOrEmpty(base.WorkItemID))
                {
                    l_blnIsProcessCreated = false;
                }

                //保存实体数据
                ReturnInfo l_objReturnInfo = FormSave.SaveEntity(p_entEntityData, this, p_blnIsSaveDraft, p_strActionName, base.TemplateName);
                if (!l_objReturnInfo.IsSucess)
                {
                    //this.ShowMsgBox(this.Page, MsgType.VbExclamation, "表单保存出错,后续操作不能进行!" + l_objReturnInfo.ErrMessage);
                    JScript.Alert("表单保存出错,后续操作不能进行!" + l_objReturnInfo.ErrMessage, TemplateName == ProcessConstString.TemplateName.PROGRAM_FILE);
                    return;
                }

                if (p_blnIsSaveDraft)
                {
                    if (l_blnIsProcessCreated)
                    {
                        //this.ShowMsgBox(this.Page, MsgType.VbInformation, "保存草稿成功!");
                        bool isUseUp = false;
                        if (TemplateName == ProcessConstString.TemplateName.PROGRAM_FILE)
                        {
                            isUseUp = true;
                        }
                        else if (TemplateName == ProcessConstString.TemplateName.FinanceCCBX_APPLY)
                        {
                            isUseUp = true;
                        }
                        else
                        {
                            isUseUp = false;
                        }
                        JScript.Alert("保存草稿成功!", isUseUp);
                    }
                    else
                    {
                        this.ShowMsgBox(this.Page, MsgType.VbInformation, "保存草稿成功,可从草稿箱查看已保存文件!", "7");
                    }
                    return;
                }

                //流程操作
                DoWorkItem(p_htAttributes, l_blnIsProcessCreated);

                //获取下一个节点
                getnext : DataTable l_dtbDataTable = B_FormsData.GetNextWorkItem(this.ProcessID, this.WorkItemID);
                if (l_dtbDataTable.Rows.Count == 0)
                {
                    //有时候反应慢 数据还没产生
                    System.Threading.Thread.Sleep(500);
                    l_dtbDataTable = B_FormsData.GetNextWorkItem(this.ProcessID, this.WorkItemID);
                }
                //防止协办与交办的冲突
                if (base.TemplateName == ProcessConstString.TemplateName.LETTER_RECEIVE && base.SubAction != ProcessConstString.SubmitAction.LetterReceiveAction.ACTION_TJCB)
                {
                    if (l_dtbDataTable != null && l_dtbDataTable.Rows.Count > 0)
                    {
                        int i = 0;
                        foreach (DataRow l_dtrDataRow in l_dtbDataTable.Rows)
                        {
                            if (l_dtrDataRow["NAME"].ToString() != ProcessConstString.StepName.LetterReceiveStepName.STEP_HELP_DIRECTOR)
                            {
                                i = 1;
                                break;
                            }
                            else if (base.SubAction == ProcessConstString.SubmitAction.ACTION_SUBMIT && base.StepName == ProcessConstString.StepName.LetterReceiveStepName.STEP_LETTER_ADMIN)
                            {
                                i = 1;
                                break;
                            }
                        }
                        if (i == 0)
                        {
                            goto getnext;
                        }
                    }
                }

                l_strMessage = p_strActionName + "  ";
                String l_strStepName = String.Empty;
                foreach (DataRow l_dtrDataRow in l_dtbDataTable.Rows)
                {
                    EntityBase l_entEntityData     = EntityFactory.CreateEntity2(base.TemplateName);
                    EntityBase l_entEntityBaseData = base.EntityData;

                    l_entEntityBaseData.Clone(l_entEntityData);

                    //流程实例ID
                    l_entEntityData.ProcessID     = this.ProcessID;
                    l_entEntityBaseData.ProcessID = this.ProcessID;

                    //步骤节点ID
                    l_entEntityData.WorkItemID     = l_dtrDataRow["WORK_ITEM_ID"].ToString();
                    l_entEntityBaseData.WorkItemID = l_dtrDataRow["WORK_ITEM_ID"].ToString();

                    //步骤名称
                    l_entEntityData.StepName     = l_dtrDataRow["NAME"].ToString();
                    l_entEntityBaseData.StepName = l_dtrDataRow["NAME"].ToString();

                    //步骤状态
                    l_entEntityData.D_StepStatus     = l_dtrDataRow["STATUS"].ToString();
                    l_entEntityBaseData.D_StepStatus = l_dtrDataRow["STATUS"].ToString();

                    //接收时间
                    l_entEntityData.ReceiveDateTime     = Convert.ToDateTime(l_dtrDataRow["CREATED_DATE"]);
                    l_entEntityBaseData.ReceiveDateTime = Convert.ToDateTime(l_dtrDataRow["CREATED_DATE"]);

                    //接收人账号
                    l_entEntityData.ReceiveUserID     = l_dtrDataRow["USER_ID"].ToString();
                    l_entEntityBaseData.ReceiveUserID = l_dtrDataRow["USER_ID"].ToString();

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

                    //公办ID
                    l_entEntityData.CommonID     = l_dtrDataRow["POOL_ID"].ToString();
                    l_entEntityBaseData.CommonID = l_dtrDataRow["POOL_ID"].ToString();

                    //提交动作
                    l_entEntityData.SubmitAction     = null;
                    l_entEntityBaseData.SubmitAction = null;

                    //代理人信息
                    l_entEntityData.AgentUserID   = String.Empty;
                    l_entEntityData.AgentUserName = String.Empty;

                    l_entEntityBaseData.AgentUserID   = String.Empty;
                    l_entEntityBaseData.AgentUserName = String.Empty;

                    l_entEntityData.IsFormSave     = false;
                    l_entEntityBaseData.IsFormSave = false;

                    if (base.TemplateName == ProcessConstString.TemplateName.PROGRAM_FILE || base.TemplateName == ProcessConstString.TemplateName.LETTER_RECEIVE)
                    {
                        l_entEntityData.CommentList.Clear();
                        l_entEntityBaseData.CommentList.Clear();
                    }

                    l_entEntityData.FormsData = XmlUtility.SerializeXml(l_entEntityBaseData);

                    if (l_strStepName != l_entEntityData.StepName)
                    {
                        l_strStepName = l_entEntityData.StepName;
                        if (l_strMessage != p_strActionName + "  ")
                        {
                            l_strMessage += "待处理!";
                        }
                        l_strMessage += "\\n[" + l_strStepName + "]:";
                    }

                    if (!String.IsNullOrEmpty(l_entEntityData.ReceiveUserName))
                    {
                        l_strMessage += l_entEntityData.ReceiveUserName + "  ";
                    }
                    else
                    {
                        l_strMessage += l_entEntityData.ReceiveUserID + "  ";
                    }

                    if ((B_FormsData.AscertainSameRecord(base.ProcessID, l_entEntityData.WorkItemID, base.TemplateName)))
                    {
                        continue;
                    }

                    if (!l_entEntityData.Save())
                    {
                        String  l_strErrorMessage = SysString.GetErrorMsgs(l_entEntityData.ErrMsgs);
                        ILogger log = LoggerFactory.GetLogger(LogType.TxtFile, @"Log", this.TemplateName);
                        log.WriteLog("保存待办节点出错:" + l_strErrorMessage);
                    }
                }
                if (l_strMessage == p_strActionName + "  ")
                {
                    l_strMessage = "完成!";
                }
                else
                {
                    l_strMessage += "待处理!";
                }
                this.ShowMsgBox(this.Page, MsgType.VbInformation, l_strMessage, base.EntryAction);
            }
            catch (Exception ex)
            {
                this.WriteLog(ex.Message);
                l_strMessage = ex.Message;
                this.ShowMsgBox(this.Page, MsgType.VbInformation, l_strMessage, base.EntryAction);
            }
        }
        protected void btnSecFF_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtProcessID.Text == string.Empty)
                {
                    JScript.Alert("只有已经启动的流程才能二次分发!");
                    return;
                }
                List <EntityBase> bworkitems = B_FormsData.GetEntities(this.txtProcessID.Text, "", ProcessConstString.TemplateName.LETTER_RECEIVE, "", true);
                B_LetterReceive   NewEntity  = new B_LetterReceive();
                B_LetterReceive   bworkitem  = bworkitems != null && bworkitems.Count > 0 ? bworkitems[0] as B_LetterReceive : new B_LetterReceive();

                NewEntity.ProcessID = this.txtProcessID.Text;

                NewEntity.WorkItemID = Guid.NewGuid().ToString("N");
                bworkitem.WorkItemID = NewEntity.WorkItemID;

                bworkitem.StepName = ProcessConstString.SubmitAction.LetterReceiveAction.ACTION_FF2;
                NewEntity.StepName = ProcessConstString.SubmitAction.LetterReceiveAction.ACTION_FF2;

                bworkitem.SubmitDate = System.DateTime.Now;
                NewEntity.SubmitDate = System.DateTime.Now;

                bworkitem.CommentList.Clear();

                bworkitem.UrgentDegree = this.ddlUrgentDegree.SelectedValue;
                NewEntity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;

                bworkitem.DocumentNo = this.txtDocumentNo.Text;
                NewEntity.DocumentNo = this.txtDocumentNo.Text;

                bworkitem.ReceiptDate = this.txtReceiveDate.Text != string.Empty ? DateTime.Parse(this.txtReceiveDate.Text) : DateTime.MinValue;
                NewEntity.ReceiptDate = this.txtReceiveDate.Text != string.Empty ? DateTime.Parse(this.txtReceiveDate.Text) : DateTime.MinValue;

                bworkitem.FileEncoding = this.txtDocumentEncoding.Text;
                NewEntity.FileEncoding = this.txtDocumentEncoding.Text;

                bworkitem.CommunicationUnit = this.txtReceiveUnit.Text;
                NewEntity.CommunicationUnit = this.txtReceiveUnit.Text;

                bworkitem.DocumentTitle = this.txtDocumentTitle.Text;
                NewEntity.DocumentTitle = this.txtDocumentTitle.Text;

                bworkitem.Remarks = this.txtRemark.Text;
                NewEntity.Remarks = this.txtRemark.Text;

                bworkitem.FileList = this.ucAttachment.UCDataList;
                NewEntity.FileList = this.ucAttachment.UCDataList;

                bworkitem.ReceiveDateTime = DateTime.Now;
                NewEntity.ReceiveDateTime = DateTime.Now;

                bworkitem.ReceiveUserID = CurrentUserInfo.UserName;
                NewEntity.ReceiveUserID = CurrentUserInfo.UserName;

                bworkitem.ReceiveUserName   = CurrentUserInfo.DisplayName;
                NewEntity.ReceiveUserName   = CurrentUserInfo.DisplayName;
                NewEntity.D_StepStatus      = bworkitem.D_StepStatus;
                NewEntity.ReceiptDate       = bworkitem.ReceiptDate;
                NewEntity.Pages             = bworkitem.Pages;
                NewEntity.ChuanYueLeader    = bworkitem.ChuanYueLeader;
                NewEntity.AssistDept        = bworkitem.AssistDept;
                NewEntity.AssistDeptName    = bworkitem.AssistDeptName;
                NewEntity.ChuanYueLeader    = bworkitem.ChuanYueLeader;
                NewEntity.ChuanYueDept      = bworkitem.ChuanYueDept;
                NewEntity.LeaderShip        = bworkitem.LeaderShip;
                NewEntity.LeaderShipName    = bworkitem.LeaderShipName;
                NewEntity.LS_Comment        = bworkitem.LS_Comment;
                NewEntity.UnderTakeID       = bworkitem.UnderTakeID;
                NewEntity.UnderTake         = bworkitem.UnderTake;
                NewEntity.UnderTake_Comment = bworkitem.UnderTake_Comment;
                NewEntity.UnderTakeLeaders  = bworkitem.UnderTakeLeaders;
                NewEntity.NiBanRen          = bworkitem.NiBanRen;
                NewEntity.NiBanRenName      = bworkitem.NiBanRenName;
                NewEntity.NiBanComment      = bworkitem.NiBanComment;
                NewEntity.Drafter           = bworkitem.Drafter;
                NewEntity.DraftDate         = bworkitem.DraftDate;
                NewEntity.RegisterID        = bworkitem.RegisterID;
                NewEntity.Prompt            = bworkitem.Prompt;
                NewEntity.ChuanYueDeptID    = bworkitem.ChuanYueDeptID;
                NewEntity.HJPrompt          = bworkitem.HJPrompt;
                NewEntity.ChuanYueLeaderID  = bworkitem.ChuanYueLeaderID;
                NewEntity.AgentUserName     = bworkitem.AgentUserName;
                NewEntity.AgentUserID       = bworkitem.AgentUserID;

                NewEntity.FormsData = XmlUtility.SerializeXml(bworkitem as EntityBase);
                FormSave.SaveEntity(NewEntity, false);

                if (B_ProcessInstance.IsCompletedOrCancel(NewEntity.ProcessID))
                {
                    B_ProcessInstance.MoveToBakTable(NewEntity.WorkItemID, "T_OA_HS_WorkItems", "T_OA_HS_WorkItems_BAK"); //在备份库中插入数据
                    B_ProcessInstance.UpdateRecordStatus(NewEntity.WorkItemID, 2);                                        //将现行库数据更新为不可用。
                }

                btnModify_Click(null, null);

                //string filedata = "<FileList />";
                //if (this.ucAttachment.UCDataList.Count > 0)
                //{
                //    string formdata = XmlUtility.SerializeXml<B_LetterReceive>(bworkitem);
                //    int iStartIndex = formdata.IndexOf("<FileList>");
                //    int iEndIndex = formdata.IndexOf("</FileList>");
                //    if (iEndIndex > iStartIndex)
                //    {
                //        filedata = formdata.Substring(iStartIndex, iEndIndex - iStartIndex);
                //        filedata += "</FileList>";
                //    }
                //}
                //FormsMethod.UpdateAssignFileData(bworkitem.ProcessID,ProcessConstString.TemplateName.LETTER_RECEIVE, "", filedata);
                List <EntityBase> bworkitemsAssign = B_FormsData.GetEntities(this.txtProcessID.Text, "", ProcessConstString.TemplateName.LETTER_RECEIVE, "", true, "'New','Assigned'");
                string            strUpdatePeople  = string.Empty;
                foreach (EntityBase entity in bworkitemsAssign)
                {
                    B_LetterReceive lentity = entity as B_LetterReceive;

                    lentity.SubmitDate = System.DateTime.Now;

                    lentity.UrgentDegree = this.ddlUrgentDegree.SelectedValue;

                    lentity.DocumentNo = this.txtDocumentNo.Text;

                    lentity.ReceiptDate  = this.txtReceiveDate.Text != string.Empty ? DateTime.Parse(this.txtReceiveDate.Text) : DateTime.MinValue;
                    lentity.FileEncoding = this.txtDocumentEncoding.Text;

                    lentity.CommunicationUnit = this.txtReceiveUnit.Text;

                    lentity.DocumentTitle = this.txtDocumentTitle.Text;

                    lentity.Remarks = this.txtRemark.Text;

                    lentity.FileList = this.ucAttachment.UCDataList;
                    FormSave.SaveEntity(lentity as EntityBase, true);
                    strUpdatePeople += lentity.ReceiveUserName + ",";
                }
                B_ToCirculate l_busCirculate = new B_ToCirculate();
                l_busCirculate.IsAgain       = true;
                l_busCirculate.ToProcessType = ProcessConstString.TemplateName.LETTER_RECEIVE;
                l_busCirculate.ToProcessID   = bworkitem.ProcessID;
                l_busCirculate.ToWorkItemID  = bworkitem.WorkItemID;
                l_busCirculate.ToUserIDS     = B_FormsData.GetProcessPeople("'Completed','Removed'", this.txtProcessID.Text, ";", true);
                string strInfo = string.Empty;
                if (l_busCirculate.ToUserIDS != string.Empty)
                {
                    strInfo = l_busCirculate.ChuanYueToDB();
                }
                strUpdatePeople = strUpdatePeople.Length > 0?strUpdatePeople.Substring(0, strUpdatePeople.Length - 1):"";
                strInfo         = strInfo.Replace("传阅成功", "二次分发成功");
                strInfo        += string.IsNullOrEmpty(strInfo) ? "" : "\\n";
                strInfo        += string.IsNullOrEmpty(strUpdatePeople) ? "" : ("(" + strUpdatePeople + ")更新成功!");
                if (strInfo != string.Empty)
                {
                    JScript.Alert(strInfo);
                }
                else
                {
                    JScript.Alert("二次分发成功!无人员传阅和数据更新!");
                }
            }
            catch
            {
                JScript.Alert("二次分发失败!");
            }
        }
        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;
            }
        }
 //更新流程第一个节点的WorkItemID
 private void UpdateDBWorkItem(String wid, Boolean isAddWorkItemID, String subaction, String strform, String stepstatus, String step, Boolean isChangStep)
 {
     B_FormsData l_busFormsData = new B_FormsData();
     l_busFormsData.UpdateWorkItemId(this.WorkItemTable, this.ProcessID, wid, isAddWorkItemID, subaction, strform, stepstatus, step, isChangStep);
 }
 public LsEntity GetList(string sProc, string sStep, DateTime dtStart, DateTime dtEnd)
 {
     return(B_FormsData.GetEntities(sProc, sStep, dtStart, dtEnd, true));
 }