Add Generate Lines to Inventory Move

--HG--
branch : EDII
This commit is contained in:
hodianto 2018-12-28 14:08:50 +07:00
parent 34dd813eb9
commit 499cf24ba7
1 changed files with 50 additions and 0 deletions

View File

@ -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<MID_PPOLine> 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;
}
}