Пример #1
0
        public static System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints> InitMapPoints(bool allOrders, string raCode, bool allRAs){using (new zAppDev.DotNet.Framework.Profiling.Profiler("MapPoints", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "InitMapPoints")) {
System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints> mapPoints = new System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints>();
try {
System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS> or = new System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>();
if ((allOrders)) {
var _count0 = 0;or = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>(1, 30,out _count0).ToList();}
else {
if ((raCode != null)) {
or?.AddRange(new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>((ord) => ord.OrdAgencyCode == raCode));
}
}
foreach (var order in or ?? Enumerable.Empty<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>()) {
var _var0 = order?.Warehouse;DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse warehouse = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable<DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse>((wr) => wr.Title == _var0)?.FirstOrDefault();
if ((warehouse?.GeoCoordinates != null)) {
float? originLat = (warehouse?.GeoCoordinates?.Latitude ?? 0);
float? originLong = (warehouse?.GeoCoordinates?.Longitude ?? 0);
if ((((((mapPoints?.Any((mp) => mp.Lat == originLat && mp.Long == originLong) ?? false))) == false))) {
DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints warehouseMapPoint = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
warehouseMapPoint.Lat = originLat;warehouseMapPoint.Long = originLong;warehouseMapPoint.Title = (warehouse?.Title ?? "");warehouseMapPoint.Icon = "http://apps.zappdev.com/SARMEDAgentPortal_1215_vvasilopoulos/Resources/Images/industries.png";mapPoints?.Add(warehouseMapPoint);
}
}
}
if ((allRAs)) {
foreach (var regionalAgent in new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll<DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>() ?? Enumerable.Empty<DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>()) {
foreach (var truck in regionalAgent?.Trucks ?? Enumerable.Empty<DSS3_LogisticsPoolingForUrbanDistribution.BO.Truck>()) {
if ((truck?.CurrentLocation == null)) {
continue;}
DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints mapPointTruck = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
mapPointTruck.Lat = (truck?.CurrentLocation?.Latitude ?? 0);mapPointTruck.Long = (truck?.CurrentLocation?.Longitude ?? 0);mapPointTruck.Icon = "http://apps.zappdev.com/SARMEDAgentPortal_1215_vvasilopoulos/Resources/Images/transport.png";mapPointTruck.Type = "Truck";mapPointTruck.Title = (truck?.PlateNumber ?? "");mapPoints?.Add(mapPointTruck);
}
if ((regionalAgent?.AddressCoordinates == null)) {
continue;}
DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints mapPoint = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
mapPoint.Lat = (regionalAgent?.AddressCoordinates?.Latitude ?? 0);mapPoint.Long = (regionalAgent?.AddressCoordinates?.Longitude ?? 0);mapPoint.Title = (regionalAgent?.AgencyDescription ?? "");mapPoint.Type = "RegionalAgent";mapPoint.Icon = "http://apps.zappdev.com/SARMEDAgentPortal_1215_vvasilopoulos/Resources/Images/industries.png";mapPoints?.Add(mapPoint);
}
}
else {
if (((((raCode == null || raCode == "")) == false))) {
DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent regionalAgent = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable<DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>((rag) => rag.AgencyCode == raCode)?.FirstOrDefault();
if ((regionalAgent?.AddressCoordinates != null)) {
DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints mapPoint = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
mapPoint.Lat = (regionalAgent?.AddressCoordinates?.Latitude ?? 0);mapPoint.Long = (regionalAgent?.AddressCoordinates?.Longitude ?? 0);mapPoint.Title = (regionalAgent?.AgencyDescription ?? "");mapPoint.Type = "RegionalAgent";mapPoint.Icon = "http://apps.zappdev.com/SARMEDAgentPortal_1215_vvasilopoulos/Resources/Images/industries.png";mapPoints?.Add(mapPoint);
foreach (var truck in regionalAgent?.Trucks ?? Enumerable.Empty<DSS3_LogisticsPoolingForUrbanDistribution.BO.Truck>()) {
if ((truck?.CurrentLocation == null)) {
continue;}
DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints mapPointTruck = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
mapPointTruck.Lat = (truck?.CurrentLocation?.Latitude ?? 0);mapPointTruck.Long = (truck?.CurrentLocation?.Longitude ?? 0);mapPointTruck.Icon = "http://apps.zappdev.com/SARMEDAgentPortal_1215_vvasilopoulos/Resources/Images/transport.png";mapPointTruck.Type = "Truck";mapPointTruck.Title = (truck?.PlateNumber ?? "");mapPoints?.Add(mapPointTruck);
}
}
}
}
}
catch (System.Exception x) {
zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Error, "MapPoints",  DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, x);
}
return mapPoints;
}
}
 public static void InitTruckPositions()
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("Utils", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "InitTruckPositions")) {
         try {
             DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent southGrRa = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>((ra) => ra.AgencyCode == "AG.265")?.FirstOrDefault();
             System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.Truck> trucks = southGrRa?.Trucks;
             DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates creteGeo = new DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates();
             creteGeo.Latitude = float.Parse("35.317223", System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); creteGeo.Longitude = float.Parse("25.099130", System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); if (((trucks?.Count() ?? 0) > 0))
             {
                 zAppDev.DotNet.Framework.Utilities.Common.GetItemFromList(trucks, 0).CurrentLocation = creteGeo;
             }
             DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates athensGeo = new DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates();
             athensGeo.Latitude = float.Parse("37.923545", System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); athensGeo.Longitude = float.Parse("23.889674", System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); if (((trucks?.Count() ?? 0) > 1))
             {
                 zAppDev.DotNet.Framework.Utilities.Common.GetItemFromList(trucks, 1).CurrentLocation = athensGeo;
             }
             DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates athGeo = new DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates();
             athGeo.Latitude = float.Parse("38.008472", System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); athGeo.Longitude = float.Parse("23.715051", System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); if (((trucks?.Count() ?? 0) > 2))
             {
                 zAppDev.DotNet.Framework.Utilities.Common.GetItemFromList(trucks, 2).CurrentLocation = athGeo;
             }
             new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Save <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>(southGrRa);
             DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent northRa = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>((rag) => rag.AgencyCode == "A.G.709")?.FirstOrDefault();
             System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.Truck> northtrucks = northRa?.Trucks;
             DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates lamiaGeo = new DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates();
             lamiaGeo.Latitude = float.Parse("38.903778", System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); lamiaGeo.Longitude = float.Parse("22.541465", System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); if (((northtrucks?.Count() ?? 0) > 0))
             {
                 zAppDev.DotNet.Framework.Utilities.Common.GetItemFromList(northtrucks, 0).CurrentLocation = lamiaGeo;
             }
             DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates IoanninaGeo = new DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates();
             IoanninaGeo.Latitude = float.Parse("39.655994", System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); IoanninaGeo.Longitude = float.Parse("20.826959", System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); if (((northtrucks?.Count() ?? 0) > 1))
             {
                 zAppDev.DotNet.Framework.Utilities.Common.GetItemFromList(northtrucks, 1).CurrentLocation = IoanninaGeo;
             }
             DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates LarissaGeo = new DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoCoordinates();
             LarissaGeo.Latitude = float.Parse("39.590443", System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); LarissaGeo.Longitude = float.Parse("22.488873", System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); if (((northtrucks?.Count() ?? 0) > 2))
             {
                 zAppDev.DotNet.Framework.Utilities.Common.GetItemFromList(northtrucks, 2).CurrentLocation = LarissaGeo;
             }
             new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Save <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>(northRa);
             foreach (var truck in trucks ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.Truck>())
             {
                 DSS3_LogisticsPoolingForUrbanDistribution.BO.GPSLocation gpsloc = new DSS3_LogisticsPoolingForUrbanDistribution.BO.GPSLocation();
                 gpsloc.truck_license_plate = (truck?.PlateNumber ?? ""); gpsloc.latitude = (truck?.CurrentLocation?.Latitude ?? 0); gpsloc.longitude = (truck?.CurrentLocation?.Longitude ?? 0); gpsloc.timestamp = DSS3_LogisticsPoolingForUrbanDistribution.BO.UtilsExtensions.ConvertToTimestampFormat(DateTime.UtcNow); gpsloc?.Publish();
             }
             foreach (var truck in northtrucks ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.Truck>())
             {
                 DSS3_LogisticsPoolingForUrbanDistribution.BO.GPSLocation gpsloc = new DSS3_LogisticsPoolingForUrbanDistribution.BO.GPSLocation();
                 gpsloc.truck_license_plate = (truck?.PlateNumber ?? ""); gpsloc.latitude = (truck?.CurrentLocation?.Latitude ?? 0); gpsloc.longitude = (truck?.CurrentLocation?.Longitude ?? 0); gpsloc.timestamp = DSS3_LogisticsPoolingForUrbanDistribution.BO.UtilsExtensions.ConvertToTimestampFormat(DateTime.UtcNow); gpsloc?.Publish();
             }
         }
         catch (System.Exception x) {
             zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Error, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "init truck positions");
             zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Error, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, x);
         }
     }
 }
