public static void Publish(this BO.OrderWMS @this) { using (new zAppDev.DotNet.Framework.Profiling.Profiler("OrderWMS", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "Publish")) { zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO> ord = new zAppDev.DotNet.Framework.Utilities.Serializer <DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO>(); DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO ordDTO = (new DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderTransformationDataTransformation.Transformer()).OrderWMS_To_OrderDTO(@this); string order = ord.ToJson(ordDTO); string encorder = zAppDev.DotNet.Framework.Utilities.Common.Base64Encode(order); System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage> message = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage>(); DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage mes1 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage(); DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage mes2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage(); DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage mes3 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage(); mes1.type = "string"; mes1.val = "sarmed_order"; mes1.key = "topic"; mes2.type = "int"; mes2.val = "1"; mes2.key = "sarmed_order"; mes3.type = "string"; mes3.val = encorder; mes3.key = "payload"; message?.Add(mes1); message?.Add(mes2); message?.Add(mes3); DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.Publication publication = new DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.Publication(); System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.PubMessage> apisPubMessage = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.PubMessage>(); foreach (var pubs in message ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage>()) { DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.PubMessage pubMessage = (new DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessageDataTransformation.Transformer()).PubMessage_To_PubMessage(pubs); apisPubMessage.Add(pubMessage); } publication.publication = apisPubMessage.ToArray(); DSS3_LogisticsPoolingForUrbanDistribution.BLL.ExternalRestServices.LocalPubSubRestService.Publish(publication); } }
public DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS OrderWMS_To_OrderDTOReversed(DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO domainOrderDTOInput, DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS domainOrderWMSInstance) { //Leave, if there is nothing to transform if (domainOrderDTOInput == null) { return(default(DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS)); } if (domainOrderWMSInstance == null) { return(OrderWMS_To_OrderDTOReversed(domainOrderDTOInput)); } // If the same Transformation has already ran, get the stored Output and return if (OrderWMS_To_OrderDTOReversed_MappingTransformations.ContainsKey(domainOrderDTOInput)) { return(OrderWMS_To_OrderDTOReversed_MappingTransformations[domainOrderDTOInput]); } // Instantiate target root var domainOrderWMSOutput = domainOrderWMSInstance; OrderWMS_To_OrderDTOReversed_MappingTransformations.Add(domainOrderDTOInput, domainOrderWMSOutput); // OrderDTO.OrdPurpose to OrderWMS.OrdPurpose domainOrderWMSOutput.OrdPurpose = domainOrderDTOInput?.OrdPurpose; // OrderDTO.OrdOrderExternalCode to OrderWMS.OrdOrderExternalCode domainOrderWMSOutput.OrdOrderExternalCode = domainOrderDTOInput?.OrdOrderExternalCode; // OrderDTO.OrdOrderDescr to OrderWMS.OrdOrderDescr domainOrderWMSOutput.OrdOrderDescr = domainOrderDTOInput?.OrdOrderDescr; // OrderDTO.OrdRegDateTime to OrderWMS.OrdRegDateTime DateTime?helperFordomainOrderWMSOutputOrdRegDateTime_55745 = domainOrderWMSOutput?.OrdRegDateTime ?? default(DateTime?); OrderWMS_OrdRegDateTimeToOrderDTO_OrdRegDateTimeRightToLeft(domainOrderDTOInput?.OrdRegDateTime, out helperFordomainOrderWMSOutputOrdRegDateTime_55745); domainOrderWMSOutput.OrdRegDateTime = helperFordomainOrderWMSOutputOrdRegDateTime_55745; // OrderDTO.OrdDeliveryDateTime to OrderWMS.OrdDeliveryDateTime DateTime?helperFordomainOrderWMSOutputOrdDeliveryDateTime_640d8 = domainOrderWMSOutput?.OrdDeliveryDateTime ?? default(DateTime?); OrderWMS_OrdDeliveryDateTimeToOrderDTO_OrdDeliveryDateTimeRightToLeft(domainOrderDTOInput?.OrdDeliveryDateTime, out helperFordomainOrderWMSOutputOrdDeliveryDateTime_640d8); domainOrderWMSOutput.OrdDeliveryDateTime = helperFordomainOrderWMSOutputOrdDeliveryDateTime_640d8; // OrderDTO.OrdDepositorCode to OrderWMS.OrdDepositorCode domainOrderWMSOutput.OrdDepositorCode = domainOrderDTOInput?.OrdDepositorCode; // OrderDTO.OrdDepositorFullName to OrderWMS.OrdDepositorFullName domainOrderWMSOutput.OrdDepositorFullName = domainOrderDTOInput?.OrdDepositorFullName; // OrderDTO.OrdCustomerCode to OrderWMS.OrdCustomerCode domainOrderWMSOutput.OrdCustomerCode = domainOrderDTOInput?.OrdCustomerCode; // OrderDTO.OrdCustomerFullName to OrderWMS.OrdCustomerFullName domainOrderWMSOutput.OrdCustomerFullName = domainOrderDTOInput?.OrdCustomerFullName; // OrderDTO.OrdStatus to OrderWMS.OrdStatus domainOrderWMSOutput.OrdStatus = domainOrderDTOInput?.OrdStatus; // OrderDTO.OrdMemo to OrderWMS.OrdMemo domainOrderWMSOutput.OrdMemo = domainOrderDTOInput?.OrdMemo; // OrderDTO.OrdAgencyDescr to OrderWMS.OrdAgencyDescr domainOrderWMSOutput.OrdAgencyDescr = domainOrderDTOInput?.OrdAgencyDescr; // OrderDTO.OrdVoucherNumber to OrderWMS.OrdVoucherNumber domainOrderWMSOutput.OrdVoucherNumber = domainOrderDTOInput?.OrdVoucherNumber; // OrderDTO.OrdIsReturn to OrderWMS.OrdIsReturn domainOrderWMSOutput.OrdIsReturn = domainOrderDTOInput?.OrdIsReturn; // OrderDTO.OrdPrdTypeDescr to OrderWMS.OrdPrdTypeDescr domainOrderWMSOutput.OrdPrdTypeDescr = domainOrderDTOInput?.OrdPrdTypeDescr; // OrderDTO.OrdWrhRoutingCode to OrderWMS.OrdWrhRoutingCode domainOrderWMSOutput.OrdWrhRoutingCode = domainOrderDTOInput?.OrdWrhRoutingCode; // OrderDTO.OrdDlsId to OrderWMS.OrdDlsId domainOrderWMSOutput.OrdDlsId = domainOrderDTOInput?.OrdDlsId; // OrderDTO.OrdDlsDescr to OrderWMS.OrdDlsDescr domainOrderWMSOutput.OrdDlsDescr = domainOrderDTOInput?.OrdDlsDescr; // OrderDTO.OrdVhrID to OrderWMS.OrdVhrID domainOrderWMSOutput.OrdVhrID = domainOrderDTOInput?.OrdVhrID; // OrderDTO.OrdReadyForLoading to OrderWMS.OrdReadyForLoading domainOrderWMSOutput.OrdReadyForLoading = domainOrderDTOInput?.OrdReadyForLoading; // OrderDTO.Polyline to OrderWMS.Polyline domainOrderWMSOutput.Polyline = domainOrderDTOInput?.Polyline; // OrderDTO.WarehouseAddress to OrderWMS.WarehouseAddress domainOrderWMSOutput.WarehouseAddress = domainOrderDTOInput?.WarehouseAddress; // OrderDTO.OrdDeliveryNotes to OrderWMS.OrdDeliveryNotes domainOrderWMSOutput.OrdDeliveryNotes = domainOrderDTOInput?.OrdDeliveryNotes; // OrderDTO.OrdDeliveryValue to OrderWMS.OrdDeliveryValue domainOrderWMSOutput.OrdDeliveryValue = domainOrderDTOInput?.OrdDeliveryValue; // OrderDTO.Warehouse to OrderWMS.Warehouse domainOrderWMSOutput.Warehouse = domainOrderDTOInput?.Warehouse; // OrderDTO.OrdOrderID_Remote to OrderWMS.OrdOrderID_Remote domainOrderWMSOutput.OrdOrderID_Remote = domainOrderDTOInput?.OrdOrderID_Remote; // OrderDTO.OrdDateTime to OrderWMS.OrdDateTime DateTime?helperFordomainOrderWMSOutputOrdDateTime_12124 = domainOrderWMSOutput?.OrdDateTime ?? default(DateTime?); OrderWMS_OrdDateTimeToOrderDTO_OrdDateTimeRightToLeft(domainOrderDTOInput?.OrdDateTime, out helperFordomainOrderWMSOutputOrdDateTime_12124); domainOrderWMSOutput.OrdDateTime = helperFordomainOrderWMSOutputOrdDateTime_12124; // OrderDTO.OrdDlsCity to OrderWMS.OrdDlsCity domainOrderWMSOutput.OrdDlsCity = domainOrderDTOInput?.OrdDlsCity; // OrderDTO.OrdRoutingStatus to OrderWMS.OrdRoutingStatus domainOrderWMSOutput.OrdRoutingStatus = domainOrderDTOInput?.OrdRoutingStatus; // OrderDTO.OrdLfdWeight to OrderWMS.OrdLfdWeight domainOrderWMSOutput.OrdLfdWeight = domainOrderDTOInput?.OrdLfdWeight; // OrderDTO.OrdLfdVol to OrderWMS.OrdLfdVol domainOrderWMSOutput.OrdLfdVol = domainOrderDTOInput?.OrdLfdVol; // OrderDTO.OrdLfdCtn to OrderWMS.OrdLfdCtn domainOrderWMSOutput.OrdLfdCtn = domainOrderDTOInput?.OrdLfdCtn; // OrderDTO.OrdLfdBar to OrderWMS.OrdLfdBar domainOrderWMSOutput.OrdLfdBar = domainOrderDTOInput?.OrdLfdBar; // OrderDTO.OrdLfdPalEuro to OrderWMS.OrdLfdPalEuro domainOrderWMSOutput.OrdLfdPalEuro = domainOrderDTOInput?.OrdLfdPalEuro; // OrderDTO.OrdLfdPalElsa to OrderWMS.OrdLfdPalElsa domainOrderWMSOutput.OrdLfdPalElsa = domainOrderDTOInput?.OrdLfdPalElsa; // OrderDTO.OrdLfdParOU to OrderWMS.OrdLfdParOU domainOrderWMSOutput.OrdLfdParOU = domainOrderDTOInput?.OrdLfdParOU; // OrderDTO.OrdLfdVar to OrderWMS.OrdLfdVar domainOrderWMSOutput.OrdLfdVar = domainOrderDTOInput?.OrdLfdVar; // OrderDTO.OrdLfdPalInd to OrderWMS.OrdLfdPalInd domainOrderWMSOutput.OrdLfdPalInd = domainOrderDTOInput?.OrdLfdPalInd; // OrderDTO.OrdVoucherSeries to OrderWMS.OrdVoucherSeries domainOrderWMSOutput.OrdVoucherSeries = domainOrderDTOInput?.OrdVoucherSeries; // OrderDTO.OrdVchPlateNr to OrderWMS.OrdVchPlateNr domainOrderWMSOutput.OrdVchPlateNr = domainOrderDTOInput?.OrdVchPlateNr; // OrderDTO.OrdVoucherId to OrderWMS.OrdVoucherId domainOrderWMSOutput.OrdVoucherId = domainOrderDTOInput?.OrdVoucherId; // OrderDTO.OrdDlsArea to OrderWMS.OrdDlsArea domainOrderWMSOutput.OrdDlsArea = domainOrderDTOInput?.OrdDlsArea; // OrderDTO.OrdVhrDate to OrderWMS.OrdVhrDate DateTime?helperFordomainOrderWMSOutputOrdVhrDate_cb86e = domainOrderWMSOutput?.OrdVhrDate ?? default(DateTime?); OrderWMS_OrdVhrDateToOrderDTO_OrdVhrDateRightToLeft(domainOrderDTOInput?.OrdVhrDate, out helperFordomainOrderWMSOutputOrdVhrDate_cb86e); domainOrderWMSOutput.OrdVhrDate = helperFordomainOrderWMSOutputOrdVhrDate_cb86e; // OrderDTO.OrdVchRouteNr to OrderWMS.OrdVchRouteNr domainOrderWMSOutput.OrdVchRouteNr = domainOrderDTOInput?.OrdVchRouteNr; // OrderDTO.OrdDlsZipCode to OrderWMS.OrdDlsZipCode domainOrderWMSOutput.OrdDlsZipCode = domainOrderDTOInput?.OrdDlsZipCode; // OrderDTO.OrdTelRouteId to OrderWMS.OrdTelRouteId domainOrderWMSOutput.OrdTelRouteId = zAppDev.DotNet.Framework.Utilities.Common.ConvertToNullableLong(domainOrderDTOInput?.OrdTelRouteId.ToString()); // OrderDTO.OrdAgencyAddress to OrderWMS.OrdAgencyAddress domainOrderWMSOutput.OrdAgencyAddress = domainOrderDTOInput?.OrdAgencyAddress; // OrderDTO.OrdDlsAddress to OrderWMS.OrdDlsAddress domainOrderWMSOutput.OrdDlsAddress = domainOrderDTOInput?.OrdDlsAddress; // OrderDTO.OrdAgencyCode to OrderWMS.OrdAgencyCode domainOrderWMSOutput.OrdAgencyCode = domainOrderDTOInput?.OrdAgencyCode; // OrderDTO.OrdID to OrderWMS.OrdID domainOrderWMSOutput.OrdID = domainOrderDTOInput?.OrdID; return(domainOrderWMSOutput); }
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); } } }
public DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO OrderWMS_To_OrderDTO(DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS domainOrderWMSInput, DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO domainOrderDTOInstance) { //Leave, if there is nothing to transform if (domainOrderWMSInput == null) { return(default(DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderDTO)); } if (domainOrderDTOInstance == null) { return(OrderWMS_To_OrderDTO(domainOrderWMSInput)); } // If the same Transformation has already ran, get the stored Output and return if (OrderWMS_To_OrderDTO_MappingTransformations.ContainsKey(domainOrderWMSInput)) { return(OrderWMS_To_OrderDTO_MappingTransformations[domainOrderWMSInput]); } // Instantiate target root var domainOrderDTOOutput = domainOrderDTOInstance; OrderWMS_To_OrderDTO_MappingTransformations.Add(domainOrderWMSInput, domainOrderDTOOutput); // OrderWMS.OrdPurpose to OrderDTO.OrdPurpose domainOrderDTOOutput.OrdPurpose = domainOrderWMSInput?.OrdPurpose; // OrderWMS.OrdOrderExternalCode to OrderDTO.OrdOrderExternalCode domainOrderDTOOutput.OrdOrderExternalCode = domainOrderWMSInput?.OrdOrderExternalCode; // OrderWMS.OrdOrderDescr to OrderDTO.OrdOrderDescr domainOrderDTOOutput.OrdOrderDescr = domainOrderWMSInput?.OrdOrderDescr; // OrderWMS.OrdRegDateTime to OrderDTO.OrdRegDateTime string helperFordomainOrderDTOOutputOrdRegDateTime_1bf6b = domainOrderDTOOutput?.OrdRegDateTime ?? default(string); OrderDTO_OrdRegDateTimeToOrderWMS_OrdRegDateTimeLeftToRight(domainOrderWMSInput?.OrdRegDateTime, out helperFordomainOrderDTOOutputOrdRegDateTime_1bf6b); domainOrderDTOOutput.OrdRegDateTime = helperFordomainOrderDTOOutputOrdRegDateTime_1bf6b; // OrderWMS.OrdDeliveryDateTime to OrderDTO.OrdDeliveryDateTime string helperFordomainOrderDTOOutputOrdDeliveryDateTime_8cd18 = domainOrderDTOOutput?.OrdDeliveryDateTime ?? default(string); OrderDTO_OrdDeliveryDateTimeToOrderWMS_OrdDeliveryDateTimeLeftToRight(domainOrderWMSInput?.OrdDeliveryDateTime, out helperFordomainOrderDTOOutputOrdDeliveryDateTime_8cd18); domainOrderDTOOutput.OrdDeliveryDateTime = helperFordomainOrderDTOOutputOrdDeliveryDateTime_8cd18; // OrderWMS.OrdDepositorCode to OrderDTO.OrdDepositorCode domainOrderDTOOutput.OrdDepositorCode = domainOrderWMSInput?.OrdDepositorCode; // OrderWMS.OrdDepositorFullName to OrderDTO.OrdDepositorFullName domainOrderDTOOutput.OrdDepositorFullName = domainOrderWMSInput?.OrdDepositorFullName; // OrderWMS.OrdCustomerCode to OrderDTO.OrdCustomerCode domainOrderDTOOutput.OrdCustomerCode = domainOrderWMSInput?.OrdCustomerCode; // OrderWMS.OrdCustomerFullName to OrderDTO.OrdCustomerFullName domainOrderDTOOutput.OrdCustomerFullName = domainOrderWMSInput?.OrdCustomerFullName; // OrderWMS.OrdStatus to OrderDTO.OrdStatus domainOrderDTOOutput.OrdStatus = domainOrderWMSInput?.OrdStatus; // OrderWMS.OrdMemo to OrderDTO.OrdMemo domainOrderDTOOutput.OrdMemo = domainOrderWMSInput?.OrdMemo; // OrderWMS.OrdAgencyDescr to OrderDTO.OrdAgencyDescr domainOrderDTOOutput.OrdAgencyDescr = domainOrderWMSInput?.OrdAgencyDescr; // OrderWMS.OrdVoucherNumber to OrderDTO.OrdVoucherNumber domainOrderDTOOutput.OrdVoucherNumber = domainOrderWMSInput?.OrdVoucherNumber; // OrderWMS.OrdIsReturn to OrderDTO.OrdIsReturn domainOrderDTOOutput.OrdIsReturn = domainOrderWMSInput?.OrdIsReturn; // OrderWMS.OrdPrdTypeDescr to OrderDTO.OrdPrdTypeDescr domainOrderDTOOutput.OrdPrdTypeDescr = domainOrderWMSInput?.OrdPrdTypeDescr; // OrderWMS.OrdWrhRoutingCode to OrderDTO.OrdWrhRoutingCode domainOrderDTOOutput.OrdWrhRoutingCode = domainOrderWMSInput?.OrdWrhRoutingCode; // OrderWMS.OrdDlsId to OrderDTO.OrdDlsId domainOrderDTOOutput.OrdDlsId = domainOrderWMSInput?.OrdDlsId; // OrderWMS.OrdDlsDescr to OrderDTO.OrdDlsDescr domainOrderDTOOutput.OrdDlsDescr = domainOrderWMSInput?.OrdDlsDescr; // OrderWMS.OrdVhrID to OrderDTO.OrdVhrID domainOrderDTOOutput.OrdVhrID = domainOrderWMSInput?.OrdVhrID; // OrderWMS.OrdReadyForLoading to OrderDTO.OrdReadyForLoading domainOrderDTOOutput.OrdReadyForLoading = domainOrderWMSInput?.OrdReadyForLoading; // OrderWMS.Polyline to OrderDTO.Polyline domainOrderDTOOutput.Polyline = domainOrderWMSInput?.Polyline; // OrderWMS.WarehouseAddress to OrderDTO.WarehouseAddress domainOrderDTOOutput.WarehouseAddress = domainOrderWMSInput?.WarehouseAddress; // OrderWMS.OrdDeliveryNotes to OrderDTO.OrdDeliveryNotes domainOrderDTOOutput.OrdDeliveryNotes = domainOrderWMSInput?.OrdDeliveryNotes; // OrderWMS.OrdDeliveryValue to OrderDTO.OrdDeliveryValue domainOrderDTOOutput.OrdDeliveryValue = domainOrderWMSInput?.OrdDeliveryValue; // OrderWMS.Warehouse to OrderDTO.Warehouse domainOrderDTOOutput.Warehouse = domainOrderWMSInput?.Warehouse; // OrderWMS.OrdOrderID_Remote to OrderDTO.OrdOrderID_Remote domainOrderDTOOutput.OrdOrderID_Remote = domainOrderWMSInput?.OrdOrderID_Remote; // OrderWMS.OrdDateTime to OrderDTO.OrdDateTime string helperFordomainOrderDTOOutputOrdDateTime_98ff9 = domainOrderDTOOutput?.OrdDateTime ?? default(string); OrderDTO_OrdDateTimeToOrderWMS_OrdDateTimeLeftToRight(domainOrderWMSInput?.OrdDateTime, out helperFordomainOrderDTOOutputOrdDateTime_98ff9); domainOrderDTOOutput.OrdDateTime = helperFordomainOrderDTOOutputOrdDateTime_98ff9; // OrderWMS.OrdDlsCity to OrderDTO.OrdDlsCity domainOrderDTOOutput.OrdDlsCity = domainOrderWMSInput?.OrdDlsCity; // OrderWMS.OrdRoutingStatus to OrderDTO.OrdRoutingStatus domainOrderDTOOutput.OrdRoutingStatus = domainOrderWMSInput?.OrdRoutingStatus; // OrderWMS.OrdLfdWeight to OrderDTO.OrdLfdWeight domainOrderDTOOutput.OrdLfdWeight = domainOrderWMSInput?.OrdLfdWeight; // OrderWMS.OrdLfdVol to OrderDTO.OrdLfdVol domainOrderDTOOutput.OrdLfdVol = domainOrderWMSInput?.OrdLfdVol; // OrderWMS.OrdLfdCtn to OrderDTO.OrdLfdCtn domainOrderDTOOutput.OrdLfdCtn = domainOrderWMSInput?.OrdLfdCtn; // OrderWMS.OrdLfdBar to OrderDTO.OrdLfdBar domainOrderDTOOutput.OrdLfdBar = domainOrderWMSInput?.OrdLfdBar; // OrderWMS.OrdLfdPalEuro to OrderDTO.OrdLfdPalEuro domainOrderDTOOutput.OrdLfdPalEuro = domainOrderWMSInput?.OrdLfdPalEuro; // OrderWMS.OrdLastUpdateDateTime to OrderDTO.OrdLastUpdateDateTime string helperFordomainOrderDTOOutputOrdLastUpdateDateTime_894b1 = domainOrderDTOOutput?.OrdLastUpdateDateTime ?? default(string); OrderDTO_OrdLastUpdateDateTimeToOrderWMS_OrdLastUpdateDateTimeLeftToRight(domainOrderWMSInput?.OrdLastUpdateDateTime, out helperFordomainOrderDTOOutputOrdLastUpdateDateTime_894b1); domainOrderDTOOutput.OrdLastUpdateDateTime = helperFordomainOrderDTOOutputOrdLastUpdateDateTime_894b1; // OrderWMS.OrdLfdPalElsa to OrderDTO.OrdLfdPalElsa domainOrderDTOOutput.OrdLfdPalElsa = domainOrderWMSInput?.OrdLfdPalElsa; // OrderWMS.OrdLfdParOU to OrderDTO.OrdLfdParOU domainOrderDTOOutput.OrdLfdParOU = domainOrderWMSInput?.OrdLfdParOU; // OrderWMS.OrdLfdVar to OrderDTO.OrdLfdVar domainOrderDTOOutput.OrdLfdVar = domainOrderWMSInput?.OrdLfdVar; // OrderWMS.OrdVoucherDateTime to OrderDTO.OrdVoucherDateTime string helperFordomainOrderDTOOutputOrdVoucherDateTime_2ac1f = domainOrderDTOOutput?.OrdVoucherDateTime ?? default(string); OrderDTO_OrdVoucherDateTimeToOrderWMS_OrdVoucherDateTimeLeftToRight(domainOrderWMSInput?.OrdVoucherDateTime, out helperFordomainOrderDTOOutputOrdVoucherDateTime_2ac1f); domainOrderDTOOutput.OrdVoucherDateTime = helperFordomainOrderDTOOutputOrdVoucherDateTime_2ac1f; // OrderWMS.OrdLfdPalInd to OrderDTO.OrdLfdPalInd domainOrderDTOOutput.OrdLfdPalInd = domainOrderWMSInput?.OrdLfdPalInd; // OrderWMS.OrdVoucherSeries to OrderDTO.OrdVoucherSeries domainOrderDTOOutput.OrdVoucherSeries = domainOrderWMSInput?.OrdVoucherSeries; // OrderWMS.OrdVchPlateNr to OrderDTO.OrdVchPlateNr domainOrderDTOOutput.OrdVchPlateNr = domainOrderWMSInput?.OrdVchPlateNr; // OrderWMS.OrdVoucherId to OrderDTO.OrdVoucherId domainOrderDTOOutput.OrdVoucherId = domainOrderWMSInput?.OrdVoucherId; // OrderWMS.OrdDlsArea to OrderDTO.OrdDlsArea domainOrderDTOOutput.OrdDlsArea = domainOrderWMSInput?.OrdDlsArea; // OrderWMS.OrdVhrDate to OrderDTO.OrdVhrDate string helperFordomainOrderDTOOutputOrdVhrDate_8ba08 = domainOrderDTOOutput?.OrdVhrDate ?? default(string); OrderDTO_OrdVhrDateToOrderWMS_OrdVhrDateLeftToRight(domainOrderWMSInput?.OrdVhrDate, out helperFordomainOrderDTOOutputOrdVhrDate_8ba08); domainOrderDTOOutput.OrdVhrDate = helperFordomainOrderDTOOutputOrdVhrDate_8ba08; // OrderWMS.OrdVchRouteNr to OrderDTO.OrdVchRouteNr domainOrderDTOOutput.OrdVchRouteNr = domainOrderWMSInput?.OrdVchRouteNr; // OrderWMS.OrdDlsZipCode to OrderDTO.OrdDlsZipCode domainOrderDTOOutput.OrdDlsZipCode = domainOrderWMSInput?.OrdDlsZipCode; // OrderWMS.OrdTelRouteId to OrderDTO.OrdTelRouteId domainOrderDTOOutput.OrdTelRouteId = domainOrderWMSInput?.OrdTelRouteId.ToString(); // OrderWMS.OrdAgencyAddress to OrderDTO.OrdAgencyAddress domainOrderDTOOutput.OrdAgencyAddress = domainOrderWMSInput?.OrdAgencyAddress; // OrderWMS.OrdDlsAddress to OrderDTO.OrdDlsAddress domainOrderDTOOutput.OrdDlsAddress = domainOrderWMSInput?.OrdDlsAddress; // OrderWMS.OrdAgencyCode to OrderDTO.OrdAgencyCode domainOrderDTOOutput.OrdAgencyCode = domainOrderWMSInput?.OrdAgencyCode; // OrderWMS.OrdID to OrderDTO.OrdID domainOrderDTOOutput.OrdID = domainOrderWMSInput?.OrdID; return(domainOrderDTOOutput); }