We construct a poset from a simple acyclic digraph together with a valuation on its vertices, and we compute the values of its M\"obius function. We show that the weak order on Coxeter groups of type A, B, affine A, and the flag weak order on the wreath product $\mathbb{Z} _r \wr S_n$ introduced by Adin, Brenti and Roichman, are special instances of our construction. We conclude by associating a quasi-symmetric function to each element of these posets. In the $A$ and $\widetilde{A}$ cases, this function coincides respectively with the classical Stanley symmetric function, and with Lam's affine generalization