Пример #3
0
public static System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints> OrderDirections(int? id){using (new zAppDev.DotNet.Framework.Profiling.Profiler("MapPoints", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "OrderDirections")) {
System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints> mapPoints = new System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints>();
try {
DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS order =  new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetById<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>(id);
}
catch (System.Exception x) {
zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Error, "MapPoints",  DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, x);
}
return mapPoints;
}
}
 public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRouteTemplate> GetTemplatesFromLSP()
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("ScheduledRouteTemplate", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "GetTemplatesFromLSP")) {
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRouteTemplate> templates = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRouteTemplate>();
         DSS3_LogisticsPoolingForUrbanDistribution.BO.LSPUser user = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <DSS3_LogisticsPoolingForUrbanDistribution.BO.LSPUser>((x) => x.UserName == zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentUserName())?.FirstOrDefault();
         if ((user != null))
         {
             var _var1 = user?.LSP?.Id; templates = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get <DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRouteTemplate>((x) => x.OwnerLSP.Id == _var1).ToList();
         }
         return(templates);
     }
 }
 public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRouteTemplate> GetAvailableLSPTemplates()
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("ScheduledRouteTemplate", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "GetAvailableLSPTemplates")) {
         DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgentUser currentUser = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgentUser>((x) => x.UserName == zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentUserName())?.FirstOrDefault();
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRouteTemplate> templates = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get <DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRouteTemplate>((x) => x.IsPrivate == false && x.OwnerLSP != null);
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRouteTemplate> temp      = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get <DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRouteTemplate>((x) => x.IsPrivate == true && x.Owner != null);
         foreach (var templ in temp ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.ScheduledRouteTemplate>())
         {
             if (((templ?.IsPrivate ?? false) && (templ?.VisibleToRAs?.Contains(currentUser?.RegionalAgent) ?? false)))
             {
                 templates?.Add(templ);
             }
         }
         return(templates);
     }
 }
