/// <summary> /// 获取流程 /// </summary> /// <param name="BusinessID"></param> /// <param name="ProcessCode"></param> /// <returns></returns> protected WorkflowContext GetProcessCode(string BusinessID, UserInfo user) { string strResult = string.Empty; var process = WFClientSDK.GetProcess(null, BusinessID, user); B_MonthlyReportAction BRA = new B_MonthlyReportAction(); if (process == null) { //BRA.Action = "WebService"; //BRA.Description = string.Format("获取流程FlowID:{0} 的Code时process为null", BusinessID); //BRA.Operator = "MobileCommonWebService.GetProcessCode"; //BRA.OperatorTime = DateTime.Now; //B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); } if (process.ProcessInstance == null) { //BRA.Action = "WebService"; //BRA.Description = string.Format("获取流程FlowID:{0} 的Code时process.ProcessInstance为null", BusinessID); //BRA.Operator = "MobileCommonWebService.GetProcessCode"; //BRA.OperatorTime = DateTime.Now; //B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); } return(process); }
/// <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="businessID"></param> /// <param name="currentUser"></param> /// <param name="approvalContent"></param> public bool SubmitProcess(string businessID, UserInfo currentUser, string approvalContent, out string Msg) { bool blResult = false; string strResult = string.Empty; WorkflowContext workflow = WFClientSDK.GetProcess(null, businessID, currentUser); B_MonthlyReportAction BRA1 = new B_MonthlyReportAction(); BRA1.Action = " 进入 MobileServiceBase.SubmitProcess :businessID:" + businessID; BRA1.Description = "workflow.StatusCode : " + workflow.StatusCode + "; workflow.ProcessInstance.Status :" + workflow.ProcessInstance.Status.ToString(); BRA1.Operator = "MonthlyApprovalService.SubmitProcess"; BRA1.OperatorTime = DateTime.Now; BRA1.CreatorName = currentUser.UserLoginID; BRA1.MonthlyReportID = businessID.ToGuid(); BRA1.IsDeleted = true; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA1); if (workflow.StatusCode != 0) { throw workflow.LastException; } if (workflow.ProcessInstance.Status == 2) { strResult = "请到pc端发起流程!"; } if (string.IsNullOrEmpty(strResult)) { BizContext bizContext = new BizContext(); bizContext.NodeInstanceList = workflow.NodeInstanceList; bizContext.CcNodeInstanceList = workflow.CcNodeInstanceList; bizContext.ProcessRunningNodeID = workflow.ProcessInstance.RunningNodeID; bizContext.BusinessID = workflow.BusinessID; bizContext.ApprovalContent = approvalContent; bizContext.CurrentUser = currentUser; WorkflowContext result = WFClientSDK.ExecuteMethod("SubmitProcess", bizContext); blResult = CanApproveBusinessData(result); BRA1.Action = "MobileServiceBase.SubmitProcess 结束 :businessID:" + businessID; BRA1.Description = "strResult : " + strResult + "; blResult :" + blResult.ToString(); BRA1.Operator = "MonthlyApprovalService.SubmitProcess"; BRA1.OperatorTime = DateTime.Now; BRA1.MonthlyReportID = businessID.ToGuid(); BRA1.CreatorName = currentUser.UserLoginID; BRA1.IsDeleted = true; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA1); } Msg = strResult; return(blResult); }
/// <summary> /// 获取授权信息 /// </summary> /// <returns></returns> public bool AuthVerify() { bool blResult = false; B_MonthlyReportAction BRA = new B_MonthlyReportAction(); HttpContext context = HttpContext.Current; IEnumerator headers = context.Request.Headers.GetEnumerator(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); while (headers.MoveNext()) { string header = headers.Current.ToString(); BRA.Action = "WebService"; BRA.Description = "获取授权信息,SOAP头:" + header; BRA.Operator = "AuthVerify()"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); if ("authorization".Equals(header.ToLower())) { string auth = context.Request.Headers.Get(header); auth = auth.Substring(6); string pwd = string.Format("{0}:{1}", configUserID, configPwd); string encodePWD = Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(pwd)); if (encodePWD.Equals(auth)) { //BRA.Action = "WebService"; //BRA.Description = "获取授权信息,SOAP权限验证成功"; //BRA.Operator = "AuthVerify()"; //BRA.OperatorTime = DateTime.Now; //B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); blResult = true; break; } } } if (!blResult) { BRA.Action = "WebService"; BRA.Description = "获取授权信息,SOAP权限验证失败:" + authVerifyMessage; BRA.Operator = "AuthVerify()"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); } return(blResult); }
/// <summary> /// /// </summary> /// <param name="ActionType"></param> /// <param name="SysId"></param> /// <param name="FinYear"></param> /// <param name="FinMonth"></param> /// <param name="MonthReportID"></param> protected void AddMonthlyReportAction(int ActionType, Guid SysId, int FinYear, int FinMonth, Guid MonthReportID) { B_MonthlyReportAction _bMonthlyReportAction = new B_MonthlyReportAction(); _bMonthlyReportAction.SystemID = SysId; _bMonthlyReportAction.MonthlyReportID = MonthReportID; _bMonthlyReportAction.FinYear = FinYear; _bMonthlyReportAction.FinMonth = FinMonth; _bMonthlyReportAction.Action = EnumHelper.GetEnumDescription(typeof(MonthlyReportLogActionType), ActionType); _bMonthlyReportAction.Operator = CurrentUser; _bMonthlyReportAction.OperatorTime = DateTime.Now; _bMonthlyReportAction.ModifierName = CurrentUser; _bMonthlyReportAction.CreatorName = CurrentUser; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(_bMonthlyReportAction); }
/// <summary> /// 退回操作 /// </summary> /// <param name="businessID"></param> /// <param name="currentUser"></param> /// <param name="approvalContent"></param> /// <param name="uids"></param> /// <returns></returns> public override string RejectProcessToStartNode(string businessID, UserInfo currentUser, string approvalContent, string[] uids) { string _businessID = businessID.Split(',')[0]; string ProType = businessID.Split(',')[1]; // 参数2 string strResult = base.RejectProcessToStartNode(_businessID, currentUser, approvalContent, uids); if (string.IsNullOrEmpty(strResult)) { try { TargetPlanProcessController TPPC = new TargetPlanProcessController(); TPPC.BusinessID = _businessID; TPPC.DisposeBusinessData(currentUser.UserLoginID); TPPC.OnProcessExecute("", 6); #region 日志 B_MonthlyReportAction BRA = new B_MonthlyReportAction(); BRA.Action = "业务数据退回审批:businessID:" + _businessID; BRA.Description = strResult; BRA.Operator = "TargetApprovalService.RejectProcessToStartNode"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; BRA.MonthlyReportID = _businessID.ToGuid(); B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); #endregion } catch (Exception ex) { strResult = "业务数据异常:" + ex.ToString(); #region 日志 B_MonthlyReportAction BRA = new B_MonthlyReportAction(); BRA.Action = "业务数据退回审批:businessID:" + _businessID; BRA.Description = strResult; BRA.Operator = "TargetApprovalService.RejectProcessToStartNode"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; BRA.MonthlyReportID = _businessID.ToGuid(); B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); #endregion } } return(strResult); }
/// <summary> /// 获取流程代码 /// <returns></returns> protected string GetProcessCode(string BusinessID, string ProType = null) { string strResult = string.Empty; try { //这里单独判断下项目公司的流程, if (!string.IsNullOrEmpty(ProType)) // { var approval = B_SystemBatchOperator.Instance.GetSystemBatch(BusinessID.ToGuid()); strResult = System.Configuration.ConfigurationManager.AppSettings["MobileWFKey"]; // 去Web.config 获取,这个虚拟的流程,没有配置 } else { try { //月报 var approval = B_MonthlyreportOperator.Instance.GetMonthlyreport(BusinessID.ToGuid()); strResult = StaticResource.Instance[approval.SystemID, DateTime.Now].Configuration.Element("ProcessCode").Value; } catch (Exception) { //分解指标的 var approval = B_TargetplanOperator.Instance.GetTargetplan(BusinessID.ToGuid()); strResult = StaticResource.Instance[approval.SystemID, DateTime.Now].Configuration.Element("ProcessCode").Value + "-ZB"; } } } catch (Exception ex) { B_MonthlyReportAction BRA = new B_MonthlyReportAction(); BRA.Action = "WebService"; BRA.Description = ex.ToString(); BRA.Operator = "GetProcessCode(string BusinessID) "; BRA.OperatorTime = DateTime.Now; BRA.MonthlyReportID = BusinessID.ToGuid(); BRA.IsDeleted = true; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); } return(strResult); }
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 + "合并流程服务,没有查找到符合条件合并流程!"); } } }
/// <summary> /// 审批事件,审批到最后一个人走业务数据 /// </summary> /// <param name="businessID"></param> /// <param name="currentUser"></param> /// <param name="approvalContent"></param> /// <returns></returns> public override string SubmitProcess(string businessID, UserInfo currentUser, string approvalContent) { string _businessID = businessID.Split(',')[0]; string ProType = businessID.Split(',')[1]; // 参数2 string strResult = string.Empty; bool blResult = base.SubmitProcess(_businessID, currentUser, approvalContent, out strResult); #region 日志 B_MonthlyReportAction BRA1 = new B_MonthlyReportAction(); BRA1.Action = "业务数据提交审批判断:businessID:" + _businessID; BRA1.Description = "strResult : " + strResult + "; blResult :" + blResult.ToString(); BRA1.Operator = "TargetApprovalService.SubmitProcess"; BRA1.OperatorTime = DateTime.Now; BRA1.CreatorName = currentUser.UserLoginID; BRA1.IsDeleted = true; BRA1.MonthlyReportID = _businessID.ToGuid(); B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA1); #endregion if (string.IsNullOrEmpty(strResult) && blResult) { try { TargetPlanProcessController TPPC = new TargetPlanProcessController(); TPPC.BusinessID = _businessID; TPPC.OnProecssCompleted(); TPPC.DisposeBusinessData(currentUser.UserLoginID); #region 日志 B_MonthlyReportAction BRA = new B_MonthlyReportAction(); BRA.Action = "业务数据提交审批:businessID:" + _businessID; BRA.Description = strResult; BRA.Operator = "TargetApprovalService.SubmitProcess"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; BRA.MonthlyReportID = _businessID.ToGuid(); B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); #endregion } catch (Exception ex) { strResult = "业务数据异常:" + ex.ToString(); #region 日志 B_MonthlyReportAction BRA = new B_MonthlyReportAction(); BRA.Action = "业务数据提交审批:businessID:" + _businessID; BRA.Description = strResult; BRA.Operator = "TargetApprovalService.SubmitProcess"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; BRA.MonthlyReportID = _businessID.ToGuid(); B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); #endregion } } else { TargetPlanProcessController TPPC = new TargetPlanProcessController(); TPPC.BusinessID = _businessID; TPPC.DisposeBusinessData(currentUser.UserLoginID); } return(strResult); }
public string submitCommonForm(string param) { B_MonthlyReportAction BRA = new B_MonthlyReportAction(); BRA.Action = "开始 submitCommonForm "; BRA.Description = param; BRA.Operator = "MobileCommonWebService.submitCommonForm"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); string errMessage = string.Empty;; if (base.AuthVerify() == false) { return(base.authVerifyMessage); } SumbitProcessParam proParam = Newtonsoft.Json.JsonConvert.DeserializeObject <SumbitProcessParam>(param); ErrMessage emResult = new ErrMessage(); string businessID = proParam.requestId.Split(',')[0]; string ProType = proParam.requestId.Split(',')[1]; string strResult = string.Empty; string strAction = string.Empty; #region 参数验证 if (string.IsNullOrEmpty(businessID)) { strResult = "缺少参数:requestId,"; } if (string.IsNullOrEmpty(proParam.userLoginId)) { strResult += "缺少参数:userLoginId,"; } if (string.IsNullOrEmpty(proParam.ButtonMethodName)) { strResult += "缺少参数:action,"; } else { strAction = proParam.ButtonMethodName; } if (strResult.Length > 0) { strResult = strResult.TrimEnd(','); } #endregion else { string[] uids; if (string.IsNullOrEmpty(proParam.uids)) { uids = new string[] { }; } else { uids = proParam.uids.Split(','); } UserInfo user = new UserInfo(); var vuser = Wanda.SDK.Common.ClientSDKHelper.GetResultContextData <UserSourceSDK.UserInfo>(UserSourceSDK.UserSourceClientSDK.GetUserInfoByUserLoginID(proParam.userLoginId, null)); if (vuser == null) { strResult = "不存在用户:" + proParam.userLoginId; } else { user.UserID = vuser.UserID; user.UserCode = vuser.UserCode;//TODO user.UserJobName = vuser.UserJobName; user.UserLoginID = vuser.UserLoginID; user.UserName = vuser.UserName; user.UserOrgID = vuser.UserOrgID; user.UserOrgPathID = vuser.UserOrgPathName; user.UserOrgPathName = vuser.UserOrgPathName; MobileServiceBase mobileservice = GetMobileService(businessID, ProType); strResult = mobileservice.ExecProcess(user, uids, proParam); } } if (string.IsNullOrEmpty(strResult)) { emResult.status = ConstantWS.success; emResult.message = ConstantWS.successText; } else { emResult.status = ConstantWS.error; emResult.message = strResult; } BRA.Action = "结束 submitCommonForm :businessID:" + businessID; BRA.Description = strResult; BRA.Operator = "MobileCommonWebService.submitCommonForm"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; BRA.MonthlyReportID = businessID.ToGuid(); B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); return(Newtonsoft.Json.JsonConvert.SerializeObject(emResult)); }
public string getProcessCode(string param) { GetProcessCodeMessage gpcm = new GetProcessCodeMessage(); string errMessage = string.Empty;; if (base.AuthVerify() == false) { return(base.authVerifyMessage); } B_MonthlyReportAction BRA = new B_MonthlyReportAction(); BRA.Action = "WebService"; BRA.Description = param; BRA.Operator = "getProcessCode()"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); GetProcessCodeParam proParam = Newtonsoft.Json.JsonConvert.DeserializeObject <GetProcessCodeParam>(param.Replace(@"\", @"")); string Urlparameter = GetBusinessIDFromUrl(proParam.sysPtpurl); // Url 的参数用“,”隔开连接 string businessID = GetBusinessIDFromUrl(proParam.sysPtpurl).Split(',')[0]; // 第一个参数是 业务ID string ProType = GetBusinessIDFromUrl(proParam.sysPtpurl).Split(',')[1]; //第二个参数 //todo if (string.IsNullOrEmpty(businessID) == false) { try { string processCode = GetProcessCode(businessID, ProType); if (string.IsNullOrEmpty(processCode) == false) { gpcm.status = ConstantWS.success; gpcm.message = ConstantWS.successText; gpcm.processCode = processCode; gpcm.requestId = Urlparameter; } else { gpcm.status = ConstantWS.error; gpcm.processCode = processCode; gpcm.requestId = Urlparameter; gpcm.message = string.Format("获取不存在processCode {0},requestId:{1} 不存在processCode", ConstantWS.errorText, Urlparameter); } BRA.Action = "WebService"; BRA.Description = string.Format("获取流程FlowID:{0} 的信息", businessID); BRA.Operator = "MobileCommonWebService.GetProcessCode"; BRA.OperatorTime = DateTime.Now; BRA.MonthlyReportID = businessID.ToGuid(); BRA.IsDeleted = true; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); } catch (Exception ex) { gpcm.status = ConstantWS.error; gpcm.message = "发生不可预知的错误:" + ex.Message; BRA.Action = "WebService"; BRA.Description = gpcm.message; BRA.Operator = "getProcessCode_Error"; BRA.OperatorTime = DateTime.Now; BRA.MonthlyReportID = businessID.ToGuid(); BRA.IsDeleted = true; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); } } else { gpcm.status = ConstantWS.error; gpcm.message = "requestId为空"; } BRA.Action = "WebService"; BRA.Description = string.Format("获取流程FlowID:{0} 的返回信息:{1}", businessID, Newtonsoft.Json.JsonConvert.SerializeObject(gpcm)); BRA.Operator = "MobileCommonWebService.GetProcessCode"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); return(Newtonsoft.Json.JsonConvert.SerializeObject(gpcm)); }
public string getMobileCommonData(string param) { GetProcessCodeMessage gpcm = new GetProcessCodeMessage(); string errMessage = string.Empty; if (base.AuthVerify() == false) { return(base.authVerifyMessage); } GetProcessInfoParam proParam = Newtonsoft.Json.JsonConvert.DeserializeObject <GetProcessInfoParam>(param); B_MonthlyReportAction BRA = new B_MonthlyReportAction(); BRA.Action = "WebService"; BRA.Description = param; BRA.Operator = "MobileCommonWebService.getMobileCommonData 进入"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); //proParam.requestId 这里的requestId 可能是多个值 string businessID = proParam.requestId.Split(',')[0]; string ProType = proParam.requestId.Split(',')[1]; string subPage = proParam.SubPageName; MobileServiceBase mobileservice; string logID = string.Empty; if (string.IsNullOrEmpty(subPage) == false) { logID = subPage; mobileservice = GetMobileServiceForsubPage(subPage); #region 获取二级页面信息 FlowPageShowData flowdata = mobileservice.getSubPageData(proParam.PlanID, proParam.CategoryID, proParam.Approve); return(Newtonsoft.Json.JsonConvert.SerializeObject(flowdata)); #endregion } else if (string.IsNullOrEmpty(businessID) == false) { logID = logID = subPage;; mobileservice = GetMobileService(businessID, ProType); #region 获取流程信息 UserInfo curUser = new UserInfo(); var vuser = Wanda.SDK.Common.ClientSDKHelper.GetResultContextData <UserSourceSDK.UserInfo>(UserSourceSDK.UserSourceClientSDK.GetUserInfoByUserLoginID(proParam.userLoginId, null)); if (vuser == null) { gpcm.status = ConstantWS.error; gpcm.processCode = ""; gpcm.requestId = businessID; gpcm.message = string.Format("当前用户:{0} 不存在", proParam.userId); } else { try { curUser.UserID = vuser.UserID; curUser.UserCode = vuser.UserCode;//TODO curUser.UserJobName = vuser.UserJobName; curUser.UserLoginID = vuser.UserLoginID; curUser.UserName = vuser.UserName; curUser.UserOrgID = vuser.UserOrgID; curUser.UserOrgPathID = vuser.UserOrgPathName; curUser.UserOrgPathName = vuser.UserOrgPathName; string processCode = GetProcessCode(businessID, ProType); WorkflowContext wfc = GetProcessCode(businessID, curUser); if (wfc.ProcessInstance.Status == 2 && wfc.CurrentUser.UserLoginID == wfc.ProcessInstance.StartUser.UserLoginID) // 退回时候,不是发起人 { gpcm.status = ConstantWS.error; gpcm.processCode = processCode; gpcm.requestId = businessID; gpcm.message = "该待办事项需要重新填报,请在电脑上操作!"; } else { // 这里的需要将proParam.requestId ,传递过去,具体的处理 业务ID的数据 FlowPageShowData flowdata = mobileservice.getMobileCommonData(proParam.requestId, processCode, wfc); if (string.IsNullOrEmpty(flowdata.requestId) == false) { //Context.Response.Write(jss.Serialize(flowdata)); return(Newtonsoft.Json.JsonConvert.SerializeObject(flowdata)); } else { gpcm.status = ConstantWS.error; gpcm.processCode = processCode; gpcm.requestId = businessID; gpcm.message = string.Format("获取不存在processCode {0},requestId:{1} 不存在processCode", ConstantWS.errorText, businessID); } } } catch (Exception ex) { gpcm.status = ConstantWS.error; gpcm.message = "发生不可预知的错误:" + ex.Message; BRA.Action = "WebService"; BRA.Description = gpcm.message; BRA.Operator = "MobileCommonWebService.getMobileCommonData"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); } } #endregion } else { gpcm.status = ConstantWS.error; gpcm.message = "requestId为空"; logID = gpcm.message; } BRA.Action = "WebService"; BRA.Description = Newtonsoft.Json.JsonConvert.SerializeObject(gpcm); BRA.Operator = "MobileCommonWebService.getMobileCommonData 序列化成功返回的Json"; BRA.OperatorTime = DateTime.Now; BRA.MonthlyReportID = businessID.ToGuid(); BRA.IsDeleted = true; B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); return(Newtonsoft.Json.JsonConvert.SerializeObject(gpcm)); }
/// <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(); } } } } }
/// <summary> /// 退回操作 /// </summary> /// <param name="businessID"></param> /// <param name="currentUser"></param> /// <param name="approvalContent"></param> /// <param name="uids"></param> /// <returns></returns> public override string RejectProcessToStartNode(string businessID, UserInfo currentUser, string approvalContent, string[] uids) { string _businessID = businessID.Split(',')[0]; string ProType = businessID.Split(',')[1]; // 参数2 string strResult = base.RejectProcessToStartNode(_businessID, currentUser, approvalContent, uids); if (string.IsNullOrEmpty(strResult)) { try { if (!string.IsNullOrEmpty(ProType)) //合并的流程 { //项目公司的 ProProcessController ProMonthRptController = new ProProcessController(); ProMonthRptController.BusinessID = _businessID; ProMonthRptController.ProType = businessID.Split(',')[1]; ProMonthRptController.ExecType = "afterAction"; ProMonthRptController.OperaionType = 6; ProMonthRptController.DisposeBusinessData();// 处理业务数据,保存工作流审批Json ProMonthRptController.ExecutionBusinessData(currentUser.UserLoginID); } else { var monthRpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(_businessID.ToGuid()); //这里判断系统的类型 int SysType = StaticResource.Instance[monthRpt.SystemID, monthRpt.CreateTime].Category; if (SysType == 2) { //项目公司的 ProProcessController ProMonthRptController = new ProProcessController(); ProMonthRptController.BusinessID = _businessID; ProMonthRptController.ProType = businessID.Split(',')[1]; ProMonthRptController.ExecType = "afterAction"; ProMonthRptController.OperaionType = 6; ProMonthRptController.DisposeBusinessData();// 处理业务数据,保存工作流审批Json ProMonthRptController.ExecutionBusinessData(currentUser.UserLoginID); } else { ProcessController MonthRptController = new ProcessController(); MonthRptController.BusinessID = _businessID; MonthRptController.OnProcessExecuteBusinessData("", 6); MonthRptController.DisposeBusinessData(currentUser.UserLoginID); // 处理业务数据,保存工作流审批Json } } #region 日志 B_MonthlyReportAction BRA = new B_MonthlyReportAction(); BRA.Action = "业务数据退回审批:businessID:" + _businessID; BRA.Description = strResult; BRA.Operator = "MonthlyApprovalService.RejectProcessToStartNode"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; BRA.MonthlyReportID = _businessID.ToGuid(); B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); #endregion } catch (Exception ex) { strResult = "业务数据异常:" + ex.ToString(); #region 日志 B_MonthlyReportAction BRA = new B_MonthlyReportAction(); BRA.Action = "业务数据退回审批:businessID:" + _businessID; BRA.Description = strResult; BRA.Operator = "MonthlyApprovalService.RejectProcessToStartNode"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; BRA.MonthlyReportID = _businessID.ToGuid(); B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); #endregion } } return(strResult); }
/// <summary> /// 审批事件,审批到最后一个人走业务数据 /// </summary> /// <param name="businessID"></param> /// <param name="currentUser"></param> /// <param name="approvalContent"></param> /// <returns></returns> public override string SubmitProcess(string businessID, UserInfo currentUser, string approvalContent) { string _businessID = businessID.Split(',')[0]; string ProType = businessID.Split(',')[1]; // 参数2 string strResult = string.Empty; bool blResult = base.SubmitProcess(_businessID, currentUser, approvalContent, out strResult); #region 日志 B_MonthlyReportAction BRA1 = new B_MonthlyReportAction(); BRA1.Action = "业务数据提交审批判断:businessID:" + _businessID; BRA1.Description = "strResult : " + strResult + "; blResult :" + blResult.ToString(); BRA1.Operator = "MonthlyApprovalService.SubmitProcess"; BRA1.OperatorTime = DateTime.Now; BRA1.CreatorName = currentUser.UserLoginID; BRA1.IsDeleted = true; BRA1.MonthlyReportID = _businessID.ToGuid(); B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA1); #endregion if (string.IsNullOrEmpty(strResult) && blResult) { try { if (!string.IsNullOrEmpty(ProType)) //合并的流程 { //项目公司的 ProProcessController ProMonthRptController = new ProProcessController(); ProMonthRptController.BusinessID = _businessID; ProMonthRptController.ProType = businessID.Split(',')[1]; ProMonthRptController.ExecType = "afterAction"; ProMonthRptController.DisposeBusinessData();// 处理业务数据,保存工作流审批Json ProMonthRptController.ExecutionBusinessData(currentUser.UserLoginID); } else { var monthRpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(_businessID.ToGuid()); //这里判断系统的类型 int SysType = StaticResource.Instance[monthRpt.SystemID, monthRpt.CreateTime].Category; if (SysType == 2) //项目公司的分支流程 { //项目公司的 ProProcessController ProMonthRptController = new ProProcessController(); ProMonthRptController.BusinessID = _businessID; ProMonthRptController.ProType = businessID.Split(',')[1]; ProMonthRptController.ExecType = "afterAction"; ProMonthRptController.DisposeBusinessData();// 处理业务数据,保存工作流审批Json ProMonthRptController.ExecutionBusinessData(currentUser.UserLoginID); } else { // 这是经营的 直管, 总部的 ProcessController MonthRptController = new ProcessController(); MonthRptController.BusinessID = _businessID; MonthRptController.OnProcessCompletedBusinessData(); MonthRptController.DisposeBusinessData(currentUser.UserLoginID); // 处理业务数据,保存工作流审批Json } } #region 日志 B_MonthlyReportAction BRA = new B_MonthlyReportAction(); BRA.Action = "业务数据提交审批:businessID:" + _businessID; BRA.Description = strResult; BRA.Operator = "MonthlyApprovalService.SubmitProcess"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; BRA.MonthlyReportID = _businessID.ToGuid(); B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); #endregion } catch (Exception ex) { strResult = "业务数据异常:" + ex.ToString(); #region 日志 B_MonthlyReportAction BRA = new B_MonthlyReportAction(); BRA.Action = "业务数据提交审批:businessID:" + _businessID; BRA.Description = strResult; BRA.Operator = "MonthlyApprovalService.SubmitProcess"; BRA.OperatorTime = DateTime.Now; BRA.IsDeleted = true; BRA.MonthlyReportID = _businessID.ToGuid(); B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(BRA); #endregion } } else { if (!string.IsNullOrEmpty(ProType)) { //项目公司的 ProProcessController ProMonthRptController = new ProProcessController(); ProMonthRptController.BusinessID = _businessID; ProMonthRptController.ProType = businessID.Split(',')[1]; ProMonthRptController.ExecType = "afterAction"; ProMonthRptController.DisposeBusinessData();// 处理业务数据,保存工作流审批Json ProMonthRptController.ExecutionBusinessData(currentUser.UserLoginID); } else { //每个审批人都要做的操作 var monthRpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(_businessID.ToGuid()); //这里判断系统的类型 int SysType = StaticResource.Instance[monthRpt.SystemID, monthRpt.CreateTime].Category; if (SysType == 2) { //项目公司的 ProProcessController ProMonthRptController = new ProProcessController(); ProMonthRptController.BusinessID = _businessID; ProMonthRptController.ProType = businessID.Split(',')[1]; ProMonthRptController.ExecType = "afterAction"; ProMonthRptController.DisposeBusinessData();// 处理业务数据,保存工作流审批Json ProMonthRptController.ExecutionBusinessData(currentUser.UserLoginID); } else { // 这是经营的 直管, 总部的 ProcessController MonthRptController = new ProcessController(); MonthRptController.BusinessID = _businessID; MonthRptController.DisposeBusinessData(currentUser.UserLoginID); // 处理业务数据,保存工作流审批Json } } } return(strResult); }
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); } }