Examples of MLocator


Examples of org.compiere.model.MLocator

    KeyNamePair currentValue;
    JTextField   editor;

    public Object getCellEditorValue() {
      String locatorValue = editor.getText();
      MLocator loc = null;
      try {
        // Lookup locator using value
        loc = new Query(Env.getCtx(), MLocator.Table_Name, "value=?", null)
                  .setParameters(new Object[]{locatorValue})
                  .setClient_ID()
                  .first();
        // Set new keyNamePair for minitable
        currentValue = getLocatorKeyNamePair(loc.get_ID());

      } catch (Exception e) {
        String message = Msg.getMsg(Env.getCtx(), "Invalid") + " " + editor.getText();
        JOptionPane.showMessageDialog(null, message);
      }
View Full Code Here

Examples of org.compiere.model.MLocator

   * @param M_Locator_ID
   * @return KeyNamePair
   */
  protected KeyNamePair getLocatorKeyNamePair(int M_Locator_ID)
  {
    MLocator locator = null;
   
    // Load desired Locator
    if (M_Locator_ID > 0)
    {
      locator = MLocator.get(Env.getCtx(), M_Locator_ID);
      // Validate warehouse
      if (locator != null && locator.getM_Warehouse_ID() != getM_Warehouse_ID())
      {
        locator = null;
      }
    }
   
    // Try to use default locator from Order Warehouse
    if (locator == null && p_order != null && p_order.getM_Warehouse_ID() == getM_Warehouse_ID())
    {
      MWarehouse wh = MWarehouse.get(Env.getCtx(), p_order.getM_Warehouse_ID());
      if (wh != null)
      {
        locator = wh.getDefaultLocator();
      }
    }
    // Try to get from locator field
    if (locator == null)
    {
      if (defaultLocator_ID > 0)
      {
        locator = MLocator.get(Env.getCtx(), defaultLocator_ID);
      }
    }
    // Validate Warehouse
    if (locator == null || locator.getM_Warehouse_ID() != getM_Warehouse_ID())
    {
      locator = MWarehouse.get(Env.getCtx(), getM_Warehouse_ID()).getDefaultLocator();
    }
   
    KeyNamePair pp = null ;
    if (locator != null)
    {
      pp = new KeyNamePair(locator.get_ID(), locator.getValue());
    }
    return pp;
  }
View Full Code Here

Examples of org.compiere.model.MLocator

  protected String doIt() throws Exception
  {
    X_Z_Packs     pack     = new X_Z_Packs(getCtx(), getRecord_ID(), get_TrxName());
    MProduct      product  = new MProduct(getCtx(), pack.getM_Product_ID(), get_TrxName());
    MPPProductBOM bom      = MPPProductBOM.get(product, getAD_Client_ID(), get_TrxName());
    MLocator      loc      = new MLocator(getCtx(), p_M_Locator_ID, get_TrxName());
    int           chargeID = getChargeID();
   
    // Error Checking.  An error results in an exception thrown which is caught
    // by SrvProcess which then rolls back any changes to the database made as
    // part of the get_TrxName() transaction.
    if (bom.is_new())
      throw new AdempiereUserError("@Error@ Bill Of Materials does not exist for "+
                                   product.getName());
    if (product.getVolume() == null || product.getVolume().doubleValue() <= 0)
      throw new AdempiereUserError("@Error@ Volume value for product "+product.getName()+
                                   " is zero or less.");
    if (!product.isVerified())
      throw new AdempiereUserError("@Error@ Product "+product.getName()+" is not verified");

    // Create the Inventory record
    MInventory inv = new MInventory(getCtx(), 0, get_TrxName());
    inv.setM_Warehouse_ID(loc.getM_Warehouse_ID());
    inv.setClientOrg(getAD_Client_ID(), Env.getAD_Org_ID(getCtx()));
    inv.addDescription("From BOM " + bom.getValue());
    inv.setZPacksDocumentNo();
    inv.save(get_TrxName());
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.