Пример #6
0
 public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.WorkContract> GetMyWorkContracts()
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("WorkContract", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "GetMyWorkContracts")) {
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.WorkContract> contracts = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.WorkContract>();
         if (((zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentApplicationUser()?.IsInRole("LSPAdmin") ?? false) || (zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentApplicationUser()?.IsInRole("LSPUser") ?? false)))
         {
             DSS3_LogisticsPoolingForUrbanDistribution.BO.LSPUser thisuser = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <DSS3_LogisticsPoolingForUrbanDistribution.BO.LSPUser>((x) => x.UserName == zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentUserName())?.FirstOrDefault();
             var _var0 = thisuser?.LSP?.Id; contracts = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get <DSS3_LogisticsPoolingForUrbanDistribution.BO.WorkContract>((x) => x.LSP.Id == _var0).ToList(); return(contracts);
         }
         else if (((zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentApplicationUser()?.IsInRole("RAAdmin") ?? false) || (zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentApplicationUser()?.IsInRole("RAUser") ?? false)))
         {
             DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgentUser thisuser = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgentUser>((x) => x.UserName == zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentUserName())?.FirstOrDefault();
             var _var1 = thisuser?.RegionalAgent?.Id; contracts = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get <DSS3_LogisticsPoolingForUrbanDistribution.BO.WorkContract>((x) => x.RegionalAgent.Id == _var1).ToList(); return(contracts);
         }
         else
         {
             return(contracts);
         }
     }
 }
