Example #1
0
        public bool CreateEntity(string wf_name, string Ser_Num = null/*2016/2/12--保证子工作流串号与父工作流相同*/)
        {
            WorkFlows wfs = new WorkFlows();

            XmlDocument doc = new XmlDocument();
            WorkFlow_Define define = wfs.GetWorkFlowDefine(wf_name);
            doc.LoadXml(Encoding.Default.GetString(define.W_Xml));
            InstFromXmlNode((XmlNode)doc.DocumentElement);

           

            WorkFlow_Entity wfe = new WorkFlow_Entity();
            wfe.WE_Status = WE_STATUS.CREATED;
            wfe.WE_Binary = Encoding.Default.GetBytes(WriteToXmlNode().OuterXml);
            
                //wfe.Create_Info = SaveCreateRecord();
            //2016/2/12 --保证子工作流串号与父工作流相同
            if (Ser_Num == null)
                wfe.WE_Ser = "";
            else
                wfe.WE_Ser = Ser_Num;            

            if (!wfs.AddWorkEntity(wf_name, wfe))
                return false;

            m_entityID = wfe.WE_Id;
            m_entitySerial = wfe.WE_Ser;
            m_defineID = define.W_ID;

            RegEventsTimeOut(true);   
            return true;

        }
Example #2
0
        /// <summary>
        /// 通过工作流实体的id获得工作流实体
        /// </summary>
        /// <param name="wfe_id"></param>
        /// <returns></returns>
        public static UI_WFEntity_Info GetWorkFlowEntiy(int wfe_id, bool FullInfo = false)
        {
            UI_WFEntity_Info wfe  = new UI_WFEntity_Info();
            WorkFlows        wfs  = new WorkFlows();
            WorkFlow_Entity  wfe1 = wfs.GetWorkFlowEntity(wfe_id);

            if (FullInfo)
            {
                CWorkFlow   wf  = new CWorkFlow();
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(Encoding.Default.GetString(wfe1.WE_Binary));
                XmlNode xml = doc.DocumentElement;
                wf.ParaseBaseInfo(xml);
                WorkFlow_Define wfd = wfs.GetWorkFlowDefine(wfe_id);
                //wfe.name = wfd.W_Name;
                //wfe.description = wfd.W_Attribution;
                wfe.Binary      = Encoding.Default.GetString(wfe1.WE_Binary);
                wfe.name        = wf.name;
                wfe.description = wf.description;
            }

            wfe.EntityID       = wfe1.WE_Id;
            wfe.serial         = wfe1.WE_Ser;
            wfe.Status         = wfe1.WE_Status;
            wfe.Last_TransTime = wfe1.Last_Trans_Time;
            return(wfe);
        }
Example #3
0
        //返回一个工作流定义
        public static UI_WF_Define GetWorkFlowDefine(string wf_name)
        {
            WorkFlows       wfs    = new WorkFlows();
            WorkFlow_Define wfd    = wfs.GetWorkFlowDefine(wf_name);
            UI_WF_Define    ui_wfd = new UI_WF_Define {
                wf_name = wfd.W_Name, wf_description = wfd.W_Attribution
            };

            return(ui_wfd);
        }
