コード例 #1
0
        public string GetCompanyMonitorDatas(RequestData data)
        {
            string pkID      = data.Get("PKID").Trim();
            string type      = data.Get("type").Trim(); //排口种类(1-废气、2-废水、3-VOCs)
            string dataClass = "GasItem,WaterItem,VOCsItem";
            //if (string.IsNullOrEmpty(pkID) || string.IsNullOrEmpty(type))
            //{
            //    return "";
            //}
            //if (type == "1")
            //{
            //    dataClass = "GasItem";
            //}
            //else if (type == "2")
            //{
            //    dataClass = "WaterItem";
            //}
            //else if (type == "3")
            //{
            //    dataClass = "VOCsItem";
            //}

            var monitorDatas = MonitorData.GetMonitorData("", DateTime.Now.AddDays(-1), DateTime.Now, "C", pkID, "hour", dataClass);

            monitorDatas.DefaultView.Sort = "DATA_TIME desc";
            monitorDatas = monitorDatas.DefaultView.ToTable();
            return(monitorDatas.ToJson());
        }
コード例 #2
0
        /// <summary>
        /// 计算监测数据的平均平均值
        /// </summary>
        /// <param name="type"></param>
        /// <param name="id"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="compamyType"></param>
        /// <returns></returns>
        public Dictionary <string, decimal> MonitorAvgData(string type, string id, DateTime startTime, DateTime endTime, string compamyType, string dataType)
        {
            /*
             * 1.获取监测数据
             * 2.去掉不需要的不需要统计的列,这里只是统计排放量
             * 3.将列名和均值保存在字典中
             */
            string dataClass = "1" == compamyType?string.Join(",", MonitorData.POLLUTION_MONITOR_ITEM_TYPE) : string.Join(",", MonitorData.VOCS_MONITOR_ITEM_TYPE);

            DataTable monitorData            = MonitorData.GetMonitorData("002", startTime, endTime, type, id, dataType, dataClass);
            DataTable exchangeTable          = ColumnNameExchange(type, id, compamyType, monitorData);
            Dictionary <string, decimal> dic = new Dictionary <string, decimal>();
            List <dynamic> data = exchangeTable.ToDynamicList();

            for (int i = 0; i < exchangeTable.Columns.Count; i++)
            {
                DataColumn column = exchangeTable.Columns[i];
                if ("DATA_TIME" == column.ColumnName)
                {
                    continue;
                }
                decimal?avgData = data.Average(item => {
                    if (item[column.ColumnName] is DBNull)
                    {
                        return(null);
                    }
                    decimal temp = StringHelper.DynamicToDecimal(item[column.ColumnName]);
                    return(temp);
                });
                dic.Add(column.ColumnName, Math.Round(avgData.HasValue?avgData.Value:0, 2));
            }
            return(dic);
        }
コード例 #3
0
ファイル: AirYear.aspx.cs プロジェクト: lwcdi/Test
        protected override void BandingReport()
        {
            //定义报表参数对象
            List <ReportParameter>      parameterList = new List <ReportParameter>();
            Dictionary <string, string> paramDic      = RdlcParam();

            foreach (var key in paramDic.Keys)
            {
                parameterList.Add(new ReportParameter(key, paramDic[key]));
            }
            parameterList.Add(new ReportParameter("PollutionName", PollutionName));
            parameterList.Add(new ReportParameter("PollutionNo", PollutionNo));

            string ReportPath = "Areas\\Report\\Template\\AirYear.rdlc";

            ReportViewer1.LocalReport.ReportPath             = ReportPath;
            ReportViewer1.LocalReport.ReportEmbeddedResource = "Tablix1";
            ReportViewer1.LocalReport.SetParameters(parameterList);
            DataTable table = MonitorData.GetMonitorDataForReportAir(Request.QueryString["dataFrom"], startTime, endTime, Request.QueryString["type"], Request.QueryString["id"], "month");

            DataHandle.TableDataStyle(table, "DATA_TIME", Request.QueryString["rdlcType"]);
            ReportDataSource rds = new ReportDataSource("AirHour", table); //指定数据源GetTestDataTable()

            ReportViewer1.LocalReport.DataSources.Clear();                 //报表数据源清除,必须
            ReportViewer1.LocalReport.DataSources.Add(rds);                //报表数据源增加
            ReportViewer1.LocalReport.Refresh();                           //刷新报表
        }
コード例 #4
0
ファイル: PingHanReport.cs プロジェクト: icprog/FS-SMISCloud
        /// <summary>
        /// 填充测量值的整数部分和小数部分
        /// </summary>
        /// <param name="data"></param>
        /// <param name="rowIndex"></param>
        /// <param name="columnIndex"></param>
        public static void FillDataCrackReport(Worksheet sheet, MonitorData data, decimal?len0, int rowIndex, int columnIndex)
        {
            bool flag = false;

            if (data.Data != null)
            {
                if (data.Data[0].Values.Any())
                {
                    var data1 = (len0 * 1000 - data.Data[0].Values[0]) / 1000;
                    var data2 = (len0 * 1000 - data.Data[0].Values[0]) % 1000;

                    sheet.Cells[rowIndex, columnIndex].PutValue(Math.Floor(Convert.ToDecimal(data1)));
                    sheet.Cells[rowIndex, columnIndex + 1].PutValue(Convert.ToDecimal(Convert.ToDecimal(data2).ToString("#0")));
                }
                else
                {
                    flag = true;
                }
            }
            else
            {
                flag = true;
            }
            if (flag)
            {
                sheet.Cells[rowIndex, columnIndex].PutValue("/");
                sheet.Cells[rowIndex, columnIndex + 1].PutValue("/");
            }
        }
コード例 #5
0
ファイル: VocsDay.aspx.cs プロジェクト: lwcdi/Test
        protected override void BandingReport()
        {
            //定义报表参数对象
            List <ReportParameter> parameterList = new List <ReportParameter>();
            var paramDic = RdlcParam(Request.QueryString["rdlcType"]);

            foreach (var key in paramDic.Keys)
            {
                parameterList.Add(new ReportParameter(key, paramDic[key]));
            }
            dynamic companyInfo = BaseCommonInfo.GetCompanyOrPK(Request.QueryString["type"], Request.QueryString["id"]);

            parameterList.Add(new ReportParameter("PollutionName", companyInfo.Name));
            parameterList.Add(new ReportParameter("PollutionNo", companyInfo.Code));


            string ReportPath = "Areas\\Report\\Template\\VocsHour.rdlc";

            ReportViewer1.LocalReport.ReportPath             = ReportPath;
            ReportViewer1.LocalReport.ReportEmbeddedResource = "Tablix1";
            ReportViewer1.LocalReport.SetParameters(parameterList);

            DataTable table = MonitorData.GetMonitorDataForReportVocs(Request.QueryString["dataFrom"], startTime, endTime, Request.QueryString["type"], Request.QueryString["id"], dataType);

            DataHandle.TableDataStyle(table, "DATA_TIME", Request.QueryString["rdlcType"]);
            ReportDataSource rds = new ReportDataSource("VocsMonitor", table); //指定数据源GetTestDataTable()

            ReportViewer1.LocalReport.DataSources.Clear();                     //报表数据源清除,必须
            ReportViewer1.LocalReport.DataSources.Add(rds);                    //报表数据源增加
            ReportViewer1.LocalReport.Refresh();                               //刷新报表
        }
