Complex sentence: On Foy's return, the expedition against Portugal was preparing, and he received a command in the artillery under Junot, during the occupation of Portugal, and filled the post of inspector of forts and fortresses.
Split into simpler sentences: On Foy's return, the expedition against Portugal was preparing. During the occupation of Portugal, he filled the post of inspector of forts and fortresses.