I am having trouble creating a return shipment. I’ve successfully direct shipped the products from the branch to the scaffold. Now I need to return the items back to the branch. To simulate this on the screen, you would go to Scaffold Register-> Shipments-> Return from Selected Scaffold.
Could you provide a code example of how to do this?
Hi Rodney,
Creating a return is very similar to other types of shipments.
Here is some boilerplate code to get you started:
Shipment returnFromScaffold = Shipment.NewShipment(ShipmentStatusType.NewDirectShip);
ScaffoldTag tag = ScaffoldTag.GetScaffoldTag("A8496");
returnFromScaffold.FromLocationType = SourceType.JobSite;
returnFromScaffold.FromStockingLocationID = tag.StockingLocationID;
returnFromScaffold.ToLocationType = SourceType.BranchOffice;
returnFromScaffold.ToStockingLocationID = tag.ParentStockingLocationID;
returnFromScaffold.CreateDate = DateTime.Now.ToString();
returnFromScaffold.RateProfileID = Guid.Empty;
// TODO: Add rent stop date
//returnFromScaffold.ReturnRentStopDate = DateTime.Now.ToString();
// TODO: Add scaffold tag activity ID
//returnFromScaffold.ReturnScaffoldTagActivityID =
// TODO: Add products
//returnFromScaffold.ShipmentProducts =
if (returnFromScaffold.BrokenRulesCollection.Count > 0)
{
Console.WriteLine("Shipment has errors");
}
else
{
returnFromScaffold.Save();
}
Please let us know if that helps or if you need further assistance.