コード例 #6
0
ファイル: Equipment.cs プロジェクト: marlonnn/CII.HV
        /// <summary>
        /// 读取监控数据
        /// </summary>
        public void GetMonitorData()
        {
            List <byte> alarmCode = new List <byte>();

            try
            {
                MonitorData = this.MthData.GetMonitorData();
                this.EquipmentConnectFailedCount = 0;
                //alarmCode.Add(MonitorData.AlarmCode);
            }
            catch (Exception ex)
            {
                this.EquipmentConnectFailedCount++;
                if (this.EquipmentConnectFailedCount >= GlobalConfig.EquipmentConnectFailedMaxCount)
                {
                    MonitorData = null;
                    //网络通信故障
                    alarmCode.Insert(0, 0xff);
                }
                else
                {
                    Entry.LAR.Entry.LogDebug(string.Format("Equipment connect failed, count={0}", this.EquipmentConnectFailedCount));
                }
            }
            CheckAlarm(alarmCode.ToArray());
        }
コード例 #7
0
ファイル: PollutionEffective.aspx.cs プロジェクト: lwcdi/Test
        private void BandingReport()
        {
            List <string> pkIDList = SerializerHelper.Deserialize <List <string> >(Request.QueryString["PK_ID"]);
            DateTime      startTime;
            DateTime      endTime;

            MonitorData.QuarterlyTime(int.Parse(Request.QueryString["timeRangYear"]), int.Parse(Request.QueryString["timeRangQuarter"]), out startTime, out endTime);

            //定义报表参数对象
            List <ReportParameter> parameterList = new List <ReportParameter>();
            var paramDic = RdlcParam();

            foreach (var key in paramDic.Keys)
            {
                parameterList.Add(new ReportParameter(key, paramDic[key]));
            }
            string ReportPath = "Areas\\Report\\Template\\DataEffective.rdlc";

            ReportViewer1.LocalReport.ReportPath             = ReportPath;
            ReportViewer1.LocalReport.ReportEmbeddedResource = "Tablix1";
            ReportViewer1.LocalReport.SetParameters(parameterList);

            DataTable        table = MonitorData.PK_PollutionEffectiveData(pkIDList, startTime, endTime);
            ReportDataSource rds   = new ReportDataSource("EffectiveData", table); //指定数据源GetTestDataTable()

            ReportViewer1.LocalReport.DataSources.Clear();                         //报表数据源清除,必须
            ReportViewer1.LocalReport.DataSources.Add(rds);                        //报表数据源增加
            ReportViewer1.LocalReport.Refresh();                                   //刷新报表
        }
コード例 #8
0
        private static void CommitMonitorData()
        {
            if (PerformanceMonitorHelper.ExistsMonitor(MonitorName))
            {
                MonitorData md = PerformanceMonitorHelper.GetMonitor("WfServerContextInvoker");

                md.Stopwatch.Stop();

                if (md.EnableLogging)
                {
                    md.LogWriter.WriteLine("请求{0}的结束时间: {1:yyyy-MM-dd HH:mm:ss.fff},经过{2:#,##0}毫秒",
                                           md.MonitorName, SNTPClient.AdjustedTime, md.Stopwatch.ElapsedMilliseconds);

                    CommitLogging(md);
                }

                if (md.EnablePFCounter)
                {
                    SetCountersValues(md, md.HasErrors);
                }

                PerformanceMonitorHelper.RemoveMonitor(MonitorName);
                PerformanceMonitorHelper.DefaultMonitorName = "DefaultMonitor";
            }
        }
コード例 #9
0
ファイル: MoveMap.cs プロジェクト: ebihane/KalsKun
        /// <summary>
        /// モニタ表示色取得
        /// </summary>
        /// <param name="x">対象位置 X 座標</param>
        /// <param name="y">対象位置 Y 座標</param>
        /// <returns>表示色</returns>
        public override Color GetColor(int x, int y)
        {
            Color       retVal  = Color.DarkGray;
            MonitorData monitor = MonitorData.GetInstance();
            byte        value   = this.Map[y][x];

            if ((x == monitor.Motor.PointX.Value) &&
                (y == monitor.Motor.PointY.Value))
            {
                retVal = Color.Orange;
            }
            else if (value == m_NotMoveValue)
            {
                retVal = Color.LightGreen;
            }
            else if (value == m_MovedValue)
            {
                retVal = Color.Khaki;
            }
            else if (value == MapValues.MoveFailedNo)
            {
                retVal = Color.Gray;
            }
            else
            {
                retVal = Color.DarkGray;
            }

            return(retVal);
        }
コード例 #10
0
        /// <summary>
        /// 封装监控数据
        /// </summary>
        /// <returns>封装后的字符串</returns>
        private static string PackingMonitorData()
        {
            ReturnMessageFormat returnData = new ReturnMessageFormat();

            try
            {
                MonitorData data = new MonitorData();
                data.cpu = totalCpuPercent;
                data.memory_available = availableMemory;
                data.memory_total     = totalMemory;
                data.memory_used      = Math.Round(totalMemory - availableMemory, 1);
                data.net_up           = totalUploadSpeed;
                data.net_down         = totalDownloadSpeed;
                data.processes        = processesFormat;

                returnData.data    = data;
                returnData.message = "";
                returnData.status  = Order.success;
            }
            catch (Exception)
            {
                returnData.data    = null;
                returnData.message = "cannot get data";
                returnData.status  = Order.failure;
            }

            return(JsonHelper.SerializeObject(returnData));
        }
コード例 #11
0
        private void context_BeginRequestExecute(object sender, EventArgs e)
        {
            if (PageMonitorSettings.GetConfig().Enabled)
            {
                PageMonitorElement pme = PageMonitorSettings.GetConfig().Pages.GetMatchedElement();

                if (pme != null)
                {
                    MonitorData md = PerformanceMonitorHelper.StartMonitor(PageMonitorModule.MonitorDataKey);

                    md.EnableLogging   = pme.EnableLogging;
                    md.EnablePFCounter = pme.EnablePFCounter;
                    md.MonitorName     = pme.Name;

                    if (string.IsNullOrEmpty(pme.CounterInstanceName))
                    {
                        md.InstanceName = pme.Name;
                    }
                    else
                    {
                        md.InstanceName = pme.CounterInstanceName;
                    }

                    PerformanceMonitorHelper.DefaultMonitorName = PageMonitorModule.MonitorDataKey;

                    if (pme.EnableLogging)
                    {
                        md.LogWriter.WriteLine("请求{0}的开始时间: {1:yyyy-MM-dd HH:mm:ss.fff}", md.MonitorName, SNTPClient.AdjustedTime);
                    }
                }
            }
        }
コード例 #12
0
        public string getDataInfo(RequestData data)
        {
            var    table = MonitorData.GetMonitorData("", DateTime.Parse(Request.QueryString["startTime"]), DateTime.Parse(Request.QueryString["endTime"]), "C", Request.QueryString["Companyid"], Request.QueryString["selectData"], "GasItem,WaterItem");
            string d     = DataTableToJson(table);

            return(DataTableToJson(table));
        }
