Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Now let’s begin creating the customer data. Just enough examples for us to understand what is happening at each step. Let’s create at least 4 customers by following the steps below:
Open the Fizos.Customers.DataTable Data Table and go to the services tab.
Open the AddDataTableEntries service to be executed. This service will allow us to create some general data to work with. You can create as many as you like for this test. Click the values parameter to start creating entries.
After clicking + Add, and enter data for customers. Try to add at least 1 Factor data tag for each customer.
Save your entry and create a second entry with any location and tags you like. We aren’t adding vehicles as of yet, but we will in the next section.
After saving, don’t forget to execute the service with the two entries saved. If you did it correctly, the values parameter of the service, should show at least 1 inside of the parentheses. See below for an example:
We just added customers manually. While convenient for our test, what we truly want is a system that is hands off. What we need is, a way to add customers programatically. Whether a customer is ordering on a website you created for them or they are checking out as a guest (we still want to track this). Below, you’ll see a quick service to add a new user. This service can be created inside of the Fizos.Customers.DataTable data table.
var customer = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({ infoTableName : "InfoTable", dataShapeName : "Fizos.Customers.DataShape" }); var count = me.GetDataTableEntryCount(); var newEntry = {}; newEntry.ID = count + 1; newEntry.UUID = generateGUID(); newEntry.Type = Type; newEntry.Factors = "Fizos.CustomerTags:FirstTime"; newEntry.Name = Name; newEntry.Email = Email; newEntry.Address = Address; newEntry.Phone = Phone; customer.AddRow(); me.AddDataTableEntry({ sourceType: "Service", values: customer, source: "AddNewCustomer" });
We can adapt these for the customers that would rather not have accounts and be considered guests. Instead of the FirstTime data tag, you might want to add a Guest tag. For name, you could have it empty. The other fields, you’ll still want to likely have. This can give you insight into who these customers are that rather the guest checkout/ordering.
Let's do a quick review of what we have before we jump forward. In this Learning Path, we've setup scheduled factory inspections, machine automation, created customers, and setup order creation. What we're missing is the handling of deliveries.
In this learning path, we have talked about how to handle design aspects that could be held in a data table or have entities created to model each one. While there are many pros and cons to each method, we will do a mixture of both. Having the logistics data in data tables provide us with an easy form of querying data. Having entities match up with vehicles/transportation allows us to have greater tracking and live updates.
Let's create the vehicle/transportation data model, come up with logic on how to do deliveries from the factories we created earlier in this learning path, then setup a schedule or timer to kickstart the process.
We already have our Data Table of vehicles. Let's create the templates and entities that will be a 1 to 1 between Thing and vehicle.
Fizos.Vans.ThingTemplate: These are smaller vehicles used to make short or last step deliveries.
Fizos.Trucks.ThingTemplate: These are trucks of different types making larger deliveries.
Fizos.Planes.ThingTemplate: These are planes used to deliver products to long distance locations.
The cost of shipping and delivering goods is often the last thing people want to think about. Sometimes the cost of shipping goods is more expensive than the goods themselves. So how can we make this one of our strongest factors? By continuing trying to make our design simpler and less costly. We all know that it won't be an easy feat. The best way to do this is to have a system where we can have analytics and continuously improve on.
Let's start with the beginner steps of creating our straight-forward delivery service. Then, we will add Value Streams and tracking to see where we can make improvements. Finally, the solutions get better as we repeat these steps. No one solution is perfect, and no logic will be without holes or issues. Nevertheless, you continuously work on it, so that you can save cost and improve customer experience.
Name | Base Type | Aspects | Details |
FuelCapacity | Number | 0 minimum, unit: liters | logged, persistent |
AverageFuelConsumption | Number | 0 minimum, unit: liters | logged, persistent |
MaxMass | Number | 0 minimum, unit: kilograms | logged, persistent |
MaxVolume | Number | 0 minimum, unit: cubic meters | logged, persistent |
CurrentLocation | Location | N/A | logged, persistent |
CurrentOrders | InfoTable(Fizos.Orders.DataShape) | N/A | logged, persistent |
Your properties should look like the following:
Name | Input | Return Type | Override | Async | Description |
PickUpGoods | PickUpLocation: Location | Nothing | Yes | Yes | Go to a pickup location (factory or otherwise), and pick up goods. |
LoadGoods | Orders: InfoTable (Fizos.Orders.DataShape) | Nothing | Yes | Yes | Perform the task of loading goods onto a vehicle (adding rows to the CurrentOrders property) |
Travel | Destination: Location | Nothing | Yes | Yes | Travel for destination A to destination B |
DeliverGoods | Orders: InfoTable (Fizos.Orders.DataShape) | Nothing | Yes | Yes | Perform the task of unloading goods at a current location |
Name | Data Shape | Description |
DestinationReached | AlertEvent | This alert is fired when the vehicle has reached a location (whether for delivery or pickup). |
OrdersLoaded | AlertEvent | This alert is fired when all orders have been loaded onto a vehicle. |
DeliveryCompleted | AlertEvent | This alert is fired when the vehicle has completed a delivery. This delivery might have been the last order delivery and vehicle needs to head back for more orders to be picked up. |
Your Services should look like the following:
Let's take a quick break to go over how this will work.
You may have noticed a few things here. For starters, we are starting this from the Fizos.Logistics entity instead of a scheduler. For this process, you can start it with a scheduler, but being a 24 hour company, we don't have a schedule to start deliveries. That being said, the click of a button would do the job.
You can also see that we haven't given you the service code for some of these services. For some of these functions, they're almost duplicates of prior services. What will be more challenging and fun is the logic for which orders go to which delivery method. This is a mixture of vehicle properties, order properties, customer type, and customer location.
Congratulations! You've successfully completed the Automated Distribution and Logistics guide.
In this guide, you learned how to:
The next guide in the Complex and Automatic Food and Beverage Systems learning path is Securing Industry Data.
We recommend the following resources to continue your learning experience:
Capability Guide
Build | ThingWorx Solutions in Food Industry |
Build | Design Your Data Model |
Build | Implement Services, Events, and Subscriptions |
If you have questions, issues, or need additional information, refer to:
Resource | Link |
Community | Developer Community Forum |
Support | Help Center |