/// <summary>
 /// put升降机运行数据
 /// </summary>
 /// <param name="zhgd_Iot_Tower_Working"></param>
 public static void Put_work_cycles(Zhgd_iot_lift_working zhgd_Iot_Lift_Working)
 {
     try
     {
         string url      = "https://111.56.13.177:52001/zhgd_iot-" + DateTime.Now.ToString("yyyyMMdd") + "/_doc/";
         string senddata = JsonConvert.SerializeObject(zhgd_Iot_Lift_Working);
         Restful.Post(url, senddata);
     }
     catch (Exception ex)
     {
         ToolAPI.XMLOperation.WriteLogXmlNoTail("升降机Put_work_cycles异常", ex.Message);
     }
 }
Пример #2
0
        /// <summary>
        /// 构造
        /// </summary>
        /// <param name="zhgd_Iot_Lift_Current"></param>
        //public static Zhgd_iot_lift_working Get_Zhgd_iot_lift_working(Zhgd_iot_lift_current zhgd_Iot_Lift_Current)
        //{
        //    Zhgd_iot_lift_working z = zhgd_Iot_Lift_Current as Zhgd_iot_lift_working;
        //    return z;
        //}

        public static Zhgd_iot_lift_working Get_Zhgd_iot_lift_working(Zhgd_iot_lift_current parent)
        {
            Zhgd_iot_lift_working child = new Zhgd_iot_lift_working();
            var ParentType = typeof(Zhgd_iot_lift_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);
        }
Пример #3
0
 public string Get_work_cycles_no(Zhgd_iot_lift_current zhgd_Iot_Lift_Current)
 {
     //速度大于0就认为触发了工作循环得条件了
     if (zhgd_Iot_Lift_Current.speed > 0)
     {
         if (zhgd_Iot_Lift_Current.is_warning == "Y")
         {
             is_work_cycles_warning = "Y";
             foreach (string type in zhgd_Iot_Lift_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_lift_working ztw = Zhgd_iot_lift_working.Get_Zhgd_iot_lift_working(zhgd_Iot_Lift_Current);
             ztw.work_cycles_warning = is_work_cycles_warning;
             ztw.work_cycles_no      = work_cycles_no;
             ztw.warning_type        = work_cycles_warning_type.ToArray();
             //异步运行
             Lift_operation.Put_work_cycles_event.BeginInvoke(ztw, null, null);
             //进行初始化操作
             work_cycles_no         = "0";
             is_work_cycles_warning = "N";
         }
     }
     return(work_cycles_no);
 }