コード例 #13
0
ファイル: LARCommandHelper.cs プロジェクト: marlonnn/CII.HV
        /// <summary>
        /// 0x40读取监控数据
        /// </summary>
        /// <returns></returns>
        public MonitorData GetMonitorData()
        {
            try
            {
                MonitorData data = new MonitorData();

                SendCommand sendCmd40 = new SendCommand(CommandId.SystemMonitor, CommandExtendId.Read);
                RecvCommand recvCmd40 = (RecvCommand)PortManager.GetInstance().Send(InsName, sendCmd40);
                CheckRecvCommand(recvCmd40);
                if (recvCmd40 != null)
                {
                    data.Motor1Switch        = recvCmd40.GetByte(ParamId.SystemMonitor_ReadResponse_Motor1Status);
                    data.Motor1Status        = recvCmd40.GetByte(ParamId.SystemMonitor_ReadResponse_Motor1Result);
                    data.Motor1completeSteps = (int)recvCmd40.GetULong(ParamId.SystemMonitor_ReadResponse_Motor1CompleteSteps);
                    data.Motor1Steps         = (int)recvCmd40.GetULong(ParamId.SystemMonitor_ReadResponse_Motor1SumSteps);

                    data.Motor2Switch        = recvCmd40.GetByte(ParamId.SystemMonitor_ReadResponse_Motor2Status);
                    data.Motor2Status        = recvCmd40.GetByte(ParamId.SystemMonitor_ReadResponse_Motor2Result);
                    data.Motor2completeSteps = (int)recvCmd40.GetULong(ParamId.SystemMonitor_ReadResponse_Motor2CompleteSteps);
                    data.Motor2Steps         = (int)recvCmd40.GetULong(ParamId.SystemMonitor_ReadResponse_Motor2SumSteps);
                    return(data);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
コード例 #14
0
 public MonitorDataModel(MonitorData model)
 {
     this._result           = model.Result;
     this._objectID         = model.ObjectID;
     this._monitorTimestamp = model.Timestamp;
     this._agentID          = model.AgentNr;
 }
コード例 #15
0
        /// <summary>
        /// 将监测数据读入到数据集合
        /// </summary>
        /// <param name="sqlStr"> sql语句 </param>
        /// <param name="data"> 数据集合 </param>
        /// <param name="config">配置</param>
        private void GetValueFromDB(string sqlStr, IList <MonitorData> data, FactorConfig config)
        {
            MonitorData temp;
            DataTable   dt = SqlHelper.ExecuteDataSetText(sqlStr, null).Tables[0];

            foreach (DataRow row in dt.Rows)
            {
                temp                 = new MonitorData();
                temp.SensorId        = Convert.ToInt32(row[0]);
                temp.AcquisitionTime = Convert.ToDateTime(row[1]);
                temp.Location        = Convert.ToString(row[2]);

                temp.Values = new decimal?[row.ItemArray.Length - 3];
                for (int i = 3; i < row.ItemArray.Length; i++)
                {
                    if (row[i] != DBNull.Value)
                    {
                        temp.Values[i - 3] =
                            Convert.ToDecimal(Convert.ToDecimal(row[i]).ToString("f" + config.DecimalPlaces[i - 3]));
                    }
                }

                temp.Columns = config.Display;
                temp.Unit    = config.Unit;
                data.Add(temp);
            }
        }
コード例 #16
0
        protected override void BandingReport()
        {
            //定义报表参数对象
            List <ReportParameter> parameterList = new List <ReportParameter>();
            var paramDic = RdlcParam(Request.QueryString["rdlcType"]);

            foreach (var key in paramDic.Keys)
            {
                parameterList.Add(new ReportParameter(key, paramDic[key]));
            }
            string ReportPath = "Areas\\Report\\Template\\PollutionCompanyWarn.rdlc";

            ReportViewer1.LocalReport.ReportPath             = ReportPath;
            ReportViewer1.LocalReport.ReportEmbeddedResource = "Tablix1";
            ReportViewer1.LocalReport.SetParameters(parameterList);

            DataTable table = MonitorData.GetPollutionWarnData(startTime, endTime, Request.QueryString["type"], Request.QueryString["id"], dataType);

            DataHandle.TableDataStyle(table, "DATA_TIME", Request.QueryString["rdlcType"]);
            ReportDataSource rds = new ReportDataSource("PollutionCompanyWarn", table); //指定数据源GetTestDataTable()

            ReportViewer1.LocalReport.DataSources.Clear();                              //报表数据源清除,必须
            ReportViewer1.LocalReport.DataSources.Add(rds);                             //报表数据源增加
            ReportViewer1.LocalReport.Refresh();                                        //刷新报表
        }
コード例 #17
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (Class != null)
                {
                    hashCode = hashCode * 59 + Class.GetHashCode();
                }
                if (DisplayName != null)
                {
                    hashCode = hashCode * 59 + DisplayName.GetHashCode();
                }
                if (Executors != null)
                {
                    hashCode = hashCode * 59 + Executors.GetHashCode();
                }
                if (Icon != null)
                {
                    hashCode = hashCode * 59 + Icon.GetHashCode();
                }
                if (IconClassName != null)
                {
                    hashCode = hashCode * 59 + IconClassName.GetHashCode();
                }

                hashCode = hashCode * 59 + Idle.GetHashCode();

                hashCode = hashCode * 59 + JnlpAgent.GetHashCode();

                hashCode = hashCode * 59 + LaunchSupported.GetHashCode();
                if (LoadStatistics != null)
                {
                    hashCode = hashCode * 59 + LoadStatistics.GetHashCode();
                }

                hashCode = hashCode * 59 + ManualLaunchAllowed.GetHashCode();
                if (MonitorData != null)
                {
                    hashCode = hashCode * 59 + MonitorData.GetHashCode();
                }

                hashCode = hashCode * 59 + NumExecutors.GetHashCode();

                hashCode = hashCode * 59 + Offline.GetHashCode();
                if (OfflineCause != null)
                {
                    hashCode = hashCode * 59 + OfflineCause.GetHashCode();
                }
                if (OfflineCauseReason != null)
                {
                    hashCode = hashCode * 59 + OfflineCauseReason.GetHashCode();
                }

                hashCode = hashCode * 59 + TemporarilyOffline.GetHashCode();
                return(hashCode);
            }
        }
コード例 #18
0
 /// <summary>
 /// 数据验证
 /// </summary>
 /// <param name="data">The data.</param>
 public static void DataProcess(MonitorData data)
 {
     if (GSetting.PortMapDict.ContainsKey(data.PortNO))
     {
         // 进一步数据处理
         GSetting.PortMapDict[data.PortNO].DatagramProcess(data);
     }
 }
コード例 #19
0
        private static void SetCountersValues(MonitorData md, bool hasErrors)
        {
            WebMethodServerCounters global   = (WebMethodServerCounters)md.Context["GlobalInstance"];
            WebMethodServerCounters instance = (WebMethodServerCounters)md.Context["Instance"];

            SetOnePFInstanceValues(global, md, hasErrors);
            SetOnePFInstanceValues(instance, md, hasErrors);
        }
コード例 #20
0
        /// <summary>
        /// 获取企业或排口的监测数据
        /// </summary>
        /// <param name="type">P:排口 C:企业</param>
        /// <param name="id"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="compamyType">1:污染源 2:VOCs</param>
        ///  <param name="dataType">hour:小时 day:日</param>
        /// <returns></returns>
        public DataTable BaseMonitorData(string type, string id, DateTime startTime, DateTime endTime, string compamyType, string dataType)
        {
            string dataClass = "1" == compamyType?string.Join(",", MonitorData.POLLUTION_MONITOR_ITEM_TYPE) : string.Join(",", MonitorData.VOCS_MONITOR_ITEM_TYPE);

            DataTable monitorData = MonitorData.GetMonitorData("002", startTime, endTime, type, id, dataType, dataClass);

            return(ColumnNameExchange(type, id, compamyType, monitorData));
        }
コード例 #21
0
        private MonitorData GetMonitorData(IntPtr monitorHandle)
        {
            var monitorData = new MonitorData();

            monitorData.Size = Marshal.SizeOf(monitorData);
            GetMonitorInfoEx(monitorHandle, ref monitorData);

            return(monitorData);
        }
コード例 #22
0
        private object InvokeWithMonitor(object instance, object[] inputs, out object[] outputs)
        {
            ServiceMethodConfigurationElement methodElement = ServiceSettings.GetConfig().GetMethodElementByOperationContext();

            object[] result = null;

            if (methodElement != null)
            {
                PerformanceMonitorHelper.DefaultMonitorName = MonitorName;
                MonitorData md = PerformanceMonitorHelper.StartMonitor(MonitorName);

                md.MonitorName     = string.Format("{0}.{1}", OperationContext.Current.GetContractName(), OperationContext.Current.GetMethodName());
                md.EnableLogging   = methodElement.EnableLogging;
                md.EnablePFCounter = methodElement.EnablePFCounter;

                md.InstanceName = md.MonitorName;
                md.Context["GlobalInstance"] = new WebMethodServerCounters("_Total_");
                md.Context["Instance"]       = new WebMethodServerCounters(md.InstanceName);

                if (md.EnableLogging)
                {
                    md.LogWriter.WriteLine("请求{0}的开始时间: {1:yyyy-MM-dd HH:mm:ss.fff}", md.MonitorName, SNTPClient.AdjustedTime);
                }

                try
                {
                    PerformanceMonitorHelper.GetDefaultMonitor().WriteExecutionDuration(md.MonitorName,
                                                                                        () =>
                    {
                        result = this.InternalInvoke(instance, inputs);
                    });
                }
                catch (System.Exception ex)
                {
                    md.HasErrors = true;

                    if (md.EnableLogging)
                    {
                        ex.WriteToEventLog(md.MonitorName, EventLogEntryType.Error, 8010);
                    }

                    throw;
                }
                finally
                {
                    CommitMonitorData();
                }
            }
            else
            {
                result = this.InternalInvoke(instance, inputs);
            }

            outputs = (object[])result[1];

            return(result[0]);
        }
コード例 #23
0
        private void context_Error(object sender, EventArgs e)
        {
            if (PerformanceMonitorHelper.ExistsMonitor(PageMonitorModule.MonitorDataKey))
            {
                MonitorData md = PerformanceMonitorHelper.GetMonitor(PageMonitorModule.MonitorDataKey);

                md.HasErrors = true;
            }
        }
コード例 #24
0
        public string GetZDGZCompanyMonitorData(RequestData data)
        {
            var    whereCompany = T_BASE_COMPANY.ISDEL == "0" & T_BASE_COMPANY.ISVOCS == "1" & T_BASE_COMPANY.GZCD.In("'1', '2'");
            var    lstID        = GetCompanyIDs(whereCompany);
            string strIDs       = string.Join(",", lstID);
            //GasItem:废气、WaterItem:废水、VOC:VOCsItem,多种类型可以使用逗号分隔传入 HX w01018_PFL_Value AD w21003_PFL_Value
            //var lstMonitorData = AnalysisData2.GetAreaMonitorData("", DateTime.Now.AddHours(-DateTime.Now.Hour - 1), DateTime.Now, "hour", "VOCsItem");
            var dtMonitorData = MonitorData.GetMonitorData("", DateTime.Now.AddHours(-DateTime.Now.Hour - 1), DateTime.Now, "C", strIDs, "hour", "VOCsItem");

            Dictionary <string, List <string> > dicReturn = new Dictionary <string, List <string> >();
            List <string> lstCompany = new List <string>();
            List <string> lstZJ      = new List <string>();
            List <string> lstBen     = new List <string>();
            List <string> lstJBen    = new List <string>();
            List <string> lstJBen2   = new List <string>();

            for (int i = 0; i < lstID.Count; i++)
            {
                string  name  = "";
                decimal ZJ    = 0;
                decimal Ben   = 0;
                decimal JBen  = 0;
                decimal JBen2 = 0;

                dtMonitorData.Select(string.Format("ID = '{0}'", lstID[i])).Each(dataRow => {
                    name             = dataRow["NAME"].ToString().Trim();
                    decimal tmpZJ    = 0;
                    decimal tmpBen   = 0;
                    decimal tmpJBen  = 0;
                    decimal tmpJBen2 = 0;
                    decimal.TryParse(dataRow["a24088_PFL_Value"].ToString().Trim(), out tmpZJ);
                    decimal.TryParse(dataRow["a25002_PFL_Value"].ToString().Trim(), out tmpBen);
                    decimal.TryParse(dataRow["a25003_PFL_Value"].ToString().Trim(), out tmpJBen);
                    decimal.TryParse(dataRow["a25005_PFL_Value"].ToString().Trim(), out tmpJBen2);
                    ZJ    += tmpZJ;
                    Ben   += tmpBen;
                    JBen  += tmpJBen;
                    JBen2 += tmpJBen2;
                });
                if (!string.IsNullOrEmpty(name))
                {
                    lstCompany.Add(name);
                    lstZJ.Add(ZJ.ToString());
                    lstBen.Add(Ben.ToString());
                    lstJBen.Add(JBen.ToString());
                    lstJBen2.Add(JBen2.ToString());
                }
            }
            dicReturn.Add("area", lstCompany);
            dicReturn.Add("ZJ", lstZJ);
            dicReturn.Add("Ben", lstBen);
            dicReturn.Add("JBen", lstJBen);
            dicReturn.Add("JBen2", lstJBen2);
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            return(serializer.Serialize(dicReturn));
        }
コード例 #25
0
        public string GetPKMonitorDatas(RequestData data)
        {
            string pkID      = data.Get("PKID").Trim();
            string type      = data.Get("type").Trim(); //排口种类(1-废气、2-废水、3-VOCs)
            string dataClass = string.Empty;

            if (string.IsNullOrEmpty(pkID) || string.IsNullOrEmpty(type))
            {
                return("");
            }
            if (type == "1")
            {
                dataClass = "GasItem";
            }
            else if (type == "2")
            {
                dataClass = "WaterItem";
            }
            else if (type == "3")
            {
                dataClass = "VOCsItem";
            }
            //var where = T_BASE_COMPANY_PK.COMPANYID == pkID;

            //var dtPoints = SqlModel.Select(T_BASE_COMPANY_PK.ID.As("PKID"), T_BASE_COMPANY_PK.NAME.As("PKNAME"), T_BASE_COMPANY_PK.TYPE.As("TYPE"), T_BASE_COMPANY_PK.COMPANYID.As("COMPANYID"))
            //    .From(DB.T_BASE_COMPANY_PK)
            //    .Where(where)
            //    .ExecToDataTable();

            //Dictionary<string, List<GpsPointData>> dicReturn = new Dictionary<string, List<GpsPointData>>();
            //List<GpsPointData> lstPointInfoList = new List<GpsPointData>();
            //if (dtPoints != null && dtPoints.Rows.Count > 0)
            //{
            //    for (int i = 0; i < dtPoints.Rows.Count; i++)
            //    {
            //        if (!string.IsNullOrEmpty(dtPoints.Rows[i]["latitude"].ToString().Trim()) && !string.IsNullOrEmpty(dtPoints.Rows[i]["latitude"].ToString().Trim()))
            //        {
            //            GpsPointData pointData = new GpsPointData();
            //            pointData.ID = dtPoints.Rows[i]["ID"].ToString().Trim();
            //            pointData.NAME = dtPoints.Rows[i]["NAME"].ToString().Trim();
            //            pointData.LATITUDE = dtPoints.Rows[i]["latitude"].ToString().Trim();
            //            pointData.LONGITUDE = dtPoints.Rows[i]["longitude"].ToString().Trim();
            //            pointData.NUMBER = (12 * i).ToString();
            //            pointData.STATUS = "1";
            //            lstPointInfoList.Add(pointData);
            //        }
            //    }
            //}
            //dicReturn.Add("allCompanyGPSDatas", lstPointInfoList);
            //JavaScriptSerializer serializer = new JavaScriptSerializer();
            var monitorDatas = MonitorData.GetMonitorData("", DateTime.Now.AddDays(-1), DateTime.Now, "P", pkID, "hour", dataClass);

            monitorDatas.DefaultView.Sort = "DATA_TIME desc";
            monitorDatas = monitorDatas.DefaultView.ToTable();
            return(monitorDatas.ToJson());
        }
コード例 #26
0
        protected override EventInfo createEvent(out int expectedSize)
        {
            EventInfo   retVal  = new EventInfo();
            MonitorData monitor = MonitorData.GetInstance();

            retVal.Code  = 2001;
            expectedSize = monitor.GetSize();

            return(retVal);
        }
コード例 #27
0
        public WeatherData GetLastWeatherData()
        {
            MonitorData data = _context.SensorsData.Last <MonitorData>();

            return(new WeatherData
            {
                Temperature = data.Temperature,
                Pressure = data.Pressure
            });
        }
コード例 #28
0
ファイル: BServerMsgHandler.cs プロジェクト: zhutoutou/SJH
        public void HandleMsg(string strMsg)
        {
            string CommandID = XmlUtil.XmlAnalysis("CommandID", strMsg);

            if (CommandID != "ShakeHand")
            {
                LogHelper.WriteNetMsgLog("Recieve BServer message:" + strMsg);
            }
            switch (CommandID)
            {
            case "ShakeHand":
                ShakeHand ShakeHand = (ShakeHand)XmlUtil.Deserialize(typeof(ShakeHand), strMsg);
                if (ShakeHand.TLX == "BSS")
                {
                    HandleSharkHandleMsg(ShakeHand);
                }
                break;

            case "CommonInterface":
                CommonInterface Common = (CommonInterface)XmlUtil.Deserialize(typeof(CommonInterface), strMsg);
                OnMessageChange(Common);
                break;

            case "DispatchTaskSelectData":
                DispatchTaskSelectData SelectData = (DispatchTaskSelectData)XmlUtil.Deserialize(typeof(DispatchTaskSelectData), strMsg);
                //SelectData.DWBH = ConfigurationManager.AppSettings["UnitCode"].Trim();
                OnMessageChange(SelectData);
                break;

            case "GetVehiclePositionResp":
                GetVehiclePositionResp VehiclePositionResp = (GetVehiclePositionResp)XmlUtil.Deserialize(typeof(GetVehiclePositionResp), strMsg);
                OnMessageChange(VehiclePositionResp);
                break;

            case "MonitorData":
                MonitorData MonitorData = (MonitorData)XmlUtil.Deserialize(typeof(MonitorData), strMsg);
                OnMessageChange(MonitorData);
                break;

            case "VehicleStatus":
                VehicleStatus VehicleStatus = (VehicleStatus)XmlUtil.Deserialize(typeof(VehicleStatus), strMsg);
                //VehicleStatus.DWBH = ConfigurationManager.AppSettings["UnitCode"].Trim();
                OnMessageChange(VehicleStatus);
                break;

            case "DispatchTaskRequestReinforcementResp":
                DispatchTaskRequestReinforcementResp DispatchTaskResp = (DispatchTaskRequestReinforcementResp)XmlUtil.Deserialize(typeof(DispatchTaskRequestReinforcementResp), strMsg);
                OnMessageChange(DispatchTaskResp);
                break;

            default:
                break;
            }
        }
コード例 #29
0
        public void AddWeatherSensorData(WeatherData data)
        {
            MonitorData newdata = new MonitorData
            {
                Pressure    = data.Pressure,
                Temperature = data.Temperature,
                Timestamp   = DateTime.Now
            };

            _context.SensorsData.Add(newdata);
            _context.SaveChanges();
        }
コード例 #30
0
ファイル: MonitorManager.cs プロジェクト: Raytar/Monitorian
        public static string ProbeMonitors()
        {
            var data = new MonitorData();

            using (var ms = new MemoryStream())
                using (var jw = JsonReaderWriterFactory.CreateJsonWriter(ms, Encoding.UTF8, true, true))
                {
                    var serializer = new DataContractJsonSerializer(typeof(MonitorData));
                    serializer.WriteObject(jw, data);
                    jw.Flush();
                    return(Encoding.UTF8.GetString(ms.ToArray()));
                }
        }
コード例 #31
0
ファイル: RecordFilter.cs プロジェクト: yuyixiaoxiang/spear
        public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            if (!_config.EnableModule(_type))
            {
                await base.OnActionExecutionAsync(context, next);

                return;
            }
            var dto = new MonitorData(_type);
            var key = string.Format(ItemKey, _type);

            context.HttpContext.Items.Add(key, dto);
        }
