From 29339825b6d998a6b4fe1c4168c4c5bfc465a2dd Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 25 Oct 2013 12:09:39 +0800 Subject: [PATCH] IDEMPIERE-1459 - Improving performance on InfoWindows IDEMPIERE-386 --- .../oracle/201310250407_IDEMPIERE-1459.sql | 66 +++++++++++++++++++ .../201310250407_IDEMPIERE-1459.sql | 66 +++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 migration/i1.0z/oracle/201310250407_IDEMPIERE-1459.sql create mode 100644 migration/i1.0z/postgresql/201310250407_IDEMPIERE-1459.sql diff --git a/migration/i1.0z/oracle/201310250407_IDEMPIERE-1459.sql b/migration/i1.0z/oracle/201310250407_IDEMPIERE-1459.sql new file mode 100644 index 0000000000..46d4dea544 --- /dev/null +++ b/migration/i1.0z/oracle/201310250407_IDEMPIERE-1459.sql @@ -0,0 +1,66 @@ +--IDEMPIERE-1459 - Improving performance on InfoWindows +CREATE OR REPLACE VIEW m_storage +AS + SELECT s.m_product_id, + s.m_locator_id, + s.ad_client_id, + s.ad_org_id, + s.isactive, + s.created, + s.createdby, + s.updated, + s.updatedby, + s.qtyonhand, + 0 AS qtyreserved, + 0 AS qtyordered, + s.datelastinventory, + s.m_attributesetinstance_id, + s.m_storageonhand_uu AS m_storage_uu, + s.datematerialpolicy AS datematerialpolicy + FROM m_storageonhand s + UNION ALL + SELECT sr.m_product_id, + w.m_reservelocator_id AS m_locator_id, + sr.ad_client_id, + sr.ad_org_id, + sr.isactive, + sr.created, + sr.createdby, + sr.updated, + sr.updatedby, + 0 AS qtyonhand, + sr.qty AS qtyreserved, + 0 AS qtyordered, + sr.datelastinventory, + sr.m_attributesetinstance_id, + sr.m_storagereservation_uu AS m_storage_uu, + null as datematerialpolicy + FROM m_storagereservation sr + JOIN m_warehouse w + ON sr.m_warehouse_id = w.m_warehouse_id + WHERE sr.issotrx = 'Y' and sr.qty <> 0 + UNION ALL + SELECT so.m_product_id, + w.m_reservelocator_id AS m_locator_id, + so.ad_client_id, + so.ad_org_id, + so.isactive, + so.created, + so.createdby, + so.updated, + so.updatedby, + 0 AS qtyonhand, + 0 AS qtyreserved, + so.qty AS qtyordered, + so.datelastinventory, + so.m_attributesetinstance_id, + so.m_storagereservation_uu AS m_storage_uu, + null as datematerialpolicy + FROM m_storagereservation so + JOIN m_warehouse w + ON so.m_warehouse_id = w.m_warehouse_id + WHERE so.issotrx = 'N' and so.qty <> 0 +; + +SELECT register_migration_script('201310250407_IDEMPIERE-1459.sql') FROM dual +; diff --git a/migration/i1.0z/postgresql/201310250407_IDEMPIERE-1459.sql b/migration/i1.0z/postgresql/201310250407_IDEMPIERE-1459.sql new file mode 100644 index 0000000000..46d4dea544 --- /dev/null +++ b/migration/i1.0z/postgresql/201310250407_IDEMPIERE-1459.sql @@ -0,0 +1,66 @@ +--IDEMPIERE-1459 - Improving performance on InfoWindows +CREATE OR REPLACE VIEW m_storage +AS + SELECT s.m_product_id, + s.m_locator_id, + s.ad_client_id, + s.ad_org_id, + s.isactive, + s.created, + s.createdby, + s.updated, + s.updatedby, + s.qtyonhand, + 0 AS qtyreserved, + 0 AS qtyordered, + s.datelastinventory, + s.m_attributesetinstance_id, + s.m_storageonhand_uu AS m_storage_uu, + s.datematerialpolicy AS datematerialpolicy + FROM m_storageonhand s + UNION ALL + SELECT sr.m_product_id, + w.m_reservelocator_id AS m_locator_id, + sr.ad_client_id, + sr.ad_org_id, + sr.isactive, + sr.created, + sr.createdby, + sr.updated, + sr.updatedby, + 0 AS qtyonhand, + sr.qty AS qtyreserved, + 0 AS qtyordered, + sr.datelastinventory, + sr.m_attributesetinstance_id, + sr.m_storagereservation_uu AS m_storage_uu, + null as datematerialpolicy + FROM m_storagereservation sr + JOIN m_warehouse w + ON sr.m_warehouse_id = w.m_warehouse_id + WHERE sr.issotrx = 'Y' and sr.qty <> 0 + UNION ALL + SELECT so.m_product_id, + w.m_reservelocator_id AS m_locator_id, + so.ad_client_id, + so.ad_org_id, + so.isactive, + so.created, + so.createdby, + so.updated, + so.updatedby, + 0 AS qtyonhand, + 0 AS qtyreserved, + so.qty AS qtyordered, + so.datelastinventory, + so.m_attributesetinstance_id, + so.m_storagereservation_uu AS m_storage_uu, + null as datematerialpolicy + FROM m_storagereservation so + JOIN m_warehouse w + ON so.m_warehouse_id = w.m_warehouse_id + WHERE so.issotrx = 'N' and so.qty <> 0 +; + +SELECT register_migration_script('201310250407_IDEMPIERE-1459.sql') FROM dual +;