FR 2350428 - Added locator in Product Replenish Tab.

This commit is contained in:
usrdno 2008-12-05 12:28:44 +00:00
parent 4aca9007dd
commit cac9cc0219
5 changed files with 203 additions and 37 deletions

View File

@ -1,31 +1,22 @@
/**********************************************************************
* This file is part of Adempiere ERP Bazaar *
* http://www.adempiere.org *
* *
* Copyright (C) Trifon Trifonov. *
* Copyright (C) Contributors *
* *
* This program is free software, you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation, either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY, without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Trifon Trifonov (trifonnt@users.sourceforge.net) *
* *
* Sponsors: *
* - Company (http://www.site.com) *
**********************************************************************/
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* 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 *
* 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 *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* 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., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* 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 *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
@ -52,6 +43,19 @@ public interface I_M_Replenish
/** Load Meta Data */
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name Level_Max */
public static final String COLUMNNAME_Level_Max = "Level_Max";
@ -78,6 +82,21 @@ public interface I_M_Replenish
*/
public BigDecimal getLevel_Min();
/** Column name M_Locator_ID */
public static final String COLUMNNAME_M_Locator_ID = "M_Locator_ID";
/** Set Locator.
* Warehouse Locator
*/
public void setM_Locator_ID (int M_Locator_ID);
/** Get Locator.
* Warehouse Locator
*/
public int getM_Locator_ID();
public I_M_Locator getM_Locator() throws RuntimeException;
/** Column name M_Product_ID */
public static final String COLUMNNAME_M_Product_ID = "M_Product_ID";
@ -91,7 +110,7 @@ public interface I_M_Replenish
*/
public int getM_Product_ID();
public I_M_Product getM_Product() throws Exception;
public I_M_Product getM_Product() throws RuntimeException;
/** Column name M_Warehouse_ID */
public static final String COLUMNNAME_M_Warehouse_ID = "M_Warehouse_ID";
@ -106,7 +125,7 @@ public interface I_M_Replenish
*/
public int getM_Warehouse_ID();
public I_M_Warehouse getM_Warehouse() throws Exception;
public I_M_Warehouse getM_Warehouse() throws RuntimeException;
/** Column name M_WarehouseSource_ID */
public static final String COLUMNNAME_M_WarehouseSource_ID = "M_WarehouseSource_ID";

View File