コード例 #32
0
ファイル: Cleanout.cs プロジェクト: Maginx/MallProject
        /// <summary>
        /// 数据处理
        /// </summary>
        /// <param name="data">数据值</param>
        public void DatagramProcess(MonitorData data)
        {
            base.DatagramProcess(data);
            if (string.Equals(this.WorkState, "FF"))
            {
                this.SIMIdentify(this.Sim);
            }

            if (string.IsNullOrEmpty(this.EndoscopeSN) || string.IsNullOrEmpty(this.EndoscopeSIM))
            {
                FormHelper.VoiceSpeech("请打内镜卡");
                this.ShowCleanStep("清洗已打内镜卡", Color.Empty);

                //if (string.IsNullOrEmpty(this.EndoscopeSIM))
                //{
                //    this.tempDateTime = DateTime.Now;
                //}

                // 没有打过卡,则返回
                return;
            }

            // 开始清洗
            if (string.Equals(this.WorkState, "01"))
            {
                // 记录失败,没有打员工卡
                if (GSetting.DataServ.RecordEveryCleanStep(DataService.Step.CleanOutWashBeginStep, DateTime.Now, this.EndoscopeSN))
                {
                    var tmp = DateTime.Now.AddSeconds(Convert.ToDouble(GSetting.StepTime["Cleanout"]));
                    GSetting.EndoscStates[this.EndoscopeSN].CleanOutTime = Convert.ToDouble(GSetting.StepTime["Cleanout"]);
                    GSetting.DataServ.RecordEveryCleanStep(DataService.Step.CleanOutWashEndStep, tmp, this.EndoscopeSN);
                    GSetting.EndoscStates[this.EndoscopeSN].CleanOutBegin = DateTime.Now;
                    FormHelper.VoiceSpeech(this.EndoscopeSN + "清洗开始");
                    this.ShowCleanStep("清洗开始", Color.Empty);
                }
                else
                {
                    FormHelper.VoiceSpeech("请先打员工卡");
                    this.PrintTempRecordMsg("清洗记录错误,请先打员工卡", Color.Red);
                }
            }

            // 清洗结束进入消毒
            if (string.Equals(this.WorkState, "02"))
            {
                // 如果忘记开始清洗则自动填充
                if (this.tempDateTime != null)
                {
                    GSetting.DataServ.RecordEveryCleanStep(DataService.Step.CleanOutWashBeginStep, this.tempDateTime.Value, this.EndoscopeSN);
                    GSetting.EndoscStates[this.EndoscopeSN].CleanOutBegin = this.tempDateTime;
                }

                if (GSetting.DataServ.RecordEveryCleanStep(DataService.Step.CleanOutWashEndStep, DateTime.Now, this.EndoscopeSN))
                {
                    FormHelper.VoiceSpeech(this.EndoscopeSN + "清洗结束,进入消毒");
                    GSetting.EndoscStates[this.EndoscopeSN].CleanOutEnd = DateTime.Now;
                    GSetting.EndoscStates[this.EndoscopeSN].CleanOutTime = (GSetting.EndoscStates[this.EndoscopeSN].CleanOutEnd.Value - GSetting.EndoscStates[this.EndoscopeSN].CleanOutBegin.Value).TotalSeconds;
                    this.ShowCleanStep("清洗结束,进入消毒", Color.Empty);
                }

                this.CleanAllStr();
                this.tempDateTime = null;
            }
        }