Example #4
0
        public static CWorkFlow CreateWFEntityModifiedTimeOut(string wf_name, string event_name, CTimeOutProperty property, string Ser_Num = null /*2016/2/12--保证子工作流串号与父工作流相同*/)
        {
            CWorkFlow wf = new CWorkFlow();

            WorkFlows wfs = new WorkFlows();

            XmlDocument     doc    = new XmlDocument();
            WorkFlow_Define define = wfs.GetWorkFlowDefine(wf_name);

            doc.LoadXml(Encoding.Default.GetString(define.W_Xml));
            wf.InstFromXmlNode((XmlNode)doc.DocumentElement);

            //修改wf
            IEvent           ev_target   = wf.events[event_name];
            CTimeOutProperty timeout_pro = ev_target.GetTimeOutProperty();

            timeout_pro.ExactTime  = property.ExactTime;
            timeout_pro.StartTime  = property.StartTime;
            timeout_pro.TimeOffset = property.TimeOffset;

            WorkFlow_Entity wfe = new WorkFlow_Entity();

            wfe.WE_Status = WE_STATUS.CREATED;
            wfe.WE_Binary = Encoding.Default.GetBytes(wf.WriteToXmlNode().OuterXml);

            if (Ser_Num == null)
            {
                wfe.WE_Ser = "";
            }
            else
            {
                wfe.WE_Ser = Ser_Num;
            }

            if (!wfs.AddWorkEntity(wf_name, wfe))
            {
                return(null);
            }

            wf.EntityID     = wfe.WE_Id;
            wf.EntitySerial = wfe.WE_Ser;
            wf.DefineID     = define.W_ID;



            wf.RegEventsTimeOut(true);

            return(wf);
        }
