protected override void Seed(WorkFlowContext context) { var wd = new WorkFlow_Define { W_Name = "A13dot1", W_Attribution = "缺陷故障管理流程" }; XmlDocument doc = new XmlDocument(); doc.Load(HttpContext.Current.Server.MapPath(@"~/Scripts/A13dot1.xml")); wd.W_Xml = Encoding.Default.GetBytes(doc.InnerXml); context.workflow_define.Add(wd); //base.Seed(context); wd = new WorkFlow_Define { W_Name = "A11dot2", W_Attribution = "设备隐患排查流程" }; doc.Load(HttpContext.Current.Server.MapPath(@"~/Scripts/A11dot2.xml")); wd.W_Xml = Encoding.Default.GetBytes(doc.InnerXml); context.workflow_define.Add(wd); wd = new WorkFlow_Define { W_Name = "A8dot2", W_Attribution = "检修计划实施管理" }; doc.Load(HttpContext.Current.Server.MapPath(@"~/Scripts/A8dot2.xml")); wd.W_Xml = Encoding.Default.GetBytes(doc.InnerXml); context.workflow_define.Add(wd); base.Seed(context); }
/// <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); }
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; }
public WorkFlow_Define GetWorkFlowDefine(string wf_name) { using (var db = base.NewDB()) { WorkFlow_Define wd = db.workflow_define.Where(s => s.W_Name == wf_name).First(); return wd; } }
//返回一个工作流定义 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); }
protected override void Seed(WorkFlowContext context) { var wd = new WorkFlow_Define { W_Name = "holiday", W_Attribution = "请假审批流程" }; XmlDocument doc = new XmlDocument(); doc.Load(HttpContext.Current.Server.MapPath(@"~/Scripts/holiday.xml")); wd.W_Xml = Encoding.Default.GetBytes(doc.InnerXml); context.workflow_define.Add(wd); base.Seed(context); }
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); }
/// <summary> /// 绑定执行对象 /// </summary> /// <param name="wf">工作流</param> /// <returns></returns> public bool attachTarget(WorkFlow_Define wf) { if (wf == null) { return(false); } XmlDocument doc = new XmlDocument(); doc.LoadXml(Encoding.Default.GetString(wf.W_Xml)); m_workFlow.InstFromXmlNode((XmlNode)doc.DocumentElement); m_workFlow.DefineID = wf.W_ID; return(true); }
//获得工作流实体 wfe_id 的define public WorkFlow_Define GetWorkFlowDefine(int wfe_id) { try { using (var db = base.NewDB()) { WorkFlow_Define wd = db.workflow_entities.Where(s => s.WE_Id == wfe_id).First().WE_Wref; return wd; } } catch { return null; } }
/// <summary> /// 从数据库记录加载类对象 /// </summary> /// <param name="job">数据库记录</param> public override void Load(Timer_Jobs job) { //加载工作流定义 WorkFlows wfs = new WorkFlows(); WorkFlow_Define wf_define = wfs.GetWorkFlowDefineByID(job.workflow_ID); 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 = job.workflow_ID; } base.Load(job); CreateCallback = CustomAction; }
public bool AddWorkEntity(string wfName, WorkFlow_Entity we) { int num = 0; lock (insert_lock) { //locked using (var db = base.NewDB()) { WorkFlow_Define wd = db.workflow_define.Where(s => s.W_Name == wfName).First(); if (we.WE_Ser == "") //2012/2/12--保证子工作流串号与父工作流相同 { //对WorkFlow_Entity编号的处理 string perFix = DateTime.Now.ToString("yyyyMM"); IQueryable<WorkFlow_Entity> we_Ser = db.workflow_entities.Where(s => s.WE_Ser.StartsWith(perFix)).OrderBy(s => s.WE_Ser); if (we_Ser.ToList().Count == 0) we.WE_Ser = perFix + "00001"; else { we.WE_Ser = (Convert.ToInt64(we_Ser.ToList().Last().WE_Ser) + 1).ToString(); } } if (wd == null) return false; wd.W_Wentities.Add(we); //System.Threading.Thread.Sleep(2000); num = db.SaveChanges(); //return (db.SaveChanges() != 0); } }//unlocked return (num != 0); }
//获取临时待处理任务 public string getJobList() { Jobs m = new Jobs(); int UserId = (Session["User"] as EquipModel.Entities.Person_Info).Person_Id; PersonManagment pm = new PersonManagment(); EquipBLL.AdminManagment.PersonManagment.P_viewModal pv = pm.Get_PersonModal(UserId); int zytd; if (pv.Role_Names.Contains("专业团队") || pv.Role_Names.Contains("专家团队") || pv.Role_Names.Contains("专业团队负责人")) { zytd = 1; } else { zytd = 0; } List <Timer_Jobs> Joblist = m.GetAllTimerJob(); List <object> r = new List <object>(); for (int i = 0; i < Joblist.Count; i++) { if (Joblist[i].custom_flag == 1 && Joblist[i].Job_Type == TIMER_JOB_TYPE.CREATE_WORKFLOW) { List <string> cjnames = new List <string>(); string Cj_Names = ""; JArray jsonVal = JArray.Parse(Joblist[i].run_params) as JArray; dynamic table2 = jsonVal; foreach (dynamic T in table2) { WorkFlow_Define wfd = wfs.GetWorkFlowDefineByID(Joblist[i].workflow_ID); if (wfd.W_Name == "A6dot2dot2") { // JObject item = (JObject)JsonConvert.DeserializeObject(T.PARAMS); string cjid = T.PARAMS.Cj_Name.ToString(); string cj_name = Em.getEa_namebyId(Convert.ToInt16(cjid)); cjnames.Add(cj_name); } else { foreach (dynamic t in T.PARAMS) { string cjtemp = ""; cjtemp = t.Value; cjnames.Add(cjtemp); } } } for (int k = 0; k < cjnames.Count; k++) { EquipArchiManagment em = new EquipArchiManagment(); // Cj_Names = Cj_Names + em.getEa_namebyId(Convert.ToInt16(cjnames[k])) + "、"; Cj_Names = Cj_Names + cjnames[k] + "、"; } //string job_time = ""; //string[] job_timelist = Joblist[i].corn_express.Split(new char[] { ' ' }); //job_time = job_timelist[6] + "年" + job_timelist[4] + "月" + job_timelist[3] + "日"; string wf_name = wfs.GetWorkFlowDefineByID(Joblist[i].workflow_ID).W_Name + ":" + wfs.GetWorkFlowDefineByID(Joblist[i].workflow_ID).W_Attribution; string job_desc = wfs.GetWorkFlowDefineByID(Joblist[i].workflow_ID).W_Name; object o = new { job_id = Joblist[i].JOB_ID, index = i + 1, jobName = Joblist[i].job_name, jobType = wf_name, job_desc = job_desc, jobTIme = Joblist[i].STR_RES_2, jobRunPara = Cj_Names, jobStatus = Joblist[i].status, job_dep = Joblist[i].STR_RES_1, job_result = Joblist[i].run_result, iszytd = zytd }; r.Add(o); } } string str = JsonConvert.SerializeObject(r); return("{" + "\"data\": " + str + "}"); }
//设置临时任务 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"); }
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("该工作流已经提报过,请删除后再发起"); } }