コード例 #33
0
ファイル: LastWash.cs プロジェクト: Maginx/MallProject
        /// <summary>
        /// 数据处理
        /// </summary>
        /// <param name="data">数据值</param>
        public override void DatagramProcess(MonitorData data)
        {
            base.DatagramProcess(data);
            if (string.Equals(this.WorkState, "FF"))
            {
                this.SIMIdentify(this.Sim);
            }

            if (string.IsNullOrEmpty(this.EndoscopeSN) || string.IsNullOrEmpty(this.EndoscopeSIM))
            {
                if (GSetting.EndoscStates.Keys.Contains(this.EndoscopeSN))
                {
                    FormHelper.VoiceSpeech("请打内镜卡");
                    this.ShowCleanStep("末洗已打内镜卡", Color.Empty);
                }

                // 没有打过卡,则返回
                return;
            }

            // 末洗开始
            if (string.Equals(this.WorkState, "01"))
            {
                // 一次

                if (this.flagCleanType == "1")
                {
                    if (GSetting.DataServ.RecordEveryCleanStep(DataService.Step.LastWashBeginStep, DateTime.Now, this.EndoscopeSN))
                    {
                        var tmp = DateTime.Now.AddSeconds(Convert.ToDouble(GSetting.StepTime["LastWash"]));
                        GSetting.EndoscStates[this.EndoscopeSN].LastWashTime = Convert.ToDouble(GSetting.StepTime["LastWash"]);
                        GSetting.DataServ.RecordEveryCleanStep(DataService.Step.LastWashEndStep, tmp, this.EndoscopeSN);

                        FormHelper.VoiceSpeech(this.EndoscopeSN + "末洗已开始");
                        //MessageBox.Show(this.EndoscopeSN + "末洗已开始");
                        GSetting.EndoscStates[this.EndoscopeSN].LastWashBegin = DateTime.Now;
                        this.ShowCleanStep("末洗已开始", Color.Empty);
                    }
                    else
                    {
                        FormHelper.VoiceSpeech("请先打员工卡");
                        this.PrintTempRecordMsg("末洗记录错误,请先打员工卡", Color.Empty);
                    }
                }
                else
                {
                    var bo = GSetting.DataServ.RecordEveryCleanStep(DataService.Step.LastWashSecBeginStep, DateTime.Now, this.EndoscopeSN);
                    var tmp = DateTime.Now.AddSeconds(Convert.ToDouble(GSetting.StepTime["LastWashSec"]));
                    GSetting.EndoscStates[this.EndoscopeSN].LastSecWashTime = Convert.ToDouble(GSetting.StepTime["LastWashSec"]);
                    GSetting.DataServ.RecordEveryCleanStep(DataService.Step.LastWashSecEndStep, tmp, this.EndoscopeSN);
                    if (bo)
                    {
                        FormHelper.VoiceSpeech(this.EndoscopeSN + "(二次)末洗已开始");
                        GSetting.EndoscStates[this.EndoscopeSN].LastSecWashBegin = DateTime.Now;
                        //MessageBox.Show(GSetting.EndoscStates[this.EndoscopeSN].LastSecWashBegin.ToSafeString());
                        this.ShowCleanStep("(二次)正在末洗", Color.Empty);
                    }
                    else
                    {
                        FormHelper.VoiceSpeech("请先打员工卡");
                        this.PrintTempRecordMsg("末洗记录错误,请先打员工卡", Color.Red);
                    }
                }
            }
            else if (string.Equals(this.WorkState, "02"))
            {
                // 一次
                if (this.flagCleanType == "1")
                {
                    if (string.IsNullOrEmpty(this.EndoscopeSN))
                    {
                        FormHelper.VoiceSpeech("请打内镜卡");
                    }

                    if (GSetting.DataServ.RecordEveryCleanStep(DataService.Step.LastWashEndStep, DateTime.Now, this.EndoscopeSN))
                    {

                        FormHelper.VoiceSpeech(this.EndoscopeSN + "末洗已结束,请稍后确认清洗信息");
                        //MessageBox.Show(this.EndoscopeSN + "末洗已结束,请稍后确认清洗信息");
                        GSetting.EndoscStates[this.EndoscopeSN].LastWashEnd = DateTime.Now;
                        GSetting.EndoscStates[this.EndoscopeSN].LastWashTime = (GSetting.EndoscStates[this.EndoscopeSN].LastWashEnd.Value - GSetting.EndoscStates[this.EndoscopeSN].LastWashBegin.Value).TotalSeconds;
                        this.ShowCleanStep("末洗已结束,确认清洗信息", Color.Empty);
                    }
                }
                else
                {
                    // 如果忘记开始清洗 则自动填充

                    if (GSetting.DataServ.RecordEveryCleanStep(DataService.Step.LastWashSecEndStep, DateTime.Now, this.EndoscopeSN))
                    {
                        FormHelper.VoiceSpeech(this.EndoscopeSN + "(二次)末洗已结束,请稍后确认清洗信息");
                        GSetting.EndoscStates[this.EndoscopeSN].LastSecWashEnd = DateTime.Now;
                        GSetting.EndoscStates[this.EndoscopeSN].LastSecWashTime = (GSetting.EndoscStates[this.EndoscopeSN].LastSecWashEnd.Value - GSetting.EndoscStates[this.EndoscopeSN].LastSecWashBegin.Value).TotalSeconds;
                        this.ShowCleanStep("(二次)末洗已结束,确认清洗信息", Color.Empty);
                    }

                    this.flagCleanType = "1";
                }

                //this.tempDateTime = null;

                // 移除状态监视器中的内镜状态 并将待确认的内镜入确认队列
                if (GSetting.EndoscStates.Keys.Contains(this.EndoscopeSN))
                {
                    // 验证清洗数据
                    GSetting.EndoscStates[this.EndoscopeSN].EndoscopeCleanStandarData = this.VerifyCleanData();

                    if (string.IsNullOrEmpty(GSetting.EndoscStates[this.EndoscopeSN].EndoscopeCleanStandarData.ToString()))
                    {
                        // 合格
                        GSetting.DataServBusi.SetQulified(this.EndoscopeSN, "1");
                    }
                    else
                    {
                        // 不合格
                        GSetting.DataServBusi.SetQulified(this.EndoscopeSN, "0");
                    }

                    // 从状态面板上去除清洗完成的EndoscopeState
                    GSetting.RemoveCleanedEndoscope(GSetting.EndoscStates[this.EndoscopeSN]);

                    if (!GSetting.WaitSureList.Contains(this.EndoscopeSN))
                    {
                        // 加入链表
                        GSetting.WaitSureList.Add(this.EndoscopeSN);

                        // 入队列
                        GSetting.AddList(GSetting.EndoscStates[this.EndoscopeSN]);
                    }

                    GSetting.EndoscStates.Remove(this.EndoscopeSN);
                }

                this.CleanAllStr();
                this.tempDateTime = null;
            }
        }
