Exemple #1
0
 /// <summary>
 /// 在流程归档之后执行,写入以归档的流程表
 /// </summary>
 /// <param name="str_ProcessID">流程ID</param>
 /// <param name="str_ProcessTemp">流程模板名称</param>
 protected void Devolved(string str_ProcessID, string str_ProcessTemp)
 {
     if (!base.IsDevolve)
     {
         B_ProcessInstance.ProcessDevolve(str_ProcessID, str_ProcessTemp);
     }
     base.IsDevolve = true;
     this.SetControlStatus();
 }
        public void Devolve(EntityBase entity, string sProcessType, out string sResult, out string sPlatForm)
        {
            sResult = "";
            string sPath = HttpContext.Current.Server.MapPath((@"~\Config\DevolveConfig.xml"));

            FounderSoftware.ADIM.OA.OA2DC.HN_OA2DC dcDev = new HN_OA2DC(sPath);
            FounderSoftware.ADIM.OA.OA2DP.HN_OA2DP dpDev = new HN_OA2DP(sPath);

            // 开始发送归档

            /*
             * 根据DevoleConfig.xml配置文件的中相应流程的<Object>DC</Object>节点来判断归档到哪个系统中
             * 若配置中为DC则表明调用OA2DC.DLL接口进行归档,若为DP则表明调用OA2DP.DLL接口进行归档
             */
            string xml        = "";
            string objDevolve = dcDev.GetCfgNodeValues("/Devolve/Process[@Name='" + sProcessType + "']/Object");
            string s          = "";

            sPlatForm = objDevolve.ToUpper();

            entity.FormsData = XmlUtility.SerializeXml(entity);
            if (objDevolve.ToUpper() == "DC" || objDevolve.ToUpper() == "FC")
            {
                FounderSoftware.ADIM.OA.OA2DC.OA2DC oa2dc = new FounderSoftware.ADIM.OA.OA2DC.OA2DC();
                xml = Devolve2DC2(entity, dcDev, sProcessType);

                s        = oa2dc.SendDevolve(xml, entity.FormsData, sProcessType);
                sResult += (s + @"\r\n");
                try
                {
                    Convert.ToInt32(s);
                }
                catch
                {
                    throw new Exception(s);
                }
                B_ProcessInstance.ProcessDevolve(entity.ProcessID, sProcessType);
            }

            if (objDevolve.ToUpper() == "DP")
            {
                FounderSoftware.ADIM.OA.OA2DP.OA2DP oa2dp = new FounderSoftware.ADIM.OA.OA2DP.OA2DP();
                string sOADPIDs = dpDev.GetCfgNodeValues("/Devolve/Process[@Name='" + sProcessType + "']/DPID");

                // 若DevolveConifg.xml配置文件中未配置CategID则根据流程实体中的处室ID归档
                string[] arrDPID = sOADPIDs.Split(new char[] { ',', ';' });
                for (int i = 0; i < arrDPID.Length; i++)
                {
                    try
                    {
                        Convert.ToInt32(arrDPID[i]);
                    }
                    catch
                    {
                        continue;
                    }
                    xml      = Devovle2DP2(entity, dpDev, arrDPID[i], sProcessType);
                    s        = oa2dp.SendDevolve(xml, entity.FormsData, sProcessType);
                    sResult += (s + @"\r\n");
                    try
                    {
                        Convert.ToInt32(s);
                    }
                    catch
                    {
                        throw new Exception(s);
                    }
                }

                string   sOptionDPID = dpDev.GetCfgNodeValues("/Devolve/Process[@Name='" + sProcessType + "']/OptionDPID");
                string[] arrOpDPID   = sOptionDPID.Split(new char[] { ',' });
                for (int i = 0; i < arrOpDPID.Length; i++)
                {
                    if (entity.GetVal(arrOpDPID[i]) == null)
                    {
                        continue;
                    }
                    string   sDPID = entity.GetVal(arrOpDPID[i]).ToString();
                    string[] IDs   = sDPID.Split(new char[] { ';', ',' });
                    for (int j = 0; j < IDs.Length; j++)
                    {
                        try
                        {
                            Convert.ToInt32(IDs[j]);
                        }
                        catch
                        {
                            continue;
                        }
                        xml      = Devovle2DP2(entity, dpDev, IDs[j], sProcessType);
                        s        = oa2dp.SendDevolve(xml, entity.FormsData, sProcessType);
                        sResult += (s + @"\r\n");
                        try
                        {
                            Convert.ToInt32(s);
                        }
                        catch
                        {
                            throw new Exception(s);
                        }
                    }
                }

                B_ProcessInstance.ProcessDevolve(entity.ProcessID, sProcessType);
            }
        }