/// <summary> /// 执行工作流创建工作 /// </summary> protected override void __processing() { //Trace.WriteLine(string.Format("Creating WorkFlow {0}", m_workFlow.name)); foreach (var rp in (List <TimerCreateWFPa>)m_run_params) { if (rp.wf_timer != null) { //创建工作流 CWorkFlow wf = new CWorkFlow(); wf.InstFromXmlNode(m_workFlow.WriteToXmlNode()); //修改定时器 foreach (var ti in rp.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; } } //更新工作流变量 foreach (var pp in ((Dictionary <string, string>)(rp.wf_params))) { try { CParam pa = wf.paramstable[pp.Key]; pa.value = pp.Value; if (pp.Key == "Zz_Name" || pp.Key == "ZzName" || pp.Key == "Pqname" || pp.Key == "Equip_GyCode") { wf.description = wf.description + "(" + pp.Value + ")"; } } catch { continue; } } //创建工作流 wf.CreateEntityBySelf(); // //回调 AfterCreate(wf.EntityID); ((List <int>)m_run_result).Add(wf.EntityID); //工作流开始工作 wf.Start((IDictionary <string, string>)(rp.wf_record)); } } }
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"); }