コード例 #34
0
ファイル: EnzymeWash.cs プロジェクト: Maginx/MallProject
        /// <summary>
        /// 数据处理程序
        /// </summary>
        /// <param name="data">数据值</param>
        public override void DatagramProcess(MonitorData data)
        {
            base.DatagramProcess(data);
            FormHelper.voiceFlag = true;
            if (string.Equals(this.WorkState, "FF"))
            {
                // 验证身份
                this.SIMIdentify(this.Sim);
            }

            if (string.IsNullOrEmpty(this.EndoscopeSN) || string.IsNullOrEmpty(this.EndoscopeSIM))
            {
                // 发送错误信息
                FormHelper.VoiceSpeech("请打内镜卡");
                this.ShowCleanStep("酶洗已打内镜卡", Color.Empty);

                //if (string.IsNullOrEmpty(this.EndoscopeSIM))
                //{
                //    this.tempDateTime = DateTime.Now;
                //}

                // 没有打过卡,则返回
                return;
            }

            // 开始酶洗
            if (string.Equals(this.WorkState, "01"))
            {
                if (GSetting.DataServ.RecordEveryCleanStep(DataService.Step.EnzymeWashBeginStep, DateTime.Now, this.EndoscopeSN))
                {
                    var tmp = DateTime.Now.AddSeconds(Convert.ToDouble(GSetting.StepTime["EnzymeWash"]));
                    GSetting.EndoscStates[this.EndoscopeSN].EzymeWashTime = Convert.ToDouble(GSetting.StepTime["EnzymeWash"]);
                    GSetting.DataServ.RecordEveryCleanStep(DataService.Step.EnzymeWashEndStep, tmp, this.EndoscopeSN);
                    FormHelper.VoiceSpeech(this.EndoscopeSN + "酶洗开始");
                    this.ShowCleanStep("酶洗开始", Color.Empty);
                    GSetting.EndoscStates[this.EndoscopeSN].EzymeWashBegin = DateTime.Now;
                }
                else
                {
                    FormHelper.VoiceSpeech("请先打员工卡");
                    this.PrintTempRecordMsg("酶洗记录错误,请先打员工卡", Color.Red);
                }
            }

            // 酶洗结束进入清洗
            if (string.Equals(this.WorkState, "02"))
            {
                // 如果忘记开始清洗则自动填充
                if (this.tempDateTime != null)
                {
                    GSetting.DataServ.RecordEveryCleanStep(DataService.Step.EnzymeWashBeginStep, this.tempDateTime.Value, this.EndoscopeSN);
                    GSetting.EndoscStates[this.EndoscopeSN].EzymeWashBegin = this.tempDateTime;
                }

                if (GSetting.DataServ.RecordEveryCleanStep(DataService.Step.EnzymeWashEndStep, DateTime.Now, this.EndoscopeSN))
                {
                    GSetting.EndoscStates[this.EndoscopeSN].EzymeWashEnd = DateTime.Now;
                    GSetting.EndoscStates[this.EndoscopeSN].EzymeWashTime = (GSetting.EndoscStates[this.EndoscopeSN].EzymeWashEnd.Value - GSetting.EndoscStates[this.EndoscopeSN].EzymeWashBegin.Value).TotalSeconds;

                    FormHelper.VoiceSpeech(this.EndoscopeSN + "酶洗结束,请进入清洗");
                    this.ShowCleanStep("酶洗结束,请进入清洗", Color.Empty);
                }
                else
                {
                    this.ShowCleanStep("酶洗记录错误,酶洗数据未更新", Color.Red);
                }

                this.CleanAllStr();
                this.tempDateTime = null;
            }
        }
