sync
This commit is contained in:
@ -14,6 +14,7 @@ using Foresight.Fleet.Services.Device;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using System.Threading;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using DocumentFormat.OpenXml.Drawing;
|
||||
|
||||
namespace IronIntel.Contractor.MapView
|
||||
{
|
||||
@ -136,7 +137,7 @@ namespace IronIntel.Contractor.MapView
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取Dealer站点下多个Contractor机器几次信息列表
|
||||
/// 获取Dealer站点下多个Contractor机器基础信息列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static MapViewAssetItem[] GetDealerAssetBasicInfos(string sessionid, string companyids, string useriid)
|
||||
@ -197,7 +198,6 @@ namespace IronIntel.Contractor.MapView
|
||||
/// <summary>
|
||||
/// 根据机器ID获取机器基础信息列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static MapViewAssetItem[] GetAssetItemsByAssets(string sessionid, string companyid, string useriid, long[] assetids)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
@ -209,6 +209,10 @@ namespace IronIntel.Contractor.MapView
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据机器ID获取机器详细信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static AssetDetailViewItem GetAssetDetailItem(string sessionid, string companyid, long machineid, string datasource = null)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<AssetQueryClient>(companyid, sessionid);
|
||||
@ -294,6 +298,10 @@ namespace IronIntel.Contractor.MapView
|
||||
return mi;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Contractorid获取机器组列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static AssetGroupViewItem[] GetAssetGroups(string sessionid, string companyid, string useriid, string searchtext)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<MapViewQueryClient>(companyid, sessionid);
|
||||
@ -311,6 +319,10 @@ namespace IronIntel.Contractor.MapView
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取Dealer站点下多个Contractor机器组列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static AssetGroupViewItem[] GetDealerAssetGroups(string sessionid, string companyids, string useriid, string searchtext)
|
||||
{
|
||||
string[] cids = null;
|
||||
@ -375,6 +387,10 @@ namespace IronIntel.Contractor.MapView
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Contractorid获取Jobsite列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static JobSiteViewItem[] GetJobsites(string sessionid, string companyid, string useriid, string searchtext)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
@ -444,6 +460,10 @@ namespace IronIntel.Contractor.MapView
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///获取Dealer站点下多个Contractor Jobsite列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static JobSiteViewItem[] GetDealerJobsites(string sessionid, string companyids, string useriid, string searchtext)
|
||||
{
|
||||
string[] cids = null;
|
||||
@ -508,7 +528,11 @@ namespace IronIntel.Contractor.MapView
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
public static AssetLocationHistoryViewItem GetMachineLocationHistory(string sessionid, string machineid, DateTime startTime, DateTime endTime, string companyid, bool notShow00loc, string datasource)
|
||||
/// <summary>
|
||||
/// 根据机器Id获取机器基本信息和位置历史记录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static AssetLocationHistoryViewItem GetMachineLocationHistory(string sessionid, string machineid, DateTime startTime, DateTime endTime, string companyid, bool notShow00loc, string datasource, string subsource)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -523,7 +547,7 @@ namespace IronIntel.Contractor.MapView
|
||||
&& d.Status == 1);
|
||||
|
||||
var locclient = FleetServiceClientHelper.CreateClient<AssetLocationQueryClient>(companyid, sessionid);
|
||||
AssetLocationInfo[] assetLocs = locclient.GetAssetBasicLocationHistory(companyid, long.Parse(machineid), startTime, endTime, datasource, "", !notShow00loc);
|
||||
AssetLocationInfo[] assetLocs = locclient.GetAssetBasicLocationHistory(companyid, long.Parse(machineid), startTime, endTime, datasource, subsource, !notShow00loc);
|
||||
|
||||
List<LocationViewItem> ls = new List<LocationViewItem>();
|
||||
foreach (AssetLocationInfo assetLoc in assetLocs)
|
||||
@ -544,11 +568,18 @@ namespace IronIntel.Contractor.MapView
|
||||
li.Street = assetLoc.Street;
|
||||
li.HarshDringEvent = assetLoc.HarshDringEvent;
|
||||
li.SpeedingBehavior = assetLoc.SpeedingBehavior;
|
||||
li.IconURL = GenerateLocationIconUrl(assetLoc, asset.OnRoad);
|
||||
bool abnormal = false;
|
||||
li.IconURL = GenerateLocationIconUrl(assetLoc, asset.OnRoad, out abnormal);
|
||||
li.Abnormal = abnormal;
|
||||
li.Heading = assetLoc.Heading;
|
||||
li.MoveStatus = (int)assetLoc.MoveStatus;
|
||||
li.SmartWitnessVideoUrl = assetLoc.SmartWitnessVideoUrl;
|
||||
|
||||
li.FromSmartWitness = device == null ? false : true;//11342 通过机器当前是否绑定SmartWitness来判断
|
||||
|
||||
li.SeatBelt = assetLoc.SeatBelt;
|
||||
li.DriverInsight = assetLoc.DriverInsight;
|
||||
|
||||
//ConvertSpeedUnitToMile(li);
|
||||
ls.Add(li);
|
||||
}
|
||||
@ -558,64 +589,88 @@ namespace IronIntel.Contractor.MapView
|
||||
return al;
|
||||
}
|
||||
|
||||
private static string GenerateLocationIconUrl(AssetLocationInfo loc, bool onRoad)
|
||||
/// <summary>
|
||||
/// 根据位置信息生成位置图标Url
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static string GenerateLocationIconUrl(AssetLocationInfo loc, bool onRoad, out bool abnormal)
|
||||
{
|
||||
//http://iron.soft.rz/admin/machinetypeicon.ashx
|
||||
//http://iron.soft.rz/admin/machinemovingicon.ashx
|
||||
string path = SystemParams.MachineTypeMapViewIconUrl.ToLower().Replace("machinetypeicon.ashx", "machinemovingicon.ashx");
|
||||
const string PARAM = "?tp={0}&bkcolor={1}&heading={2}";
|
||||
string path = SystemParams.MachineMovingIconUrl;
|
||||
const string PARAM = "?tp={0}&bkcolor={1}&heading={2}&seatbelt={3}";
|
||||
|
||||
int tp = (int)HarshDrivingEvents.HardAccelerationEvent;
|
||||
abnormal = false;
|
||||
string color = "";
|
||||
if (onRoad)
|
||||
{
|
||||
switch (loc.HarshDringEvent)
|
||||
if (loc.DriverInsight != DriverInsights.None)
|
||||
{
|
||||
case HarshDrivingEvents.None:
|
||||
break;
|
||||
case HarshDrivingEvents.HardAccelerationEvent:
|
||||
color = "#ff3f48cc";
|
||||
break;
|
||||
case HarshDrivingEvents.HardBrakeEvent:
|
||||
color = "#ff00a8f3";
|
||||
break;
|
||||
case HarshDrivingEvents.HardTurnEvent:
|
||||
color = "#fffff200";
|
||||
break;
|
||||
return "";// path + "?legend=DriverInsights";
|
||||
}
|
||||
if (string.IsNullOrEmpty(color))
|
||||
else
|
||||
{
|
||||
if (loc.SpeedingBehavior == SpeedingBehaviors.MinorSpeeding)
|
||||
color = "#ffff7f27";
|
||||
else if (loc.SpeedingBehavior == SpeedingBehaviors.SevereSpeeding)
|
||||
color = "#ffec1c24";
|
||||
if (loc.HarshDringEvent != HarshDrivingEvents.None || loc.SpeedingBehavior != SpeedingBehaviors.None)
|
||||
abnormal = true;
|
||||
switch (loc.HarshDringEvent)
|
||||
{
|
||||
case HarshDrivingEvents.None:
|
||||
break;
|
||||
case HarshDrivingEvents.HardAccelerationEvent:
|
||||
color = "#ff3f48cc";
|
||||
break;
|
||||
case HarshDrivingEvents.HardBrakeEvent:
|
||||
color = "#ff00a8f3";
|
||||
break;
|
||||
case HarshDrivingEvents.HardTurnEvent:
|
||||
color = "#ffff89e6";
|
||||
break;
|
||||
}
|
||||
if (string.IsNullOrEmpty(color))
|
||||
{
|
||||
if (loc.SpeedingBehavior == SpeedingBehaviors.MinorSpeeding)
|
||||
color = "#ffff7f27";
|
||||
else if (loc.SpeedingBehavior == SpeedingBehaviors.SevereSpeeding)
|
||||
color = "#ffec1c24";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(color))
|
||||
{
|
||||
if (loc.MoveStatus == AssetMoveStatus.InMotion)
|
||||
color = "#ff228B22";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(color) && loc.MoveStatus == AssetMoveStatus.InMotion)
|
||||
color = "#ff228B22";
|
||||
|
||||
if (loc.Speed <= 0 && loc.MoveStatus == AssetMoveStatus.Unknown)
|
||||
{
|
||||
loc.Heading = -1;
|
||||
abnormal = true;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(color))
|
||||
{
|
||||
if (loc.MoveStatus == AssetMoveStatus.StoppedOn)
|
||||
return path + "?legend=StoppedOn";
|
||||
return "";// path + "?legend=StoppedOn";
|
||||
else if (loc.MoveStatus == AssetMoveStatus.StoppedOff)
|
||||
return path + "?legend=StoppedOff";
|
||||
return "";// path + "?legend=StoppedOff";
|
||||
else if (loc.MoveStatus == AssetMoveStatus.ConnectivityRecovery)
|
||||
{
|
||||
abnormal = true;
|
||||
return path + "?legend=CGAIN";
|
||||
}
|
||||
else if (loc.MoveStatus == AssetMoveStatus.ConnectivityLose)
|
||||
{
|
||||
abnormal = true;
|
||||
return path + "?legend=CLOSS";
|
||||
}
|
||||
}
|
||||
color = HttpUtility.UrlEncode(color);
|
||||
path = path + string.Format(PARAM, tp, color, loc.Heading);
|
||||
path = abnormal ? path + string.Format(PARAM, tp, color, loc.Heading, loc.SeatBelt == SeatBeltStatus.NotDetected ? 1 : 0) : "";//角度在js 中实现
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据contractorid获取地图AlertView定义列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static MapAlertViewDefinitionItem[] GetMapAlertViews(string sessionid, string companyid, string selectedViewID)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(companyid))
|
||||
@ -639,6 +694,7 @@ namespace IronIntel.Contractor.MapView
|
||||
MapAlertViewDefinitionItem mi = new MapAlertViewDefinitionItem();
|
||||
mi.ID = ai.ID;
|
||||
mi.Name = ai.Name;
|
||||
mi.LocalNames.AddRange(ai.LocalNames);
|
||||
|
||||
if (viewInfo != null && viewInfo.ID.Equals(mi.ID, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@ -650,6 +706,7 @@ namespace IronIntel.Contractor.MapView
|
||||
mi.Layers[i].ID = layer.LayerId;
|
||||
mi.Layers[i].Title = layer.Title;
|
||||
mi.Layers[i].LegendUrl = layer.LegendUrl;
|
||||
mi.Layers[i].LocalTitles.AddRange(layer.LocalTitles);
|
||||
|
||||
if (layer.Pivots != null && layer.Pivots.Count > 0)
|
||||
mi.Layers[i].Pivots = ConvertPivotsDefine(layer.Pivots);
|
||||
@ -662,6 +719,10 @@ namespace IronIntel.Contractor.MapView
|
||||
return ls.OrderBy((mal) => mal.Name).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///获取Dealer站点下多个Contractor地图AlertView定义列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static MapAlertViewDefinitionItem[] GetDealerMapAlertViews(string sessionid, string companyids, string selectedViewID)
|
||||
{
|
||||
string[] cids = null;
|
||||
@ -707,6 +768,7 @@ namespace IronIntel.Contractor.MapView
|
||||
mi = new MapAlertViewDefinitionItem();
|
||||
mi.ID = ai.ID;
|
||||
mi.Name = ai.Name;
|
||||
mi.LocalNames.AddRange(ai.LocalNames);
|
||||
results.Add(mi);
|
||||
}
|
||||
|
||||
@ -720,6 +782,7 @@ namespace IronIntel.Contractor.MapView
|
||||
mi.Layers[i].ID = layer.LayerId;
|
||||
mi.Layers[i].Title = layer.Title;
|
||||
mi.Layers[i].LegendUrl = layer.LegendUrl;
|
||||
mi.Layers[i].LocalTitles.AddRange(layer.LocalTitles);
|
||||
|
||||
if (layer.Pivots != null && layer.Pivots.Count > 0)
|
||||
mi.Layers[i].Pivots = ConvertPivotsDefine(layer.Pivots);
|
||||
@ -781,6 +844,7 @@ namespace IronIntel.Contractor.MapView
|
||||
{
|
||||
AlertLayerPivotViewItem pi = new AlertLayerPivotViewItem();
|
||||
Helper.CloneProperty(pi, pd);
|
||||
pi.LocalCaptions.AddRange(pd.LocalCaptions);
|
||||
if (pi.DataType == DataTypes.Datetime)
|
||||
{
|
||||
try
|
||||
|
@ -91,5 +91,7 @@ namespace IronIntel.Contractor.MapView
|
||||
public bool IsAllAllowed { get; set; }
|
||||
public bool MutipleSelect { get; set; }
|
||||
public bool IsCriteriaSQL { get; set; }
|
||||
public List<KeyValuePair<string, string>> LocalCaptions { get; private set; } = new List<KeyValuePair<string, string>>();//不同language下的Title
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -145,6 +145,8 @@ namespace IronIntel.Contractor.MapView
|
||||
{
|
||||
public string ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public List<KeyValuePair<string, string>> LocalNames { get; private set; } = new List<KeyValuePair<string, string>>();
|
||||
|
||||
public MapAlertLayerDefinitionItem[] Layers { get; set; }
|
||||
public List<LookupDataSourceDataItem> LookupDataSources { get; set; } = new List<LookupDataSourceDataItem>();
|
||||
}
|
||||
@ -172,6 +174,8 @@ namespace IronIntel.Contractor.MapView
|
||||
public string IconColor { get; set; }
|
||||
public string AlertLayerType { get; set; }//Primary/Secondary
|
||||
public string LegendUrl { get; set; }
|
||||
public List<KeyValuePair<string, string>> LocalTitles { get; private set; } = new List<KeyValuePair<string, string>>();//不同language下的Title
|
||||
|
||||
public DbQueryParameterItem[] CriteriaSQLParameters { get; set; }
|
||||
public DbQueryParameterItem[] AlertSQLParameters { get; set; }
|
||||
public AlertLayerPivotViewItem[] Pivots { get; set; }
|
||||
@ -193,6 +197,8 @@ namespace IronIntel.Contractor.MapView
|
||||
public bool IsField { get; set; }//表明该参数名是一个数据库参数或是结果集的字段,如果是结果集的字段,则该定义必须要与lookupdatasource关联。
|
||||
public bool IsAllAllowed { get; set; }
|
||||
public bool MutipleSelect { get; set; }
|
||||
public List<KeyValuePair<string, string>> LocalCaptions { get; private set; } = new List<KeyValuePair<string, string>>();//不同language下的Title
|
||||
|
||||
}
|
||||
|
||||
public class QueryParameterSource
|
||||
@ -229,10 +235,17 @@ namespace IronIntel.Contractor.MapView
|
||||
public string PostedSpeedUnit { get; set; }
|
||||
public string Street { get; set; } = string.Empty;
|
||||
public string IconURL { get; set; } = string.Empty;
|
||||
public int Heading { get; set; } = 0;
|
||||
public int MoveStatus { get; set; } = 0;
|
||||
public bool Abnormal { get; set; }//是否是异常驾驶
|
||||
public List<KeyValuePair<string, string>> SmartWitnessVideoUrl { get; set; }
|
||||
public SpeedingBehaviors SpeedingBehavior { get; set; }
|
||||
public HarshDrivingEvents HarshDringEvent { get; set; }
|
||||
public bool FromSmartWitness { get; set; }
|
||||
|
||||
public SeatBeltStatus SeatBelt { get; set; }
|
||||
|
||||
public DriverInsights DriverInsight { get; set; }
|
||||
}
|
||||
|
||||
public class MachineTypeItem
|
||||
|
Reference in New Issue
Block a user