public List <DictionaryVmodel> GetProReportInstance(string strMonthReportID, string strProType, string strSystemID, string strBusinessID) { ReportInstance rpt = null; if (string.IsNullOrEmpty(strProType)) { rpt = new ReportInstance(strMonthReportID.ToGuid(), true); } else { B_SystemBatch _BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(strBusinessID.ToGuid()); if (_BatchModel != null) { List <V_SubReport> rptList = JsonHelper.Deserialize <List <V_SubReport> >(_BatchModel.SubReport); V_SubReport rptModel = rptList.Find(p => p.SystemID == strSystemID.ToGuid()); rpt = new ReportInstance(rptModel.ReportID, true); } } List <DictionaryVmodel> listSRDS = ReportInstanceSummaryEngine.ReportInstanceSummaryService.GetSummaryRptDataSource(rpt, false); return(listSRDS); }
/// <summary> /// 业务处理,更新Monthlyreport表ProcessOwn字段,添加actio表记录 /// </summary> public void DisposeBusinessData() { #region 业务处理 if (string.IsNullOrEmpty(this.BusinessID)) { throw new Exception("BusinessID is null!"); } else { //添加谁点击了提交审批按钮 B_MonthlyReport ReportModel = null; B_SystemBatch _BatchModel = null; //正常的月报ID if (string.IsNullOrEmpty(ProType)) { ReportModel = B_MonthlyreportOperator.Instance.GetMonthlyreport(BusinessID.ToGuid()); //月报业务ID ,没有问题 if (string.IsNullOrEmpty(ReportModel.ProcessOwn)) { ReportModel.ProcessOwn = this.CurrentUser; B_MonthlyreportOperator.Instance.UpdateMonthlyreport(ReportModel); } B_MonthlyReportAction _bMonthlyReportAction = new B_MonthlyReportAction(); _bMonthlyReportAction.SystemID = ReportModel.SystemID; _bMonthlyReportAction.MonthlyReportID = ReportModel.ID; _bMonthlyReportAction.FinYear = ReportModel.FinYear; _bMonthlyReportAction.FinMonth = ReportModel.FinMonth; _bMonthlyReportAction.Action = EnumHelper.GetEnumDescription(typeof(MonthlyReportLogActionType), (int)MonthlyReportLogActionType.Submit); _bMonthlyReportAction.Operator = this.CurrentUser; _bMonthlyReportAction.OperatorTime = DateTime.Now; _bMonthlyReportAction.ModifierName = this.CurrentUser; _bMonthlyReportAction.CreatorName = this.CurrentUser; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(_bMonthlyReportAction); } else { //批次ID获取实体 _BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(BusinessID.ToGuid()); _BatchModel.ModifierName = this.CurrentUser; B_SystemBatchOperator.Instance.UpdateSystemBatch(_BatchModel); B_MonthlyReportAction _bMonthlyReportAction = new B_MonthlyReportAction(); _bMonthlyReportAction.SystemID = Guid.Empty; _bMonthlyReportAction.MonthlyReportID = _BatchModel.ID; _bMonthlyReportAction.FinYear = _BatchModel.FinYear; _bMonthlyReportAction.FinMonth = _BatchModel.FinMonth; _bMonthlyReportAction.Action = EnumHelper.GetEnumDescription(typeof(MonthlyReportLogActionType), (int)MonthlyReportLogActionType.Submit); _bMonthlyReportAction.Operator = this.CurrentUser; _bMonthlyReportAction.OperatorTime = DateTime.Now; _bMonthlyReportAction.ModifierName = this.CurrentUser; _bMonthlyReportAction.CreatorName = this.CurrentUser; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(_bMonthlyReportAction); } } #endregion }
/// <summary> /// 审批页面使用,审批页面数据不判断权限 /// </summary> /// <param name="unUseful">没用,只是为了重载</param> /// <param name="monthReportID"></param> /// <param name="isAll"></param> public ReportInstance(Guid?monthReportID, Guid?systemBatchId, bool isAll) { if (monthReportID != null && monthReportID != Guid.Empty) { _MonthReportID = monthReportID.Value; B_MonthlyReport report = B_MonthlyreportOperator.Instance.GetMonthlyreport(_MonthReportID); _SystemID = report.SystemID; _SystemBatchID = report.SystemBatchID; TargetPlanID = report.TargetPlanID; AreaID = report.AreaID; FinYear = report.FinYear; FinMonth = report.FinMonth; } else if (systemBatchId != null && monthReportID != Guid.Empty) { B_SystemBatch b_SystemBatch = B_SystemBatchOperator.Instance.GetSystemBatch(systemBatchId.Value); C_System c_System = StaticResource.Instance.SystemList.Where(x => x.GroupType == b_SystemBatch.BatchType).FirstOrDefault(); _SystemID = c_System.ID; _SystemBatchID = b_SystemBatch.ID; TargetPlanID = b_SystemBatch.TargetPlanID; FinYear = b_SystemBatch.FinYear; FinMonth = b_SystemBatch.FinMonth; } DataSource = "Draft"; UserPermission = false; InitialData(true, isAll); }
/// <summary> ///新流程结束 /// </summary> protected void OnProcessCompletedBusinessData() { if (!string.IsNullOrEmpty(this.ProType))//批次 { B_SystemBatch sysBatch = B_SystemBatchOperator.Instance.GetSystemBatch(BusinessID.ToGuid()); ExceptionHelper.TrueThrow(sysBatch == null, string.Format("cannot find the report data which id={0}", BusinessID)); //获取批次A表中的数据 A_SystemBatch _sysBatch = A_SystemBatchOperator.Instance.GetSystemBatch("ProSystem", sysBatch.FinYear, sysBatch.FinMonth); if (_sysBatch == null) { AddBatchData(sysBatch); } else { //先删除数据,在添加数据 int succeed = A_SystemBatchOperator.Instance.DeleteSystemBatch(_sysBatch); ExceptionHelper.TrueThrow(succeed == 0, string.Format("批次表删除失败,批次ID:{0}", _sysBatch.ID)); AddBatchData(sysBatch); } } else { //不包含批次的 //这里通过BusinessID 获取流程批次的信息 B_MonthlyReport mrpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(BusinessID.ToGuid()); ExceptionHelper.TrueThrow(mrpt == null, string.Format("cannot find the report data which id={0}", BusinessID)); List <B_MonthlyReportDetail> rptDetailList = B_MonthlyreportdetailOperator.Instance.GetMonthlyreportdetailList(mrpt.ID).ToList(); mrpt.WFStatus = "Approved"; B_MonthlyreportOperator.Instance.UpdateMonthlyreport(mrpt); //更新 BtoAData(mrpt, rptDetailList); } }
public void debugg(string BusinessID) { B_SystemBatch sysBatch = B_SystemBatchOperator.Instance.GetSystemBatch(new Guid(BusinessID)); //获取批次 List <V_SubReport> BatchRptList = JsonConvert.DeserializeObject <List <V_SubReport> >(sysBatch.SubReport); //批次更新 BatchRptList.ForEach(p => { Update(p); }); }
/// <summary> /// 添加批次Model /// </summary> /// <returns></returns> public B_SystemBatch AddSystemBatch() { B_SystemBatch BatchModel = new B_SystemBatch(); BatchModel.BatchType = "ProSystem"; BatchModel.FinMonth = FinMonth; BatchModel.FinYear = FinYear; BatchModel.WFBatchStatus = "Draft"; BatchModel.ID = Guid.NewGuid(); List <V_SubReport> SubReportList = new List <V_SubReport>(); //获取项目系统的公司 List <C_System> ProSysList = StaticResource.Instance.SystemList.Where(p => p.GroupType == "ProSystem").OrderBy(PR => PR.Sequence).ToList(); //循环添加B_MonthlyReport表数据 foreach (var item in ProSysList) { B_MonthlyReport BatchMonthlyReport = new B_MonthlyReport(); BatchMonthlyReport.SystemID = item.ID; BatchMonthlyReport.FinMonth = FinMonth; BatchMonthlyReport.FinYear = FinYear; BatchMonthlyReport.Status = 2; BatchMonthlyReport.WFStatus = "Draft"; BatchMonthlyReport.SystemBatchID = BatchModel.ID; BatchMonthlyReport.CreateTime = DateTime.Now; BatchMonthlyReport.ID = B_MonthlyreportOperator.Instance.AddMonthlyreport(BatchMonthlyReport); //添加数据 ,如果是当前选择的系统,isreaday==true if (ddlSystem.SelectedValue == item.ID.ToString()) { SubReportList.Add(new V_SubReport(item.ID, item.SystemName, BatchMonthlyReport.ID, false)); AddBMRD(BatchMonthlyReport); // 添加明细数据 hideMonthReportID.Value = BatchMonthlyReport.ID.ToString(); //将新增的月报ID,存在影藏控件中 HiddenBatch.Value = BatchMonthlyReport.ID.ToString(); MutipleUpload.LoadByBusinessID(BatchMonthlyReport.ID.ToString()); //添加附件ID UserControl.SetButtonSpanStyle(BatchMonthlyReport.Status); //设置第几步的状态 } else { //判断其它系统的提交状态 SubReportList.Add(new V_SubReport(item.ID, item.SystemName, BatchMonthlyReport.ID, false)); } } BatchModel.SubReport = JsonConvert.SerializeObject(SubReportList); BatchModel.ID = B_SystemBatchOperator.Instance.AddSystemBatch(BatchModel); return(BatchModel); }
//protected string GetDescription(Guid systemtId, int year, int month) //{ // string Description = string.Empty; // C_System sysModel = StaticResource.Instance[systemtId, DateTime.Now]; // XElement element = sysModel.Configuration; // var RptList = B_MonthlyreportdetailOperator.Instance.GetMonthlyReportDetailList_Approve(systemtId, year, month, Guid.Empty,,false); // if (element.Elements("Report").Elements("Rgroup") != null) // { // Description = element.Element("Report").GetElementValue("Rgroup", ""); // if (!string.IsNullOrEmpty(Description)) // { // Hashtable p = MonthDescriptionValueEngine.MonthDescriptionValueService.GetMonthDescriptionValue(RptList, systemtId, ""); // foreach (string key in p.Keys) // { // Description = Description.Replace("【" + key + "】", p[key].ToString()); // } // } // } // return Description; //} public void AddMonthlyReport(B_SystemBatch batch, C_System c_System, string description) { B_MonthlyReport bmr = new B_MonthlyReport(); bmr.ID = batch.ID; bmr.SystemID = c_System.ID; bmr.AreaID = Guid.Empty; bmr.FinMonth = batch.FinMonth; bmr.FinYear = batch.FinYear; bmr.Status = 2; bmr.WFStatus = "Progress"; bmr.CreateTime = DateTime.Now; bmr.Description = description; bmr.ID = B_MonthlyreportOperator.Instance.AddMonthlyreport(bmr); }
/// <summary> /// 通过批次获取月报的审批 /// </summary> private void LoadBatchData() { hideBusinessID.Value = Request.QueryString["BusinessID"]; hideProType.Value = Request.QueryString["ProType"]; #region 获取子流程和主流程的审批日志 _BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(Guid.Parse(Request.QueryString["BusinessID"])); List <ProcessLog> listALLProLog = new List <ProcessLog>(); List <ProcessLog> listProLog = new List <ProcessLog>(); //JsonConvert.DeserializeObject<List<ProcessLog>>(_BatchModel.Opinions); List <V_SubReport> BatchRptList = JsonConvert.DeserializeObject <List <V_SubReport> >(_BatchModel.SubReport); for (int i = 0; i < BatchRptList.Count; i++) { if (BPF.Workflow.Client.WFClientSDK.Exist(BatchRptList[i].ReportID.ToString())) { listProLog.AddRange(BPF.Workflow.Client.WFClientSDK.GetProcessLogList(BatchRptList[i].ReportID.ToString())); } } List <ProcessLog> listBatchProLog = null; if (BPF.Workflow.Client.WFClientSDK.Exist(_BatchModel.ID.ToString())) { listBatchProLog = BPF.Workflow.Client.WFClientSDK.GetProcessLogList(_BatchModel.ID.ToString()); //JsonConvert.DeserializeObject<List<ProcessLog>>(_BatchModel.Batch_Opinions); } if (listBatchProLog != null) { listALLProLog.AddRange(listBatchProLog); } if (listProLog != null) { listALLProLog.AddRange(listProLog); } if (listALLProLog != null) { //这里去掉汇总审批时的虚拟节点同意日志 HideOpinions.Value = JsonConvert.SerializeObject(listALLProLog.Where(p => p.NodeType != 7).OrderByDescending(p => p.FinishDateTime)); } #endregion C_System c_System = StaticResource.Instance.SystemList.Where(x => x.GroupType == _BatchModel.BatchType).FirstOrDefault(); hideSystemID.Value = c_System.ID.ToString(); hideProcessCode.Value = StaticResource.Instance[c_System.ID, DateTime.Now].Configuration.Element("ProcessCode").Value; lblName.Text = _BatchModel.FinYear + "-" + _BatchModel.FinMonth + "月度经营报告"; hideFinMonth.Value = _BatchModel.FinMonth.ToString(); hideProType.Value = Request.QueryString["ProType"]; hideBatchID.Value = _BatchModel.ID.ToString(); //hideMonthReportID.Value = _BatchModel.ID.ToString(); hideMonthReportID.Value = Guid.Empty.ToString(); hideFinYear.Value = _BatchModel.FinYear.ToString(); }
/// <summary> /// 处理流程按钮事件 /// </summary> /// <param name="UserLonginID"></param> public void ExecutionBusinessData(string UserLonginID = null) { switch (this.ExecType) { case "saveApplicationData": SaveApplactionBusinessData(); break; case "afterAction": ProcessExecuteBusinessData(); AfterExcuteBusinessData(UserLonginID); if (string.IsNullOrEmpty(ProType)) { B_MonthlyReport ReportModelA = B_MonthlyreportOperator.Instance.GetMonthlyreport(BusinessID.ToGuid()); List <NavigatActivity1> lstna = GetProcessIntance(ReportModelA.ID.ToString(), UserLonginID); string Json = Newtonsoft.Json.JsonConvert.SerializeObject(lstna); if (ReportModelA.WFStatus == "Draft" && OperaionTypes == 7) { ReportModelA.ReportApprove = null; } else { ReportModelA.ReportApprove = Json; } B_MonthlyreportOperator.Instance.UpdateMonthlyreport(ReportModelA); } else { B_SystemBatch SystemBatchA = B_SystemBatchOperator.Instance.GetSystemBatch(BusinessID.ToGuid()); List <NavigatActivity1> lstna = GetProcessIntance(SystemBatchA.ID.ToString(), UserLonginID); string Json = Newtonsoft.Json.JsonConvert.SerializeObject(lstna); SystemBatchA.ReportApprove = Json; B_SystemBatchOperator.Instance.UpdateSystemBatch(SystemBatchA); } break; case "beforeAction": BeforeExcuteBusinessData(); break; } }
public void Execute(Quartz.IJobExecutionContext context) { Common.ScheduleService.Log.Instance.Info("合并流程服务,开始执行"); DateTime datetime = StaticResource.Instance.GetReportDateTime(); finMonth = datetime.Month; finYear = datetime.Year; //string[] array = System.Configuration.ConfigurationManager.AppSettings["GroupTypes"].Split(new char[] { ','},StringSplitOptions.RemoveEmptyEntries); var array = StaticResource.Instance.SystemList.Where(x => !string.IsNullOrEmpty(x.GroupType)); foreach (var c_System in array) { bool _WFStarts = true; Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "合并流程服务,读取批次表里是否有合适的数据Stare!"); B_SystemBatch batchModel = B_SystemBatchOperator.Instance.GetSystemBatchByDraft(c_System.GroupType, finYear, finMonth); if (batchModel == null) { continue; } if (batchModel != null) { Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "读取数据成功!" + batchModel.FinYear + "年" + batchModel.FinMonth + "月"); BatchRptList = JsonConvert.DeserializeObject <List <V_SubReport> >(batchModel.SubReport); int n = BatchRptList.Count(x => !x.IsReady); _WFStarts = n == 0; } Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "合并流程服务,读取批次表里是否有合适的数据End!"); if (_WFStarts) { string ProcessKey = c_System.Configuration.Element("ProcessCode").Value + "-HB"; //string ProcessKey = "YY_ZBGK-FDCHZ"; Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "合并流程服务,有符合条件的的数据!"); this.ProcessKey = ProcessKey; this.BusinessID = batchModel.ID.ToString(); Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "合并流程服务,有符合条件的的数据BusinessID=" + this.BusinessID + "!"); //添加日志 B_MonthlyReportAction _bMonthlyReportAction = new B_MonthlyReportAction(); _bMonthlyReportAction.SystemID = Guid.Empty; _bMonthlyReportAction.MonthlyReportID = batchModel.ID; _bMonthlyReportAction.FinYear = batchModel.FinYear; _bMonthlyReportAction.FinMonth = batchModel.FinMonth; _bMonthlyReportAction.Action = EnumHelper.GetEnumDescription(typeof(MonthlyReportLogActionType), (int)MonthlyReportLogActionType.Submit); _bMonthlyReportAction.Operator = this.CurrentUser; _bMonthlyReportAction.OperatorTime = DateTime.Now; _bMonthlyReportAction.ModifierName = this.CurrentUser; _bMonthlyReportAction.CreatorName = this.CurrentUser; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(_bMonthlyReportAction); Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "合并流程服务,准备启动合并流程数据!"); try { if (!WFClientSDK.Exist(BusinessID)) //判断业务ID是否存在 { //开启流程 CallMethed("startprocess", c_System.GroupType); Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "合并流程服务,合并流程数据启动完成!"); } else { Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "合并流程服务,有错误!!!!!!"); //当汇总后流程退回,再次发起用该方法 if (batchModel.WFBatchStatus == "Draft") { #region 该方法只能在草稿状态的时候启动 try { string FinYear = batchModel.FinYear.ToString() + "年"; string FinMonth = batchModel.FinMonth.ToString("D2"); //string _Title = "项目系统(南、中、北、大项目)" + FinYear + FinMonth + "月度报告"; string _Title = c_System.SystemName + FinYear + FinMonth + "汇总月度报告"; Dictionary <string, string> Dic = new Dictionary <string, string>(); Dic["ReportName"] = _Title; Dic["ProcessKey"] = ProcessKey; #region 记录审批日志的Json Common.ScheduleService.Log.Instance.Info("合并流程再次启动开始!"); string opiniontext = string.Empty; //重新在批次表中,获取数据 BatchRptList = JsonConvert.DeserializeObject <List <V_SubReport> >(batchModel.SubReport); List <BPF.Workflow.Object.ProcessLog> _list = new List <ProcessLog>(); if (BatchRptList.Count > 0) { BatchRptList.ForEach(BR => { //B_MonthlyReport bm = B_MonthlyreportOperator.Instance.GetMonthlyreport(BR.ReportID); _list.AddRange(BPF.Workflow.Client.WFClientSDK.GetProcessLogList(BR.ReportID.ToString())); }); } batchModel.Opinions = JsonConvert.SerializeObject(_list.OrderByDescending(p => p.FinishDateTime)); #endregion WorkflowContext workflow = WFClientSDK.GetProcess(null, this.BusinessID, new UserInfo() { UserCode = "$VirtualUserCode$" + this.CurrentUser }); Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "合并流程,获取流程成功!"); //先启动流程,流程能启动了,在写入数据库流程审批日志 Dictionary <string, object> formParams = new Dictionary <string, object>(); formParams.Add("ReportName", _Title); formParams.Add("ProcessKey", ProcessKey); var DynamicRoleUserList = JsonUser.GetDynamicRoleUserList(ProcessKey); BizContext bizContext = new BizContext(); bizContext.NodeInstanceList = workflow.NodeInstanceList; bizContext.ProcessRunningNodeID = workflow.ProcessInstance.RunningNodeID; bizContext.BusinessID = BusinessID; bizContext.FlowCode = ProcessKey; bizContext.ApprovalContent = "各区域数据已经汇总完成,请领导审批"; bizContext.CurrentUser = new UserInfo() { UserCode = "$VirtualUserCode$" + this.CurrentUser }; bizContext.ProcessURL = "/BusinessReport/TargetApprove.aspx?ProType=Batch"; bizContext.FormParams = formParams; bizContext.DynamicRoleUserList = DynamicRoleUserList; bizContext.ExtensionCommond = new Dictionary <string, string>(); bizContext.ExtensionCommond.Add("RejectNode", Guid.Empty.ToString()); Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "合并流程,流程参数配置成功!"); WorkflowContext wfc = WFClientSDK.ExecuteMethod("SubmitProcess", bizContext); Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "合并流程,流程提交成功!"); OperationType = 1; //ProcessExecute(); //先启动流程,流程能启动了,在写入数据库流程审批日志 //ProcessResponse r = ClientProcess.MoveTo(BusinessID, "南、北、中、文旅项目已经汇总完成,请领导审批", Dic, "", true); //将批次的审批状态改变 ExceptionHelper.TrueThrow(batchModel == null, string.Format("cannot find the report data which id={0}", BusinessID)); batchModel.WFBatchStatus = "Progress"; //batchModel.Description = GetDescription(c_System.ID, batchModel.FinYear, batchModel.FinMonth); //获取流程导航 List <NavigatActivity1> listna = GetProcessIntance(wfc); if (listna.Count > 0) { batchModel.ReportApprove = JsonConvert.SerializeObject(listna); } B_SystemBatchOperator.Instance.UpdateSystemBatch(batchModel); Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "合并流程服务,再次合并流程数据启动完成!"); } catch (Exception ex) { Common.ScheduleService.Log.Instance.Error(c_System.SystemName + "合并流程再次启动失败!,错误信息:" + ex.ToString()); } #endregion } } } catch (Exception ex) { Common.ScheduleService.Log.Instance.Error("合并流程启动失败!,错误信息:" + ex.ToString()); } } else { Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "合并流程服务,没有查找到符合条件合并流程!"); } } }
protected void StartProcess(string groupType) { Dictionary <string, object> formParams = new Dictionary <string, object>(); var c_System = StaticResource.Instance.SystemList.Where(x => x.GroupType == groupType).FirstOrDefault(); string ProcessKey = c_System.Configuration.Element("ProcessCode").Value + "-HB"; //string ProcessKey = "YY_ZBGK-FDCHZ"; //系统2014年7月月报 B_SystemBatch batch = B_SystemBatchOperator.Instance.GetSystemBatch(Guid.Parse(BusinessID)); string FinYear = batch.FinYear.ToString() + "年"; string FinMonth = batch.FinMonth.ToString("D2"); string _Title = c_System.SystemName + FinYear + FinMonth + "汇总月度报告"; formParams.Add("ReportName", _Title); formParams.Add("ProcessKey", ProcessKey); Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "合并流程服务,合并流程启动, 上报年:" + FinYear + ",上报月:" + FinMonth); Dictionary <string, string> Dic = new Dictionary <string, string>(); Dic["ReportName"] = _Title; Dic["ProcessKey"] = ProcessKey; WorkflowContext wfc = null; try { Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "合并流程启动开始!"); var dynamicRoleUserList = JsonUser.GetDynamicRoleUserList(ProcessKey); var starup = new BPF.Workflow.Client.WFStartupParameter() { FlowCode = ProcessKey, BusinessID = this.BusinessID, CurrentUser = new UserInfo() { UserCode = "$VirtualUserCode$" + this.CurrentUser }, FormParams = formParams, DynamicRoleUserList = dynamicRoleUserList, }; string opiniontext = string.Empty; //重新在批次表中,获取数据 BatchRptList = JsonConvert.DeserializeObject <List <V_SubReport> >(batch.SubReport); List <BPF.Workflow.Object.ProcessLog> _list = new List <ProcessLog>(); if (BatchRptList.Count > 0) { BatchRptList.ForEach(BR => { //B_MonthlyReport bm = B_MonthlyreportOperator.Instance.GetMonthlyreport(BR.ReportID); _list.AddRange(BPF.Workflow.Client.WFClientSDK.GetProcessLogList(BR.ReportID.ToString())); }); } batch.Opinions = JsonConvert.SerializeObject(_list); WorkflowContext workflow = WFClientSDK.CreateProcess(null, starup); Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "项目系统合并流程启动中!"); BizContext bizContext = new BizContext(); bizContext.NodeInstanceList = workflow.NodeInstanceList; bizContext.ProcessRunningNodeID = workflow.ProcessInstance.RunningNodeID; bizContext.BusinessID = BusinessID; bizContext.FlowCode = ProcessKey; bizContext.ApprovalContent = c_System.SystemName + "各区域数据已经汇总完成,请领导审批"; // bizContext.CurrentUser = new UserInfo() { UserCode = "$VirtualUserCode$项目汇总服务" }; bizContext.CurrentUser = new UserInfo() { UserCode = "$VirtualUserCode$" + this.CurrentUser }; bizContext.ProcessURL = "/BusinessReport/TargetApprove.aspx?ProType=Batch"; bizContext.FormParams = formParams; bizContext.ExtensionCommond = new Dictionary <string, string>(); bizContext.ExtensionCommond.Add("RejectNode", Guid.Empty.ToString()); bizContext.DynamicRoleUserList = dynamicRoleUserList; wfc = WFClientSDK.ExecuteMethod("SubmitProcess", bizContext); if (wfc.StatusCode != 0) { throw new Exception(wfc.StatusMessage + "; BusinessID = " + BusinessID); } //提交操作状态为1 OperationType = 1; Common.ScheduleService.Log.Instance.Info(c_System.SystemName + "合并流程启动结束!"); } catch (Exception ex) { Common.ScheduleService.Log.Instance.Error(c_System.SystemName + "合并流程启动失败!,错误信息:" + ex.ToString()); batch = null; } //将批次的审批状态改变 ExceptionHelper.TrueThrow(batch == null, string.Format("cannot find the report data which id={0}", BusinessID)); batch.WFBatchStatus = "Progress"; //跟新后面两个大老板的状态 //var AP = ProcessResponse.GetProcess(batch.ID.ToString(), null); //List<NavigatActivity> APlist = AP.Navigat; //string Json = Newtonsoft.Json.JsonConvert.SerializeObject(APlist); //batch.ReportApprove = Json; //获取流程导航 List <NavigatActivity1> listna = GetProcessIntance(wfc); if (listna.Count > 0) { batch.ReportApprove = JsonConvert.SerializeObject(listna); } //batch.Description = GetDescription(c_System.ID, batch.FinYear, batch.FinMonth); //修改批次数据 B_SystemBatchOperator.Instance.UpdateSystemBatch(batch); }
/// <summary> /// 获取区域公司总计的实体(第一步) /// </summary> /// <param name="ProCounter"></param> /// <returns></returns> private List <V_ProjectCompany> GetProjectModel(ProjectCounter ProCounter) { Guid SysId = Guid.Empty; //从XML中获取的系统ID Guid _CompanyId = Guid.Empty; if (!string.IsNullOrEmpty(ProCounter.CompanyID)) { _CompanyId = Guid.Parse(ProCounter.CompanyID); } //公司,区域小计的ID,从XML中获取的 C_Company itemCompany = C_CompanyOperator.Instance.GetCompany(_CompanyId); SysId = itemCompany.SystemID; //指标List List <C_Target> targetList = StaticResource.Instance.TargetList[SysId].ToList(); //项目公司 List <V_ProjectCompany> ProCompanyList = new List <V_ProjectCompany>(); ReportInstance rpt = null; //获取批次ID,如果_MonthReportID 不是为Guid.Empty ,表示:是从上报页面过来的 //反之,则代表是从查询页面传递过来的 if (currRptModel._MonthReportID != Guid.Empty) { //上报页面 ExceptionHelper.TrueThrow(currRptModel.LastestMonthlyReport == null, "B_MonthlyReport表为Null"); if (currRptModel.LastestMonthlyReport.SystemBatchID != Guid.Empty) { B_SystemBatch _BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(currRptModel.LastestMonthlyReport.SystemBatchID); List <V_SubReport> subRptList = JsonHelper.Deserialize <List <V_SubReport> >(_BatchModel.SubReport); subRptList.ForEach(p => { if (p.SystemID == SysId) { rpt = new ReportInstance(p.ReportID, true);// 从B表中获取根据ReportID获取 } }); } else { rpt = currRptModel; } } else { //查询页面, 通过系统倒序查找相应的项目系统 rpt = new ReportInstance(SysId, FinYear, FinMonth, IsLatestVersion); } ProjectCompanyDetails = rpt.ReportDetails; //计划指标,包含了 区域小计的指标 List <A_TargetPlanDetail> TargetPlanList = new List <A_TargetPlanDetail>(); if (currRptModel._MonthReportID != Guid.Empty) { //上报的时候总是获取最新的指标。 TargetPlanList = StaticResource.Instance.GetTargetPlanList(SysId, FinYear, FinMonth); } else { //查询的时候按照版本查询,从B表中查出后转换成A表的数据 List <B_TargetPlanDetail> _bTargetPlanList = new List <B_TargetPlanDetail>(); _bTargetPlanList = B_TargetplandetailOperator.Instance.GetTargetplandetailList(rpt.ReportDetails[0].TargetPlanID).ToList(); //将B 表数据添加到 A表中 _bTargetPlanList.ForEach(tp => TargetPlanList.Add(tp.ToAModel())); } List <V_ProjectTarget> ProTargetList = new List <V_ProjectTarget>(); V_ProjectCompany tempProCompany = new V_ProjectCompany(); tempProCompany.ProCompanySequence = itemCompany.Sequence; tempProCompany.SystemID = itemCompany.SystemID; tempProCompany.ProCompayName = itemCompany.CompanyName; tempProCompany.ProCompayID = itemCompany.ID; tempProCompany.ProCompanyProperty1 = itemCompany.CompanyProperty1; tempProCompany.FinYear = FinYear; tempProCompany.FinMonth = FinMonth; tempProCompany.CompayModel = itemCompany; tempProCompany.ProRowSpan = 0; tempProCompany.ProCompanyNumber = 0; //获取批次ID,如果_MonthReportID 不是为Guid.Empty ,表示:是从上报页面过来的 //反之,则代表是从查询页面传递过来的 if (currRptModel._MonthReportID != Guid.Empty) { tempProCompany.ProjectTargets = SingleProTargetLists(targetList, rpt.ReportDetails, TargetPlanList, itemCompany, false); } else { tempProCompany.ProjectTargets = SingleProTargetLists(targetList, rpt.ReportDetails, TargetPlanList, itemCompany, true); } tempProCompany.ProDataType = "XML"; ProCompanyList.Add(tempProCompany); return(ProCompanyList); }
/// <summary> /// 正常获取月报的审批 /// </summary> /// <param name="isFirst"></param> private void LoadData(bool isFirst) { HiddBusinessID.Value = Request.QueryString["BusinessID"]; HideProType.Value = Request.QueryString["ProType"]; //审批页面,判断该月报ID,是否含有批次ID B_MonthlyReport bmonthReport = B_MonthlyreportOperator.Instance.GetMonthlyreport(Guid.Parse(Request.QueryString["BusinessID"])); B_SystemBatch bs = null; List <ProcessLog> lstBatchProcess = new List <ProcessLog>(); if (bmonthReport.SystemBatchID != Guid.Empty) { bs = B_SystemBatchOperator.Instance.GetSystemBatch(bmonthReport.SystemBatchID); if (bs != null) { lstBatchProcess = BPF.Workflow.Client.WFClientSDK.GetProcessLogList(bs.ID.ToString()); //JsonConvert.DeserializeObject<List<ProcessLog>>(bs.Batch_Opinions); } } List <ProcessLog> lstProcess = new List <ProcessLog>(); lstProcess = BPF.Workflow.Client.WFClientSDK.GetProcessLogList(bmonthReport.ID.ToString()); if (lstBatchProcess != null) { lstProcess.AddRange(lstBatchProcess); } HideOpinions.Value = JsonConvert.SerializeObject(lstProcess.Where(p => p.NodeType != 7).OrderByDescending(p => p.FinishDateTime)); List <C_System> sysList = null; if (isFirst) { if (bmonthReport != null) { hideSystemID.Value = bmonthReport.SystemID.ToString(); HideProcessCode.Value = StaticResource.Instance[bmonthReport.SystemID, DateTime.Now].Configuration.Element("ProcessCode").Value; //判断批次号 //if (bmonthReport.SystemBatchID != Guid.Empty) //{ //通过权限,加载可以看到的系统 sysList = new List <C_System>(); if (PermissionList != null && PermissionList.Count > 0) { foreach (var item in PermissionList) { sysList.AddRange(StaticResource.Instance.SystemList.Where(p => p.SystemName == item.ToString()).ToList()); } } /* 暂时放开权限*/ if (sysList.Count > 0) { //Category ==1 代表的是经营系统 ddlSystem.DataSource = sysList.Distinct().OrderBy(or => or.Sequence).ToList(); } else { ddlSystem.DataSource = StaticResource.Instance.SystemList.Where(p => p.Category == 2).ToList(); } /* 暂时放开权限*/ ddlSystem.DataTextField = "SystemName"; ddlSystem.DataValueField = "ID"; ddlSystem.DataBind(); //} } ddlSystem.SelectedValue = bmonthReport.SystemID.ToString(); } lblName.Text = bmonthReport.FinYear + "-" + bmonthReport.FinMonth + "月度经营报告"; HiddenMonth.Value = bmonthReport.FinMonth.ToString(); hideMonthReportID.Value = bmonthReport.ID.ToString(); //获取批次实体 //_BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(bmonthReport.SystemBatchID); //if (isFirst) //{ // if (_BatchModel != null) // { // List<V_SubReport> rptList = JsonSerializer.Deserialize<List<V_SubReport>>(_BatchModel.SubReport); // if (sysList.Count == 1) // { // V_SubReport rptModel = rptList.Find(p => p.SystemID == sysList[0].ID); // //在当前批次中,的项目系统 // hideMonthReportID.Value = rptModel.ReportID.ToString(); // } // else // { // ddlSystem.DataSource = rptList; // ddlSystem.DataTextField = "SystemName"; // ddlSystem.DataValueField = "SystemID"; // ddlSystem.DataBind(); // V_SubReport rptModel = rptList.Find(p => p.SystemID == ddlSystem.SelectedValue.ToGuid()); // //在当前批次中,的项目系统 // hideMonthReportID.Value = rptModel.ReportID.ToString(); // } // } //} //else //{ // if (_BatchModel != null) // { // List<V_SubReport> rptList = JsonSerializer.Deserialize<List<V_SubReport>>(_BatchModel.SubReport); // V_SubReport rptModel = rptList.Find(p => p.SystemID == ddlSystem.SelectedValue.ToGuid()); // //在当前批次中,的项目系统 // hideMonthReportID.Value = rptModel.ReportID.ToString(); // } //} }
/// <summary> /// 添加月度报告数据 /// </summary> public void AddMonthlyReport() { HidSystemID.Value = ddlSystem.SelectedValue; HidAreaID.Value = ddlAreaID.Visible ? ddlAreaID.SelectedValue : Guid.Empty.ToString(); hiddenDis.Value = "2"; //如果存在审批中的数据,不让重复提交 var bmrProgress = B_MonthlyreportOperator.Instance.GetMonthlyReportModel(Guid.Parse(ddlSystem.SelectedValue), Guid.Parse(HidAreaID.Value), FinYear, FinMonth, 1, "Progress"); if (bmrProgress != null && bmrProgress.WFStatus == "Progress") { hiddenDis.Value = "1"; hideMonthReportID.Value = bmrProgress.ID.ToString(); return; } HideProcessCode.Value = StaticResource.Instance[ddlSystem.SelectedValue.ToGuid(), DateTime.Now].Configuration.Element("ProcessCode").Value; hiddenDis.Value = "0"; B_SystemBatch BatchModel = null; // 公用的批次 实体 B_MonthlyReport bmr = null; string Gtypt = StaticResource.Instance[ddlSystem.SelectedValue.ToGuid(), DateTime.Now].GroupType; if (!string.IsNullOrEmpty(Gtypt)) { #region 包含在批次里的数据的业务系统 //判断当前URL是否存在BusinessID if (string.IsNullOrEmpty(Request["BusinessID"])) { B_MonthlyReport _statreRpt = null; //-状态B_MonthlyReport - BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(Gtypt, FinYear, FinMonth); //判断批次表中是否有数据 if (BatchModel == null) { BatchModel = AddSystemBatch(Gtypt); if (BatchModel == null) { UserControl.SetButtonSpanStyle(2); return; } } else { //批次不为Null,且批次还是在审批中的。 //批次是草稿状态 List <V_SubReport> V_SubReportList = JsonConvert.DeserializeObject <List <V_SubReport> >(BatchModel.SubReport); //获取上报月报的ID var subRpt = V_SubReportList.Find(SR => SR.SystemID == ddlAreaID.SelectedValue.ToGuid()); B_MonthlyReport monthRpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(subRpt.ReportID); #region 批次存在 //审批进行中,是要被跳转到审批页面的,但是审批完成就需要重新开启新的流程 if (BatchModel.WFBatchStatus == "Progress" || monthRpt.WFStatus == "Progress") { //批次是草稿状态 //var model = V_SubReportList.Find(p => p.SystemID == ddlAreaID.SelectedValue.ToGuid()); //--------------------------------------------------------------------------------------------------------------------------------------------- //这里批次需要控制,每次审批的状态只能是唯一的 // 暂时注销掉 BatchModel = AddSystemBatch(); if (BPF.Workflow.Client.WFClientSDK.Exist(monthRpt.ID.ToString())) { BPF.Workflow.Object.WorkflowContext wc = BPF.Workflow.Client.WFClientSDK.GetProcess(null, monthRpt.ID.ToString()); if (!wc.CurrentUserHasTodoTask) { hiddenDis.Value = "1"; hideMonthReportID.Value = monthRpt.ID.ToString(); return; //Server.Transfer("~/BusinessReport/TargetApprove.aspx?BusinessID=" + host.BusinessID); } else { bmr = monthRpt; hideMonthReportID.Value = monthRpt.ID.ToString(); } } } else if (BatchModel.WFBatchStatus == "Approved") //如果审批是完成状态,重新生产 { BatchModel = AddSystemBatch(Gtypt); } else { //批次是草稿状态 V_SubReportList.ForEach(p => { //选择的是那个系统? if (p.SystemID == Guid.Parse(ddlAreaID.SelectedValue)) { //根据选择的系统,将明细数据展示出来 _statreRpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(p.ReportID); if (_statreRpt.WFStatus == "Cancel") //如果当前月报是作废的状态,则重新生产一个新的ID ( 这里针对作废后,重新起一个流程) { _statreRpt.ID = Guid.NewGuid(); //替换实体ID _statreRpt.WFStatus = "Draft"; _statreRpt.Status = 2; Guid _BRptID = B_MonthlyreportOperator.Instance.AddMonthlyreport(_statreRpt); p.ReportID = _BRptID; HiddenBatch.Value = BatchModel.ID.ToString(); //批次ID不变 hideMonthReportID.Value = p.ReportID.ToString(); } else { //注意这里 hideMonthReportID.Value = p.ReportID.ToString(); HiddenBatch.Value = p.ReportID.ToString(); } AddBMRD(_statreRpt); bmr = _statreRpt; MutipleUpload.LoadByBusinessID(_statreRpt.ID.ToString()); } }); //这里重新序列,将作废后,重新生成的新ID 序列化到批次里 BatchModel.SubReport = JsonConvert.SerializeObject(V_SubReportList); B_SystemBatchOperator.Instance.UpdateSystemBatch(BatchModel); } #endregion } UserControl.SetButtonSpanStyle(bmr == null ? -1 : bmr.Status); } else { //如果是传过来的BusinessID,就直接去查询,不做操作 //通过BusinessID,首先获取批次的实体,根据权限,然后在批次中寻找 bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(Request["BusinessID"].ToGuid()); ExceptionHelper.TrueThrow <ArgumentNullException>(bmr == null ? true : false, "Argument B_MonthlyReport is Null"); HiddenBatch.Value = bmr.SystemBatchID.ToString(); hideMonthReportID.Value = bmr.ID.ToString(); if (bmr.SystemBatchID != Guid.Empty) { //BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(bmr.SystemBatchID); //List<V_SubReport> rptLsit = JsonConvert.DeserializeObject<List<V_SubReport>>(BatchModel.SubReport); //V_SubReport rptModel = rptLsit.Find(f => f.SystemID == ddlSystem.SelectedValue.ToGuid()); //hideMonthReportID.Value = rptModel.ReportID.ToString(); //bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(rptModel.ReportID); //ExceptionHelper.TrueThrow<ArgumentNullException>(bmr == null ? true : false, "Argument B_MonthlyReport is Null"); MutipleUpload.LoadByBusinessID(bmr.ID.ToString()); UserControl.SetButtonSpanStyle(bmr.Status); } } #endregion } else { //判断当前URL是否存在BusinessID if (string.IsNullOrEmpty(Request["BusinessID"])) { //添加月报说明 // bmr = B_MonthlyreportOperator.Instance.GetMonthlyReportDraft(Guid.Parse(ddlSystem.SelectedValue), FinYear, FinMonth); bmr = B_MonthlyreportOperator.Instance.GetMonthlyReportDraft(Guid.Parse(ddlSystem.SelectedValue), Guid.Parse(HidAreaID.Value), FinYear, FinMonth); if (bmr == null) { bmr = AddMR(); } else { if (bmr.WFStatus == "Progress" || bmr.WFStatus == "Approved") { bmr = AddMR(); } } //为当前月度经营报告(bmr),插入月度经营明细数据 AddBMRD(bmr); } else { hideMonthReportID.Value = Request["BusinessID"]; bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(Request["BusinessID"].ToGuid()); ddlSystem.SelectedValue = bmr.SystemID.ToString(); ddlAreaID.SelectedValue = bmr.AreaID.ToString(); FinYear = bmr.FinYear; FinMonth = bmr.FinMonth; lblName.Text = ""; lblName.Text = FinYear + "-" + FinMonth + "月度经营报告上报"; } if (bmr != null) { hideMonthReportID.Value = bmr.ID.ToString(); MutipleUpload.LoadByBusinessID(bmr.ID.ToString()); UserControl.SetButtonSpanStyle(bmr.Status); } else { hiddenDis.Value = "2"; UserControl.SetButtonSpanStyle(-1); } } }
/// <summary> /// 添加更新批次数据 /// </summary> /// <param name="rpt"></param> private void AddBatchData(B_SystemBatch _BatchModel) { //获取批次 List <V_SubReport> BatchRptList = JsonConvert.DeserializeObject <List <V_SubReport> >(_BatchModel.SubReport); //批次更新 BatchRptList.ForEach(p => { B_MonthlyReport tempModel = B_MonthlyreportOperator.Instance.GetMonthlyreport(p.ReportID); List <B_MonthlyReportDetail> rptDetailList = B_MonthlyreportdetailOperator.Instance.GetMonthlyreportdetailList(p.ReportID).ToList(); tempModel.WFStatus = "Approved"; #region 子流程虚拟审批人提交,是流程走完。 try { WorkflowContext workflow = WFClientSDK.GetProcess(null, tempModel.ID.ToString(), new UserInfo() { UserCode = "$VirtualUserCode$虚拟汇总人" }); if (workflow.ProcessInstance.Status != 3) { Dictionary <string, object> formParams = new Dictionary <string, object>(); formParams.Add("ReportName", workflow.ProcessInstance.ProcessTitle); formParams.Add("ProcessKey", workflow.ProcessInstance.FlowCode); BizContext bizContext = new BizContext(); bizContext.NodeInstanceList = workflow.NodeInstanceList; bizContext.ProcessRunningNodeID = workflow.ProcessInstance.RunningNodeID; bizContext.BusinessID = tempModel.ID.ToString(); bizContext.FlowCode = workflow.ProcessInstance.FlowCode; bizContext.ApprovalContent = "同意"; bizContext.CurrentUser = new UserInfo() { UserCode = "$VirtualUserCode$虚拟汇总人" }; bizContext.ProcessURL = "/BusinessReport/ProTargetApprove.aspx"; bizContext.FormParams = formParams; bizContext.ExtensionCommond = new Dictionary <string, string>(); bizContext.ExtensionCommond.Add("RejectNode", Guid.Empty.ToString()); WorkflowContext wfc = WFClientSDK.ExecuteMethod("SubmitProcess", bizContext); } } catch (Exception ex) { ExceptionHelper.TrueThrow(true, string.Format("{0}", ex)); } #endregion B_MonthlyreportOperator.Instance.UpdateMonthlyreport(tempModel); //?? BtoAData(tempModel, rptDetailList); }); _BatchModel.WFBatchStatus = "Approved"; //修改B批次表的审批状态 B_SystemBatchOperator.Instance.UpdateSystemBatch(_BatchModel); //将B批次表信息,添加到A表 A_SystemBatchOperator.Instance.AddSystemBatch(new A_SystemBatch() { ID = _BatchModel.ID, FinYear = _BatchModel.FinYear, FinMonth = _BatchModel.FinMonth, BatchType = _BatchModel.BatchType, WFBatchStatus = _BatchModel.WFBatchStatus, SubReport = _BatchModel.SubReport, CreateTime = DateTime.Now, CreatorName = this.CurrentUser, Opinions = _BatchModel.Opinions, Batch_Opinions = _BatchModel.Batch_Opinions }); }
/// <summary> /// 更新执行工作流后更新对应字段的值。如果是合并审批中退回,退回所有分支流程。 /// </summary> protected void ProcessExecuteBusinessData() { B_MonthlyReport tempRPT = null; B_MonthlyReport rpt = null; B_SystemBatch BacthModel = null; if (string.IsNullOrEmpty(ProType)) //非批次 { rpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(BusinessID.ToGuid()); ExceptionHelper.TrueThrow(rpt == null, string.Format("cannot find the report data which id={0}", BusinessID)); } else //批次 { BacthModel = B_SystemBatchOperator.Instance.GetSystemBatch(BusinessID.ToGuid()); ExceptionHelper.TrueThrow(BacthModel == null, string.Format("cannot find the report data which id={0}", BusinessID)); } //WfOperationInfo wfop = JsonConvert.DeserializeObject<WfOperationInfo>(OperaionInfo); if (!string.IsNullOrEmpty(ProType)) //批次 { List <V_SubReport> monthRpt = JsonConvert.DeserializeObject <List <V_SubReport> >(BacthModel.SubReport); #region 所有子流程的状态 foreach (var item in monthRpt) { B_MonthlyReport _rpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(item.ReportID); tempRPT = _rpt; ExceptionHelper.TrueThrow(_rpt == null, string.Format("cannot find the report data which id={0}", BusinessID)); //工作流状态,如果合并审批退回,退回所有分支流程 WorkFlowStatus(_rpt, true); //针对退回,单独做了处理 if (OperaionType == 6) { item.IsReady = false; } } #endregion //有效流程状态:Progress, Approved //6-return, 7 -withdraw #region 这个是整个批次的审批流程 if (OperaionType == 6 || OperaionType == 7) { BacthModel.WFBatchStatus = "Draft"; if (OperaionType == 6) { BacthModel.SubReport = JsonConvert.SerializeObject(monthRpt); new MonthlyReportLog().AddMonthlyReportAction((int)MonthlyReportLogActionType.Return, tempRPT.SystemID, tempRPT.FinYear, tempRPT.FinMonth, BusinessID.ToGuid()); } else if (OperaionType == 7) { new MonthlyReportLog().AddMonthlyReportAction((int)MonthlyReportLogActionType.Withdraw, tempRPT.SystemID, tempRPT.FinYear, tempRPT.FinMonth, BusinessID.ToGuid()); } } else if (OperaionType == 9)//9, cancel { BacthModel.WFBatchStatus = "Cancel"; new MonthlyReportLog().AddMonthlyReportAction((int)MonthlyReportLogActionType.Cancel, tempRPT.SystemID, tempRPT.FinYear, tempRPT.FinMonth, BusinessID.ToGuid()); } else { if (BacthModel.WFBatchStatus != "Approved") //这里为了避免通知节点的提交覆盖了审批完成状态,而添加的 { BacthModel.WFBatchStatus = "Progress"; } new MonthlyReportLog().AddMonthlyReportAction((int)MonthlyReportLogActionType.Submit, tempRPT.SystemID, tempRPT.FinYear, tempRPT.FinMonth, BusinessID.ToGuid()); } //修改批次数据 B_SystemBatchOperator.Instance.UpdateSystemBatch(BacthModel); #endregion } else //不含批次 { //工作流状态 WorkFlowStatus(rpt, false); new MonthlyReportLog().AddMonthlyReportAction((int)MonthlyReportLogActionType.Submit, rpt.SystemID, rpt.FinYear, rpt.FinMonth, BusinessID.ToGuid()); } }
/// <summary> /// 判断是否为虚拟暂挂节点,如果是 则更新IsReady=true。如果不是,更新合并审批意见。汇总流程审批完成。执行listB TO listA /// </summary> /// <param name="UserLonginID"></param> protected void AfterExcuteBusinessData(string UserLonginID = null) { if (WFClientSDK.Exist(BusinessID)) { var p = BPF.Workflow.Client.WFClientSDK.GetProcess(null, this.BusinessID, UserLonginID); //获取当前节点是否为暂挂节点。 var nodetype = 0; if (p.ProcessInstance.RunningNodeID != null && p.ProcessInstance.RunningNodeID != "") { nodetype = p.NodeInstanceList[p.ProcessInstance.RunningNodeID].NodeType; } if (nodetype == 7)//如果当前节点类型等于7,当前节点为虚拟暂挂节点。 { //是在分支流程里面,这个判断已经走到了虚拟暂挂节点了。 //正对的是项目的分支流程 if (string.IsNullOrEmpty(ProType)) { //获取月报主表 B_MonthlyReport bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(this.BusinessID.ToGuid()); if (bmr != null && bmr.SystemBatchID != Guid.Empty) //判断当前的月报是否含有批次ID { #region 添加日志 B_MonthlyReportAction _bMonthlyReportAction = new B_MonthlyReportAction(); _bMonthlyReportAction.SystemID = bmr.SystemID; _bMonthlyReportAction.MonthlyReportID = bmr.ID; _bMonthlyReportAction.FinYear = bmr.FinYear; _bMonthlyReportAction.FinMonth = bmr.FinMonth; _bMonthlyReportAction.Action = EnumHelper.GetEnumDescription(typeof(MonthlyReportLogActionType), (int)MonthlyReportLogActionType.Save); _bMonthlyReportAction.Operator = System.Web.HttpContext.Current.User.Identity.Name; _bMonthlyReportAction.OperatorTime = DateTime.Now; _bMonthlyReportAction.ModifierName = System.Web.HttpContext.Current.User.Identity.Name; _bMonthlyReportAction.CreatorName = System.Web.HttpContext.Current.User.Identity.Name; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(_bMonthlyReportAction); #endregion #region 批次数据处理 //获取批次实体 B_SystemBatch BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(bmr.SystemBatchID); List <V_SubReport> V_SubReportList = null; if (BatchModel != null) { //批次是草稿状态 V_SubReportList = JsonConvert.DeserializeObject <List <V_SubReport> >(BatchModel.SubReport); foreach (var item in V_SubReportList) { //选择的是那个系统? if (item.SystemID == bmr.SystemID) { //根据选择的系统 item.IsReady = true; } } BatchModel.SubReport = JsonConvert.SerializeObject(V_SubReportList); } B_SystemBatchOperator.Instance.UpdateSystemBatch(BatchModel); #endregion } } } else { if (string.IsNullOrEmpty(ProType) == false && ProType == "Batch") { //这里针对的是汇总后批次的流程意见 B_SystemBatch _batchModel = new B_SystemBatch(); _batchModel = B_SystemBatchOperator.Instance.GetSystemBatch(this.BusinessID.ToGuid()); List <BPF.Workflow.Object.ProcessLog> _list = BPF.Workflow.Client.WFClientSDK.GetProcessLogList(this.BusinessID); _batchModel.Batch_Opinions = JsonConvert.SerializeObject(_list); //修改批次数据 B_SystemBatchOperator.Instance.UpdateSystemBatch(_batchModel); } } //var p = BPF.Workflow.Client.WFClientSDK.GetProcess(null, this.BusinessID); // //汇总流程审批完成。执行listB TO listA ,对最后的审批做了更加严谨的判断 if (p.ProcessInstance.Status == 3) { if (p.CurrentUserNodeID != null && p.CurrentUserNodeID != "") { var nodeInfo = p.NodeInstanceList[p.CurrentUserNodeID]; if (nodeInfo != null && (nodeInfo.NodeType == 1 || nodeInfo.NodeType == 2 || nodeInfo.NodeType == 7)) { OnProcessCompletedBusinessData(); } } } } }
protected void ProcessExecute() { B_MonthlyReport rpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(Guid.Parse(BusinessID)); ExceptionHelper.TrueThrow(rpt == null, string.Format("cannot find the report data which id={0}", BusinessID)); if (rpt.SystemBatchID != Guid.Empty) //如果含有批次 { B_SystemBatch BacthModel = B_SystemBatchOperator.Instance.GetSystemBatch(rpt.SystemBatchID); ExceptionHelper.TrueThrow(BacthModel == null, string.Format("cannot find the report data which id={0}", BusinessID)); // BacthModel.WFBatchStatus = "Progress"; List <V_SubReport> monthRpt = JsonConvert.DeserializeObject <List <V_SubReport> >(BacthModel.SubReport); foreach (var item in monthRpt) { B_MonthlyReport _rpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(item.ReportID); ExceptionHelper.TrueThrow(_rpt == null, string.Format("cannot find the report data which id={0}", BusinessID)); //有效流程状态:Progress, Approved //6-return, 7 -withdraw if (OperationType == 6 || OperationType == 7) { _rpt.WFStatus = "Draft"; if (OperationType == 6) { AddMonthlyReportAction((int)MonthlyReportLogActionType.Return, _rpt.SystemID, _rpt.FinYear, _rpt.FinMonth, Guid.Parse(BusinessID)); } else if (OperationType == 7) { AddMonthlyReportAction((int)MonthlyReportLogActionType.Withdraw, _rpt.SystemID, _rpt.FinYear, _rpt.FinMonth, Guid.Parse(BusinessID)); } } else if (OperationType == 9)//9, cancel { _rpt.WFStatus = "Cancel"; AddMonthlyReportAction((int)MonthlyReportLogActionType.Cancel, _rpt.SystemID, _rpt.FinYear, _rpt.FinMonth, Guid.Parse(BusinessID)); } else { _rpt.WFStatus = "Progress"; _rpt.Status = 5; AddMonthlyReportAction((int)MonthlyReportLogActionType.Submit, _rpt.SystemID, _rpt.FinYear, _rpt.FinMonth, Guid.Parse(BusinessID)); } B_MonthlyreportOperator.Instance.UpdateMonthlyreport(_rpt); } //有效流程状态:Progress, Approved //6-return, 7 -withdraw if (OperationType == 6 || OperationType == 7) { BacthModel.WFBatchStatus = "Draft"; if (OperationType == 6) { AddMonthlyReportAction((int)MonthlyReportLogActionType.Return, rpt.SystemID, rpt.FinYear, rpt.FinMonth, Guid.Parse(BusinessID)); } else if (OperationType == 7) { AddMonthlyReportAction((int)MonthlyReportLogActionType.Withdraw, rpt.SystemID, rpt.FinYear, rpt.FinMonth, Guid.Parse(BusinessID)); } } else if (OperationType == 9)//9, cancel { BacthModel.WFBatchStatus = "Cancel"; AddMonthlyReportAction((int)MonthlyReportLogActionType.Cancel, rpt.SystemID, rpt.FinYear, rpt.FinMonth, Guid.Parse(BusinessID)); } else { BacthModel.WFBatchStatus = "Progress"; AddMonthlyReportAction((int)MonthlyReportLogActionType.Submit, rpt.SystemID, rpt.FinYear, rpt.FinMonth, Guid.Parse(BusinessID)); } //修改批次数据 B_SystemBatchOperator.Instance.UpdateSystemBatch(BacthModel); } else //不含批次 { rpt.WFStatus = "Progress"; B_MonthlyreportOperator.Instance.UpdateMonthlyreport(rpt); AddMonthlyReportAction((int)MonthlyReportLogActionType.Submit, rpt.SystemID, rpt.FinYear, rpt.FinMonth, Guid.Parse(BusinessID)); } }
public List <V_SubReport> ProSystemSave(string rpts, string strMonthReportID) { ReportInstance rpt = JsonHelper.Deserialize <ReportInstance>(rpts); B_SystemBatch BatchModel = null; B_MonthlyReport bmr = null; List <V_SubReport> V_SubReportList = null; if (!string.IsNullOrEmpty(strMonthReportID)) { //获取月报主表 bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(strMonthReportID.ToGuid()); if (bmr != null) { if (bmr.SystemBatchID != Guid.Empty) { //获取批次实体 BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(bmr.SystemBatchID); B_MonthlyReportAction _bMonthlyReportAction = new B_MonthlyReportAction(); _bMonthlyReportAction.SystemID = rpt._SystemID; _bMonthlyReportAction.MonthlyReportID = strMonthReportID.ToGuid(); _bMonthlyReportAction.FinYear = bmr.FinYear; _bMonthlyReportAction.FinMonth = bmr.FinMonth; _bMonthlyReportAction.Action = EnumHelper.GetEnumDescription(typeof(MonthlyReportLogActionType), (int)MonthlyReportLogActionType.Save); _bMonthlyReportAction.Operator = System.Web.HttpContext.Current.User.Identity.Name; _bMonthlyReportAction.OperatorTime = DateTime.Now; _bMonthlyReportAction.ModifierName = System.Web.HttpContext.Current.User.Identity.Name; _bMonthlyReportAction.CreatorName = System.Web.HttpContext.Current.User.Identity.Name; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(_bMonthlyReportAction); //if (BatchModel != null) //{ // //批次是草稿状态 // V_SubReportList = JsonHelper.Deserialize<List<V_SubReport>>(BatchModel.SubReport); // foreach (var item in V_SubReportList) // { // //选择的是那个系统? // if (item.SystemID == rpt._SystemID) // { // //根据选择的系统 // item.IsReady = false; // } // } // BatchModel.SubReport = JsonHelper.Serialize(V_SubReportList); //} //BatchModel.ID = B_SystemBatchOperator.Instance.UpdateSystemBatch(BatchModel); } } } //获取批次 //BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch("ProSystem", rpt.FinYear, rpt.FinMonth); if (BatchModel != null) { return(V_SubReportList); } else { V_SubReportList = new List <V_SubReport>(); V_SubReportList.Add(new V_SubReport { SystemName = rpt._System.SystemName, ReportID = bmr.ID, SystemID = rpt._System.ID, IsReady = false }); return(V_SubReportList); } }
/// <summary> /// 通过批次获取月报的审批 /// </summary> private void LoadBatchData(bool isFirst) { HiddBusinessID.Value = Request.QueryString["BusinessID"]; HideProType.Value = Request.QueryString["ProType"]; #region 获取子流程和主流程的审批日志 _BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(Guid.Parse(Request.QueryString["BusinessID"])); List <ProcessLog> listALLProLog = new List <ProcessLog>(); List <ProcessLog> listProLog = new List <ProcessLog>(); //JsonConvert.DeserializeObject<List<ProcessLog>>(_BatchModel.Opinions); List <V_SubReport> BatchRptList = JsonConvert.DeserializeObject <List <V_SubReport> >(_BatchModel.SubReport); for (int i = 0; i < BatchRptList.Count; i++) { if (BPF.Workflow.Client.WFClientSDK.Exist(BatchRptList[i].ReportID.ToString())) { listProLog.AddRange(BPF.Workflow.Client.WFClientSDK.GetProcessLogList(BatchRptList[i].ReportID.ToString())); } } List <ProcessLog> listBatchProLog = null; if (BPF.Workflow.Client.WFClientSDK.Exist(_BatchModel.ID.ToString())) { listBatchProLog = BPF.Workflow.Client.WFClientSDK.GetProcessLogList(_BatchModel.ID.ToString()); //JsonConvert.DeserializeObject<List<ProcessLog>>(_BatchModel.Batch_Opinions); } if (listBatchProLog != null) { listALLProLog.AddRange(listBatchProLog); } if (listProLog != null) { listALLProLog.AddRange(listProLog); } if (listALLProLog != null) { //这里去掉汇总审批时的虚拟节点同意日志 HideOpinions.Value = JsonConvert.SerializeObject(listALLProLog.Where(p => p.NodeType != 7).OrderByDescending(p => p.FinishDateTime)); } #endregion List <C_System> sysList = null; if (isFirst) { //判断批次号 if (_BatchModel != null) { List <V_SubReport> rptList = JsonConvert.DeserializeObject <List <V_SubReport> >(_BatchModel.SubReport); if (sysList != null && sysList.Count == 1) { V_SubReport rptModel = rptList.Find(p => p.SystemID == sysList[0].ID); //在当前批次中,的项目系统 hideMonthReportID.Value = rptModel.ReportID.ToString(); } else { ddlSystem.DataSource = rptList; ddlSystem.DataTextField = "SystemName"; ddlSystem.DataValueField = "SystemID"; ddlSystem.DataBind(); V_SubReport rptModel = rptList.Find(p => p.SystemID == ddlSystem.SelectedValue.ToGuid()); lblName.Text = _BatchModel.FinYear + "-" + _BatchModel.FinMonth + "月度经营报告"; HiddenMonth.Value = _BatchModel.FinMonth.ToString(); //在当前批次中,的项目系统 hideMonthReportID.Value = rptModel.ReportID.ToString(); hideSystemID.Value = ddlSystem.SelectedValue; HideProcessCode.Value = StaticResource.Instance[ddlSystem.SelectedValue.ToGuid(), DateTime.Now].Configuration.Element("ProcessCode").Value; } } } else { //判断批次号 if (_BatchModel != null) { List <V_SubReport> rptList = JsonConvert.DeserializeObject <List <V_SubReport> >(_BatchModel.SubReport); V_SubReport rptModel = rptList.Find(p => p.SystemID == ddlSystem.SelectedValue.ToGuid()); //在当前批次中,的项目系统 hideMonthReportID.Value = rptModel.ReportID.ToString(); hideSystemID.Value = ddlSystem.SelectedValue; HideProcessCode.Value = StaticResource.Instance[ddlSystem.SelectedValue.ToGuid(), DateTime.Now].Configuration.Element("ProcessCode").Value; lblName.Text = _BatchModel.FinYear + "-" + _BatchModel.FinMonth + "月度经营报告"; HiddenMonth.Value = _BatchModel.FinMonth.ToString(); } } }
/// <summary> /// 添加批次Model /// </summary> /// <returns></returns> public B_SystemBatch AddSystemBatch(string groupType) { B_SystemBatch BatchModel = new B_SystemBatch(); BatchModel.BatchType = groupType; BatchModel.FinMonth = FinMonth; BatchModel.FinYear = FinYear; BatchModel.WFBatchStatus = "Draft"; BatchModel.ID = Guid.NewGuid(); var defaultTarget = A_TargetplanOperator.Instance.GetDefaultTargetplanList(ddlSystem.SelectedValue.ToGuid(), DateTime.Now.Year); if (defaultTarget == null || defaultTarget.Count < 1) { return(null); } BatchModel.TargetPlanID = defaultTarget.FirstOrDefault().ID; List <V_SubReport> SubReportList = new List <V_SubReport>(); //获取项目系统的公司 //List<C_System> ProSysList = StaticResource.Instance.SystemList.Where(p => p.GroupType == groupType).OrderBy(PR => PR.Sequence).ToList(); var orgList = StaticResource.Instance.OrgList[ddlSystem.SelectedValue.ToGuid()].Where(x => x.Level == 3); //循环添加B_MonthlyReport表数据 foreach (var item in orgList) { B_MonthlyReport BatchMonthlyReport = new B_MonthlyReport(); BatchMonthlyReport.SystemID = ddlSystem.SelectedValue.ToGuid(); BatchMonthlyReport.AreaID = item.ID; BatchMonthlyReport.FinMonth = FinMonth; BatchMonthlyReport.FinYear = FinYear; BatchMonthlyReport.Status = 2; BatchMonthlyReport.DefaultVersionStatus = 1; BatchMonthlyReport.WFStatus = "Draft"; BatchMonthlyReport.SystemBatchID = BatchModel.ID; BatchMonthlyReport.CreateTime = DateTime.Now; BatchMonthlyReport.DefaultVersionStatus = 1; BatchMonthlyReport.TargetPlanID = BatchModel.TargetPlanID; BatchMonthlyReport.ID = B_MonthlyreportOperator.Instance.AddMonthlyreport(BatchMonthlyReport); //添加数据 ,如果是当前选择的系统,isreaday==true if (ddlAreaID.SelectedValue == item.ID.ToString()) { SubReportList.Add(new V_SubReport(item.ID, item.CnName, BatchMonthlyReport.ID, false)); AddBMRD(BatchMonthlyReport); // 添加明细数据 hideMonthReportID.Value = BatchMonthlyReport.ID.ToString(); //将新增的月报ID,存在影藏控件中 HiddenBatch.Value = BatchMonthlyReport.ID.ToString(); MutipleUpload.LoadByBusinessID(BatchMonthlyReport.ID.ToString()); //添加附件ID UserControl.SetButtonSpanStyle(BatchMonthlyReport.Status); //设置第几步的状态 } else { //判断其它系统的提交状态 SubReportList.Add(new V_SubReport(item.ID, item.CnName, BatchMonthlyReport.ID, false)); } } BatchModel.SubReport = JsonConvert.SerializeObject(SubReportList); BatchModel.ID = B_SystemBatchOperator.Instance.AddSystemBatch(BatchModel); return(BatchModel); }
/// <summary> /// 添加月度报告数据 /// </summary> public void AddMonthlyReport() { HidSystemID.Value = ddlSystem.SelectedValue; HideProcessCode.Value = StaticResource.Instance[ddlSystem.SelectedValue.ToGuid(), DateTime.Now].Configuration.Element("ProcessCode").Value; B_SystemBatch BatchModel = null; // 公用的批次 实体 B_MonthlyReport bmr = null; // 公用B_MonthlyReport 实体 //首先判断系统, 是否是包含在批次里 string Gtypt = StaticResource.Instance[ddlSystem.SelectedValue.ToGuid(), DateTime.Now].GroupType; if (!string.IsNullOrEmpty(Gtypt)) { #region 包含在批次里的数据的业务系统 //判断当前URL是否存在BusinessID if (string.IsNullOrEmpty(Request["BusinessID"])) { B_MonthlyReport _statreRpt = null; //-状态B_MonthlyReport - BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch("ProSystem", FinYear, FinMonth); //判断批次表中是否有数据 if (BatchModel == null) { BatchModel = AddSystemBatch(); } else { //批次不为Null,且批次还是在审批中的。 //批次是草稿状态 List <V_SubReport> V_SubReportList = JsonConvert.DeserializeObject <List <V_SubReport> >(BatchModel.SubReport); //获取上报月报的ID var subRpt = V_SubReportList.Find(SR => SR.SystemID == HidSystemID.Value.ToGuid()); B_MonthlyReport monthRpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(subRpt.ReportID); #region 批次存在 //审批进行中,是要被跳转到审批页面的,但是审批完成就需要重新开启新的流程 if (BatchModel.WFBatchStatus == "Progress" || monthRpt.WFStatus == "Progress") { //批次是草稿状态 var model = V_SubReportList.Find(p => p.SystemID == HidSystemID.Value.ToGuid()); //--------------------------------------------------------------------------------------------------------------------------------------------- //这里批次需要控制,每次审批的状态只能是唯一的 // 暂时注销掉 BatchModel = AddSystemBatch(); var host = new LJTH.BusinessIndicators.Web.AjaxHander.ProProcessController(); host.BusinessID = model.ReportID.ToString(); if (BPF.Workflow.Client.WFClientSDK.Exist(host.BusinessID)) { BPF.Workflow.Object.WorkflowContext wc = BPF.Workflow.Client.WFClientSDK.GetProcess(null, host.BusinessID); if (!wc.CurrentUserHasTodoTask) { Server.Transfer("~/BusinessReport/ProTargetApprove.aspx?BusinessID=" + host.BusinessID); } else { bmr = monthRpt; hideMonthReportID.Value = monthRpt.ID.ToString(); } } //WfClientListener.Listen(host, null); //if (WfClientContext.Current.ProcessResponse.FromReadOnly) //{ // HttpContext.Current.Response.Clear(); // Server.Transfer("~/BusinessReport/ProTargetApprove.aspx?BusinessID=" + host.BusinessID); //} //--------------------------------------------------------------------------------------------------------------------------------------------- } else if (BatchModel.WFBatchStatus == "Approved") //如果审批是完成状态,重新生产 { BatchModel = AddSystemBatch(); } else { //批次是草稿状态 V_SubReportList.ForEach(p => { //选择的是那个系统? if (p.SystemID == Guid.Parse(ddlSystem.SelectedValue)) { //根据选择的系统,将明细数据展示出来 _statreRpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(p.ReportID); if (_statreRpt.WFStatus == "Cancel") //如果当前月报是作废的状态,则重新生产一个新的ID ( 这里针对作废后,重新起一个流程) { _statreRpt.ID = Guid.NewGuid(); //替换实体ID _statreRpt.WFStatus = "Draft"; _statreRpt.Status = 2; Guid _BRptID = B_MonthlyreportOperator.Instance.AddMonthlyreport(_statreRpt); p.ReportID = _BRptID; HiddenBatch.Value = BatchModel.ID.ToString(); //批次ID不变 hideMonthReportID.Value = p.ReportID.ToString(); } else { //注意这里 hideMonthReportID.Value = p.ReportID.ToString(); HiddenBatch.Value = p.ReportID.ToString(); } AddBMRD(_statreRpt); bmr = _statreRpt; MutipleUpload.LoadByBusinessID(_statreRpt.ID.ToString()); } }); //这里重新序列,将作废后,重新生成的新ID 序列化到批次里 BatchModel.SubReport = JsonConvert.SerializeObject(V_SubReportList); B_SystemBatchOperator.Instance.UpdateSystemBatch(BatchModel); } #endregion } } else { //如果是传过来的BusinessID,就直接去查询,不做操作 //通过BusinessID,首先获取批次的实体,根据权限,然后在批次中寻找 HiddenBatch.Value = Request["BusinessID"]; bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(Request["BusinessID"].ToGuid()); ExceptionHelper.TrueThrow <ArgumentNullException>(bmr == null ? true : false, "Argument B_MonthlyReport is Null"); if (bmr.SystemBatchID != Guid.Empty) { BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(bmr.SystemBatchID); List <V_SubReport> rptLsit = JsonConvert.DeserializeObject <List <V_SubReport> >(BatchModel.SubReport); V_SubReport rptModel = rptLsit.Find(f => f.SystemID == ddlSystem.SelectedValue.ToGuid()); hideMonthReportID.Value = rptModel.ReportID.ToString(); bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(rptModel.ReportID); ExceptionHelper.TrueThrow <ArgumentNullException>(bmr == null ? true : false, "Argument B_MonthlyReport is Null"); MutipleUpload.LoadByBusinessID(bmr.ID.ToString()); UserControl.SetButtonSpanStyle(bmr.Status); } } #endregion } else { #region 没有包含在批次里系统 if (string.IsNullOrEmpty(Request["BusinessID"])) //正常上报 { //添加月报说明 bmr = B_MonthlyreportOperator.Instance.GetMonthlyReportDraft(Guid.Parse(ddlSystem.SelectedValue), FinYear, FinMonth); if (bmr == null) { bmr = AddMR(); } else { if (bmr.WFStatus == "Progress" || bmr.WFStatus == "Approved") { bmr = AddMR(); } } //为当前月度经营报告(bmr),插入月度经营明细数据 AddBMRD(bmr); hideMonthReportID.Value = bmr.ID.ToString(); } else { hideMonthReportID.Value = Request["BusinessID"]; bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(Request["BusinessID"].ToGuid()); ddlSystem.SelectedValue = bmr.SystemID.ToString(); FinYear = bmr.FinYear; FinMonth = bmr.FinMonth; lblName.Text = ""; lblName.Text = FinYear + "-" + FinMonth + "月度经营报告上报"; } if (bmr != null) { MutipleUpload.LoadByBusinessID(bmr.ID.ToString()); UserControl.SetButtonSpanStyle(bmr.Status); } #endregion } if (bmr != null) { List <BPF.Workflow.Object.ProcessLog> lstBatchProcessLog = new List <BPF.Workflow.Object.ProcessLog>(); if (bmr.SystemBatchID != Guid.Empty) { //if (BPF.Workflow.Client.WFClientSDK.Exist(bmr.SystemBatchID.ToString())) //{ // lstBatchProcessLog = BPF.Workflow.Client.WFClientSDK.GetProcessLogList(bmr.SystemBatchID.ToString()); //} } //List<BPF.Workflow.Object.ProcessLog> lstCurrentProcessLog = BPF.Workflow.Client.WFClientSDK.GetProcessLogList(bmr.ID.ToString()); //if (lstBatchProcessLog!=null) //{ // lstCurrentProcessLog.AddRange(lstBatchProcessLog); //} //HideOpinions.Value = JsonConvert.SerializeObject(lstCurrentProcessLog.OrderByDescending(p => p.FinishDateTime)); } }