Moeen Ali hit a century for Worcestershire before the hosts collapsed from 215-3 to 287 all out on day one against Lancashire at New Road.