Search in sources :

Example 6 with MMovement

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();
}
Also used : AdempiereException(org.adempiere.exceptions.AdempiereException) MMovement(org.compiere.model.MMovement)

Example 7 with MMovement

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();
    }
}
Also used : LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) MMovement(org.compiere.model.MMovement)

Example 8 with MMovement

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();
}
Also used : MMovement(org.compiere.model.MMovement) X_I_Movement(org.eevolution.model.X_I_Movement)

Example 9 with MMovement

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;
}
Also used : MProduct(org.compiere.model.MProduct) MLocator(org.compiere.model.MLocator) Properties(java.util.Properties) MMovementLine(org.compiere.model.MMovementLine) MMovement(org.compiere.model.MMovement)

Example 10 with MMovement

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;
}
Also used : MMovement(org.compiere.model.MMovement)

Aggregations

MMovement (org.compiere.model.MMovement)18 MMovementLine (org.compiere.model.MMovementLine)10 BigDecimal (java.math.BigDecimal)6 AdempiereException (org.adempiere.exceptions.AdempiereException)5 Properties (java.util.Properties)4 MProduct (org.compiere.model.MProduct)4 Timestamp (java.sql.Timestamp)3 MLocator (org.compiere.model.MLocator)3 MStorage (org.compiere.model.MStorage)3 MWarehouse (org.compiere.model.MWarehouse)3 MDDOrder (org.eevolution.model.MDDOrder)3 MClient (org.compiere.model.MClient)2 MInOut (org.compiere.model.MInOut)2 MInOutLine (org.compiere.model.MInOutLine)2 MOrder (org.compiere.model.MOrder)2 MOrderLine (org.compiere.model.MOrderLine)2 Query (org.compiere.model.Query)2 X_T_Replenish (org.compiere.model.X_T_Replenish)2 ProcessInfo (org.compiere.process.ProcessInfo)2 Trx (org.compiere.util.Trx)2