مقدمه ای بر وظایف برنامه ریزی شده ، که رابطه بین وظایف، توقف ها و وسایل نقلیه را به تفصیل پوشش می دهد.
در یک سناریوی تحویل در دنیای واقعی، کسب و کارها وظایف حمل و نقل را به رانندگان محول می کنند، که سپس از یک وسیله نقلیه برای تحویل آنها به گیرنده در یک مکان برنامه ریزی شده، مانند یک محل سکونت یا یک اتاق تحویل در یک مجتمع ساختمانی استفاده می کنند. شما این را در Fleet Engine با ایجاد یک کار و صدور یک درخواست بهروزرسانی وسیله نقلیه تحویل، مدلسازی میکنید، که سپس موجودیت وسیله نقلیه را با لیستی از توقفهای سفر بهروزرسانی میکند. شما به هر ایستگاه لیستی از وظایفی که باید در ایستگاه تکمیل شوند اختصاص می دهید.
میتوانید کارهای خودرو را در هر زمانی بهروزرسانی کنید، اما معمولاً این کار را برای اهداف زیر انجام میدهید:
کارهایی را برای یک وسیله نقلیه برنامه ریزی کنید تا کامل شود. میتوانید این کار را با درخواست بهروزرسانی که توقف جدیدی به خودرو اضافه میکند، یا با درخواست بهروزرسانی که وظیفه جدیدی را به توقف فعلی اضافه میکند، انجام دهید.
ترتیب وظایف موجود مرتبط با توقف وسیله نقلیه معین را به روز کنید .
مکان تکمیل کار را تغییر دهید. بهطور پیشفرض، Fleet Engine مکان تکمیل کار را به عنوان همان مکان توقف وسیله نقلیه مرتبط با کار علامتگذاری میکند. اگر ترجیح می دهید، می توانید مکان های خاصی را برای وظایف فردی مشخص کنید. به عنوان مثال، ممکن است یک وسیله نقلیه در یک مجتمع بزرگ توقف کنید تا تعدادی بسته را تحویل بگیرید، که به هر کدام یک اتاق تحویل نامه خاص اختصاص داده شده است.
کارهایی که قبلاً محول شدهاند را ببندید تا از ترتیب بهروزرسانیشده خارج شوند. برای جزئیات به نهایی کردن وظایف مراجعه کنید.
وظایف تحویل را برنامه ریزی یا تغییر دهید
در صورتی که به راننده امکان مدیریت وظایف را با استفاده از یک دستگاه قابل اعتماد در اختیار راننده قرار دهید، میتوانید از محیط سرور یا با استفاده از Driver SDK برنامهریزی یا تغییر دهید. فقط از یک روش استفاده کنید تا از شرایط مسابقه اجتناب کنید و یک منبع حقیقت را حفظ کنید.
برای تغییر یک محموله از یک وسیله نقلیه به وسیله نقلیه دیگر، کار اصلی را ببندید و قبل از اختصاص دادن به وسیله نقلیه دیگری، آن را دوباره ایجاد کنید. اگر وسیله نقلیه تحویلی را بهروزرسانی کنید تا وظیفهای را که قبلاً به وسیله نقلیه دیگری اختصاص داده شده است شامل شود، با خطا مواجه میشوید.
فیلدهای لازم برای به روز رسانی وظایف
این بخش فیلدهای مورد نیاز برای تنظیم هنگام به روز رسانی یک کار برای یک وسیله نقلیه را مستند می کند. هیچ فیلد اختیاری ارائه نشده است. موتور ناوگان تمام فیلدهای دیگر موجود در موجودیت را برای به روز رسانی نادیده می گیرد.
فیلد الزامی
ارزش
remainingVehicleJourneySegments
فهرستی از بخشهای سفر برای وظایف به ترتیبی که باید اجرا شوند. اولین وظیفه در لیست ابتدا اجرا می شود.
فهرستی از کارهایی که باید در این توقف خودرو انجام شوند.
remainingVehicleJourneySegments[i].stop.state
State.NEW
وظایف را به عنوان مثال اختصاص دهید
مثالهای زیر نحوه استفاده از کتابخانه gRPC جاوا و تماس HTTP REST با UpdateDeliveryVehicle را برای افزودن دو کار جدید برای خودرو نشان میدهند.
gRPC
staticfinalStringPROJECT_ID="my-delivery-co-gcp-project";staticfinalStringVEHICLE_ID="vehicle-8241890";staticfinalStringTASK1_ID="task-756390";staticfinalStringTASK2_ID="task-849263";DeliveryServiceBlockingStubdeliveryService=DeliveryServiceGrpc.newBlockingStub(channel);// Vehicle settingsStringvehicleName="providers/"+PROJECT_ID+"/deliveryVehicles/"+VEHICLE_ID;DeliveryVehicledeliveryVehicle=DeliveryVehicle.newBuilder().addRemainingVehicleJourneySegments(VehicleJourneySegment.newBuilder()// 1st stop.setStop(VehicleStop.newBuilder().setPlannedLocation(LocationInfo.newBuilder().setPoint(LatLng.newBuilder().setLatitude(37.7749).setLongitude(122.4194))).addTasks(TaskInfo.newBuilder().setTaskId(TASK1_ID)).setState(VehicleStop.State.NEW))).addRemainingVehicleJourneySegments(VehicleJourneySegment.newBuilder()// 2nd stop.setStop(VehicleStop.newBuilder().setPlannedLocation(LocationInfo.newBuilder().setPoint(LatLng.newBuilder().setLatitude(37.3382).setLongitude(121.8863))).addTasks(TaskInfo.newBuilder().setTaskId(TASK2_ID)).setState(VehicleStop.State.NEW))).build();// DeliveryVehicle requestUpdateDeliveryVehicleRequestupdateDeliveryRequest=UpdateDeliveryVehicleRequest.newBuilder()// No need for the header.setName(vehicleName).setDeliveryVehicle(deliveryVehicle).setUpdateMask(FieldMask.newBuilder().addPaths("remaining_vehicle_journey_segments")).build();try{DeliveryVehicleupdatedDeliveryVehicle=deliveryService.updateDeliveryVehicle(updateDeliveryVehicleRequest);}catch(StatusRuntimeExceptione){Statuss=e.getStatus();switch(s.getCode()){caseNOT_FOUND:break;casePERMISSION_DENIED:break;}return;}
<id> یک شناسه منحصر به فرد برای وسیله نقلیه تحویلی در ناوگان شما است که قصد دارید سفارش کار را برای آن به روز کنید. این شناسه ای است که هنگام ایجاد وسیله نقلیه مشخص کرده اید.
سرصفحه درخواست باید حاوی یک فیلد مجوز با مقدار حامل <token> باشد که در آن <token> توسط سرور شما مطابق دستورالعملهای شرح داده شده در نقشهای حساب سرویس و نشانههای وب JSON صادر میشود.
بدنه درخواست باید حاوی یک موجودیت DeliveryVehicle باشد
تاریخ آخرین بهروزرسانی 2025-09-03 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-09-03 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eFleet Engine enables modeling real-world deliveries by creating tasks and assigning them to vehicles via stops, allowing for dynamic task management.\u003c/p\u003e\n"],["\u003cp\u003eYou can schedule, reorder, relocate, and close tasks for vehicles using server requests or the Driver SDK, ensuring a single source of truth for task management.\u003c/p\u003e\n"],["\u003cp\u003eTo move a task between vehicles, close the original task and recreate it for the new vehicle, preventing assignment errors.\u003c/p\u003e\n"],["\u003cp\u003eWhen scheduling multiple tasks at the same location, assign them to a single stop to streamline task status sharing and improve efficiency.\u003c/p\u003e\n"],["\u003cp\u003eUpdating tasks involves specifying remaining journey segments, stop locations, associated tasks, and setting the stop state to 'NEW' via gRPC or REST API calls.\u003c/p\u003e\n"]]],[],null,["This document assumes familiarity with the following:\n\n- [Create shipment tasks](/maps/documentation/mobility/fleet-engine/journeys/tasks/create-shipment-tasks)\n- The introduction to [Scheduled tasks](/maps/documentation/mobility/fleet-engine/essentials/tasks-intro), which covers the relationship between tasks, stops, and vehicles in detail.\n\nIn a real-world delivery scenario, businesses assign delivery shipment tasks to\ndrivers, who then use a vehicle to deliver them to the recipient at a planned\nlocation, such as a residence or a delivery room in a building complex. You\nmodel this in Fleet Engine by creating a task and issuing a delivery vehicle\nupdate request, which then updates the vehicle entity with a list of stops to\ntravel. You assign each stop a list of tasks to be completed at the stop.\n\nYou can update vehicle tasks at any time, but typically you do this for the\nfollowing purposes:\n\n- **Schedule tasks** for a vehicle to complete. You can do this either with an update request that adds a new stop to the vehicle, or by an update request that adds a new task to an existing stop.\n- **Update the order of existing tasks** associated with a given vehicle stop.\n- **Change the location of the task completion.** By default, Fleet Engine marks the task completion location as the same location as the vehicle stop associated with the task. If you prefer, you can specify specific locations for individual tasks. For example, you might have a vehicle stop at a large complex to delivery a number of packages, each of which is assigned a specific mail delivery room.\n- **Close any previously assigned tasks** to leave them out of the updated ordering. See [Finalize tasks](/maps/documentation/mobility/fleet-engine/journeys/tasks/finalize-tasks) for details.\n\nSchedule or change delivery tasks\n\nYou can schedule or change tasks assigned to a vehicle from either a server\nenvironment, or by using the Driver SDK if you provide the driver the ability to\nmanage tasks using a trusted device. Use only one method so that you avoid race\nconditions and maintain a single source of truth.\n\nTo change a shipment from one vehicle to another, [close the original task](/maps/documentation/mobility/fleet-engine/journeys/tasks/finalize-tasks#close-task)\nand recreate it before assigning to a different vehicle. If you update a\ndelivery vehicle to include a task that is already assigned to a different\nvehicle, you get an error.\n| **Note:** When you schedule a number of tasks for a vehicle to complete at the same location, you should create a one-to-many association between a stop and the tasks associated with that stop location. Avoid creating a list of stop-task pairs where the stop location is the same for each pair in the list. This helps when you want to share the task status with your consumers using journey sharing. For example, if a driver is making many deliveries to a single office building, you would assign all the delivery tasks to a single vehicle stop.\n\nRequired fields for updating tasks\n\nThis section documents the required fields to set when updating a task for a\nvehicle. No optional fields are provided. Fleet engine ignores all other fields\nin the entity for the update.\n\n\u003cbr /\u003e\n\n| Required field | Value |\n|-----------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|\n| `remainingVehicleJourneySegments` | A list of journey segments for tasks in the order they should be executed. The first task in the list is executed first. |\n| `remainingVehicleJourneySegments[i].stop` | The stop for task *i* in the list. |\n| `remainingVehicleJourneySegments[i].stop.plannedLocation` | The planned location for the stop. |\n| `remainingVehicleJourneySegments[i].stop.tasks` | A list of tasks to be performed at this vehicle stop. |\n| `remainingVehicleJourneySegments[i].stop.state` | `State.NEW` |\n\n\u003cbr /\u003e\n\nAssign tasks example\n\nThe following examples show how to use the [Java gRPC library](/maps/documentation/mobility/fleet-engine/essentials/client-libraries-tasks) and an HTTP\nREST call to `UpdateDeliveryVehicle` to add two new tasks for the vehicle. \n\ngRPC \n\n static final String PROJECT_ID = \"my-delivery-co-gcp-project\";\n static final String VEHICLE_ID = \"vehicle-8241890\";\n static final String TASK1_ID = \"task-756390\";\n static final String TASK2_ID = \"task-849263\";\n\n DeliveryServiceBlockingStub deliveryService =\n DeliveryServiceGrpc.newBlockingStub(channel);\n\n // Vehicle settings\n String vehicleName = \"providers/\" + PROJECT_ID + \"/deliveryVehicles/\" + VEHICLE_ID;\n DeliveryVehicle deliveryVehicle = DeliveryVehicle.newBuilder()\n .addRemainingVehicleJourneySegments(VehicleJourneySegment.newBuilder() // 1st stop\n .setStop(VehicleStop.newBuilder()\n .setPlannedLocation(LocationInfo.newBuilder()\n .setPoint(LatLng.newBuilder()\n .setLatitude(37.7749)\n .setLongitude(122.4194)))\n .addTasks(TaskInfo.newBuilder().setTaskId(TASK1_ID))\n .setState(VehicleStop.State.NEW)))\n .addRemainingVehicleJourneySegments(VehicleJourneySegment.newBuilder() // 2nd stop\n .setStop(VehicleStop.newBuilder()\n .setPlannedLocation(LocationInfo.newBuilder()\n .setPoint(LatLng.newBuilder()\n .setLatitude(37.3382)\n .setLongitude(121.8863)))\n .addTasks(TaskInfo.newBuilder().setTaskId(TASK2_ID))\n .setState(VehicleStop.State.NEW)))\n .build();\n\n // DeliveryVehicle request\n UpdateDeliveryVehicleRequest updateDeliveryRequest =\n UpdateDeliveryVehicleRequest.newBuilder() // No need for the header\n .setName(vehicleName)\n .setDeliveryVehicle(deliveryVehicle)\n .setUpdateMask(FieldMask.newBuilder().addPaths(\"remaining_vehicle_journey_segments\"))\n .build();\n\n try {\n DeliveryVehicle updatedDeliveryVehicle =\n deliveryService.updateDeliveryVehicle(updateDeliveryVehicleRequest);\n } catch (StatusRuntimeException e) {\n Status s = e.getStatus();\n switch (s.getCode()) {\n case NOT_FOUND:\n break;\n case PERMISSION_DENIED:\n break;\n }\n return;\n }\n\nREST \n\n PATCH https://fleetengine.googleapis.com/v1/providers/\u003cproject_id\u003e/deliveryVehicles/\u003cid\u003e?updateMask=remainingVehicleJourneySegments`\n\n- *\\\u003cid\\\u003e* is a unique identifier for a delivery vehicle in your fleet\n for which you intend to update the task ordering. It is the identifier that\n you specified when creating the vehicle.\n\n- The request header must contain a field *Authorization* with the value\n *Bearer \\\u003ctoken\\\u003e* , where *\\\u003ctoken\\\u003e* is issued by your server\n according to the guidelines described in [Service account roles](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/service-accounts) and\n [JSON Web tokens](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/jwt).\n\n- The request body must contain a `DeliveryVehicle` entity\n\nExample `curl` command:\n**Note:** This command overwrites any `remainingVehicleJourneySegments` already set on the delivery vehicle. \n\n # Set JWT, PROJECT_ID, VEHICLE_ID, TASK1_ID, and TASK2_ID in the local\n # environment\n curl -X PATCH \"https://fleetengine.googleapis.com/v1/providers/${PROJECT_ID}/deliveryVehicles/${VEHICLE_ID}?updateMask=remainingVehicleJourneySegments\" \\\n -H \"Content-type: application/json\" \\\n -H \"Authorization: Bearer ${JWT}\" \\\n --data-binary @- \u003c\u003c EOM\n {\n \"remainingVehicleJourneySegments\": [\n {\n \"stop\": {\n \"state\": \"NEW\",\n \"plannedLocation\": {\n \"point\": {\n \"latitude\": 37.7749,\n \"longitude\": -122.084061\n }\n },\n \"tasks\": [\n {\n \"taskId\": \"${TASK1_ID}\"\n }\n ]\n }\n },\n {\n \"stop\": {\n \"state\": \"NEW\",\n \"plannedLocation\": {\n \"point\": {\n \"latitude\": 37.3382,\n \"longitude\": 121.8863\n }\n },\n \"tasks\": [\n {\n \"taskId\": \"${TASK2_ID}\"\n }\n ]\n }\n }\n ]\n }\n EOM\n\n| **Experimental:** As an experimental feature, the `LocationInfo` ([gRPC](/maps/documentation/mobility/fleet-engine/reference/tasks/rpc/maps.fleetengine.delivery.v1#locationinfo) or [REST](/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/LocationInfo)) field now supports using `place` ([gRPC](/maps/documentation/mobility/fleet-engine/reference/tasks/rpc/maps.fleetengine.delivery.v1#maps.fleetengine.delivery.v1.LocationInfo.FIELDS.string.maps.fleetengine.delivery.v1.LocationInfo.place) or [REST](/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/LocationInfo#FIELDS.place)), either alongside or instead of `LatLng`.\n\nWhat's next\n\n- [Update stop status](/maps/documentation/mobility/fleet-engine/journeys/tasks/update-stops)"]]