First you need to fix the density function that your demand variable satisfies. Secondly set your proposed model following this distribution without considering JIT. Then finally impose the concept of JIT in your pre-defined model. Hope this strategy will help you modeling your problem.
I would recommend you to use stochastic dynamic programming, the example in the page 51 of the attached is a very good example (Dynamic Programming and Stochastic Control, written by Dimitri Bertsekas) .