@ -73,7 +73,7 @@ public class MReplenish extends X_M_Replenish {
*/
public static List<MReplenish> getForProduct(Properties ctx, int M_ProductID, String trxName) {
String whereClause= "M_Product_ID=? AND AD_Client_ID=? AND AD_Org_ID IN (0, ?) ";
return new Query(ctx, Table_Name, whereClause, trxName)
return new Query(ctx, MReplenish.Table_Name, whereClause, trxName)
.setParameters(new Object[]{M_ProductID, Env.getAD_Client_ID(ctx), Env.getAD_Org_ID(ctx)})
.setOrderBy("AD_Org_ID")
.setOnlyActiveRecords(true)

View File

@ -121,7 +121,46 @@ public class X_M_Replenish extends PO implements I_M_Replenish, I_Persistent
return bd;
}
public I_M_Product getM_Product() throws Exception
public I_M_Locator getM_Locator() throws RuntimeException
{
Class<?> clazz = MTable.getClass(I_M_Locator.Table_Name);
I_M_Locator result = null;
try {
Constructor<?> constructor = null;
constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class});
result = (I_M_Locator)constructor.newInstance(new Object[] {getCtx(), new Integer(getM_Locator_ID()), get_TrxName()});
} catch (Exception e) {
log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e);
log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz);
throw new RuntimeException( e );
}
return result;
}
/** Set Locator.
@param M_Locator_ID
Warehouse Locator
*/
public void setM_Locator_ID (int M_Locator_ID)
{
if (M_Locator_ID < 1)
set_Value (COLUMNNAME_M_Locator_ID, null);
else
set_Value (COLUMNNAME_M_Locator_ID, Integer.valueOf(M_Locator_ID));
}
/** Get Locator.
@return Warehouse Locator
*/
public int getM_Locator_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Locator_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_M_Product getM_Product() throws RuntimeException
{
Class<?> clazz = MTable.getClass(I_M_Product.Table_Name);
I_M_Product result = null;
@ -132,7 +171,7 @@ public class X_M_Replenish extends PO implements I_M_Replenish, I_Persistent
} catch (Exception e) {
log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e);
log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz);
throw e;
throw new RuntimeException( e );
}
return result;
}
@ -159,7 +198,7 @@ public class X_M_Replenish extends PO implements I_M_Replenish, I_Persistent
return ii.intValue();
}
public I_M_Warehouse getM_Warehouse() throws Exception
public I_M_Warehouse getM_Warehouse() throws RuntimeException
{
Class<?> clazz = MTable.getClass(I_M_Warehouse.Table_Name);
I_M_Warehouse result = null;
@ -170,7 +209,7 @@ public class X_M_Replenish extends PO implements I_M_Replenish, I_Persistent
} catch (Exception e) {
log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e);
log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz);
throw e;
throw new RuntimeException( e );
}
return result;
}
@ -197,8 +236,6 @@ public class X_M_Replenish extends PO implements I_M_Replenish, I_Persistent
return ii.intValue();
}
/** M_WarehouseSource_ID AD_Reference_ID=197 */
public static final int M_WAREHOUSESOURCE_ID_AD_Reference_ID=197;
/** Set Source Warehouse.
@param M_WarehouseSource_ID
Optional Warehouse to replenish from

View File

@ -0,0 +1,55 @@
-- 2008-dec-05 09:18:11 CET
-- [ 2350428 ] Add default locator to replenishment line
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AD_Val_Rule_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,56518,448,0,19,249,127,'M_Locator_ID',TO_DATE('2008-12-05 09:18:10','YYYY-MM-DD HH24:MI:SS'),100,'Warehouse Locator','D',1,'The Locator indicates where in a Warehouse a product is located.','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Locator',0,TO_DATE('2008-12-05 09:18:10','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 2008-dec-05 09:18:11 CET
-- [ 2350428 ] Add default locator to replenishment line
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56518 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- 2008-dec-05 09:18:34 CET
-- [ 2350428 ] Add default locator to replenishment line
ALTER TABLE M_Replenish ADD M_Locator_ID NUMBER(10)
;
-- 2008-dec-05 09:19:11 CET
-- [ 2350428 ] Add default locator to replenishment line
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,56518,56500,0,182,TO_DATE('2008-12-05 09:19:10','YYYY-MM-DD HH24:MI:SS'),100,'Warehouse Locator',1,'D','The Locator indicates where in a Warehouse a product is located.','Y','Y','Y','N','N','N','N','N','Locator',TO_DATE('2008-12-05 09:19:10','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2008-dec-05 09:19:11 CET
-- [ 2350428 ] Add default locator to replenishment line
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56500 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
;
-- 2008-dec-05 09:19:21 CET
-- [ 2350428 ] Add default locator to replenishment line
UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=56500
;
-- 2008-dec-05 09:19:21 CET
-- [ 2350428 ] Add default locator to replenishment line
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=1051
;
-- 2008-dec-05 09:19:21 CET
-- [ 2350428 ] Add default locator to replenishment line
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=1052
;
-- 2008-dec-05 09:19:21 CET
-- [ 2350428 ] Add default locator to replenishment line
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=1053
;
-- 2008-dec-05 09:19:21 CET
-- [ 2350428 ] Add default locator to replenishment line
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=1054
;
-- 2008-dec-05 09:19:21 CET
-- [ 2350428 ] Add default locator to replenishment line
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=12133
;

View File

@ -0,0 +1,55 @@
-- 2008-dec-05 09:18:11 CET
-- [ 2350428 ] Add default locator to replenishment line
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AD_Val_Rule_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,56518,448,0,19,249,127,'M_Locator_ID',TO_TIMESTAMP('2008-12-05 09:18:10','YYYY-MM-DD HH24:MI:SS'),100,'Warehouse Locator','D',1,'The Locator indicates where in a Warehouse a product is located.','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Locator',0,TO_TIMESTAMP('2008-12-05 09:18:10','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 2008-dec-05 09:18:11 CET
-- [ 2350428 ] Add default locator to replenishment line
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56518 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- 2008-dec-05 09:18:34 CET
-- [ 2350428 ] Add default locator to replenishment line
ALTER TABLE M_Replenish ADD COLUMN M_Locator_ID NUMERIC(10)
;
-- 2008-dec-05 09:19:11 CET
-- [ 2350428 ] Add default locator to replenishment line
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,56518,56500,0,182,TO_TIMESTAMP('2008-12-05 09:19:10','YYYY-MM-DD HH24:MI:SS'),100,'Warehouse Locator',1,'D','The Locator indicates where in a Warehouse a product is located.','Y','Y','Y','N','N','N','N','N','Locator',TO_TIMESTAMP('2008-12-05 09:19:10','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 2008-dec-05 09:19:11 CET
-- [ 2350428 ] Add default locator to replenishment line
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56500 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
;
-- 2008-dec-05 09:19:21 CET
-- [ 2350428 ] Add default locator to replenishment line
UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=56500
;
-- 2008-dec-05 09:19:21 CET
-- [ 2350428 ] Add default locator to replenishment line
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=1051
;
-- 2008-dec-05 09:19:21 CET
-- [ 2350428 ] Add default locator to replenishment line
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=1052
;
-- 2008-dec-05 09:19:21 CET
-- [ 2350428 ] Add default locator to replenishment line
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=1053
;
-- 2008-dec-05 09:19:21 CET
-- [ 2350428 ] Add default locator to replenishment line
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=1054
;
-- 2008-dec-05 09:19:21 CET
-- [ 2350428 ] Add default locator to replenishment line
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=12133
;