예제 #1
0
        public ActivityReport[] GetActRep(Login login, int minutes)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.ActivityReportSelection_V3 ActRepSel = new IWS.ActivityReportSelection_V3();

            IWS.DateTimeSelection      dtSel = new IWS.DateTimeSelection();
            IWS.DateTimeAndIdSelection idSel = new IWS.DateTimeAndIdSelection();

            idSel.DateTimeType = IWS.enumSelectionDateTimeAndIdType.MINUTES;
            idSel.Value        = minutes;

            dtSel.DateTimeType = IWS.enumSelectionDateTimeType.MINUTES;
            dtSel.Value        = minutes;

            ActRepSel.DateTimeSelection = idSel;

            IWS.GetActivityReportResult_V9 ActRepRes = IWSService.Get_ActivityReport_V9(iwsLogin(login), ActRepSel);

            int i = 0;

            ActivityReport[] actRepList = new ActivityReport[ActRepRes.ActivityReportItems.Count()];

            foreach (IWS.ActivityReportItem_V9 act in ActRepRes.ActivityReportItems)
            {
                i = MoveActToActRep(act, ref actRepList, i);
            }
            return(actRepList);
        }
예제 #2
0
        public VehicleInfo[] GetVehicles(Login login)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.DateTimeSelection DtSelection = new IWS.DateTimeSelection()
            {
                DateTimeType = IWS.enumSelectionDateTimeType.GET_ALL,
                //                IWS.enumSelectionDate.GET_MODIFIED_SINCE_LAST_REQUEST,
                Value = null
            };

            IWS.VehicleSelection_With_NextStop_Info GetVehicles = new IWS.VehicleSelection_With_NextStop_Info()
            {
                //Identifiers = new IWS.IdentifierVehicle[] { Vehicle },
                SelectionFromToday  = DtSelection,
                Identifiers         = null,
                IncludePosition     = true,
                IncludeActivity     = true,
                IncludeETAInfo      = true,
                IncludeDrivers      = true,
                IncludeNextStopInfo = true,
                IncludeUpdateDates  = true
            };

            IWS.GetVehicleResult_With_NextStop_Info get_VehicleResult = IWSService.Get_Vehicles_V2(iwsLogin(login), GetVehicles);
            int i = 0;

            VehicleInfo[] vehInfoList = new VehicleInfo[get_VehicleResult.Vehicles.Count()];

            foreach (IWS.VehicleResult_With_NextStop_Info veh in get_VehicleResult.Vehicles)
            {
                VehicleInfo vehinfo = new VehicleInfo();
                vehinfo.VehicleID         = veh.VehicleID;
                vehinfo.VehicleTransicsID = veh.VehicleTransicsID;
                vehinfo.CurrentKms        = veh.CurrentKms;
                vehinfo.LastTrailerCode   = veh.LastTrailerCode;

                if (veh.Position != null)
                {
                    vehinfo.addressInfo             = veh.Position.AddressInfo;
                    vehinfo.distFromCapitol         = veh.Position.DistanceFromCapitol;
                    vehinfo.distFromLargeCity       = veh.Position.DistanceFromLargeCity;
                    vehinfo.distFromSmallcity       = veh.Position.DistanceFromSmallCity;
                    vehinfo.distFromPointOfInterest = veh.Position.DistanceFromPointOfInterest;
                    vehinfo.countryCode             = veh.Position.CountryCode;
                    vehinfo.Latitude  = veh.Position.Latitude;
                    vehinfo.Longitude = veh.Position.Longitude;
                }
                if (veh.NextStopInfo != null)
                {
                    if (veh.NextStopInfo.Place != null)
                    {
                        vehinfo.strPlace = veh.NextStopInfo.Place.PlaceID;
                    }

                    if (veh.NextStopInfo.Trip != null)
                    {
                        vehinfo.strTrip = veh.NextStopInfo.Trip.TripID;
                    }
                }

                try {
                    vehinfo.ETALat      = veh.ETAInfo.PositionDestination.Latitude.NullSafeToDouble();
                    vehinfo.ETALong     = veh.ETAInfo.PositionDestination.Longitude.NullSafeToDouble();
                    vehinfo.ETAStatus   = veh.ETAInfo.ETAStatus.NullSafeToString();
                    vehinfo.DistanceETA = veh.ETAInfo.DistanceETA;
                    vehinfo.ETA         = veh.ETAInfo.ETA;
                    vehinfo.PosInfoDest = veh.ETAInfo.PositionInfoDestination;
                }
                catch { }
                if (veh.UpdateDates != null)
                {
                    vehinfo.LastUpdate = veh.UpdateDates.Position;
                }

                if (veh.Driver != null)
                {
                    vehinfo.strDriverID = veh.Driver.ID;
                }

                if (veh.Activity != null)
                {
                    vehinfo.ActivityID = veh.Activity.ID.ToString();
                }

                if (veh.UpdateDates.GPRS != null)
                {
                    vehinfo.GPRSDate = veh.UpdateDates.GPRS;
                }

                vehInfoList[i] = vehinfo;
                i += 1;
            }
            return(vehInfoList);
        }
