/// <summary> /// 判断接收波形数据是否完整 /// </summary> /// <param name="_WSWaveInfo"></param> /// <returns></returns> public static bool CheckDataIsFull(WSWaveInfo _WSWaveInfo) { bool isfull = true; lock (_WSWaveInfo) { //var list = _WSWaveInfo.ReceiveDataNumber.Where(obj => obj.ToString().Trim() == "0").ToList(); //if (list != null && list.Count > 0) //{ // isfull = false; //} if (_WSWaveInfo.WaveDescInfo == null) { return(false); } else if (_WSWaveInfo.WaveDescInfo.SamplingTime == null) { return(false); } for (int i = 1; i < _WSWaveInfo.ReceiveDataNumber.Length; i++) { if (_WSWaveInfo.ReceiveDataNumber[i] == 0) { isfull = false; break; } } } return(isfull); }
/// <summary> /// 检查波形数据集合中是否存在指定值的对象 /// </summary> /// <param name="list"></param> /// <param name="MAC"></param> /// <param name="WaveType"></param> /// <param name="index"></param> /// <returns></returns> public static bool CheckObjectInArray(List <WSWaveInfo> list, string MAC, EnumWaveType WaveType, ref int index) { List <WSWaveInfo> tempList = list.Where(p => p.MAC.ToString().ToUpper() == MAC.ToString().ToUpper() && p.WaveType == WaveType).ToList(); if (tempList != null && tempList.Count > 0) { WSWaveInfo waveInfo = tempList.FirstOrDefault(); index = list.IndexOf(waveInfo); } return(tempList.Count > 0); }
public void UploadVibrationWave(WSWaveInfo _WSWaveInfo, int waveLength) { string cacheData = string.Empty; System.Threading.Tasks.Task.Run(() => { try { if (iCMS.WG.Agent.ComFunction.IsExisted(iCMS.WG.Agent.ComFunction.CreateCacheData(_WSWaveInfo, (EnumCacheType)_WSWaveInfo.WaveType))) { iCMS.WG.Agent.Common.LogHelper.WriteLog(iCMS.WG.Agent.Common.Enum.EnumLogType.InvalidData.ToString(), "重复波形数据,MAC: " + _WSWaveInfo.MAC + " 类型:" + GetWaveTypeString.GetString((int)_WSWaveInfo.WaveType) + "采集时间:" + _WSWaveInfo.WaveDescInfo.SamplingTime); return; } VibrationWaveParamter uploadData = new VibrationWaveParamter(); uploadData.WSMAC = _WSWaveInfo.MAC.ToUpper(); uploadData.DAQStyle = _WSWaveInfo.WaveDescInfo.DAQStyle.ToString(); uploadData.SamplingTime = _WSWaveInfo.WaveDescInfo.SamplingTime; uploadData.SignalType = (int)_WSWaveInfo.WaveType; uploadData.WaveData = CalculateWaveData(_WSWaveInfo.WaveData, _WSWaveInfo.WaveDescInfo.AmplitueScaler, waveLength); uploadData.TranceformCofe = _WSWaveInfo.WaveDescInfo.AmplitueScaler; uploadData.WaveLength = waveLength / 2; if ((int)_WSWaveInfo.WaveType == 4) { uploadData.EnlvpBandWidth = _WSWaveInfo.WaveDescInfo.UpperLimit; //上限表示包络带宽 uploadData.EnlvpFilter = _WSWaveInfo.WaveDescInfo.LowerLimit; //下限表示滤波器 } else { uploadData.UpLimitFrequency = _WSWaveInfo.WaveDescInfo.UpperLimit; uploadData.LowLimitFrequency = _WSWaveInfo.WaveDescInfo.LowerLimit; } uploadData.PeakValue = _WSWaveInfo.WaveDescInfo.PK; uploadData.PeakPeakValue = _WSWaveInfo.WaveDescInfo.PPK; uploadData.EffValue = _WSWaveInfo.WaveDescInfo.RMS; uploadData.CarpetValue = _WSWaveInfo.WaveDescInfo.GPKC; cacheData = uploadData.ToClientString(); ComFunction.CreateRequest(EnumRequestType.UpLoadData, "UploadVibrationWave", cacheData); } catch (Exception ex) { iCMS.WG.Agent.Common.LogHelper.WriteLog(iCMS.WG.Agent.Common.Enum.EnumLogType.Error.ToString(), "iCMS.WG.Agent.CommunicationWithServer.UploadVibrationWave执行失败,异常:" + ex.Message + "\r\n详细:" + ex.StackTrace.ToString()); if (iCMS.WG.Agent.ComFunction.GetAppConfig("isCache").Trim() == "1") { iCMS.WG.Agent.Common.LogHelper.WriteLog(iCMS.WG.Agent.Common.Enum.EnumLogType.Cache.ToString(), "UploadVibrationWave # \r\n" + cacheData); } } }); }