Пример #7
0
 public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS> GetTopDepositors()
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("OrderWMS", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "GetTopDepositors")) {
         System.Collections.Generic.List <string> Depositors = new System.Collections.Generic.List <string>();
         Depositors.Add("H");
         Depositors.Add("L");
         Depositors.Add("F");
         Depositors.Add("S");
         Depositors.Add("P");
         Depositors.Add("Y");
         Depositors.Add("Z");
         Depositors.Add("R");
         Depositors.Add("I");
         Depositors.Add("E");
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS> orders = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>()?.Where((o) => Depositors.Contains(o.OrdDepositorCode)).ToList();
         return(orders);
     }
 }
Пример #8
0
 public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS> GetTopRAs()
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("OrderWMS", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "GetTopRAs")) {
         System.Collections.Generic.List <string> RAs = new System.Collections.Generic.List <string>();
         RAs.Add("Al");
         RAs.Add("Yw");
         RAs.Add("Ec");
         RAs.Add("Hw");
         RAs.Add("Fr");
         RAs.Add("Js");
         RAs.Add("Yb");
         RAs.Add("Fi");
         RAs.Add("Oo");
         RAs.Add("Bl");
         RAs.Add("Jk");
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS> orders = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>()?.Where((o) => RAs.Contains(o.OrdAgencyCode)).ToList();
         return(orders);
     }
 }
