sync
This commit is contained in:
@ -1,46 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="DbConntionString" value="Data Source=192.168.25.215\ironintel;Initial Catalog=FORESIGHT_FLV_IICON004;Integrated Security=false;User ID=fi;Password=database" />
|
||||
<add key="JRE_IronIntelDb" value="Data Source=192.168.25.215\ironintel;Initial Catalog=JRE_IRONINTEL;Integrated Security=false;User ID=fi;Password=database" />
|
||||
<add key="ClientSettingsProvider.ServiceUri" value="" />
|
||||
<add key="DbConntionString" value="Data Source=192.168.25.215\ironintel;Initial Catalog=IRONINTEL_IRONDEV;Integrated Security=false;User ID=fi;Password=database"/>
|
||||
<add key="JRE_IronIntelDb" value="Data Source=192.168.25.215\ironintel;Initial Catalog=JRE_IRONINTEL;Integrated Security=false;User ID=fi;Password=database"/>
|
||||
<add key="ClientSettingsProvider.ServiceUri" value=""/>
|
||||
</appSettings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
</startup>
|
||||
<system.web>
|
||||
<membership defaultProvider="ClientAuthenticationMembershipProvider">
|
||||
<providers>
|
||||
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
|
||||
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/>
|
||||
</providers>
|
||||
</membership>
|
||||
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
|
||||
<providers>
|
||||
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
|
||||
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/>
|
||||
</providers>
|
||||
</roleManager>
|
||||
</system.web>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Data.SqlClient" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.6.1.1" newVersion="4.6.1.1" />
|
||||
<assemblyIdentity name="System.Data.SqlClient" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.6.1.1" newVersion="4.6.1.1"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
@ -3,94 +3,91 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Foresight.Cache;
|
||||
using Foresight.Service.Cache;
|
||||
using Foresight.Fleet.Services.SystemOption;
|
||||
using Foresight.Fleet.Services;
|
||||
using Foresight.Fleet.Services.Customer;
|
||||
|
||||
namespace IronIntel.Contractor
|
||||
{
|
||||
public static class CacheManager
|
||||
{
|
||||
private static CacheClient _Client = null;
|
||||
private static object _sycobj = new object();
|
||||
|
||||
private static CacheClient CreateRedisClient()
|
||||
private static string CacheRegion
|
||||
{
|
||||
string[] servers = FleetServiceClientHelper.CreateClient<SystemOptionProvider>().GetCacheServiceAddress(SystemParams.CompanyID);
|
||||
if ((servers == null) || (servers.Length == 0))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new CacheClient("IRONINTEL_" + SystemParams.CompanyID.ToUpper(), servers);
|
||||
}
|
||||
}
|
||||
|
||||
private static CacheClient Client
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Client == null)
|
||||
{
|
||||
lock (_sycobj)
|
||||
{
|
||||
if (_Client == null)
|
||||
{
|
||||
_Client = CreateRedisClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
return _Client;
|
||||
}
|
||||
get { return "FLEET_" + SystemParams.CompanyID.ToUpper(); }
|
||||
}
|
||||
|
||||
public static void Remove(string key)
|
||||
{
|
||||
if (Client != null)
|
||||
var client = FleetServiceClientHelper.CreateClient<SystemUtil>();
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
Client.Remove(key);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
client.RemoveCache(CacheRegion, key);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
public static void SetValue(string key, byte[] buffer, TimeSpan expire)
|
||||
{
|
||||
if (buffer == null)
|
||||
var client = FleetServiceClientHelper.CreateClient<SystemUtil>();
|
||||
try
|
||||
{
|
||||
Remove(key);
|
||||
}
|
||||
else if (Client != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Client.SetValue(key, buffer, expire);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
client.SetCache(CacheRegion, key, buffer, (int)expire.TotalSeconds);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
public static byte[] GetValue(string key)
|
||||
{
|
||||
if (Client != null)
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
return Client.GetValue(key);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var client = FleetServiceClientHelper.CreateClient<SystemUtil>();
|
||||
return client.GetCache(CacheRegion, key);
|
||||
}
|
||||
else
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void RemoveCustomerCache(string key)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<CustomerProvider>();
|
||||
try
|
||||
{
|
||||
client.RemoveCustomerCacheData(SystemParams.CompanyID, key);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
public static void SetCustomerCacheData(string key, byte[] buffer, TimeSpan expire)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<CustomerProvider>();
|
||||
try
|
||||
{
|
||||
client.SetCustomerCacheData(SystemParams.CompanyID, key, buffer);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
public static byte[] GetCustomerCacheData(string key)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<CustomerProvider>();
|
||||
return client.GetCustomerCacheData(SystemParams.CompanyID, key);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>IronIntel.Contractor</RootNamespace>
|
||||
<AssemblyName>iicontractorbl</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
@ -31,7 +31,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>LHBIS.snk</AssemblyOriginatorKeyFile>
|
||||
@ -69,12 +69,6 @@
|
||||
<Reference Include="FIWinLib">
|
||||
<HintPath>..\Reflib\FIWinLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Foresight.Service.Client">
|
||||
<HintPath>..\Reflib\Foresight.Service.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Foresight.ServiceModel">
|
||||
<HintPath>..\Reflib\Foresight.ServiceModel.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="irondbobjlib">
|
||||
<HintPath>..\Reflib\irondbobjlib.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -411,7 +411,7 @@ namespace IronIntel.Contractor
|
||||
CacheManager.SetValue(key, tmp, TimeSpan.FromSeconds(expirationsecond));
|
||||
}
|
||||
|
||||
public void SetCacheDataTable(string key, DataTable dt, int expirationsecond, bool slidingExpiration, DateTime createTime)
|
||||
public void SetCacheDataTable(string key, string datatableIID, DataTable dt, int expirationsecond, bool slidingExpiration, DateTime createTime)
|
||||
{
|
||||
if (dt == null)
|
||||
{
|
||||
@ -757,6 +757,64 @@ namespace IronIntel.Contractor
|
||||
client.DocumentExportAuditTrail(SystemParams.CompanyID, useriid, doctype, docid, notes, filename, filetype, filedata);
|
||||
}
|
||||
|
||||
private static bool IsValidPhoneNumber(string number)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(number))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string s1 = number.Replace(" ", string.Empty)
|
||||
.Replace("(", string.Empty)
|
||||
.Replace(")", string.Empty)
|
||||
.Replace("-", string.Empty);
|
||||
|
||||
if(string.IsNullOrWhiteSpace(s1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (char c in s1)
|
||||
{
|
||||
if (c < '0' || c > '9')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public long SendSMS(string source, string sourceid, string sendingnumber, string receiverphonenumber, string message, string sender)
|
||||
{
|
||||
if(!IsValidPhoneNumber(sendingnumber))
|
||||
{
|
||||
throw new Exception("Invalid phone number: " + sendingnumber);
|
||||
}
|
||||
if(!IsValidPhoneNumber(receiverphonenumber))
|
||||
{
|
||||
throw new Exception("Invalid phone number: " + receiverphonenumber);
|
||||
}
|
||||
var client = FleetServiceClientHelper.CreateClient<SystemUtil>();
|
||||
return client.SendSMS(SystemParams.CompanyID, source, sourceid, sendingnumber, receiverphonenumber, message, sender);
|
||||
}
|
||||
|
||||
public int GetSMSStatus(long smsid)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<SystemUtil>();
|
||||
return client.GetSMSStatus(SystemParams.CompanyID, smsid);
|
||||
}
|
||||
|
||||
public long SendEMail(MailMessage message)
|
||||
{
|
||||
return SystemParams.SendMail(message);
|
||||
}
|
||||
|
||||
public int GetEmailStatus(long mailid)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<SystemUtil>();
|
||||
return client.GetEmailStatus(SystemParams.CompanyID, mailid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -65,6 +66,7 @@ namespace IronIntel.Contractor.Machines
|
||||
/// 前端选择的时区的分钟偏移
|
||||
/// </summary>
|
||||
public int OffsetMinute { get; set; }
|
||||
public string TimeZone { get; set; }
|
||||
public string DataSource { get; set; }
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using DocumentFormat.OpenXml.Office2010.CustomUI;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.ServiceModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -8,78 +9,24 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace IronIntel.Contractor.Machines
|
||||
{
|
||||
public class AssetBasicItem
|
||||
public class AssetBasicItem : AssetBasicInfo
|
||||
{
|
||||
public long ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Name2 { get; set; }
|
||||
public string MakeName { get; set; }
|
||||
public string ModelName { get; set; }
|
||||
|
||||
private double _EngineHours;
|
||||
public double EngineHours
|
||||
{
|
||||
get
|
||||
{
|
||||
return _EngineHours;
|
||||
}
|
||||
set
|
||||
{
|
||||
value = value > 0 ? value : 0;
|
||||
_EngineHours = Math.Round(value, 2);
|
||||
}
|
||||
}
|
||||
|
||||
public string CalampDeviceAirID { get; set; }//PairedDeviceSN
|
||||
public bool TelematicsEnabled { get; set; }
|
||||
public bool Hide { get; set; }
|
||||
public bool OnRoad { get; set; }
|
||||
public bool Attachment { get; set; }
|
||||
|
||||
public bool Preloaded { get; set; }
|
||||
public int MakeYear { get; set; }
|
||||
public string DealerID { get; set; }
|
||||
public string Dealer { get; set; }
|
||||
public string ContractorID { get; set; }
|
||||
public string Contractor { get; set; }
|
||||
public string TypeName { get; set; }
|
||||
public int ModelID { get; set; }
|
||||
public int TypeID { get; set; }
|
||||
public int MakeID { get; set; }
|
||||
public string VIN { get; set; }
|
||||
public DateTime? EngineHoursDate { get; set; }
|
||||
public AssetShareStatus ShareStatus { get; set; }
|
||||
public DateTime? AddedTime { get; set; }
|
||||
public DateTime? AddedLocalTime { get; set; }
|
||||
|
||||
public double Odometer;
|
||||
public string OdometerUOM { get; set; }
|
||||
public DateTime? OdometerDate { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string AcquisitionType { get; set; }
|
||||
public string PMPlans { get; set; }
|
||||
public string AssetGroups { get; set; }
|
||||
public string Jobsites { get; set; }
|
||||
public AssetCustomStatus CustomStatus { get; set; }
|
||||
public string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
//DisplayName取值顺序为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;
|
||||
}
|
||||
}
|
||||
private const char SPLITCHAR = (char)175;
|
||||
public string AddedTimeStr { get { return (AddedLocalTime == null || AddedLocalTime.Value <= Helper.DBMinDateTime) ? "" : AddedLocalTime.Value.ToShortDateString(); } }
|
||||
public string EngineHoursDateStr { get { return (EngineHoursDate == null || EngineHoursDate.Value <= Helper.DBMinDateTime) ? "" : EngineHoursDate.Value.ToShortDateString(); } }
|
||||
public string EngineHoursDateTimeStr { get { return (EngineHoursDate == null || EngineHoursDate.Value <= Helper.DBMinDateTime) ? "" : EngineHoursDate.Value.ToString(); } }
|
||||
public string OdometerDateStr { get { return (OdometerDate == null || OdometerDate.Value <= Helper.DBMinDateTime) ? "" : OdometerDate.Value.ToShortDateString(); } }
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(base.ToString());
|
||||
sb.Append(SPLITCHAR + AddedTimeStr);
|
||||
sb.Append(SPLITCHAR + EngineHoursDateStr);
|
||||
sb.Append(SPLITCHAR + EngineHoursDateTimeStr);
|
||||
sb.Append(SPLITCHAR + OdometerDateStr);
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -80,6 +80,7 @@ namespace IronIntel.Contractor.Machines
|
||||
/// 前端选择的时区的分钟偏移
|
||||
/// </summary>
|
||||
public int OffsetMinute { get; set; }
|
||||
public string TimeZone { get; set; }
|
||||
public string DataSource { get; set; }
|
||||
}
|
||||
public class CalampOdometerInfo
|
||||
|
@ -1,6 +1,8 @@
|
||||
using Foresight.Fleet.Services.AssetHealth;
|
||||
using Foresight.Standard;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -9,8 +11,11 @@ namespace IronIntel.Contractor.Maintenance
|
||||
{
|
||||
public class AlertInfo
|
||||
{
|
||||
private const char SPLITCHAR = (char)175;
|
||||
private const char SPLITCHAR1 = (char)181;
|
||||
public long AlertID { get; set; }
|
||||
public long WorkOrderID { get; set; }
|
||||
public string WorkOrderNumber { get; set; }
|
||||
public string WorkOrderStatus { get; set; }
|
||||
public string AlertType { get; set; }
|
||||
public DateTime AlertTime_UTC { get; set; }
|
||||
@ -82,10 +87,64 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public string AcknowledgedTime_LocalStr { get { return AcknowledgedTime_Local == DateTime.MinValue ? "" : AcknowledgedTime_Local.ToString(); } }
|
||||
|
||||
public string AcknowledgedComment { get; set; }
|
||||
public string Comment { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
TextableDTO.Append(sb, AlertID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, WorkOrderID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, WorkOrderStatus);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AlertType);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AlertTime_UTC);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AlertTime_UTCStr);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AlertLocalTime);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AlertLocalTimeStr);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Completed ? "1" : "0");
|
||||
TextableDTO.Append(sb, SPLITCHAR, MachineID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, ModelID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Model);
|
||||
TextableDTO.Append(sb, SPLITCHAR, MakeID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Make);
|
||||
TextableDTO.Append(sb, SPLITCHAR, VIN);
|
||||
TextableDTO.Append(sb, SPLITCHAR, MachineName);
|
||||
TextableDTO.Append(sb, SPLITCHAR, EngineHours);
|
||||
TextableDTO.Append(sb, SPLITCHAR, CurrentHours);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Description);
|
||||
TextableDTO.Append(sb, SPLITCHAR, ServiceDescription);
|
||||
TextableDTO.Append(sb, SPLITCHAR, ScheduleID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, IntervalID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Recurring ? "1" : "0");
|
||||
TextableDTO.Append(sb, SPLITCHAR, Priority);
|
||||
TextableDTO.Append(sb, SPLITCHAR, ExpectedCost);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AlertCount);
|
||||
if (RepeatedAlerts != null && RepeatedAlerts.Count > 0)
|
||||
{
|
||||
string repeatedalertsstr = string.Join(SPLITCHAR1.ToString(), RepeatedAlerts);
|
||||
TextableDTO.Append(sb, SPLITCHAR, repeatedalertsstr);
|
||||
}
|
||||
else
|
||||
TextableDTO.Append(sb, SPLITCHAR, "");
|
||||
TextableDTO.Append(sb, SPLITCHAR, OpenWorkOrderCount);
|
||||
TextableDTO.Append(sb, SPLITCHAR, PMType);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AcknowledgedBy);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AcknowledgedByName);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AcknowledgedTime_UTC);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AcknowledgedTime_UTCStr);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AcknowledgedTime_Local);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AcknowledgedTime_LocalStr);
|
||||
TextableDTO.Append(sb, SPLITCHAR, AcknowledgedComment);
|
||||
TextableDTO.Append(sb, SPLITCHAR, WorkOrderNumber);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Comment);
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public class MachineInfoForAlert
|
||||
{
|
||||
private const char SPLITCHAR = (char)182;
|
||||
private const char SPLITCHAR1 = (char)180;
|
||||
public long MachineID { get; set; }
|
||||
public string VIN { get; set; }
|
||||
public string MachineName { get; set; }
|
||||
@ -113,6 +172,39 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public string LatestAlertDateTimeStr { get { return LatestAlertDateTime == DateTime.MinValue ? "" : LatestAlertDateTime.ToString(); } }
|
||||
|
||||
public List<AlertInfo> Alerts { get; } = new List<AlertInfo>();
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
TextableDTO.Append(sb, MachineID);
|
||||
TextableDTO.Append(sb, SPLITCHAR, VIN);
|
||||
TextableDTO.Append(sb, SPLITCHAR, MachineName);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Make);
|
||||
TextableDTO.Append(sb, SPLITCHAR, Model);
|
||||
TextableDTO.Append(sb, SPLITCHAR, EngineHours);
|
||||
TextableDTO.Append(sb, SPLITCHAR, DTCAlertCount);
|
||||
TextableDTO.Append(sb, SPLITCHAR, PMAlertCount);
|
||||
TextableDTO.Append(sb, SPLITCHAR, InspectAlertCount);
|
||||
TextableDTO.Append(sb, SPLITCHAR, OpenWorkOrders);
|
||||
TextableDTO.Append(sb, SPLITCHAR, LatestAlertDateTime);
|
||||
TextableDTO.Append(sb, SPLITCHAR, LatestAlertDateTimeStr);
|
||||
if (Alerts != null && Alerts.Count > 0)
|
||||
{
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
foreach (AlertInfo ai in Alerts)
|
||||
{
|
||||
if (sb1.Length > 0)
|
||||
sb1.Append(SPLITCHAR1 + ai.ToString());
|
||||
else
|
||||
sb1.Append(ai.ToString());
|
||||
}
|
||||
TextableDTO.Append(sb, SPLITCHAR, sb1.ToString());
|
||||
}
|
||||
else
|
||||
TextableDTO.Append(sb, SPLITCHAR, "");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public class AssetAlertInfo
|
||||
|
@ -17,26 +17,10 @@ namespace IronIntel.Contractor.Maintenance
|
||||
{
|
||||
}
|
||||
|
||||
public StringKeyValue[] GetAlertTypes()
|
||||
{
|
||||
const string SQL = "select distinct ltrim(rtrim(ALERTTYPE)) as ALERTTYPE from ALERTS with(nolock) where ISNULL(ALERTTYPE,'')<>''";
|
||||
DataTable tb = GetDataTableBySQL(SQL);
|
||||
if (tb.Rows.Count == 0)
|
||||
{
|
||||
return new StringKeyValue[0];
|
||||
}
|
||||
List<StringKeyValue> list = new List<StringKeyValue>();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
string type = FIDbAccess.GetFieldString(dr["ALERTTYPE"], string.Empty);
|
||||
StringKeyValue kv = new StringKeyValue();
|
||||
kv.Key = type;
|
||||
kv.Value = type;
|
||||
list.Add(kv);
|
||||
}
|
||||
return list.OrderBy(t => t.Key).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据WorkorderId获取Alert列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public AlertInfo[] GetAlertsByWorkOrder(long workorderid, Foresight.Fleet.Services.User.UserInfo user)
|
||||
{
|
||||
const string SQL = @"select a.ALERTID,ALERTTYPE,a.ALERTTIME_UTC,COMPLETED,a.MACHINEID,a.VIN,a.MACHINENAME,a.ENGINGHOURS,a.ALERTDESC,pit.SERVICEDESCRIPTION,a.PMTYPE from ALERTS a
|
||||
@ -60,7 +44,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public void AcknowledgeAlert(string useriid, long[] alertids, string acknowledgmentcomment)
|
||||
{
|
||||
const string SQL = "update ALERTS set ACKNOWLEDGED=1,ACKNOWLEDGEDBY={1},ACKNOWLEDGMENTCOMMENT={2},ACKNOWLEDGEDDATE_UTC=GETUTCDATE() where ALERTID={0}";
|
||||
const string SQL_S = "select ALERTID from ALERTS where ISNULL(ACKNOWLEDGED,0)<>1 and ISNULL(COMPLETED,0)<>1 and MACHINEID=(select MACHINEID from ALERTS where ALERTID={0}) and ALERTDESC=(select ALERTDESC from ALERTS where ALERTID={0}) ";
|
||||
const string SQL_S = "select ALERTID from ALERTS a where ISNULL(ACKNOWLEDGED,0)<>1 and ISNULL(COMPLETED,0)<>1 and MACHINEID=(select MACHINEID from ALERTS where ALERTID={0}) and ALERTDESC=(select ALERTDESC from ALERTS where ALERTID={0}) and not exists(select 1 from WORKORDER_ALERTS woa where woa.ALERTID=a.ALERTID) ";
|
||||
|
||||
if (alertids != null && alertids.Length > 0)
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public string BeginDate { get; set; }
|
||||
public string EndDate { get; set; }
|
||||
public bool IncludeunCompleted { get; set; }
|
||||
public string[] Category { get; set; }
|
||||
}
|
||||
|
||||
public class AutoAcknowledgeInfo : AutoAcknowledgeItem
|
||||
|
@ -9,6 +9,9 @@ using IronIntel.Contractor.Machines;
|
||||
|
||||
namespace IronIntel.Contractor.Maintenance
|
||||
{
|
||||
/// <summary>
|
||||
/// 已移到CurfewWinService服务中执行
|
||||
/// </summary>
|
||||
public class IATCAlertsSyncService
|
||||
{
|
||||
private static bool isrunning = false;
|
||||
|
@ -36,6 +36,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
|
||||
public PmIntervalItem[] Intervals { get; set; }
|
||||
public int[] AllIntervals { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
}
|
||||
|
||||
public class PmIntervalItem
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Foresight.Data;
|
||||
using DocumentFormat.OpenXml.Office2010.CustomUI;
|
||||
using Foresight.Data;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.Fleet.Services.AssetHealth;
|
||||
using Foresight.Fleet.Services.User;
|
||||
@ -18,6 +19,10 @@ namespace IronIntel.Contractor.Maintenance
|
||||
|
||||
#region PM SCHEDULES
|
||||
|
||||
/// <summary>
|
||||
/// 根据PM类型、PMId获取PM计划列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static PmScheduleInfo[] GetPmSchedule(string sessionid, string pmtype, string pmid, string filter)
|
||||
{
|
||||
var items = FleetServiceClientHelper.CreateClient<PMClient>(sessionid).GetPMScheduleItems(SystemParams.CompanyID, pmtype, filter, true);
|
||||
@ -34,6 +39,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
pm.PmScheduleUom = item.UOM;
|
||||
pm.PmScheduleType = item.ScheduleType;
|
||||
pm.Notes = item.Notes;
|
||||
pm.Enabled = item.Enabled;
|
||||
if (item.Intervals != null || item.Intervals.Count > 0)
|
||||
{
|
||||
List<PmIntervalItem> lsinterval = new List<PmIntervalItem>();
|
||||
@ -56,6 +62,10 @@ namespace IronIntel.Contractor.Maintenance
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据PM计划ID获取计划信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static PmScheduleInfo GetPMScheduleByID(string sessionid, string scheduleid)
|
||||
{
|
||||
var item = FleetServiceClientHelper.CreateClient<PMClient>(sessionid).GetPMScheduleItem(SystemParams.CompanyID, scheduleid, true);
|
||||
@ -65,6 +75,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
pm.PmScheduleUom = item.UOM;
|
||||
pm.PmScheduleType = item.ScheduleType;
|
||||
pm.Notes = item.Notes;
|
||||
pm.Enabled = item.Enabled;
|
||||
if (item.Intervals != null || item.Intervals.Count > 0)
|
||||
{
|
||||
List<PmIntervalItem> lsinterval = new List<PmIntervalItem>();
|
||||
@ -159,6 +170,10 @@ namespace IronIntel.Contractor.Maintenance
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据机器id获取PM计划列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static PMAssetAlertInfo[] GetPmScheduleByAsset(string sessionid, long assetid, bool includeinterval)
|
||||
{
|
||||
List<PMAssetAlertInfo> result = new List<PMAssetAlertInfo>();
|
||||
@ -225,6 +240,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
pm.UOM = si.PmScheduleUom;
|
||||
pm.ScheduleType = si.PmScheduleType;
|
||||
pm.Notes = si.Notes;
|
||||
pm.Enabled = si.Enabled;
|
||||
if (si.Intervals != null && si.Intervals.Length > 0)
|
||||
{
|
||||
List<PMIntervalItem> list = new List<PMIntervalItem>();
|
||||
@ -485,8 +501,8 @@ namespace IronIntel.Contractor.Maintenance
|
||||
public static WorkOrderListItemClient[] GetMaintenanceWorkOrders(string sessionid, string custid, string[] assignedusers, string[] asseitgroups, string filter, string useriid)
|
||||
{
|
||||
const string SQL = @"select m.MAINTENANCEID,m.COMPLETEDBY,(select USERNAME from USERS with(nolock) where USERS.USERIID=m.COMPLETEDBY) as ASSIGNEDTONAME,m.NOTES,m.MAINTENANCEDATE
|
||||
,b.MACHINEID,b.VIN,b.MACHINENAME,b.MACHINENAME2 from MAINTENANCELOG m with(nolock) left join MACHINES b with(nolock) on b.MACHINEID=m.MACHINEID
|
||||
where m.ALERTID not in (select ALERTID from WORKORDER_ALERTS with(nolock)) and m.MACHINEID = b.MACHINEID and ISNULL(b.HIDE,0)<>1 ";
|
||||
,b.MACHINEID,b.VIN,b.MACHINENAME,b.MACHINENAME2,b.MAKENAME,b.MODELNAME,b.JOBSITES,m.COMPLETED from MAINTENANCELOG m with(nolock) left join V_WORKORDER_MACHINES b with(nolock) on b.MACHINEID=m.MACHINEID left join WORKORDER_ALERTS woa on woa.ALERTID=m.ALERTID
|
||||
where woa.ALERTID is null and m.MACHINEID = b.MACHINEID";
|
||||
const string SQL_FILTER = " and (m.NOTES like {0} or b.MACHINEID like {0} or b.VIN like {0} or b.MACHINENAME like {0} or b.MACHINENAME2 like {0}) ";
|
||||
const string SQL_ORDERBY = " order by m.MAINTENANCEID";
|
||||
|
||||
@ -547,11 +563,26 @@ namespace IronIntel.Contractor.Maintenance
|
||||
wo.MaintenanceID = FIDbAccess.GetFieldString(dr["MAINTENANCEID"], string.Empty);
|
||||
wo.Description = FIDbAccess.GetFieldString(dr["NOTES"], string.Empty);
|
||||
wo.CompleteDate = FIDbAccess.GetFieldDateTime(dr["MAINTENANCEDATE"], DateTime.MinValue);
|
||||
wo.AssetName = FIDbAccess.GetFieldString(dr["MACHINENAME"], string.Empty);
|
||||
wo.Make = FIDbAccess.GetFieldString(dr["MAKENAME"], string.Empty);
|
||||
wo.Model = FIDbAccess.GetFieldString(dr["MODELNAME"], string.Empty);
|
||||
wo.CurrentJobsites = FIDbAccess.GetFieldString(dr["JOBSITES"], string.Empty);
|
||||
wo.VIN = FIDbAccess.GetFieldString(dr["VIN"], string.Empty);
|
||||
wo.AssetName = FIDbAccess.GetFieldString(dr["MACHINENAME2"], string.Empty);
|
||||
if (string.IsNullOrWhiteSpace(wo.AssetName))
|
||||
{
|
||||
wo.AssetName = FIDbAccess.GetFieldString(dr["MACHINENAME"], string.Empty);
|
||||
if (string.IsNullOrWhiteSpace(wo.AssetName))
|
||||
{
|
||||
wo.AssetName = wo.VIN;
|
||||
}
|
||||
}
|
||||
//var assignedTo = FIDbAccess.GetFieldString(dr["COMPLETEDBY"], string.Empty);
|
||||
//wo.AssignedToName = FIDbAccess.GetFieldString(dr["ASSIGNEDTONAME"], assignedTo);
|
||||
|
||||
wo.WorkOrderNumber = "";
|
||||
wo.Status = FIDbAccess.GetFieldInt(dr["COMPLETED"], 0) == 1 ? 100 : -1;
|
||||
if (!wo.Completed)
|
||||
wo.CompleteDate = null;
|
||||
|
||||
list.Add(wo);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using Foresight.Fleet.Services.AssetHealth.WorkOrder;
|
||||
using Foresight.Fleet.Services.Customer;
|
||||
using Foresight.ServiceModel;
|
||||
using IronIntel.Contractor.Machines;
|
||||
using IronIntel.Contractor.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -34,6 +35,9 @@ namespace IronIntel.Contractor.Maintenance
|
||||
|
||||
public class WorkOrderListItemClient : WorkOrderListItem
|
||||
{
|
||||
const char SPLITCHAR = (char)170;
|
||||
const char SPLIT_CHAR182 = (char)182;
|
||||
const char SPLIT_CHAR183 = (char)183;
|
||||
public string DueDateStr { get { return DueDate == null ? "" : DueDate.Value.ToShortDateString(); } }
|
||||
public string CompleteDateStr { get { return CompleteDate == null ? "" : CompleteDate.Value.ToShortDateString(); } }
|
||||
public string NextFollowUpDateStr { get { return NextFollowUpDate == null ? "" : NextFollowUpDate.Value.ToShortDateString(); } }
|
||||
@ -88,6 +92,98 @@ namespace IronIntel.Contractor.Maintenance
|
||||
return rst;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(base.ToString());
|
||||
sb.Append(SPLITCHAR + DueDateStr);
|
||||
sb.Append(SPLITCHAR + CompleteDateStr);
|
||||
sb.Append(SPLITCHAR + NextFollowUpDateStr);
|
||||
sb.Append(SPLITCHAR + CreateDateStr);
|
||||
sb.Append(SPLITCHAR + CreationDateStr);
|
||||
sb.Append(SPLITCHAR + LastCommunicationDateStr);
|
||||
sb.Append(SPLITCHAR + LastInternalCommunicationDateStr);
|
||||
sb.Append(SPLITCHAR + PartsExpectedDateStr);
|
||||
sb.Append(SPLITCHAR + LastLaborDateStr);
|
||||
sb.Append(SPLITCHAR + MaintenanceID);
|
||||
sb.Append(SPLITCHAR + ((WorkOrderStatus != null && WorkOrderStatus.Length > 0) ? WorkOrderStatus[0].ToString() : ""));
|
||||
if (AssignedToUsers != null && AssignedToUsers.Length > 0)
|
||||
{
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
foreach (UserInfo user in AssignedToUsers)
|
||||
{
|
||||
string str = user.IID + SPLIT_CHAR183 + user.DisplayName;
|
||||
if (sb1.Length == 0)
|
||||
sb1.Append(str);
|
||||
else
|
||||
sb1.Append(SPLIT_CHAR182 + str);
|
||||
}
|
||||
sb.Append(SPLITCHAR + sb1.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(SPLITCHAR + "");
|
||||
}
|
||||
|
||||
if (Departments != null && Departments.Length > 0)
|
||||
{
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
foreach (DepartmentInfo dept in Departments)
|
||||
{
|
||||
string str = dept.Id.ToString() + SPLIT_CHAR183 + dept.Name;
|
||||
if (sb1.Length == 0)
|
||||
sb1.Append(str);
|
||||
else
|
||||
sb1.Append(SPLIT_CHAR182 + str);
|
||||
}
|
||||
sb.Append(SPLITCHAR + sb1.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(SPLITCHAR + "");
|
||||
}
|
||||
|
||||
if (Locations != null && Locations.Length > 0)
|
||||
{
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
foreach (CustomerLocation loc in Locations)
|
||||
{
|
||||
string str = loc.ID.ToString() + SPLIT_CHAR183 + loc.Name;
|
||||
if (sb1.Length == 0)
|
||||
sb1.Append(str);
|
||||
else
|
||||
sb1.Append(SPLIT_CHAR182 + str);
|
||||
}
|
||||
sb.Append(SPLITCHAR + sb1.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(SPLITCHAR + "");
|
||||
}
|
||||
|
||||
if (Salespersons != null && Salespersons.Length > 0)
|
||||
{
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
foreach (StringKeyValue sale in Salespersons)
|
||||
{
|
||||
string str = sale.Key + SPLIT_CHAR183 + sale.Value;
|
||||
if (sb1.Length == 0)
|
||||
sb1.Append(str);
|
||||
else
|
||||
sb1.Append(SPLIT_CHAR182 + str);
|
||||
}
|
||||
sb.Append(SPLITCHAR + sb1.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(SPLITCHAR + "");
|
||||
}
|
||||
sb.Append(SPLITCHAR + ContactsStr);
|
||||
sb.Append(SPLITCHAR + (Completed ? "1" : "0"));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public class TextMessageClient : TextMessage
|
||||
|
@ -248,7 +248,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_HOURLYRATE", "Hourly Rate") + "</td><td>{0}</td></tr>", wo.HourlyRate);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_TIMETOCOMPLATEHOURS", "Time To Complete(Hrs)") + "</td><td>{0}</td></tr>", wo.HoursToComplete);
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_TIMETOCOMPLATEHOURS", "Labor Hours") + "</td><td>{0}</td></tr>", wo.HoursToComplete);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_COMPLETEDDATE", "Completed Date") + "</td><td>{0}</td></tr>", wo.CompleteDate == null ? "" : wo.CompleteDate.Value.ToShortDateString());
|
||||
str.AppendLine("");
|
||||
@ -256,7 +256,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_INVOICENUMBER", "Invoice Number") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(wo.InvoiceNumber));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + "Billable" + "</td><td>{0}</td></tr>", wo.Billable ? "Yes" : "No");
|
||||
str.AppendFormat("<tr><td class='label'>" + "Billable" + "</td><td>{0}</td></tr>", wo.Billable ? SystemParams.GetTextByKey(lang, "P_UTILITY_YES", "Yes") : SystemParams.GetTextByKey(lang, "P_UTILITY_NO", "No"));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + "Bill To Job" + "</td><td>{0}</td></tr>", wo.BillToJobName);
|
||||
str.AppendLine("");
|
||||
@ -287,11 +287,11 @@ namespace IronIntel.Contractor.Maintenance
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_COMPONENT", "Component") + "</td><td>{0}</td></tr>", se.Component);
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_COMPLETED", "Completed") + "</td><td>{0}</td></tr>", se.Completed ? "Yes" : "No");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_COMPLETED", "Completed") + "</td><td>{0}</td></tr>", se.Completed ? SystemParams.GetTextByKey(lang, "P_UTILITY_YES", "Yes") : SystemParams.GetTextByKey(lang, "P_UTILITY_NO", "No"));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_COMPLETEDDATE", "Completed Date") + "</td><td>{0}</td></tr>", se.CompletedDate == null ? "" : se.CompletedDate.Value.ToShortDateString());
|
||||
str.AppendFormat("<tr><td class='label'>" + "Segment Type" + "</td><td>{0}</td></tr>", se.SegmentType);
|
||||
str.AppendFormat("<tr><td class='label'>" + "Billable" + "</td><td>{0}</td></tr>", se.Billable ? "Yes" : "No");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_SEGMENTTYPE", "Segment Type") + "</td><td>{0}</td></tr>", se.SegmentType);
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_BILLABLE", "Billable") + "</td><td>{0}</td></tr>", se.Billable ? SystemParams.GetTextByKey(lang, "P_UTILITY_YES", "Yes") : SystemParams.GetTextByKey(lang, "P_UTILITY_NO", "No"));
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_DESCRIPTION", "Description") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(se.Description));
|
||||
str.AppendLine("");
|
||||
str.AppendFormat("<tr><td class='label'>" + SystemParams.GetTextByKey(lang, "P_WO_NOTES", "Notes") + "</td><td>{0}</td></tr>", HttpUtility.HtmlEncode(se.Notes).Replace("\n", "<br>"));
|
||||
@ -646,6 +646,7 @@ namespace IronIntel.Contractor.Maintenance
|
||||
ai.Recurring = alertitem.Recurring;
|
||||
ai.Priority = alertitem.Priority;
|
||||
ai.ExpectedCost = alertitem.ExpectedCost;
|
||||
ai.Comment = alertitem.Comment;
|
||||
|
||||
return ai;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("23.5.11")]
|
||||
[assembly: AssemblyFileVersion("24.3.19")]
|
||||
|
@ -25,6 +25,7 @@ using Foresight.Fleet.Services.User;
|
||||
using Foresight.Fleet.Services.SystemOption;
|
||||
using Foresight;
|
||||
using DocumentFormat.OpenXml.Presentation;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
|
||||
namespace IronIntel.Contractor
|
||||
{
|
||||
@ -46,6 +47,8 @@ namespace IronIntel.Contractor
|
||||
public const string DefaultPORequired = "DefaultPORequired";
|
||||
public const string InvoiceMessage = "InvoiceMessage";
|
||||
|
||||
public const string AlertMappingDefaultCategory = "AlertMappingDefaultCategory";
|
||||
|
||||
private static string EncryptString(string s)
|
||||
{
|
||||
byte[] buf = Encoding.UTF8.GetBytes(s);
|
||||
@ -223,25 +226,6 @@ namespace IronIntel.Contractor
|
||||
}
|
||||
}
|
||||
|
||||
private static string _WebSocketURL = null;
|
||||
public static string WebSocketURL
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_WebSocketURL == null)
|
||||
{
|
||||
string url = GetStringParam("WebSocketURL");
|
||||
if (string.IsNullOrEmpty(url))
|
||||
url = FleetServiceClientHelper.CreateClient<SystemOptionProvider>().GetMasterSysParam("WebSocketURL");
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
_WebSocketURL = string.Format("{0}?custid={1}", url, SystemParams.CompanyID);
|
||||
else
|
||||
_WebSocketURL = "";
|
||||
}
|
||||
return _WebSocketURL;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetStringParam(string paramname, string value)
|
||||
{
|
||||
FleetServiceClientHelper.CreateClient<CustomerProvider>().SetSystemParams(CompanyID, paramname, value);
|
||||
@ -255,7 +239,7 @@ namespace IronIntel.Contractor
|
||||
/// <returns>参数值</returns>
|
||||
public static string GetStringParam(string paramname, bool useCache = true, FISqlConnection db = null)
|
||||
{
|
||||
const string SQL = "select PARAMVALUE from SYSPARAMS where PARAMNAME={0}";
|
||||
const string SQL = "select PARAMVALUE from SYSPARAMS with(nolock) where PARAMNAME={0}";
|
||||
|
||||
string v = null;
|
||||
if (useCache && _Params.TryGetValue(paramname, out v))
|
||||
@ -348,6 +332,23 @@ namespace IronIntel.Contractor
|
||||
return FleetServiceClientHelper.CreateClient<CustomerProvider>().GetCustomerDetail(cid);
|
||||
}
|
||||
|
||||
private static CustomerParams _CurrentCustomerParams = null;
|
||||
|
||||
public static CustomerParams CurrentCustomerParams
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_CurrentCustomerParams == null)
|
||||
_CurrentCustomerParams = GetCustomerParams(CompanyID);
|
||||
return _CurrentCustomerParams;
|
||||
}
|
||||
}
|
||||
|
||||
public static CustomerParams GetCustomerParams(string cid)
|
||||
{
|
||||
return FleetServiceClientHelper.CreateClient<CustomerProvider>().GetConfiguredParams(cid);
|
||||
}
|
||||
|
||||
public static LicenseInfo GetLicense()
|
||||
{
|
||||
CustomerProvider ic = FleetServiceClientHelper.CreateClient<CustomerProvider>();
|
||||
@ -609,6 +610,19 @@ namespace IronIntel.Contractor
|
||||
return _MachineTypeMapViewIconUrl;
|
||||
}
|
||||
}
|
||||
private static string _MachineMovingIconUrl = string.Empty;
|
||||
public static string MachineMovingIconUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_MachineMovingIconUrl))
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<AssetClassProvider>();
|
||||
_MachineMovingIconUrl = client.GetMachineMovingIconUrl();
|
||||
}
|
||||
return _MachineMovingIconUrl;
|
||||
}
|
||||
}
|
||||
|
||||
public static CustUIStyle GetUIStyle(string useriid)
|
||||
{
|
||||
@ -633,18 +647,18 @@ namespace IronIntel.Contractor
|
||||
{
|
||||
var tzs = TimeZoneInfo.GetSystemTimeZones();
|
||||
List<StringKeyValue> result = new List<StringKeyValue>();
|
||||
|
||||
foreach (TimeZoneInfo tz in tzs)
|
||||
DateTime now = DateTime.UtcNow;
|
||||
foreach (TimeZoneInfo tz in tzs.OrderBy(tz => tz.GetUtcOffset(now)).ThenBy(tz => tz.Id))
|
||||
{
|
||||
StringKeyValue skv = new StringKeyValue();
|
||||
skv.Key = tz.Id;
|
||||
TimeSpan offset = tz.GetUtcOffset(DateTime.UtcNow);
|
||||
TimeSpan offset = tz.GetUtcOffset(now);//tz.BaseUtcOffset; BaseUtcOffset有问题
|
||||
skv.Value = string.Format("{0}{1}:{2}", offset.Hours >= 0 ? "+" : "", offset.Hours.ToString("00"), Math.Abs(offset.Minutes).ToString("00"));
|
||||
|
||||
skv.Tag1 = offset.TotalMinutes.ToString();
|
||||
result.Add(skv);
|
||||
}
|
||||
return result.OrderBy(tz => double.Parse(tz.Tag1)).ThenBy(tz => tz.Key).ToArray();
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
public static DateTime ConvertToUserTimeFromUtc(Foresight.Fleet.Services.User.UserInfo ui, DateTime utctime)
|
||||
@ -666,17 +680,31 @@ namespace IronIntel.Contractor
|
||||
return TimeZoneInfo.ConvertTimeFromUtc(new DateTime(utctime.Ticks), timeZone);
|
||||
}
|
||||
|
||||
public static string GetUserTimeZoneId(Foresight.Fleet.Services.User.UserInfo ui)
|
||||
{
|
||||
string tzid = ui.TimeZone;
|
||||
if (!string.IsNullOrWhiteSpace(tzid))
|
||||
return tzid;
|
||||
|
||||
if (ui.IsForesightUser)
|
||||
tzid = ForesightCustomerDetail.TimeZoneId;
|
||||
else
|
||||
tzid = CustomerDetail.TimeZoneId;
|
||||
|
||||
return tzid;
|
||||
}
|
||||
|
||||
public const string APPNAME = "IronIntelCustomerSite";
|
||||
private const string WORKING_COMPANY_HEADER = "WorkingCompanyID";
|
||||
|
||||
public static void SendMail(System.Net.Mail.MailMessage msg)
|
||||
public static long SendMail(System.Net.Mail.MailMessage msg)
|
||||
{
|
||||
SendMail(APPNAME, msg);
|
||||
return SendMail(APPNAME, msg);
|
||||
}
|
||||
|
||||
public static void SendMail(string appname, System.Net.Mail.MailMessage msg)
|
||||
public static long SendMail(string appname, System.Net.Mail.MailMessage msg)
|
||||
{
|
||||
FleetServiceClientHelper.CreateClient<SystemUtil>().SendMail(CompanyID, appname, msg);
|
||||
return FleetServiceClientHelper.CreateClient<SystemUtil>().SendMail(CompanyID, appname, msg);
|
||||
}
|
||||
|
||||
public static void WriteLog(string logType, string source, string message, string detail)
|
||||
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using Foresight.Data;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using Foresight.Fleet.Services.AssetHealth;
|
||||
|
||||
namespace IronIntel.Contractor.Users
|
||||
{
|
||||
@ -83,7 +84,7 @@ namespace IronIntel.Contractor.Users
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<NavigateItem> GetMaintenanceNavigateItems(Tuple<Feature, Permissions>[] pmss)
|
||||
public List<NavigateItem> GetMaintenanceNavigateItems(Tuple<Feature, Permissions>[] pmss, UserInfo user)
|
||||
{
|
||||
List<NavigateItem> list = new List<NavigateItem>();
|
||||
|
||||
@ -117,6 +118,19 @@ namespace IronIntel.Contractor.Users
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.ALERTS_MANAGEMENT) != null)
|
||||
list.Add(item);
|
||||
|
||||
if (user.UserType == UserTypes.SupperAdmin)
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_alertsmappings";
|
||||
item.FeatureID = Feature.ALERTS_MANAGEMENT;
|
||||
item.Title = "Alert Mappings";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "AlertsMapping.aspx";
|
||||
item.IconPath = "img/alert.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.ALERTS_MANAGEMENT) != null)
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_maintenanceschedule";
|
||||
item.FeatureID = Feature.PREVENTATIVE_MAINTENANCE;
|
||||
@ -249,7 +263,7 @@ namespace IronIntel.Contractor.Users
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.CURFEW_CONFIG) != null)
|
||||
list.Add(item);
|
||||
|
||||
if (user.UserType == UserTypes.SupperAdmin)
|
||||
if (!IronIntel.Contractor.SystemParams.IsDealer && user.UserType == UserTypes.SupperAdmin)
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_curfewmt";
|
||||
@ -279,6 +293,16 @@ namespace IronIntel.Contractor.Users
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.MANAGE_ASSETS) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_assethistory";
|
||||
item.FeatureID = Feature.MANAGE_ASSETS;
|
||||
item.Title = "Asset History";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "AssetHistory.aspx";
|
||||
item.IconPath = "img/workorderhis.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.MANAGE_ASSETS) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_managrentals";
|
||||
item.FeatureID = Feature.MANAGE_ASSETS;
|
||||
@ -318,6 +342,18 @@ namespace IronIntel.Contractor.Users
|
||||
if (user.UserType >= UserTypes.Admin)
|
||||
list.Add(item);
|
||||
|
||||
bool license = SystemParams.HasLicense("ShareAsset");
|
||||
if (license && !SystemParams.IsDealer && pmss.FirstOrDefault(m => m.Item1.Id == Feature.MANAGE_DEVICES) != null)
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_shareasset";
|
||||
item.Title = "Share Assets";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "ShareMachines.aspx";
|
||||
//item.IconPath = "img/model.png";
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ namespace IronIntel.Contractor.Users
|
||||
if (m.Id == FeatureModule.MODULE_JOBSITES)
|
||||
ami.SubItems = ami.GetJobsiteNavigateItems(pmss);
|
||||
else if (m.Id == FeatureModule.MODULE_ASSETHEALTH)
|
||||
ami.SubItems = ami.GetMaintenanceNavigateItems(pmss);
|
||||
ami.SubItems = ami.GetMaintenanceNavigateItems(pmss, user);
|
||||
else if (m.Id == FeatureModule.MODULE_SECURITY)
|
||||
ami.SubItems = ami.GetSecurityNavigateItems(pmss, user);
|
||||
else if (m.Id == FeatureModule.MODULE_MANAGEASSETS)
|
||||
@ -103,7 +103,7 @@ namespace IronIntel.Contractor.Users
|
||||
|
||||
string SQL = @"select w.IID,isnull(l.WorkSpaceName,w.WSPNAME) as WSPNAME,w.WSPDESCRIPTION from WORKSPACE w
|
||||
left join WorkSpaceLanguage l on w.IID=l.WorkspaceIID and l.LanguageCode='en-us'
|
||||
where (ISPUBLIC=1 or ISPUBLIC>10)";
|
||||
where (ISPUBLIC=1 or ISPUBLIC>10) or (ISPUBLIC=0 AND CREATER={0})";
|
||||
|
||||
FISqlConnection db = new FISqlConnection(SystemParams.FICDbConnectionString);
|
||||
if (user.UserType == UserTypes.Readonly)
|
||||
@ -114,7 +114,7 @@ namespace IronIntel.Contractor.Users
|
||||
|
||||
|
||||
|
||||
DataTable tb = db.GetDataTableBySQL(SQL);
|
||||
DataTable tb = db.GetDataTableBySQL(SQL, user.IID);
|
||||
List<AppModuleInfo> ls = new List<AppModuleInfo>();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
using FI.FIC;
|
||||
using FI.FIC.Contracts.DataObjects.BaseObject;
|
||||
using Foresight.Fleet.Services;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.Fleet.Services.JobSite;
|
||||
using Foresight.Fleet.Services.User;
|
||||
@ -15,16 +16,17 @@ namespace IronIntel.Contractor.Users
|
||||
{
|
||||
public class UserInfo
|
||||
{
|
||||
private static string[] ContactTypeNames = { "Foreman", "Driver", "Inventory Manager", "Rental Manager", "Service Manager", "Fleet Manager", "Technician", "Advisor", "Other" };
|
||||
public string IID { get; set; }
|
||||
public string ID { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public string TextAddress { get; set; }
|
||||
public string TextAddressDisplayText { get; set; }
|
||||
public bool IsUser { get; set; }
|
||||
public ContactTypes ContactType { get; set; }
|
||||
public string Mobile { get; set; }
|
||||
public string MobilePhoneDisplayText { get; set; }
|
||||
public string BusinessPhone { get; set; }
|
||||
public string BusinessPhoneDisplayText { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public bool Active { get; set; }
|
||||
public UserTypes UserType { get; set; }
|
||||
@ -58,15 +60,31 @@ namespace IronIntel.Contractor.Users
|
||||
public bool ExcelExports { get; set; }
|
||||
public LoginVerifyTypes LoginVerifyType { get; set; } = LoginVerifyTypes.OrganizationSetting;
|
||||
public UserInfo[] Managers { get; set; }
|
||||
public string ContactTypeName
|
||||
public string ContactTypeName { get; private set; }
|
||||
public void SetContactTypeName(string lang)
|
||||
{
|
||||
get
|
||||
{
|
||||
int cType = (int)ContactType;
|
||||
if (cType > 8)
|
||||
cType = 8;
|
||||
return ContactTypeNames[cType];
|
||||
}
|
||||
string cname = "";
|
||||
int cType = (int)ContactType;
|
||||
if (cType == 0)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_FOREMAN", "Foreman");
|
||||
else if (cType == 1)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_DRIVER", "Driver");
|
||||
else if (cType == 2)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_INVENTORYMANAGER", "Inventory Manager");
|
||||
else if (cType ==3)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_RENTALMANAGER", "Rental Manager");
|
||||
else if (cType == 4)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_SERVICEMANAGER", "Service Manager");
|
||||
else if (cType == 5)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_FLEETMANAGER", "Fleet Manager");
|
||||
else if (cType == 6)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_TECHNICIAN", "Technician");
|
||||
else if (cType == 7)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_ADVISOR", "Advisor");
|
||||
else if (cType > 8)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_OTHER", "Other");
|
||||
|
||||
ContactTypeName = cname;
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +97,7 @@ namespace IronIntel.Contractor.Users
|
||||
public string UserAlertFilter { get; set; }
|
||||
|
||||
public EmailSchedule Schedule { get; set; }
|
||||
public StringKeyValue[] MessageTypes { get; set; }
|
||||
public MessageRestrictInfo[] MessageTypes { get; set; }
|
||||
public UserFilterTemplateItem[] FilterTemplates { get; set; }
|
||||
public int[] DeleteFilterTemplates { get; set; }
|
||||
}
|
||||
|
@ -17,7 +17,14 @@ namespace IronIntel.Contractor.Users
|
||||
{
|
||||
public static class UserManagement
|
||||
{
|
||||
public static UserInfo[] GetUsers(string companyid = null, string filter = null)
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="companyid"></param>
|
||||
/// <param name="filter"></param>
|
||||
/// <param name="lang">ContactTypeName需根据用户语言获取</param>
|
||||
/// <returns></returns>
|
||||
public static UserInfo[] GetUsers(string companyid = null, string filter = null, string lang = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -29,7 +36,7 @@ namespace IronIntel.Contractor.Users
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
UserInfo u = ConvertUserItem(user);
|
||||
UserInfo u = ConvertUserItem(user, lang);
|
||||
if (maps.ContainsKey(u.IID))
|
||||
u.GroupNames = maps[u.IID].ToArray();
|
||||
list.Add(u);
|
||||
@ -62,7 +69,7 @@ namespace IronIntel.Contractor.Users
|
||||
return result;
|
||||
}
|
||||
|
||||
public static UserInfo[] GetActiveUsers(string sessionid, string companyid = null)
|
||||
public static UserInfo[] GetActiveUsers(string lang, string sessionid, string companyid = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -71,12 +78,29 @@ namespace IronIntel.Contractor.Users
|
||||
foreach (var user in users)
|
||||
{
|
||||
if (user.Active)
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static UserInfo[] GetSalespersons(string sessionid, string companyid = null, string filter = "")
|
||||
public static UserInfo[] GetAllFollowers(string lang, string sessionid, string companyid = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
var client = FleetServiceClientHelper.CreateClient<UserQueryClient>(companyid, sessionid);
|
||||
var users = client.GetUsersByCustomerID(companyid, "");
|
||||
var userattrs = client.GetUserAdditionalAttributeByCustomer(companyid);
|
||||
var followers = userattrs.Where(x => x.WorkOrderFollower).Select(x => x.UserIID);
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
if (user.Active && user.IsUser && followers.Contains(user.UID, StringComparer.OrdinalIgnoreCase))
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static UserInfo[] GetSalespersons(string sessionid, string lang, string companyid = null, string filter = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -87,20 +111,27 @@ namespace IronIntel.Contractor.Users
|
||||
if (user.Active)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filter))
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
else
|
||||
{
|
||||
if (user.ID.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0
|
||||
|| user.Name.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0
|
||||
|| user.FOB.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
private static UserInfo ConvertUserItem(Foresight.Fleet.Services.User.UserInfo user)
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="lang">ContactTypeName需根据用户语言获取</param>
|
||||
/// <returns></returns>
|
||||
private static UserInfo ConvertUserItem(Foresight.Fleet.Services.User.UserInfo user, string lang = null)
|
||||
{
|
||||
if (user == null)
|
||||
return null;
|
||||
@ -111,9 +142,11 @@ namespace IronIntel.Contractor.Users
|
||||
u.UserType = (UserTypes)user.UserType;
|
||||
u.Active = user.Active;
|
||||
u.TextAddress = user.TextAddress;
|
||||
u.TextAddressDisplayText = user.TextAddressDisplayText;
|
||||
u.Mobile = user.Mobile;
|
||||
u.MobilePhoneDisplayText = user.MobilePhoneDisplayText;
|
||||
u.BusinessPhone = user.BusinessPhone;
|
||||
u.BusinessPhoneDisplayText = user.BusinessPhoneDisplayText;
|
||||
u.Notes = user.Remark;
|
||||
u.IsUser = user.IsUser;
|
||||
u.ContactType = (ContactTypes)user.ContactType;
|
||||
@ -135,6 +168,7 @@ namespace IronIntel.Contractor.Users
|
||||
if (!string.IsNullOrWhiteSpace(u.ManagerIID))
|
||||
u.Managers = new UserInfo[] { new UserInfo() { IID = u.ManagerIID, DisplayName = u.ManagerName } };
|
||||
|
||||
u.SetContactTypeName(string.IsNullOrWhiteSpace(lang) ? "en" : lang);
|
||||
return u;
|
||||
}
|
||||
|
||||
@ -172,7 +206,7 @@ namespace IronIntel.Contractor.Users
|
||||
return u;
|
||||
}
|
||||
|
||||
public static UserInfo[] GetUnmanagementUsers()
|
||||
public static UserInfo[] GetUnmanagementUsers(string lang)
|
||||
{
|
||||
var users = FleetServiceClientHelper.CreateClient<UserQueryClient>(SystemParams.CompanyID).GetUsersByCustomerID(SystemParams.CompanyID, "");
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
@ -180,7 +214,7 @@ namespace IronIntel.Contractor.Users
|
||||
{
|
||||
if (user.IsUser && user.UserType < Foresight.Fleet.Services.User.UserTypes.Admin)
|
||||
{
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
}
|
||||
return list.ToArray();
|
||||
@ -522,7 +556,7 @@ namespace IronIntel.Contractor.Users
|
||||
|
||||
#region User Machines/Jobsite/MachineType/Department/Location
|
||||
|
||||
public static UserInfo[] GetUsersByAssetID(string sessionid, long assetid, string companyid)
|
||||
public static UserInfo[] GetUsersByAssetID(string sessionid, long assetid, string companyid, string lang)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -530,12 +564,12 @@ namespace IronIntel.Contractor.Users
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static UserInfo[] GetWorkOrderAssignToUsers(string sessionid, string companyid, long assetid, int locid, int depid)
|
||||
public static UserInfo[] GetWorkOrderAssignToUsers(string sessionid, string companyid, long assetid, int locid, int depid, string lang)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -561,14 +595,14 @@ namespace IronIntel.Contractor.Users
|
||||
if (!user.AssignedWorkOrders && user.ContactType != Foresight.Fleet.Services.User.ContactTypes.Advisor) continue;
|
||||
if (depandlocusers == null || depandlocusers.Contains(user.UID, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
uids.Add(user.UID);
|
||||
}
|
||||
}
|
||||
return list.OrderBy(u => u.DisplayName).ToArray();
|
||||
}
|
||||
|
||||
public static UserInfo[] GetUsersByAssets(string sessionid, long[] assetids, string companyid)
|
||||
public static UserInfo[] GetUsersByAssets(string sessionid, long[] assetids, string companyid, string lang)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -576,12 +610,12 @@ namespace IronIntel.Contractor.Users
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static UserInfo[] GetUsersByJobsiteID(string sessionid, long jsid, string companyid)
|
||||
public static UserInfo[] GetUsersByJobsiteID(string sessionid, string lang, long jsid, string companyid)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -589,7 +623,7 @@ namespace IronIntel.Contractor.Users
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ namespace IronIntel.Contractor.Users
|
||||
|
||||
private const string _MapViewSearches = "MapViewSearches";
|
||||
private const string _LandingPage = "LandingPage";
|
||||
private const string _BreadcrumbLocationSource = "BreadcrumbLocationSource";
|
||||
|
||||
public static UserParamInfo GetUserParams(string sessionid, string useriid)
|
||||
{
|
||||
@ -94,6 +95,9 @@ namespace IronIntel.Contractor.Users
|
||||
case _LandingPage:
|
||||
userParams.LandingPage = value;
|
||||
break;
|
||||
case _BreadcrumbLocationSource:
|
||||
userParams.BreadcrumbLocationSource = int.Parse(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
userParams.MapViewSearches = GetMapViewSearches(sessionid, useriid);
|
||||
@ -110,10 +114,20 @@ namespace IronIntel.Contractor.Users
|
||||
else
|
||||
userParams.MapRefreshInterval = 60;
|
||||
userParams.MachineIconURL = SystemParams.MachineTypeMapViewIconUrl;
|
||||
userParams.MachineMovingIconURL = SystemParams.MachineMovingIconUrl;
|
||||
|
||||
var uc = FleetServiceClientHelper.CreateClient<UserQueryClient>();
|
||||
userParams.PreferredLanguage = uc.GetUserPreferredLanguageByIID(useriid);
|
||||
userParams.TimeZone = uc.GetUserTimeZoneByIID(useriid);
|
||||
if (userParams.BreadcrumbLocationSource < 0)//用户参数未设置,取系统参数
|
||||
{
|
||||
string locsourcestr = SystemParams.GetStringParam(_BreadcrumbLocationSource);
|
||||
int locsource = 0;
|
||||
int.TryParse(locsourcestr, out locsource);
|
||||
userParams.BreadcrumbLocationSource = locsource;
|
||||
}
|
||||
if (userParams.BreadcrumbLocationSource < 0)
|
||||
userParams.BreadcrumbLocationSource = 0;
|
||||
|
||||
return userParams;
|
||||
}
|
||||
@ -196,6 +210,10 @@ namespace IronIntel.Contractor.Users
|
||||
else
|
||||
db.ExecSQL(SQL_Delete, useriid, _LandingPage);
|
||||
|
||||
if (userParams.BreadcrumbLocationSource >= 0)
|
||||
db.ExecSQL(SQL, useriid, _BreadcrumbLocationSource, userParams.BreadcrumbLocationSource);
|
||||
else
|
||||
db.ExecSQL(SQL_Delete, useriid, _BreadcrumbLocationSource);
|
||||
}
|
||||
|
||||
public static string GetStringParameter(string useriid, string paramname)
|
||||
@ -251,7 +269,7 @@ namespace IronIntel.Contractor.Users
|
||||
}
|
||||
}
|
||||
|
||||
public static MapViewSearchItem[] SaveMapViewSearch(string sessionid, string useriid, MapViewSearchItem search)
|
||||
public static MapViewSearchItem[] SaveMapViewSearch(string sessionid, string useriid, MapViewSearchItem search, string lang)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<UserProfileProvider>(sessionid);
|
||||
string xmlstr = client.GetUserParams(SystemParams.CompanyID, useriid, _MapViewSearches);
|
||||
@ -269,8 +287,7 @@ namespace IronIntel.Contractor.Users
|
||||
}
|
||||
}
|
||||
searches.Add(search);
|
||||
|
||||
client.SetUserParam(SystemParams.CompanyID, useriid, _MapViewSearches, MapViewSearcheHelper.ToXml(searches).InnerXml);
|
||||
client.SetUserParam(SystemParams.CompanyID, useriid, _MapViewSearches, MapViewSearcheHelper.ToXml(searches, lang).InnerXml);
|
||||
return searches.OrderByDescending(s => s.IsDefault).ThenBy(s => s.Name).ToArray();
|
||||
}
|
||||
|
||||
@ -297,7 +314,7 @@ namespace IronIntel.Contractor.Users
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
public static MapViewSearchItem[] DeleteMapViewSearch(string sessionid, string useriid, string searchName)
|
||||
public static MapViewSearchItem[] DeleteMapViewSearch(string sessionid, string useriid, string searchName, string lang)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<UserProfileProvider>(sessionid);
|
||||
string xmlstr = client.GetUserParams(SystemParams.CompanyID, useriid, _MapViewSearches);
|
||||
@ -306,7 +323,7 @@ namespace IronIntel.Contractor.Users
|
||||
if (item != null)// remove it
|
||||
searches.Remove(item);
|
||||
|
||||
client.SetUserParam(SystemParams.CompanyID, useriid, _MapViewSearches, MapViewSearcheHelper.ToXml(searches).InnerXml);
|
||||
client.SetUserParam(SystemParams.CompanyID, useriid, _MapViewSearches, MapViewSearcheHelper.ToXml(searches, lang).InnerXml);
|
||||
return searches.OrderByDescending(s => s.IsDefault).ThenBy(s => s.Name).ToArray();
|
||||
}
|
||||
|
||||
@ -330,6 +347,7 @@ namespace IronIntel.Contractor.Users
|
||||
public string SystemStyleID { get; set; }
|
||||
public int MapRefreshInterval { get; set; }
|
||||
public string MachineIconURL { get; set; }
|
||||
public string MachineMovingIconURL { get; set; }
|
||||
public string AssetDefaultSearch { get; set; }
|
||||
public string JobSiteDefaultSearch { get; set; }
|
||||
public string AssetGroupDefaultSearch { get; set; }
|
||||
@ -344,6 +362,7 @@ namespace IronIntel.Contractor.Users
|
||||
public string LandingPage { get; set; }
|
||||
public string PreferredLanguage { get; set; }
|
||||
public string TimeZone { get; set; }
|
||||
public int BreadcrumbLocationSource { get; set; } = -1;
|
||||
}
|
||||
|
||||
public class MapViewSearcheHelper
|
||||
@ -398,7 +417,7 @@ namespace IronIntel.Contractor.Users
|
||||
}
|
||||
return item;
|
||||
}
|
||||
public static XmlDocument ToXml(List<MapViewSearchItem> searches)
|
||||
public static XmlDocument ToXml(List<MapViewSearchItem> searches, string lang)
|
||||
{
|
||||
XmlDocument doc = XmlHelper.CreateXmlDocument();
|
||||
XmlNode node = XmlHelper.AppendChildNode(doc.DocumentElement, "Searches", "");
|
||||
@ -409,7 +428,7 @@ namespace IronIntel.Contractor.Users
|
||||
var sn = AddSubNode(node, "Search", "");
|
||||
|
||||
AddSubNode(sn, "Name", search.Name);
|
||||
AddSubNode(sn, "IsDefault", search.IsDefault ? "Yes" : "No");
|
||||
AddSubNode(sn, "IsDefault", search.IsDefault ? SystemParams.GetTextByKey(lang, "P_UTILITY_YES", "Yes") : SystemParams.GetTextByKey(lang, "P_UTILITY_NO", "No"));
|
||||
if (!string.IsNullOrEmpty(search.AssetDefaultSearch))
|
||||
AddSubNode(sn, "AssetDefaultSearch", search.AssetDefaultSearch);
|
||||
if (!string.IsNullOrEmpty(search.JobSiteDefaultSearch))
|
||||
|
Reference in New Issue
Block a user