コード例 #35
0
ファイル: Wash.cs プロジェクト: Maginx/MallProject
 /// <summary>
 /// 处理Socket接收数据
 /// </summary>
 /// <param name="data">数据值</param>
 public virtual void DatagramProcess(MonitorData data)
 {
     this.WorkState = data.WorkState;
     this.PortNo = data.PortNO;
     this.Sim = data.SIM;
     return;
 }
コード例 #36
0
        /// <summary>
        /// 数据处理
        /// </summary>
        /// <param name="data">数据值</param>
        public override void DatagramProcess(MonitorData data)
        {
            base.DatagramProcess(data);

            if (string.Equals(this.WorkState, "FF"))
            {
                this.SIMIdentify(this.Sim);
            }

            // 开始
            if (string.Equals(this.WorkState, "01"))
            {
                startDateTime = DateTime.Now;

                if (!string.IsNullOrEmpty(this.WasherNo))
                {
                    FormHelper.VoiceSpeech(this.EndoscopeSN + "自动清洗机开始二次清洗");
                    this.ShowCleanStep("机洗二次清洗开始", Color.Empty);
                }
                else
                {
                    FormHelper.VoiceSpeech(this.EndoscopeSN + "自动清洗机开始清洗");
                    this.ShowCleanStep("机洗清洗开始", Color.Empty);
                }
            }

            // 结束
            if (string.Equals(this.WorkState, "02"))
            {
                // 一次清洗
                if (cleanType == "1")
                {
                    GSetting.DataServ.SetAutoCleanNo(this.EndoscopeSN, data.PortNO);
                    this.PrintTempRecordMsg(this.EndoscopeSN + "自动清洗机清洗结束", Color.Empty);
                    FormHelper.VoiceSpeech(this.EndoscopeSN + "自动清洗机清洗结束,请稍后确认清洗信息");
                    this.SimulateAutoMachine(startDateTime, DateTime.Now);
                }
                else
                {
                    // 重置内镜信息,并且开始
                    bool isRest = GSetting.DataServ.ResetEndoscopeMsg(this.EndoscopeSN, this.EndoscopeSIM, this.WasherNo, this.WasherName, "2", "1", data.PortNO);

                    this.PrintTempRecordMsg(this.EndoscopeSN + "自动清洗机二次清洗结束", Color.Empty);
                    this.SimulateAutoMachineSec(startDateTime, DateTime.Now);
                    FormHelper.VoiceSpeech(this.EndoscopeSN + "自动清洗机二次清洗结束,请稍后确认清洗信息");
                }

                GSetting.WashObj.ShowCleanStep("机洗清洗结束", Color.Empty);

                // 移除状态监视器中的内镜状态 并将待确认的内镜入确认队列
                if (GSetting.EndoscStates.Keys.Contains(this.EndoscopeSN))
                {
                    EndoscopeState state = GSetting.EndoscStates[this.EndoscopeSN];

                    // 验证结果
                    state.EndoscopeCleanStandarData = this.VerifyCleanDataAuto();

                    if (string.IsNullOrEmpty(state.EndoscopeCleanStandarData.ToString()))
                    {
                        // 合格
                        GSetting.DataServBusi.SetQulified(this.EndoscopeSN, "1");
                    }
                    else
                    {
                        // 不合格
                        GSetting.DataServBusi.SetQulified(this.EndoscopeSN, "0");
                    }

                    // 从状态面板上去除清洗完成的EndoscopeState
                    GSetting.RemoveCleanedEndoscope(state);

                    if (!GSetting.WaitSureList.Contains(this.EndoscopeSN))
                    {
                        // 加入链表
                        GSetting.WaitSureList.Add(this.EndoscopeSN);

                        // 入队列
                        GSetting.AddList(state);
                    }

                    GSetting.EndoscStates.Remove(this.EndoscopeSN);
                }

                cleanType = "1";
                this.CleanAllStr();
            }
        }
