The orderID is displayed on the checkout success page and in the email body. You can add leading 0's directly to those files.
The DetailProductID comes from the ID in the shopping cart. You would want to update any page where you have add to cart buttons and change the ID column to the MessageNumber when it is added to the cart.