.
This commit is contained in:
@ -32,16 +32,15 @@ namespace IronIntel.Contractor.MapView
|
||||
qp.FilterString = filtertext;
|
||||
qp.OnRoad = onroad;
|
||||
qp.IncludeNoLocation = IncludeNoLocation;
|
||||
qp.IncludeAssetGroups = true;
|
||||
qp.IncludeJobSites = true;
|
||||
if (param != null)
|
||||
{
|
||||
qp.ViewId = param.ViewID;
|
||||
qp.AlertViewQueryParam = param;
|
||||
}
|
||||
qp.Attachment = attachment;
|
||||
|
||||
var client = FleetServiceClientHelper.CreateClient<MapViewQueryClient>(companyid, sessionid);
|
||||
AssetMapViewPinItem[] assets = client.GetAssets(companyid, useriid, qp, attachment);
|
||||
AssetMapViewPinItem[] assets = client.GetAssets(companyid, useriid, qp);
|
||||
List<AssetMapViewPinItemClient> result = new List<AssetMapViewPinItemClient>();
|
||||
foreach (var a in assets)
|
||||
{
|
||||
@ -122,6 +121,94 @@ namespace IronIntel.Contractor.MapView
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Contractorid获取机器基础信息列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static MapViewAssetItem[] GetAssetBasicInfos(string sessionid, string companyid, string useriid)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
|
||||
var client = FleetServiceClientHelper.CreateClient<MapViewQueryClient>(companyid, sessionid);
|
||||
MapViewAssetItem[] assets = client.GetAvailableAssetItems(companyid, useriid);
|
||||
return assets.OrderBy(a => a.Id).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取Dealer站点下多个Contractor机器几次信息列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static MapViewAssetItem[] GetDealerAssetBasicInfos(string sessionid, string companyids, string useriid)
|
||||
{
|
||||
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 MapViewAssetItem[0];
|
||||
|
||||
int requestCount = 0;
|
||||
Exception lasterror = null;
|
||||
List<MapViewAssetItem> results = new List<MapViewAssetItem>();
|
||||
foreach (var cid in cids)
|
||||
{
|
||||
requestCount++;
|
||||
Thread th = new Thread((object state) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var assets = GetAssetBasicInfos(sessionid, cid, useriid);
|
||||
lock (results)
|
||||
{
|
||||
results.AddRange(assets);
|
||||
}
|
||||
}
|
||||
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(a => a.Id).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据机器ID获取机器基础信息列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static MapViewAssetItem[] GetAssetItemsByAssets(string sessionid, string companyid, string useriid, long[] assetids)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
|
||||
var client = FleetServiceClientHelper.CreateClient<MapViewQueryClient>(companyid, sessionid);
|
||||
MapViewAssetItem[] assets = client.GetAssetItemsByAssets(companyid, useriid, assetids);
|
||||
return assets.OrderBy(a => a.Id).ToArray();
|
||||
}
|
||||
|
||||
|
||||
public static AssetDetailViewItem GetAssetDetailItem(string sessionid, string companyid, long machineid, string datasource = null)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<AssetQueryClient>(companyid, sessionid);
|
||||
|
Reference in New Issue
Block a user