Search in sources :

Example 1 with X_I_Movement

use of org.eevolution.model.X_I_Movement 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 2 with X_I_Movement

use of org.eevolution.model.X_I_Movement in project adempiere by adempiere.

the class ImportInventoryMove method fillIDValues.

/**
	 * fill IDs values based on Search Key 
	 */
private void fillIDValues() {
    for (X_I_Movement movementImport : getRecords(false, isImportOnlyNoErrors)) {
        //if(movementImport.getAD_Org_ID()==0)
        movementImport.setAD_Org_ID(getID(MOrg.Table_Name, "Value = ?", new Object[] { movementImport.getOrgValue() }));
        if (movementImport.getM_Product_ID() == 0)
            movementImport.setM_Product_ID(getID(MProduct.Table_Name, "Value = ?", new Object[] { movementImport.getProductValue() }));
        //if(imov.getM_Locator_ID()==0)
        movementImport.setM_Locator_ID(getID(MLocator.Table_Name, "Value = ?", new Object[] { movementImport.getLocatorValue() }));
        //if(imov.getM_LocatorTo_ID()==0)
        movementImport.setM_LocatorTo_ID(getID(MLocator.Table_Name, "Value = ?", new Object[] { movementImport.getLocatorToValue() }));
        if (movementImport.getC_DocType_ID() == 0)
            movementImport.setC_DocType_ID(getID(MDocType.Table_Name, "Name=?", new Object[] { movementImport.getDocTypeName() }));
        if (movementImport.getC_BPartner_ID() == 0)
            movementImport.setC_BPartner_ID(getID(MBPartner.Table_Name, "Value =?", new Object[] { movementImport.getBPartnerValue() }));
        if (movementImport.getM_Shipper_ID() == 0)
            movementImport.setM_Shipper_ID(getID(MShipper.Table_Name, "Name = ?", new Object[] { movementImport.getShipperName() }));
        if (movementImport.getC_Project_ID() == 0)
            movementImport.setC_Project_ID(getID(MProject.Table_Name, "Value = ?", new Object[] { movementImport.getProjectValue() }));
        if (movementImport.getC_Campaign_ID() == 0)
            movementImport.setC_Campaign_ID(getID(MCampaign.Table_Name, "Value = ?", new Object[] { movementImport.getCampaignValue() }));
        if (movementImport.getAD_OrgTrx_ID() == 0)
            movementImport.setAD_OrgTrx_ID(getID(MOrg.Table_Name, "Value = ?", new Object[] { movementImport.getOrgTrxValue() }));
        movementImport.saveEx();
        StringBuilder err = new StringBuilder("");
        if (movementImport.getAD_Org_ID() <= 0)
            err.append(" @AD_Org_ID@ @NotFound@,");
        if (movementImport.getM_Product_ID() <= 0)
            err.append(" @M_Product_ID@ @NotFound@,");
        if (movementImport.getM_Locator_ID() <= 0)
            err.append(" @M_Locator_ID@ @NotFound@,");
        if (movementImport.getM_LocatorTo_ID() <= 0)
            err.append(" @M_LocatorTo_ID@ @NotFound@,");
        if (movementImport.getC_DocType_ID() <= 0)
            err.append(" @C_DocType_ID@ @NotFound@,");
        if (err.toString() != null && err.toString().length() > 0) {
            notImported++;
            movementImport.setI_ErrorMsg(Msg.parseTranslation(getCtx(), err.toString()));
            movementImport.saveEx();
        }
    }
}
Also used : X_I_Movement(org.eevolution.model.X_I_Movement)

Example 3 with X_I_Movement

use of org.eevolution.model.X_I_Movement in project adempiere by adempiere.

the class ImportInventoryMove method doIt.

//	prepare
/**
	 *  Perform process.
	 *  @return Message
	 *  @throws Exception
	 */
protected String doIt() throws Exception {
    //Delete Old Imported
    if (deleteOldImported) {
        int no = 0;
        for (X_I_Movement movement : getRecords(true, false)) {
            movement.deleteEx(true);
            no++;
        }
        log.fine("Delete Old Impored =" + no);
    }
    fillIDValues();
    importRecords();
    return "@I_IsImported@: " + imported + ", @I_ErrorMsg@ : " + notImported;
}
Also used : X_I_Movement(org.eevolution.model.X_I_Movement)

Aggregations

X_I_Movement (org.eevolution.model.X_I_Movement)3 MMovement (org.compiere.model.MMovement)1