コード例 #37
0
ファイル: DipIn.cs プロジェクト: Maginx/MallProject
        /// <summary>
        /// 数据处理方法
        /// </summary>
        /// <param name="data">The data.</param>
        public override void DatagramProcess(MonitorData data)
        {
            base.DatagramProcess(data);
            if (string.Equals(this.WorkState, "FF"))
            {
                this.SIMIdentify(this.Sim);
            }

            if (string.IsNullOrEmpty(this.EndoscopeSN) || string.IsNullOrEmpty(this.EndoscopeSIM))
            {
                if (!string.IsNullOrEmpty(this.WasherNo))
                {
                    FormHelper.VoiceSpeech("请打内镜卡");
                    //return;
                }

                // 没有打过卡,则返回
                return;
            }

            // 消毒开始
            if (string.Equals(this.WorkState, "01"))
            {
                // 一次清洗
                if (this.flagCleanType == "1")
                {
                    if (string.IsNullOrEmpty(this.EndoscopeSN))
                    {
                        FormHelper.VoiceSpeech("请打内镜卡");
                    }

                    if (GSetting.DataServ.RecordEveryCleanStep(DataService.Step.DipInWashBeginStep, DateTime.Now, this.EndoscopeSN))
                    {
                        var tmp = DateTime.Now.AddSeconds(Convert.ToDouble(GSetting.StepTime["DipIn"]));
                        GSetting.EndoscStates[this.EndoscopeSN].DipInTime = Convert.ToDouble(GSetting.StepTime["DipIn"]);
                        GSetting.DataServ.RecordEveryCleanStep(DataService.Step.DipInWashEndStep, tmp, this.EndoscopeSN);
                        FormHelper.VoiceSpeech(this.EndoscopeSN + "消毒已开始");
                        GSetting.EndoscStates[this.EndoscopeSN].DipInBegin = DateTime.Now;
                        this.ShowCleanStep("消毒已开始", Color.Empty);
                    }
                    else
                    {
                        FormHelper.VoiceSpeech("请先打员工卡");
                        this.PrintTempRecordMsg("消毒记录错误,请先打员工卡", Color.Empty);
                    }
                }
                else
                {
                    if (GSetting.DataServ.RecordEveryCleanStep(DataService.Step.DipInWashSecBeginStep, DateTime.Now, this.EndoscopeSN))
                    {
                        var tmp = DateTime.Now.AddSeconds(Convert.ToDouble(GSetting.StepTime["DipInSec"]));
                        GSetting.EndoscStates[this.EndoscopeSN].DipInSecTime = Convert.ToDouble(GSetting.StepTime["DipInSec"]);
                        GSetting.DataServ.RecordEveryCleanStep(DataService.Step.DipInWashSecEndStep, tmp, this.EndoscopeSN);
                        GSetting.DataServ.RecordEveryCleanStep(DataService.Step.RecordTime, DateTime.Now, this.EndoscopeSN);
                        FormHelper.VoiceSpeech(this.EndoscopeSN + "(二次)消毒已开始");
                        GSetting.EndoscStates[this.EndoscopeSN].DipInSecBegin = DateTime.Now;
                        this.ShowCleanStep("(二次)消毒已开始", Color.Empty);
                    }
                    else
                    {
                        FormHelper.VoiceSpeech("请先打员工卡");
                        this.PrintTempRecordMsg("消毒记录错误,请先打员工卡", Color.Empty);
                    }
                }

            }

            // 消毒结束
            if (string.Equals(this.WorkState, "02"))
            {
                // 一次
                if (this.flagCleanType == "1")
                {

                    if (GSetting.DataServ.RecordEveryCleanStep(DataService.Step.DipInWashEndStep, DateTime.Now, this.EndoscopeSN))
                    {
                        FormHelper.VoiceSpeech(this.EndoscopeSN + "消毒已结束,进入末洗");
                        GSetting.EndoscStates[this.EndoscopeSN].DipInEnd = DateTime.Now;
                        GSetting.EndoscStates[this.EndoscopeSN].DipInTime = (GSetting.EndoscStates[this.EndoscopeSN].DipInEnd.Value - GSetting.EndoscStates[this.EndoscopeSN].DipInBegin.Value).TotalSeconds;
                        this.ShowCleanStep("消毒已结束,进入末洗", Color.Empty);
                    }
                }
                else
                {
                    GSetting.DataServ.RecordEveryCleanStep(DataService.Step.RecordTime, DateTime.Now, this.EndoscopeSN);

                    if (GSetting.DataServ.RecordEveryCleanStep(DataService.Step.DipInWashSecEndStep, DateTime.Now, this.EndoscopeSN))
                    {
                        FormHelper.VoiceSpeech(this.EndoscopeSN + "(二次)消毒已结束,进入末洗");
                        GSetting.EndoscStates[this.EndoscopeSN].DipInSecEnd = DateTime.Now;
                        GSetting.EndoscStates[this.EndoscopeSN].DipInSecTime = (GSetting.EndoscStates[this.EndoscopeSN].DipInSecEnd.Value - GSetting.EndoscStates[this.EndoscopeSN].DipInSecBegin.Value).TotalSeconds;
                        this.ShowCleanStep("(二次)消毒已结束,进入末洗", Color.Empty);
                    }

                    this.flagCleanType = "1";
                }

                this.CleanAllStr();
                this.tempDateTime = null;
            }
        }
コード例 #38
0
ファイル: FirstWash.cs プロジェクト: Maginx/MallProject
        /// <summary>
        /// 数据处理程序
        /// </summary>
        /// <param name="data">数据值</param>
        public override void DatagramProcess(MonitorData data)
        {
            // 执行父类操作
            base.DatagramProcess(data);
            // 端口状态
            if (string.Equals(this.WorkState, "FF"))
            {
                this.SIMIdentify(this.Sim);
            }

            if (!this.NullOfStrs())
            {
                // 已经打过员工卡
                if (this.WasherChecked())
                {
                    FormHelper.VoiceSpeech("员工打卡完成,请打内镜卡");
                    this.PrintTempRecordMsg(this.WasherNo + "员工打卡完成", Color.Empty);
                }

                // 没有打过卡,直接返回
                return;
            }

            // 刷洗结束初洗开始
            if (string.Equals(this.WorkState, "01"))
            {
                GSetting.EndoscStates[this.EndoscopeSN].BrushWashEnd = DateTime.Now;
                GSetting.EndoscStates[this.EndoscopeSN].FirstWashBegin = DateTime.Now;
                GSetting.EndoscStates[this.EndoscopeSN].BrushWashTime = (GSetting.EndoscStates[this.EndoscopeSN].BrushWashEnd.Value - GSetting.EndoscStates[this.EndoscopeSN].BrushWashBegin.Value).TotalSeconds;

                if (GSetting.DataServ.RecordEveryCleanStep(DataService.Step.FirstWashBeginStep, DateTime.Now, this.EndoscopeSN))
                {
                    var tmp = DateTime.Now.AddSeconds(Convert.ToDouble(GSetting.StepTime["FirstWash"]));
                    GSetting.EndoscStates[this.EndoscopeSN].FirstWashTime = Convert.ToDouble(GSetting.StepTime["FirstWash"]);
                    GSetting.DataServ.RecordEveryCleanStep(DataService.Step.FirstWashEndStep, tmp, this.EndoscopeSN);
                    GSetting.EndoscStates[this.EndoscopeSN].FirstWashBegin = DateTime.Now;
                    FormHelper.VoiceSpeech(this.EndoscopeSN + "初洗开始");
                    this.ShowCleanStep("刷洗结束,初洗开始", Color.Empty);
                }
                else
                {
                    this.ShowCleanStep("内镜初洗开始失败", Color.Red);
                    GSetting.EndoscStates[this.EndoscopeSN].txtEndoscopeState.Text = "内镜初洗开始失败";
                }
            }

            // 初洗结束,进入酶洗
            if (string.Equals(this.WorkState, "02"))
            {
                if (GSetting.DataServ.RecordEveryCleanStep(DataService.Step.FirstWashEndStep, DateTime.Now, this.EndoscopeSN))
                {
                    GSetting.EndoscStates[this.EndoscopeSN].FirstWashEnd = DateTime.Now;
                    GSetting.EndoscStates[this.EndoscopeSN].FirstWashTime = (GSetting.EndoscStates[this.EndoscopeSN].FirstWashEnd.Value - GSetting.EndoscStates[this.EndoscopeSN].FirstWashBegin.Value).TotalSeconds;

                    FormHelper.VoiceSpeech(this.EndoscopeSN + "初洗结束,请进入酶洗");
                    this.ShowCleanStep("初洗结束,请进入酶洗", Color.Empty);
                }
                else
                {
                    this.ShowCleanStep("内镜初洗结束失败", Color.Red);
                    GSetting.EndoscStates[this.EndoscopeSN].txtEndoscopeState.Text = "内镜初洗结束失败";
                }

                this.CleanAllStr();
            }
        }