How do I split incoming EDI sales orders into appropriate warehouses while also considering stock status?


I am currently using Sage 100 and Trucommerce Transaction Manager.  Our current setup is incomplete.  Transaction Manager sees what state the sales order is shipping to and then assigns the appropriate warehouse code so that the order will ship from the closest warehouse location.  However,  Transaction Manager does not take into account if the warehouse even has the item in stock.  This creates manual work and creates room for error.  Is there a way to divide sales orders coming into Sage from Transaction Manager into the closest warehouse that has the product in stock?  We are opening a third warehouse soon and would like to solve this before this problem becomes bigger.  Thanks!