or I see you've written what I've scanned on paper. Anyway this is the problem
That is a giant step toward your problem. Knowing what the problem is, now it is fairly easy to write PLC logic to solve it.
Think of it in terms of your 3 Outputs Conveyor Motor #1, Flapper, and Conveyor #2. These are the only 3 things that the PLC must control to solve your problem. So why, when, and for how long do we turn on Q1.1. Q1.2, Q1.3? Figure that out and your assignment is 95% finished!
1. Output Q1.1: Turns on to move product to Sensor S1. When S1 = 1, Q1.1 goes off for 2 seconds (use Timer T0). Then if S2 = 1, Q1.1 is turned on again. Instead if S2 = 0, then start Timer T1 AND Output 1.3, wait until T1 is DONE, then restart Q1.1 IF S4 = 1 and Q1.1 is not ON.
2. Output Q1.2: Turns on to move a full box of 24 products off to another place. Assume that Q1.3 runs for 5 seconds (Timer T2) when S4 = 1 AND S3 has triggered a Counter C0 until C0 = 24. If S4 goes off when the full box leaves, then S4 = 1 AGAIN when a new empty box arrives, then turn off Q1.3 and wait until the new box is full.
3. Output Q1.3: Turn on when S1 = 1 AND S2 = 0. Run for 2 seconds (measured by Timer T1), then turn off again, wait for next product.
Those are the 3 Outputs and what each must do, when it goes ON, and when it goes OFF (the only things this PLC can do to any of the 3 devices that control the work).
That is all I have to say about that right now.