Example #5
0
        //设置临时任务
        public string LSJob_Submit(string json1)
        {
            JObject item         = (JObject)JsonConvert.DeserializeObject(json1);
            string  WorkFlowName = item["Work_Name"].ToString();
            // WorkFlows ws = new WorkFlows();
            int    workflow_id = wfs.GetWorkFlowDefine(WorkFlowName).W_ID;
            string cj_ids      = item["Cj_Name"].ToString();
            string Zz_ids      = item["Zz_Name"].ToString();

            string[]       cjids      = cj_ids.Split(new char[] { ',' });
            string[]       zzids      = Zz_ids.Split(new char[] { ',' });
            string         Depts      = item["Dept"].ToString();
            string         qr_endtime = item["ZhengGaiTime"].ToString();
            CTimerCreateWF m          = new CTimerCreateWF();

            //使用lambda表达式过滤掉空字符串
            zzids = zzids.Where(t => !string.IsNullOrEmpty(t)).ToArray();

            //这里需要创建一个回调函数
            string TempJobName = item["Job_Name"].ToString();

            string corn            = "0 0 0 * * ?";
            string ReservationTime = item["ReservationTime"].ToString();


            m.Set_Res_Value("STR_RES_1", Depts);

            string[] s = ReservationTime.Split(new char[] { '-' });

            string[] ss      = s[0].Split(new char[] { '/' });
            string   endtime = s[1].Replace(" ", "");
            DateTime Endtime = DateTime.Parse(endtime);

            m.Set_Res_Value("STR_RES_2", Endtime);
            //11.12改
            if (qr_endtime != "")
            {
                m.Set_Res_Value("STR_RES_3", DateTime.Parse(qr_endtime));
            }

            corn = "0 0 0 " + ss[2] + "" + ss[1] + " " + "? " + ss[0];

            //未写
            if (WorkFlowName == "A6dot2")
            {
                for (int i = 0; i < cjids.Count(); i++)
                {
                    TimerCreateWFPa             TCP    = new TimerCreateWFPa();//
                    Dictionary <string, string> param  = new Dictionary <string, string>();
                    Dictionary <string, string> record = new Dictionary <string, string>();
                    param.Add("Cj_Name", Em.getEa_namebyId(Convert.ToInt16(cjids[i])));
                    record.Add("username", "system_temporary");
                    record.Add("time", DateTime.Now.ToString());
                    TCP.wf_params = param;
                    TCP.wf_record = record;
                    m.AppendCreateParam(TCP);

                    TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                    time_set.Time_start  = "wf_create";
                    time_set.Exact_time  = Endtime.ToString();
                    time_set.Offset_time = "";
                    time_set.Action      = "SUSPEND";
                    time_set.Call_back   = "";
                    TCP.AppendTimer("Xc_Sample", time_set);
                }
            }
            else if (WorkFlowName == "A5dot1")
            {
                for (int i = 0; i < zzids.Count(); i++)
                {
                    TimerCreateWFPa             TCP    = new TimerCreateWFPa();//
                    Dictionary <string, string> param  = new Dictionary <string, string>();
                    Dictionary <string, string> record = new Dictionary <string, string>();
                    param.Add("Zz_Name", Em.getEa_namebyId(Convert.ToInt16(zzids[i])));
                    record.Add("username", "system_temporary");
                    record.Add("time", DateTime.Now.ToString());
                    TCP.wf_params = param;
                    TCP.wf_record = record;
                    m.AppendCreateParam(TCP);

                    TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                    time_set.Time_start  = "wf_create";
                    time_set.Exact_time  = Endtime.ToString();
                    time_set.Offset_time = "";
                    time_set.Action      = "SUSPEND";
                    time_set.Call_back   = "";
                    TCP.AppendTimer("ZzSubmit", time_set);
                }
            }
            else if (WorkFlowName == "A11dot2dot1")
            {
                for (int i = 0; i < zzids.Count(); i++)
                {
                    TimerCreateWFPa             TCP    = new TimerCreateWFPa();//
                    Dictionary <string, string> param  = new Dictionary <string, string>();
                    Dictionary <string, string> record = new Dictionary <string, string>();
                    param.Add("Zz_Name", Em.getEa_namebyId(Convert.ToInt16(zzids[i])));
                    record.Add("username", "system_temporary");
                    record.Add("time", DateTime.Now.ToString());
                    TCP.wf_params = param;
                    TCP.wf_record = record;
                    m.AppendCreateParam(TCP);

                    TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                    time_set.Time_start  = "wf_create";
                    time_set.Exact_time  = Endtime.ToString();
                    time_set.Offset_time = "";
                    time_set.Action      = "SUSPEND";
                    time_set.Call_back   = "";
                    TCP.AppendTimer("ZzSubmit", time_set);
                }
            }
            else if (WorkFlowName == "A6dot2dot2")
            {
                for (int i = 0; i < cjids.Count(); i++)
                {
                    TimerCreateWFPa             TCP    = new TimerCreateWFPa();//
                    Dictionary <string, string> param  = new Dictionary <string, string>();
                    Dictionary <string, string> record = new Dictionary <string, string>();
                    param.Add("Cj_Name", cjids[i]);
                    param.Add("Job_Name", TempJobName);
                    param.Add("Job_Ztdanwei", Depts);
                    record.Add("username", "system_temporary");
                    record.Add("time", DateTime.Now.ToString());
                    TCP.wf_params = param;
                    TCP.wf_record = record;
                    m.AppendCreateParam(TCP);

                    TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                    time_set.Time_start  = "wf_create";
                    time_set.Exact_time  = Endtime.ToString();
                    time_set.Offset_time = "";
                    time_set.Action      = "SUSPEND";
                    time_set.Call_back   = "";
                    TCP.AppendTimer("ZzSubmit", time_set);
                }
            }
            else if (WorkFlowName == "A5dot2dot1")
            {
                for (int i = 0; i < zzids.Count(); i++)
                {
                    TimerCreateWFPa             TCP    = new TimerCreateWFPa();//
                    Dictionary <string, string> param  = new Dictionary <string, string>();
                    Dictionary <string, string> record = new Dictionary <string, string>();
                    param.Add("Zz_Name", Em.getEa_namebyId(Convert.ToInt16(zzids[i])));
                    record.Add("username", "system_temporary");
                    record.Add("time", DateTime.Now.ToString());
                    TCP.wf_params = param;
                    TCP.wf_record = record;
                    m.AppendCreateParam(TCP);

                    TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                    time_set.Time_start  = "wf_create";
                    time_set.Exact_time  = Endtime.ToString();
                    time_set.Offset_time = "";
                    time_set.Action      = "SUSPEND";
                    time_set.Call_back   = "";
                    TCP.AppendTimer("ZzSubmit", time_set);
                }
            }

            m.for_using  = TIMER_USING.FOR_CUSTOM;
            m.CreateTime = DateTime.Now;
            m.SetTriggerTiming(corn);
            m.mission_name = item["Job_Name"].ToString();
            m.status       = TM_STATUS.TM_STATUS_ACTIVE;
            //m.CreateCallback = "/zxhtest/QxFunction?depts="+Depts+"";//和权限有关的回调函数
            m.CustomFlag = 1;

            WorkFlow_Define wfd = wfs.GetWorkFlowDefineByID(workflow_id);

            m.attachTarget(wfd);
            m.GetAttachWorkFlow();//0910
            m.Save();

            CTimerManage.ActiveListActionForMission(m);
            return("/TempJob/index");
        }
        public string CreateA14dot3s_submitsignal(string json1)
        {
            try
            {
                JObject        item    = (JObject)JsonConvert.DeserializeObject(json1);
                EquipManagment tm      = new EquipManagment();
                string         temp    = item["sample"].ToString();
                JArray         jsonVal = JArray.Parse(temp) as JArray;
                dynamic        table2  = jsonVal;
                foreach (dynamic T in table2)
                {
                    //加载原工作流工作流
                    CWorkFlow       m_workFlow = new CWorkFlow();
                    WorkFlows       wfs        = new WorkFlows();
                    WorkFlow_Define wf_define  = wfs.GetWorkFlowDefine("A14dot3dot3");
                    m_workFlow = null;
                    if (wf_define != null)
                    {
                        XmlDocument doc = new XmlDocument();
                        doc.LoadXml(Encoding.Default.GetString(wf_define.W_Xml));
                        m_workFlow = new CWorkFlow();
                        m_workFlow.InstFromXmlNode((XmlNode)doc.DocumentElement);
                        m_workFlow.DefineID = wf_define.W_ID;
                    }

                    //加载超时属性数据
                    TimerCreateWFPa TCP = new TimerCreateWFPa();
                    TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                    time_set.Time_start  = "wf_create";
                    time_set.Exact_time  = "";
                    time_set.Offset_time = (DateTime.Now.AddDays(5) - DateTime.Now).ToString();
                    //time_set.Offset_time = (DateTime.Now.AddMinutes(3) - DateTime.Now).ToString();
                    time_set.Action    = "INVILID";
                    time_set.Call_back = "http://localhost/CallBack/testCallBack";
                    TCP.AppendTimer("PqAssess", time_set);

                    //创建写入timeout属性的工作流
                    CWorkFlow wf = new CWorkFlow();

                    wf.InstFromXmlNode(m_workFlow.WriteToXmlNode());

                    //修改定时器
                    foreach (var ti in TCP.wf_timer)
                    {
                        try
                        {
                            DateTime?dt = null;

                            if (ti.Value["ExactTime"] != "")
                            {
                                dt = DateTime.Parse(ti.Value["ExactTime"]);
                            }
                            wf.events[ti.Key].TimeOutProperty.SetAttribute("exact_time", dt);

                            TimeSpan?ts = null;
                            if (ti.Value["OffsetTime"] != "")
                            {
                                ts = TimeSpan.Parse(ti.Value["OffsetTime"]);
                            }
                            wf.events[ti.Key].TimeOutProperty.SetAttribute("offset_time", ts);

                            wf.events[ti.Key].TimeOutProperty.SetAttribute("time_start", ti.Value["TimeStart"]);

                            wf.events[ti.Key].TimeOutProperty.SetAttribute("action", ti.Value["Action"]);
                            wf.events[ti.Key].TimeOutProperty.SetAttribute("call_back", ti.Value["CallBack"]);
                        }
                        catch
                        {
                            continue;
                        }
                    }

                    //创建工作流
                    wf.CreateEntityBySelf();
                    //开启工作流
                    Dictionary <string, string> record = new Dictionary <string, string>();
                    record.Add("username", "system_temporary");
                    record.Add("time", DateTime.Now.ToString());
                    TCP.wf_record = record;
                    wf.Start((IDictionary <string, string>)(TCP.wf_record));


                    Dictionary <string, string> signal = new Dictionary <string, string>();
                    string Equip_Code           = T.Equip_Code;
                    int    Equip_location_EA_Id = tm.getEA_id_byCode(Equip_Code);

                    signal["Zz_Name"]           = tm.getZzName(Equip_location_EA_Id);
                    signal["Equip_GyCode"]      = T.Equip_GyCode;
                    signal["Equip_Code"]        = T.Equip_Code;
                    signal["Equip_ABCMark"]     = T.Equip_ABCMark;
                    signal["SubmitJxPlan_Done"] = "true";
                    //record
                    Dictionary <string, string> record1 = new Dictionary <string, string>();
                    record1["username"] = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                    record1["time"]     = DateTime.Now.ToString();
                    //submit
                    CWFEngine.SubmitSignal(Convert.ToInt32(wf.EntityID), signal, record1);
                }
            }
            catch (Exception e)
            {
                return("");
            }
            return("/A14dot3/Index");
        }
