public string Get_work_cycles_no(Zhgd_iot_tower_current zhgd_Iot_Tower_Current) { //大于0.2t就认为触发了工作循环得条件了 if (zhgd_Iot_Tower_Current.weight > 0.2) { if (zhgd_Iot_Tower_Current.is_warning == "Y") { is_work_cycles_warning = "Y"; foreach (string type in zhgd_Iot_Tower_Current.warning_type) { if (!work_cycles_warning_type.Contains(type)) { work_cycles_warning_type.Add(type); } } } if (work_cycles_no != "0") { if (last_height != zhgd_Iot_Tower_Current.height || last_range != zhgd_Iot_Tower_Current.range || last_rotation != zhgd_Iot_Tower_Current.rotation) { is_change_height = true; } last_height = zhgd_Iot_Tower_Current.height; last_range = zhgd_Iot_Tower_Current.range; last_rotation = zhgd_Iot_Tower_Current.rotation; } else { work_cycles_no = DPC_Tool.GetTimeStamp().ToString(); is_change_height = false; last_height = zhgd_Iot_Tower_Current.height; last_range = zhgd_Iot_Tower_Current.range; last_rotation = zhgd_Iot_Tower_Current.rotation; } } //不满足工作循环得条件 else { //不等于0说明这次工作循环该结束了 if (work_cycles_no != "0") { //put运行数据到ES里 Zhgd_iot_tower_working ztw = Zhgd_iot_tower_working.Get_Zhgd_iot_tower_working(zhgd_Iot_Tower_Current); ztw.work_cycles_warning = is_work_cycles_warning; ztw.work_cycles_no = work_cycles_no; ztw.warning_type = work_cycles_warning_type.ToArray(); //异步运行 Tower_operation.Put_work_cycles_event.BeginInvoke(ztw, null, null); //进行初始化操作 work_cycles_no = "0"; is_work_cycles_warning = "N"; is_change_height = false; last_height = 0; last_range = 0; last_rotation = 0; } } return(work_cycles_no); }
/// <summary> /// put塔吊运行数据 /// </summary> /// <param name="zhgd_Iot_Tower_Working"></param> public static void Put_work_cycles(Zhgd_iot_tower_working zhgd_Iot_Tower_Working) { try { string url = "https://111.56.13.177:52001/zhgd_iot-" + DateTime.Now.ToString("yyyyMMdd") + "/_doc/"; string senddata = JsonConvert.SerializeObject(zhgd_Iot_Tower_Working); Restful.Post(url, senddata); } catch (Exception ex) { ToolAPI.XMLOperation.WriteLogXmlNoTail("塔吊Put_work_cycles异常", ex.Message); } }
/// <summary> /// 构造 /// </summary> /// <param name="zhgd_Iot_Tower_Current"></param> //public static Zhgd_iot_tower_working Get_Zhgd_iot_tower_working(Zhgd_iot_tower_current zhgd_Iot_Tower_Current) //{ // Zhgd_iot_tower_working z = new Zhgd_iot_tower_working(); // Zhgd_iot_tower_current zhgd_Iot_Tower_Currenta = z; // zhgd_Iot_Tower_Currenta = zhgd_Iot_Tower_Current; // z.work_cycles_warning = ""; // return z; //} public static Zhgd_iot_tower_working Get_Zhgd_iot_tower_working(Zhgd_iot_tower_current parent) { Zhgd_iot_tower_working child = new Zhgd_iot_tower_working(); var ParentType = typeof(Zhgd_iot_tower_current); var Properties = ParentType.GetProperties(); foreach (var Propertie in Properties) { if (Propertie.CanRead && Propertie.CanWrite) { Propertie.SetValue(child, Propertie.GetValue(parent, null), null); } } return(child); }