dos2unix on pl/pgsql functions
Add BOM_Qty_AvailableASI, nextIDFunc
This commit is contained in:
parent
ab54e5b240
commit
6fc6478b92
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
*This file is part of Adempiere ERP Bazaar
|
||||||
|
*http://www.adempiere.org
|
||||||
|
*Copyright (C) 2006-2008 carlos.ruiz@globalqss.com, GlobalQSS
|
||||||
|
*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.of
|
||||||
|
*/
|
||||||
|
CREATE OR REPLACE FUNCTION bomQtyAvailableASI(Product_ID numeric, AttributeSetInstance_ID numeric, Warehouse_ID numeric ,Locator_ID numeric)
|
||||||
|
RETURNS numeric AS
|
||||||
|
$BODY$
|
||||||
|
BEGIN
|
||||||
|
RETURN bomQtyOnHandASI(Product_ID, AttributeSetInstance_ID, Warehouse_ID, Locator_ID) -
|
||||||
|
bomQtyReservedASI(Product_ID, AttributeSetInstance_ID, Warehouse_ID, Locator_ID);
|
||||||
|
END;
|
||||||
|
$BODY$
|
||||||
|
LANGUAGE 'plpgsql' STABLE STRICT
|
||||||
|
COST 100;
|
|
@ -0,0 +1,55 @@
|
||||||
|
CREATE OR REPLACE FUNCTION nextid(
|
||||||
|
p_AD_Sequence_ID IN INTEGER,
|
||||||
|
p_System IN VARCHAR,
|
||||||
|
o_NextID OUT INTEGER
|
||||||
|
)
|
||||||
|
RETURNS INTEGER AS $body$
|
||||||
|
/*************************************************************************
|
||||||
|
* The contents of this file are subject to the Compiere License. You may
|
||||||
|
* obtain a copy of the License at http://www.compiere.org/license.html
|
||||||
|
* Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
|
||||||
|
* express or implied. See the License for details. Code: Compiere ERP+CRM
|
||||||
|
* Copyright (C) 1999-2005 Jorg Janke, ComPiere, Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* converted to postgreSQL by Karsten Thiemann (Schaeffer AG),
|
||||||
|
* kthiemann@adempiere.org
|
||||||
|
*************************************************************************
|
||||||
|
***
|
||||||
|
* Title: Get Next ID - no Commit
|
||||||
|
* Description: Returns the next id of the sequence.
|
||||||
|
* Test:
|
||||||
|
* select * from nextid((select ad_sequence_id from ad_sequence where name = 'Test')::Integer, 'Y'::Varchar);
|
||||||
|
*
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
BEGIN
|
||||||
|
IF (p_System = 'Y') THEN
|
||||||
|
RAISE NOTICE 'system';
|
||||||
|
SELECT CurrentNextSys
|
||||||
|
INTO o_NextID
|
||||||
|
FROM AD_Sequence
|
||||||
|
WHERE AD_Sequence_ID=p_AD_Sequence_ID;
|
||||||
|
--
|
||||||
|
UPDATE AD_Sequence
|
||||||
|
SET CurrentNextSys = CurrentNextSys + IncrementNo
|
||||||
|
WHERE AD_Sequence_ID=p_AD_Sequence_ID;
|
||||||
|
ELSE
|
||||||
|
SELECT CurrentNext
|
||||||
|
INTO o_NextID
|
||||||
|
FROM AD_Sequence
|
||||||
|
WHERE AD_Sequence_ID=p_AD_Sequence_ID;
|
||||||
|
--
|
||||||
|
UPDATE AD_Sequence
|
||||||
|
SET CurrentNext = CurrentNext + IncrementNo
|
||||||
|
WHERE AD_Sequence_ID=p_AD_Sequence_ID;
|
||||||
|
END IF;
|
||||||
|
--
|
||||||
|
EXCEPTION
|
||||||
|
WHEN OTHERS THEN
|
||||||
|
RAISE NOTICE '%',SQLERRM;
|
||||||
|
END;
|
||||||
|
|
||||||
|
$body$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,55 +1,10 @@
|
||||||
CREATE OR REPLACE FUNCTION nextid(
|
CREATE OR REPLACE FUNCTION nextidfunc(
|
||||||
p_AD_Sequence_ID IN INTEGER,
|
p_AD_Sequence_ID IN INTEGER,
|
||||||
p_System IN VARCHAR,
|
p_System IN VARCHAR,
|
||||||
o_NextID OUT INTEGER
|
o_NextID OUT INTEGER
|
||||||
)
|
)
|
||||||
RETURNS INTEGER AS $body$
|
RETURNS INTEGER AS $body$
|
||||||
/*************************************************************************
|
|
||||||
* The contents of this file are subject to the Compiere License. You may
|
|
||||||
* obtain a copy of the License at http://www.compiere.org/license.html
|
|
||||||
* Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
|
|
||||||
* express or implied. See the License for details. Code: Compiere ERP+CRM
|
|
||||||
* Copyright (C) 1999-2005 Jorg Janke, ComPiere, Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* converted to postgreSQL by Karsten Thiemann (Schaeffer AG),
|
|
||||||
* kthiemann@adempiere.org
|
|
||||||
*************************************************************************
|
|
||||||
***
|
|
||||||
* Title: Get Next ID - no Commit
|
|
||||||
* Description: Returns the next id of the sequence.
|
|
||||||
* Test:
|
|
||||||
* select * from nextid((select ad_sequence_id from ad_sequence where name = 'Test')::Integer, 'Y'::Varchar);
|
|
||||||
*
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
IF (p_System = 'Y') THEN
|
RETURN nextid(p_AD_Sequence_ID, p_System, o_NextID);
|
||||||
RAISE NOTICE 'system';
|
|
||||||
SELECT CurrentNextSys
|
|
||||||
INTO o_NextID
|
|
||||||
FROM AD_Sequence
|
|
||||||
WHERE AD_Sequence_ID=p_AD_Sequence_ID;
|
|
||||||
--
|
|
||||||
UPDATE AD_Sequence
|
|
||||||
SET CurrentNextSys = CurrentNextSys + IncrementNo
|
|
||||||
WHERE AD_Sequence_ID=p_AD_Sequence_ID;
|
|
||||||
ELSE
|
|
||||||
SELECT CurrentNext
|
|
||||||
INTO o_NextID
|
|
||||||
FROM AD_Sequence
|
|
||||||
WHERE AD_Sequence_ID=p_AD_Sequence_ID;
|
|
||||||
--
|
|
||||||
UPDATE AD_Sequence
|
|
||||||
SET CurrentNext = CurrentNext + IncrementNo
|
|
||||||
WHERE AD_Sequence_ID=p_AD_Sequence_ID;
|
|
||||||
END IF;
|
|
||||||
--
|
|
||||||
EXCEPTION
|
|
||||||
WHEN OTHERS THEN
|
|
||||||
RAISE NOTICE '%',SQLERRM;
|
|
||||||
END;
|
END;
|
||||||
|
|
||||||
$body$ LANGUAGE plpgsql;
|
$body$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue