/// <summary>
        /// 发起流程方法
        /// </summary>
        public static void Launch()
        {
            string ConfName = string.Format(@"{0}\{1}", System.AppDomain.CurrentDomain.BaseDirectory, "TransferPlan.xml");
            //读取配置文件
            TransferPlanConf conf = TransferPlanConf.LoadConf(ConfName);
            //获取数据源,如果不需要发起,直接退出,避免后面的尝试连接程序性能消耗
            DataSet ds = GetDataSource(conf.ERPConnString);
            if (ds.Tables["WarehouseTransferPlanM"].Rows.Count == 0) return;

            try
            {
                _bpm = new BPMHelper(conf.BPMServer, conf.UserAccount, conf.PWD);
                //声明原数据输出xml stream的方法
                _bpm._tag = new GeneratePostXML(TransferPlanXML);

                foreach (DataRow row in ds.Tables["WarehouseTransferPlanM"].Rows)
                {
                    int pId = int.Parse(row["Id"].ToString());
                    if (row["OAFlowId"] is DBNull || row["OAFlowId"].ToString() == "1")
                    {
                        string result = _bpm.StartProcess(_proccessName, ds,pId);
                        string msg = BPMMsgHepler.StartProccessSucceed(_proccessName, _billTypeName, pId, result);
                        _log.Info(msg);
                        row["OAFlowId"] = 3;
                    }
                }
            }
            catch (Exception err)
            {
                _log.Error(err);
                throw(err);
            }
            finally
            {
                //对已启动的流程设置已触发标记
                FinalDo(conf.ERPConnString, ds);
            }
        }
        /// <summary>
        /// 发起流程方法
        /// </summary>
        public static void Launch()
        {
            string ConfName = string.Format(@"{0}\{1}", System.AppDomain.CurrentDomain.BaseDirectory, "LoseInTrafic.xml");
            //读取配置文件
            LoseInTraficConf conf = LoseInTraficConf.LoadConf(ConfName);

            //获取数据源,如果不需要发起,直接退出,避免后面的尝试连接程序性能消耗
            DataSet ds = GetDataSource(conf.ERPConnString);
            if (ds.Tables[0].Rows.Count == 0)
            {
                return;
            }

            try
            {
                BPMHelper bpm = new BPMHelper(conf.BPMServer, conf.UserAccount,conf.PWD);
                bpm._tag = new GeneratePostXML(LoseInTraficXML);

                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    if (row["ReqFlowId"].ToString() == "2")
                    {
                        string result = bpm.StartProcess("中心仓途损申请", ds,int.Parse(row["ID"].ToString()));
                        //此处需将信息记录到日志中
                        row["ReqFlowId"] = 6;
                    }
                }
            }
            catch (Exception err)
            {
                throw new Exception(err.Message);
            }
            finally
            {
                //对已启动的流程设置已触发标记
                FinalDo(conf.ERPConnString,ds);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 发起流程方法
        /// </summary>
        public static void Launch()
        {
            string ConfName = string.Format(@"{0}\{1}", System.AppDomain.CurrentDomain.BaseDirectory, "TC.xml");
            //读取配置文件
            TCConf conf = TCConf.LoadConf(ConfName);
            //获取数据源,如果不需要发起,直接退出,避免后面的尝试连接程序性能消耗
            DataSet ds = GetDataSource(conf.ERPConnString);

            if (ds.Tables[0].Rows.Count == 0)
            {
                return;
            }

            try
            {
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    if (row["ReqFlowId"].ToString() == "2")
                    {
                        //判定发起人位置;
                        string strOrganizing = row["Organizing"].ToString().Substring(0, 2) ;
                        string UID = "hboa";
                        string pName = "特采";

                        switch(strOrganizing)
                        {
                            case "南京":
                                UID = "njoa";
                                break;
                            case "阳江":
                                UID = "yjoa";
                                break;
                            default:
                                UID = "hboa";
                                break;
                        }
                        if (row["FlowTypeID"].ToString() == "1")
                        {
                            pName = "紧急放行";
                        }

                        BPMHelper bpm = new BPMHelper(conf.BPMServer, UID,"");
                        bpm._tag = new GeneratePostXML(TCXML);
                        int pId = int.Parse(row["ID"].ToString());
                        string result = bpm.StartProcess(pName, ds,pId);
                        //此处需将信息记录到日志中
                        _log.Info(String.Format("{0}{1}发起流程成功;流程发起返回信息{2}", pName,pId, result));
                        row["OAflowID"] = 3;;
                    }
                }
            }
            catch (Exception err)
            {
                _log.Info(err);
                throw new Exception(err.Message);
            }
            finally
            {
                //对已启动的流程设置已触发标记
                FinalDo(conf.ERPConnString, ds);
            }
        }