Пример #9
0
        public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS> GetOrders()
        {
            using (new zAppDev.DotNet.Framework.Profiling.Profiler("OrderWMS", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "GetOrders")) {
                System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS> orders = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>();
                foreach (var order in orders ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>())
                {
                    switch ((order?.OrdStatus ?? 0))
                    {
                    case 0:
                    {
                        order.OrdStatusString = "Unfulfilled"; break;
                    }

                    case 10:
                    {
                        order.OrdStatusString = "Picking"; break;
                    }

                    case 20:
                    {
                        order.OrdStatusString = "In transit"; break;
                    }

                    case 30:
                    {
                        order.OrdStatusString = "Delivered"; break;
                    }

                    case 99:
                    {
                        order.OrdStatusString = "Cancelled"; break;
                    }
                    }
                }
                return(orders);
            }
        }
 public static void DeserializeMessage(string json)
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("Utils", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "DeserializeMessage")) {
         try {
             zAppDev.DotNet.Framework.Utilities.Serializer <System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage> > ser = new zAppDev.DotNet.Framework.Utilities.Serializer <System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage> >();
             zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO> ord     = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO>();
             System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage>             kvpairs = ser.FromJson(json);
             zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "Starting message parsing... JSON contains " + (kvpairs?.Count() ?? 0) + " objects");
             foreach (var mes in kvpairs ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage>())
             {
                 if ((mes?.key == "sarmed_order" && int.Parse((mes?.val ?? "")) > 0))
                 {
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "Order received!");
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage payload = kvpairs?.FirstOrDefault((x) => x.key == "payload");
                     string orderjson = zAppDev.DotNet.Framework.Utilities.Common.Base64Decode((payload?.val ?? ""));
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO tempDTO = ord.FromJson(orderjson);
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS temp = (new DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderTransformationDataTransformation.Transformer()).OrderWMS_To_OrderDTOReversed(tempDTO);
                     var _var0 = temp?.OrdID; DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS tempord = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>((x) => x.OrdID == _var0)?.FirstOrDefault();
                     if ((tempord != null))
                     {
                         zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "Order found in database. Updating...");
                         tempord?.CopyFields(temp);
                         if ((tempord?.OrdRoutingStatus == 30))
                         {
                             tempord.ATA = DateTime.UtcNow; System.Collections.Generic.List <string> roles = new System.Collections.Generic.List <string>();
                             foreach (var role in zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentApplicationUser()?.Roles ?? Enumerable.Empty <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>())
                             {
                                 roles.Add((role?.Name ?? ""));
                             }
                             tempord.OrdStatus = 30; new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Update <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>(tempord);
                             DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseSaveOrder((tempord?.OrdID ?? 0), roles.ToArray());
                         }
                         else
                         {
                             new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Save <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>(tempord);
                             System.Collections.Generic.List <string> roles = new System.Collections.Generic.List <string>();
                             foreach (var role in zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentApplicationUser()?.Roles ?? Enumerable.Empty <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>())
                             {
                                 roles.Add((role?.Name ?? ""));
                             }
                             DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseUpdateDatasets((tempord?.Id ?? 0), roles.ToArray());
                         }
                     }
                     else
                     {
                         zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "New order received!");
                         if ((temp?.OrdRoutingStatus == 30))
                         {
                             temp.ATA = DateTime.UtcNow;
                         }
                         new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Save <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>(temp);
                     }
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "Order saved successfully.");
                     zAppDev.DotNet.Framework.Data.MiniSessionManager.Instance.Session.Flush();
                     if ((temp?.OrdRoutingStatus == 20))
                     {
                         DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseOrderStarted((temp?.OrdID ?? 0), (temp?.OrdVchPlateNr ?? ""));
                     }
                     else if ((temp?.OrdRoutingStatus == 30))
                     {
                         DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseOrderFinished((temp?.OrdID ?? 0));
                     }
                     else
                     {
                         System.Collections.Generic.List <string> roles = new System.Collections.Generic.List <string>();
                         foreach (var role in zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentApplicationUser()?.Roles ?? Enumerable.Empty <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>())
                         {
                             roles.Add((role?.Name ?? ""));
                         }
                         DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseOnOrderReceive((temp?.OrdID ?? 0), (temp?.Warehouse ?? ""), (temp?.OrdDlsCity ?? ""), (temp?.OrdAgencyDescr ?? ""), roles.ToArray());
                     }
                 }
                 else if ((mes?.key == "truck_location"))
                 {
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "Truck location received!");
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage payload = kvpairs?.FirstOrDefault((x) => x.key == "payload");
                     string gpsjson = zAppDev.DotNet.Framework.Utilities.Common.Base64Decode((payload?.val ?? ""));
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "gps data " + gpsjson);
                     zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.GPSLocation> gps = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.GPSLocation>();
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.GPSLocation temp = gps.FromJson(gpsjson);
                     DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseOnGPSReceive((temp?.truck_license_plate ?? ""), (temp?.latitude?.ToString() ?? ""), (temp?.longitude?.ToString() ?? ""));
                 }
                 else if ((mes?.key == "sarmed_truck_recommendation" && int.Parse((mes?.val ?? "")) > 0))
                 {
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage payload = kvpairs?.FirstOrDefault((x) => x.key == "payload");
                     string truckRec = zAppDev.DotNet.Framework.Utilities.Common.Base64Decode((payload?.val ?? ""));
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "TruckRec " + truckRec);
                     zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.DisruptionAPI.TrucksRecommended> truckSer = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.DisruptionAPI.TrucksRecommended>();
                     DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.DisruptionAPI.TrucksRecommended truck = truckSer.FromJson(truckRec);
                     System.Collections.Generic.List <string> roles = new System.Collections.Generic.List <string>();
                     foreach (var role in zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentApplicationUser()?.Roles ?? Enumerable.Empty <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>())
                     {
                         roles.Add((role?.Name ?? ""));
                     }
                     DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseOnNTUARecommendationReceive(truck.order_id, zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(truck.trucks_recommended, 0), roles.ToArray());
                 }
                 else if ((mes?.key == "sarmed_truck_eta"))
                 {
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage payload = kvpairs?.FirstOrDefault((x) => x.key == "payload");
                     string trucketa = zAppDev.DotNet.Framework.Utilities.Common.Base64Decode((payload?.val ?? ""));
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "Truck eta mess " + trucketa);
                     zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.truck_eta> truckSer = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.truck_eta>();
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.truck_eta truck = truckSer.FromJson(trucketa);
                     var _var1 = truck?.order_id; DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS orderETA = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>((ordETA) => ordETA.OrdID == _var1)?.FirstOrDefault();
                     DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseOnETAReceived((truck?.truck_license_plate ?? ""), (truck?.eta ?? System.Data.SqlTypes.SqlDateTime.MinValue.Value), (truck?.order_id ?? 0));
                 }
                 else if ((mes?.key == "sarmed_truck_emissions"))
                 {
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage payload = kvpairs?.FirstOrDefault((x) => x.key == "payload");
                     string truckemiss = zAppDev.DotNet.Framework.Utilities.Common.Base64Decode((payload?.val ?? ""));
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "co2 " + truckemiss);
                     zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.truck_emission> truckSer = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.truck_emission>();
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.truck_emission truck = truckSer.FromJson(truckemiss);
                     var   _var2 = truck?.truck_license_plate; DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS orderCOE = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>((ordco) => ordco.OrdVchPlateNr == _var2 && ordco.OrdRoutingStatus == 20)?.FirstOrDefault();
                     float?co2em = float.Parse((truck?.co2_emission ?? ""), System.Globalization.NumberStyles.Number | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture);
                     co2em = co2em.GetValueOrDefault(0) / 1000; truck.co2_emission = (co2em?.ToString() ?? ""); DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseOnCO2Received((truck?.truck_license_plate ?? ""), (truck?.co2_emission ?? ""));
                 }
                 else if ((mes?.key == "sarmed_truck_delivery_time"))
                 {
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage payload = kvpairs?.FirstOrDefault((x) => x.key == "payload");
                     string truckAVGtime = zAppDev.DotNet.Framework.Utilities.Common.Base64Decode((payload?.val ?? ""));
                     zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "avg time " + truckAVGtime);
                     zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.AVGTime> avgSer = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.AVGTime>();
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.AVGTime avg = avgSer.FromJson(truckAVGtime);
                     new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Save <DSS3_LogisticsPoolingForUrbanDistribution.BO.AVGTime>(avg);
                 }
             }
         }
         catch (System.Exception x) {
             zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Error, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, x);
         }
     }
 }
