コード例 #1
0
        /// <summary>
        /// 进行数据发送
        /// </summary>
        /// <returns></returns>
        public static void Send_personnel_records(Zhgd_iot_personnel_records zhgd_Iot_Personnel_Records)
        {
            try
            {
                //获取redis中的项目
                string key = "equipment:projectid:" + Equipment_type.人员管理 + ":" + zhgd_Iot_Personnel_Records.project_code;
                string value = RedisCacheHelper.Get<string>(key);
                if (value != null)
                {
                    zhgd_Iot_Personnel_Records.create_time = DPC_Tool.GetTimeStamp();
                    zhgd_Iot_Personnel_Records.project_id = value;
                    zhgd_Iot_Personnel_Records.equipment_type = Equipment_type.人员管理;

                    //先执行rabbitMQ 进行推送
                    RabbitMQ.producer("Personnel_forward", JsonConvert.SerializeObject(zhgd_Iot_Personnel_Records));

                    //执行put方法,把实时数据推走
                    Put_Send_personnel_records(zhgd_Iot_Personnel_Records);
                }
            }
            catch (Exception ex)
            {
                ToolAPI.XMLOperation.WriteLogXmlNoTail("人员管理Send_personnel_records异常", ex.Message);
            }
        }
コード例 #2
0
 /// <summary>
 /// 进行数据发送
 /// </summary>
 /// <param name="sn">设备序列码</param>
 /// <returns></returns>
 public static void Send_discharge_Current(Zhgd_iot_discharge_current zhgd_Iot_discharge_Current)
 {
     try
     {
         //获取redis中的项目
         string key   = "equipment:projectid:" + Equipment_type.卸料平台 + ":" + zhgd_Iot_discharge_Current.sn;
         string value = RedisCacheHelper.Get <string>(key);
         if (value != null)
         {
             zhgd_Iot_discharge_Current.create_time    = DPC_Tool.GetTimeStamp();
             zhgd_Iot_discharge_Current.project_id     = value;
             zhgd_Iot_discharge_Current.equipment_type = Equipment_type.卸料平台;
             //这里面应该还有工作运行的判断以及运行序列码得赋值
             if (working_state.ContainsKey(zhgd_Iot_discharge_Current.sn))
             {
                 zhgd_Iot_discharge_Current.work_cycles_no = working_state[zhgd_Iot_discharge_Current.sn].Get_work_cycles_no(zhgd_Iot_discharge_Current);
             }
             else
             {
                 working_state.Add(zhgd_Iot_discharge_Current.sn, new Zhgd_iot_discharge_working_state(zhgd_Iot_discharge_Current.sn));
                 zhgd_Iot_discharge_Current.work_cycles_no = working_state[zhgd_Iot_discharge_Current.sn].Get_work_cycles_no(zhgd_Iot_discharge_Current);
             }
             //先执行rabbitMQ 进行推送
             RabbitMQ.producer("Discharge_forward", JsonConvert.SerializeObject(zhgd_Iot_discharge_Current));
             //执行put方法,把实时数据推走
             Put_discharge_current(zhgd_Iot_discharge_Current);
             //更新redis
             DPC.Discharge_operation.Update_equminet_last_online_time(zhgd_Iot_discharge_Current.sn, zhgd_Iot_discharge_Current.timestamp);
         }
     }
     catch (Exception ex)
     {
         ToolAPI.XMLOperation.WriteLogXmlNoTail("卸料Send_discharge_Current异常", ex.Message);
     }
 }
コード例 #3
0
        /// <summary>
        /// 进行数据发送
        /// </summary>
        /// <param name="sn">设备序列码</param>
        /// <returns></returns>
        public static void Send_dust_noise_Current(Zhgd_iot_dust_noise_current zhgd_Iot_dust_noise_Current)
        {
            try
            {
                //获取redis中的项目
                string key   = "equipment:projectid:" + Equipment_type.扬尘噪音 + ":" + zhgd_Iot_dust_noise_Current.sn;
                string value = RedisCacheHelper.Get <string>(key);
                if (value != null)
                {
                    string[] item = value.Split('&');
                    zhgd_Iot_dust_noise_Current.create_time    = DPC_Tool.GetTimeStamp();
                    zhgd_Iot_dust_noise_Current.project_id     = item[0];
                    zhgd_Iot_dust_noise_Current.equipment_type = Equipment_type.扬尘噪音;
                    //报警判断
                    zhgd_Iot_dust_noise_Current.is_warning = "N";
                    List <string> vs = new List <string>();
                    if (zhgd_Iot_dust_noise_Current.pm2_5 > double.Parse(item[1]))
                    {
                        vs.Add(Warning_type.PM2_5报警);
                        zhgd_Iot_dust_noise_Current.is_warning = "Y";
                    }
                    if (zhgd_Iot_dust_noise_Current.pm10 > double.Parse(item[2]))
                    {
                        vs.Add(Warning_type.PM10报警);
                        zhgd_Iot_dust_noise_Current.is_warning = "Y";
                    }
                    if (zhgd_Iot_dust_noise_Current.noise > double.Parse(item[3]))
                    {
                        vs.Add(Warning_type.噪音告警);
                        zhgd_Iot_dust_noise_Current.is_warning = "Y";
                    }
                    zhgd_Iot_dust_noise_Current.warning_type = vs.ToArray();
                    //进行AQI计算
                    zhgd_Iot_dust_noise_Current.aqi = Get_aqi(zhgd_Iot_dust_noise_Current.pm2_5);

                    //先执行rabbitMQ 进行推送
                    RabbitMQ.producer("Dust_noise_forward", JsonConvert.SerializeObject(zhgd_Iot_dust_noise_Current));
                    //执行put方法,把实时数据推走
                    Put_dust_noise_current(zhgd_Iot_dust_noise_Current);
                    //更新在线时间
                    Update_equminet_last_online_time(zhgd_Iot_dust_noise_Current.sn, zhgd_Iot_dust_noise_Current.timestamp);
                }
            }
            catch (Exception ex)
            {
                ToolAPI.XMLOperation.WriteLogXmlNoTail("扬尘噪音Send_dust_noise_Current异常", ex.Message);
            }
        }