Example #7
0
        public string DSJob_Submit(string json1)
        {
            JObject item         = (JObject)JsonConvert.DeserializeObject(json1);
            string  WorkFlowName = item["Work_Name"].ToString();
            // WorkFlows ws = new WorkFlows();
            int  workflow_id           = wfs.GetWorkFlowDefine(WorkFlowName).W_ID;
            Jobs job                   = new Jobs();
            List <Timer_Jobs> job_list = job.GetDSbyWorkflow(workflow_id);

            if (job_list.Count == 0)
            {
                string         cj_ids = item["Cj_Name"].ToString();
                string         Zz_ids = item["Zz_Name"].ToString();
                string[]       cjids  = cj_ids.Split(new char[] { ',' });
                string[]       zzids  = Zz_ids.Split(new char[] { ',' });
                CTimerCreateWF m      = new CTimerCreateWF();
                //这里需要创建一个回调函数
                string DingShiJobName = item["Job_Name"].ToString();

                //使用lambda表达式过滤掉空字符串
                zzids = zzids.Where(s => !string.IsNullOrEmpty(s)).ToArray();
                //未写
                if (WorkFlowName == "A6dot2")
                {
                    for (int i = 0; i < cjids.Count(); i++)
                    {
                        TimerCreateWFPa             TCP    = new TimerCreateWFPa();//
                        Dictionary <string, string> param  = new Dictionary <string, string>();
                        Dictionary <string, string> record = new Dictionary <string, string>();
                        param.Add("Cj_Name", Em.getEa_namebyId(Convert.ToInt16(cjids[i])));
                        record.Add("username", "system_scheduled");
                        record.Add("time", DateTime.Now.ToString());
                        TCP.wf_params = param;
                        TCP.wf_record = record;
                        m.AppendCreateParam(TCP);

                        TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                        time_set.Time_start  = "wf_create";
                        time_set.Exact_time  = "";
                        time_set.Offset_time = (DateTime.Now.AddDays(5) - DateTime.Now).ToString();
                        //time_set.Offset_time = (DateTime.Now.AddMinutes(3) - DateTime.Now).ToString();
                        time_set.Action    = "INVILID";
                        time_set.Call_back = "http://localhost/CallBack/testCallBack";
                        TCP.AppendTimer("Xc_Sample", time_set);
                    }
                }
                if (WorkFlowName == "A15dot1")
                {
                    List <string> pq_list = new List <string>();
                    pq_list.Add("联合一片区");
                    pq_list.Add("联合二片区");
                    pq_list.Add("联合三片区");
                    pq_list.Add("联合四片区");
                    pq_list.Add("化工片区");
                    pq_list.Add("综合片区");
                    pq_list.Add("其他");
                    //pq_list.Add("检修单位");
                    for (int i = 0; i < pq_list.Count(); i++)
                    {
                        TimerCreateWFPa             TCP    = new TimerCreateWFPa();//
                        Dictionary <string, string> param  = new Dictionary <string, string>();
                        Dictionary <string, string> record = new Dictionary <string, string>();
                        param.Add("Pqname", pq_list[i]);
                        record.Add("username", "system_scheduled");
                        record.Add("time", DateTime.Now.ToString());
                        TCP.wf_params = param;
                        TCP.wf_record = record;
                        m.AppendCreateParam(TCP);


                        TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                        time_set.Time_start  = "wf_create";
                        time_set.Exact_time  = "";
                        time_set.Offset_time = (DateTime.Now.AddDays(1) - DateTime.Now).ToString();
                        //time_set.Offset_time = (DateTime.Now.AddMinutes(3) - DateTime.Now).ToString();
                        time_set.Action    = "INVILID";
                        time_set.Call_back = "http://localhost/CallBack/testCallBack";
                        TCP.AppendTimer("ZzSubmit", time_set);
                    }
                }
                else if (WorkFlowName == "A5dot1dot2")
                {
                    for (int i = 0; i < zzids.Count(); i++)
                    {
                        TimerCreateWFPa             TCP    = new TimerCreateWFPa();//
                        Dictionary <string, string> param  = new Dictionary <string, string>();
                        Dictionary <string, string> record = new Dictionary <string, string>();
                        param.Add("Zz_Name", Em.getEa_namebyId(Convert.ToInt16(zzids[i])));
                        record.Add("username", "system_scheduled");
                        record.Add("time", DateTime.Now.ToString());
                        TCP.wf_params = param;
                        TCP.wf_record = record;
                        m.AppendCreateParam(TCP);

                        TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                        time_set.Time_start  = "wf_create";
                        time_set.Exact_time  = "";
                        time_set.Offset_time = (DateTime.Now.AddDays(5) - DateTime.Now).ToString();
                        //time_set.Offset_time = (DateTime.Now.AddMinutes(3) - DateTime.Now).ToString();
                        time_set.Action    = "INVILID";
                        time_set.Call_back = "http://localhost/CallBack/testCallBack";
                        TCP.AppendTimer("ZzSubmit", time_set);
                    }
                }
                else if (WorkFlowName == "A5dot2dot2")
                {
                    for (int i = 0; i < zzids.Count(); i++)
                    {
                        TimerCreateWFPa             TCP    = new TimerCreateWFPa();//
                        Dictionary <string, string> param  = new Dictionary <string, string>();
                        Dictionary <string, string> record = new Dictionary <string, string>();
                        param.Add("Zz_Name", Em.getEa_namebyId(Convert.ToInt16(zzids[i])));
                        record.Add("username", "system_scheduled");
                        record.Add("time", DateTime.Now.ToString());
                        TCP.wf_params = param;
                        TCP.wf_record = record;
                        m.AppendCreateParam(TCP);

                        TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                        time_set.Time_start  = "wf_create";
                        time_set.Exact_time  = "";
                        time_set.Offset_time = (DateTime.Now.AddDays(5) - DateTime.Now).ToString();
                        //time_set.Offset_time = (DateTime.Now.AddMinutes(3) - DateTime.Now).ToString();
                        time_set.Action    = "INVILID";
                        time_set.Call_back = "http://localhost/CallBack/testCallBack";
                        TCP.AppendTimer("ZzSubmit", time_set);
                    }
                }
                else if (WorkFlowName == "A11dot2dot2")
                {
                    for (int i = 0; i < zzids.Count(); i++)
                    {
                        TimerCreateWFPa             TCP    = new TimerCreateWFPa();//
                        Dictionary <string, string> param  = new Dictionary <string, string>();
                        Dictionary <string, string> record = new Dictionary <string, string>();
                        param.Add("Zz_Name", Em.getEa_namebyId(Convert.ToInt16(zzids[i])));
                        record.Add("username", "system_scheduled");
                        record.Add("time", DateTime.Now.ToString());
                        TCP.wf_params = param;
                        TCP.wf_record = record;
                        m.AppendCreateParam(TCP);

                        TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                        time_set.Time_start  = "wf_create";
                        time_set.Exact_time  = "";
                        time_set.Offset_time = (DateTime.Now.AddDays(5) - DateTime.Now).ToString();
                        //time_set.Offset_time = (DateTime.Now.AddMinutes(3) - DateTime.Now).ToString();
                        time_set.Action    = "INVILID";
                        time_set.Call_back = "http://localhost/CallBack/testCallBack";
                        TCP.AppendTimer("ZzSubmit", time_set);
                    }
                }
                if (WorkFlowName == "A12dot2dot1")
                {
                    for (int i = 0; i < zzids.Count(); i++)
                    {
                        TimerCreateWFPa             TCP    = new TimerCreateWFPa();//
                        Dictionary <string, string> param  = new Dictionary <string, string>();
                        Dictionary <string, string> record = new Dictionary <string, string>();
                        param.Add("Zz_Name", Em.getEa_namebyId(Convert.ToInt16(zzids[i])));
                        record.Add("username", "system_scheduled");
                        record.Add("time", DateTime.Now.ToString());
                        TCP.wf_params = param;
                        TCP.wf_record = record;
                        m.AppendCreateParam(TCP);

                        TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                        time_set.Time_start  = "wf_create";
                        time_set.Exact_time  = "";
                        time_set.Offset_time = (DateTime.Now.AddDays(5) - DateTime.Now).ToString();
                        time_set.Action      = "INVILID";
                        time_set.Call_back   = "http://localhost/CallBack/testCallBack";
                        TCP.AppendTimer("ZzSubmit", time_set);
                    }
                }
                else if (WorkFlowName == "A6dot3")
                {
                    for (int i = 0; i < cjids.Count(); i++)
                    {
                        TimerCreateWFPa             TCP    = new TimerCreateWFPa();//
                        Dictionary <string, string> param  = new Dictionary <string, string>();
                        Dictionary <string, string> record = new Dictionary <string, string>();
                        param.Add("Zz_Name", Em.getEa_namebyId(Convert.ToInt16(zzids[i])));
                        record.Add("username", "system_scheduled");
                        record.Add("time", DateTime.Now.ToString());
                        TCP.wf_params = param;
                        TCP.wf_record = record;
                        m.AppendCreateParam(TCP);

                        TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                        time_set.Time_start  = "wf_create";
                        time_set.Exact_time  = "";
                        time_set.Offset_time = (DateTime.Now.AddDays(1) - DateTime.Now).ToString();
                        time_set.Action      = "INVILID";
                        time_set.Call_back   = "http://localhost/CallBack/testCallBack";
                        TCP.AppendTimer("Ineligible_Submit", time_set);
                    }
                }
                else if (WorkFlowName == "A7dot1dot1")
                {
                    List <Equip_Info> Th_sb = new List <Equip_Info>();
                    EquipManagment    Epm   = new EquipManagment();
                    Th_sb = Epm.getAllThEquips();
                    for (int i = 0; i < Th_sb.Count(); i++)
                    {
                        TimerCreateWFPa             TCP    = new TimerCreateWFPa();//
                        Dictionary <string, string> param  = new Dictionary <string, string>();
                        Dictionary <string, string> record = new Dictionary <string, string>();
                        param.Add("Equip_GyCode", Th_sb[i].Equip_GyCode);
                        record.Add("username", "system_scheduled");
                        record.Add("time", DateTime.Now.ToString());
                        TCP.wf_params = param;
                        TCP.wf_record = record;
                        m.AppendCreateParam(TCP);

                        TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                        time_set.Time_start  = "wf_create";
                        time_set.Exact_time  = "";
                        time_set.Offset_time = (DateTime.Now.AddDays(1) - DateTime.Now).ToString();
                        time_set.Action      = "INVILID";
                        time_set.Call_back   = "http://localhost/CallBack/testCallBack";
                        TCP.AppendTimer("ZzSubmit", time_set);
                    }
                }
                else if (WorkFlowName == "A14dot2")
                {
                    for (int i = 0; i < zzids.Count(); i++)
                    {
                        TimerCreateWFPa             TCP    = new TimerCreateWFPa();//
                        Dictionary <string, string> param  = new Dictionary <string, string>();
                        Dictionary <string, string> record = new Dictionary <string, string>();
                        param.Add("Zz_Name", Em.getEa_namebyId(Convert.ToInt16(zzids[i])));
                        record.Add("username", "system_scheduled");
                        record.Add("time", DateTime.Now.ToString());
                        TCP.wf_params = param;
                        TCP.wf_record = record;
                        m.AppendCreateParam(TCP);

                        TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                        time_set.Time_start  = "wf_create";
                        time_set.Exact_time  = "";
                        time_set.Action      = "INVILID";
                        time_set.Call_back   = "http://localhost/CallBack/testCallBack";
                        time_set.Offset_time = (DateTime.Now.AddDays(5) - DateTime.Now).ToString();
                        TCP.AppendTimer("JxdwSubmit", time_set);
                        //TCP.AppendTimer("ZzConfirm", time_set);
                    }
                }
                else if (WorkFlowName == "A14dot3dot2")
                {
                    for (int i = 0; i < zzids.Count(); i++)
                    {
                        TimerCreateWFPa             TCP    = new TimerCreateWFPa();//
                        Dictionary <string, string> param  = new Dictionary <string, string>();
                        Dictionary <string, string> record = new Dictionary <string, string>();
                        param.Add("Zz_Name", Em.getEa_namebyId(Convert.ToInt16(zzids[i])));
                        record.Add("username", "system_scheduled");
                        record.Add("time", DateTime.Now.ToString());
                        TCP.wf_params = param;
                        TCP.wf_record = record;
                        m.AppendCreateParam(TCP);

                        TimerCreateWFPa.TimerSetting time_set = new TimerCreateWFPa.TimerSetting();
                        time_set.Time_start  = "wf_create";
                        time_set.Exact_time  = "";
                        time_set.Offset_time = (DateTime.Now.AddDays(5) - DateTime.Now).ToString();
                        time_set.Action      = "SUSPEND";
                        time_set.Call_back   = "http://localhost/CallBack/testCallBack";
                        TCP.AppendTimer("ZzSubmit", time_set);
                    }
                }



                string corn            = "0 0 0 * * ?";
                string corn_express    = item["corn_express"].ToString();
                string ReservationTime = item["reservationtime"].ToString();
                m.Set_Res_Value("STR_RES_2", ReservationTime);
                corn         = corn_express;
                m.for_using  = TIMER_USING.FOR_CUSTOM;
                m.CreateTime = DateTime.Now;
                m.SetTriggerTiming(corn);
                m.mission_name = item["Job_Name"].ToString();
                m.status       = TM_STATUS.TM_STATUS_ACTIVE;
                //m.CreateCallback = "/zxhtest/QxFunction?depts="+Depts+"";//和权限有关的回调函数
                m.CustomFlag = 0;

                WorkFlow_Define wfd = wfs.GetWorkFlowDefineByID(workflow_id);

                m.attachTarget(wfd);
                m.GetAttachWorkFlow();//0910
                m.Save();

                CTimerManage.ActiveListActionForMission(m);
                return("成功发起定时任务");
            }
            else
            {
                return("该工作流已经提报过,请删除后再发起");
            }
        }