Esempio n. 1
0
        public List<VMonitorVehicle> GetWithMonitorVehicleList(EnumMapType mapType, List<Guid> vehicleCodes)
        {
            List<VMonitorVehicle> list = DACFacade.Movo.VehicleDAC.SelectListByVehicleCodes(vehicleCodes, mapType);
            LatLon latlon = null;
            GoogleMapService gms = new GoogleMapService();
            foreach (var item in list)
            {
                if (item.ExpireTime.HasValue && item.ExpireTime.Value.Date < DateTime.Now.Date)
                {
                    item.IsOverdue = true;
                }
                if (item.AlarmType != null)
                {
                    item.IsWarning = true;
                }
                if (item.Lng.HasValue && item.Lat.HasValue)
                {
                    switch (mapType)
                    {
                        case EnumMapType.GoogleCN:
                            latlon = gms.LatLonToMar(new LatLon { Longitude = item.Lng.Value, Latitude = item.Lat.Value });
                            break;

                        case EnumMapType.BaiduMap:
                            latlon = gms.LatLonToMar(new LatLon { Longitude = item.Lng.Value, Latitude = item.Lat.Value });
                            break;
                    }
                    if (latlon != null)
                    {
                        item.Lng = latlon.Longitude;
                        item.Lat = latlon.Latitude;
                    }
                }
            }

            return list;
        }
Esempio n. 2
0
        public List<VMonitorVehicle> GetMonitorVehicleList(string vehicleCode, EnumMapType mapType)
        {

            List<VMonitorVehicle> list = DACFacade.Movo.VehicleDAC.SelectListByVehicleCodes(vehicleCode, mapType);
            list = list.OrderBy(p => p.OrderByType).ToList();
            LatLon latlon = null;
            GoogleMapService gms = new GoogleMapService();
            foreach (var item in list)
            {
                if (item.Lng.HasValue && item.Lat.HasValue)
                {
                    if (mapType == EnumMapType.GoogleCN)
                    {
                        latlon = gms.LatLonToMar(new LatLon { Longitude = item.Lng.Value, Latitude = item.Lat.Value });
                        if (latlon != null)
                        {
                            item.Lng = latlon.Longitude;
                            item.Lat = latlon.Latitude;
                        }
                    }
                }
            }
            return list;
        }