Пример #11
0
 public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS> GenerateOrders(int?ordersCount)
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("OrderGenerator", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "GenerateOrders")) {
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoArea>   areas           = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll <DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoArea>();
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse> warehouses      = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll <DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse>();
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>  orders          = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>();
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>  generatedOrders = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>();
         int?areasNo      = (areas?.Count() ?? 0);
         int?ordersNo     = (orders?.Count() ?? 0);
         int?warehousesNo = (warehouses?.Count() ?? 0);
         for (var i = 0; i < ordersCount; i = i + 1)
         {
             int?randomOrderIndex = zAppDev.DotNet.Framework.Utilities.Common.Random.Next(0, (ordersNo).GetValueOrDefault(0));
             DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS tempOrder = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromList(orders, randomOrderIndex.GetValueOrDefault(0));
             DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS copyOrder = tempOrder?.Copy(false, null, true);
             int?randomAreaIndex = zAppDev.DotNet.Framework.Utilities.Common.Random.Next(0, (areasNo).GetValueOrDefault(0));
             DSS3_LogisticsPoolingForUrbanDistribution.BO.GeoArea selectedGeoArea = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromList(areas, randomAreaIndex.GetValueOrDefault(0));
             copyOrder.OrdDlsAddress = ""; copyOrder.OrdDlsCity = (selectedGeoArea?.Area ?? ""); copyOrder.OrdDlsArea = (selectedGeoArea?.County ?? ""); copyOrder.OrdDlsZipCode = (selectedGeoArea?.PostalCode ?? ""); int?randomWarehouseIndex = zAppDev.DotNet.Framework.Utilities.Common.Random.Next(0, (warehousesNo).GetValueOrDefault(0));
             DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse warehouse = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromList(warehouses, randomWarehouseIndex.GetValueOrDefault(0));
             System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent> regionalAgents = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get <DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>((ra) => ra.AreaSupport.Contains(selectedGeoArea));
             int?randomRAIndex = zAppDev.DotNet.Framework.Utilities.Common.Random.Next(0, (regionalAgents?.Count() ?? 0));
             DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent regionalAgent = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromList(regionalAgents, randomRAIndex.GetValueOrDefault(0));
             copyOrder.OrdAgencyCode       = (regionalAgent?.AgencyCode ?? ""); copyOrder.OrdAgencyAddress = (regionalAgent?.AgencyAddress ?? ""); copyOrder.OrdAgencyDescr = (regionalAgent?.AgencyDescription ?? ""); DateTime?now = DateTime.UtcNow;
             copyOrder.OrdRegDateTime      = now; int?randomDaysAdd = zAppDev.DotNet.Framework.Utilities.Common.Random.Next(1, 100);
             copyOrder.OrdDeliveryDateTime = (now?.AddDays((randomDaysAdd).GetValueOrDefault(0)) ?? System.Data.SqlTypes.SqlDateTime.MinValue.Value); copyOrder.OrdStatus = 10; generatedOrders?.Add(copyOrder);
             new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Save <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>(copyOrder);
         }
         return(generatedOrders);
     }
 }
