From 5cd07c4c261ff034153d6b6c329e9ca27627eec4 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 12 Jun 2015 23:14:33 -0500 Subject: [PATCH] IDEMPIERE-2668 Exclude Locators for Demand Operations --- .../oracle/functions/BOM_Qty_Available.sql | 2 +- .../oracle/functions/BOM_Qty_OnHand.sql | 18 +- .../BOM_Qty_OnHandForReservation.sql | 127 ++ .../oracle/views/M_PRODUCT_STOCK_V.sql | 5 +- .../views/M_PRODUCT_SUBSTITUTERELATED_V.sql | 8 +- db/ddlutils/oracle/views/RV_STORAGE.sql | 4 +- .../functions/BOM_Qty_Available.sql | 2 +- .../postgresql/functions/BOM_Qty_OnHand.sql | 20 +- .../BOM_Qty_OnHandForReservation.sql | 113 ++ .../postgresql/views/M_PRODUCT_STOCK_V.sql | 5 +- .../views/M_PRODUCT_SUBSTITUTERELATED_V.sql | 6 +- db/ddlutils/postgresql/views/RV_STORAGE.sql | 4 +- .../oracle/201506091830_IDEMPIERE-2668.sql | 1226 +++++++++++++++++ .../201506091830_IDEMPIERE-2668.sql | 1179 ++++++++++++++++ .../org/compiere/process/InOutGenerate.java | 19 +- .../org/compiere/process/ReplenishReport.java | 23 + .../process/ReplenishReportProduction.java | 26 + .../src/org/compiere/model/I_M_Locator.java | 11 + .../org/compiere/model/I_M_LocatorType.java | 193 +++ .../src/org/compiere/model/MInOutLine.java | 12 + .../src/org/compiere/model/MLocator.java | 13 +- .../src/org/compiere/model/MLocatorType.java | 103 ++ .../src/org/compiere/model/MOrder.java | 23 +- .../org/compiere/model/MStorageOnHand.java | 35 +- .../compiere/model/MStorageReservation.java | 4 +- .../src/org/compiere/model/X_M_Locator.java | 27 +- .../org/compiere/model/X_M_LocatorType.java | 235 ++++ .../webui/info/InfoProductWindow.java | 2 + .../adempiere/webui/panel/InvoiceHistory.java | 7 +- .../webui/window/WLocatorDialog.java | 104 +- 30 files changed, 3493 insertions(+), 63 deletions(-) create mode 100644 db/ddlutils/oracle/functions/BOM_Qty_OnHandForReservation.sql create mode 100644 db/ddlutils/postgresql/functions/BOM_Qty_OnHandForReservation.sql create mode 100644 migration/i2.1z/oracle/201506091830_IDEMPIERE-2668.sql create mode 100644 migration/i2.1z/postgresql/201506091830_IDEMPIERE-2668.sql create mode 100644 org.adempiere.base/src/org/compiere/model/I_M_LocatorType.java create mode 100644 org.adempiere.base/src/org/compiere/model/MLocatorType.java create mode 100644 org.adempiere.base/src/org/compiere/model/X_M_LocatorType.java diff --git a/db/ddlutils/oracle/functions/BOM_Qty_Available.sql b/db/ddlutils/oracle/functions/BOM_Qty_Available.sql index a396069be3..ee9fa2ce0c 100644 --- a/db/ddlutils/oracle/functions/BOM_Qty_Available.sql +++ b/db/ddlutils/oracle/functions/BOM_Qty_Available.sql @@ -15,7 +15,7 @@ RETURN NUMBER */ AS BEGIN - RETURN bomQtyOnHand(Product_ID, Warehouse_ID, Locator_ID) + RETURN bomQtyOnHandForReservation(Product_ID, Warehouse_ID, Locator_ID) - bomQtyReserved(Product_ID, Warehouse_ID, Locator_ID); END bomQtyAvailable; / diff --git a/db/ddlutils/oracle/functions/BOM_Qty_OnHand.sql b/db/ddlutils/oracle/functions/BOM_Qty_OnHand.sql index 8234cad33d..285c5ffe5a 100644 --- a/db/ddlutils/oracle/functions/BOM_Qty_OnHand.sql +++ b/db/ddlutils/oracle/functions/BOM_Qty_OnHand.sql @@ -60,7 +60,7 @@ BEGIN WHEN OTHERS THEN RETURN 0; END; - -- Unimited capacity if no item + -- Unlimited capacity if no item IF (IsBOM='N' AND (ProductType<>'I' OR IsStocked='N')) THEN RETURN Quantity; -- Stocked item @@ -68,16 +68,15 @@ BEGIN -- Get ProductQty SELECT NVL(SUM(QtyOnHand), 0) INTO ProductQty - FROM M_STORAGE s - WHERE M_Product_ID=Product_ID - AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID - AND l.M_Warehouse_ID=myWarehouse_ID); + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + WHERE s.M_Product_ID=Product_ID AND l.M_Warehouse_ID=myWarehouse_ID; -- -- DBMS_OUTPUT.PUT_LINE('Qty=' || ProductQty); RETURN ProductQty; END IF; - -- Go though BOM + -- Go through BOM -- DBMS_OUTPUT.PUT_LINE('BOM'); FOR bom IN CUR_BOM LOOP -- Stocked Items "leaf node" @@ -85,10 +84,9 @@ BEGIN -- Get ProductQty SELECT NVL(SUM(QtyOnHand), 0) INTO ProductQty - FROM M_STORAGE s - WHERE M_Product_ID=bom.M_ProductBOM_ID - AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID - AND l.M_Warehouse_ID=myWarehouse_ID); + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + WHERE s.M_Product_ID=bom.M_ProductBOM_ID AND l.M_Warehouse_ID=myWarehouse_ID; -- Get Rounding Precision SELECT NVL(MAX(u.StdPrecision), 0) INTO StdPrecision diff --git a/db/ddlutils/oracle/functions/BOM_Qty_OnHandForReservation.sql b/db/ddlutils/oracle/functions/BOM_Qty_OnHandForReservation.sql new file mode 100644 index 0000000000..125893a0e1 --- /dev/null +++ b/db/ddlutils/oracle/functions/BOM_Qty_OnHandForReservation.sql @@ -0,0 +1,127 @@ +CREATE OR REPLACE FUNCTION BOMQTYONHANDFORRESERVATION +( + Product_ID IN NUMBER, + Warehouse_ID IN NUMBER, + Locator_ID IN NUMBER -- Only used, if warehouse is null +) +RETURN NUMBER +/****************************************************************************** + * ** Compiere Product ** Copyright (c) 1999-2001 Accorto, Inc. USA + * Open Source Software Provided "AS IS" without warranty or liability + * When you use any parts (changed or unchanged), add "Powered by Compiere" to + * your product name; See license details http://www.compiere.org/license.html + ****************************************************************************** + * Return quantity on hand for BOM + */ +AS + myWarehouse_ID NUMBER; + Quantity NUMBER := 99999; -- unlimited + IsBOM CHAR(1); + IsStocked CHAR(1); + ProductType CHAR(1); + ProductQty NUMBER; + StdPrecision NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y'; + -- +BEGIN + -- Check Parameters + myWarehouse_ID := Warehouse_ID; + IF (myWarehouse_ID IS NULL) THEN + IF (Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT SUM(M_Warehouse_ID) INTO myWarehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=Locator_ID; + END IF; + END IF; + IF (myWarehouse_ID IS NULL) THEN + RETURN 0; + END IF; +-- DBMS_OUTPUT.PUT_LINE('Warehouse=' || myWarehouse_ID); + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO IsBOM, ProductType, IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + -- Unlimited capacity if no item + IF (IsBOM='N' AND (ProductType<>'I' OR IsStocked='N')) THEN + RETURN Quantity; + -- Stocked item + ELSIF (IsStocked='Y') THEN + -- Get ProductQty + SELECT NVL(SUM(QtyOnHand), 0) + INTO ProductQty + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + LEFT JOIN M_LocatorType lt ON (l.M_LocatorType_ID=lt.M_LocatorType_ID) + WHERE s.M_Product_ID=Product_ID AND l.M_Warehouse_ID=myWarehouse_ID + AND COALESCE(lt.IsAvailableForReservation,'Y')='Y'; + -- + -- DBMS_OUTPUT.PUT_LINE('Qty=' || ProductQty); + RETURN ProductQty; + END IF; + + -- Go through BOM +-- DBMS_OUTPUT.PUT_LINE('BOM'); + FOR bom IN CUR_BOM LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get ProductQty + SELECT NVL(SUM(QtyOnHand), 0) + INTO ProductQty + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + LEFT JOIN M_LocatorType lt ON (l.M_LocatorType_ID=lt.M_LocatorType_ID) + WHERE s.M_Product_ID=bom.M_ProductBOM_ID AND l.M_Warehouse_ID=myWarehouse_ID + AND COALESCE(lt.IsAvailableForReservation,'Y')='Y'; + -- Get Rounding Precision + SELECT NVL(MAX(u.StdPrecision), 0) + INTO StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + ProductQty := ROUND (ProductQty/bom.BOMQty, StdPrecision); + -- How much can we make overall + IF (ProductQty < Quantity) THEN + Quantity := ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + ProductQty := BomqtyonhandForReservation (bom.M_ProductBOM_ID, myWarehouse_ID, Locator_ID); + -- How much can we make overall + IF (ProductQty < Quantity) THEN + Quantity := ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + IF (Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT NVL(MAX(u.StdPrecision), 0) + INTO StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=Product_ID; + -- + RETURN ROUND (Quantity, StdPrecision); + END IF; + RETURN 0; +END BOMQTYONHANDFORRESERVATION; +/ + diff --git a/db/ddlutils/oracle/views/M_PRODUCT_STOCK_V.sql b/db/ddlutils/oracle/views/M_PRODUCT_STOCK_V.sql index 439c42fb0e..fb505ab3a4 100644 --- a/db/ddlutils/oracle/views/M_PRODUCT_STOCK_V.sql +++ b/db/ddlutils/oracle/views/M_PRODUCT_STOCK_V.sql @@ -3,11 +3,14 @@ CREATE OR REPLACE VIEW M_PRODUCT_STOCK_V AS SELECT ms.IsActive, ms.Created, ms.CreatedBy, ms.Updated, ms.UpdatedBy, -mp.VALUE, mp.help, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand, +mp.VALUE, mp.help, +(CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN ms.qtyonhand ELSE 0 END - ms.qtyreserved) AS qtyavailable, +ms.qtyonhand, ms.qtyreserved, mp.description, mw.NAME AS warehouse, mw.m_warehouse_id, mw.ad_client_id, mw.ad_org_id, mp.documentnote, mp.m_product_id FROM M_STORAGE ms JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id +LEFT JOIN M_LOCATORTYPE lt ON ml.m_locatortype_id = lt.m_locatortype_id JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id ORDER BY mw.NAME; diff --git a/db/ddlutils/oracle/views/M_PRODUCT_SUBSTITUTERELATED_V.sql b/db/ddlutils/oracle/views/M_PRODUCT_SUBSTITUTERELATED_V.sql index 13e86f23ab..fef9567284 100644 --- a/db/ddlutils/oracle/views/M_PRODUCT_SUBSTITUTERELATED_V.sql +++ b/db/ddlutils/oracle/views/M_PRODUCT_SUBSTITUTERELATED_V.sql @@ -10,7 +10,7 @@ SELECT s.ad_client_id, s.substitute_id, 'S' AS rowtype, mp.name, - sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable, + sum(CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN ms.qtyonhand ELSE 0 END - ms.qtyreserved) AS qtyavailable, sum(ms.qtyonhand) AS qtyonhand, sum(ms.qtyreserved) AS qtyreserved, currencyRound(MAX(mpr.pricestd),mpl.C_Currency_ID,'N') AS pricestd, @@ -21,6 +21,7 @@ SELECT s.ad_client_id, JOIN m_storage ms ON ms.m_product_id = s.substitute_id JOIN m_product mp ON ms.m_product_id = mp.m_product_id JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id + LEFT JOIN M_LOCATORTYPE lt ON ml.m_locatortype_id = lt.m_locatortype_id JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id JOIN m_pricelist_version mplv ON mplv.m_pricelist_version_id = mpr.m_pricelist_version_id @@ -52,7 +53,7 @@ SELECT s.ad_client_id, r.relatedproduct_id AS substitute_id, 'R' AS rowtype, mp.name, - sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable, + sum(CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN ms.qtyonhand ELSE 0 END - ms.qtyreserved) AS qtyavailable, sum(ms.qtyonhand) AS qtyonhand, sum(ms.qtyreserved) AS qtyreserved, currencyRound(MAX(mpr.pricestd),mpl.C_Currency_ID,'N') AS pricestd, @@ -63,6 +64,7 @@ SELECT s.ad_client_id, JOIN m_storage ms ON ms.m_product_id = r.relatedproduct_id JOIN m_product mp ON ms.m_product_id = mp.m_product_id JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id + LEFT JOIN M_LOCATORTYPE lt ON ml.m_locatortype_id = lt.m_locatortype_id JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id JOIN m_pricelist_version mplv ON mplv.m_pricelist_version_id = mpr.m_pricelist_version_id @@ -81,4 +83,4 @@ SELECT s.ad_client_id, mpr.m_pricelist_version_id, org.name, mp.name, - mpl.C_Currency_ID; \ No newline at end of file + mpl.C_Currency_ID; diff --git a/db/ddlutils/oracle/views/RV_STORAGE.sql b/db/ddlutils/oracle/views/RV_STORAGE.sql index c1ab6bacf3..c472c0d6d5 100644 --- a/db/ddlutils/oracle/views/RV_STORAGE.sql +++ b/db/ddlutils/oracle/views/RV_STORAGE.sql @@ -23,7 +23,7 @@ AS l.z, s.qtyonhand, s.qtyreserved, - s.qtyonhand - s.qtyreserved AS qtyavailable, + CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN s.qtyonhand ELSE 0 END - s.qtyreserved AS qtyavailable, s.qtyordered, s.datelastinventory, s.m_attributesetinstance_id, @@ -102,6 +102,8 @@ AS FROM m_storage s JOIN m_locator l ON s.m_locator_id = l.m_locator_id + LEFT JOIN m_locatortype lt + ON l.m_locatortype_id = lt.m_locatortype_id JOIN m_product p ON s.m_product_id = p.m_product_id LEFT JOIN m_attributesetinstance asi diff --git a/db/ddlutils/postgresql/functions/BOM_Qty_Available.sql b/db/ddlutils/postgresql/functions/BOM_Qty_Available.sql index 40952ccf98..18ff6e857d 100644 --- a/db/ddlutils/postgresql/functions/BOM_Qty_Available.sql +++ b/db/ddlutils/postgresql/functions/BOM_Qty_Available.sql @@ -1,7 +1,7 @@ CREATE OR REPLACE FUNCTION bomqtyavailable (in product_id numeric, in warehouse_id numeric, in locator_id numeric) RETURNS numeric AS $BODY$ BEGIN - RETURN bomQtyOnHand(Product_ID, Warehouse_ID, Locator_ID) - bomQtyReserved(Product_ID, Warehouse_ID, Locator_ID); + RETURN bomQtyOnHandForReservation(Product_ID, Warehouse_ID, Locator_ID) - bomQtyReserved(Product_ID, Warehouse_ID, Locator_ID); END; $BODY$ LANGUAGE 'plpgsql' STABLE diff --git a/db/ddlutils/postgresql/functions/BOM_Qty_OnHand.sql b/db/ddlutils/postgresql/functions/BOM_Qty_OnHand.sql index adeff6ec6f..697b2de662 100644 --- a/db/ddlutils/postgresql/functions/BOM_Qty_OnHand.sql +++ b/db/ddlutils/postgresql/functions/BOM_Qty_OnHand.sql @@ -1,4 +1,4 @@ -CREATE OR REPLACE FUNCTION bomqtyonhand (in product_id numeric, in warehouse_id numeric, in locator_id numeric) RETURNS numeric AS +CREATE OR REPLACE FUNCTION BOMQtyOnHand (in product_id numeric, in warehouse_id numeric, in locator_id numeric) RETURNS numeric AS $BODY$ DECLARE myWarehouse_ID numeric; @@ -37,7 +37,7 @@ BEGIN WHEN OTHERS THEN RETURN 0; END; - -- Unimited capacity if no item + -- Unlimited capacity if no item IF (v_IsBOM='N' AND (v_ProductType<>'I' OR v_IsStocked='N')) THEN RETURN v_Quantity; -- Stocked item @@ -45,15 +45,14 @@ BEGIN -- Get ProductQty SELECT COALESCE(SUM(QtyOnHand), 0) INTO v_ProductQty - FROM M_STORAGE s - WHERE M_Product_ID=Product_ID - AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID - AND l.M_Warehouse_ID=myWarehouse_ID); + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + WHERE s.M_Product_ID=Product_ID AND l.M_Warehouse_ID=myWarehouse_ID; -- RETURN v_ProductQty; END IF; - -- Go though BOM + -- Go through BOM FOR bom IN -- Get BOM Product info SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType FROM M_PRODUCT_BOM b, M_PRODUCT p @@ -69,10 +68,9 @@ BEGIN -- Get v_ProductQty SELECT COALESCE(SUM(QtyOnHand), 0) INTO v_ProductQty - FROM M_STORAGE s - WHERE M_Product_ID=bom.M_ProductBOM_ID - AND EXISTS (SELECT * FROM M_LOCATOR l WHERE s.M_Locator_ID=l.M_Locator_ID - AND l.M_Warehouse_ID=myWarehouse_ID); + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + WHERE s.M_Product_ID=bom.M_ProductBOM_ID AND l.M_Warehouse_ID=myWarehouse_ID; -- Get Rounding Precision SELECT COALESCE(MAX(u.StdPrecision), 0) INTO v_StdPrecision diff --git a/db/ddlutils/postgresql/functions/BOM_Qty_OnHandForReservation.sql b/db/ddlutils/postgresql/functions/BOM_Qty_OnHandForReservation.sql new file mode 100644 index 0000000000..6cde685873 --- /dev/null +++ b/db/ddlutils/postgresql/functions/BOM_Qty_OnHandForReservation.sql @@ -0,0 +1,113 @@ +CREATE OR REPLACE FUNCTION BOMQtyOnHandForReservation (in product_id numeric, in warehouse_id numeric, in locator_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + myWarehouse_ID numeric; + v_Quantity numeric := 99999; -- unlimited + v_IsBOM CHAR(1); + v_IsStocked CHAR(1); + v_ProductType CHAR(1); + v_ProductQty numeric; + v_StdPrecision int; + bom record; + +BEGIN + -- Check Parameters + myWarehouse_ID := Warehouse_ID; + IF (myWarehouse_ID IS NULL) THEN + IF (Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT SUM(M_Warehouse_ID) INTO myWarehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=Locator_ID; + END IF; + END IF; + IF (myWarehouse_ID IS NULL) THEN + RETURN 0; + END IF; + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO v_IsBOM, v_ProductType, v_IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + -- Unlimited capacity if no item + IF (v_IsBOM='N' AND (v_ProductType<>'I' OR v_IsStocked='N')) THEN + RETURN v_Quantity; + -- Stocked item + ELSIF (v_IsStocked='Y') THEN + -- Get ProductQty + SELECT COALESCE(SUM(QtyOnHand), 0) + INTO v_ProductQty + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + LEFT JOIN M_LocatorType lt ON (l.M_LocatorType_ID=lt.M_LocatorType_ID) + WHERE s.M_Product_ID=Product_ID AND l.M_Warehouse_ID=myWarehouse_ID + AND COALESCE(lt.IsAvailableForReservation,'Y')='Y'; + -- + RETURN v_ProductQty; + END IF; + + -- Go through BOM + FOR bom IN -- Get BOM Product info + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=product_ID + AND b.M_ProductBOM_ID != Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y' + LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get v_ProductQty + SELECT COALESCE(SUM(QtyOnHand), 0) + INTO v_ProductQty + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + LEFT JOIN M_LocatorType lt ON (l.M_LocatorType_ID=lt.M_LocatorType_ID) + WHERE s.M_Product_ID=bom.M_ProductBOM_ID AND l.M_Warehouse_ID=myWarehouse_ID + AND COALESCE(lt.IsAvailableForReservation,'Y')='Y'; + -- Get Rounding Precision + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + v_ProductQty := ROUND (v_ProductQty/bom.BOMQty, v_StdPrecision); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + v_ProductQty := BOMQtyOnHandForReservation (bom.M_ProductBOM_ID, myWarehouse_ID, Locator_ID); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + IF (v_Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=Product_ID; + -- + RETURN ROUND (v_Quantity, v_StdPrecision); + END IF; + RETURN 0; +END; +$BODY$ +LANGUAGE 'plpgsql' STABLE +; + diff --git a/db/ddlutils/postgresql/views/M_PRODUCT_STOCK_V.sql b/db/ddlutils/postgresql/views/M_PRODUCT_STOCK_V.sql index 439c42fb0e..fb505ab3a4 100644 --- a/db/ddlutils/postgresql/views/M_PRODUCT_STOCK_V.sql +++ b/db/ddlutils/postgresql/views/M_PRODUCT_STOCK_V.sql @@ -3,11 +3,14 @@ CREATE OR REPLACE VIEW M_PRODUCT_STOCK_V AS SELECT ms.IsActive, ms.Created, ms.CreatedBy, ms.Updated, ms.UpdatedBy, -mp.VALUE, mp.help, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand, +mp.VALUE, mp.help, +(CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN ms.qtyonhand ELSE 0 END - ms.qtyreserved) AS qtyavailable, +ms.qtyonhand, ms.qtyreserved, mp.description, mw.NAME AS warehouse, mw.m_warehouse_id, mw.ad_client_id, mw.ad_org_id, mp.documentnote, mp.m_product_id FROM M_STORAGE ms JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id +LEFT JOIN M_LOCATORTYPE lt ON ml.m_locatortype_id = lt.m_locatortype_id JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id ORDER BY mw.NAME; diff --git a/db/ddlutils/postgresql/views/M_PRODUCT_SUBSTITUTERELATED_V.sql b/db/ddlutils/postgresql/views/M_PRODUCT_SUBSTITUTERELATED_V.sql index 13e86f23ab..258aa8e23a 100644 --- a/db/ddlutils/postgresql/views/M_PRODUCT_SUBSTITUTERELATED_V.sql +++ b/db/ddlutils/postgresql/views/M_PRODUCT_SUBSTITUTERELATED_V.sql @@ -10,7 +10,7 @@ SELECT s.ad_client_id, s.substitute_id, 'S' AS rowtype, mp.name, - sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable, + sum(CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN ms.qtyonhand ELSE 0 END - ms.qtyreserved) AS qtyavailable, sum(ms.qtyonhand) AS qtyonhand, sum(ms.qtyreserved) AS qtyreserved, currencyRound(MAX(mpr.pricestd),mpl.C_Currency_ID,'N') AS pricestd, @@ -21,6 +21,7 @@ SELECT s.ad_client_id, JOIN m_storage ms ON ms.m_product_id = s.substitute_id JOIN m_product mp ON ms.m_product_id = mp.m_product_id JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id + LEFT JOIN M_LOCATORTYPE lt ON ml.m_locatortype_id = lt.m_locatortype_id JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id JOIN m_pricelist_version mplv ON mplv.m_pricelist_version_id = mpr.m_pricelist_version_id @@ -52,7 +53,7 @@ SELECT s.ad_client_id, r.relatedproduct_id AS substitute_id, 'R' AS rowtype, mp.name, - sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable, + sum(CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN ms.qtyonhand ELSE 0 END - ms.qtyreserved) AS qtyavailable, sum(ms.qtyonhand) AS qtyonhand, sum(ms.qtyreserved) AS qtyreserved, currencyRound(MAX(mpr.pricestd),mpl.C_Currency_ID,'N') AS pricestd, @@ -63,6 +64,7 @@ SELECT s.ad_client_id, JOIN m_storage ms ON ms.m_product_id = r.relatedproduct_id JOIN m_product mp ON ms.m_product_id = mp.m_product_id JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id + LEFT JOIN M_LOCATORTYPE lt ON ml.m_locatortype_id = lt.m_locatortype_id JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id JOIN m_pricelist_version mplv ON mplv.m_pricelist_version_id = mpr.m_pricelist_version_id diff --git a/db/ddlutils/postgresql/views/RV_STORAGE.sql b/db/ddlutils/postgresql/views/RV_STORAGE.sql index 93001ec6cb..c31aaf8c77 100644 --- a/db/ddlutils/postgresql/views/RV_STORAGE.sql +++ b/db/ddlutils/postgresql/views/RV_STORAGE.sql @@ -22,7 +22,7 @@ SELECT s.ad_client_id, l.z, s.qtyonhand, s.qtyreserved, - s.qtyonhand - s.qtyreserved AS qtyavailable, + CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN s.qtyonhand ELSE 0 END - s.qtyreserved AS qtyavailable, s.qtyordered, s.datelastinventory, s.m_attributesetinstance_id, @@ -99,6 +99,8 @@ SELECT s.ad_client_id, FROM m_storage s JOIN m_locator l ON s.m_locator_id = l.m_locator_id + LEFT JOIN m_locatortype lt + ON l.m_locatortype_id = lt.m_locatortype_id JOIN m_product p ON s.m_product_id = p.m_product_id LEFT JOIN m_attributesetinstance asi diff --git a/migration/i2.1z/oracle/201506091830_IDEMPIERE-2668.sql b/migration/i2.1z/oracle/201506091830_IDEMPIERE-2668.sql new file mode 100644 index 0000000000..06e6d7eccf --- /dev/null +++ b/migration/i2.1z/oracle/201506091830_IDEMPIERE-2668.sql @@ -0,0 +1,1226 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-2668 Exclude Locators for Demand Operations +-- Jun 9, 2015 6:03:39 PM COT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202886,0,0,'Y',TO_DATE('2015-06-09 18:03:38','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:03:38','YYYY-MM-DD HH24:MI:SS'),100,'IsAvailableForReplenishment','Available for Replenishment','Available for Replenishment','D','5e2d1eaa-3fde-4240-b83a-035ccab27483') +; + +-- Jun 9, 2015 6:03:58 PM COT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202887,0,0,'Y',TO_DATE('2015-06-09 18:03:58','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:03:58','YYYY-MM-DD HH24:MI:SS'),100,'IsAvailableForReservation','Available for Reservation','Available for Reservation','D','4ddf3b6f-825d-4c90-9f92-71a3e11f2e2a') +; + +-- Jun 9, 2015 6:04:23 PM COT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202888,0,0,'Y',TO_DATE('2015-06-09 18:04:23','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:04:23','YYYY-MM-DD HH24:MI:SS'),100,'IsAvailableForShipping','Available for Shipping','Available for Shipping','D','75f9e774-476c-4f32-9c84-54f21f4717bf') +; + +-- Jun 9, 2015 6:08:51 PM COT +INSERT INTO AD_Window (AD_Window_ID,Name,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,WindowType,Processing,EntityType,IsSOTrx,IsDefault,WinHeight,WinWidth,IsBetaFunctionality,AD_Window_UU) VALUES (200074,'Locator Type',0,0,'Y',TO_DATE('2015-06-09 18:08:50','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:08:50','YYYY-MM-DD HH24:MI:SS'),100,'M','N','D','Y','N',0,0,'N','cf08fb56-c497-48b2-b901-dc331f88a4d4') +; + +-- Jun 9, 2015 6:08:59 PM COT +INSERT INTO AD_Table (AD_Table_ID,Name,AD_Window_ID,TableName,LoadSeq,AccessLevel,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSecurityEnabled,IsDeleteable,IsHighVolume,IsView,EntityType,ImportTable,IsChangeLog,ReplicationType,CopyColumnsFromTable,IsCentrallyMaintained,AD_Table_UU,Processing,DatabaseViewDrop) VALUES (200175,'Locator Type',200074,'M_LocatorType',0,'3',0,0,'Y',TO_DATE('2015-06-09 18:08:59','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:08:59','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','N','N','D','N','Y','L','N','Y','f2b7e21d-ca0f-4575-a598-5bae28df6b24','N','N') +; + +-- Jun 9, 2015 6:08:59 PM COT +INSERT INTO AD_Sequence (Name,CurrentNext,IsAudited,StartNewYear,Description,IsActive,IsTableID,AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,AD_Sequence_ID,IsAutoSequence,StartNo,IncrementNo,CurrentNextSys,AD_Sequence_UU) VALUES ('M_LocatorType',1000000,'N','N','Table M_LocatorType','Y','Y',0,0,TO_DATE('2015-06-09 18:08:59','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:08:59','YYYY-MM-DD HH24:MI:SS'),100,200231,'Y',1000000,1,200000,'401b3cae-5730-4c62-b306-2f18e3d8d142') +; + +-- Jun 9, 2015 6:09:13 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212181,1,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200175,129,'AD_Client_ID','@#AD_Client_ID@',22,'N','N','Y','N','N',0,'N',19,0,0,'Y',TO_DATE('2015-06-09 18:09:13','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:09:13','YYYY-MM-DD HH24:MI:SS'),100,102,'N','N','D','Y','N','N','Y','f364ce24-be93-4de6-8686-111905fd6980','N','N','N') +; + +-- Jun 9, 2015 6:09:13 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212182,1,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200175,104,'AD_Org_ID','@#AD_Org_ID@',22,'N','N','Y','N','N',0,'N',19,0,0,'Y',TO_DATE('2015-06-09 18:09:13','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:09:13','YYYY-MM-DD HH24:MI:SS'),100,113,'N','N','D','Y','N','N','Y','ae0f9c76-2825-4cd9-bcd9-24fe6eb43253','N','N','N') +; + +-- Jun 9, 2015 6:09:14 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212183,1,'Created','Date this record was created','The Created field indicates the date that this record was created.',200175,'Created','SYSDATE',7,'N','N','Y','N','N',0,'N',16,0,0,'Y',TO_DATE('2015-06-09 18:09:13','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:09:13','YYYY-MM-DD HH24:MI:SS'),100,245,'N','N','D','Y','N','N','Y','37c6dedf-df2b-4b75-8ecf-a4a6f5c0c376','N','N','N') +; + +-- Jun 9, 2015 6:09:14 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212184,1,'Created By','User who created this records','The Created By field indicates the user who created this record.',200175,'CreatedBy',22,'N','N','Y','N','N',0,'N',18,110,0,0,'Y',TO_DATE('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,246,'N','N','D','Y','N','N','Y','4b1edc4a-f105-4753-8566-4a415ea12c77','N','N','N') +; + +-- Jun 9, 2015 6:09:14 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212185,1,'Description','Optional short description of the record','A description is limited to 255 characters.',200175,'Description',255,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_DATE('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,275,'Y','Y','D','Y','N','N','Y','c5c54fc4-f29a-495b-b70b-0319e6e18656','Y','N','N') +; + +-- Jun 9, 2015 6:09:14 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212186,1,'Comment/Help','Comment or Hint','The Help field contains a hint, comment or help about the use of this item.',200175,'Help',2000,'N','N','N','N','N',0,'N',14,0,0,'Y',TO_DATE('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,326,'Y','N','D','Y','N','N','Y','7352dea2-66c4-4e2e-98aa-741d102bcb34','Y','N','N') +; + +-- Jun 9, 2015 6:09:15 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212187,1,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200175,'IsActive','Y',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_DATE('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,348,'Y','N','D','Y','N','N','Y','1bf86a87-aa8d-4287-bb41-1e82376d8242','N','N','N') +; + +-- Jun 9, 2015 6:09:15 PM COT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202889,0,0,'Y',TO_DATE('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,'M_LocatorType_ID','Locator Type','Locator Type','D','40daae66-c2e4-4700-9ea6-7ba10237fff8') +; + +-- Jun 9, 2015 6:09:15 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212188,1,'Locator Type',200175,'M_LocatorType_ID',22,'Y','N','Y','N','N',0,'N',13,0,0,'Y',TO_DATE('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,202889,'N','N','D','Y','N','N','Y','f4d83bfd-cc5d-4c03-b479-ad01fa1f7684','N','N','N') +; + +-- Jun 9, 2015 6:09:15 PM COT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202890,0,0,'Y',TO_DATE('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,'M_LocatorType_UU','M_LocatorType_UU','M_LocatorType_UU','D','9b6c9339-fc09-46c5-884f-b048019eeb39') +; + +-- Jun 9, 2015 6:09:15 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212189,1.00,'M_LocatorType_UU',200175,'M_LocatorType_UU',36,'N','N','N','N','N','N',10,0,0,'Y',TO_DATE('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,202890,'Y','N','D','N','N','N','Y','0963606e-219d-49d2-aba1-22605cd5f302','N','N','N') +; + +-- Jun 9, 2015 6:09:16 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212190,1,'Name','Alphanumeric identifier of the entity','The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.',200175,'Name',60,'N','N','Y','N','Y',1,'N',10,0,0,'Y',TO_DATE('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,469,'Y','Y','D','Y','N','N','Y','73f48c32-177a-41bf-b049-f347290c5334','Y','N','N') +; + +-- Jun 9, 2015 6:09:16 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212191,1,'Updated','Date this record was updated','The Updated field indicates the date that this record was updated.',200175,'Updated','SYSDATE',7,'N','N','Y','N','N',0,'N',16,0,0,'Y',TO_DATE('2015-06-09 18:09:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:09:16','YYYY-MM-DD HH24:MI:SS'),100,607,'N','N','D','Y','N','N','Y','a35a068c-6556-4b2b-b7e9-93b2c8ab5dbf','N','N','N') +; + +-- Jun 9, 2015 6:09:16 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212192,1,'Updated By','User who updated this records','The Updated By field indicates the user who updated this record.',200175,'UpdatedBy',22,'N','N','Y','N','N',0,'N',18,110,0,0,'Y',TO_DATE('2015-06-09 18:09:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:09:16','YYYY-MM-DD HH24:MI:SS'),100,608,'N','N','D','Y','N','N','Y','6905723a-de6b-40bf-8595-948cfe1c8029','N','N','N') +; + +-- Jun 9, 2015 6:09:16 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212193,1,'Search Key','Search key for the record in the format required - must be unique','A search key allows you a fast method of finding a particular record. +If you leave the search key empty, the system automatically creates a numeric number. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).',200175,'Value',40,'N','N','Y','N','N',0,'N',10,0,0,'Y',TO_DATE('2015-06-09 18:09:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:09:16','YYYY-MM-DD HH24:MI:SS'),100,620,'Y','Y','D','Y','N','N','Y','5f703bd8-6824-453f-a419-978a39c47320','Y','N','N') +; + +-- Jun 9, 2015 6:10:56 PM COT +UPDATE AD_Column SET Name='Available for Replenishment', Description=NULL, Help=NULL, ColumnName='IsAvailableForReplenishment', DefaultValue='Y', FieldLength=1, AD_Reference_ID=20, AD_Element_ID=202886, IsSelectionColumn='N', FKConstraintType=NULL,Updated=TO_DATE('2015-06-09 18:10:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212193 +; + +-- Jun 9, 2015 6:11:18 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212194,1,'Available for Reservation',200175,'IsAvailableForReservation','Y',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_DATE('2015-06-09 18:11:17','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:11:17','YYYY-MM-DD HH24:MI:SS'),100,202887,'Y','N','D','Y','N','N','Y','6de34019-bfeb-4272-974e-52906d4d29eb','Y','N','N') +; + +-- Jun 9, 2015 6:12:01 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintType) VALUES (212195,1,'Available for Shipping',200175,'IsAvailableForShipping','Y',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_DATE('2015-06-09 18:12:01','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:12:01','YYYY-MM-DD HH24:MI:SS'),100,202888,'Y','N','D','Y','N','N','Y','e7fba8f8-f3fb-488f-a6b7-93a89a28e0a3','Y','N','N','N') +; + +-- Jun 9, 2015 6:15:44 PM COT +UPDATE AD_Column SET FKConstraintName='ADClient_MLocatorType', FKConstraintType='N',Updated=TO_DATE('2015-06-09 18:15:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212181 +; + +-- Jun 9, 2015 6:15:44 PM COT +UPDATE AD_Column SET FKConstraintName='ADOrg_MLocatorType', FKConstraintType='N',Updated=TO_DATE('2015-06-09 18:15:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212182 +; + +-- Jun 9, 2015 6:15:44 PM COT +UPDATE AD_Column SET FKConstraintName='CreatedBy_MLocatorType', FKConstraintType='N',Updated=TO_DATE('2015-06-09 18:15:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212184 +; + +-- Jun 9, 2015 6:15:44 PM COT +UPDATE AD_Column SET FKConstraintName='UpdatedBy_MLocatorType', FKConstraintType='N',Updated=TO_DATE('2015-06-09 18:15:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212192 +; + +-- Jun 9, 2015 6:15:44 PM COT +CREATE TABLE M_LocatorType (AD_Client_ID NUMBER(10) NOT NULL, AD_Org_ID NUMBER(10) NOT NULL, Created DATE DEFAULT SYSDATE NOT NULL, CreatedBy NUMBER(10) NOT NULL, Description VARCHAR2(255) DEFAULT NULL , Help VARCHAR2(2000) DEFAULT NULL , IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL, IsAvailableForReplenishment CHAR(1) DEFAULT 'Y' CHECK (IsAvailableForReplenishment IN ('Y','N')) NOT NULL, IsAvailableForReservation CHAR(1) DEFAULT 'Y' CHECK (IsAvailableForReservation IN ('Y','N')) NOT NULL, IsAvailableForShipping CHAR(1) DEFAULT 'Y' CHECK (IsAvailableForShipping IN ('Y','N')) NOT NULL, M_LocatorType_ID NUMBER(10) NOT NULL, M_LocatorType_UU VARCHAR2(36) DEFAULT NULL , Name VARCHAR2(60) NOT NULL, Updated DATE DEFAULT SYSDATE NOT NULL, UpdatedBy NUMBER(10) NOT NULL, CONSTRAINT M_LocatorType_Key PRIMARY KEY (M_LocatorType_ID), CONSTRAINT M_LocatorType_UU_idx UNIQUE (M_LocatorType_UU)) +; + +-- Jun 9, 2015 6:15:44 PM COT +ALTER TABLE M_LocatorType ADD CONSTRAINT ADClient_MLocatorType FOREIGN KEY (AD_Client_ID) REFERENCES ad_client(ad_client_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Jun 9, 2015 6:15:44 PM COT +ALTER TABLE M_LocatorType ADD CONSTRAINT ADOrg_MLocatorType FOREIGN KEY (AD_Org_ID) REFERENCES ad_org(ad_org_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Jun 9, 2015 6:15:44 PM COT +ALTER TABLE M_LocatorType ADD CONSTRAINT CreatedBy_MLocatorType FOREIGN KEY (CreatedBy) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Jun 9, 2015 6:15:44 PM COT +ALTER TABLE M_LocatorType ADD CONSTRAINT UpdatedBy_MLocatorType FOREIGN KEY (UpdatedBy) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Jun 9, 2015 6:16:17 PM COT +INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing) VALUES (0,0,201037,'ba61df8c-e022-49fb-8f1a-bc6c6c23f2eb',TO_DATE('2015-06-09 18:16:17','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','m_locatortype_uu_idx',TO_DATE('2015-06-09 18:16:17','YYYY-MM-DD HH24:MI:SS'),100,200175,'N','Y','N') +; + +-- Jun 9, 2015 6:16:17 PM COT +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201269,'f1a91678-6ecf-49a3-b5d6-919df929f9c4',TO_DATE('2015-06-09 18:16:17','YYYY-MM-DD HH24:MI:SS'),100,'Y',TO_DATE('2015-06-09 18:16:17','YYYY-MM-DD HH24:MI:SS'),100,212189,201037,1) +; + +-- Jun 9, 2015 6:19:29 PM COT +INSERT INTO AD_Tab (AD_Tab_ID,Name,AD_Window_ID,SeqNo,IsSingleRow,AD_Table_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,HasTree,IsInfoTab,IsTranslationTab,IsReadOnly,OrderByClause,Processing,ImportFields,TabLevel,IsSortTab,EntityType,IsInsertRecord,IsAdvancedTab,AD_Tab_UU,TreeDisplayedOn) VALUES (200190,'Locator Type',200074,10,'Y',200175,0,0,'Y',TO_DATE('2015-06-09 18:19:20','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:19:20','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','N','M_LocatorType.Name','N','N',0,'N','D','Y','N','388b0f0c-ece2-4809-96d6-4d486d3e7b5d','B') +; + +-- Jun 9, 2015 6:19:38 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,ColumnSpan) VALUES (203803,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200190,212181,'Y',22,10,'N','N','N','N',0,0,'Y',TO_DATE('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','b4a6281e-d02c-4385-b011-50a80efbe606','N',2) +; + +-- Jun 9, 2015 6:19:38 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsAllowCopy,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (203804,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200190,212182,'Y',22,20,'N','N','N','N',0,0,'Y',TO_DATE('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','73843af6-0103-442d-88dc-be6860f7d8f5','Y','Y',10,4,2) +; + +-- Jun 9, 2015 6:19:38 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (203805,'Name','Alphanumeric identifier of the entity','The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.',200190,212190,'Y',60,30,'N','N','N','N',0,0,'Y',TO_DATE('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','d929ad16-8f1a-42ff-a657-83d3f26ebc54','Y',20,5) +; + +-- Jun 9, 2015 6:19:38 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (203806,'Description','Optional short description of the record','A description is limited to 255 characters.',200190,212185,'Y',255,40,'N','N','N','N',0,0,'Y',TO_DATE('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','cc891cd5-29f8-4887-89d6-ea4185a3c6c6','Y',30,5) +; + +-- Jun 9, 2015 6:19:39 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan,NumLines) VALUES (203807,'Comment/Help','Comment or Hint','The Help field contains a hint, comment or help about the use of this item.',200190,212186,'Y',2000,50,'N','N','N','N',0,0,'Y',TO_DATE('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','29d71ef0-7af4-40cc-a873-89452a6431e2','Y',40,5,3) +; + +-- Jun 9, 2015 6:19:39 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,ColumnSpan) VALUES (203808,'Locator Type',200190,212188,'N',22,'N','N','N','N',0,0,'Y',TO_DATE('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','c51aade9-02bb-4126-9d35-5cdc82e903cf','N',2) +; + +-- Jun 9, 2015 6:19:39 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,ColumnSpan) VALUES (203809,'M_LocatorType_UU',200190,212189,'N',36,'N','N','N','N',0,0,'Y',TO_DATE('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','edf9670f-8fb1-45b7-97f8-06dcb0e7d305','N',2) +; + +-- Jun 9, 2015 6:19:39 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (203810,'Available for Replenishment',200190,212193,'Y',1,60,'N','N','N','N',0,0,'Y',TO_DATE('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','5cf26906-5c25-4fc1-b38a-8369366d8eb6','Y',50,2,2) +; + +-- Jun 9, 2015 6:19:39 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (203811,'Available for Reservation',200190,212194,'Y',1,70,'N','N','N','N',0,0,'Y',TO_DATE('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','8cc97c74-2853-4c19-8f98-f139981c70e5','Y',60,2,2) +; + +-- Jun 9, 2015 6:19:40 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (203812,'Available for Shipping',200190,212195,'Y',1,80,'N','N','N','N',0,0,'Y',TO_DATE('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','58d68f4a-6cf1-42a7-a75e-2378822161dd','Y',70,2,2) +; + +-- Jun 9, 2015 6:19:40 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (203813,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200190,212187,'Y',1,90,'N','N','N','N',0,0,'Y',TO_DATE('2015-06-09 18:19:40','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:19:40','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','b9734ff4-cda2-4acc-8d88-1adae757273c','Y',80,2,2) +; + +-- Jun 9, 2015 6:20:10 PM COT +UPDATE AD_Field SET SeqNo=60, ColumnSpan=1,Updated=TO_DATE('2015-06-09 18:20:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203810 +; + +-- Jun 9, 2015 6:20:10 PM COT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70, XPosition=3, ColumnSpan=1,Updated=TO_DATE('2015-06-09 18:20:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203811 +; + +-- Jun 9, 2015 6:20:10 PM COT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=80, XPosition=4, ColumnSpan=1,Updated=TO_DATE('2015-06-09 18:20:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203812 +; + +-- Jun 9, 2015 6:20:10 PM COT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, XPosition=6, ColumnSpan=1,Updated=TO_DATE('2015-06-09 18:20:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203813 +; + +-- Jun 9, 2015 6:20:10 PM COT +UPDATE AD_Field SET SeqNo=0,Updated=TO_DATE('2015-06-09 18:20:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203808 +; + +-- Jun 9, 2015 6:20:10 PM COT +UPDATE AD_Field SET SeqNo=0,Updated=TO_DATE('2015-06-09 18:20:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203809 +; + +-- Jun 9, 2015 6:21:29 PM COT +INSERT INTO AD_Menu (AD_Menu_ID,Name,Action,AD_Window_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSummary,IsSOTrx,IsReadOnly,EntityType,IsCentrallyMaintained,AD_Menu_UU) VALUES (200111,'Locator Type','W',200074,0,0,'Y',TO_DATE('2015-06-09 18:21:29','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:21:29','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','N','D','Y','a2f0d1bd-3fe0-4f59-af8c-2dafa0247e5a') +; + +-- Jun 9, 2015 6:21:29 PM COT +INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNodeMM_UU) SELECT t.AD_Client_ID, 0, 'Y', SysDate, 100, SysDate, 100,t.AD_Tree_ID, 200111, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='MM' AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200111) +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=0, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=218 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=1, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=153 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=2, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=263 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=3, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=166 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=4, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=203 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=5, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53242 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=6, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=236 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=7, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=183 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=8, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=160 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=9, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=278 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=10, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=345 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=11, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53296 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=12, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53014 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=13, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53108 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=0, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=167 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=1, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=357 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=2, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=229 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=3, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=412 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=4, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=256 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=5, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=197 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=6, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=477 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=7, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=181 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=8, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=484 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=9, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=179 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=10, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=503 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=11, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200064 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=12, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200111 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=13, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=196 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=14, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=479 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=15, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=482 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=16, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=481 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=17, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=411 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=18, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53253 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=19, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=426 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=20, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=537 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=21, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=311 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=22, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=292 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=23, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=504 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=24, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=515 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=0, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=167 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=1, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=357 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=2, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=229 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=3, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=412 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=4, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=256 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=5, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=197 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=6, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=477 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=7, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=181 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=8, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=484 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=9, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=179 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=10, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=503 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=11, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200064 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=12, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=196 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=13, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=479 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=14, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=482 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=15, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=481 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=16, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=411 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=17, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53253 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=18, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=426 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=19, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=537 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=20, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=311 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=21, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=292 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=22, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=504 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=23, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=515 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=0, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=268 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=1, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=125 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=2, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=422 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=3, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=107 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=4, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=130 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=5, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=188 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=6, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=227 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=7, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=381 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=8, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=126 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=9, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200111 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=10, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=421 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=11, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=534 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=12, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200044 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=13, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=267 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=14, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=490 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=15, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=132 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=16, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=310 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=17, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200032 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=18, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200033 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=19, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200029 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=20, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=128 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=21, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=585 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=22, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=187 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=23, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53210 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=24, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53211 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=0, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=268 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=1, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200111 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=2, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=125 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=3, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=422 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=4, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=107 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=5, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=130 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=6, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=188 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=7, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=227 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=8, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=381 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=9, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=126 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=10, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=421 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=11, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=534 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=12, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200044 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=13, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=267 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=14, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=490 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=15, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=132 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=16, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=310 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=17, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200032 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=18, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200033 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=19, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200029 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=20, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=128 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=21, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=585 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=22, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=187 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=23, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53210 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=24, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53211 +; + +-- Jun 9, 2015 6:27:22 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType) VALUES (212196,0,'Locator Type',207,'M_LocatorType_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_DATE('2015-06-09 18:27:21','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:27:21','YYYY-MM-DD HH24:MI:SS'),100,202889,'Y','N','D','N','N','N','Y','78a5bc43-39d9-46d3-b30e-f9ae3bf9f4ec','Y',0,'N','N','N') +; + +-- Jun 9, 2015 6:27:27 PM COT +UPDATE AD_Column SET FKConstraintName='MLocatorType_MLocator', FKConstraintType='N',Updated=TO_DATE('2015-06-09 18:27:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212196 +; + +-- Jun 9, 2015 6:27:27 PM COT +ALTER TABLE M_Locator ADD M_LocatorType_ID NUMBER(10) DEFAULT NULL +; + +-- Jun 9, 2015 6:27:27 PM COT +ALTER TABLE M_Locator ADD CONSTRAINT MLocatorType_MLocator FOREIGN KEY (M_LocatorType_ID) REFERENCES m_locatortype(m_locatortype_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Jun 9, 2015 6:28:07 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (203814,'Locator Type',178,212196,'Y',22,120,'N','N','N','N',0,0,'Y',TO_DATE('2015-06-09 18:28:07','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-09 18:28:07','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6d4732fc-d162-4eea-ad45-6118537250bc','Y',120,2) +; + +-- Jun 9, 2015 6:29:03 PM COT +UPDATE AD_Field SET SeqNo=10,Updated=TO_DATE('2015-06-09 18:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1000 +; + +-- Jun 9, 2015 6:29:03 PM COT +UPDATE AD_Field SET SeqNo=20,Updated=TO_DATE('2015-06-09 18:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2044 +; + +-- Jun 9, 2015 6:29:03 PM COT +UPDATE AD_Field SET SeqNo=30,Updated=TO_DATE('2015-06-09 18:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1003 +; + +-- Jun 9, 2015 6:29:03 PM COT +UPDATE AD_Field SET SeqNo=40,Updated=TO_DATE('2015-06-09 18:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2095 +; + +-- Jun 9, 2015 6:29:03 PM COT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=50, XPosition=1,Updated=TO_DATE('2015-06-09 18:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203814 +; + +-- Jun 9, 2015 6:29:03 PM COT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=60, XPosition=5, ColumnSpan=2,Updated=TO_DATE('2015-06-09 18:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1001 +; + +-- Jun 9, 2015 6:29:03 PM COT +UPDATE AD_Field SET SeqNo=0,Updated=TO_DATE('2015-06-09 18:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=999 +; + +CREATE OR REPLACE FUNCTION BOMQTYONHAND +( + Product_ID IN NUMBER, + Warehouse_ID IN NUMBER, + Locator_ID IN NUMBER -- Only used, if warehouse is null +) +RETURN NUMBER +/****************************************************************************** + * ** Compiere Product ** Copyright (c) 1999-2001 Accorto, Inc. USA + * Open Source Software Provided "AS IS" without warranty or liability + * When you use any parts (changed or unchanged), add "Powered by Compiere" to + * your product name; See license details http://www.compiere.org/license.html + ****************************************************************************** + * Return quantity on hand for BOM + */ +AS + myWarehouse_ID NUMBER; + Quantity NUMBER := 99999; -- unlimited + IsBOM CHAR(1); + IsStocked CHAR(1); + ProductType CHAR(1); + ProductQty NUMBER; + StdPrecision NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y'; + -- +BEGIN + -- Check Parameters + myWarehouse_ID := Warehouse_ID; + IF (myWarehouse_ID IS NULL) THEN + IF (Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT SUM(M_Warehouse_ID) INTO myWarehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=Locator_ID; + END IF; + END IF; + IF (myWarehouse_ID IS NULL) THEN + RETURN 0; + END IF; +-- DBMS_OUTPUT.PUT_LINE('Warehouse=' || myWarehouse_ID); + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO IsBOM, ProductType, IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + -- Unlimited capacity if no item + IF (IsBOM='N' AND (ProductType<>'I' OR IsStocked='N')) THEN + RETURN Quantity; + -- Stocked item + ELSIF (IsStocked='Y') THEN + -- Get ProductQty + SELECT NVL(SUM(QtyOnHand), 0) + INTO ProductQty + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + WHERE s.M_Product_ID=Product_ID AND l.M_Warehouse_ID=myWarehouse_ID; + -- + -- DBMS_OUTPUT.PUT_LINE('Qty=' || ProductQty); + RETURN ProductQty; + END IF; + + -- Go through BOM +-- DBMS_OUTPUT.PUT_LINE('BOM'); + FOR bom IN CUR_BOM LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get ProductQty + SELECT NVL(SUM(QtyOnHand), 0) + INTO ProductQty + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + WHERE s.M_Product_ID=bom.M_ProductBOM_ID AND l.M_Warehouse_ID=myWarehouse_ID; + -- Get Rounding Precision + SELECT NVL(MAX(u.StdPrecision), 0) + INTO StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + ProductQty := ROUND (ProductQty/bom.BOMQty, StdPrecision); + -- How much can we make overall + IF (ProductQty < Quantity) THEN + Quantity := ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + ProductQty := Bomqtyonhand (bom.M_ProductBOM_ID, myWarehouse_ID, Locator_ID); + -- How much can we make overall + IF (ProductQty < Quantity) THEN + Quantity := ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + IF (Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT NVL(MAX(u.StdPrecision), 0) + INTO StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=Product_ID; + -- + RETURN ROUND (Quantity, StdPrecision); + END IF; + RETURN 0; +END Bomqtyonhand; +/ + +CREATE OR REPLACE FUNCTION BOMQTYONHANDFORRESERVATION +( + Product_ID IN NUMBER, + Warehouse_ID IN NUMBER, + Locator_ID IN NUMBER -- Only used, if warehouse is null +) +RETURN NUMBER +/****************************************************************************** + * ** Compiere Product ** Copyright (c) 1999-2001 Accorto, Inc. USA + * Open Source Software Provided "AS IS" without warranty or liability + * When you use any parts (changed or unchanged), add "Powered by Compiere" to + * your product name; See license details http://www.compiere.org/license.html + ****************************************************************************** + * Return quantity on hand for BOM + */ +AS + myWarehouse_ID NUMBER; + Quantity NUMBER := 99999; -- unlimited + IsBOM CHAR(1); + IsStocked CHAR(1); + ProductType CHAR(1); + ProductQty NUMBER; + StdPrecision NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y'; + -- +BEGIN + -- Check Parameters + myWarehouse_ID := Warehouse_ID; + IF (myWarehouse_ID IS NULL) THEN + IF (Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT SUM(M_Warehouse_ID) INTO myWarehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=Locator_ID; + END IF; + END IF; + IF (myWarehouse_ID IS NULL) THEN + RETURN 0; + END IF; +-- DBMS_OUTPUT.PUT_LINE('Warehouse=' || myWarehouse_ID); + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO IsBOM, ProductType, IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + -- Unlimited capacity if no item + IF (IsBOM='N' AND (ProductType<>'I' OR IsStocked='N')) THEN + RETURN Quantity; + -- Stocked item + ELSIF (IsStocked='Y') THEN + -- Get ProductQty + SELECT NVL(SUM(QtyOnHand), 0) + INTO ProductQty + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + LEFT JOIN M_LocatorType lt ON (l.M_LocatorType_ID=lt.M_LocatorType_ID) + WHERE s.M_Product_ID=Product_ID AND l.M_Warehouse_ID=myWarehouse_ID + AND COALESCE(lt.IsAvailableForReservation,'Y')='Y'; + -- + -- DBMS_OUTPUT.PUT_LINE('Qty=' || ProductQty); + RETURN ProductQty; + END IF; + + -- Go through BOM +-- DBMS_OUTPUT.PUT_LINE('BOM'); + FOR bom IN CUR_BOM LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get ProductQty + SELECT NVL(SUM(QtyOnHand), 0) + INTO ProductQty + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + LEFT JOIN M_LocatorType lt ON (l.M_LocatorType_ID=lt.M_LocatorType_ID) + WHERE s.M_Product_ID=bom.M_ProductBOM_ID AND l.M_Warehouse_ID=myWarehouse_ID + AND COALESCE(lt.IsAvailableForReservation,'Y')='Y'; + -- Get Rounding Precision + SELECT NVL(MAX(u.StdPrecision), 0) + INTO StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + ProductQty := ROUND (ProductQty/bom.BOMQty, StdPrecision); + -- How much can we make overall + IF (ProductQty < Quantity) THEN + Quantity := ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + ProductQty := BomqtyonhandForReservation (bom.M_ProductBOM_ID, myWarehouse_ID, Locator_ID); + -- How much can we make overall + IF (ProductQty < Quantity) THEN + Quantity := ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + IF (Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT NVL(MAX(u.StdPrecision), 0) + INTO StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=Product_ID; + -- + RETURN ROUND (Quantity, StdPrecision); + END IF; + RETURN 0; +END BOMQTYONHANDFORRESERVATION; +/ + +CREATE OR REPLACE FUNCTION BOMQTYAVAILABLE +( + Product_ID IN NUMBER, + Warehouse_ID IN NUMBER, + Locator_ID IN NUMBER -- Only used, if warehouse is null +) +RETURN NUMBER +/****************************************************************************** + * ** Compiere Product ** Copyright (c) 1999-2001 Accorto, Inc. USA + * Open Source Software Provided "AS IS" without warranty or liability + * When you use any parts (changed or unchanged), add "Powered by Compiere" to + * your product name; See license details http://www.compiere.org/license.html + ****************************************************************************** + * Return quantity available for BOM + */ +AS +BEGIN + RETURN bomQtyOnHandForReservation(Product_ID, Warehouse_ID, Locator_ID) + - bomQtyReserved(Product_ID, Warehouse_ID, Locator_ID); +END bomQtyAvailable; +/ + +--create views +CREATE OR REPLACE VIEW M_PRODUCT_STOCK_V +AS +SELECT +ms.IsActive, ms.Created, ms.CreatedBy, ms.Updated, ms.UpdatedBy, +mp.VALUE, mp.help, +(CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN ms.qtyonhand ELSE 0 END - ms.qtyreserved) AS qtyavailable, +ms.qtyonhand, +ms.qtyreserved, mp.description, mw.NAME AS warehouse, mw.m_warehouse_id, mw.ad_client_id, +mw.ad_org_id, mp.documentnote, mp.m_product_id +FROM M_STORAGE ms +JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id +JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id +LEFT JOIN M_LOCATORTYPE lt ON ml.m_locatortype_id = lt.m_locatortype_id +JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id +ORDER BY mw.NAME; + +CREATE OR REPLACE VIEW M_PRODUCT_SUBSTITUTERELATED_V AS +SELECT s.ad_client_id, + s.ad_org_id, + s.isactive, + s.created, + s.createdby, + s.updated, + s.updatedby, + s.m_product_id, + s.substitute_id, + 'S' AS rowtype, + mp.name, + sum(CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN ms.qtyonhand ELSE 0 END - ms.qtyreserved) AS qtyavailable, + sum(ms.qtyonhand) AS qtyonhand, + sum(ms.qtyreserved) AS qtyreserved, + currencyRound(MAX(mpr.pricestd),mpl.C_Currency_ID,'N') AS pricestd, + mpr.m_pricelist_version_id, + mw.m_warehouse_id, + org.name AS orgname + FROM m_substitute s + JOIN m_storage ms ON ms.m_product_id = s.substitute_id + JOIN m_product mp ON ms.m_product_id = mp.m_product_id + JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id + LEFT JOIN M_LOCATORTYPE lt ON ml.m_locatortype_id = lt.m_locatortype_id + JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id + JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id + JOIN m_pricelist_version mplv ON mplv.m_pricelist_version_id = mpr.m_pricelist_version_id + JOIN m_pricelist mpl ON mplv.m_pricelist_id = mpl.m_pricelist_id + JOIN ad_org org ON org.ad_org_id = mw.ad_org_id + GROUP BY s.ad_client_id, + s.ad_org_id, + s.isactive, + s.created, + s.createdby, + s.updated, + s.updatedby, + s.m_product_id, + s.substitute_id, + mw.m_warehouse_id, + mpr.m_pricelist_version_id, + org.name, + mp.name, + mpl.C_Currency_ID + UNION + SELECT r.ad_client_id, + r.ad_org_id, + r.isactive, + r.created, + r.createdby, + r.updated, + r.updatedby, + r.m_product_id, + r.relatedproduct_id AS substitute_id, + 'R' AS rowtype, + mp.name, + sum(CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN ms.qtyonhand ELSE 0 END - ms.qtyreserved) AS qtyavailable, + sum(ms.qtyonhand) AS qtyonhand, + sum(ms.qtyreserved) AS qtyreserved, + currencyRound(MAX(mpr.pricestd),mpl.C_Currency_ID,'N') AS pricestd, + mpr.m_pricelist_version_id, + mw.m_warehouse_id, + org.name AS orgname + FROM m_relatedproduct r + JOIN m_storage ms ON ms.m_product_id = r.relatedproduct_id + JOIN m_product mp ON ms.m_product_id = mp.m_product_id + JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id + LEFT JOIN M_LOCATORTYPE lt ON ml.m_locatortype_id = lt.m_locatortype_id + JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id + JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id + JOIN m_pricelist_version mplv ON mplv.m_pricelist_version_id = mpr.m_pricelist_version_id + JOIN m_pricelist mpl ON mplv.m_pricelist_id = mpl.m_pricelist_id + JOIN ad_org org ON org.ad_org_id = mw.ad_org_id + GROUP BY r.ad_client_id, + r.ad_org_id, + r.isactive, + r.created, + r.createdby, + r.updated, + r.updatedby, + r.m_product_id, + r.relatedproduct_id, + mw.m_warehouse_id, + mpr.m_pricelist_version_id, + org.name, + mp.name, + mpl.C_Currency_ID; + +CREATE OR REPLACE VIEW rv_storage +AS + SELECT s.ad_client_id, + s.ad_org_id, + s.m_product_id, + p.value, + p.name, + p.description, + p.upc, + p.sku, + p.c_uom_id, + p.m_product_category_id, + p.classification, + p.weight, + p.volume, + p.versionno, + p.guaranteedays, + p.guaranteedaysmin, + s.m_locator_id, + l.m_warehouse_id, + l.x, + l.y, + l.z, + s.qtyonhand, + s.qtyreserved, + CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN s.qtyonhand ELSE 0 END - s.qtyreserved AS qtyavailable, + s.qtyordered, + s.datelastinventory, + s.m_attributesetinstance_id, + asi.m_attributeset_id, + asi.serno, + asi.lot, + asi.m_lot_id, + asi.guaranteedate, + daysbetween(asi.guaranteedate, getdate()) AS shelflifedays, + daysbetween(asi.guaranteedate, getdate()) - p.guaranteedaysmin AS goodfordays, + CASE + WHEN COALESCE(p.guaranteedays, 0) > 0 THEN round(daysbetween(asi.guaranteedate, getdate()) / p.guaranteedays * 100, 0) + ELSE NULL + END AS shelfliferemainingpct, + s.isactive AS m_storage_isactive, + s.updated AS m_storage_updated, + s.updatedby AS m_storage_updatedby, + l.ad_org_id AS m_locator_ad_org_id, + l.isactive AS m_locator_isactive, + l.isdefault, + l.priorityno, + l.value AS m_locator_value, + p.ad_org_id AS m_product_ad_org_id, + p.copyfrom AS m_product_copyfrom, + p.created AS m_product_created, + p.createdby AS m_product_createdby, + p.c_revenuerecognition_id, + p.c_subscriptiontype_id, + p.c_taxcategory_id, + p.descriptionurl, + p.discontinued AS m_product_discontinued, + p.discontinuedat AS m_product_discontinuedat, + p.documentnote, + p.group1, + p.group2, + p.help, + p.imageurl, + p.isactive AS m_product_isactive, + p.isbom, + p.isdropship, + p.isexcludeautodelivery, + p.isinvoiceprintdetails, + p.ispicklistprintdetails, + p.ispurchased, + p.isselfservice, + p.issold, + p.isstocked, + p.issummary AS m_product_issummary, + p.isverified, + p.iswebstorefeatured, + p.lowlevel, + p.m_attributeset_id AS m_product_m_attributeset_id, + p.m_attributesetinstance_id AS m_product_m_asi_id, + p.m_freightcategory_id, + p.m_locator_id AS m_product_m_locator_id, + p.processing AS m_product_processing, + p.producttype, + p.r_mailtext_id, + p.salesrep_id AS m_product_salesrep_id, + p.s_expensetype_id, + p.shelfdepth, + p.shelfheight, + p.shelfwidth, + p.s_resource_id, + p.unitsperpack, + p.unitsperpallet, + p.updated AS m_product_updated, + p.updatedby AS m_product_updatedby, + asi.ad_org_id AS m_asi_ad_org_id, + asi.created AS m_asi_created, + asi.createdby AS m_asi_createdby, + asi.description AS m_asi_description, + asi.isactive AS m_asi_isactive, + asi.updated AS m_asi_updated, + asi.updatedby AS m_asi_updatedby + FROM m_storage s + JOIN m_locator l + ON s.m_locator_id = l.m_locator_id + LEFT JOIN m_locatortype lt + ON l.m_locatortype_id = lt.m_locatortype_id + JOIN m_product p + ON s.m_product_id = p.m_product_id + LEFT JOIN m_attributesetinstance asi + ON s.m_attributesetinstance_id = asi.m_attributesetinstance_id +; + +-- Jun 12, 2015 11:07:40 PM COT +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Locator not available for shipping',0,0,'Y',TO_DATE('2015-06-12 23:07:40','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-12 23:07:40','YYYY-MM-DD HH24:MI:SS'),100,200353,'LocatorNotAvailableForShipping','D','213a2d7d-449a-48e0-8aa4-596207ee2c73') +; + +SELECT register_migration_script('201506091830_IDEMPIERE-2668.sql') FROM dual +; + diff --git a/migration/i2.1z/postgresql/201506091830_IDEMPIERE-2668.sql b/migration/i2.1z/postgresql/201506091830_IDEMPIERE-2668.sql new file mode 100644 index 0000000000..71f11ecdb2 --- /dev/null +++ b/migration/i2.1z/postgresql/201506091830_IDEMPIERE-2668.sql @@ -0,0 +1,1179 @@ +-- IDEMPIERE-2668 Exclude Locators for Demand Operations +-- Jun 9, 2015 6:03:39 PM COT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202886,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:03:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:03:38','YYYY-MM-DD HH24:MI:SS'),100,'IsAvailableForReplenishment','Available for Replenishment','Available for Replenishment','D','5e2d1eaa-3fde-4240-b83a-035ccab27483') +; + +-- Jun 9, 2015 6:03:58 PM COT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202887,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:03:58','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:03:58','YYYY-MM-DD HH24:MI:SS'),100,'IsAvailableForReservation','Available for Reservation','Available for Reservation','D','4ddf3b6f-825d-4c90-9f92-71a3e11f2e2a') +; + +-- Jun 9, 2015 6:04:23 PM COT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202888,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:04:23','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:04:23','YYYY-MM-DD HH24:MI:SS'),100,'IsAvailableForShipping','Available for Shipping','Available for Shipping','D','75f9e774-476c-4f32-9c84-54f21f4717bf') +; + +-- Jun 9, 2015 6:08:51 PM COT +INSERT INTO AD_Window (AD_Window_ID,Name,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,WindowType,Processing,EntityType,IsSOTrx,IsDefault,WinHeight,WinWidth,IsBetaFunctionality,AD_Window_UU) VALUES (200074,'Locator Type',0,0,'Y',TO_TIMESTAMP('2015-06-09 18:08:50','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:08:50','YYYY-MM-DD HH24:MI:SS'),100,'M','N','D','Y','N',0,0,'N','cf08fb56-c497-48b2-b901-dc331f88a4d4') +; + +-- Jun 9, 2015 6:08:59 PM COT +INSERT INTO AD_Table (AD_Table_ID,Name,AD_Window_ID,TableName,LoadSeq,AccessLevel,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSecurityEnabled,IsDeleteable,IsHighVolume,IsView,EntityType,ImportTable,IsChangeLog,ReplicationType,CopyColumnsFromTable,IsCentrallyMaintained,AD_Table_UU,Processing,DatabaseViewDrop) VALUES (200175,'Locator Type',200074,'M_LocatorType',0,'3',0,0,'Y',TO_TIMESTAMP('2015-06-09 18:08:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:08:59','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','N','N','D','N','Y','L','N','Y','f2b7e21d-ca0f-4575-a598-5bae28df6b24','N','N') +; + +-- Jun 9, 2015 6:08:59 PM COT +INSERT INTO AD_Sequence (Name,CurrentNext,IsAudited,StartNewYear,Description,IsActive,IsTableID,AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,AD_Sequence_ID,IsAutoSequence,StartNo,IncrementNo,CurrentNextSys,AD_Sequence_UU) VALUES ('M_LocatorType',1000000,'N','N','Table M_LocatorType','Y','Y',0,0,TO_TIMESTAMP('2015-06-09 18:08:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:08:59','YYYY-MM-DD HH24:MI:SS'),100,200231,'Y',1000000,1,200000,'401b3cae-5730-4c62-b306-2f18e3d8d142') +; + +-- Jun 9, 2015 6:09:13 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212181,1,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200175,129,'AD_Client_ID','@#AD_Client_ID@',22,'N','N','Y','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:09:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:09:13','YYYY-MM-DD HH24:MI:SS'),100,102,'N','N','D','Y','N','N','Y','f364ce24-be93-4de6-8686-111905fd6980','N','N','N') +; + +-- Jun 9, 2015 6:09:13 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212182,1,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200175,104,'AD_Org_ID','@#AD_Org_ID@',22,'N','N','Y','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:09:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:09:13','YYYY-MM-DD HH24:MI:SS'),100,113,'N','N','D','Y','N','N','Y','ae0f9c76-2825-4cd9-bcd9-24fe6eb43253','N','N','N') +; + +-- Jun 9, 2015 6:09:14 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212183,1,'Created','Date this record was created','The Created field indicates the date that this record was created.',200175,'Created','SYSDATE',7,'N','N','Y','N','N',0,'N',16,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:09:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:09:13','YYYY-MM-DD HH24:MI:SS'),100,245,'N','N','D','Y','N','N','Y','37c6dedf-df2b-4b75-8ecf-a4a6f5c0c376','N','N','N') +; + +-- Jun 9, 2015 6:09:14 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212184,1,'Created By','User who created this records','The Created By field indicates the user who created this record.',200175,'CreatedBy',22,'N','N','Y','N','N',0,'N',18,110,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,246,'N','N','D','Y','N','N','Y','4b1edc4a-f105-4753-8566-4a415ea12c77','N','N','N') +; + +-- Jun 9, 2015 6:09:14 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212185,1,'Description','Optional short description of the record','A description is limited to 255 characters.',200175,'Description',255,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,275,'Y','Y','D','Y','N','N','Y','c5c54fc4-f29a-495b-b70b-0319e6e18656','Y','N','N') +; + +-- Jun 9, 2015 6:09:14 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212186,1,'Comment/Help','Comment or Hint','The Help field contains a hint, comment or help about the use of this item.',200175,'Help',2000,'N','N','N','N','N',0,'N',14,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,326,'Y','N','D','Y','N','N','Y','7352dea2-66c4-4e2e-98aa-741d102bcb34','Y','N','N') +; + +-- Jun 9, 2015 6:09:15 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212187,1,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200175,'IsActive','Y',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:09:14','YYYY-MM-DD HH24:MI:SS'),100,348,'Y','N','D','Y','N','N','Y','1bf86a87-aa8d-4287-bb41-1e82376d8242','N','N','N') +; + +-- Jun 9, 2015 6:09:15 PM COT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202889,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,'M_LocatorType_ID','Locator Type','Locator Type','D','40daae66-c2e4-4700-9ea6-7ba10237fff8') +; + +-- Jun 9, 2015 6:09:15 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212188,1,'Locator Type',200175,'M_LocatorType_ID',22,'Y','N','Y','N','N',0,'N',13,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,202889,'N','N','D','Y','N','N','Y','f4d83bfd-cc5d-4c03-b479-ad01fa1f7684','N','N','N') +; + +-- Jun 9, 2015 6:09:15 PM COT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202890,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,'M_LocatorType_UU','M_LocatorType_UU','M_LocatorType_UU','D','9b6c9339-fc09-46c5-884f-b048019eeb39') +; + +-- Jun 9, 2015 6:09:15 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212189,1.00,'M_LocatorType_UU',200175,'M_LocatorType_UU',36,'N','N','N','N','N','N',10,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,202890,'Y','N','D','N','N','N','Y','0963606e-219d-49d2-aba1-22605cd5f302','N','N','N') +; + +-- Jun 9, 2015 6:09:16 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212190,1,'Name','Alphanumeric identifier of the entity','The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.',200175,'Name',60,'N','N','Y','N','Y',1,'N',10,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:09:15','YYYY-MM-DD HH24:MI:SS'),100,469,'Y','Y','D','Y','N','N','Y','73f48c32-177a-41bf-b049-f347290c5334','Y','N','N') +; + +-- Jun 9, 2015 6:09:16 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212191,1,'Updated','Date this record was updated','The Updated field indicates the date that this record was updated.',200175,'Updated','SYSDATE',7,'N','N','Y','N','N',0,'N',16,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:09:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:09:16','YYYY-MM-DD HH24:MI:SS'),100,607,'N','N','D','Y','N','N','Y','a35a068c-6556-4b2b-b7e9-93b2c8ab5dbf','N','N','N') +; + +-- Jun 9, 2015 6:09:16 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212192,1,'Updated By','User who updated this records','The Updated By field indicates the user who updated this record.',200175,'UpdatedBy',22,'N','N','Y','N','N',0,'N',18,110,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:09:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:09:16','YYYY-MM-DD HH24:MI:SS'),100,608,'N','N','D','Y','N','N','Y','6905723a-de6b-40bf-8595-948cfe1c8029','N','N','N') +; + +-- Jun 9, 2015 6:09:16 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212193,1,'Search Key','Search key for the record in the format required - must be unique','A search key allows you a fast method of finding a particular record. +If you leave the search key empty, the system automatically creates a numeric number. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).',200175,'Value',40,'N','N','Y','N','N',0,'N',10,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:09:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:09:16','YYYY-MM-DD HH24:MI:SS'),100,620,'Y','Y','D','Y','N','N','Y','5f703bd8-6824-453f-a419-978a39c47320','Y','N','N') +; + +-- Jun 9, 2015 6:10:56 PM COT +UPDATE AD_Column SET Name='Available for Replenishment', Description=NULL, Help=NULL, ColumnName='IsAvailableForReplenishment', DefaultValue='Y', FieldLength=1, AD_Reference_ID=20, AD_Element_ID=202886, IsSelectionColumn='N', FKConstraintType=NULL,Updated=TO_TIMESTAMP('2015-06-09 18:10:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212193 +; + +-- Jun 9, 2015 6:11:18 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure) VALUES (212194,1,'Available for Reservation',200175,'IsAvailableForReservation','Y',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:11:17','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:11:17','YYYY-MM-DD HH24:MI:SS'),100,202887,'Y','N','D','Y','N','N','Y','6de34019-bfeb-4272-974e-52906d4d29eb','Y','N','N') +; + +-- Jun 9, 2015 6:12:01 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,IsToolbarButton,IsSecure,FKConstraintType) VALUES (212195,1,'Available for Shipping',200175,'IsAvailableForShipping','Y',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:12:01','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:12:01','YYYY-MM-DD HH24:MI:SS'),100,202888,'Y','N','D','Y','N','N','Y','e7fba8f8-f3fb-488f-a6b7-93a89a28e0a3','Y','N','N','N') +; + +-- Jun 9, 2015 6:15:44 PM COT +UPDATE AD_Column SET FKConstraintName='ADClient_MLocatorType', FKConstraintType='N',Updated=TO_TIMESTAMP('2015-06-09 18:15:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212181 +; + +-- Jun 9, 2015 6:15:44 PM COT +UPDATE AD_Column SET FKConstraintName='ADOrg_MLocatorType', FKConstraintType='N',Updated=TO_TIMESTAMP('2015-06-09 18:15:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212182 +; + +-- Jun 9, 2015 6:15:44 PM COT +UPDATE AD_Column SET FKConstraintName='CreatedBy_MLocatorType', FKConstraintType='N',Updated=TO_TIMESTAMP('2015-06-09 18:15:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212184 +; + +-- Jun 9, 2015 6:15:44 PM COT +UPDATE AD_Column SET FKConstraintName='UpdatedBy_MLocatorType', FKConstraintType='N',Updated=TO_TIMESTAMP('2015-06-09 18:15:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212192 +; + +-- Jun 9, 2015 6:15:44 PM COT +CREATE TABLE M_LocatorType (AD_Client_ID NUMERIC(10) NOT NULL, AD_Org_ID NUMERIC(10) NOT NULL, Created TIMESTAMP DEFAULT statement_timestamp() NOT NULL, CreatedBy NUMERIC(10) NOT NULL, Description VARCHAR(255) DEFAULT NULL , Help VARCHAR(2000) DEFAULT NULL , IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL, IsAvailableForReplenishment CHAR(1) DEFAULT 'Y' CHECK (IsAvailableForReplenishment IN ('Y','N')) NOT NULL, IsAvailableForReservation CHAR(1) DEFAULT 'Y' CHECK (IsAvailableForReservation IN ('Y','N')) NOT NULL, IsAvailableForShipping CHAR(1) DEFAULT 'Y' CHECK (IsAvailableForShipping IN ('Y','N')) NOT NULL, M_LocatorType_ID NUMERIC(10) NOT NULL, M_LocatorType_UU VARCHAR(36) DEFAULT NULL , Name VARCHAR(60) NOT NULL, Updated TIMESTAMP DEFAULT statement_timestamp() NOT NULL, UpdatedBy NUMERIC(10) NOT NULL, CONSTRAINT M_LocatorType_Key PRIMARY KEY (M_LocatorType_ID), CONSTRAINT M_LocatorType_UU_idx UNIQUE (M_LocatorType_UU)) +; + +-- Jun 9, 2015 6:15:44 PM COT +ALTER TABLE M_LocatorType ADD CONSTRAINT ADClient_MLocatorType FOREIGN KEY (AD_Client_ID) REFERENCES ad_client(ad_client_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Jun 9, 2015 6:15:44 PM COT +ALTER TABLE M_LocatorType ADD CONSTRAINT ADOrg_MLocatorType FOREIGN KEY (AD_Org_ID) REFERENCES ad_org(ad_org_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Jun 9, 2015 6:15:44 PM COT +ALTER TABLE M_LocatorType ADD CONSTRAINT CreatedBy_MLocatorType FOREIGN KEY (CreatedBy) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Jun 9, 2015 6:15:44 PM COT +ALTER TABLE M_LocatorType ADD CONSTRAINT UpdatedBy_MLocatorType FOREIGN KEY (UpdatedBy) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Jun 9, 2015 6:16:17 PM COT +INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing) VALUES (0,0,201037,'ba61df8c-e022-49fb-8f1a-bc6c6c23f2eb',TO_TIMESTAMP('2015-06-09 18:16:17','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','m_locatortype_uu_idx',TO_TIMESTAMP('2015-06-09 18:16:17','YYYY-MM-DD HH24:MI:SS'),100,200175,'N','Y','N') +; + +-- Jun 9, 2015 6:16:17 PM COT +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201269,'f1a91678-6ecf-49a3-b5d6-919df929f9c4',TO_TIMESTAMP('2015-06-09 18:16:17','YYYY-MM-DD HH24:MI:SS'),100,'Y',TO_TIMESTAMP('2015-06-09 18:16:17','YYYY-MM-DD HH24:MI:SS'),100,212189,201037,1) +; + +-- Jun 9, 2015 6:19:29 PM COT +INSERT INTO AD_Tab (AD_Tab_ID,Name,AD_Window_ID,SeqNo,IsSingleRow,AD_Table_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,HasTree,IsInfoTab,IsTranslationTab,IsReadOnly,OrderByClause,Processing,ImportFields,TabLevel,IsSortTab,EntityType,IsInsertRecord,IsAdvancedTab,AD_Tab_UU,TreeDisplayedOn) VALUES (200190,'Locator Type',200074,10,'Y',200175,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:19:20','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:19:20','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','N','M_LocatorType.Name','N','N',0,'N','D','Y','N','388b0f0c-ece2-4809-96d6-4d486d3e7b5d','B') +; + +-- Jun 9, 2015 6:19:38 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,ColumnSpan) VALUES (203803,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200190,212181,'Y',22,10,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','b4a6281e-d02c-4385-b011-50a80efbe606','N',2) +; + +-- Jun 9, 2015 6:19:38 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsAllowCopy,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (203804,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200190,212182,'Y',22,20,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','73843af6-0103-442d-88dc-be6860f7d8f5','Y','Y',10,4,2) +; + +-- Jun 9, 2015 6:19:38 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (203805,'Name','Alphanumeric identifier of the entity','The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.',200190,212190,'Y',60,30,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','d929ad16-8f1a-42ff-a657-83d3f26ebc54','Y',20,5) +; + +-- Jun 9, 2015 6:19:38 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (203806,'Description','Optional short description of the record','A description is limited to 255 characters.',200190,212185,'Y',255,40,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','cc891cd5-29f8-4887-89d6-ea4185a3c6c6','Y',30,5) +; + +-- Jun 9, 2015 6:19:39 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan,NumLines) VALUES (203807,'Comment/Help','Comment or Hint','The Help field contains a hint, comment or help about the use of this item.',200190,212186,'Y',2000,50,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:19:38','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','29d71ef0-7af4-40cc-a873-89452a6431e2','Y',40,5,3) +; + +-- Jun 9, 2015 6:19:39 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,ColumnSpan) VALUES (203808,'Locator Type',200190,212188,'N',22,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','c51aade9-02bb-4126-9d35-5cdc82e903cf','N',2) +; + +-- Jun 9, 2015 6:19:39 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,ColumnSpan) VALUES (203809,'M_LocatorType_UU',200190,212189,'N',36,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','edf9670f-8fb1-45b7-97f8-06dcb0e7d305','N',2) +; + +-- Jun 9, 2015 6:19:39 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (203810,'Available for Replenishment',200190,212193,'Y',1,60,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','5cf26906-5c25-4fc1-b38a-8369366d8eb6','Y',50,2,2) +; + +-- Jun 9, 2015 6:19:39 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (203811,'Available for Reservation',200190,212194,'Y',1,70,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','8cc97c74-2853-4c19-8f98-f139981c70e5','Y',60,2,2) +; + +-- Jun 9, 2015 6:19:40 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (203812,'Available for Shipping',200190,212195,'Y',1,80,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:19:39','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','58d68f4a-6cf1-42a7-a75e-2378822161dd','Y',70,2,2) +; + +-- Jun 9, 2015 6:19:40 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (203813,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200190,212187,'Y',1,90,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-06-09 18:19:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:19:40','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','b9734ff4-cda2-4acc-8d88-1adae757273c','Y',80,2,2) +; + +-- Jun 9, 2015 6:20:10 PM COT +UPDATE AD_Field SET SeqNo=60, ColumnSpan=1,Updated=TO_TIMESTAMP('2015-06-09 18:20:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203810 +; + +-- Jun 9, 2015 6:20:10 PM COT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70, XPosition=3, ColumnSpan=1,Updated=TO_TIMESTAMP('2015-06-09 18:20:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203811 +; + +-- Jun 9, 2015 6:20:10 PM COT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=80, XPosition=4, ColumnSpan=1,Updated=TO_TIMESTAMP('2015-06-09 18:20:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203812 +; + +-- Jun 9, 2015 6:20:10 PM COT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, XPosition=6, ColumnSpan=1,Updated=TO_TIMESTAMP('2015-06-09 18:20:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203813 +; + +-- Jun 9, 2015 6:20:10 PM COT +UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2015-06-09 18:20:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203808 +; + +-- Jun 9, 2015 6:20:10 PM COT +UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2015-06-09 18:20:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203809 +; + +-- Jun 9, 2015 6:21:29 PM COT +INSERT INTO AD_Menu (AD_Menu_ID,Name,"action",AD_Window_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSummary,IsSOTrx,IsReadOnly,EntityType,IsCentrallyMaintained,AD_Menu_UU) VALUES (200111,'Locator Type','W',200074,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:21:29','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:21:29','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','N','D','Y','a2f0d1bd-3fe0-4f59-af8c-2dafa0247e5a') +; + +-- Jun 9, 2015 6:21:29 PM COT +INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNodeMM_UU) SELECT t.AD_Client_ID, 0, 'Y', statement_timestamp(), 100, statement_timestamp(), 100,t.AD_Tree_ID, 200111, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='MM' AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200111) +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=0, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=218 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=1, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=153 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=2, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=263 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=3, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=166 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=4, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=203 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=5, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53242 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=6, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=236 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=7, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=183 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=8, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=160 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=9, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=278 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=10, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=345 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=11, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53296 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=12, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53014 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=13, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53108 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=0, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=167 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=1, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=357 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=2, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=229 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=3, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=412 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=4, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=256 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=5, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=197 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=6, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=477 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=7, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=181 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=8, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=484 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=9, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=179 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=10, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=503 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=11, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200064 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=12, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200111 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=13, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=196 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=14, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=479 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=15, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=482 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=16, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=481 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=17, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=411 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=18, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53253 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=19, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=426 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=20, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=537 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=21, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=311 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=22, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=292 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=23, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=504 +; + +-- Jun 9, 2015 6:21:52 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=24, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=515 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=0, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=167 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=1, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=357 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=2, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=229 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=3, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=412 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=4, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=256 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=5, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=197 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=6, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=477 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=7, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=181 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=8, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=484 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=9, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=179 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=10, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=503 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=11, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200064 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=12, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=196 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=13, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=479 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=14, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=482 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=15, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=481 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=16, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=411 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=17, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53253 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=18, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=426 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=19, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=537 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=20, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=311 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=21, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=292 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=22, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=504 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=23, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=515 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=0, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=268 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=1, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=125 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=2, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=422 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=3, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=107 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=4, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=130 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=5, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=188 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=6, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=227 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=7, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=381 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=8, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=126 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=9, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200111 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=10, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=421 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=11, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=534 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=12, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200044 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=13, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=267 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=14, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=490 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=15, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=132 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=16, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=310 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=17, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200032 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=18, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200033 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=19, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200029 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=20, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=128 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=21, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=585 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=22, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=187 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=23, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53210 +; + +-- Jun 9, 2015 6:22:14 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=24, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53211 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=0, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=268 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=1, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200111 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=2, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=125 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=3, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=422 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=4, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=107 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=5, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=130 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=6, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=188 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=7, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=227 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=8, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=381 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=9, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=126 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=10, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=421 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=11, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=534 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=12, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200044 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=13, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=267 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=14, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=490 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=15, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=132 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=16, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=310 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=17, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200032 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=18, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200033 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=19, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200029 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=20, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=128 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=21, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=585 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=22, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=187 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=23, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53210 +; + +-- Jun 9, 2015 6:22:19 PM COT +UPDATE AD_TreeNodeMM SET Parent_ID=167, SeqNo=24, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53211 +; + +-- Jun 9, 2015 6:27:22 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType) VALUES (212196,0,'Locator Type',207,'M_LocatorType_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2015-06-09 18:27:21','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:27:21','YYYY-MM-DD HH24:MI:SS'),100,202889,'Y','N','D','N','N','N','Y','78a5bc43-39d9-46d3-b30e-f9ae3bf9f4ec','Y',0,'N','N','N') +; + +-- Jun 9, 2015 6:27:27 PM COT +UPDATE AD_Column SET FKConstraintName='MLocatorType_MLocator', FKConstraintType='N',Updated=TO_TIMESTAMP('2015-06-09 18:27:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212196 +; + +-- Jun 9, 2015 6:27:27 PM COT +ALTER TABLE M_Locator ADD COLUMN M_LocatorType_ID NUMERIC(10) DEFAULT NULL +; + +-- Jun 9, 2015 6:27:27 PM COT +ALTER TABLE M_Locator ADD CONSTRAINT MLocatorType_MLocator FOREIGN KEY (M_LocatorType_ID) REFERENCES m_locatortype(m_locatortype_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Jun 9, 2015 6:28:07 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (203814,'Locator Type',178,212196,'Y',22,120,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-06-09 18:28:07','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-09 18:28:07','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6d4732fc-d162-4eea-ad45-6118537250bc','Y',120,2) +; + +-- Jun 9, 2015 6:29:03 PM COT +UPDATE AD_Field SET SeqNo=10,Updated=TO_TIMESTAMP('2015-06-09 18:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1000 +; + +-- Jun 9, 2015 6:29:03 PM COT +UPDATE AD_Field SET SeqNo=20,Updated=TO_TIMESTAMP('2015-06-09 18:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2044 +; + +-- Jun 9, 2015 6:29:03 PM COT +UPDATE AD_Field SET SeqNo=30,Updated=TO_TIMESTAMP('2015-06-09 18:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1003 +; + +-- Jun 9, 2015 6:29:03 PM COT +UPDATE AD_Field SET SeqNo=40,Updated=TO_TIMESTAMP('2015-06-09 18:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2095 +; + +-- Jun 9, 2015 6:29:03 PM COT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=50, XPosition=1,Updated=TO_TIMESTAMP('2015-06-09 18:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203814 +; + +-- Jun 9, 2015 6:29:03 PM COT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=60, XPosition=5, ColumnSpan=2,Updated=TO_TIMESTAMP('2015-06-09 18:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1001 +; + +-- Jun 9, 2015 6:29:03 PM COT +UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2015-06-09 18:29:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=999 +; + +CREATE OR REPLACE FUNCTION BOMQtyOnHand (in product_id numeric, in warehouse_id numeric, in locator_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + myWarehouse_ID numeric; + v_Quantity numeric := 99999; -- unlimited + v_IsBOM CHAR(1); + v_IsStocked CHAR(1); + v_ProductType CHAR(1); + v_ProductQty numeric; + v_StdPrecision int; + bom record; + +BEGIN + -- Check Parameters + myWarehouse_ID := Warehouse_ID; + IF (myWarehouse_ID IS NULL) THEN + IF (Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT SUM(M_Warehouse_ID) INTO myWarehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=Locator_ID; + END IF; + END IF; + IF (myWarehouse_ID IS NULL) THEN + RETURN 0; + END IF; + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO v_IsBOM, v_ProductType, v_IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + -- Unlimited capacity if no item + IF (v_IsBOM='N' AND (v_ProductType<>'I' OR v_IsStocked='N')) THEN + RETURN v_Quantity; + -- Stocked item + ELSIF (v_IsStocked='Y') THEN + -- Get ProductQty + SELECT COALESCE(SUM(QtyOnHand), 0) + INTO v_ProductQty + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + WHERE s.M_Product_ID=Product_ID AND l.M_Warehouse_ID=myWarehouse_ID; + -- + RETURN v_ProductQty; + END IF; + + -- Go through BOM + FOR bom IN -- Get BOM Product info + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=product_ID + AND b.M_ProductBOM_ID != Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y' + LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get v_ProductQty + SELECT COALESCE(SUM(QtyOnHand), 0) + INTO v_ProductQty + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + WHERE s.M_Product_ID=bom.M_ProductBOM_ID AND l.M_Warehouse_ID=myWarehouse_ID; + -- Get Rounding Precision + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + v_ProductQty := ROUND (v_ProductQty/bom.BOMQty, v_StdPrecision); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + v_ProductQty := Bomqtyonhand (bom.M_ProductBOM_ID, myWarehouse_ID, Locator_ID); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + IF (v_Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=Product_ID; + -- + RETURN ROUND (v_Quantity, v_StdPrecision); + END IF; + RETURN 0; +END; +$BODY$ +LANGUAGE 'plpgsql' STABLE +; + +CREATE OR REPLACE FUNCTION BOMQtyOnHandForReservation (in product_id numeric, in warehouse_id numeric, in locator_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + myWarehouse_ID numeric; + v_Quantity numeric := 99999; -- unlimited + v_IsBOM CHAR(1); + v_IsStocked CHAR(1); + v_ProductType CHAR(1); + v_ProductQty numeric; + v_StdPrecision int; + bom record; + +BEGIN + -- Check Parameters + myWarehouse_ID := Warehouse_ID; + IF (myWarehouse_ID IS NULL) THEN + IF (Locator_ID IS NULL) THEN + RETURN 0; + ELSE + SELECT SUM(M_Warehouse_ID) INTO myWarehouse_ID + FROM M_LOCATOR + WHERE M_Locator_ID=Locator_ID; + END IF; + END IF; + IF (myWarehouse_ID IS NULL) THEN + RETURN 0; + END IF; + + -- Check, if product exists and if it is stocked + BEGIN + SELECT IsBOM, ProductType, IsStocked + INTO v_IsBOM, v_ProductType, v_IsStocked + FROM M_PRODUCT + WHERE M_Product_ID=Product_ID; + -- + EXCEPTION -- not found + WHEN OTHERS THEN + RETURN 0; + END; + -- Unlimited capacity if no item + IF (v_IsBOM='N' AND (v_ProductType<>'I' OR v_IsStocked='N')) THEN + RETURN v_Quantity; + -- Stocked item + ELSIF (v_IsStocked='Y') THEN + -- Get ProductQty + SELECT COALESCE(SUM(QtyOnHand), 0) + INTO v_ProductQty + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + LEFT JOIN M_LocatorType lt ON (l.M_LocatorType_ID=lt.M_LocatorType_ID) + WHERE s.M_Product_ID=Product_ID AND l.M_Warehouse_ID=myWarehouse_ID + AND COALESCE(lt.IsAvailableForReservation,'Y')='Y'; + -- + RETURN v_ProductQty; + END IF; + + -- Go through BOM + FOR bom IN -- Get BOM Product info + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM, p.IsStocked, p.ProductType + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=product_ID + AND b.M_ProductBOM_ID != Product_ID + AND p.IsBOM='Y' + AND p.IsVerified='Y' + AND b.IsActive='Y' + LOOP + -- Stocked Items "leaf node" + IF (bom.ProductType = 'I' AND bom.IsStocked = 'Y') THEN + -- Get v_ProductQty + SELECT COALESCE(SUM(QtyOnHand), 0) + INTO v_ProductQty + FROM M_Storageonhand s + JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + LEFT JOIN M_LocatorType lt ON (l.M_LocatorType_ID=lt.M_LocatorType_ID) + WHERE s.M_Product_ID=bom.M_ProductBOM_ID AND l.M_Warehouse_ID=myWarehouse_ID + AND COALESCE(lt.IsAvailableForReservation,'Y')='Y'; + -- Get Rounding Precision + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=bom.M_ProductBOM_ID; + -- How much can we make with this product + v_ProductQty := ROUND (v_ProductQty/bom.BOMQty, v_StdPrecision); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + -- Another BOM + ELSIF (bom.IsBOM = 'Y') THEN + v_ProductQty := BOMQtyOnHandForReservation (bom.M_ProductBOM_ID, myWarehouse_ID, Locator_ID); + -- How much can we make overall + IF (v_ProductQty < v_Quantity) THEN + v_Quantity := v_ProductQty; + END IF; + END IF; + END LOOP; -- BOM + + IF (v_Quantity > 0) THEN + -- Get Rounding Precision for Product + SELECT COALESCE(MAX(u.StdPrecision), 0) + INTO v_StdPrecision + FROM C_UOM u, M_PRODUCT p + WHERE u.C_UOM_ID=p.C_UOM_ID AND p.M_Product_ID=Product_ID; + -- + RETURN ROUND (v_Quantity, v_StdPrecision); + END IF; + RETURN 0; +END; +$BODY$ +LANGUAGE 'plpgsql' STABLE +; + +CREATE OR REPLACE FUNCTION bomqtyavailable (in product_id numeric, in warehouse_id numeric, in locator_id numeric) RETURNS numeric AS +$BODY$ +BEGIN + RETURN bomQtyOnHandForReservation(Product_ID, Warehouse_ID, Locator_ID) - bomQtyReserved(Product_ID, Warehouse_ID, Locator_ID); +END; +$BODY$ +LANGUAGE 'plpgsql' STABLE +; + +--create views +CREATE OR REPLACE VIEW M_PRODUCT_STOCK_V +AS +SELECT +ms.IsActive, ms.Created, ms.CreatedBy, ms.Updated, ms.UpdatedBy, +mp.VALUE, mp.help, +(CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN ms.qtyonhand ELSE 0 END - ms.qtyreserved) AS qtyavailable, +ms.qtyonhand, +ms.qtyreserved, mp.description, mw.NAME AS warehouse, mw.m_warehouse_id, mw.ad_client_id, +mw.ad_org_id, mp.documentnote, mp.m_product_id +FROM M_STORAGE ms +JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id +JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id +LEFT JOIN M_LOCATORTYPE lt ON ml.m_locatortype_id = lt.m_locatortype_id +JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id +ORDER BY mw.NAME; + +CREATE OR REPLACE VIEW M_PRODUCT_SUBSTITUTERELATED_V AS +SELECT s.ad_client_id, + s.ad_org_id, + s.isactive, + s.created, + s.createdby, + s.updated, + s.updatedby, + s.m_product_id, + s.substitute_id, + 'S' AS rowtype, + mp.name, + sum(CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN ms.qtyonhand ELSE 0 END - ms.qtyreserved) AS qtyavailable, + sum(ms.qtyonhand) AS qtyonhand, + sum(ms.qtyreserved) AS qtyreserved, + currencyRound(MAX(mpr.pricestd),mpl.C_Currency_ID,'N') AS pricestd, + mpr.m_pricelist_version_id, + mw.m_warehouse_id, + org.name AS orgname + FROM m_substitute s + JOIN m_storage ms ON ms.m_product_id = s.substitute_id + JOIN m_product mp ON ms.m_product_id = mp.m_product_id + JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id + LEFT JOIN M_LOCATORTYPE lt ON ml.m_locatortype_id = lt.m_locatortype_id + JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id + JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id + JOIN m_pricelist_version mplv ON mplv.m_pricelist_version_id = mpr.m_pricelist_version_id + JOIN m_pricelist mpl ON mplv.m_pricelist_id = mpl.m_pricelist_id + JOIN ad_org org ON org.ad_org_id = mw.ad_org_id + GROUP BY s.ad_client_id, + s.ad_org_id, + s.isactive, + s.created, + s.createdby, + s.updated, + s.updatedby, + s.m_product_id, + s.substitute_id, + mw.m_warehouse_id, + mpr.m_pricelist_version_id, + org.name, + mp.name, + mpl.C_Currency_ID + UNION + SELECT r.ad_client_id, + r.ad_org_id, + r.isactive, + r.created, + r.createdby, + r.updated, + r.updatedby, + r.m_product_id, + r.relatedproduct_id AS substitute_id, + 'R' AS rowtype, + mp.name, + sum(CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN ms.qtyonhand ELSE 0 END - ms.qtyreserved) AS qtyavailable, + sum(ms.qtyonhand) AS qtyonhand, + sum(ms.qtyreserved) AS qtyreserved, + currencyRound(MAX(mpr.pricestd),mpl.C_Currency_ID,'N') AS pricestd, + mpr.m_pricelist_version_id, + mw.m_warehouse_id, + org.name AS orgname + FROM m_relatedproduct r + JOIN m_storage ms ON ms.m_product_id = r.relatedproduct_id + JOIN m_product mp ON ms.m_product_id = mp.m_product_id + JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id + LEFT JOIN M_LOCATORTYPE lt ON ml.m_locatortype_id = lt.m_locatortype_id + JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id + JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id + JOIN m_pricelist_version mplv ON mplv.m_pricelist_version_id = mpr.m_pricelist_version_id + JOIN m_pricelist mpl ON mplv.m_pricelist_id = mpl.m_pricelist_id + JOIN ad_org org ON org.ad_org_id = mw.ad_org_id + GROUP BY r.ad_client_id, + r.ad_org_id, + r.isactive, + r.created, + r.createdby, + r.updated, + r.updatedby, + r.m_product_id, + r.relatedproduct_id, + mw.m_warehouse_id, + mpr.m_pricelist_version_id, + org.name, + mp.name, + mpl.C_Currency_ID; + +CREATE OR REPLACE VIEW rv_storage AS +SELECT s.ad_client_id, + s.ad_org_id, + s.m_product_id, + p.value, + p.name, + p.description, + p.upc, + p.sku, + p.c_uom_id, + p.m_product_category_id, + p.classification, + p.weight, + p.volume, + p.versionno, + p.guaranteedays, + p.guaranteedaysmin, + s.m_locator_id, + l.m_warehouse_id, + l.x, + l.y, + l.z, + s.qtyonhand, + s.qtyreserved, + CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN s.qtyonhand ELSE 0 END - s.qtyreserved AS qtyavailable, + s.qtyordered, + s.datelastinventory, + s.m_attributesetinstance_id, + asi.m_attributeset_id, + asi.serno, + asi.lot, + asi.m_lot_id, + asi.guaranteedate, + daysbetween(asi.guaranteedate, getdate()) AS shelflifedays, + daysbetween(asi.guaranteedate, getdate()) - p.guaranteedaysmin AS goodfordays, + CASE WHEN COALESCE(p.guaranteedays, 0) > 0 THEN round(daysbetween(asi.guaranteedate, getdate()) / p.guaranteedays * 100, 0) ELSE NULL END AS + shelfliferemainingpct, + s.isactive AS m_storage_isactive, + s.updated AS m_storage_updated, + s.updatedby AS m_storage_updatedby, + l.ad_org_id AS m_locator_ad_org_id, + l.isactive AS m_locator_isactive, + l.isdefault, + l.priorityno, + l.value AS m_locator_value, + p.ad_org_id AS m_product_ad_org_id, + p.copyfrom AS m_product_copyfrom, + p.created AS m_product_created, + p.createdby AS m_product_createdby, + p.c_revenuerecognition_id, + p.c_subscriptiontype_id, + p.c_taxcategory_id, + p.descriptionurl, + p.discontinued AS m_product_discontinued, + p.discontinuedat AS m_product_discontinuedat, + p.documentnote, + p.group1, + p.group2, + p.help, + p.imageurl, + p.isactive AS m_product_isactive, + p.isbom, + p.isdropship, + p.isexcludeautodelivery, + p.isinvoiceprintdetails, + p.ispicklistprintdetails, + p.ispurchased, + p.isselfservice, + p.issold, + p.isstocked, + p.issummary AS m_product_issummary, + p.isverified, + p.iswebstorefeatured, + p.lowlevel, + p.m_attributeset_id AS m_product_m_attributeset_id, + p.m_attributesetinstance_id AS m_product_m_asi_id, + p.m_freightcategory_id, + p.m_locator_id AS m_product_m_locator_id, + p.processing AS m_product_processing, + p.producttype, + p.r_mailtext_id, + p.salesrep_id AS m_product_salesrep_id, + p.s_expensetype_id, + p.shelfdepth, + p.shelfheight, + p.shelfwidth, + p.s_resource_id, + p.unitsperpack, + p.unitsperpallet, + p.updated AS m_product_updated, + p.updatedby AS m_product_updatedby, + asi.ad_org_id AS m_asi_ad_org_id, + asi.created AS m_asi_created, + asi.createdby AS m_asi_createdby, + asi.description AS m_asi_description, + asi.isactive AS m_asi_isactive, + asi.updated AS m_asi_updated, + asi.updatedby AS m_asi_updatedby +FROM m_storage s + JOIN m_locator l + ON s.m_locator_id = l.m_locator_id + LEFT JOIN m_locatortype lt + ON l.m_locatortype_id = lt.m_locatortype_id + JOIN m_product p + ON s.m_product_id = p.m_product_id + LEFT JOIN m_attributesetinstance asi + ON s.m_attributesetinstance_id = asi.m_attributesetinstance_id +; + +-- Jun 12, 2015 11:07:40 PM COT +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Locator not available for shipping',0,0,'Y',TO_TIMESTAMP('2015-06-12 23:07:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-12 23:07:40','YYYY-MM-DD HH24:MI:SS'),100,200353,'LocatorNotAvailableForShipping','D','213a2d7d-449a-48e0-8aa4-596207ee2c73') +; + +SELECT register_migration_script('201506091830_IDEMPIERE-2668.sql') FROM dual +; + diff --git a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java index 3e3c1d4d42..d0fca5a2f2 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java +++ b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java @@ -22,12 +22,15 @@ import java.sql.ResultSet; import java.sql.Timestamp; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.logging.Level; import org.adempiere.exceptions.AdempiereException; import org.compiere.model.MClient; import org.compiere.model.MInOut; import org.compiere.model.MInOutLine; +import org.compiere.model.MLocator; +import org.compiere.model.MLocatorType; import org.compiere.model.MOrder; import org.compiere.model.MOrderLine; import org.compiere.model.MProduct; @@ -559,9 +562,23 @@ public class InOutGenerate extends SvrProcess if (m_lastStorages == null) { - m_lastStorages = MStorageOnHand.getWarehouse(getCtx(), + MStorageOnHand[] tmpStorages = MStorageOnHand.getWarehouse(getCtx(), M_Warehouse_ID, M_Product_ID, M_AttributeSetInstance_ID, minGuaranteeDate, FiFo,false, 0, get_TrxName()); + + /* IDEMPIERE-2668 - filter just locators enabled for shipping */ + List m_storagesForShipping = new ArrayList(); + for (MStorageOnHand soh : tmpStorages) { + MLocator loc = MLocator.get(getCtx(), soh.getM_Locator_ID()); + MLocatorType lt = null; + if (loc.getM_LocatorType_ID() > 0) + lt = MLocatorType.get(getCtx(), loc.getM_LocatorType_ID()); + if (lt == null || lt.isAvailableForShipping()) + m_storagesForShipping.add(soh); + } + m_lastStorages = new MStorageOnHand[m_storagesForShipping.size()]; + m_storagesForShipping.toArray(m_lastStorages); + m_map.put(m_lastPP, m_lastStorages); } return m_lastStorages; diff --git a/org.adempiere.base.process/src/org/compiere/process/ReplenishReport.java b/org.adempiere.base.process/src/org/compiere/process/ReplenishReport.java index b89a2cc2bd..de6fa93c5e 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ReplenishReport.java +++ b/org.adempiere.base.process/src/org/compiere/process/ReplenishReport.java @@ -28,6 +28,8 @@ import org.adempiere.base.Core; import org.compiere.model.MBPartner; import org.compiere.model.MClient; import org.compiere.model.MDocType; +import org.compiere.model.MLocator; +import org.compiere.model.MLocatorType; import org.compiere.model.MMovement; import org.compiere.model.MMovementLine; import org.compiere.model.MOrder; @@ -429,6 +431,9 @@ public class ReplenishReport extends SvrProcess order.setM_Warehouse_ID(wh.getM_Warehouse_ID()); if (!order.save()) return; + addBufferLog(order.getC_Order_ID(), order.getDateOrdered(), null, + Msg.parseTranslation(getCtx(), "@C_Order_ID@ @Created@"), + MOrder.Table_ID, order.getC_Order_ID()); if (log.isLoggable(Level.FINE)) log.fine(order.toString()); noOrders++; info.append(" - "); @@ -473,6 +478,9 @@ public class ReplenishReport extends SvrProcess requisition.setM_Warehouse_ID(wh.getM_Warehouse_ID()); if (!requisition.save()) return; + addBufferLog(requisition.getM_Requisition_ID(), requisition.getDateDoc(), null, + Msg.parseTranslation(getCtx(), "@M_Requisition_ID@ @Created@"), + MRequisition.Table_ID, requisition.getM_Requisition_ID()); if (log.isLoggable(Level.FINE)) log.fine(requisition.toString()); noReqs++; info.append(" - "); @@ -530,6 +538,9 @@ public class ReplenishReport extends SvrProcess move.setAD_Org_ID(whSource.getAD_Org_ID()); if (!move.save()) return; + addBufferLog(move.getM_Movement_ID(), move.getMovementDate(), null, + Msg.parseTranslation(getCtx(), "@M_Movement_ID@ @Created@"), + MMovement.Table_ID, move.getM_Movement_ID()); if (log.isLoggable(Level.FINE)) log.fine(move.toString()); noMoves++; info.append(" - ").append(move.getDocumentNo()); @@ -549,6 +560,15 @@ public class ReplenishReport extends SvrProcess MStorageOnHand storage = storages[j]; if (storage.getQtyOnHand().signum() <= 0) continue; + + /* IDEMPIERE-2668 - filter just locators enabled for replenishment */ + MLocator loc = MLocator.get(getCtx(), storage.getM_Locator_ID()); + MLocatorType lt = null; + if (loc.getM_LocatorType_ID() > 0) + lt = MLocatorType.get(getCtx(), loc.getM_LocatorType_ID()); + if (lt != null && !lt.isAvailableForReplenishment()) + continue; + BigDecimal moveQty = target; if (storage.getQtyOnHand().compareTo(moveQty) < 0) moveQty = storage.getQtyOnHand(); @@ -653,6 +673,9 @@ public class ReplenishReport extends SvrProcess if (!order.save()) return; + addBufferLog(order.getDD_Order_ID(), order.getDateOrdered(), null, + Msg.parseTranslation(getCtx(), "@DD_Order_ID@ @Created@"), + MDDOrder.Table_ID, order.getDD_Order_ID()); if (log.isLoggable(Level.FINE)) log.fine(order.toString()); noMoves++; info.append(" - ").append(order.getDocumentNo()); diff --git a/org.adempiere.base.process/src/org/compiere/process/ReplenishReportProduction.java b/org.adempiere.base.process/src/org/compiere/process/ReplenishReportProduction.java index ecaa359cf0..3f70401567 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ReplenishReportProduction.java +++ b/org.adempiere.base.process/src/org/compiere/process/ReplenishReportProduction.java @@ -29,6 +29,8 @@ import org.adempiere.base.Core; import org.compiere.model.MBPartner; import org.compiere.model.MClient; import org.compiere.model.MDocType; +import org.compiere.model.MLocator; +import org.compiere.model.MLocatorType; import org.compiere.model.MMovement; import org.compiere.model.MMovementLine; import org.compiere.model.MOrder; @@ -464,6 +466,9 @@ public class ReplenishReportProduction extends SvrProcess order.setM_Warehouse_ID(wh.getM_Warehouse_ID()); if (!order.save()) return; + addBufferLog(order.getC_Order_ID(), order.getDateOrdered(), null, + Msg.parseTranslation(getCtx(), "@C_Order_ID@ @Created@"), + MOrder.Table_ID, order.getC_Order_ID()); if (log.isLoggable(Level.FINE)) log.fine(order.toString()); noOrders++; info.append(" - "); @@ -508,6 +513,9 @@ public class ReplenishReportProduction extends SvrProcess requisition.setM_Warehouse_ID(wh.getM_Warehouse_ID()); if (!requisition.save()) return; + addBufferLog(requisition.getM_Requisition_ID(), requisition.getDateDoc(), null, + Msg.parseTranslation(getCtx(), "@M_Requisition_ID@ @Created@"), + MRequisition.Table_ID, requisition.getM_Requisition_ID()); if (log.isLoggable(Level.FINE)) log.fine(requisition.toString()); noReqs++; info.append(" - "); @@ -566,6 +574,9 @@ public class ReplenishReportProduction extends SvrProcess move.setAD_Org_ID(whSource.getAD_Org_ID()); if (!move.save()) return; + addBufferLog(move.getM_Movement_ID(), move.getMovementDate(), null, + Msg.parseTranslation(getCtx(), "@M_Movement_ID@ @Created@"), + MMovement.Table_ID, move.getM_Movement_ID()); if (log.isLoggable(Level.FINE)) log.fine(move.toString()); noMoves++; info.append(" - ").append(move.getDocumentNo()); @@ -585,6 +596,15 @@ public class ReplenishReportProduction extends SvrProcess MStorageOnHand storage = storages[j]; if (storage.getQtyOnHand().signum() <= 0) continue; + + /* IDEMPIERE-2668 - filter just locators enabled for replenishment */ + MLocator loc = MLocator.get(getCtx(), storage.getM_Locator_ID()); + MLocatorType lt = null; + if (loc.getM_LocatorType_ID() > 0) + lt = MLocatorType.get(getCtx(), loc.getM_LocatorType_ID()); + if (lt != null && !lt.isAvailableForReplenishment()) + continue; + BigDecimal moveQty = target; if (storage.getQtyOnHand().compareTo(moveQty) < 0) moveQty = storage.getQtyOnHand(); @@ -689,6 +709,9 @@ public class ReplenishReportProduction extends SvrProcess if (!order.save()) return; + addBufferLog(order.getDD_Order_ID(), order.getDateOrdered(), null, + Msg.parseTranslation(getCtx(), "@DD_Order_ID@ @Created@"), + MDDOrder.Table_ID, order.getDD_Order_ID()); if (log.isLoggable(Level.FINE)) log.fine(order.toString()); noMoves++; info.append(" - ").append(order.getDocumentNo()); @@ -819,6 +842,9 @@ public class ReplenishReportProduction extends SvrProcess production.setIsCreated("Y"); production.saveEx(get_TrxName()); + addBufferLog(production.getM_Production_ID(), production.getMovementDate(), null, + Msg.parseTranslation(getCtx(), "@M_Production_ID@ @Created@"), + MProduction.Table_ID, production.getM_Production_ID()); if (log.isLoggable(Level.FINE)) log.fine(production.toString()); noProds++; info.append(" - "); diff --git a/org.adempiere.base/src/org/compiere/model/I_M_Locator.java b/org.adempiere.base/src/org/compiere/model/I_M_Locator.java index bb8a907968..b925da25e3 100644 --- a/org.adempiere.base/src/org/compiere/model/I_M_Locator.java +++ b/org.adempiere.base/src/org/compiere/model/I_M_Locator.java @@ -117,6 +117,17 @@ public interface I_M_Locator */ public int getM_Locator_ID(); + /** Column name M_LocatorType_ID */ + public static final String COLUMNNAME_M_LocatorType_ID = "M_LocatorType_ID"; + + /** Set Locator Type */ + public void setM_LocatorType_ID (int M_LocatorType_ID); + + /** Get Locator Type */ + public int getM_LocatorType_ID(); + + public org.compiere.model.I_M_LocatorType getM_LocatorType() throws RuntimeException; + /** Column name M_Locator_UU */ public static final String COLUMNNAME_M_Locator_UU = "M_Locator_UU"; diff --git a/org.adempiere.base/src/org/compiere/model/I_M_LocatorType.java b/org.adempiere.base/src/org/compiere/model/I_M_LocatorType.java new file mode 100644 index 0000000000..35b21dbca7 --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/I_M_LocatorType.java @@ -0,0 +1,193 @@ +/****************************************************************************** + * Product: iDempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2012 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; +import java.sql.Timestamp; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for M_LocatorType + * @author iDempiere (generated) + * @version Release 2.1 + */ +public interface I_M_LocatorType +{ + + /** TableName=M_LocatorType */ + public static final String Table_Name = "M_LocatorType"; + + /** AD_Table_ID=200175 */ + public static final int Table_ID = 200175; + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 3 - Client - Org + */ + BigDecimal accessLevel = BigDecimal.valueOf(3); + + /** Load Meta Data */ + + /** Column name AD_Client_ID */ + public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID"; + + /** Get Client. + * Client/Tenant for this installation. + */ + public int getAD_Client_ID(); + + /** 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 Created */ + public static final String COLUMNNAME_Created = "Created"; + + /** Get Created. + * Date this record was created + */ + public Timestamp getCreated(); + + /** Column name CreatedBy */ + public static final String COLUMNNAME_CreatedBy = "CreatedBy"; + + /** Get Created By. + * User who created this records + */ + public int getCreatedBy(); + + /** Column name Description */ + public static final String COLUMNNAME_Description = "Description"; + + /** Set Description. + * Optional short description of the record + */ + public void setDescription (String Description); + + /** Get Description. + * Optional short description of the record + */ + public String getDescription(); + + /** Column name Help */ + public static final String COLUMNNAME_Help = "Help"; + + /** Set Comment/Help. + * Comment or Hint + */ + public void setHelp (String Help); + + /** Get Comment/Help. + * Comment or Hint + */ + public String getHelp(); + + /** Column name IsActive */ + public static final String COLUMNNAME_IsActive = "IsActive"; + + /** Set Active. + * The record is active in the system + */ + public void setIsActive (boolean IsActive); + + /** Get Active. + * The record is active in the system + */ + public boolean isActive(); + + /** Column name IsAvailableForReplenishment */ + public static final String COLUMNNAME_IsAvailableForReplenishment = "IsAvailableForReplenishment"; + + /** Set Available for Replenishment */ + public void setIsAvailableForReplenishment (boolean IsAvailableForReplenishment); + + /** Get Available for Replenishment */ + public boolean isAvailableForReplenishment(); + + /** Column name IsAvailableForReservation */ + public static final String COLUMNNAME_IsAvailableForReservation = "IsAvailableForReservation"; + + /** Set Available for Reservation */ + public void setIsAvailableForReservation (boolean IsAvailableForReservation); + + /** Get Available for Reservation */ + public boolean isAvailableForReservation(); + + /** Column name IsAvailableForShipping */ + public static final String COLUMNNAME_IsAvailableForShipping = "IsAvailableForShipping"; + + /** Set Available for Shipping */ + public void setIsAvailableForShipping (boolean IsAvailableForShipping); + + /** Get Available for Shipping */ + public boolean isAvailableForShipping(); + + /** Column name M_LocatorType_ID */ + public static final String COLUMNNAME_M_LocatorType_ID = "M_LocatorType_ID"; + + /** Set Locator Type */ + public void setM_LocatorType_ID (int M_LocatorType_ID); + + /** Get Locator Type */ + public int getM_LocatorType_ID(); + + /** Column name M_LocatorType_UU */ + public static final String COLUMNNAME_M_LocatorType_UU = "M_LocatorType_UU"; + + /** Set M_LocatorType_UU */ + public void setM_LocatorType_UU (String M_LocatorType_UU); + + /** Get M_LocatorType_UU */ + public String getM_LocatorType_UU(); + + /** Column name Name */ + public static final String COLUMNNAME_Name = "Name"; + + /** Set Name. + * Alphanumeric identifier of the entity + */ + public void setName (String Name); + + /** Get Name. + * Alphanumeric identifier of the entity + */ + public String getName(); + + /** Column name Updated */ + public static final String COLUMNNAME_Updated = "Updated"; + + /** Get Updated. + * Date this record was updated + */ + public Timestamp getUpdated(); + + /** Column name UpdatedBy */ + public static final String COLUMNNAME_UpdatedBy = "UpdatedBy"; + + /** Get Updated By. + * User who updated this records + */ + public int getUpdatedBy(); +} diff --git a/org.adempiere.base/src/org/compiere/model/MInOutLine.java b/org.adempiere.base/src/org/compiere/model/MInOutLine.java index 0479bda181..c5e5f28767 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOutLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInOutLine.java @@ -565,6 +565,18 @@ public class MInOutLine extends X_M_InOutLine locator, getLine()); } + + // IDEMPIERE-2668 + if (getParent().isSOTrx()) { + if (locator.getM_LocatorType_ID() > 0) { + MLocatorType lt = MLocatorType.get(getCtx(), locator.getM_LocatorType_ID()); + if (! lt.isAvailableForShipping()) { + log.saveError("Error", Msg.translate(getCtx(), "LocatorNotAvailableForShipping")); + return false; + } + } + } + } // if (getC_Charge_ID() == 0 && getM_Product_ID() == 0) diff --git a/org.adempiere.base/src/org/compiere/model/MLocator.java b/org.adempiere.base/src/org/compiere/model/MLocator.java index 2ece305a49..c7b0cbb97e 100644 --- a/org.adempiere.base/src/org/compiere/model/MLocator.java +++ b/org.adempiere.base/src/org/compiere/model/MLocator.java @@ -39,8 +39,7 @@ public class MLocator extends X_M_Locator /** * */ - private static final long serialVersionUID = 6019655556196171287L; - + private static final long serialVersionUID = 3649134803161895263L; /** * Get oldest Default Locator of warehouse with locator @@ -118,7 +117,12 @@ public class MLocator extends X_M_Locator } // getDefault - /** + public static MLocator get (Properties ctx, int M_Warehouse_ID, String Value, + String X, String Y, String Z) { + return get (ctx, M_Warehouse_ID, Value, X, Y, Z, 0); + } + + /** * Get the Locator with the combination or create new one * @param ctx Context * @param M_Warehouse_ID warehouse @@ -129,7 +133,7 @@ public class MLocator extends X_M_Locator * @return locator */ public static MLocator get (Properties ctx, int M_Warehouse_ID, String Value, - String X, String Y, String Z) + String X, String Y, String Z, int M_LocatorType_ID) { MLocator retValue = null; String sql = "SELECT * FROM M_Locator WHERE IsActive = 'Y' AND M_Warehouse_ID=? AND X=? AND Y=? AND Z=?"; @@ -160,6 +164,7 @@ public class MLocator extends X_M_Locator MWarehouse wh = MWarehouse.get (ctx, M_Warehouse_ID); retValue = new MLocator (wh, Value); retValue.setXYZ(X, Y, Z); + retValue.setM_LocatorType_ID(M_LocatorType_ID); retValue.saveEx(); } return retValue; diff --git a/org.adempiere.base/src/org/compiere/model/MLocatorType.java b/org.adempiere.base/src/org/compiere/model/MLocatorType.java new file mode 100644 index 0000000000..a1d70ddfe5 --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/MLocatorType.java @@ -0,0 +1,103 @@ +/********************************************************************** +* This file is part of iDempiere ERP Open Source * +* http://www.idempiere.org * +* * +* 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: * +* - Carlos Ruiz - globalqss * +**********************************************************************/ +package org.compiere.model; + +import java.sql.ResultSet; +import java.util.Properties; + +import org.compiere.util.CCache; +import org.compiere.util.CLogger; + +/** + * Warehouse Locator Type Object + * + * @author Carlos Ruiz - Quality Systems & Solutions - globalqss + */ +public class MLocatorType extends X_M_LocatorType { + /** + * + */ + private static final long serialVersionUID = -7567584133468332781L; + + /** + * Get Locator Type from Cache + * @param ctx context + * @param M_LocatorType_ID id + * @return MLocator + */ + public static MLocatorType get (Properties ctx, int M_LocatorType_ID) { + if (s_cache == null) + s_cache = new CCache(Table_Name, 20); + Integer key = new Integer (M_LocatorType_ID); + MLocatorType retValue = (MLocatorType) s_cache.get (key); + if (retValue != null) + return retValue; + retValue = new MLocatorType (ctx, M_LocatorType_ID, null); + if (retValue.get_ID () != 0) + s_cache.put (key, retValue); + return retValue; + } // get + + /** Cache */ + private volatile static CCache s_cache; + + /** Logger */ + @SuppressWarnings("unused") + private static CLogger s_log = CLogger.getCLogger (MLocatorType.class); + + /************************************************************************** + * Standard Locator Constructor + * @param ctx Context + * @param M_LocatorType_ID id + * @param trxName transaction + */ + public MLocatorType (Properties ctx, int M_LocatorType_ID, String trxName) { + super (ctx, M_LocatorType_ID, trxName); + if (M_LocatorType_ID == 0) { + setIsAvailableForReplenishment (true); + setIsAvailableForReservation (true); + setIsAvailableForShipping (true); + } + } // MLocatorType + + /** + * Load Constructor + * @param ctx context + * @param rs result set + * @param trxName transaction + */ + public MLocatorType (Properties ctx, ResultSet rs, String trxName) { + super(ctx, rs, trxName); + } // MLocatorType + + /** + * Get String Representation + * @return Name + */ + public String toString() { + return getName(); + } // toString + +} // MLocatorType diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index e7e986aa9c..6ce5e93c99 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -18,15 +18,11 @@ package org.compiere.model; import java.io.File; import java.math.BigDecimal; -import java.sql.Connection; -import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.sql.SQLException; import java.sql.Timestamp; import java.util.Hashtable; import java.util.List; import java.util.Properties; -import java.util.Vector; import java.util.logging.Level; import java.util.regex.Pattern; @@ -74,7 +70,7 @@ public class MOrder extends X_C_Order implements DocAction /** * */ - private static final long serialVersionUID = -5424713436299981736L; + private static final long serialVersionUID = 6669447827539872218L; /** * Create new Order by copying @@ -2835,13 +2831,6 @@ public class MOrder extends X_C_Order implements DocAction || DOCSTATUS_Reversed.equals(ds); } // isComplete - private static final String OrderLinesToAllocate = "select C_OrderLine.* from C_OrderLine " + - "JOIN C_Order ON C_OrderLine.C_Order_ID=C_Order.C_Order_ID " + - "JOIN M_Product ON C_OrderLine.M_Product_ID=M_Product.M_Product_ID " + - "where C_Order.IsSOTrx='Y' AND C_Order.DocStatus='CO' AND QtyAllocated<(QtyOrdered-QtyDelivered) " + - "AND M_Product.M_Product_ID=? " + - "order by PriorityRule, C_OrderLine.Created "; - /** * Finds all order lines that contains not yet delivered physical items of a specific product. * @@ -2850,7 +2839,14 @@ public class MOrder extends X_C_Order implements DocAction * @return Order lines to allocate products to. * @throws SQLException */ + /* commenting out wrong unused function - column qtyallocated does not exist public static List getOrderLinesToAllocate(Connection conn, int productId, String trxName) throws SQLException { + final String OrderLinesToAllocate = "select C_OrderLine.* from C_OrderLine " + + "JOIN C_Order ON C_OrderLine.C_Order_ID=C_Order.C_Order_ID " + + "JOIN M_Product ON C_OrderLine.M_Product_ID=M_Product.M_Product_ID " + + "where C_Order.IsSOTrx='Y' AND C_Order.DocStatus='CO' AND QtyAllocated<(QtyOrdered-QtyDelivered) " + + "AND M_Product.M_Product_ID=? " + + "order by PriorityRule, C_OrderLine.Created "; List result = new Vector(); Properties ctx = Env.getCtx(); MOrderLine line; @@ -2872,6 +2868,7 @@ public class MOrder extends X_C_Order implements DocAction } return(result); } + */ /** * Finds all products that can be allocated. A product can be allocated if there are more items @@ -2882,6 +2879,7 @@ public class MOrder extends X_C_Order implements DocAction * @return * @throws SQLException */ + /* commenting out wrong unused function - column qtyallocated does not exist public static List getProductsToAllocate(Connection conn, int WarehouseID) throws SQLException { List result = new Vector(); @@ -2934,6 +2932,7 @@ public class MOrder extends X_C_Order implements DocAction public StockInfo() {} } + */ /** * Set process message diff --git a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java index 0a80755095..3cc3b309d9 100644 --- a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java +++ b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java @@ -44,7 +44,7 @@ public class MStorageOnHand extends X_M_StorageOnHand /** * */ - private static final long serialVersionUID = -4934837951332485064L; + private static final long serialVersionUID = 1137569740767949519L; /** * @@ -958,6 +958,39 @@ public class MStorageOnHand extends X_M_StorageOnHand return qty; } + /** + * Get Quantity On Hand of Warehouse Available for Reservation + * @param M_Product_ID + * @param M_Warehouse_ID + * @param M_AttributeSetInstance_ID + * @param trxName + * @return QtyOnHand + */ + public static BigDecimal getQtyOnHandForReservation(int M_Product_ID, int M_Warehouse_ID, int M_AttributeSetInstance_ID, String trxName) { + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT SUM(QtyOnHand) FROM M_StorageOnHand oh" + + " JOIN M_Locator loc ON (oh.M_Locator_ID=loc.M_Locator_ID)" + + " LEFT JOIN M_LocatorType lt ON (loc.M_LocatorType_ID=lt.M_LocatorType_ID)") + .append(" WHERE oh.M_Product_ID=?") + .append(" AND loc.M_Warehouse_ID=? AND COALESCE(lt.IsAvailableForReservation,'Y')='Y'"); + + ArrayList params = new ArrayList(); + params.add(M_Product_ID); + params.add(M_Warehouse_ID); + + // With ASI + if (M_AttributeSetInstance_ID != 0) { + sql.append(" AND oh.M_AttributeSetInstance_ID=?"); + params.add(M_AttributeSetInstance_ID); + } + + BigDecimal qty = DB.getSQLValueBD(trxName, sql.toString(), params); + if (qty == null) + qty = Env.ZERO; + + return qty; + } + /** * Get Quantity On Hand of Locator * @param M_Product_ID diff --git a/org.adempiere.base/src/org/compiere/model/MStorageReservation.java b/org.adempiere.base/src/org/compiere/model/MStorageReservation.java index 243842dee2..71f8863558 100644 --- a/org.adempiere.base/src/org/compiere/model/MStorageReservation.java +++ b/org.adempiere.base/src/org/compiere/model/MStorageReservation.java @@ -30,7 +30,7 @@ public class MStorageReservation extends X_M_StorageReservation { /** * */ - private static final long serialVersionUID = -8646802850122507899L; + private static final long serialVersionUID = -2649259510341856418L; /** * Get Storage Info @@ -203,7 +203,7 @@ public class MStorageReservation extends X_M_StorageReservation { public static BigDecimal getQtyAvailable (int M_Warehouse_ID, int M_Product_ID, int M_AttributeSetInstance_ID, String trxName) { - BigDecimal qtyOnHand = MStorageOnHand.getQtyOnHand(M_Product_ID, M_Warehouse_ID, M_AttributeSetInstance_ID, trxName); + BigDecimal qtyOnHand = MStorageOnHand.getQtyOnHandForReservation(M_Product_ID, M_Warehouse_ID, M_AttributeSetInstance_ID, trxName); BigDecimal qtyReserved = MStorageReservation.getQty(M_Product_ID, M_Warehouse_ID, M_AttributeSetInstance_ID, true, trxName); BigDecimal retValue = qtyOnHand.subtract(qtyReserved); return retValue; diff --git a/org.adempiere.base/src/org/compiere/model/X_M_Locator.java b/org.adempiere.base/src/org/compiere/model/X_M_Locator.java index 5b63831d88..acb3d6379b 100644 --- a/org.adempiere.base/src/org/compiere/model/X_M_Locator.java +++ b/org.adempiere.base/src/org/compiere/model/X_M_Locator.java @@ -30,7 +30,7 @@ public class X_M_Locator extends PO implements I_M_Locator, I_Persistent /** * */ - private static final long serialVersionUID = 20141030L; + private static final long serialVersionUID = 20150609L; /** Standard Constructor */ public X_M_Locator (Properties ctx, int M_Locator_ID, String trxName) @@ -125,6 +125,31 @@ public class X_M_Locator extends PO implements I_M_Locator, I_Persistent return ii.intValue(); } + public org.compiere.model.I_M_LocatorType getM_LocatorType() throws RuntimeException + { + return (org.compiere.model.I_M_LocatorType)MTable.get(getCtx(), org.compiere.model.I_M_LocatorType.Table_Name) + .getPO(getM_LocatorType_ID(), get_TrxName()); } + + /** Set Locator Type. + @param M_LocatorType_ID Locator Type */ + public void setM_LocatorType_ID (int M_LocatorType_ID) + { + if (M_LocatorType_ID < 1) + set_Value (COLUMNNAME_M_LocatorType_ID, null); + else + set_Value (COLUMNNAME_M_LocatorType_ID, Integer.valueOf(M_LocatorType_ID)); + } + + /** Get Locator Type. + @return Locator Type */ + public int getM_LocatorType_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_LocatorType_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + /** Set M_Locator_UU. @param M_Locator_UU M_Locator_UU */ public void setM_Locator_UU (String M_Locator_UU) diff --git a/org.adempiere.base/src/org/compiere/model/X_M_LocatorType.java b/org.adempiere.base/src/org/compiere/model/X_M_LocatorType.java new file mode 100644 index 0000000000..8bb1bcee9e --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/X_M_LocatorType.java @@ -0,0 +1,235 @@ +/****************************************************************************** + * Product: iDempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2012 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 * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.sql.ResultSet; +import java.util.Properties; +import org.compiere.util.KeyNamePair; + +/** Generated Model for M_LocatorType + * @author iDempiere (generated) + * @version Release 2.1 - $Id$ */ +public class X_M_LocatorType extends PO implements I_M_LocatorType, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 20150609L; + + /** Standard Constructor */ + public X_M_LocatorType (Properties ctx, int M_LocatorType_ID, String trxName) + { + super (ctx, M_LocatorType_ID, trxName); + /** if (M_LocatorType_ID == 0) + { + setIsAvailableForReplenishment (true); +// Y + setIsAvailableForReservation (true); +// Y + setIsAvailableForShipping (true); +// Y + setM_LocatorType_ID (0); + setName (null); + } */ + } + + /** Load Constructor */ + public X_M_LocatorType (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 3 - Client - Org + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_M_LocatorType[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + /** Set Description. + @param Description + Optional short description of the record + */ + public void setDescription (String Description) + { + set_Value (COLUMNNAME_Description, Description); + } + + /** Get Description. + @return Optional short description of the record + */ + public String getDescription () + { + return (String)get_Value(COLUMNNAME_Description); + } + + /** Set Comment/Help. + @param Help + Comment or Hint + */ + public void setHelp (String Help) + { + set_Value (COLUMNNAME_Help, Help); + } + + /** Get Comment/Help. + @return Comment or Hint + */ + public String getHelp () + { + return (String)get_Value(COLUMNNAME_Help); + } + + /** Set Available for Replenishment. + @param IsAvailableForReplenishment Available for Replenishment */ + public void setIsAvailableForReplenishment (boolean IsAvailableForReplenishment) + { + set_Value (COLUMNNAME_IsAvailableForReplenishment, Boolean.valueOf(IsAvailableForReplenishment)); + } + + /** Get Available for Replenishment. + @return Available for Replenishment */ + public boolean isAvailableForReplenishment () + { + Object oo = get_Value(COLUMNNAME_IsAvailableForReplenishment); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Available for Reservation. + @param IsAvailableForReservation Available for Reservation */ + public void setIsAvailableForReservation (boolean IsAvailableForReservation) + { + set_Value (COLUMNNAME_IsAvailableForReservation, Boolean.valueOf(IsAvailableForReservation)); + } + + /** Get Available for Reservation. + @return Available for Reservation */ + public boolean isAvailableForReservation () + { + Object oo = get_Value(COLUMNNAME_IsAvailableForReservation); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Available for Shipping. + @param IsAvailableForShipping Available for Shipping */ + public void setIsAvailableForShipping (boolean IsAvailableForShipping) + { + set_Value (COLUMNNAME_IsAvailableForShipping, Boolean.valueOf(IsAvailableForShipping)); + } + + /** Get Available for Shipping. + @return Available for Shipping */ + public boolean isAvailableForShipping () + { + Object oo = get_Value(COLUMNNAME_IsAvailableForShipping); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + + /** Set Locator Type. + @param M_LocatorType_ID Locator Type */ + public void setM_LocatorType_ID (int M_LocatorType_ID) + { + if (M_LocatorType_ID < 1) + set_ValueNoCheck (COLUMNNAME_M_LocatorType_ID, null); + else + set_ValueNoCheck (COLUMNNAME_M_LocatorType_ID, Integer.valueOf(M_LocatorType_ID)); + } + + /** Get Locator Type. + @return Locator Type */ + public int getM_LocatorType_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_LocatorType_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set M_LocatorType_UU. + @param M_LocatorType_UU M_LocatorType_UU */ + public void setM_LocatorType_UU (String M_LocatorType_UU) + { + set_Value (COLUMNNAME_M_LocatorType_UU, M_LocatorType_UU); + } + + /** Get M_LocatorType_UU. + @return M_LocatorType_UU */ + public String getM_LocatorType_UU () + { + return (String)get_Value(COLUMNNAME_M_LocatorType_UU); + } + + /** Set Name. + @param Name + Alphanumeric identifier of the entity + */ + public void setName (String Name) + { + set_Value (COLUMNNAME_Name, Name); + } + + /** Get Name. + @return Alphanumeric identifier of the entity + */ + public String getName () + { + return (String)get_Value(COLUMNNAME_Name); + } + + /** Get Record ID/ColumnName + @return ID/ColumnName pair + */ + public KeyNamePair getKeyNamePair() + { + return new KeyNamePair(get_ID(), getName()); + } +} \ No newline at end of file diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java index 8e378d5e94..12fe268283 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java @@ -666,6 +666,7 @@ public class InfoProductWindow extends InfoWindow { sql += " w.Name, l.Value " + "FROM M_Storage s" + " INNER JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID)" + + " LEFT JOIN M_LocatorType lt ON (l.M_LocatorType_ID=lt.M_LocatorType_ID)" + " INNER JOIN M_Warehouse w ON (l.M_Warehouse_ID=w.M_Warehouse_ID) " + "WHERE M_Product_ID=?"; if (m_M_Warehouse_ID != 0) @@ -673,6 +674,7 @@ public class InfoProductWindow extends InfoWindow { if (m_M_AttributeSetInstance_ID > 0) sql += " AND s.M_AttributeSetInstance_ID=?"; sql += " AND (s.QtyOnHand<>0 OR s.QtyReserved<>0 OR s.QtyOrdered<>0)"; + sql += " AND COALESCE(lt.IsAvailableForReservation,'Y')='Y'"; if (!showDetail) sql += " GROUP BY productAttribute(s.M_AttributeSetInstance_ID), w.Name, l.Value"; sql += " ORDER BY l.Value"; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InvoiceHistory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InvoiceHistory.java index fa3929f2e1..408c6fec18 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InvoiceHistory.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InvoiceHistory.java @@ -182,10 +182,11 @@ public class InvoiceHistory extends Window implements EventListener confirmPanel.addActionListener(this); Borderlayout borderlayout = new Borderlayout(); - borderlayout.setWidth("700px"); - borderlayout.setHeight("400px"); + this.setWidth("700px"); + this.setHeight("400px"); borderlayout.setStyle("border: none; position: relative"); this.appendChild(borderlayout); + this.setClosable(true); North north = new North(); north.setStyle("border: none"); @@ -615,6 +616,7 @@ public class InvoiceHistory extends Window implements EventListener sql += " w.Name, l.Value " + "FROM M_Storage s" + " INNER JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID)" + + " LEFT JOIN M_LocatorType lt ON (l.M_LocatorType_ID=lt.M_LocatorType_ID)" + " INNER JOIN M_Warehouse w ON (l.M_Warehouse_ID=w.M_Warehouse_ID) " + "WHERE M_Product_ID=?"; if (m_M_Warehouse_ID != 0) @@ -622,6 +624,7 @@ public class InvoiceHistory extends Window implements EventListener if (m_M_AttributeSetInstance_ID > 0) sql += " AND s.M_AttributeSetInstance_ID=?"; sql += " AND (s.QtyOnHand<>0 OR s.QtyReserved<>0 OR s.QtyOrdered<>0)"; + sql += " AND COALESCE(lt.IsAvailableForReservation,'Y')='Y'"; if (!showDetailATP) sql += " GROUP BY productAttribute(s.M_AttributeSetInstance_ID), w.Name, l.Value"; sql += " ORDER BY l.Value"; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocatorDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocatorDialog.java index e2a5ea540f..02aa18aaa4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocatorDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocatorDialog.java @@ -42,6 +42,7 @@ import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Window; import org.compiere.model.MLocator; import org.compiere.model.MLocatorLookup; +import org.compiere.model.MLocatorType; import org.compiere.model.MRole; import org.compiere.util.AdempiereUserError; import org.compiere.util.CLogger; @@ -69,16 +70,18 @@ public class WLocatorDialog extends Window implements EventListener /** * */ - private static final long serialVersionUID = -1013647722305985723L; + private static final long serialVersionUID = -2441739966645819543L; private Grid mainPanel = GridFactory.newGridLayout(); private Listbox lstLocator = new Listbox(); private Listbox lstWarehouse = new Listbox(); + private Listbox lstLocatorType = new Listbox(); private Checkbox chkCreateNew = new Checkbox(); private Textbox txtWarehouse = new Textbox(); + private Textbox txtLocatorType = new Textbox(); private Textbox txtAisleX = new Textbox(); private Textbox txtBinY = new Textbox(); private Textbox txtLevelZ = new Textbox(); @@ -87,6 +90,8 @@ public class WLocatorDialog extends Window implements EventListener private Label lblLocator = new Label(); private Label lblWarehouse = new Label(); private Label lblWarehouse2 = new Label(); + private Label lblLocatorType = new Label(); + private Label lblLocatorType2 = new Label(); private Label lblAisleX = new Label(); private Label lblBinY = new Label(); private Label lblLevelZ = new Label(); @@ -152,6 +157,8 @@ public class WLocatorDialog extends Window implements EventListener lblLocator.setValue(Msg.translate(Env.getCtx(), "M_Locator_ID")); lblWarehouse.setValue(Msg.translate(Env.getCtx(), "M_Warehouse_ID")); lblWarehouse2.setValue(Msg.translate(Env.getCtx(), "M_Warehouse_ID")); + lblLocatorType.setValue(Msg.getElement(Env.getCtx(), "M_LocatorType_ID")); + lblLocatorType2.setValue(Msg.getElement(Env.getCtx(), "M_LocatorType_ID")); lblAisleX.setValue(Msg.getElement(Env.getCtx(), "X")); lblBinY.setValue(Msg.getElement(Env.getCtx(), "Y")); lblLevelZ.setValue(Msg.getElement(Env.getCtx(), "Z")); @@ -166,7 +173,11 @@ public class WLocatorDialog extends Window implements EventListener lstWarehouse.setMold("select"); lstWarehouse.setRows(0); LayoutUtils.addSclass("z-label", lstWarehouse); - + + lstLocatorType.setMold("select"); + lstLocatorType.setRows(0); + LayoutUtils.addSclass("z-label", lstLocatorType); + confirmPanel = new ConfirmPanel(true); confirmPanel.addActionListener(this); @@ -205,7 +216,19 @@ public class WLocatorDialog extends Window implements EventListener row.appendChild(lblWarehouse2); row.appendChild(txtWarehouse); txtWarehouse.setHflex("1"); - + + row = new Row(); + rows.appendChild(row); + row.appendChild(lblLocatorType); + row.appendChild(lstLocatorType); + lstLocatorType.setHflex("1"); + + row = new Row(); + rows.appendChild(row); + row.appendChild(lblLocatorType2); + row.appendChild(txtLocatorType); + txtLocatorType.setHflex("1"); + row = new Row(); rows.appendChild(row); row.appendChild(lblAisleX); @@ -253,7 +276,7 @@ public class WLocatorDialog extends Window implements EventListener this.setClosable(true); this.setBorder("normal"); this.setWidth("260px"); - this.setHeight("300px"); // required fixed height for ZK to auto adjust the position based on available space + this.setHeight("350px"); // required fixed height for ZK to auto adjust the position based on available space this.setShadow(true); this.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED); this.setSizable(true); // Elaine 2009/02/02 - window set to resizable @@ -298,6 +321,38 @@ public class WLocatorDialog extends Window implements EventListener if (log.isLoggable(Level.FINE)) log.fine("Warehouses=" + lstWarehouse.getItemCount()); + // Load Locator Type + sql = "SELECT M_LocatorType_ID, Name FROM M_LocatorType WHERE IsActive='Y'"; + SQL = MRole.getDefault().addAccessSQL( + sql, "M_LocatorType", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO) + + " ORDER BY 2"; + pstmt = null; + rs = null; + KeyNamePair keyEmpty = new KeyNamePair(0, ""); + lstLocatorType.appendItem(keyEmpty.getName(), keyEmpty); + try + { + pstmt = DB.prepareStatement(SQL, null); + rs = pstmt.executeQuery(); + while (rs.next()) + { + KeyNamePair key = new KeyNamePair(rs.getInt(1), rs.getString(2)); + lstLocatorType.appendItem(key.getName(), key); + } + } + catch (SQLException e) + { + log.log(Level.SEVERE, SQL, e); + } + finally + { + DB.close(rs, pstmt); + rs = null; + pstmt = null; + } + + if (log.isLoggable(Level.FINE)) log.fine("LocatorTypes=" + lstLocatorType.getItemCount()); + // Load existing Locators m_mLocator.fillComboBox(m_mandatory, true, true, false, false); // IDEMPIERE 90 @@ -338,7 +393,6 @@ public class WLocatorDialog extends Window implements EventListener enableNew(); lstWarehouse.addEventListener(Events.ON_SELECT, this); - txtAisleX.addEventListener(Events.ON_CHANGE, this); txtBinY.addEventListener(Events.ON_CHANGE, this); txtLevelZ.addEventListener(Events.ON_CHANGE, this); @@ -363,6 +417,14 @@ public class WLocatorDialog extends Window implements EventListener m_M_Locator_ID = l.getM_Locator_ID(); txtWarehouse.setText(l.getWarehouseName()); + + if (l.getM_LocatorType_ID() > 0) { + MLocatorType lt = MLocatorType.get(Env.getCtx(), l.getM_LocatorType_ID()); + txtLocatorType.setText(lt.getName()); + } else { + txtLocatorType.setText(""); + } + txtAisleX.setText(l.getX()); txtBinY.setText(l.getY()); txtLevelZ.setText(l.getZ()); @@ -385,6 +447,19 @@ public class WLocatorDialog extends Window implements EventListener continue; } } + + // Set Locator Type + size = lstLocatorType.getItemCount(); + for (int i = 0; i < size; i++) + { + ListItem listItem = lstLocatorType.getItemAtIndex(i); + KeyNamePair pp = (KeyNamePair)listItem.getValue(); + if (pp.getKey() == l.getM_LocatorType_ID()) + { + lstLocatorType.setSelectedIndex(i); + continue; + } + } } // displayLocator /** @@ -400,8 +475,14 @@ public class WLocatorDialog extends Window implements EventListener //lWarehouseInfo.setVisible(!sel); txtWarehouse.setVisible(!sel); txtWarehouse.getParent().setVisible(!sel); - txtWarehouse.setReadonly(true); + + lstLocatorType.setVisible(sel); + lstLocatorType.getParent().setVisible(sel); + txtLocatorType.setVisible(!sel); + txtLocatorType.getParent().setVisible(!sel); + txtLocatorType.setReadonly(true); + txtAisleX.setReadonly(!sel); txtBinY.setReadonly(!sel); txtLevelZ.setReadonly(!sel); @@ -525,8 +606,14 @@ public class WLocatorDialog extends Window implements EventListener return; } + listitem = lstLocatorType.getSelectedItem(); + pp = (KeyNamePair)listitem.getValue(); + int lt = 0; + if (pp != null) + lt = pp.getKey(); + MLocator loc = MLocator.get(Env.getCtx(), m_M_Warehouse_ID, txtKey.getText(), - txtAisleX.getText(), txtBinY.getText(), txtLevelZ.getText()); + txtAisleX.getText(), txtBinY.getText(), txtLevelZ.getText(), lt); m_M_Locator_ID = loc.getM_Locator_ID(); @@ -596,7 +683,8 @@ public class WLocatorDialog extends Window implements EventListener else if (event.getTarget() == chkCreateNew) enableNew(); // Entered/Changed data for Value - else if (chkCreateNew.isChecked() && event.getTarget() == lstWarehouse) + else if (chkCreateNew.isChecked() + && (event.getTarget() == lstWarehouse || event.getTarget() == txtAisleX || event.getTarget() == txtBinY || event.getTarget() == txtLevelZ)) createValue(); } }