From cac9cc0219d76ec1d9700e3c021e6989ba908be9 Mon Sep 17 00:00:00 2001 From: usrdno Date: Fri, 5 Dec 2008 12:28:44 +0000 Subject: [PATCH] FR 2350428 - Added locator in Product Replenish Tab. --- .../src/org/compiere/model/I_M_Replenish.java | 79 ++++++++++++------- base/src/org/compiere/model/MReplenish.java | 2 +- .../src/org/compiere/model/X_M_Replenish.java | 49 ++++++++++-- .../341_FR2350428_LocatorInReplenishTab.sql | 55 +++++++++++++ .../341_FR2350428_LocatorInReplenishTab.sql | 55 +++++++++++++ 5 files changed, 203 insertions(+), 37 deletions(-) create mode 100644 migration/352a-trunk/341_FR2350428_LocatorInReplenishTab.sql create mode 100644 migration/352a-trunk/postgresql/341_FR2350428_LocatorInReplenishTab.sql diff --git a/base/src/org/compiere/model/I_M_Replenish.java b/base/src/org/compiere/model/I_M_Replenish.java index afbf8d17f2..1cda5bb0fd 100644 --- a/base/src/org/compiere/model/I_M_Replenish.java +++ b/base/src/org/compiere/model/I_M_Replenish.java @@ -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"; diff --git a/base/src/org/compiere/model/MReplenish.java b/base/src/org/compiere/model/MReplenish.java index 6c9fe2f87e..d5e9ac76f2 100644 --- a/base/src/org/compiere/model/MReplenish.java +++ b/base/src/org/compiere/model/MReplenish.java @@ -73,7 +73,7 @@ public class MReplenish extends X_M_Replenish { */ public static List 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) diff --git a/base/src/org/compiere/model/X_M_Replenish.java b/base/src/org/compiere/model/X_M_Replenish.java index 5c2b1bfaed..ed2ff792a8 100644 --- a/base/src/org/compiere/model/X_M_Replenish.java +++ b/base/src/org/compiere/model/X_M_Replenish.java @@ -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 diff --git a/migration/352a-trunk/341_FR2350428_LocatorInReplenishTab.sql b/migration/352a-trunk/341_FR2350428_LocatorInReplenishTab.sql new file mode 100644 index 0000000000..3b14d7b93c --- /dev/null +++ b/migration/352a-trunk/341_FR2350428_LocatorInReplenishTab.sql @@ -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 +; + diff --git a/migration/352a-trunk/postgresql/341_FR2350428_LocatorInReplenishTab.sql b/migration/352a-trunk/postgresql/341_FR2350428_LocatorInReplenishTab.sql new file mode 100644 index 0000000000..098b8f6d22 --- /dev/null +++ b/migration/352a-trunk/postgresql/341_FR2350428_LocatorInReplenishTab.sql @@ -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 +; +