use of org.compiere.model.MMovement in project adempiere by adempiere.
the class GenerateMovementMaterial method createMovement.
// generateMovements
private void createMovement(MDDOrderLine orderLine) {
if (movement != null && movement.get_ID() > 0)
return;
movement = new MMovement(orderLine.getParent(), getMovementDate());
//Look the document type for the organization
int docTypeDO_ID = MDocType.getDocType(MDocType.DOCBASETYPE_MaterialMovement, orderLine.getAD_Org_ID());
if (docTypeDO_ID > 0)
movement.setC_DocType_ID(docTypeDO_ID);
else
throw new AdempiereException("@C_DocType_ID@ @NotFound@");
movement.saveEx();
}
use of org.compiere.model.MMovement in project adempiere by adempiere.
the class ImportInventoryMove method processAll.
/**
* Process all movement
*/
private void processAll() {
for (Map.Entry<Integer, MMovement> entry : movementProcessed.entrySet()) {
MMovement movement = entry.getValue();
movement.processIt(docAction);
movement.saveEx();
}
}
use of org.compiere.model.MMovement in project adempiere by adempiere.
the class ImportInventoryMove method importRecords.
// doIt
/**
* import records using I_M_Movement table
*/
private void importRecords() {
isImported = false;
for (X_I_Movement movementImport : getRecords(false, isImportOnlyNoErrors)) {
MMovement movement = importInventoryMovement(movementImport);
if (movement != null)
isImported = importInventoryMovementLine(movement, movementImport);
else
isImported = false;
if (isImported) {
movementImport.setM_Movement_ID(movement.getM_Movement_ID());
movementImport.setI_IsImported(true);
movementImport.setProcessed(true);
movementImport.saveEx();
movement.saveEx();
imported++;
addMovementToProcess(movement);
} else {
movementImport.setI_IsImported(false);
movementImport.setProcessed(true);
movementImport.saveEx();
notImported++;
}
}
processAll();
}
use of org.compiere.model.MMovement in project adempiere by adempiere.
the class InventoryUtil method createMovement.
public static MMovement createMovement(MMDocument doc, String trxName) {
Properties ctx = Env.getCtx();
int AD_Org_ID = getFirst_Org_ID();
MProduct product = getCreateProduct(doc.ProductValue, null);
MLocator locator = getCreateLocator(AD_Org_ID, doc.LocatorValue, doc.LocatorValue);
MLocator locatorTo = getCreateLocator(AD_Org_ID, doc.LocatorValueTo, doc.LocatorValueTo);
//
MMovement m = new MMovement(ctx, 0, trxName);
m.setAD_Org_ID(AD_Org_ID);
m.setMovementDate(doc.Date);
m.saveEx();
//
MMovementLine line = new MMovementLine(m);
line.setM_Product_ID(product.get_ID());
line.setM_Locator_ID(locator.get_ID());
line.setM_LocatorTo_ID(locatorTo.get_ID());
line.setMovementQty(doc.Qty);
line.saveEx();
//
doc.document = m;
processDocument(doc, MMovement.DOCACTION_Complete, MMovement.DOCSTATUS_Completed);
return m;
}
use of org.compiere.model.MMovement in project adempiere by adempiere.
the class MovementGenerate method createMovement.
// createLine
private static MMovement createMovement(MDDOrder order, Timestamp movementDate) {
MMovement move = new MMovement(order.getCtx(), 0, order.get_TrxName());
move.setC_BPartner_ID(order.getC_BPartner_ID());
// shipment address
move.setC_BPartner_Location_ID(order.getC_BPartner_Location_ID());
move.setAD_User_ID(order.getAD_User_ID());
// Default - Today
if (movementDate != null)
move.setMovementDate(movementDate);
// Copy from Order
move.setDD_Order_ID(order.getC_Order_ID());
move.setDeliveryRule(order.getDeliveryRule());
move.setDeliveryViaRule(order.getDeliveryViaRule());
move.setM_Shipper_ID(order.getM_Shipper_ID());
move.setFreightCostRule(order.getFreightCostRule());
move.setFreightAmt(order.getFreightAmt());
move.setSalesRep_ID(order.getSalesRep_ID());
//
move.setC_Activity_ID(order.getC_Activity_ID());
move.setC_Campaign_ID(order.getC_Campaign_ID());
move.setC_Charge_ID(order.getC_Charge_ID());
move.setChargeAmt(order.getChargeAmt());
//
move.setC_Project_ID(order.getC_Project_ID());
//move.setDateOrdered(order.getDateOrdered());
move.setDescription(order.getDescription());
//setPOReference(order.getPOReference());
move.setSalesRep_ID(order.getSalesRep_ID());
move.setAD_OrgTrx_ID(order.getAD_OrgTrx_ID());
move.setUser1_ID(order.getUser1_ID());
move.setUser2_ID(order.getUser2_ID());
move.setPriorityRule(order.getPriorityRule());
return move;
}
Aggregations