Esempio n. 3
0
        public List<VMonitorVehicle> GetMonitorVehicleList(string userCode, string tenantCode, EnumMapType mapType, string vehGroupID,
            bool? isMonitorVehicles,out string rightTabHtmlAll, out string rightTabHtmlOnline, out int onlineNum)
        {
            onlineNum = 0;
            rightTabHtmlAll = string.Empty;
            rightTabHtmlOnline = string.Empty;
            List<VMonitorVehicle> list = DACFacade.Movo.VehicleDAC.SelectListByVehicleCodes(userCode, tenantCode, mapType, vehGroupID);
            list = list.OrderBy(p => p.OrderByType).ToList();
            LatLon latlon = null;
            GoogleMapService gms = new GoogleMapService();
            StringBuilder sbTabHtmlAll = new StringBuilder();
            StringBuilder sbTabHtmlOnline = new StringBuilder();

            foreach (var item in list)
            {

                EFortifyAlertsetting fortifyAlertsetting = DACFacade.Gps.FortifyAlertSettingDAC.SelectByVehicleCode(new Guid(item.VehicleCode));
                //设防按钮
                string fortifysHtml = string.Empty;
                if (fortifyAlertsetting != null && fortifyAlertsetting.Enable)
                {
                    item.IsFortify = true;
                    fortifysHtml = "<a href='#' class='al-lock' onclick='MonitorUnFortify(\"{0}\");'>取消设防</a>";
                }
                else
                {
                    fortifysHtml = "<a href='#' class='al-unlock' onclick='MonitorFortify(\"{0}\");'>设防</a>";
                }
                //obd按钮
                string obdHtml = string.Empty;
                if (item.MachineType == 1)
                {
                    obdHtml = "<a href='#' class='aLinkMonitor al-obd' onclick='OpenMonitorOBDInfo(\"{0}\")'>OBD</a>";
                }

                if (item.Lng.HasValue && item.Lat.HasValue)
                {
                    if (mapType == EnumMapType.GoogleCN)
                    {
                        latlon = gms.LatLonToMar(new LatLon { Longitude = item.Lng.Value, Latitude = item.Lat.Value });
                        if (latlon != null)
                        {
                            item.Lng = latlon.Longitude;
                            item.Lat = latlon.Latitude;
                        }
                    }
                }

                string _cssName = (item.Lng.HasValue && item.Lat.HasValue ? string.Empty : " c9");
                string checkHtml = "<div ";
                if (isMonitorVehicles != null && isMonitorVehicles.Value)
                {
                    checkHtml = "<div style='padding-top: 8px;padding-left: 4px; float: left;'><input id='chkVehicle_{0}' type='checkbox'></div><div style='width: auto;' ";
                }
                if (item.IsOverdue) // 过期
                {
                    //item.OrderByType = 3;
                    sbTabHtmlAll.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='true' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam red'><span>{1}</span>过期</p><p class='car-fun{7}'>跟踪<a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' onclick='MonitorZoomIn();'>放大</a></p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName);

                    if (item.StateName != "OffLine")
                    {
                        onlineNum++;
                        sbTabHtmlOnline.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='true' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam red'><span>{1}</span>过期</p><p class='car-fun{7}'>跟踪<a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' onclick='MonitorZoomIn();'>放大</a></p></li>",
                            item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName);
                    }
                }
                else if (item.IsStop) // 停用
                {
                    //item.OrderByType = 4;
                    sbTabHtmlAll.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam red'><span>{1}</span>停用</p><p class='car-fun{7}'>跟踪<a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' onclick='MonitorZoomIn();'>放大</a></p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);

                    if (item.StateName != "OffLine")
                    {
                        onlineNum++;
                        sbTabHtmlOnline.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='true' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam red'><span>{1}</span>停用</p><p class='car-fun{7}'>跟踪<a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' onclick='MonitorZoomIn();'>放大</a></p></li>",
                            item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);
                    }
                }
                else if (item.StateName == EnumVehicleState.Run.ToString()) // 行驶
                {

                    //item.OrderByType = 1;
                    sbTabHtmlAll.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam gre'><span>{1}</span>行驶</p><p class='car-fun{7}'>" + obdHtml + "<a href='#' class='aLinkMonitor al-fol' onclick='OpenMonitorTrack(\"{0}\")'>跟踪</a><a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' class='al-mag' onclick='MonitorZoomIn();'>放大</a>" + fortifysHtml + "</p></li>",
                            item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);

                    onlineNum++;
                    sbTabHtmlOnline.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam gre'><span>{1}</span>行驶</p><p class='car-fun{7}'>" + obdHtml + "<a href='#' class='aLinkMonitor al-fol' onclick='OpenMonitorTrack(\"{0}\")'>跟踪</a><a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' class='al-mag' onclick='MonitorZoomIn();'>放大</a>" + fortifysHtml + "</p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);


                }
                else if (item.StateName == EnumVehicleState.Stop.ToString()) // 停止
                {
                    //item.OrderByType = 2;
                    sbTabHtmlAll.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam gre'><span>{1}</span>停止</p><p class='car-fun{7}'>" + obdHtml + "<a href='#' class='aLinkMonitor al-fol' onclick='OpenMonitorTrack(\"{0}\")'>跟踪</a><a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' class='al-mag' onclick='MonitorZoomIn();'>放大</a>" + fortifysHtml + "</p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);

                    onlineNum++;
                    sbTabHtmlOnline.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam gre'><span>{1}</span>停止</p><p class='car-fun{7}'>" + obdHtml + "<a href='#' class='aLinkMonitor al-fol' onclick='OpenMonitorTrack(\"{0}\")'>跟踪</a><a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' class='al-mag' onclick='MonitorZoomIn();'>放大</a>" + fortifysHtml + "</p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);

                }
                else if (item.StateName == EnumVehicleState.OffLine.ToString()) // 离线
                {
                    //item.OrderByType = 5;
                    sbTabHtmlAll.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam{7}'><span>{1}</span>离线</p><p class='car-fun{7}'>" + obdHtml + "<a href='#' class='aLinkMonitor al-fol' onclick='OpenMonitorTrack(\"{0}\")'>跟踪</a><a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' class='al-mag' onclick='MonitorZoomIn();'>放大</a>" + fortifysHtml + "</p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);
                }
                else if (item.StateName == EnumVehicleState.Warning.ToString()) //报警
                {
                    //item.OrderByType = 1;
                    sbTabHtmlAll.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam gre'><span>{1}</span>报警</p><p class='car-fun{7}'>" + obdHtml + "<a href='#' class='aLinkMonitor al-fol' onclick='OpenMonitorTrack(\"{0}\")'>跟踪</a><a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' class='al-mag' onclick='MonitorZoomIn();'>放大</a>" + fortifysHtml + "</p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);

                    onlineNum++;
                    sbTabHtmlOnline.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam gre'><span>{1}</span>报警</p><p class='car-fun{7}'>" + obdHtml + "<a href='#' class='aLinkMonitor al-fol' onclick='OpenMonitorTrack(\"{0}\")'>跟踪</a><a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' class='al-mag' onclick='MonitorZoomIn();'>放大</a>" + fortifysHtml + "</p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);
                }
            }

            if (sbTabHtmlAll.Length > 0)
                rightTabHtmlAll = sbTabHtmlAll.ToString();

            if (sbTabHtmlOnline.Length > 0)
                rightTabHtmlOnline = sbTabHtmlOnline.ToString();

            return list;
        }