sezgink / paketci-frontend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

It is a project developed for BiTaksi Getir Hackathon 2018. Detailed information can be foud from below.

Team Paketci!

Timeline of our little project!

Paketçi Backend

Getir Hackhathon 2018

Takımdakiler: Sertan Sezgin Kutlu <<<<<<< HEAD Ertuğrul Çınar

Ertuğrul Çınar

600a5566f7b35449521505291b6a4b042b8d38c0 Mehmet Ozan Ünal

Paketci App

Its a work on pack collection and delivery for courier and observer.

Features:

By Backend: 1.Assign routes for couries by relate most efficent path. 2.Update states of packets. 3.Update states of couriers.

By Frontend 1.Courier see waypoints and pack to collect. 2.Observers see all couriers and pack states. 3.Adding new packs

Used Libraries and API in frontend

1.Android Libraries 2.Java 3.Volley 4.Google Maps Directions API 5.Google Maps Javascript API 6.AngularJS

Compleated Part of Frontend

Application is designed for used by cariers. It gave users to see which way courier should go and where to take packs.

In order to make it more stable, decions of disturbution made at backend in order to keep system stable for all users, this app communacte with backend by using asyncrounous http requests.

For async HTTPS requess, it been used Volley library in JSON Object and String responsed GET and POST requests.

App takes missions from backend and by communicating with Google Direcitons API, get caluclations of every shorth path waypoints which collect and carry pointed packs in missions and drawing them on a Map View.

In angular web app we see all packs and couriers with their missions and routes. Its allows users to add new packs to environment.

<<<<<<< HEAD

BACKEND

enter image description here Data structure and Crud Outputs Sample JSON files, it can be enchance according to packet number and courier number

/api/courier

> [   {
>     "_id": 0,
>     "initLocation": {
>       "lat": 40.73726833204571,
>       "long": -111.86816435821093
>     },
>     "curLocation": {
>       "lat": 40.73726833204571,
>       "long": -111.86816435821093
>     },
>     "weightCapacity": 20,
>     "remainingWeightCapacity": 18.2923904630732,
>     "pieceCapacity": 8,
>     "remainingPieceCapacity": 7,
>     "routes": [
>       {
>         "_id": 1,
>         "routeFromGoogle": "",
>         "distance": 0.02248501759660298,
>         "startLoc": {
>           "lat": 40.73726833204571,
>           "long": -111.86816435821093
>         },
>         "endLoc": {
>           "lat": 40.73287234594392,
>           "long": -111.84611325115227
>         },
>         "nearPacketsDistance": [
>           -1
>         ],
>         "state": 1
>       },
>       {
>         "_id": 3,
>         "routeFromGoogle": "",
>         "distance": 0.01372524844602735,
>         "startLoc": {
>           "lat": 40.73287234594392,
>           "long": -111.84611325115227
>         },
>         "endLoc": {
>           "lat": 40.745843583374935,
>           "long": -111.84162666621344
>         },
>         "nearPacketsDistance": [
>           -1
>         ],
>         "state": 1
>       }
>     ],
>     "packets": [
>       {
>         "_id": 0,
>         "initLocation": {
>           "lat": 40.73287234594392,
>           "long": -111.84611325115227
>         },
>         "destLocation": {
>           "lat": 40.745843583374935,
>           "long": -111.84162666621344
>         },
>         "weight": 1.707609536926801,
>         "state": 1,
>         "courier": {}
>       }
>     ]   } ]

/api/packet

[
  {
    "_id": 0,
    "initLocation": {
      "lat": 40.73287234594392,
      "long": -111.84611325115227
    },
    "destLocation": {
      "lat": 40.745843583374935,
      "long": -111.84162666621344
    },
    "weight": 1.707609536926801,
    "state": 1,
    "courier": {}
  }
]

/api/route

> [   {
>     "_id": 0,
>     "routeFromGoogle": "",
>     "distance": 0.027888779677731172,
>     "startLoc": {
>       "lat": 40.73726833204571,
>       "long": -111.86816435821093
>     },
>     "endLoc": {
>       "lat": 40.745843583374935,
>       "long": -111.84162666621344
>     },
>     "nearPacketsDistance": [
>       -1
>     ],
>     "state": 0   },   {
>     "_id": 1,
>     "routeFromGoogle": "",
>     "distance": 0.02248501759660298,
>     "startLoc": {
>       "lat": 40.73726833204571,
>       "long": -111.86816435821093
>     },
>     "endLoc": {
>       "lat": 40.73287234594392,
>       "long": -111.84611325115227
>     },
>     "nearPacketsDistance": [
>       -1
>     ],
>     "state": 1   },   {
>     "_id": 2,
>     "routeFromGoogle": "",
>     "distance": 0,
>     "startLoc": {
>       "lat": 40.73287234594392,
>       "long": -111.84611325115227
>     },
>     "endLoc": {
>       "lat": 40.73287234594392,
>       "long": -111.84611325115227
>     },
>     "nearPacketsDistance": [
>       -1
>     ],
>     "state": 0   },   {
>     "_id": 3,
>     "routeFromGoogle": "",
>     "distance": 0.01372524844602735,
>     "startLoc": {
>       "lat": 40.73287234594392,
>       "long": -111.84611325115227
>     },
>     "endLoc": {
>       "lat": 40.745843583374935,
>       "long": -111.84162666621344
>     },
>     "nearPacketsDistance": [
>       -1
>     ],
>     "state": 1   } ]

Route Optimization

enter image description here Firstly, every courier has a route to common destination point. Then most efficient package route change apply. It's calculated with change of route distance according to package location. It will iterate until no package will left. But according to courier capacities, some of package can be over couriers' capacities; so you need to go second round.

"dependencies": {
    "body-parser": "~1.18.2",
    "cookie-parser": "~1.4.3",
    "debug": "~2.6.9",
    "express": "~4.15.5",
    "mathjs": "^3.20.2",
    "point-line-distance": "^1.0.0",
    "google_directions": "^0.6.0",
    "polyline": "^0.2.0",
    "request": "^2.83.0"
  }

600a5566f7b35449521505291b6a4b042b8d38c0

About


Languages

Language:Java 65.7%Language:HTML 34.1%Language:CSS 0.2%