FEATURE: [ 2306161 ] Locator on line level when creating lines from.
GUI: Added field for using barcode scanner when checking received goods.
This commit is contained in:
parent
230a2c9396
commit
34f8c8ba7c
|
@ -3,321 +3,320 @@
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
* by the Free Software Foundation. This program is distributed in the hope *
|
* by the Free Software Foundation. This program is distributed in the hope *
|
||||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU General Public License for more details. *
|
* See the GNU General Public License for more details. *
|
||||||
* You should have received a copy of the GNU General Public License along *
|
* You should have received a copy of the GNU General Public License along *
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
* For the text or an alternative of this public license, you may reach us *
|
* For the text or an alternative of this public license, you may reach us *
|
||||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
import org.compiere.util.KeyNamePair;
|
import org.compiere.util.KeyNamePair;
|
||||||
import org.compiere.util.NamePair;
|
import org.compiere.util.NamePair;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Warehouse Locator Lookup Model.
|
* Warehouse Locator Lookup Model.
|
||||||
* (Lookup Model is model.Lookup.java)
|
* (Lookup Model is model.Lookup.java)
|
||||||
*
|
*
|
||||||
* @author Jorg Janke
|
* @author Jorg Janke
|
||||||
* @version $Id: MLocatorLookup.java,v 1.3 2006/07/30 00:58:04 jjanke Exp $
|
* @version $Id: MLocatorLookup.java,v 1.3 2006/07/30 00:58:04 jjanke Exp $
|
||||||
*
|
*
|
||||||
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
||||||
* <li>BF [ 1892920 ] Locators fieldshould be ordered by Warehouse/Value
|
* <li>BF [ 1892920 ] Locators fieldshould be ordered by Warehouse/Value
|
||||||
*/
|
* <li>FR [ 2306161 ] Removed limit of 200 on max number of locators.
|
||||||
public final class MLocatorLookup extends Lookup implements Serializable
|
*/
|
||||||
{
|
public final class MLocatorLookup extends Lookup implements Serializable
|
||||||
/**
|
{
|
||||||
* Constructor
|
/**
|
||||||
* @param ctx context
|
* Constructor
|
||||||
* @param WindowNo window no
|
* @param ctx context
|
||||||
*/
|
* @param WindowNo window no
|
||||||
public MLocatorLookup(Properties ctx, int WindowNo)
|
*/
|
||||||
{
|
public MLocatorLookup(Properties ctx, int WindowNo)
|
||||||
super (DisplayType.TableDir, WindowNo);
|
{
|
||||||
m_ctx = ctx;
|
super (DisplayType.TableDir, WindowNo);
|
||||||
//
|
m_ctx = ctx;
|
||||||
m_loader = new Loader();
|
//
|
||||||
m_loader.start();
|
m_loader = new Loader();
|
||||||
} // MLocator
|
m_loader.start();
|
||||||
|
} // MLocator
|
||||||
/** Context */
|
|
||||||
private Properties m_ctx;
|
/** Context */
|
||||||
protected int C_Locator_ID;
|
private Properties m_ctx;
|
||||||
private Loader m_loader;
|
protected int C_Locator_ID;
|
||||||
|
private Loader m_loader;
|
||||||
/** Only Warehouse */
|
|
||||||
private int m_only_Warehouse_ID = 0;
|
/** Only Warehouse */
|
||||||
/** Only Product */
|
private int m_only_Warehouse_ID = 0;
|
||||||
private int m_only_Product_ID = 0;
|
/** Only Product */
|
||||||
|
private int m_only_Product_ID = 0;
|
||||||
/** Storage of data MLookups */
|
|
||||||
private volatile LinkedHashMap<Integer,MLocator> m_lookup = new LinkedHashMap<Integer,MLocator>();
|
/** Storage of data MLookups */
|
||||||
/** Max Locators per Lookup */
|
private volatile LinkedHashMap<Integer,MLocator> m_lookup = new LinkedHashMap<Integer,MLocator>();
|
||||||
private static int s_maxRows = 200; // how many rows to read
|
|
||||||
|
/**
|
||||||
/**
|
* Dispose
|
||||||
* Dispose
|
*/
|
||||||
*/
|
public void dispose()
|
||||||
public void dispose()
|
{
|
||||||
{
|
log.fine("C_Locator_ID=" + C_Locator_ID);
|
||||||
log.fine("C_Locator_ID=" + C_Locator_ID);
|
if (m_loader != null)
|
||||||
if (m_loader != null)
|
{
|
||||||
{
|
while (m_loader.isAlive())
|
||||||
while (m_loader.isAlive())
|
m_loader.interrupt();
|
||||||
m_loader.interrupt();
|
}
|
||||||
}
|
m_loader = null;
|
||||||
m_loader = null;
|
if (m_lookup != null)
|
||||||
if (m_lookup != null)
|
m_lookup.clear();
|
||||||
m_lookup.clear();
|
m_lookup = null;
|
||||||
m_lookup = null;
|
//
|
||||||
//
|
super.dispose();
|
||||||
super.dispose();
|
} // dispose
|
||||||
} // dispose
|
|
||||||
|
/**
|
||||||
/**
|
* Set Warehouse restriction
|
||||||
* Set Warehouse restriction
|
* @param only_Warehouse_ID warehouse
|
||||||
* @param only_Warehouse_ID warehouse
|
*/
|
||||||
*/
|
public void setOnly_Warehouse_ID (int only_Warehouse_ID)
|
||||||
public void setOnly_Warehouse_ID (int only_Warehouse_ID)
|
{
|
||||||
{
|
m_only_Warehouse_ID = only_Warehouse_ID;
|
||||||
m_only_Warehouse_ID = only_Warehouse_ID;
|
} // setOnly_Warehouse_ID
|
||||||
} // setOnly_Warehouse_ID
|
|
||||||
|
/**
|
||||||
/**
|
* Get Only Wahrehouse
|
||||||
* Get Only Wahrehouse
|
* @return warehouse
|
||||||
* @return warehouse
|
*/
|
||||||
*/
|
public int getOnly_Warehouse_ID()
|
||||||
public int getOnly_Warehouse_ID()
|
{
|
||||||
{
|
return m_only_Warehouse_ID;
|
||||||
return m_only_Warehouse_ID;
|
} // getOnly_Warehouse_ID
|
||||||
} // getOnly_Warehouse_ID
|
|
||||||
|
/**
|
||||||
/**
|
* Set Product restriction
|
||||||
* Set Product restriction
|
* @param only_Product_ID Product
|
||||||
* @param only_Product_ID Product
|
*/
|
||||||
*/
|
public void setOnly_Product_ID (int only_Product_ID)
|
||||||
public void setOnly_Product_ID (int only_Product_ID)
|
{
|
||||||
{
|
m_only_Product_ID = only_Product_ID;
|
||||||
m_only_Product_ID = only_Product_ID;
|
} // setOnly_Product_ID
|
||||||
} // setOnly_Product_ID
|
|
||||||
|
/**
|
||||||
/**
|
* Get Only Product
|
||||||
* Get Only Product
|
* @return Product
|
||||||
* @return Product
|
*/
|
||||||
*/
|
public int getOnly_Product_ID()
|
||||||
public int getOnly_Product_ID()
|
{
|
||||||
{
|
return m_only_Product_ID;
|
||||||
return m_only_Product_ID;
|
} // getOnly_Product_ID
|
||||||
} // getOnly_Product_ID
|
|
||||||
|
/**
|
||||||
/**
|
* Wait until async Load Complete
|
||||||
* Wait until async Load Complete
|
*/
|
||||||
*/
|
public void loadComplete()
|
||||||
public void loadComplete()
|
{
|
||||||
{
|
if (m_loader != null)
|
||||||
if (m_loader != null)
|
{
|
||||||
{
|
try
|
||||||
try
|
{
|
||||||
{
|
m_loader.join();
|
||||||
m_loader.join();
|
}
|
||||||
}
|
catch (InterruptedException ie)
|
||||||
catch (InterruptedException ie)
|
{
|
||||||
{
|
log.log(Level.SEVERE, "Join interrupted", ie);
|
||||||
log.log(Level.SEVERE, "Join interrupted", ie);
|
}
|
||||||
}
|
}
|
||||||
}
|
} // loadComplete
|
||||||
} // loadComplete
|
|
||||||
|
/**
|
||||||
/**
|
* Get value
|
||||||
* Get value
|
* @param key key
|
||||||
* @param key key
|
* @return value value
|
||||||
* @return value value
|
*/
|
||||||
*/
|
public NamePair get (Object key)
|
||||||
public NamePair get (Object key)
|
{
|
||||||
{
|
if (key == null)
|
||||||
if (key == null)
|
return null;
|
||||||
return null;
|
|
||||||
|
// try cache
|
||||||
// try cache
|
MLocator loc = (MLocator) m_lookup.get(key);
|
||||||
MLocator loc = (MLocator) m_lookup.get(key);
|
if (loc != null)
|
||||||
if (loc != null)
|
return new KeyNamePair (loc.getM_Locator_ID(), loc.toString());
|
||||||
return new KeyNamePair (loc.getM_Locator_ID(), loc.toString());
|
|
||||||
|
// Not found and waiting for loader
|
||||||
// Not found and waiting for loader
|
if (m_loader.isAlive())
|
||||||
if (m_loader.isAlive())
|
{
|
||||||
{
|
log.fine("Waiting for Loader");
|
||||||
log.fine("Waiting for Loader");
|
loadComplete();
|
||||||
loadComplete();
|
// is most current
|
||||||
// is most current
|
loc = (MLocator) m_lookup.get(key);
|
||||||
loc = (MLocator) m_lookup.get(key);
|
}
|
||||||
}
|
if (loc != null)
|
||||||
if (loc != null)
|
return new KeyNamePair (loc.getM_Locator_ID(), loc.toString());
|
||||||
return new KeyNamePair (loc.getM_Locator_ID(), loc.toString());
|
|
||||||
|
// Try to get it directly
|
||||||
// Try to get it directly
|
return getDirect(key, true, null);
|
||||||
return getDirect(key, true, null);
|
} // get
|
||||||
} // get
|
|
||||||
|
/**
|
||||||
/**
|
* Get Display value
|
||||||
* Get Display value
|
* @param value value
|
||||||
* @param value value
|
* @return String to display
|
||||||
* @return String to display
|
*/
|
||||||
*/
|
public String getDisplay (Object value)
|
||||||
public String getDisplay (Object value)
|
{
|
||||||
{
|
if (value == null)
|
||||||
if (value == null)
|
return "";
|
||||||
return "";
|
//
|
||||||
//
|
NamePair display = get (value);
|
||||||
NamePair display = get (value);
|
if (display == null)
|
||||||
if (display == null)
|
return "<" + value.toString() + ">";
|
||||||
return "<" + value.toString() + ">";
|
return display.toString();
|
||||||
return display.toString();
|
} // getDisplay
|
||||||
} // getDisplay
|
|
||||||
|
/**
|
||||||
/**
|
* The Lookup contains the key
|
||||||
* The Lookup contains the key
|
* @param key key
|
||||||
* @param key key
|
* @return true, if lookup contains key
|
||||||
* @return true, if lookup contains key
|
*/
|
||||||
*/
|
public boolean containsKey (Object key)
|
||||||
public boolean containsKey (Object key)
|
{
|
||||||
{
|
return m_lookup.containsKey(key);
|
||||||
return m_lookup.containsKey(key);
|
} // containsKey
|
||||||
} // containsKey
|
|
||||||
|
/**
|
||||||
/**
|
* Get Data Direct from Table
|
||||||
* Get Data Direct from Table
|
* @param keyValue integer key value
|
||||||
* @param keyValue integer key value
|
* @param saveInCache save in cache
|
||||||
* @param saveInCache save in cache
|
* @param trxName transaction
|
||||||
* @param trxName transaction
|
* @return Object directly loaded
|
||||||
* @return Object directly loaded
|
*/
|
||||||
*/
|
public NamePair getDirect (Object keyValue, boolean saveInCache, String trxName)
|
||||||
public NamePair getDirect (Object keyValue, boolean saveInCache, String trxName)
|
{
|
||||||
{
|
MLocator loc = getMLocator (keyValue, trxName);
|
||||||
MLocator loc = getMLocator (keyValue, trxName);
|
if (loc == null)
|
||||||
if (loc == null)
|
return null;
|
||||||
return null;
|
//
|
||||||
//
|
int key = loc.getM_Locator_ID();
|
||||||
int key = loc.getM_Locator_ID();
|
if (saveInCache)
|
||||||
if (saveInCache)
|
m_lookup.put(new Integer(key), loc);
|
||||||
m_lookup.put(new Integer(key), loc);
|
NamePair retValue = new KeyNamePair(key, loc.toString());
|
||||||
NamePair retValue = new KeyNamePair(key, loc.toString());
|
return retValue;
|
||||||
return retValue;
|
} // getDirect
|
||||||
} // getDirect
|
|
||||||
|
/**
|
||||||
/**
|
* Get Data Direct from Table
|
||||||
* Get Data Direct from Table
|
* @param keyValue integer key value
|
||||||
* @param keyValue integer key value
|
* @param trxName transaction
|
||||||
* @param trxName transaction
|
* @return Object directly loaded
|
||||||
* @return Object directly loaded
|
*/
|
||||||
*/
|
public MLocator getMLocator (Object keyValue, String trxName)
|
||||||
public MLocator getMLocator (Object keyValue, String trxName)
|
{
|
||||||
{
|
// log.fine( "MLocatorLookup.getDirect " + keyValue.getClass() + "=" + keyValue);
|
||||||
// log.fine( "MLocatorLookup.getDirect " + keyValue.getClass() + "=" + keyValue);
|
int M_Locator_ID = -1;
|
||||||
int M_Locator_ID = -1;
|
try
|
||||||
try
|
{
|
||||||
{
|
M_Locator_ID = Integer.parseInt(keyValue.toString());
|
||||||
M_Locator_ID = Integer.parseInt(keyValue.toString());
|
}
|
||||||
}
|
catch (Exception e)
|
||||||
catch (Exception e)
|
{}
|
||||||
{}
|
if (M_Locator_ID == -1)
|
||||||
if (M_Locator_ID == -1)
|
{
|
||||||
{
|
log.log(Level.SEVERE, "Invalid key=" + keyValue);
|
||||||
log.log(Level.SEVERE, "Invalid key=" + keyValue);
|
return null;
|
||||||
return null;
|
}
|
||||||
}
|
//
|
||||||
//
|
return new MLocator (m_ctx, M_Locator_ID, trxName);
|
||||||
return new MLocator (m_ctx, M_Locator_ID, trxName);
|
} // getMLocator
|
||||||
} // getMLocator
|
|
||||||
|
/**
|
||||||
/**
|
* @return a string representation of the object.
|
||||||
* @return a string representation of the object.
|
*/
|
||||||
*/
|
public String toString()
|
||||||
public String toString()
|
{
|
||||||
{
|
return "MLocatorLookup[Size=" + m_lookup.size() + "]";
|
||||||
return "MLocatorLookup[Size=" + m_lookup.size() + "]";
|
} // toString
|
||||||
} // toString
|
|
||||||
|
|
||||||
|
/**
|
||||||
/**
|
* Is Locator with key valid (Warehouse)
|
||||||
* Is Locator with key valid (Warehouse)
|
* @param key key
|
||||||
* @param key key
|
* @return true if valid
|
||||||
* @return true if valid
|
*/
|
||||||
*/
|
public boolean isValid (Object key)
|
||||||
public boolean isValid (Object key)
|
{
|
||||||
{
|
if (key == null)
|
||||||
if (key == null)
|
return true;
|
||||||
return true;
|
// try cache
|
||||||
// try cache
|
MLocator loc = (MLocator) m_lookup.get(key);
|
||||||
MLocator loc = (MLocator) m_lookup.get(key);
|
if (loc == null)
|
||||||
if (loc == null)
|
loc = getMLocator(key, null);
|
||||||
loc = getMLocator(key, null);
|
return isValid(loc);
|
||||||
return isValid(loc);
|
} // isValid
|
||||||
} // isValid
|
|
||||||
|
/**
|
||||||
/**
|
* Is Locator with key valid (Warehouse)
|
||||||
* Is Locator with key valid (Warehouse)
|
* @param locator locator
|
||||||
* @param locator locator
|
* @return true if valid
|
||||||
* @return true if valid
|
*/
|
||||||
*/
|
public boolean isValid (MLocator locator)
|
||||||
public boolean isValid (MLocator locator)
|
{
|
||||||
{
|
if (locator == null || getOnly_Warehouse_ID() == 0)
|
||||||
if (locator == null || getOnly_Warehouse_ID() == 0)
|
return true;
|
||||||
return true;
|
// Warehouse OK - Product check
|
||||||
// Warehouse OK - Product check
|
if (getOnly_Warehouse_ID() == locator.getM_Warehouse_ID())
|
||||||
if (getOnly_Warehouse_ID() == locator.getM_Warehouse_ID())
|
return locator.isCanStoreProduct(getOnly_Product_ID());
|
||||||
return locator.isCanStoreProduct(getOnly_Product_ID());
|
return false;
|
||||||
return false;
|
} // isValid
|
||||||
} // isValid
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
/**************************************************************************
|
* Loader
|
||||||
* Loader
|
*/
|
||||||
*/
|
class Loader extends Thread implements Serializable
|
||||||
class Loader extends Thread implements Serializable
|
{
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loader
|
* Loader
|
||||||
*/
|
*/
|
||||||
public Loader()
|
public Loader()
|
||||||
{
|
{
|
||||||
super("MLocatorLookup");
|
super("MLocatorLookup");
|
||||||
} // Loader
|
} // Loader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load Lookup
|
* Load Lookup
|
||||||
*/
|
*/
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
// log.config("MLocatorLookup Loader.run " + m_AD_Column_ID);
|
// log.config("MLocatorLookup Loader.run " + m_AD_Column_ID);
|
||||||
// Set Info - see VLocator.actionText
|
// Set Info - see VLocator.actionText
|
||||||
int local_only_warehouse_id = getOnly_Warehouse_ID(); // [ 1674891 ] MLocatorLookup - weird error
|
int local_only_warehouse_id = getOnly_Warehouse_ID(); // [ 1674891 ] MLocatorLookup - weird error
|
||||||
int local_only_product_id = getOnly_Product_ID();
|
int local_only_product_id = getOnly_Product_ID();
|
||||||
|
|
||||||
StringBuffer sql = new StringBuffer("SELECT * FROM M_Locator ")
|
StringBuffer sql = new StringBuffer("SELECT * FROM M_Locator ")
|
||||||
.append(" WHERE IsActive='Y'");
|
.append(" WHERE IsActive='Y'");
|
||||||
|
|
||||||
if (local_only_warehouse_id != 0)
|
if (local_only_warehouse_id != 0)
|
||||||
sql.append(" AND M_Warehouse_ID=?");
|
sql.append(" AND M_Warehouse_ID=?");
|
||||||
if (local_only_product_id != 0)
|
if (local_only_product_id != 0)
|
||||||
sql.append(" AND (IsDefault='Y' ") // Default Locator
|
sql.append(" AND (IsDefault='Y' ") // Default Locator
|
||||||
.append("OR EXISTS (SELECT * FROM M_Product p ") // Product Locator
|
.append("OR EXISTS (SELECT * FROM M_Product p ") // Product Locator
|
||||||
|
@ -329,138 +328,132 @@ public final class MLocatorLookup extends Lookup implements Serializable
|
||||||
sql.append("(SELECT wh.Name FROM M_Warehouse wh WHERE wh.M_Warehouse_ID=M_Locator.M_Warehouse_ID),");
|
sql.append("(SELECT wh.Name FROM M_Warehouse wh WHERE wh.M_Warehouse_ID=M_Locator.M_Warehouse_ID),");
|
||||||
sql.append("M_Locator.Value");
|
sql.append("M_Locator.Value");
|
||||||
String finalSql = MRole.getDefault(m_ctx, false).addAccessSQL(
|
String finalSql = MRole.getDefault(m_ctx, false).addAccessSQL(
|
||||||
sql.toString(), "M_Locator", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
sql.toString(), "M_Locator", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
||||||
if (isInterrupted())
|
if (isInterrupted())
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "Interrupted");
|
log.log(Level.SEVERE, "Interrupted");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset
|
// Reset
|
||||||
m_lookup.clear();
|
m_lookup.clear();
|
||||||
int rows = 0;
|
int rows = 0;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(finalSql, null);
|
pstmt = DB.prepareStatement(finalSql, null);
|
||||||
int index = 1;
|
int index = 1;
|
||||||
if (local_only_warehouse_id != 0)
|
if (local_only_warehouse_id != 0)
|
||||||
pstmt.setInt(index++, getOnly_Warehouse_ID());
|
pstmt.setInt(index++, getOnly_Warehouse_ID());
|
||||||
if (local_only_product_id != 0)
|
if (local_only_product_id != 0)
|
||||||
{
|
{
|
||||||
pstmt.setInt(index++, getOnly_Product_ID());
|
pstmt.setInt(index++, getOnly_Product_ID());
|
||||||
pstmt.setInt(index++, getOnly_Product_ID());
|
pstmt.setInt(index++, getOnly_Product_ID());
|
||||||
}
|
}
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
//
|
//
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
// Max out
|
MLocator loc = new MLocator(m_ctx, rs, null);
|
||||||
if (rows++ > s_maxRows)
|
int M_Locator_ID = loc.getM_Locator_ID();
|
||||||
{
|
m_lookup.put(new Integer(M_Locator_ID), loc);
|
||||||
log.warning("Over Max Rows - " + rows);
|
}
|
||||||
break;
|
}
|
||||||
}
|
catch (SQLException e)
|
||||||
MLocator loc = new MLocator(m_ctx, rs, null);
|
{
|
||||||
int M_Locator_ID = loc.getM_Locator_ID();
|
log.log(Level.SEVERE, finalSql, e);
|
||||||
m_lookup.put(new Integer(M_Locator_ID), loc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (SQLException e)
|
|
||||||
{
|
|
||||||
log.log(Level.SEVERE, finalSql, e);
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
rs = null; pstmt = null;
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
log.fine("Complete #" + m_lookup.size());
|
log.fine("Complete #" + m_lookup.size());
|
||||||
if (m_lookup.size() == 0)
|
if (m_lookup.size() == 0)
|
||||||
log.finer(finalSql);
|
log.finer(finalSql);
|
||||||
} // run
|
} // run
|
||||||
} // Loader
|
} // Loader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return info as ArrayList containing Locator, waits for the loader to finish
|
* Return info as ArrayList containing Locator, waits for the loader to finish
|
||||||
* @return Collection of lookup values
|
* @return Collection of lookup values
|
||||||
*/
|
*/
|
||||||
public Collection<MLocator> getData ()
|
public Collection<MLocator> getData ()
|
||||||
{
|
{
|
||||||
if (m_loader.isAlive())
|
if (m_loader.isAlive())
|
||||||
{
|
{
|
||||||
log.fine("Waiting for Loader");
|
log.fine("Waiting for Loader");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_loader.join();
|
m_loader.join();
|
||||||
}
|
}
|
||||||
catch (InterruptedException ie)
|
catch (InterruptedException ie)
|
||||||
{
|
{
|
||||||
log.severe ("Join interrupted - " + ie.getMessage());
|
log.severe ("Join interrupted - " + ie.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return m_lookup.values();
|
return m_lookup.values();
|
||||||
} // getData
|
} // getData
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return data as sorted ArrayList
|
* Return data as sorted ArrayList
|
||||||
* @param mandatory mandatory
|
* @param mandatory mandatory
|
||||||
* @param onlyValidated only validated
|
* @param onlyValidated only validated
|
||||||
* @param onlyActive only active
|
* @param onlyActive only active
|
||||||
* @param temporary force load for temporary display
|
* @param temporary force load for temporary display
|
||||||
* @return ArrayList of lookup values
|
* @return ArrayList of lookup values
|
||||||
*/
|
*/
|
||||||
public ArrayList<Object> getData (boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary)
|
public ArrayList<Object> getData (boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary)
|
||||||
{
|
{
|
||||||
// create list
|
// create list
|
||||||
Collection<MLocator> collection = getData();
|
Collection<MLocator> collection = getData();
|
||||||
ArrayList<Object> list = new ArrayList<Object>(collection.size());
|
ArrayList<Object> list = new ArrayList<Object>(collection.size());
|
||||||
Iterator<MLocator> it = collection.iterator();
|
Iterator<MLocator> it = collection.iterator();
|
||||||
while (it.hasNext())
|
while (it.hasNext())
|
||||||
{
|
{
|
||||||
MLocator loc = it.next();
|
MLocator loc = it.next();
|
||||||
if (isValid(loc)) // only valid warehouses
|
if (isValid(loc)) // only valid warehouses
|
||||||
list.add(loc);
|
list.add(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sort Data
|
/** Sort Data
|
||||||
MLocator l = new MLocator (m_ctx, 0);
|
MLocator l = new MLocator (m_ctx, 0);
|
||||||
if (!mandatory)
|
if (!mandatory)
|
||||||
list.add (l);
|
list.add (l);
|
||||||
Collections.sort (list, l);
|
Collections.sort (list, l);
|
||||||
**/
|
**/
|
||||||
return list;
|
return list;
|
||||||
} // getArray
|
} // getArray
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh Values
|
* Refresh Values
|
||||||
* @return new size of lookup
|
* @return new size of lookup
|
||||||
*/
|
*/
|
||||||
public int refresh()
|
public int refresh()
|
||||||
{
|
{
|
||||||
log.fine("start");
|
log.fine("start");
|
||||||
m_loader = new Loader();
|
m_loader = new Loader();
|
||||||
m_loader.start();
|
m_loader.start();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_loader.join();
|
m_loader.join();
|
||||||
}
|
}
|
||||||
catch (InterruptedException ie)
|
catch (InterruptedException ie)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
log.info("#" + m_lookup.size());
|
log.info("#" + m_lookup.size());
|
||||||
return m_lookup.size();
|
return m_lookup.size();
|
||||||
} // refresh
|
} // refresh
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get underlying fully qualified Table.Column Name
|
* Get underlying fully qualified Table.Column Name
|
||||||
* @return Table.ColumnName
|
* @return Table.ColumnName
|
||||||
*/
|
*/
|
||||||
public String getColumnName()
|
public String getColumnName()
|
||||||
{
|
{
|
||||||
return "M_Locator.M_Locator_ID";
|
return "M_Locator.M_Locator_ID";
|
||||||
} // getColumnName
|
} // getColumnName
|
||||||
|
|
||||||
} // MLocatorLookup
|
} // MLocatorLookup
|
||||||
|
|
|
@ -34,6 +34,7 @@ import java.util.logging.Level;
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JTextField;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
import javax.swing.event.TableModelEvent;
|
import javax.swing.event.TableModelEvent;
|
||||||
|
@ -217,6 +218,8 @@ public abstract class VCreateFrom extends CDialog
|
||||||
protected JComboBox invoiceField = new JComboBox();
|
protected JComboBox invoiceField = new JComboBox();
|
||||||
protected JLabel shipmentLabel = new JLabel();
|
protected JLabel shipmentLabel = new JLabel();
|
||||||
protected JComboBox shipmentField = new JComboBox();
|
protected JComboBox shipmentField = new JComboBox();
|
||||||
|
protected JLabel upcLabel = new JLabel();
|
||||||
|
protected JTextField upcField = new JTextField();
|
||||||
private JScrollPane dataPane = new JScrollPane();
|
private JScrollPane dataPane = new JScrollPane();
|
||||||
private CPanel southPanel = new CPanel();
|
private CPanel southPanel = new CPanel();
|
||||||
private BorderLayout southLayout = new BorderLayout();
|
private BorderLayout southLayout = new BorderLayout();
|
||||||
|
@ -276,6 +279,7 @@ public abstract class VCreateFrom extends CDialog
|
||||||
rmaLabel.setText(Msg.translate(Env.getCtx(), "M_RMA_ID"));
|
rmaLabel.setText(Msg.translate(Env.getCtx(), "M_RMA_ID"));
|
||||||
sameWarehouseCb.setText(Msg.getMsg(Env.getCtx(), "FromSameWarehouseOnly", true));
|
sameWarehouseCb.setText(Msg.getMsg(Env.getCtx(), "FromSameWarehouseOnly", true));
|
||||||
sameWarehouseCb.setToolTipText(Msg.getMsg(Env.getCtx(), "FromSameWarehouseOnly", false));
|
sameWarehouseCb.setToolTipText(Msg.getMsg(Env.getCtx(), "FromSameWarehouseOnly", false));
|
||||||
|
upcLabel.setText(Msg.getElement(Env.getCtx(), "UPC", false));
|
||||||
documentTypeLabel.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
|
documentTypeLabel.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
|
||||||
tenderTypeLabel.setText(Msg.translate(Env.getCtx(), "TenderType"));
|
tenderTypeLabel.setText(Msg.translate(Env.getCtx(), "TenderType"));
|
||||||
|
|
||||||
|
@ -384,6 +388,13 @@ public abstract class VCreateFrom extends CDialog
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||||
parameterStdPanel.add(sameWarehouseCb, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
|
parameterStdPanel.add(sameWarehouseCb, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||||
|
if (this instanceof VCreateFromShipment) {
|
||||||
|
parameterStdPanel.add(upcLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
|
||||||
|
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||||
|
parameterStdPanel.add(upcField, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0
|
||||||
|
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add RMA document selection to panel
|
// Add RMA document selection to panel
|
||||||
parameterStdPanel.add(rmaLabel, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0
|
parameterStdPanel.add(rmaLabel, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0
|
||||||
|
@ -648,7 +659,7 @@ public abstract class VCreateFrom extends CDialog
|
||||||
line.add(qtyEntered); // 1-Qty
|
line.add(qtyEntered); // 1-Qty
|
||||||
KeyNamePair pp = new KeyNamePair(rs.getInt(3), rs.getString(4).trim());
|
KeyNamePair pp = new KeyNamePair(rs.getInt(3), rs.getString(4).trim());
|
||||||
line.add(pp); // 2-UOM
|
line.add(pp); // 2-UOM
|
||||||
pp = new KeyNamePair(rs.getInt(5), rs.getString(6));
|
pp = new KeyNamePair(rs.getInt(5), rs.getString(6));
|
||||||
line.add(pp); // 3-Product
|
line.add(pp); // 3-Product
|
||||||
line.add(rs.getString(7)); // 4-VendorProductNo
|
line.add(rs.getString(7)); // 4-VendorProductNo
|
||||||
pp = new KeyNamePair(rs.getInt(8), rs.getString(9));
|
pp = new KeyNamePair(rs.getInt(8), rs.getString(9));
|
||||||
|
|
|
@ -22,8 +22,10 @@ import java.math.*;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.*;
|
import java.util.logging.*;
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import javax.swing.event.*;
|
||||||
import javax.swing.table.*;
|
import javax.swing.table.*;
|
||||||
|
|
||||||
import org.adempiere.plaf.AdempierePLAF;
|
import org.adempiere.plaf.AdempierePLAF;
|
||||||
import org.compiere.grid.ed.*;
|
import org.compiere.grid.ed.*;
|
||||||
import org.compiere.model.*;
|
import org.compiere.model.*;
|
||||||
|
@ -37,6 +39,82 @@ import org.compiere.util.*;
|
||||||
*/
|
*/
|
||||||
public class VCreateFromShipment extends VCreateFrom implements VetoableChangeListener
|
public class VCreateFromShipment extends VCreateFrom implements VetoableChangeListener
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cell editor specific for the MLocator in this form's table.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class InnerLocatorTableCellEditor extends AbstractCellEditor implements TableCellEditor, CellEditorListener {
|
||||||
|
|
||||||
|
private KeyNamePair m_locatorKey;
|
||||||
|
private VLocator v_loc;
|
||||||
|
private JTable m_table;
|
||||||
|
private int m_row;
|
||||||
|
private int m_column;
|
||||||
|
|
||||||
|
public InnerLocatorTableCellEditor() {
|
||||||
|
addCellEditorListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getCellEditorValue() {
|
||||||
|
return(m_locatorKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param table
|
||||||
|
* @param value The current value in the cell. In this case, a KeyName pair of the locator
|
||||||
|
* @param isSelected
|
||||||
|
* @param row
|
||||||
|
* @param column
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
|
||||||
|
m_table = table;
|
||||||
|
m_row = row;
|
||||||
|
m_column = column;
|
||||||
|
m_locatorKey = (KeyNamePair)value;
|
||||||
|
MLocatorLookup mLocatorLookup = new MLocatorLookup(Env.getCtx(), 0);
|
||||||
|
v_loc = new VLocator("M_Locator_ID", true, false, true, mLocatorLookup, 0);
|
||||||
|
v_loc.setValue(m_locatorKey.getKey());
|
||||||
|
return(v_loc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When editing stops (editing done), save the value in the table model
|
||||||
|
* and update the product's default locator.
|
||||||
|
*
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
|
public void editingStopped(ChangeEvent e) {
|
||||||
|
// Editing ends, save value
|
||||||
|
if (v_loc.getValue()!=null) {
|
||||||
|
int key = ((Integer)v_loc.getValue()).intValue();
|
||||||
|
MLocator locator = new MLocator(Env.getCtx(), key, null);
|
||||||
|
m_locatorKey = new KeyNamePair(key, locator.getValue());
|
||||||
|
m_table.getModel().setValueAt(m_locatorKey, m_row, m_column);
|
||||||
|
|
||||||
|
// Get product and save new locator
|
||||||
|
KeyNamePair prodKey = (KeyNamePair)m_table.getModel().getValueAt(m_row, m_column + 1);
|
||||||
|
MProduct prod = new MProduct(Env.getCtx(), prodKey.getKey(), null);
|
||||||
|
prod.setM_Locator_ID(key);
|
||||||
|
prod.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When editing stops, do nothing.
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
|
public void editingCanceled(ChangeEvent e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// == END OF INNER CLASS InnerLocatorTableCellEditor
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Protected Constructor
|
* Protected Constructor
|
||||||
* @param mTab MTab
|
* @param mTab MTab
|
||||||
|
@ -49,25 +127,48 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
|
|
||||||
/** Loaded Invoice */
|
/** Loaded Invoice */
|
||||||
private MInvoice m_invoice = null;
|
private MInvoice m_invoice = null;
|
||||||
/** Loaded RMA */
|
/** Loaded RMA */
|
||||||
private MRMA m_rma = null;
|
private MRMA m_rma = null;
|
||||||
|
|
||||||
|
private static int COL_SELECT = 0;
|
||||||
|
private static int COL_QTY = 1;
|
||||||
|
private static int COL_UOM = 2;
|
||||||
|
private static int COL_LOCATOR_ID = 3;
|
||||||
|
private static int COL_PRODUCT_ID = 4;
|
||||||
|
private static int COL_VENDORPRODNO = 5;
|
||||||
|
private static int COL_ORDER_ID = 6;
|
||||||
|
private static int COL_RMA_ID = 7;
|
||||||
|
private static int COL_INVOICE_ID = 8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Column names
|
||||||
|
* Override names from parent class since it differs on COL_RMA_ID.
|
||||||
|
*/
|
||||||
|
protected String[] colNames = new String[] {
|
||||||
|
Msg.getMsg(Env.getCtx(), "Select"),
|
||||||
|
Msg.translate(Env.getCtx(), "Quantity"),
|
||||||
|
Msg.translate(Env.getCtx(), "C_UOM_ID"),
|
||||||
|
Msg.translate((Env.getCtx()), "M_Locator_ID"),
|
||||||
|
Msg.translate(Env.getCtx(), "M_Product_ID"),
|
||||||
|
Msg.getElement(Env.getCtx(), "VendorProductNo", false),
|
||||||
|
Msg.getElement(Env.getCtx(), "C_Order_ID", false),
|
||||||
|
Msg.getElement(Env.getCtx(), "M_RMA_ID", false),
|
||||||
|
Msg.getElement(Env.getCtx(), "C_Invoice_ID", false)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load Order/Invoice/RMA data into Table
|
* Load Order/Invoice/RMA data into Table
|
||||||
* @param data data
|
* @param data data
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void loadTableOIS (Vector data)
|
protected void loadTableOIS (Vector data)
|
||||||
{
|
{
|
||||||
// Header Info
|
// Header Info
|
||||||
Vector<String> columnNames = new Vector<String>(7);
|
Vector<String> columnNames = new Vector<String>(colNames.length);
|
||||||
columnNames.add(Msg.getMsg(Env.getCtx(), "Select"));
|
for (int i=0; i<colNames.length; i++) {
|
||||||
columnNames.add(Msg.translate(Env.getCtx(), "Quantity"));
|
columnNames.add(colNames[i]);
|
||||||
columnNames.add(Msg.translate(Env.getCtx(), "C_UOM_ID"));
|
}
|
||||||
columnNames.add(Msg.translate(Env.getCtx(), "M_Product_ID"));
|
|
||||||
columnNames.add(Msg.getElement(Env.getCtx(), "VendorProductNo", false));
|
|
||||||
columnNames.add(Msg.getElement(Env.getCtx(), "C_Order_ID", false));
|
|
||||||
columnNames.add(Msg.getElement(Env.getCtx(), "M_RMA_ID", false));
|
|
||||||
columnNames.add(Msg.getElement(Env.getCtx(), "C_Invoice_ID", false));
|
|
||||||
|
|
||||||
// Remove previous listeners
|
// Remove previous listeners
|
||||||
dataTable.getModel().removeTableModelListener(this);
|
dataTable.getModel().removeTableModelListener(this);
|
||||||
|
@ -76,14 +177,17 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
model.addTableModelListener(this);
|
model.addTableModelListener(this);
|
||||||
dataTable.setModel(model);
|
dataTable.setModel(model);
|
||||||
//
|
//
|
||||||
dataTable.setColumnClass(0, Boolean.class, false); // 0-Selection
|
dataTable.setColumnClass(COL_SELECT, Boolean.class, false); // Selection
|
||||||
dataTable.setColumnClass(1, BigDecimal.class, false); // 1-Qty
|
dataTable.setColumnClass(COL_QTY, BigDecimal.class, false); // Qty
|
||||||
dataTable.setColumnClass(2, String.class, true); // 2-UOM
|
dataTable.setColumnClass(COL_UOM, String.class, true); // UOM
|
||||||
dataTable.setColumnClass(3, String.class, true); // 3-Product
|
dataTable.setColumnClass(COL_LOCATOR_ID, String.class, false); // Locator
|
||||||
dataTable.setColumnClass(4, String.class, true); // 4-VendorProductNo
|
TableColumn col = dataTable.getColumnModel().getColumn(COL_LOCATOR_ID);
|
||||||
dataTable.setColumnClass(5, String.class, true); // 5-Order
|
col.setCellEditor(new InnerLocatorTableCellEditor());
|
||||||
dataTable.setColumnClass(6, String.class, true); // 6-RMA
|
dataTable.setColumnClass(COL_PRODUCT_ID, String.class, true); // Product
|
||||||
dataTable.setColumnClass(7, String.class, true); // 7-Invoice
|
dataTable.setColumnClass(COL_VENDORPRODNO, String.class, true); // VendorProductNo
|
||||||
|
dataTable.setColumnClass(COL_ORDER_ID, String.class, true); // Order
|
||||||
|
dataTable.setColumnClass(COL_RMA_ID, String.class, true); // Ship
|
||||||
|
dataTable.setColumnClass(COL_INVOICE_ID, String.class, true); // Invoice
|
||||||
// Table UI
|
// Table UI
|
||||||
dataTable.autoSize();
|
dataTable.autoSize();
|
||||||
} // loadOrder
|
} // loadOrder
|
||||||
|
@ -105,7 +209,6 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
sameWarehouseCb.addActionListener(this);
|
sameWarehouseCb.addActionListener(this);
|
||||||
|
|
||||||
// load Locator
|
// load Locator
|
||||||
int AD_Column_ID = 3537; // M_InOut.M_Locator_ID
|
|
||||||
MLocatorLookup locator = new MLocatorLookup(Env.getCtx(), p_WindowNo);
|
MLocatorLookup locator = new MLocatorLookup(Env.getCtx(), p_WindowNo);
|
||||||
locatorField = new VLocator ("M_Locator_ID", true, false, true, locator, p_WindowNo);
|
locatorField = new VLocator ("M_Locator_ID", true, false, true, locator, p_WindowNo);
|
||||||
|
|
||||||
|
@ -176,6 +279,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
}
|
}
|
||||||
invoiceField.setSelectedIndex(0);
|
invoiceField.setSelectedIndex(0);
|
||||||
invoiceField.addActionListener(this);
|
invoiceField.addActionListener(this);
|
||||||
|
upcField.addActionListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -295,10 +399,58 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
else if (e.getSource().equals(sameWarehouseCb))
|
else if (e.getSource().equals(sameWarehouseCb))
|
||||||
{
|
{
|
||||||
initBPartnerOIS(((Integer)bPartnerField.getValue()).intValue(), false);
|
initBPartnerOIS(((Integer)bPartnerField.getValue()).intValue(), false);
|
||||||
|
} else if (e.getSource().equals(upcField)) {
|
||||||
|
checkProductUsingUpc();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // actionPerformed
|
} // actionPerformed
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the UPC value and checks if the UPC matches any of the products in the
|
||||||
|
* list.
|
||||||
|
*/
|
||||||
|
private void checkProductUsingUpc() {
|
||||||
|
String upc = upcField.getText();
|
||||||
|
DefaultTableModel model = (DefaultTableModel)dataTable.getModel();
|
||||||
|
// Lookup UPC
|
||||||
|
java.util.List<MProduct> products = MProduct.getByUPC(Env.getCtx(), upc, null);
|
||||||
|
MProduct product;
|
||||||
|
int row;
|
||||||
|
BigDecimal qty;
|
||||||
|
for (Iterator<MProduct> it = products.iterator(); it.hasNext();) {
|
||||||
|
product = it.next();
|
||||||
|
row = findProductRow(product.get_ID());
|
||||||
|
if (row>=0) {
|
||||||
|
qty = (BigDecimal)model.getValueAt(row, COL_QTY);
|
||||||
|
model.setValueAt(qty, row, COL_QTY);
|
||||||
|
model.setValueAt(Boolean.TRUE, row, COL_SELECT);
|
||||||
|
model.fireTableRowsUpdated(row, row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
upcField.setText("");
|
||||||
|
upcField.requestFocusInWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the row where a given product is. If the product is not found
|
||||||
|
* in the table -1 is returned.
|
||||||
|
* @param M_Product_ID
|
||||||
|
* @return Row of the product or -1 if non existing.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private int findProductRow(int M_Product_ID) {
|
||||||
|
DefaultTableModel model = (DefaultTableModel)dataTable.getModel();
|
||||||
|
KeyNamePair kp;
|
||||||
|
for (int i=0; i<model.getRowCount(); i++) {
|
||||||
|
kp = (KeyNamePair)model.getValueAt(i, COL_PRODUCT_ID);
|
||||||
|
if (kp.getKey()==M_Product_ID) {
|
||||||
|
return(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change Listener
|
* Change Listener
|
||||||
* @param e event
|
* @param e event
|
||||||
|
@ -316,10 +468,108 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
tableChanged(null);
|
tableChanged(null);
|
||||||
} // vetoableChange
|
} // vetoableChange
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load Data - Order
|
||||||
|
* @param C_Order_ID Order
|
||||||
|
* @param forInvoice true if for invoice vs. delivery qty
|
||||||
|
*/
|
||||||
|
protected void loadOrder (int C_Order_ID, boolean forInvoice)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Selected - 0
|
||||||
|
* Qty - 1
|
||||||
|
* C_UOM_ID - 2
|
||||||
|
* M_Locator_ID - 3
|
||||||
|
* M_Product_ID - 4
|
||||||
|
* VendorProductNo - 5
|
||||||
|
* OrderLine - 6
|
||||||
|
* ShipmentLine - 7
|
||||||
|
* InvoiceLine - 8
|
||||||
|
*/
|
||||||
|
log.config("C_Order_ID=" + C_Order_ID);
|
||||||
|
p_order = new MOrder (Env.getCtx(), C_Order_ID, null); // save
|
||||||
|
|
||||||
|
Vector<Vector> data = new Vector<Vector>();
|
||||||
|
StringBuffer sql = new StringBuffer("SELECT "
|
||||||
|
+ "l.QtyOrdered-SUM(COALESCE(m.Qty,0))," // 1
|
||||||
|
+ "CASE WHEN l.QtyOrdered=0 THEN 0 ELSE l.QtyEntered/l.QtyOrdered END," // 2
|
||||||
|
+ " l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name)," // 3..4
|
||||||
|
+ " p.M_Locator_ID, COALESCE(loc.value,''), " // 5..6
|
||||||
|
+ " COALESCE(l.M_Product_ID,0),COALESCE(p.Name,c.Name), " // 7..8
|
||||||
|
+ " po.VendorProductNo, " // 9
|
||||||
|
+ " l.C_OrderLine_ID,l.Line " // 10..11
|
||||||
|
+ "FROM C_OrderLine l"
|
||||||
|
+ " LEFT OUTER JOIN M_Product_PO po ON (l.M_Product_ID = po.M_Product_ID AND l.C_BPartner_ID = po.C_BPartner_ID) "
|
||||||
|
+ " LEFT OUTER JOIN M_MatchPO m ON (l.C_OrderLine_ID=m.C_OrderLine_ID AND ");
|
||||||
|
sql.append(forInvoice ? "m.C_InvoiceLine_ID" : "m.M_InOutLine_ID");
|
||||||
|
sql.append(" IS NOT NULL)")
|
||||||
|
.append(" LEFT OUTER JOIN M_Product p ON (l.M_Product_ID=p.M_Product_ID)"
|
||||||
|
+ " LEFT OUTER JOIN M_Locator loc on (p.M_Locator_ID=loc.M_Locator_ID)"
|
||||||
|
+ " LEFT OUTER JOIN C_Charge c ON (l.C_Charge_ID=c.C_Charge_ID)");
|
||||||
|
if (Env.isBaseLanguage(Env.getCtx(), "C_UOM"))
|
||||||
|
sql.append(" LEFT OUTER JOIN C_UOM uom ON (l.C_UOM_ID=uom.C_UOM_ID)");
|
||||||
|
else
|
||||||
|
sql.append(" LEFT OUTER JOIN C_UOM_Trl uom ON (l.C_UOM_ID=uom.C_UOM_ID AND uom.AD_Language='")
|
||||||
|
.append(Env.getAD_Language(Env.getCtx())).append("')");
|
||||||
|
//
|
||||||
|
sql.append(" WHERE l.C_Order_ID=? " // #1
|
||||||
|
+ "GROUP BY l.QtyOrdered,CASE WHEN l.QtyOrdered=0 THEN 0 ELSE l.QtyEntered/l.QtyOrdered END, "
|
||||||
|
+ "l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name), p.m_locator_id, COALESCE(loc.value,''), po.VendorProductNo, "
|
||||||
|
+ "l.M_Product_ID,COALESCE(p.Name,c.Name), l.Line,l.C_OrderLine_ID "
|
||||||
|
+ "ORDER BY l.Line");
|
||||||
|
//
|
||||||
|
log.finer(sql.toString());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
||||||
|
pstmt.setInt(1, C_Order_ID);
|
||||||
|
ResultSet rs = pstmt.executeQuery();
|
||||||
|
while (rs.next())
|
||||||
|
{
|
||||||
|
Vector<Object> line = new Vector<Object>();
|
||||||
|
line.add(new Boolean(false)); // 0-Selection
|
||||||
|
BigDecimal qtyOrdered = rs.getBigDecimal(1);
|
||||||
|
BigDecimal multiplier = rs.getBigDecimal(2);
|
||||||
|
BigDecimal qtyEntered = qtyOrdered.multiply(multiplier);
|
||||||
|
line.add(qtyEntered); // 1-Qty
|
||||||
|
KeyNamePair pp = new KeyNamePair(rs.getInt(3), rs.getString(4).trim());
|
||||||
|
line.add(pp); // 2-UOM
|
||||||
|
// Add locator
|
||||||
|
pp = new KeyNamePair(rs.getInt(5), rs.getString(6));
|
||||||
|
line.add(pp); // 3-Locator
|
||||||
|
// Add product
|
||||||
|
pp = new KeyNamePair(rs.getInt(7), rs.getString(8));
|
||||||
|
line.add(pp); // 4-Product
|
||||||
|
line.add(rs.getString(9)); // 5-VendorProductNo
|
||||||
|
pp = new KeyNamePair(rs.getInt(10), rs.getString(11));
|
||||||
|
line.add(pp); // 6-OrderLine
|
||||||
|
line.add(null); // 7-Ship
|
||||||
|
line.add(null); // 8-Invoice
|
||||||
|
data.add(line);
|
||||||
|
}
|
||||||
|
rs.close();
|
||||||
|
pstmt.close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, sql.toString(), e);
|
||||||
|
}
|
||||||
|
loadTableOIS (data);
|
||||||
|
} // LoadOrder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load Data - Invoice
|
* Load Data - Invoice
|
||||||
* @param C_Invoice_ID Invoice
|
* @param C_Invoice_ID Invoice
|
||||||
|
*
|
||||||
|
* Selected - 0
|
||||||
|
* Qty - 1
|
||||||
|
* C_UOM_ID - 2
|
||||||
|
* M_Locator_ID - 3
|
||||||
|
* M_Product_ID - 4
|
||||||
|
* VendorProductNo - 5
|
||||||
|
* OrderLine - 6
|
||||||
|
* ShipmentLine - 7
|
||||||
|
* InvoiceLine - 8
|
||||||
*/
|
*/
|
||||||
private void loadInvoice(int C_Invoice_ID) {
|
private void loadInvoice(int C_Invoice_ID) {
|
||||||
log.config("C_Invoice_ID=" + C_Invoice_ID);
|
log.config("C_Invoice_ID=" + C_Invoice_ID);
|
||||||
|
@ -331,9 +581,10 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
StringBuffer sql = new StringBuffer("SELECT " // Entered UOM
|
StringBuffer sql = new StringBuffer("SELECT " // Entered UOM
|
||||||
+ "l.QtyInvoiced-SUM(NVL(mi.Qty,0)),l.QtyEntered/l.QtyInvoiced,"
|
+ "l.QtyInvoiced-SUM(NVL(mi.Qty,0)),l.QtyEntered/l.QtyInvoiced,"
|
||||||
+ " l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name)," // 3..4
|
+ " l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name)," // 3..4
|
||||||
+ " l.M_Product_ID,p.Name, po.VendorProductNo, l.C_InvoiceLine_ID,l.Line," // 5..9
|
+ " p.M_Locator_ID, COALESCE(loc.value,''), " // 5..6
|
||||||
+ " l.C_OrderLine_ID "
|
+ " l.M_Product_ID,p.Name, po.VendorProductNo, l.C_InvoiceLine_ID,l.Line," // 7..11
|
||||||
+ " FROM C_InvoiceLine l "); // 10
|
+ " l.C_OrderLine_ID " // 12
|
||||||
|
+ " FROM C_InvoiceLine l ");
|
||||||
if (Env.isBaseLanguage(Env.getCtx(), "C_UOM"))
|
if (Env.isBaseLanguage(Env.getCtx(), "C_UOM"))
|
||||||
sql.append(" LEFT OUTER JOIN C_UOM uom ON (l.C_UOM_ID=uom.C_UOM_ID)");
|
sql.append(" LEFT OUTER JOIN C_UOM uom ON (l.C_UOM_ID=uom.C_UOM_ID)");
|
||||||
else
|
else
|
||||||
|
@ -341,6 +592,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
.append(Env.getAD_Language(Env.getCtx())).append("')");
|
.append(Env.getAD_Language(Env.getCtx())).append("')");
|
||||||
|
|
||||||
sql.append(" LEFT OUTER JOIN M_Product p ON (l.M_Product_ID=p.M_Product_ID)")
|
sql.append(" LEFT OUTER JOIN M_Product p ON (l.M_Product_ID=p.M_Product_ID)")
|
||||||
|
.append(" LEFT OUTER JOIN M_Locator loc on (p.M_Locator_ID=loc.M_Locator_ID)")
|
||||||
.append(" INNER JOIN C_Invoice inv ON (l.C_Invoice_ID=inv.C_Invoice_ID)")
|
.append(" INNER JOIN C_Invoice inv ON (l.C_Invoice_ID=inv.C_Invoice_ID)")
|
||||||
.append(" LEFT OUTER JOIN M_Product_PO po ON (l.M_Product_ID = po.M_Product_ID AND inv.C_BPartner_ID = po.C_BPartner_ID)")
|
.append(" LEFT OUTER JOIN M_Product_PO po ON (l.M_Product_ID = po.M_Product_ID AND inv.C_BPartner_ID = po.C_BPartner_ID)")
|
||||||
.append(" LEFT OUTER JOIN M_MatchInv mi ON (l.C_InvoiceLine_ID=mi.C_InvoiceLine_ID)")
|
.append(" LEFT OUTER JOIN M_MatchInv mi ON (l.C_InvoiceLine_ID=mi.C_InvoiceLine_ID)")
|
||||||
|
@ -348,6 +600,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
.append(" WHERE l.C_Invoice_ID=? AND l.QtyInvoiced<>0 ")
|
.append(" WHERE l.C_Invoice_ID=? AND l.QtyInvoiced<>0 ")
|
||||||
.append("GROUP BY l.QtyInvoiced,l.QtyEntered/l.QtyInvoiced,"
|
.append("GROUP BY l.QtyInvoiced,l.QtyEntered/l.QtyInvoiced,"
|
||||||
+ "l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name),"
|
+ "l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name),"
|
||||||
|
+ "p.M_Locator_ID, COALESCE(loc.value,''), "
|
||||||
+ "l.M_Product_ID,p.Name, po.VendorProductNo, l.C_InvoiceLine_ID,l.Line,l.C_OrderLine_ID ")
|
+ "l.M_Product_ID,p.Name, po.VendorProductNo, l.C_InvoiceLine_ID,l.Line,l.C_OrderLine_ID ")
|
||||||
.append("ORDER BY l.Line");
|
.append("ORDER BY l.Line");
|
||||||
|
|
||||||
|
@ -364,17 +617,21 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
line.add(qtyEntered); // 1-Qty
|
line.add(qtyEntered); // 1-Qty
|
||||||
KeyNamePair pp = new KeyNamePair(rs.getInt(3), rs.getString(4).trim());
|
KeyNamePair pp = new KeyNamePair(rs.getInt(3), rs.getString(4).trim());
|
||||||
line.add(pp); // 2-UOM
|
line.add(pp); // 2-UOM
|
||||||
pp = new KeyNamePair(rs.getInt(5), rs.getString(6));
|
// Add locator
|
||||||
line.add(pp); // 3-Product
|
pp = new KeyNamePair(rs.getInt(5), rs.getString(6));
|
||||||
line.add(rs.getString(7)); // 4-VendorProductNo
|
line.add(pp); // 3-Locator
|
||||||
int C_OrderLine_ID = rs.getInt(10);
|
|
||||||
|
pp = new KeyNamePair(rs.getInt(7), rs.getString(8));
|
||||||
|
line.add(pp); // 4-Product
|
||||||
|
line.add(rs.getString(9)); // 5-VendorProductNo
|
||||||
|
int C_OrderLine_ID = rs.getInt(12);
|
||||||
if (rs.wasNull())
|
if (rs.wasNull())
|
||||||
line.add(null); // 5-Order
|
line.add(null); // 6-Order
|
||||||
else
|
else
|
||||||
line.add(new KeyNamePair(C_OrderLine_ID, "."));
|
line.add(new KeyNamePair(C_OrderLine_ID, "."));
|
||||||
line.add(null); // 6-Ship
|
line.add(null); // 7-Ship
|
||||||
pp = new KeyNamePair(rs.getInt(8), rs.getString(9));
|
pp = new KeyNamePair(rs.getInt(10), rs.getString(11));
|
||||||
line.add(pp); // 7-Invoice
|
line.add(pp); // 8-Invoice
|
||||||
data.add(line);
|
data.add(line);
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
|
@ -446,13 +703,14 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
line.add(rs.getBigDecimal(3)); // 1-Qty
|
line.add(rs.getBigDecimal(3)); // 1-Qty
|
||||||
KeyNamePair pp = new KeyNamePair(rs.getInt(6), rs.getString(7));
|
KeyNamePair pp = new KeyNamePair(rs.getInt(6), rs.getString(7));
|
||||||
line.add(pp); // 2-UOM
|
line.add(pp); // 2-UOM
|
||||||
|
line.add(null); // 3-Locator - TODO: Not implemented since RMA is in alpha and can't be tested.
|
||||||
pp = new KeyNamePair(rs.getInt(4), rs.getString(5));
|
pp = new KeyNamePair(rs.getInt(4), rs.getString(5));
|
||||||
line.add(pp); // 3-Product
|
line.add(pp); // 4-Product
|
||||||
line.add(null); //4-Vendor Product No
|
line.add(null); //5-Vendor Product No
|
||||||
line.add(null); //5-Order
|
line.add(null); //6-Order
|
||||||
pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
|
pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
|
||||||
line.add(pp); //6-RMA
|
line.add(pp); //7-RMA
|
||||||
line.add(null); //7-invoice
|
line.add(null); //8-invoice
|
||||||
data.add(line);
|
data.add(line);
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
|
@ -506,12 +764,12 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
if (rows == 0)
|
if (rows == 0)
|
||||||
return false;
|
return false;
|
||||||
//
|
//
|
||||||
Integer loc = (Integer) locatorField.getValue();
|
Integer defaultLoc = (Integer) locatorField.getValue();
|
||||||
if (loc == null || loc.intValue() == 0) {
|
if (defaultLoc == null || defaultLoc.intValue() == 0) {
|
||||||
locatorField.setBackground(AdempierePLAF.getFieldBackground_Error());
|
locatorField.setBackground(AdempierePLAF.getFieldBackground_Error());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int M_Locator_ID = loc.intValue();
|
int M_Locator_ID = defaultLoc.intValue();
|
||||||
// Get Shipment
|
// Get Shipment
|
||||||
int M_InOut_ID = ((Integer) p_mTab.getValue("M_InOut_ID")).intValue();
|
int M_InOut_ID = ((Integer) p_mTab.getValue("M_InOut_ID")).intValue();
|
||||||
MInOut inout = new MInOut(Env.getCtx(), M_InOut_ID, null);
|
MInOut inout = new MInOut(Env.getCtx(), M_InOut_ID, null);
|
||||||
|
@ -521,22 +779,27 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
for (int i = 0; i < rows; i++) {
|
for (int i = 0; i < rows; i++) {
|
||||||
if (((Boolean) model.getValueAt(i, 0)).booleanValue()) {
|
if (((Boolean) model.getValueAt(i, 0)).booleanValue()) {
|
||||||
// variable values
|
// variable values
|
||||||
BigDecimal QtyEntered = (BigDecimal) model.getValueAt(i, 1); // 1-Qty
|
BigDecimal QtyEntered = (BigDecimal) model.getValueAt(i, COL_QTY); // Qty
|
||||||
KeyNamePair pp = (KeyNamePair) model.getValueAt(i, 2); // 2-UOM
|
KeyNamePair pp = (KeyNamePair) model.getValueAt(i, COL_UOM); // UOM
|
||||||
int C_UOM_ID = pp.getKey();
|
int C_UOM_ID = pp.getKey();
|
||||||
pp = (KeyNamePair) model.getValueAt(i, 3); // 3-Product
|
pp = (KeyNamePair) model.getValueAt(i, COL_LOCATOR_ID); // Locator
|
||||||
|
// If a locator is specified on the product, choose that otherwise default locator
|
||||||
|
M_Locator_ID = pp!=null ? pp.getKey() : defaultLoc.intValue();
|
||||||
|
|
||||||
|
pp = (KeyNamePair) model.getValueAt(i, COL_PRODUCT_ID); // Product
|
||||||
int M_Product_ID = pp.getKey();
|
int M_Product_ID = pp.getKey();
|
||||||
int C_OrderLine_ID = 0;
|
int C_OrderLine_ID = 0;
|
||||||
pp = (KeyNamePair) model.getValueAt(i, 5); // 5-OrderLine
|
pp = (KeyNamePair) model.getValueAt(i, COL_ORDER_ID); // OrderLine
|
||||||
if (pp != null)
|
if (pp != null)
|
||||||
C_OrderLine_ID = pp.getKey();
|
C_OrderLine_ID = pp.getKey();
|
||||||
int M_RMALine_ID = 0;
|
int M_RMALine_ID = 0;
|
||||||
pp = (KeyNamePair) model.getValueAt(i, 6); // 6-RMA
|
pp = (KeyNamePair) model.getValueAt(i, COL_RMA_ID); // RMA
|
||||||
if (pp != null)
|
// If we have RMA
|
||||||
M_RMALine_ID = pp.getKey();
|
if (pp != null)
|
||||||
|
M_RMALine_ID = pp.getKey();
|
||||||
int C_InvoiceLine_ID = 0;
|
int C_InvoiceLine_ID = 0;
|
||||||
MInvoiceLine il = null;
|
MInvoiceLine il = null;
|
||||||
pp = (KeyNamePair) model.getValueAt(i, 7); // 7-InvoiceLine
|
pp = (KeyNamePair) model.getValueAt(i, COL_INVOICE_ID); // InvoiceLine
|
||||||
if (pp != null)
|
if (pp != null)
|
||||||
C_InvoiceLine_ID = pp.getKey();
|
C_InvoiceLine_ID = pp.getKey();
|
||||||
if (C_InvoiceLine_ID != 0)
|
if (C_InvoiceLine_ID != 0)
|
||||||
|
@ -570,7 +833,6 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
{
|
{
|
||||||
iol.setC_OrderLine_ID(C_OrderLine_ID);
|
iol.setC_OrderLine_ID(C_OrderLine_ID);
|
||||||
ol = new MOrderLine (Env.getCtx(), C_OrderLine_ID, null);
|
ol = new MOrderLine (Env.getCtx(), C_OrderLine_ID, null);
|
||||||
// iol.setOrderLine(ol, M_Locator_ID, QtyEntered);
|
|
||||||
if (ol.getQtyEntered().compareTo(ol.getQtyOrdered()) != 0)
|
if (ol.getQtyEntered().compareTo(ol.getQtyOrdered()) != 0)
|
||||||
{
|
{
|
||||||
iol.setMovementQty(QtyEntered
|
iol.setMovementQty(QtyEntered
|
||||||
|
@ -592,7 +854,6 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
}
|
}
|
||||||
else if (il != null)
|
else if (il != null)
|
||||||
{
|
{
|
||||||
// iol.setInvoiceLine(il, M_Locator_ID, QtyEntered);
|
|
||||||
if (il.getQtyEntered().compareTo(il.getQtyInvoiced()) != 0)
|
if (il.getQtyEntered().compareTo(il.getQtyInvoiced()) != 0)
|
||||||
{
|
{
|
||||||
iol.setQtyEntered(QtyEntered
|
iol.setQtyEntered(QtyEntered
|
||||||
|
@ -610,21 +871,21 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
iol.setUser1_ID(il.getUser1_ID());
|
iol.setUser1_ID(il.getUser1_ID());
|
||||||
iol.setUser2_ID(il.getUser2_ID());
|
iol.setUser2_ID(il.getUser2_ID());
|
||||||
}
|
}
|
||||||
else if (M_RMALine_ID != 0)
|
else if (M_RMALine_ID != 0)
|
||||||
{
|
{
|
||||||
rmal = new MRMALine(Env.getCtx(), M_RMALine_ID, null);
|
rmal = new MRMALine(Env.getCtx(), M_RMALine_ID, null);
|
||||||
iol.setM_RMALine_ID(M_RMALine_ID);
|
iol.setM_RMALine_ID(M_RMALine_ID);
|
||||||
iol.setQtyEntered(QtyEntered);
|
iol.setQtyEntered(QtyEntered);
|
||||||
iol.setDescription(rmal.getDescription());
|
iol.setDescription(rmal.getDescription());
|
||||||
iol.setM_AttributeSetInstance_ID(rmal.getM_AttributeSetInstance_ID());
|
iol.setM_AttributeSetInstance_ID(rmal.getM_AttributeSetInstance_ID());
|
||||||
iol.setC_Project_ID(rmal.getC_Project_ID());
|
iol.setC_Project_ID(rmal.getC_Project_ID());
|
||||||
iol.setC_ProjectPhase_ID(rmal.getC_ProjectPhase_ID());
|
iol.setC_ProjectPhase_ID(rmal.getC_ProjectPhase_ID());
|
||||||
iol.setC_ProjectTask_ID(rmal.getC_ProjectTask_ID());
|
iol.setC_ProjectTask_ID(rmal.getC_ProjectTask_ID());
|
||||||
iol.setC_Activity_ID(rmal.getC_Activity_ID());
|
iol.setC_Activity_ID(rmal.getC_Activity_ID());
|
||||||
iol.setAD_OrgTrx_ID(rmal.getAD_OrgTrx_ID());
|
iol.setAD_OrgTrx_ID(rmal.getAD_OrgTrx_ID());
|
||||||
iol.setUser1_ID(rmal.getUser1_ID());
|
iol.setUser1_ID(rmal.getUser1_ID());
|
||||||
iol.setUser2_ID(rmal.getUser2_ID());
|
iol.setUser2_ID(rmal.getUser2_ID());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Charge
|
// Charge
|
||||||
if (M_Product_ID == 0)
|
if (M_Product_ID == 0)
|
||||||
|
@ -636,7 +897,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
else if (rmal != null && rmal.getC_Charge_ID() != 0) // from rma
|
else if (rmal != null && rmal.getC_Charge_ID() != 0) // from rma
|
||||||
iol.setC_Charge_ID(rmal.getC_Charge_ID());
|
iol.setC_Charge_ID(rmal.getC_Charge_ID());
|
||||||
}
|
}
|
||||||
//
|
// Set locator
|
||||||
iol.setM_Locator_ID(M_Locator_ID);
|
iol.setM_Locator_ID(M_Locator_ID);
|
||||||
if (!iol.save())
|
if (!iol.save())
|
||||||
log.log(Level.SEVERE, "Line NOT created #" + i);
|
log.log(Level.SEVERE, "Line NOT created #" + i);
|
||||||
|
@ -663,15 +924,15 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
||||||
inout.setC_Activity_ID(p_order.getC_Activity_ID());
|
inout.setC_Activity_ID(p_order.getC_Activity_ID());
|
||||||
inout.setUser1_ID(p_order.getUser1_ID());
|
inout.setUser1_ID(p_order.getUser1_ID());
|
||||||
inout.setUser2_ID(p_order.getUser2_ID());
|
inout.setUser2_ID(p_order.getUser2_ID());
|
||||||
|
|
||||||
if ( p_order.isDropShip() )
|
if ( p_order.isDropShip() )
|
||||||
{
|
{
|
||||||
inout.setM_Warehouse_ID( p_order.getM_Warehouse_ID() );
|
inout.setM_Warehouse_ID( p_order.getM_Warehouse_ID() );
|
||||||
inout.setIsDropShip(p_order.isDropShip());
|
inout.setIsDropShip(p_order.isDropShip());
|
||||||
inout.setDropShip_BPartner_ID(p_order.getDropShip_BPartner_ID());
|
inout.setDropShip_BPartner_ID(p_order.getDropShip_BPartner_ID());
|
||||||
inout.setDropShip_Location_ID(p_order.getDropShip_Location_ID());
|
inout.setDropShip_Location_ID(p_order.getDropShip_Location_ID());
|
||||||
inout.setDropShip_User_ID(p_order.getDropShip_User_ID());
|
inout.setDropShip_User_ID(p_order.getDropShip_User_ID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_invoice != null && m_invoice.getC_Invoice_ID() != 0)
|
if (m_invoice != null && m_invoice.getC_Invoice_ID() != 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue