示例#1
0
        public List <RecordReportInfo> loadRecodeReportInfo(DateTime start_time, DateTime end_time, string vh_id, string cmd_id)
        {
            Nest.DateRangeQuery dq = new Nest.DateRangeQuery()
            {
                Field       = "@timestamp",
                GreaterThan = start_time,
                LessThan    = end_time
            };
            Nest.TermsQuery tsq  = null;
            Nest.TermsQuery tsq1 = null;
            if (vh_id != null)
            {
                tsq = new Nest.TermsQuery()
                {
                    Field = new Nest.Field("VH_ID.keyword"),
                    Terms = new List <string> {
                        vh_id.Trim()
                    }
                };
            }
            if (cmd_id != null)
            {
                tsq1 = new Nest.TermsQuery()
                {
                    Field = new Nest.Field("MCS_CMD_ID.keyword"),
                    Terms = new List <string> {
                        cmd_id.Trim()
                    }
                };
            }
            var queryList = app.GetElasticSearchManager().Search <RecordReportInfo>
                                (ElasticSearchManager.ELASTIC_URL,
                                ElasticSearchManager.ELASTIC_TABLE_INDEX_RECODEREPORTINFO,
                                dq,
                                new[] { tsq, tsq1 },
                                0,
                                9999);

            return(queryList);
        }
示例#2
0
        public void UpdateSysEfficiencyComparisonBaseTable_parallel()
        {
            var           port_station_list = app.ObjCacheManager.GetPortStations();
            List <string> from_ports        = port_station_list.Select(port_st => port_st.PORT_ID).ToList();
            List <string> to_ports          = port_station_list.Select(port_st => port_st.PORT_ID).ToList();
            DateTime      query_dateTime    = DateTime.Now;
            BlockingCollection <Port2Port_TransferInfo> listTemp = new BlockingCollection <Port2Port_TransferInfo>();

            Parallel.For(0, from_ports.Count(), from_port_index =>
            {
                Parallel.For(0, to_ports.Count(), to_port_index =>
                {
                    string from_port = from_ports[from_port_index];
                    string to_port   = from_ports[to_port_index];
                    if (sc.Common.SCUtility.isMatche(from_port, to_port))
                    {
                        return;
                    }

                    Nest.DateRangeQuery dq = new Nest.DateRangeQuery()
                    {
                        Field       = "@timestamp",
                        GreaterThan = query_dateTime.AddDays(-7),
                        LessThan    = query_dateTime
                    };
                    Nest.TermsQuery tsq = new Nest.TermsQuery()
                    {
                        Field = new Nest.Field("SOURCE_ADR.keyword"),
                        Terms = new List <string> {
                            from_port.Trim()
                        }
                    };
                    Nest.TermsQuery tsq1 = new Nest.TermsQuery()
                    {
                        Field = new Nest.Field("DESTINATION_ADR.keyword"),
                        Terms = new List <string> {
                            to_port.Trim()
                        }
                    };
                    string[] include_column = new string[]
                    {
                        "@timestamp", "SOURCE_ADR", "DESTINATION_ADR", "CMD_TOTAL_EXCUTION_TIME"
                    };

                    var queryList = app.GetElasticSearchManager().Search <sysexcutequality>
                                        (ElasticSearchManager.ELASTIC_URL,
                                        ElasticSearchManager.ELASTIC_TABLE_INDEX_SYSEXCUTEQUALITY,
                                        dq,
                                        new[] { tsq, tsq1 },
                                        include_column,
                                        0,
                                        500);
                    if (queryList.Count == 0)
                    {
                        return;
                    }
                    queryList         = queryList.OrderBy(sys_excute => sys_excute.CMD_TOTAL_EXCUTION_TIME).ToList();
                    int total_count   = queryList.Count;
                    double middle_num = total_count / 2;
                    int middle_index  = Convert.ToInt16(Math.Ceiling(middle_num)) - 1;

                    //double min_excute_time_sec = queryList.Min(p => p.CMD_TOTAL_EXCUTION_TIME);
                    double middle_excute_time_sec = queryList[middle_index].CMD_TOTAL_EXCUTION_TIME;

                    listTemp.Add(new Port2Port_TransferInfo()
                    {
                        SOURCE_ADR      = from_port,
                        DESTINATION_ADR = to_port,
                        //CMD_TOTAL_EXCUTION_TIME_MinTime = min_excute_time_sec
                        CMD_TOTAL_EXCUTION_TIME_MinTime = middle_excute_time_sec
                    });
                });
            });
            port2Port_ComparisonBaseTable = listTemp.ToList();
            isComparisonBaseTableReady    = true;
        }
示例#3
0
        public void UpdateSysEfficiencyComparisonBaseTable()
        {
            List <Port2Port_TransferInfo> port2Ports = new List <Port2Port_TransferInfo>();
            var           port_station_list          = app.ObjCacheManager.GetPortStations();
            List <string> from_ports     = port_station_list.Select(port_st => port_st.PORT_ID).ToList();
            List <string> to_ports       = port_station_list.Select(port_st => port_st.PORT_ID).ToList();
            DateTime      query_dateTime = DateTime.Now;

            foreach (string from_port in from_ports)
            {
                foreach (string to_port in to_ports)
                {
                    if (sc.Common.SCUtility.isMatche(from_port, to_port))
                    {
                        continue;
                    }

                    Nest.DateRangeQuery dq = new Nest.DateRangeQuery()
                    {
                        Field       = "@timestamp",
                        GreaterThan = query_dateTime.AddDays(-7),
                        LessThan    = query_dateTime
                    };
                    Nest.TermsQuery tsq = new Nest.TermsQuery()
                    {
                        Field = new Nest.Field("SOURCE_ADR.keyword"),
                        Terms = new List <string> {
                            from_port.Trim()
                        }
                    };
                    Nest.TermsQuery tsq1 = new Nest.TermsQuery()
                    {
                        Field = new Nest.Field("DESTINATION_ADR.keyword"),
                        Terms = new List <string> {
                            to_port.Trim()
                        }
                    };
                    string[] include_column = new string[]
                    {
                        "@timestamp", "SOURCE_ADR", "DESTINATION_ADR", "CMD_TOTAL_EXCUTION_TIME"
                    };

                    var queryList = app.GetElasticSearchManager().Search <sysexcutequality>
                                        (ElasticSearchManager.ELASTIC_URL,
                                        ElasticSearchManager.ELASTIC_TABLE_INDEX_SYSEXCUTEQUALITY,
                                        dq,
                                        new[] { tsq, tsq1 },
                                        include_column,
                                        0,
                                        10000);
                    if (queryList.Count == 0)
                    {
                        continue;
                    }
                    double min_excute_time_sec = queryList.Min(p => p.CMD_TOTAL_EXCUTION_TIME);

                    port2Ports.Add(new Port2Port_TransferInfo()
                    {
                        SOURCE_ADR      = from_port,
                        DESTINATION_ADR = to_port,
                        CMD_TOTAL_EXCUTION_TIME_MinTime = min_excute_time_sec
                    });
                }
            }
        }