Ocean Freight Custom Doc and Script

Hi All,

We’ve created this custom script that gets ocean vessel data and updates the freight location and data of our shipments. We’ve, also, created a custom form called “Shipment” which enables us to store various data about our logistics. I’ve attached a screenshot of our form, as well, as the script. If we build a dashboard on top of this, we have what Flexport.com and others claim they have about product-level detail of freight.

frappe.ui.form.on("Shipment", "{{Custom Button}}", function(frm) {
var imo = cur_frm.doc.imo_number_vessel;
var settings = {
  URL: "{API Call}",
  method: "GET",
  async: false,
};
var data = {}; //Marinetraffic.com data
$.ajax(settings).done(function (response) {
    data = response;
});
if(data.length > 0){
    var latitude = data[0].LAT;
    var longitude = data[0].LON;
    var eta = data[0].ETA;
cur_frm.get_field("location").locate_control._marker.setLatLng([latitude,longitude]);
cur_frm.get_field("location").map.panTo([latitude,longitude]);
}
else{
    frappe.msgprint("Ship Data Currently Unavailable");
}
});

I hope it’s useful for anyone’s supply chain/logistics needs

5 Likes

@salar - is this part of the logistics module / app? Do you have any solution for tracking deliveries locally?

@zerodiscount It is not part of the module. This is something we created outside the logistics module.I’m having trouble finding the logistics module

I haven’t thought about tracking deliveries locally yet, but when we do I can follow up