@Override public void initialize(ModelValidationEngine engine, MClient client) { if (client != null) { ad_Client_ID = client.getAD_Client_ID(); } engine.addModelChange(I_C_CountryArea_Assign.Table_Name, this); }
@Override public void initialize(final ModelValidationEngine engine, final MClient client) { if (client != null) m_AD_Client_ID = client.getAD_Client_ID(); engine.addModelChange(I_C_Order.Table_Name, this); engine.addDocValidate(I_C_Order.Table_Name, this); }
public void initialize(ModelValidationEngine engine, MClient client) { if (client != null) { m_AD_Client_ID = client.getAD_Client_ID(); } engine.addModelChange(MDDOrderLine.Table_Name, this); // engine.addDocValidate(MDDOrderLine.Table_Name, this); // engine.addDocValidate(MMovement.Table_Name, this); } // initialize
/** * Initialize Validation * * @param engine validation engine * @param client client */ public void initialize(ModelValidationEngine engine, MClient client) { // client = null for global validator if (client != null) { m_AD_Client_ID = client.getAD_Client_ID(); if (log.isLoggable(Level.INFO)) log.info(client.toString()); } else { if (log.isLoggable(Level.INFO)) log.info("Initializing global validator: " + this.toString()); } // We want to be informed when C_Order is created/changed engine.addModelChange(MOrder.Table_Name, this); // We want to validate Order before preparing engine.addDocValidate(MOrder.Table_Name, this); } // initialize
@Override public void initialize(final ModelValidationEngine engine, final MClient client) { adClientId = client == null ? -1 : client.getAD_Client_ID(); engine.addModelValidator(new C_Invoice(), client); engine.addModelValidator(new C_BPartner(), client); engine.addModelValidator(C_Order.INSTANCE, client); engine.addModelValidator(C_OrderLine.INSTANCE, client); engine.addModelValidator(new C_OLCand(), client); engine.addModelValidator(EDI_Desadv.INSTANCE, client); engine.addModelValidator(EDI_DesadvLine.INSTANCE, client); engine.addModelValidator(new M_InOut(), client); engine.addModelValidator(M_InOutLine.INSTANCE, client); engine.addModelValidator(new C_Invoice_Candidate(), client); // task 08926 // invoice candidate listener final IInvoiceCandidateListeners invoiceCandidateListeners = Services.get(IInvoiceCandidateListeners.class); invoiceCandidateListeners.addListener(EdiInvoiceCandidateListener.instance); // task 08926 // invoice copy handler Services.get(ICopyHandlerBL.class) .registerCopyHandler( org.compiere.model.I_C_Invoice.class, new IQueryFilter< Pair<org.compiere.model.I_C_Invoice, org.compiere.model.I_C_Invoice>>() { @Override public boolean accept( Pair<org.compiere.model.I_C_Invoice, org.compiere.model.I_C_Invoice> model) { return true; } }, new EdiInvoiceCopyHandler()); }
/** Create Inventory Movements */ private void createMovements() { int noMoves = 0; String info = ""; // MClient client = null; MMovement move = null; int M_Warehouse_ID = 0; int M_WarehouseSource_ID = 0; MWarehouse whSource = null; MWarehouse wh = null; X_T_Replenish[] replenishs = getReplenish("M_WarehouseSource_ID IS NOT NULL"); for (int i = 0; i < replenishs.length; i++) { X_T_Replenish replenish = replenishs[i]; if (whSource == null || whSource.getM_WarehouseSource_ID() != replenish.getM_WarehouseSource_ID()) whSource = MWarehouse.get(getCtx(), replenish.getM_WarehouseSource_ID()); if (wh == null || wh.getM_Warehouse_ID() != replenish.getM_Warehouse_ID()) wh = MWarehouse.get(getCtx(), replenish.getM_Warehouse_ID()); if (client == null || client.getAD_Client_ID() != whSource.getAD_Client_ID()) client = MClient.get(getCtx(), whSource.getAD_Client_ID()); // if (move == null || M_WarehouseSource_ID != replenish.getM_WarehouseSource_ID() || M_Warehouse_ID != replenish.getM_Warehouse_ID()) { M_WarehouseSource_ID = replenish.getM_WarehouseSource_ID(); M_Warehouse_ID = replenish.getM_Warehouse_ID(); move = new MMovement(getCtx(), 0, get_TrxName()); move.setC_DocType_ID(p_C_DocType_ID); move.setDescription( Msg.getMsg(getCtx(), "Replenishment") + ": " + whSource.getName() + "->" + wh.getName()); // Set Org move.setAD_Org_ID(whSource.getAD_Org_ID()); if (!move.save()) return; log.debug(move.toString()); noMoves++; info += " - " + move.getDocumentNo(); } // To int M_LocatorTo_ID = wh.getDefaultLocator().getM_Locator_ID(); // From: Look-up Storage MProduct product = MProduct.get(getCtx(), replenish.getM_Product_ID()); String MMPolicy = product.getMMPolicy(); MStorage[] storages = MStorage.getWarehouse( getCtx(), whSource.getM_Warehouse_ID(), replenish.getM_Product_ID(), 0, 0, true, null, MClient.MMPOLICY_FiFo.equals(MMPolicy), get_TrxName()); // BigDecimal target = replenish.getQtyToOrder(); for (int j = 0; j < storages.length; j++) { MStorage storage = storages[j]; if (storage.getQtyOnHand().signum() <= 0) continue; BigDecimal moveQty = target; if (storage.getQtyOnHand().compareTo(moveQty) < 0) moveQty = storage.getQtyOnHand(); // MMovementLine line = new MMovementLine(move); line.setM_Product_ID(replenish.getM_Product_ID()); line.setMovementQty(moveQty); if (replenish.getQtyToOrder().compareTo(moveQty) != 0) line.setDescription("Total: " + replenish.getQtyToOrder()); line.setM_Locator_ID(storage.getM_Locator_ID()); // from line.setM_AttributeSetInstance_ID(storage.getM_AttributeSetInstance_ID()); line.setM_LocatorTo_ID(M_LocatorTo_ID); // to line.setM_AttributeSetInstanceTo_ID(storage.getM_AttributeSetInstance_ID()); line.save(); // target = target.subtract(moveQty); if (target.signum() == 0) break; } } if (replenishs.length == 0) { m_info = "No Source Warehouse"; log.warn(m_info); } else { m_info = "#" + noMoves + info; log.info(m_info); } } // createRequisition