/// <summary> /// put卸料运行数据 /// </summary> /// <param name="zhgd_Iot_Tower_Working"></param> public static void Put_work_cycles(Zhgd_iot_discharge_working zhgd_Iot_discharge_Working) { try { string url = "https://111.56.13.177:52001/zhgd_iot-" + DateTime.Now.ToString("yyyyMMdd") + "/_doc/"; string senddata = JsonConvert.SerializeObject(zhgd_Iot_discharge_Working); Restful.Post(url, senddata); } catch (Exception ex) { ToolAPI.XMLOperation.WriteLogXmlNoTail("卸料Put_work_cycles异常", ex.Message); } }
/// <summary> /// 构造 /// </summary> /// <param name="zhgd_Iot_discharge_Current"></param> //public static Zhgd_iot_discharge_working Get_Zhgd_iot_discharge_working(Zhgd_iot_discharge_current zhgd_Iot_discharge_Current) //{ // Zhgd_iot_discharge_working z = zhgd_Iot_discharge_Current as Zhgd_iot_discharge_working; // return z; //} public static Zhgd_iot_discharge_working Get_Zhgd_iot_discharge_working(Zhgd_iot_discharge_current parent) { Zhgd_iot_discharge_working child = new Zhgd_iot_discharge_working(); var ParentType = typeof(Zhgd_iot_discharge_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); }
public string Get_work_cycles_no(Zhgd_iot_discharge_current zhgd_Iot_discharge_Current) { //重量大于0就认为触发了工作循环得条件了 if (zhgd_Iot_discharge_Current.weight > 0) { if (zhgd_Iot_discharge_Current.is_warning == "Y") { is_work_cycles_warning = "Y"; foreach (string type in zhgd_Iot_discharge_Current.warning_type) { if (!work_cycles_warning_type.Contains(type)) { work_cycles_warning_type.Add(type); } } } if (work_cycles_no == "0") { work_cycles_no = DPC_Tool.GetTimeStamp().ToString(); } } //不满足工作循环得条件 else { //不等于0说明这次工作循环该结束了 if (work_cycles_no != "0") { //put运行数据到ES里 Zhgd_iot_discharge_working ztw = Zhgd_iot_discharge_working.Get_Zhgd_iot_discharge_working(zhgd_Iot_discharge_Current); ztw.work_cycles_warning = is_work_cycles_warning; ztw.work_cycles_no = work_cycles_no; ztw.warning_type = work_cycles_warning_type.ToArray(); //异步运行 Discharge_operation.Put_work_cycles_event.BeginInvoke(ztw, null, null); //进行初始化操作 work_cycles_no = "0"; is_work_cycles_warning = "N"; } } return(work_cycles_no); }