Пример #1
0
    /// <summary>
    /// 提交
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Submit_Click(object sender, EventArgs e)
    {
        if (!VertifyOverTime())
        {
            return;
        }

        if (!BeforeSubmit())
        {
            return;
        }
        string id = ViewState["FormID"].ToString();

        var dataInfo = SaveFormData();

        Countersign1.SaveData(true);//会签数据保存
        Countersign_Group1.SaveData(true);
        if (dataInfo != null)
        {
            uploadAttachments.SaveAttachment(FormId);
            // Countersign1.SaveAndSubmit();//会签数据保存

            #region 工作流参数
            NameValueCollection dataFields = SetWFParams();
            if (dataFields == null)
            {
                return;
            }
            #endregion


            WorkflowHelper.CurrentUser = "******" + _BPMContext.CurrentUser.LoginId;
            AppDict appInfo = new Pkurg.BPM.Services.AppDictService().GetByAppId("10109");
            if (appInfo == null)
            {
                Alert("提交失败");
                return;
            }
            int wfInstanceId = 0; //process instance id
            WorkflowHelper.StartProcess(appInfo.WorkFlowName, FormId, dataFields, ref wfInstanceId);
            if (wfInstanceId > 0)
            {
                string instId = SaveWorkFlowInstance("1", DateTime.Now, wfInstanceId.ToString());
                if (!string.IsNullOrEmpty(instId))
                {
                    SaveWorkItem();
                    if (!AfterWorkflowStart(wfInstanceId))
                    {
                        return;
                    }
                    IFrameHelper.DownloadLocalFileUrl(instId);
                    ScriptManager.RegisterClientScriptBlock(this, typeof(string), "1", "alert('提交成功');window.opener.location.href=window.opener.location.href;", true);
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", " window.opener=null;window.open('', '_self', '');window.close();", true);
                    return;
                }
            }
        }

        Alert("提交失败");
    }
Пример #2
0
    //测试时先注释掉
    /// <summary>
    /// 流程成功启动后操作
    /// </summary>
    protected override bool AfterWorkflowStart(int wfInstanceId)
    {
        var info = BizContext.ERP_ContractFinalAccount.FirstOrDefault(x => x.FormID == FormId);
        ERP_CallbackResultType resultType = new CommonService(int.Parse(AppID)).NotifyStartAdvance(info.ErpFormId, true);

        if (resultType != ERP_CallbackResultType.调用成功)
        {
            //删除流程实例
            new WF_WorkFlowInstance().DeleteWorkFlowInstance(_BPMContext.ProcID);

            //撤销已发起的流程
            WorkflowManage.StopWorkflow(wfInstanceId);
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", "alert('" + ConstString.RepeatAlertTip + "'); window.opener=null;window.open('', '_self', '');window.close();", true);
            return(false);
        }
        try
        {
            //保存嵌套的表单数据,下载该表单
            IFrameHelper.DownloadLocalFileUrl(_BPMContext.ProcID);
        }
        catch (Exception)
        {
        }
        return(true);
    }
Пример #3
0
    /// <summary>
    /// 加载页面时调用
    /// </summary>
    /// <returns></returns>
    public static string GetErpUrl()
    {
        string erpId   = HttpContext.Current.Request["erpFormId"];
        string erpType = HttpContext.Current.Request["erpFormType"];

        string id = HttpContext.Current.Request["Id"];

        if (string.IsNullOrEmpty(id))
        {
            //新建页面
            if (string.IsNullOrEmpty(erpId) || string.IsNullOrEmpty(erpType))
            {
                //参数错误
                ExceptionHander.GoToErrorPage("IFrameHelper 参数错误");
                return(null);
            }
            else
            {
                string erpUrl = GetERPPageUrl(erpId, erpType);
                return(erpUrl);
            }
        }
        else
        {
            string fileName = string.Format("ERP_{0}.html", id);
            string filePath = Path.Combine("/Files/ERP/", fileName);

            //查看页面或者审批页面,第一次生成文件
            if (!File.Exists(HttpContext.Current.Server.MapPath("~" + filePath)))
            {
                try
                {
                    IFrameHelper.DownloadLocalFileUrl(id);
                }
                catch
                {
                }
            }

            if (!File.Exists(HttpContext.Current.Server.MapPath("~" + filePath)))
            {
                return(GetERPPageUrlByInstId(id));
            }
            return(filePath);
        }
    }