sync
This commit is contained in:
@ -6,11 +6,14 @@ using System.Text;
|
||||
using System.Web;
|
||||
using Foresight.Data;
|
||||
using Foresight.ServiceModel;
|
||||
using IronIntel.Services.Business.Admin;
|
||||
using IronIntel.Contractor.Machines;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.Fleet.Services.MapView;
|
||||
using Foresight.Fleet.Services.JobSite;
|
||||
using Foresight.Fleet.Services.Device;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using System.Threading;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
|
||||
namespace IronIntel.Contractor.MapView
|
||||
{
|
||||
@ -20,7 +23,7 @@ namespace IronIntel.Contractor.MapView
|
||||
/// 根据Contractorid获取机器列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static AssetMapViewPinItem[] GetAssets(string sessionid, string companyid, string useriid, string filtertext, int onroad, MachineAlertViewQueryParameter param, bool IncludeNoLocation)
|
||||
public static AssetMapViewPinItem[] GetAssets(string sessionid, string companyid, string useriid, string filtertext, int onroad, MachineAlertViewQueryParameter param, bool IncludeNoLocation, int attachment)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -38,23 +41,99 @@ namespace IronIntel.Contractor.MapView
|
||||
}
|
||||
|
||||
var client = FleetServiceClientHelper.CreateClient<MapViewQueryClient>(companyid, sessionid);
|
||||
AssetMapViewPinItem[] assets = client.GetAssets(companyid, useriid, qp);
|
||||
return assets;
|
||||
//List<AssetViewItem> result = new List<AssetViewItem>();
|
||||
//foreach (var a in assets)
|
||||
//{
|
||||
// AssetViewItem avi = new AssetViewItem();
|
||||
// Helper.CloneProperty(avi, a);
|
||||
// result.Add(avi);
|
||||
//}
|
||||
//return result.ToArray();
|
||||
AssetMapViewPinItem[] assets = client.GetAssets(companyid, useriid, qp, attachment);
|
||||
List<AssetMapViewPinItemClient> result = new List<AssetMapViewPinItemClient>();
|
||||
foreach (var a in assets)
|
||||
{
|
||||
AssetMapViewPinItemClient avi = new AssetMapViewPinItemClient();
|
||||
Helper.CloneProperty(avi, a);
|
||||
result.Add(avi);
|
||||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取Dealer站点下多个Contractor机器列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static AssetMapViewPinItem[] GetDealerAssets(string sessionid, string companyids, string useriid, string filtertext, int onroad, MachineAlertViewQueryParameter param, bool IncludeNoLocation, int attachment)
|
||||
{
|
||||
string[] cids = null;
|
||||
if (!string.IsNullOrEmpty(companyids))
|
||||
cids = companyids.Split(',');
|
||||
|
||||
var contractors = SystemParams.GetContractors();
|
||||
if (cids == null || cids.Length == 0)
|
||||
cids = contractors.Select(c => c.ID).ToArray();
|
||||
|
||||
if (cids == null || cids.Length == 0)
|
||||
return new AssetMapViewPinItem[0];
|
||||
|
||||
int requestCount = 0;
|
||||
Exception lasterror = null;
|
||||
List<AssetMapViewPinItem> results = new List<AssetMapViewPinItem>();
|
||||
foreach (var cid in cids)
|
||||
{
|
||||
requestCount++;
|
||||
Thread th = new Thread((object state) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var assets = GetAssets(sessionid, cid, useriid, filtertext, onroad, param, IncludeNoLocation, attachment);
|
||||
lock (results)
|
||||
{
|
||||
foreach (var a in assets)
|
||||
{
|
||||
AssetMapViewPinItemClient asset = new AssetMapViewPinItemClient();
|
||||
Helper.CloneProperty(asset, a);
|
||||
var c = contractors.FirstOrDefault(t => t.ID.Equals(cid, StringComparison.OrdinalIgnoreCase));
|
||||
if (c != null)
|
||||
{
|
||||
asset.CompanyID = c.ID;
|
||||
asset.CompanyName = c.Name;
|
||||
}
|
||||
results.Add(asset);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
lasterror = ex;
|
||||
}
|
||||
requestCount--;
|
||||
});
|
||||
|
||||
th.Start();
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
if (requestCount == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lasterror != null)
|
||||
{
|
||||
throw lasterror;
|
||||
}
|
||||
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
public static AssetDetailViewItem GetAssetDetailItem(string sessionid, string companyid, long machineid, string datasource = null)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<AssetQueryClient>(companyid, sessionid);
|
||||
var locclient = FleetServiceClientHelper.CreateClient<AssetLocationQueryClient>(companyid, sessionid);
|
||||
var asset = client.GetAssetDetailInfo(companyid, machineid);
|
||||
var companyinfo = SystemParams.GetCustomerInfo(companyid);
|
||||
AssetDetailViewItem mi = new AssetDetailViewItem();
|
||||
if (companyinfo != null)
|
||||
{
|
||||
mi.CompanyID = companyinfo.ID;
|
||||
mi.CompanyName = companyinfo.Name;
|
||||
}
|
||||
mi.ID = asset.ID;
|
||||
mi.Name = asset.Name;
|
||||
mi.Name2 = asset.Name2;
|
||||
@ -67,6 +146,7 @@ namespace IronIntel.Contractor.MapView
|
||||
mi.IconUrl = asset.MapViewIconUrl;
|
||||
mi.AssetIconUrl = asset.AssetIconUrl;
|
||||
mi.Description = asset.Description;
|
||||
mi.DisplayName = asset.DisplayName;
|
||||
|
||||
if (asset.CurrentHours != null)
|
||||
{
|
||||
@ -79,7 +159,7 @@ namespace IronIntel.Contractor.MapView
|
||||
if (!string.IsNullOrWhiteSpace(datasource)
|
||||
&& (loc == null || string.Compare(datasource, loc.DataSource, true) != 0))
|
||||
{
|
||||
AssetLocationInfo[] locs = client.GetAssetCurrentLocation(companyid, machineid);
|
||||
AssetLocationInfo[] locs = locclient.GetAssetCurrentLocation(companyid, machineid);
|
||||
var tempLoc = locs.FirstOrDefault(l => string.Compare(datasource, l.DataSource, true) != 0);
|
||||
if (tempLoc != null)
|
||||
{
|
||||
@ -91,6 +171,8 @@ namespace IronIntel.Contractor.MapView
|
||||
mi.Location.PostedSpeed = tempLoc.PostedSpeedLimit;
|
||||
mi.Location.PostedSpeedUnit = tempLoc.SpeedLimitUnits;
|
||||
mi.Location.Street = tempLoc.Street;
|
||||
|
||||
//MapView页面 不会走此分支,所以暂时不用对DataSource/SubSource/EventType/MsgUID赋值
|
||||
}
|
||||
}
|
||||
else if (loc != null)
|
||||
@ -103,8 +185,19 @@ namespace IronIntel.Contractor.MapView
|
||||
mi.Location.PostedSpeed = loc.PostedSpeedLimit;
|
||||
mi.Location.PostedSpeedUnit = loc.SpeedLimitUnits;
|
||||
mi.Location.Street = loc.Street;
|
||||
|
||||
//当前位置没有LogID,通过DataSource/SubSource/EventType/MsgUID 来进行RequestVideo
|
||||
mi.Location.DataSource = loc.DataSource;
|
||||
mi.Location.SubSource = loc.SubSource;
|
||||
mi.Location.EventType = loc.EventType;
|
||||
mi.Location.MsgUID = loc.MsgUID;
|
||||
}
|
||||
|
||||
var assetDevices = client.GetPairedDevices(companyid, machineid);
|
||||
var device = assetDevices.FirstOrDefault(d => d.Source.Equals(Foresight.Fleet.Services.Device.DeviceInfo.DEVICESOURCE_SMARTWITNESS, StringComparison.OrdinalIgnoreCase)
|
||||
&& d.Status == 1);
|
||||
mi.Location.FromSmartWitness = device == null ? false : true;//11342 通过机器当前是否绑定SmartWitness来判断
|
||||
|
||||
if (asset.CurrentOdometer != null)
|
||||
{
|
||||
mi.Odometer = asset.CurrentOdometer.Corrected;
|
||||
@ -131,8 +224,75 @@ namespace IronIntel.Contractor.MapView
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static AssetGroupViewItem[] GetDealerAssetGroups(string sessionid, string companyids, string useriid, string searchtext)
|
||||
{
|
||||
string[] cids = null;
|
||||
if (!string.IsNullOrEmpty(companyids))
|
||||
cids = companyids.Split(',');
|
||||
|
||||
var contractors = SystemParams.GetContractors();
|
||||
if (cids == null || cids.Length == 0)
|
||||
cids = contractors.Select(c => c.ID).ToArray();
|
||||
|
||||
if (cids == null || cids.Length == 0)
|
||||
return new AssetGroupViewItem[0];
|
||||
|
||||
int requestCount = 0;
|
||||
Exception lasterror = null;
|
||||
List<AssetGroupViewItem> results = new List<AssetGroupViewItem>();
|
||||
foreach (var cid in cids)
|
||||
{
|
||||
requestCount++;
|
||||
Thread th = new Thread((object state) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var ags = GetAssetGroups(sessionid, cid, useriid, searchtext);
|
||||
lock (results)
|
||||
{
|
||||
foreach (var ag in ags)
|
||||
{
|
||||
var c = contractors.FirstOrDefault(t => t.ID.Equals(cid, StringComparison.OrdinalIgnoreCase));
|
||||
if (c != null)
|
||||
{
|
||||
ag.CompanyID = c.ID;
|
||||
ag.CompanyName = c.Name;
|
||||
}
|
||||
}
|
||||
results.AddRange(ags);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
lasterror = ex;
|
||||
}
|
||||
requestCount--;
|
||||
});
|
||||
|
||||
th.Start();
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
if (requestCount == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lasterror != null)
|
||||
{
|
||||
throw lasterror;
|
||||
}
|
||||
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
public static JobSiteViewItem[] GetJobsites(string sessionid, string companyid, string useriid, string searchtext)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
|
||||
var client = FleetServiceClientHelper.CreateClient<MapViewQueryClient>(companyid, sessionid);
|
||||
MapViewJobSiteInfo[] jss = client.GetAvailableJobSites(companyid, useriid, searchtext, false);
|
||||
|
||||
@ -146,8 +306,16 @@ namespace IronIntel.Contractor.MapView
|
||||
ajs.Longitude = js.Longitude;
|
||||
ajs.Radius = js.Radius;
|
||||
ajs.Radius_UOM = js.RadiusUOM;
|
||||
if (js.StartDate != null)
|
||||
ajs.StartDate = js.StartDate.Value;
|
||||
if (js.EndDate != null)
|
||||
ajs.EndDate = js.EndDate.Value;
|
||||
if (js.ProjectedEndDate != null)
|
||||
ajs.ProjectedEndDate = js.ProjectedEndDate.Value;
|
||||
|
||||
//ajs.Assets = js.Assets;
|
||||
|
||||
ajs.ColorString = js.Color;
|
||||
System.Drawing.Color color = System.Drawing.Color.Orange;
|
||||
try
|
||||
{
|
||||
@ -167,58 +335,90 @@ namespace IronIntel.Contractor.MapView
|
||||
ajs.Polygon = temp.ToArray();
|
||||
}
|
||||
ajs.Notes = js.Notes;
|
||||
ajs.Code = js.Code;
|
||||
ajs.RegionId = js.ReginId;
|
||||
ajs.Region = js.Region;
|
||||
ajs.Number = js.Number;
|
||||
ajs.Foreman = js.Foreman;
|
||||
ajs.Manager = js.Manager;
|
||||
ajs.Phone = js.Phone;
|
||||
ajs.Email = js.Email;
|
||||
ajs.Group = js.Group;
|
||||
ajs.Address1 = js.Address1;
|
||||
ajs.Address2 = js.Address2;
|
||||
ajs.City = js.City;
|
||||
ajs.State = js.State;
|
||||
ajs.Zip = js.Zip;
|
||||
ajs.County = js.County;
|
||||
ajs.BaseOnMachineID = js.BaseonMachineID;
|
||||
ajs.Types = new string[] { js.JobSiteTypes };
|
||||
list.Add(ajs);
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
private static Dictionary<string, List<MachineViewItem>> GetGroupAssets(string useriid, FISqlConnection db = null)
|
||||
public static JobSiteViewItem[] GetDealerJobsites(string sessionid, string companyids, string useriid, string searchtext)
|
||||
{
|
||||
const string SQL = @"if(select count(1) from USERMACHINEGROUPMAP where USERIID={0})=0
|
||||
select a.MACHINEID,a.GROUPID,b.VIN,b.MACHINENAME,b.MACHINENAME2 from MACHINEGROUPMAP a,MACHINES b where a.MACHINEID=b.MACHINEID and ISNULL(b.HIDE,0)=0
|
||||
else
|
||||
select a.MACHINEID,a.GROUPID,b.VIN,b.MACHINENAME,b.MACHINENAME2 from MACHINEGROUPMAP a,MACHINES b where a.MACHINEID=b.MACHINEID and ISNULL(b.HIDE,0)=0
|
||||
and b.MACHINEID in (select distinct MACHINEID from MACHINEGROUPMAP
|
||||
where GROUPID in (select GROUPID from USERMACHINEGROUPMAP where USERIID={0}))";
|
||||
string[] cids = null;
|
||||
if (!string.IsNullOrEmpty(companyids))
|
||||
cids = companyids.Split(',');
|
||||
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable dt = null;
|
||||
dt = db.GetDataTableBySQL(SQL, useriid);
|
||||
var contractors = SystemParams.GetContractors();
|
||||
if (cids == null || cids.Length == 0)
|
||||
cids = contractors.Select(c => c.ID).ToArray();
|
||||
|
||||
Dictionary<string, List<MachineViewItem>> result = new Dictionary<string, List<MachineViewItem>>(StringComparer.OrdinalIgnoreCase);
|
||||
if (dt.Rows.Count == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
MachineViewItem mi = new MachineViewItem();
|
||||
mi.ID = FIDbAccess.GetFieldInt64(dr["MACHINEID"], 0);
|
||||
mi.Name = FIDbAccess.GetFieldString(dr["MACHINENAME"], string.Empty);
|
||||
mi.Name2 = FIDbAccess.GetFieldString(dr["MACHINENAME2"], string.Empty);
|
||||
mi.VIN = FIDbAccess.GetFieldString(dr["VIN"], string.Empty);
|
||||
string groupID = FIDbAccess.GetFieldString(dr["GROUPID"], string.Empty);
|
||||
if (!result.ContainsKey(groupID))
|
||||
result[groupID] = new List<MachineViewItem>();
|
||||
result[groupID].Add(mi);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (cids == null || cids.Length == 0)
|
||||
return new JobSiteViewItem[0];
|
||||
|
||||
private static void ConvertSpeedUnitToMile(LocationViewItem loc)
|
||||
{
|
||||
if (loc == null) return;
|
||||
if (loc.Speed >= 0 && loc.SpeedUnit.StartsWith("K", StringComparison.OrdinalIgnoreCase))
|
||||
int requestCount = 0;
|
||||
Exception lasterror = null;
|
||||
List<JobSiteViewItem> results = new List<JobSiteViewItem>();
|
||||
foreach (var cid in cids)
|
||||
{
|
||||
loc.Speed = loc.Speed * 0.6213712;
|
||||
loc.SpeedUnit = "mi/h";
|
||||
requestCount++;
|
||||
Thread th = new Thread((object state) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var jss = GetJobsites(sessionid, cid, useriid, searchtext);
|
||||
lock (results)
|
||||
{
|
||||
foreach (var js in jss)
|
||||
{
|
||||
var c = contractors.FirstOrDefault(t => t.ID.Equals(cid, StringComparison.OrdinalIgnoreCase));
|
||||
if (c != null)
|
||||
{
|
||||
js.CompanyID = c.ID;
|
||||
js.CompanyName = c.Name;
|
||||
}
|
||||
}
|
||||
results.AddRange(jss);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
lasterror = ex;
|
||||
}
|
||||
requestCount--;
|
||||
});
|
||||
|
||||
th.Start();
|
||||
}
|
||||
if (loc.PostedSpeed > 0 && loc.PostedSpeedUnit.StartsWith("K", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
while (true)
|
||||
{
|
||||
loc.PostedSpeed = loc.PostedSpeed * 0.6213712;
|
||||
loc.PostedSpeedUnit = "mi/h";
|
||||
Thread.Sleep(10);
|
||||
if (requestCount == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lasterror != null)
|
||||
{
|
||||
throw lasterror;
|
||||
}
|
||||
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
public static AssetLocationHistoryViewItem GetMachineLocationHistory(string sessionid, string machineid, DateTime startTime, DateTime endTime, string companyid, bool notShow00loc, string datasource)
|
||||
@ -231,19 +431,24 @@ namespace IronIntel.Contractor.MapView
|
||||
//AssetViewItem ai = new AssetViewItem();
|
||||
//Helper.CloneProperty(ai, asset);
|
||||
|
||||
double timeOffset = SystemParams.GetHoursOffset();
|
||||
startTime = startTime.AddHours(-timeOffset);
|
||||
endTime = endTime.AddHours(-timeOffset);
|
||||
var assetDevices = client.GetPairedDevices(companyid, long.Parse(machineid));
|
||||
var device = assetDevices.FirstOrDefault(d => d.Source.Equals(Foresight.Fleet.Services.Device.DeviceInfo.DEVICESOURCE_SMARTWITNESS, StringComparison.OrdinalIgnoreCase)
|
||||
&& d.Status == 1);
|
||||
|
||||
AssetLocationInfo[] assetLocs = client.GetAssetBasicLocationHistory(companyid, long.Parse(machineid), startTime, endTime, datasource, "", !notShow00loc);
|
||||
var locclient = FleetServiceClientHelper.CreateClient<AssetLocationQueryClient>(companyid, sessionid);
|
||||
AssetLocationInfo[] assetLocs = locclient.GetAssetBasicLocationHistory(companyid, long.Parse(machineid), startTime, endTime, datasource, "", !notShow00loc);
|
||||
|
||||
List<LocationViewItem> ls = new List<LocationViewItem>();
|
||||
foreach (AssetLocationInfo assetLoc in assetLocs)
|
||||
{
|
||||
LocationViewItem li = new LocationViewItem();
|
||||
li.LogId = assetLoc.LogId;
|
||||
li.Latitude = assetLoc.Latitude;
|
||||
li.Longitude = assetLoc.Longitude;
|
||||
li.LocationTime = assetLoc.AsofTime.AddHours(timeOffset);
|
||||
li.LocationTime = assetLoc.AsofTimeLocal;
|
||||
|
||||
//历史位置通过Logid进行RequestVideo,无需对DataSource/SubSource/EventType/MsgUID 赋值
|
||||
li.LogId = assetLoc.LogId;
|
||||
|
||||
li.Speed = assetLoc.Speed;
|
||||
li.SpeedUnit = assetLoc.SpeedUnits;
|
||||
@ -252,10 +457,12 @@ namespace IronIntel.Contractor.MapView
|
||||
li.Street = assetLoc.Street;
|
||||
li.HarshDringEvent = assetLoc.HarshDringEvent;
|
||||
li.SpeedingBehavior = assetLoc.SpeedingBehavior;
|
||||
li.IconURL = GenerateLocationIconUrl(assetLoc);
|
||||
li.IconURL = GenerateLocationIconUrl(assetLoc, asset.OnRoad);
|
||||
li.SmartWitnessVideoUrl = assetLoc.SmartWitnessVideoUrl;
|
||||
|
||||
ConvertSpeedUnitToMile(li);
|
||||
li.FromSmartWitness = device == null ? false : true;//11342 通过机器当前是否绑定SmartWitness来判断
|
||||
|
||||
//ConvertSpeedUnitToMile(li);
|
||||
ls.Add(li);
|
||||
}
|
||||
AssetLocationHistoryViewItem al = new AssetLocationHistoryViewItem();
|
||||
@ -264,7 +471,7 @@ namespace IronIntel.Contractor.MapView
|
||||
return al;
|
||||
}
|
||||
|
||||
private static string GenerateLocationIconUrl(AssetLocationInfo loc)
|
||||
private static string GenerateLocationIconUrl(AssetLocationInfo loc, bool onRoad)
|
||||
{
|
||||
//http://iron.soft.rz/admin/machinetypeicon.ashx
|
||||
//http://iron.soft.rz/admin/machinemovingicon.ashx
|
||||
@ -272,26 +479,29 @@ namespace IronIntel.Contractor.MapView
|
||||
const string PARAM = "?tp={0}&bkcolor={1}&heading={2}";
|
||||
int tp = (int)HarshDrivingEvents.HardAccelerationEvent;
|
||||
string color = "";
|
||||
switch (loc.HarshDringEvent)
|
||||
if (onRoad)
|
||||
{
|
||||
case HarshDrivingEvents.None:
|
||||
break;
|
||||
case HarshDrivingEvents.HardAccelerationEvent:
|
||||
color = "#ff3f48cc";
|
||||
break;
|
||||
case HarshDrivingEvents.HardBrakeEvent:
|
||||
color = "#ff00a8f3";
|
||||
break;
|
||||
case HarshDrivingEvents.HardTurnEvent:
|
||||
color = "#fffff200";
|
||||
break;
|
||||
}
|
||||
if (string.IsNullOrEmpty(color))
|
||||
{
|
||||
if (loc.SpeedingBehavior == SpeedingBehaviors.MinorSpeeding)
|
||||
color = "#ffff7f27";
|
||||
else if (loc.SpeedingBehavior == SpeedingBehaviors.SevereSpeeding)
|
||||
color = "#ffec1c24";
|
||||
switch (loc.HarshDringEvent)
|
||||
{
|
||||
case HarshDrivingEvents.None:
|
||||
break;
|
||||
case HarshDrivingEvents.HardAccelerationEvent:
|
||||
color = "#ff3f48cc";
|
||||
break;
|
||||
case HarshDrivingEvents.HardBrakeEvent:
|
||||
color = "#ff00a8f3";
|
||||
break;
|
||||
case HarshDrivingEvents.HardTurnEvent:
|
||||
color = "#fffff200";
|
||||
break;
|
||||
}
|
||||
if (string.IsNullOrEmpty(color))
|
||||
{
|
||||
if (loc.SpeedingBehavior == SpeedingBehaviors.MinorSpeeding)
|
||||
color = "#ffff7f27";
|
||||
else if (loc.SpeedingBehavior == SpeedingBehaviors.SevereSpeeding)
|
||||
color = "#ffec1c24";
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(color))
|
||||
{
|
||||
@ -308,6 +518,10 @@ namespace IronIntel.Contractor.MapView
|
||||
return path + "?legend=StoppedOn";
|
||||
else if (loc.MoveStatus == AssetMoveStatus.StoppedOff)
|
||||
return path + "?legend=StoppedOff";
|
||||
else if (loc.MoveStatus == AssetMoveStatus.ConnectivityRecovery)
|
||||
return path + "?legend=CGAIN";
|
||||
else if (loc.MoveStatus == AssetMoveStatus.ConnectivityLose)
|
||||
return path + "?legend=CLOSS";
|
||||
}
|
||||
color = HttpUtility.UrlEncode(color);
|
||||
path = path + string.Format(PARAM, tp, color, loc.Heading);
|
||||
@ -359,7 +573,101 @@ namespace IronIntel.Contractor.MapView
|
||||
ls.Add(mi);
|
||||
}
|
||||
return ls.OrderBy((mal) => mal.Name).ToArray();
|
||||
}
|
||||
|
||||
public static MapAlertViewDefinitionItem[] GetDealerMapAlertViews(string sessionid, string companyids, string selectedViewID)
|
||||
{
|
||||
string[] cids = null;
|
||||
if (!string.IsNullOrEmpty(companyids))
|
||||
cids = companyids.Split(',');
|
||||
|
||||
var contractors = SystemParams.GetContractors();
|
||||
if (cids == null || cids.Length == 0)
|
||||
cids = contractors.Select(c => c.ID).ToArray();
|
||||
|
||||
if (cids == null || cids.Length == 0)
|
||||
return new MapAlertViewDefinitionItem[0];
|
||||
|
||||
int requestCount = 0;
|
||||
Exception lasterror = null;
|
||||
List<MapAlertViewDefinitionItem> results = new List<MapAlertViewDefinitionItem>();
|
||||
foreach (var cid in cids)
|
||||
{
|
||||
requestCount++;
|
||||
Thread th = new Thread((object state) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<MapViewQueryClient>(cid, sessionid);
|
||||
AlertViewMapItem[] views = client.GetAlertViewMapItems(cid);
|
||||
|
||||
AlertViewMapItem viewInfo = null;
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(selectedViewID))//获取View下使用的数据源信息
|
||||
viewInfo = client.GetAlertViewMapItem(cid, selectedViewID);
|
||||
}
|
||||
catch { }
|
||||
|
||||
string path = SystemParams.MachineTypeMapViewIconUrl;
|
||||
lock (results)
|
||||
{
|
||||
foreach (AlertViewMapItem ai in views)
|
||||
{
|
||||
MapAlertViewDefinitionItem mi = results.FirstOrDefault(r => r.ID.Equals(ai.ID, StringComparison.OrdinalIgnoreCase));
|
||||
if (mi == null)
|
||||
{
|
||||
mi = new MapAlertViewDefinitionItem();
|
||||
mi.ID = ai.ID;
|
||||
mi.Name = ai.Name;
|
||||
results.Add(mi);
|
||||
}
|
||||
|
||||
if (viewInfo != null && viewInfo.ID.Equals(mi.ID, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
mi.Layers = new MapAlertLayerDefinitionItem[viewInfo.Layers.Count];
|
||||
for (int i = 0; i < viewInfo.Layers.Count; i++)
|
||||
{
|
||||
var layer = viewInfo.Layers[i];
|
||||
mi.Layers[i] = new MapAlertLayerDefinitionItem();
|
||||
mi.Layers[i].ID = layer.LayerId;
|
||||
mi.Layers[i].Title = layer.Title;
|
||||
mi.Layers[i].LegendUrl = layer.LegendUrl;
|
||||
|
||||
if (layer.Pivots != null && layer.Pivots.Count > 0)
|
||||
mi.Layers[i].Pivots = ConvertPivotsDefine(layer.Pivots);
|
||||
}
|
||||
//mi.Layers = mi.Layers.OrderBy((l) => l.AlertLayerType).ToArray();
|
||||
var lookupData = ConvertLookupData(viewInfo.LookupDataSources);
|
||||
mi.LookupDataSources.AddRange(lookupData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
lasterror = ex;
|
||||
}
|
||||
requestCount--;
|
||||
});
|
||||
|
||||
th.Start();
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
if (requestCount == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lasterror != null)
|
||||
{
|
||||
throw lasterror;
|
||||
}
|
||||
|
||||
return results.OrderBy(r => r.Name).ToArray();
|
||||
}
|
||||
|
||||
private static List<LookupDataSourceDataItem> ConvertLookupData(List<LookupDataSourceData> data)
|
||||
@ -402,26 +710,194 @@ namespace IronIntel.Contractor.MapView
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static long[] GetNoGroupAssets(string companyid)
|
||||
/// <summary>
|
||||
/// 根据Contractorid获取Shape列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ShapeFileItem[] GetShapes(string sessionid, string companyid, string filtertext)
|
||||
{
|
||||
const string SQL = @"select b.MACHINEID from MACHINES b where not exists(select 1 from MACHINEGROUPMAP a where a.MACHINEID=b.MACHINEID) and isnull(b.HIDE,0)=0";
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
|
||||
string dbs = SystemParams.GetCompanyDbString(companyid);
|
||||
FISqlConnection db = new FISqlConnection(dbs);
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable dt = db.GetDataTableBySQL(SQL);
|
||||
ShapeFileInfo[] files = FleetServiceClientHelper.CreateClient<ShapeFileProvider>(companyid, sessionid).GetShapeFileInfos(companyid, filtertext);
|
||||
if (files == null || files.Length == 0)
|
||||
return new ShapeFileItem[0];
|
||||
|
||||
List<long> result = new List<long>();
|
||||
if (dt.Rows.Count == 0)
|
||||
List<ShapeFileItem> list = new List<ShapeFileItem>();
|
||||
foreach (ShapeFileInfo fi in files)
|
||||
{
|
||||
return new long[0];
|
||||
ShapeFileItem item = new ShapeFileItem();
|
||||
Helper.CloneProperty(item, fi);
|
||||
list.Add(item);
|
||||
}
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
return list.OrderBy(m => m.Name).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取Dealer站点下多个Contractor机器列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ShapeFileItem[] GetDealerShapes(string sessionid, string companyids, string filtertext)
|
||||
{
|
||||
string[] cids = null;
|
||||
if (!string.IsNullOrEmpty(companyids))
|
||||
cids = companyids.Split(',');
|
||||
|
||||
var contractors = SystemParams.GetContractors();
|
||||
if (cids == null || cids.Length == 0)
|
||||
cids = contractors.Select(c => c.ID).ToArray();
|
||||
|
||||
if (cids == null || cids.Length == 0)
|
||||
return new ShapeFileItem[0];
|
||||
|
||||
int requestCount = 0;
|
||||
Exception lasterror = null;
|
||||
List<ShapeFileItem> results = new List<ShapeFileItem>();
|
||||
foreach (var cid in cids)
|
||||
{
|
||||
result.Add(FIDbAccess.GetFieldInt64(dr["MACHINEID"], 0));
|
||||
requestCount++;
|
||||
Thread th = new Thread((object state) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
ShapeFileInfo[] files = FleetServiceClientHelper.CreateClient<ShapeFileProvider>(cid, sessionid).GetShapeFileInfos(cid, filtertext);
|
||||
lock (results)
|
||||
{
|
||||
foreach (ShapeFileInfo fi in files)
|
||||
{
|
||||
ShapeFileItem item = new ShapeFileItem();
|
||||
Helper.CloneProperty(item, fi);
|
||||
var c = contractors.FirstOrDefault(t => t.ID.Equals(cid, StringComparison.OrdinalIgnoreCase));
|
||||
if (c != null)
|
||||
{
|
||||
item.CompanyID = c.ID;
|
||||
item.CompanyName = c.Name;
|
||||
}
|
||||
results.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
lasterror = ex;
|
||||
}
|
||||
requestCount--;
|
||||
});
|
||||
|
||||
th.Start();
|
||||
}
|
||||
return result.ToArray();
|
||||
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
if (requestCount == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lasterror != null)
|
||||
{
|
||||
throw lasterror;
|
||||
}
|
||||
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据Contractorid获取Location列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static CompanyLocationViewItem[] GetLocations(string sessionid, string companyid)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
|
||||
var client = FleetServiceClientHelper.CreateClient<MapViewQueryClient>(companyid, sessionid);
|
||||
CustomerLocation[] locs = client.GetCompanyLocations(companyid);
|
||||
List<CompanyLocationViewItem> temps = new List<CompanyLocationViewItem>();
|
||||
foreach (var loc in locs)
|
||||
{
|
||||
CompanyLocationViewItem l = new CompanyLocationViewItem();
|
||||
l.ID = loc.ID;
|
||||
l.Latitude = loc.Latitude;
|
||||
l.Longitude = loc.Longitude;
|
||||
l.LocationName = loc.Name;
|
||||
l.Notes = loc.Notes;
|
||||
l.IconUrl = loc.IconUrl;
|
||||
temps.Add(l);
|
||||
}
|
||||
return temps.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取Dealer站点下多个Contractor机器列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static CompanyLocationViewItem[] GetDealerLocations(string sessionid, string companyids)
|
||||
{
|
||||
string[] cids = null;
|
||||
if (!string.IsNullOrEmpty(companyids))
|
||||
cids = companyids.Split(',');
|
||||
|
||||
var contractors = SystemParams.GetContractors();
|
||||
if (cids == null || cids.Length == 0)
|
||||
cids = contractors.Select(c => c.ID).ToArray();
|
||||
|
||||
if (cids == null || cids.Length == 0)
|
||||
return new CompanyLocationViewItem[0];
|
||||
|
||||
int requestCount = 0;
|
||||
Exception lasterror = null;
|
||||
List<CompanyLocationViewItem> results = new List<CompanyLocationViewItem>();
|
||||
foreach (var cid in cids)
|
||||
{
|
||||
requestCount++;
|
||||
Thread th = new Thread((object state) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<MapViewQueryClient>(cid, sessionid);
|
||||
CustomerLocation[] locs = client.GetCompanyLocations(cid);
|
||||
lock (results)
|
||||
{
|
||||
foreach (var loc in locs)
|
||||
{
|
||||
CompanyLocationViewItem l = new CompanyLocationViewItem();
|
||||
l.ID = loc.ID;
|
||||
l.Latitude = loc.Latitude;
|
||||
l.Longitude = loc.Longitude;
|
||||
l.LocationName = loc.Name;
|
||||
l.Notes = loc.Notes;
|
||||
l.IconUrl = loc.IconUrl;
|
||||
results.Add(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
lasterror = ex;
|
||||
}
|
||||
requestCount--;
|
||||
});
|
||||
|
||||
th.Start();
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
if (requestCount == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lasterror != null)
|
||||
{
|
||||
throw lasterror;
|
||||
}
|
||||
|
||||
return results.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,9 @@ namespace IronIntel.Contractor.MapView
|
||||
{
|
||||
public class AssetDetailViewItem
|
||||
{
|
||||
public string CompanyID { get; set; } = "";
|
||||
public string CompanyName { get; set; } = "";
|
||||
|
||||
private double _EngineHours;
|
||||
public double EngineHours
|
||||
{
|
||||
@ -64,6 +67,7 @@ namespace IronIntel.Contractor.MapView
|
||||
return "";
|
||||
}
|
||||
}
|
||||
public string DisplayName { get; set; }
|
||||
}
|
||||
|
||||
public class AssetLocationHistoryViewItem
|
||||
|
@ -1,125 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Foresight.Data;
|
||||
|
||||
namespace IronIntel.Contractor.MapView
|
||||
{
|
||||
public class JobManagement
|
||||
{
|
||||
public static JobSiteViewItem[] GetJobSite(string searchtext, int onroad, string companyid)
|
||||
{
|
||||
const string sql_1 = @"select JOBSITEID,JOBSITENAME,LATITUDE,LONGITUDE ,RADIUS,RADUIS_UOM,CONTRACTORID,COLOR,NOTES,STARTDATE,ENDDATE,POLYGON from JOBSITES where ENDDATE is null or ENDDATE>getdate() order by JOBSITENAME";
|
||||
const string sql_2 = @"select JOBSITEID,JOBSITENAME,LATITUDE,LONGITUDE ,RADIUS,RADUIS_UOM,CONTRACTORID,COLOR,NOTES,STARTDATE,ENDDATE,POLYGON from JOBSITES where (ENDDATE is null or ENDDATE>getdate()) and JOBSITENAME like {0} order by JOBSITENAME";
|
||||
|
||||
FISqlConnection db = SystemParams.GetCompanyDbConnection(companyid);
|
||||
if (db == null)
|
||||
{
|
||||
return new JobSiteViewItem[0];
|
||||
}
|
||||
DataTable dt = null;
|
||||
if (string.IsNullOrWhiteSpace(searchtext))
|
||||
{
|
||||
dt = db.GetDataTableBySQL(sql_1);
|
||||
}
|
||||
else
|
||||
{
|
||||
dt = db.GetDataTableBySQL(sql_2, "%" + searchtext + "%");
|
||||
}
|
||||
List<JobSiteViewItem> list = new List<JobSiteViewItem>();
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
JobSiteViewItem js = new JobSiteViewItem();
|
||||
long JobSiteId = FIDbAccess.GetFieldInt(dr["JOBSITEID"], 0);
|
||||
js.ID = FIDbAccess.GetFieldInt(dr["JOBSITEID"], 0);
|
||||
js.Name = FIDbAccess.GetFieldString(dr["JOBSITENAME"], string.Empty);
|
||||
js.Latitude = FIDbAccess.GetFieldDouble(dr["LATITUDE"], 0);
|
||||
js.Longitude = FIDbAccess.GetFieldDouble(dr["LONGITUDE"], 0);
|
||||
js.Radius = FIDbAccess.GetFieldDouble(dr["RADIUS"], 0);
|
||||
js.Radius_UOM = FIDbAccess.GetFieldString(dr["RADUIS_UOM"], string.Empty);
|
||||
if (string.IsNullOrWhiteSpace(js.Radius_UOM))
|
||||
js.Radius_UOM = "Mile";
|
||||
js.ContractorID = FIDbAccess.GetFieldString(dr["CONTRACTORID"], string.Empty);
|
||||
js.ColorString = FIDbAccess.GetFieldString(dr["COLOR"], string.Empty);
|
||||
System.Drawing.Color color = System.Drawing.Color.Orange;
|
||||
try
|
||||
{
|
||||
color = System.Drawing.ColorTranslator.FromHtml(js.ColorString);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
js.Color = new IIColor() { Alpha = color.A, Red = color.R, Green = color.G, Blue = color.B };
|
||||
|
||||
js.Notes = FIDbAccess.GetFieldString(dr["NOTES"], string.Empty);
|
||||
js.StartDate = FIDbAccess.GetFieldDateTime(dr["STARTDATE"], DateTime.MinValue);
|
||||
js.EndDate = FIDbAccess.GetFieldDateTime(dr["ENDDATE"], DateTime.MinValue);
|
||||
string polygon = FIDbAccess.GetFieldString(dr["POLYGON"], string.Empty);
|
||||
js.Polygon = ConvertPolygonToPointItem(polygon);
|
||||
MachineViewItem[] msiary = GetJobSiteMachines(JobSiteId, onroad, db);
|
||||
if (msiary.Count() > 0)
|
||||
{
|
||||
js.Machines = msiary.OrderBy((m) => m.VIN).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
js.Machines = null;
|
||||
}
|
||||
list.Add(js);
|
||||
}
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
private static MachineViewItem[] GetJobSiteMachines(long jobsiteid, int onroad, FISqlConnection db = null)
|
||||
{
|
||||
const string sql_m = @"select a.MACHINEID,b.VIN,b.MACHINENAME,b.MACHINENAME2,ONROAD from JOBSITEMACHINES a,MACHINES b where a.MACHINEID=b.MACHINEID and ISNULL(b.HIDE,0)=0 and a.JOBSITEID={0}";
|
||||
|
||||
if (db == null)
|
||||
db = SystemParams.GetDbInstance();
|
||||
DataTable dt = null;
|
||||
dt = db.GetDataTableBySQL(sql_m, jobsiteid);
|
||||
|
||||
if (dt.Rows.Count == 0)
|
||||
{
|
||||
return new MachineViewItem[0];
|
||||
}
|
||||
List<MachineViewItem> list = new List<MachineViewItem>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
MachineViewItem mi = new MachineViewItem();
|
||||
mi.ID = FIDbAccess.GetFieldInt64(dr["MACHINEID"], 0);
|
||||
mi.Name = FIDbAccess.GetFieldString(dr["MACHINENAME"], string.Empty);
|
||||
mi.Name2 = FIDbAccess.GetFieldString(dr["MACHINENAME2"], string.Empty);
|
||||
mi.VIN = FIDbAccess.GetFieldString(dr["VIN"], string.Empty);
|
||||
mi.Onroad = FIDbAccess.GetFieldInt(dr["ONROAD"], 0);
|
||||
if (onroad < 0 || onroad == mi.Onroad)
|
||||
list.Add(mi);
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
private static PostionItem[] ConvertPolygonToPointItem(string polygon)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(polygon))
|
||||
return null;
|
||||
|
||||
List<PostionItem> list = new List<PostionItem>();
|
||||
var polygons = polygon.Split(';');
|
||||
foreach (var py in polygons)
|
||||
{
|
||||
PostionItem pi = new PostionItem();
|
||||
var sap = py.Split(',');
|
||||
pi.Latitude = Convert.ToDouble(sap[0]);
|
||||
pi.Longitude = Convert.ToDouble(sap[1]);
|
||||
list.Add(pi);
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Foresight.Fleet.Services.Customer;
|
||||
using IronIntel.Services;
|
||||
using IronIntel.Services.Business.Admin;
|
||||
|
||||
namespace IronIntel.Contractor.MapView
|
||||
{
|
||||
public class LocationManagement
|
||||
{
|
||||
public static CompanyLocationViewItem[] GetCompanyLocations(string companyid)
|
||||
{
|
||||
List<CompanyLocationViewItem> ls = new List<CompanyLocationViewItem>();
|
||||
if (string.IsNullOrWhiteSpace(companyid) || string.Compare(companyid, SystemParams.CompanyID, true) == 0)
|
||||
{
|
||||
GetCompanyLocations(SystemParams.CompanyID, ls);
|
||||
if (!SystemParams.IsDealer)
|
||||
{
|
||||
Services.Customers.CustomerInfo dealer = SystemParams.GetFirstDealerInfo();
|
||||
if (dealer != null)
|
||||
{
|
||||
GetCompanyLocations(dealer.ID, ls);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ls.ToArray();
|
||||
}
|
||||
|
||||
private static void GetCompanyLocations(string companyid, List<CompanyLocationViewItem> ls)
|
||||
{
|
||||
CustomerLocation[] locations = FleetServiceClientHelper.CreateClient<CustomerProvider>(companyid, string.Empty).GetCustomerLocations(companyid);
|
||||
|
||||
foreach (CustomerLocation loc in locations)
|
||||
{
|
||||
ls.Add(ConvertToViewItem(loc, companyid));
|
||||
}
|
||||
}
|
||||
|
||||
private static CompanyLocationViewItem ConvertToViewItem(CustomerLocation loc, string companyid)
|
||||
{
|
||||
CompanyLocationViewItem li = new CompanyLocationViewItem();
|
||||
li.CompanyID = companyid;
|
||||
li.ID = loc.ID;
|
||||
li.LocationName = loc.Name;
|
||||
li.Latitude = loc.Latitude;
|
||||
li.Longitude = loc.Longitude;
|
||||
li.Notes = loc.Notes;
|
||||
|
||||
return li;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
using Foresight;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using IronIntel.Services.Common;
|
||||
using IronIntel.Services.MapView;
|
||||
using Foresight.Fleet.Services.JobSite;
|
||||
using Foresight.Fleet.Services.MapView;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -10,93 +10,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace IronIntel.Contractor.MapView
|
||||
{
|
||||
public class MachineViewItem
|
||||
{
|
||||
public string VIN { get; set; }
|
||||
public long ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Name2 { get; set; }
|
||||
public string IconUrl { get; set; }
|
||||
public string EmptyIconUrl { get; set; }//不包含机器图标
|
||||
public string MachineType { get; set; }
|
||||
public string Make { get; set; }
|
||||
public string Model { get; set; }
|
||||
public int MakeYear { get; set; }
|
||||
|
||||
private double _EngineHours;
|
||||
public double EngineHours
|
||||
{
|
||||
get
|
||||
{
|
||||
return _EngineHours;
|
||||
}
|
||||
set
|
||||
{
|
||||
value = value > 0 ? value : 0;
|
||||
_EngineHours = Math.Round(value, 2);
|
||||
}
|
||||
}
|
||||
public DateTime EngineHoursDate { get; set; }
|
||||
public int TypeID { get; set; }
|
||||
public string AlertTip { get; set; }
|
||||
public bool OnSite { get; set; }
|
||||
public string JobSiteName { get; set; }//当前所在的JobSiteName
|
||||
public double DistanceFromSite { get; set; }//机器与Jobsite之间的距离
|
||||
public bool WithinSite { get; set; }//机器是否在JobSite多边形范围内
|
||||
public LocationViewItem Location { get; set; }
|
||||
|
||||
private double _Odometer;
|
||||
public double Odometer
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Odometer;
|
||||
}
|
||||
set
|
||||
{
|
||||
value = value > 0 ? value : 0;
|
||||
_Odometer = Math.Round(value, 2);
|
||||
}
|
||||
}
|
||||
public string OdometerUOM { get; set; }
|
||||
public int Onroad { get; set; }
|
||||
public string IconFileName { get; set; }
|
||||
public string MoveStatus { get; set; }
|
||||
public int Directionalheading { get; set; }
|
||||
public int MapAlertLayerPriority { get; set; }
|
||||
public Int64 GpsDeviceID { get; set; } //空 -1
|
||||
public string AssetGroupNames { get; set; }
|
||||
public string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
//Name取值顺序为Name2,Name,VIN,ID用于前端显示
|
||||
string name = Name2;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
name = Name;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
name = VIN;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
name = ID.ToString();
|
||||
return name;
|
||||
}
|
||||
}//由于地图显示及排序的名称
|
||||
|
||||
public string EngineHoursDateText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (EngineHoursDate != DateTime.MinValue)
|
||||
{
|
||||
return EngineHoursDate.ToString();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class JobSiteViewItem
|
||||
{
|
||||
public string CompanyID { get; set; } = "";
|
||||
public string CompanyName { get; set; } = "";
|
||||
|
||||
public Int64 ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string[] Types { get; set; }
|
||||
@ -109,14 +27,30 @@ namespace IronIntel.Contractor.MapView
|
||||
public IIColor Color { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public DateTime StartDate { get; set; }
|
||||
public DateTime ProjectedEndDate { get; set; }
|
||||
public DateTime EndDate { get; set; }
|
||||
public PostionItem[] Polygon { get; set; }
|
||||
public Int64 BaseOnMachineID { get; set; }
|
||||
public string BaseonMachineName { get; set; }
|
||||
public string Code { get; set; }
|
||||
public long[] Assets { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
public int RegionId { get; set; }
|
||||
public string Region { get; set; }
|
||||
public string Number { get; set; }
|
||||
public string Foreman { get; set; }
|
||||
public string Manager { get; set; }
|
||||
public string Phone { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string Group { get; set; }
|
||||
public string Address1 { get; set; }
|
||||
public string Address2 { get; set; }
|
||||
public string City { get; set; }
|
||||
public string State { get; set; }
|
||||
public string Zip { get; set; }
|
||||
public string County { get; set; }
|
||||
|
||||
public string strStartDate
|
||||
public string StartDateStr
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -133,7 +67,7 @@ namespace IronIntel.Contractor.MapView
|
||||
|
||||
|
||||
|
||||
public string strEndDate
|
||||
public string EndDateStr
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -147,12 +81,50 @@ namespace IronIntel.Contractor.MapView
|
||||
}
|
||||
}
|
||||
}
|
||||
public string ProjectedEndDateStr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ProjectedEndDate == DateTime.MinValue)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
return ProjectedEndDate.ToShortDateString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MachineViewItem[] Machines { get; set; }
|
||||
public string RadiusStr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Radius > 0)
|
||||
{
|
||||
return Radius + " " + Radius_UOM + "(s)";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public JobSiteAssetItem[] Machines { get; set; }
|
||||
}
|
||||
|
||||
public class AssetMapViewPinItemClient : AssetMapViewPinItem
|
||||
{
|
||||
public string CompanyID { get; set; } = "";
|
||||
|
||||
public string CompanyName { get; set; } = "";
|
||||
}
|
||||
|
||||
public class AssetGroupViewItem
|
||||
{
|
||||
public string CompanyID { get; set; } = "";
|
||||
public string CompanyName { get; set; } = "";
|
||||
public string ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public long[] Assets { get; set; }
|
||||
@ -161,7 +133,7 @@ namespace IronIntel.Contractor.MapView
|
||||
public class CompanyLocationViewItem
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string CompanyID { get; set; }
|
||||
public string CompanyID { get; set; } = "";
|
||||
public double Latitude { get; set; }
|
||||
public double Longitude { get; set; }
|
||||
public string LocationName { get; set; }
|
||||
@ -174,7 +146,7 @@ namespace IronIntel.Contractor.MapView
|
||||
public string ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public MapAlertLayerDefinitionItem[] Layers { get; set; }
|
||||
public List<LookupDataSourceDataItem> LookupDataSources { get; set; }
|
||||
public List<LookupDataSourceDataItem> LookupDataSources { get; set; } = new List<LookupDataSourceDataItem>();
|
||||
}
|
||||
|
||||
public class LookupDataSourceDataItem
|
||||
@ -231,6 +203,7 @@ namespace IronIntel.Contractor.MapView
|
||||
|
||||
public class LocationViewItem
|
||||
{
|
||||
public long LogId { get; set; }
|
||||
public double Latitude { get; set; }
|
||||
public double Longitude { get; set; }
|
||||
public DateTime LocationTime { get; set; }
|
||||
@ -245,6 +218,11 @@ namespace IronIntel.Contractor.MapView
|
||||
return "";
|
||||
}
|
||||
}
|
||||
public string DataSource { get; set; }
|
||||
public string SubSource { get; set; }
|
||||
public string EventType { get; set; } = string.Empty;
|
||||
public string MsgUID { get; set; } = string.Empty;
|
||||
|
||||
public double Speed { get; set; } = -1;
|
||||
public string SpeedUnit { get; set; }
|
||||
public double PostedSpeed { get; set; } = -1;
|
||||
@ -254,29 +232,15 @@ namespace IronIntel.Contractor.MapView
|
||||
public List<KeyValuePair<string, string>> SmartWitnessVideoUrl { get; set; }
|
||||
public SpeedingBehaviors SpeedingBehavior { get; set; }
|
||||
public HarshDrivingEvents HarshDringEvent { get; set; }
|
||||
public bool FromSmartWitness { get; set; }
|
||||
}
|
||||
|
||||
public class MachineLocationHistoryViewItem
|
||||
{
|
||||
public MachineViewItem Machine { get; set; }
|
||||
public LocationViewItem[] Locations { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class MachineTypeItem
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 供JobSite选中的Mahcine
|
||||
/// </summary>
|
||||
public class AvailableMachines
|
||||
{
|
||||
public MachineViewItem[] Assigned { get; set; }
|
||||
public MachineViewItem[] Unassigned { get; set; }
|
||||
}
|
||||
public struct PostionItem
|
||||
{
|
||||
public double Latitude;
|
||||
@ -291,8 +255,11 @@ namespace IronIntel.Contractor.MapView
|
||||
|
||||
public class ShapeFileItem
|
||||
{
|
||||
public string CompanyID { get; set; } = "";
|
||||
public string CompanyName { get; set; } = "";
|
||||
public long ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public string FileName { get; set; }
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,8 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using IronIntel.Services;
|
||||
using IronIntel.Contractor.Users;
|
||||
using IronIntel.Services.MapView;
|
||||
using IronIntel.Services.Customers;
|
||||
using Foresight.Fleet.Services.Customer;
|
||||
|
||||
namespace IronIntel.Contractor.MapView
|
||||
{
|
||||
|
Reference in New Issue
Block a user