diff --git a/andromeida.midsuit.project/src/andromedia/midsuit/process/MID_MovementCreateLine.java b/andromeida.midsuit.project/src/andromedia/midsuit/process/MID_MovementCreateLine.java new file mode 100644 index 0000000..c8eb0c3 --- /dev/null +++ b/andromeida.midsuit.project/src/andromedia/midsuit/process/MID_MovementCreateLine.java @@ -0,0 +1,50 @@ +package andromedia.midsuit.process; + +import java.util.List; + +import org.compiere.model.MMovementLine; +import org.compiere.model.Query; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.process.SvrProcess; + +import andromedia.midsuit.model.MID_MMovement; +import andromedia.midsuit.model.MID_PPOLine; + +public class MID_MovementCreateLine extends SvrProcess{ + + MID_MMovement movement = null; + @Override + protected void prepare() { + ProcessInfoParameter[] para = getParameter(); + for (int i = 0; i < para.length; i++) + { +// String name = para[i].getParameterName(); +// if ("Recreate".equals(name)) +// isRecreate = "Y".equals(para[i].getParameter()); +// else +// log.log(Level.SEVERE, "Unknown Parameter: " + name); + } + + movement = new MID_MMovement(getCtx(), getRecord_ID(), get_TrxName()); + } + + @Override + protected String doIt() throws Exception { + int PS_PPO_ID = movement.get_ValueAsInt("ps_ppo_ID"); + + List lines = new Query (getCtx(), MID_PPOLine.Table_Name, " ps_ppo_ID =? AND IsEndProduct =?", get_TrxName()) + .setOnlyActiveRecords(true) + .setParameters(new Object[] { PS_PPO_ID, false }) + .list(); + for(MID_PPOLine line : lines) { + MMovementLine mLine = new MMovementLine(movement); + mLine.setM_Product_ID(line.getM_Product_ID()); + mLine.setMovementQty(line.getQtyUsed()); + mLine.setM_Locator_ID(movement.get_ValueAsInt("M_Locator_ID")); + mLine.setM_LocatorTo_ID(movement.get_ValueAsInt("M_LocatorTo_ID")); + mLine.saveEx(); + } + return null; + } + +}