Пример #12
0
 public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrdersPerMonth> GroupRAOrders(int?year, string agentCode)
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("OrdersPerMonth", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "GroupRAOrders")) {
         DateTime?d = new DateTime((year).GetValueOrDefault(0), 01, 01, 0, 0, 0, DateTimeKind.Utc);
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>       ordersFiltered = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>((or) => or.OrdAgencyCode == agentCode);
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrdersPerMonth> ordersPerMonth = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrdersPerMonth>();
         for (var i = 1; i < 13; i = i + 1)
         {
             DSS3_LogisticsPoolingForUrbanDistribution.BO.OrdersPerMonth orderPerMonth = new DSS3_LogisticsPoolingForUrbanDistribution.BO.OrdersPerMonth();
             orderPerMonth.Label = i.ToString(); DateTime?currentMonth = new DateTime(int.Parse((year?.ToString() ?? "")), int.Parse(i.ToString()), 01, 0, 0, 0, DateTimeKind.Utc);
             int?     j         = new int?();
             DateTime?nextMonth = new DateTime?();
             if ((i == 12))
             {
                 year = year.GetValueOrDefault(0) + 1; j = 01; nextMonth = new DateTime(int.Parse((year?.ToString() ?? "")), int.Parse((j?.ToString() ?? "")), 01, 0, 0, 0, DateTimeKind.Utc);
             }
             else
             {
                 j = i + 1; nextMonth = new DateTime(int.Parse((year?.ToString() ?? "")), int.Parse((j?.ToString() ?? "")), 01, 0, 0, 0, DateTimeKind.Utc);
             }
             zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "OrdersPerMonth", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "Current month " + currentMonth.GetValueOrDefault(System.Data.SqlTypes.SqlDateTime.MinValue.Value) + " next month " + nextMonth.GetValueOrDefault(System.Data.SqlTypes.SqlDateTime.MinValue.Value));
             System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS> ordersCounted = ordersFiltered?.Where((ord) => ord.OrdRegDateTime >= currentMonth && ord.OrdRegDateTime < nextMonth).ToList();
             orderPerMonth.Value = (ordersCounted?.Count() ?? 0); ordersPerMonth?.Add(orderPerMonth);
         }
         return(ordersPerMonth);
     }
 }
Пример #13
0
 public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.DashboardStatistics> CalculatePoDStats()
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("DashboardStatistics", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "CalculatePoDStats")) {
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.DashboardStatistics> wow = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.DashboardStatistics>();
         DSS3_LogisticsPoolingForUrbanDistribution.BO.DashboardStatistics stats = new DSS3_LogisticsPoolingForUrbanDistribution.BO.DashboardStatistics();
         stats.InFull = 0; stats.AsOrdered = 0; stats.OnTime = 0; System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.ProofOfDelivery> deliveries = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll <DSS3_LogisticsPoolingForUrbanDistribution.BO.ProofOfDelivery>();
         foreach (var delivery in deliveries ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.ProofOfDelivery>())
         {
             stats.Supplier = (delivery?.OrderWMS?.OrdDepositorFullName ?? ""); if ((delivery?.QuantityStatus == "In Full"))
             {
                 stats.InFull = (stats?.InFull ?? 0) + 1;
             }
             if ((delivery?.QualityStatus == "As Ordered"))
             {
                 stats.AsOrdered = (stats?.AsOrdered ?? 0) + 1;
             }
             if ((delivery?.DeliveryStatus == "On Time"))
             {
                 stats.OnTime = (stats?.OnTime ?? 0) + 1;
             }
         }
         stats.TotalDelivered = (deliveries?.Count() ?? 0); wow?.Add(stats);
         return(wow);
     }
 }