예제 #3
0
        public string GetPlanning(Login login, ref Planning planning, string FromDate, ref string ToDate, bool Init)
        {
            IWS.ServiceSoapClient IWSService = InitWS(login);

            IWS.PlanningModificationsSelection_V2 PlanningSelection = new IWS.PlanningModificationsSelection_V2();

            IWS.DateTimeSelection      Selection = new IWS.DateTimeSelection();
            IWS.DateTimeRangeSelection dateRange = new IWS.DateTimeRangeSelection();
            if (Init)
            {
                Selection.DateTimeType = IWS.enumSelectionDateTimeType.GET_MODIFIED_SINCE_LAST_REQUEST;
                PlanningSelection.SelectionFromToday = Selection;
            }
            else
            {
                dateRange.StartDate             = Convert.ToDateTime(FromDate);
                PlanningSelection.DateTimeRange = dateRange;
            }

            PlanningSelection.PlanningSelectionType = IWS.enumPlanningSelectionModificationsType.ALL;
            IWS.GetPlanningModificationsResult_V5 getPlanningResult = IWSService.Get_Planning_Modifications_V5(iwsLogin(login), PlanningSelection);

            string strError = handleError(getPlanningResult);

            if (getPlanningResult.MaximumModificationDate == null)
            {
                ToDate = FromDate;
            }
            else
            {
                ToDate = getPlanningResult.MaximumModificationDate.Value.ToString();
            }

            if (getPlanningResult.Trips != null)
            {
                foreach (IWS.TripItemResult_V5 trip in getPlanningResult.Trips)
                {
                    planning.Trips.Add(new Trip {
                        TripId         = trip.TripId,
                        Status         = trip.Status.ToString(),
                        Vehicle        = trip.Vehicle.ID ?? "",
                        Driver         = trip.Driver?.ID ?? "",
                        StartDate      = trip.StartDate,
                        EndDate        = trip.EndDate,
                        TransferStatus = trip.TransferStatus.ToString(),
                        CancelStatus   = trip.CancelStatus.ToString(),
                        ExecutionDate  = (DateTime)trip.ExecutionDate
                    });
                }
            }
            if (getPlanningResult.Places != null)
            {
                foreach (IWS.PlaceItemResult_V4 place in getPlanningResult.Places)
                {
                    planning.Places.Add(new Place {
                        PlaceId           = place.PlaceId,
                        Status            = place.Status.ToString(),
                        ExecutionDate     = (DateTime)place.ExecutionDate,
                        DriverDisplay     = place.DriverDisplay,
                        VehicleCode       = place.Vehicle.Code ?? "",
                        DriverID          = place.Driver?.ID ?? "",
                        Author            = place.Author,
                        ActivityID        = (int)place.Activity.ID,
                        DispatcherDisplay = place.DispatcherDisplay,
                        Reference         = place.References.InternalReference ?? "",
                        StartDate         = place.StartDate,
                        EndDate           = place.EndDate
                    });
                }
            }
            if (getPlanningResult.Consultation != null)
            {
                foreach (IWS.Consultation_V3 consultation in getPlanningResult.Consultation)
                {
                    Consultation thisCons = new Consultation();
                    if (consultation.Place != null)
                    {
                        thisCons.PlaceId = consultation.Place.PlaceID;
                    }
                    if (consultation.Position != null)
                    {
                        thisCons.Latitude  = consultation.Position.Latitude;
                        thisCons.Longitude = consultation.Position.Longitude;
                    }
                    thisCons.Km = consultation.Km;
                    if (consultation.Trip != null)
                    {
                        thisCons.TripId = consultation.Trip.TripID;
                    }
                    thisCons.VehicleId   = consultation.Vehicle.ID;
                    thisCons.ActivityId  = consultation.Activity.ID;
                    thisCons.ArrivalDate = consultation.ArrivalDate;
                    thisCons.LeavingDate = consultation.LeavingDate;
                    planning.Consultations.Add(thisCons);
                }
            }
            if (getPlanningResult.Anomalies != null)
            {
                foreach (IWS.Anomaly_V3 anomaly in getPlanningResult.Anomalies)
                {
                    if (anomaly.Place == null)
                    {
                        planning.Anomalies.Add(new Anomaly {
                            CustomerID = anomaly.Product?.CustomerID ?? "",
                            //                        DriverId = anomaly.Driver.ID ?? "",
                            AnomalyCode        = anomaly.AnomalyCode,
                            AnomalyDateTime    = anomaly.AnomalyDateTime,
                            AnomalyDescription = anomaly.AnomalyDescription,
                            AnomalyID          = anomaly.AnomalyID
                        });
                    }
                    else
                    {
                        planning.Anomalies.Add(new Anomaly {
                            PlaceId    = anomaly.Place.CustomerID ?? "",
                            CustomerID = anomaly.Product?.CustomerID ?? "",
                            //                        DriverId = anomaly.Driver.ID ?? "",
                            AnomalyCode        = anomaly.AnomalyCode,
                            AnomalyDateTime    = anomaly.AnomalyDateTime,
                            AnomalyDescription = anomaly.AnomalyDescription,
                            AnomalyID          = anomaly.AnomalyID
                        });
                    }
                }
            }
            //if (getPlanningResult.Products != null)
            //    foreach (IWS.ProductItemResult_V3 product in getPlanningResult.Products) {
            //        Product thisProd = new Product();
            //        thisProd.ProductID = product.ProductID;
            //        thisProd.Status = product.Status.ToString();
            //        thisProd.DriverDisplay = product.DriverDisplay;
            //        //planning.Products.Add(thisProd);
            //    }
            if (getPlanningResult.Jobs != null)
            {
                foreach (IWS.JobItemResult_V3 job in getPlanningResult.Jobs)
                {
                    planning.Jobs.Add(new Job {
                        JobId         = job.JobId,
                        Comment       = job.Comment,
                        DriverDisplay = job.DriverDisplay,
                        Status        = job.Status.ToString()
                    });
                }
            }
            return(strError);
        }