예제 #1
0
        /// <summary>
        /// 打开OA流程页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void btnOAFlow_Click(object sender, EventArgs e)
        {
            IUIRecord rec      = uiPart.Model.Views["CompleteRpt"].FocusedRecord;
            string    sql      = string.Format(@"SELECT  a.DescFlexField_PrivateDescSeg2 OAFlowID 
FROM dbo.mo_completerpt a WHERE a.ID={0}", rec["ID"].ToString());
            DataSet   ds       = new DataSet();
            string    OAFlowID = "";

            DataAccessor.RunSQL(DatabaseManager.GetCurrentConnection(), sql, null, out ds);
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                OAFlowID = row["OAFlowID"].ToString();
            }
            string script = PubFunction.GetOAFlowScript(PDContext.Current.UserCode, OAFlowID);//打开流程页面脚本

            AtlasHelper.RegisterAtlasStartupScript
                ((Control)this.uiPart.TopLevelContainer, this.uiPart.GetType(), "ReferenceReturn", script, false);
        }
예제 #2
0
        /// <summary>
        /// 调用OA接口服务
        /// </summary>
        /// <returns></returns>
        public static string OAService(string jsson)
        {
            //参数1:准入码,参数2:json
            string  OACode = PubFunction.GetOACode();
            string  result = string.Empty;
            string  IsTest = PubFunction.IsOATest();
            ILogger logger = LoggerManager.GetLogger(typeof(CacheManager));

            if (IsTest == "是")//测试环境
            {
                OAWorkflowService4Test.WorkflowServiceToOtherSystemPortTypeClient service = new OAWorkflowService4Test.WorkflowServiceToOtherSystemPortTypeClient();
                try
                {
                    result = service.createWorkflow(OACode, jsson);
                    logger.Error("调用OA审批内网测试接口成功,返回的结果为:" + result);
                }
                catch (Exception ex)
                {
                    logger.Error("调用OA审批内网测试接口出错,错误信息为:" + ex.Message);
                    throw new Exception("调用OA审批内网测试接口出错,错误信息为:" + ex.Message);
                }
            }
            else//生产环境
            {
                OAWorkflowService.WorkflowServiceToOtherSystemPortTypeClient service = new OAWorkflowService.WorkflowServiceToOtherSystemPortTypeClient();
                try
                {
                    result = service.createWorkflow(OACode, jsson);
                    logger.Error("调用OA审批接口成功,返回的结果为:" + result);
                }
                catch (Exception ex)
                {
                    logger.Error("调用OA审批接口出错,错误信息为:" + ex.Message);
                    throw new Exception("调用OA审批接口出错,错误信息为:" + ex.Message);
                }
            }


            //将OA接口返回结果转成对象
            string     OAFlowID = "";
            ResultInfo OAResult = JsonHelper.JsonDeserialize <ResultInfo>(result);

            if (OAResult.type == "1")
            {
                logger.Error("OA接口返回错误,错误信息为:" + OAResult.backmsg);
                throw new Exception("OA接口返回错误,错误信息为:" + OAResult.backmsg);
            }
            else
            {
                //检查结果集
                foreach (ResultList rList in OAResult.resultlist)
                {
                    if (rList.status == "1")
                    {
                        throw new Exception("OA接口返回错误,错误信息为:" + rList.msg);
                        throw new Exception("OA接口返回错误,错误信息为:" + OAResult.backmsg);
                    }
                    OAFlowID = rList.requestid;
                }
            }
            return(OAFlowID);
        }