[Reservations]Add procedures definition.
authorGorka Ion Damián <gorkaion.damian@openbravo.com>
Wed, 17 Oct 2012 10:51:07 +0200
changeset 18644 765a5878c35f
parent 18643 923d07185690
child 18645 33469aeb6413
[Reservations]Add procedures definition.
src-db/database/model/functions/M_ADD_RESERVED_STOCK.xml
src-db/database/model/functions/M_CREATE_RESERVE_FROM_SOL.xml
src-db/database/model/functions/M_CREATE_RESERVE_STOCK.xml
src-db/database/model/functions/M_RESERVE_POST.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/functions/M_ADD_RESERVED_STOCK.xml	Wed Oct 17 10:51:07 2012 +0200
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+  <database name="FUNCTION M_ADD_RESERVED_STOCK">
+    <function name="M_ADD_RESERVED_STOCK" type="VARCHAR">
+      <parameter name="p_reserve_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_storage_detail_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_po_line_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_qty" type="NUMERIC" mode="in">
+        <default/>
+      </parameter>
+      <body><![CDATA[/*************************************************************************
+* The contents of this file are subject to the Openbravo  Public  License
+* Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+* Version 1.1  with a permitted attribution clause; you may not  use this
+* file except in compliance with the License. You  may  obtain  a copy of
+* the License at http://www.openbravo.com/legal/license.html
+* Software distributed under the License  is  distributed  on  an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+* License for the specific  language  governing  rights  and  limitations
+* under the License.
+* The Original Code is Openbravo ERP.
+* The Initial Developer of the Original Code is Openbravo SLU
+* All portions are Copyright (C) 2012 Openbravo SLU
+* All Rights Reserved.
+* Contributor(s):  ______________________________________.
+************************************************************************/
+/*************
+* Function to reserve given stock or purchase order line.
+**************/
+  v_product_id    VARCHAR2(32);
+  v_uom_id        VARCHAR2(32);
+  v_qty           NUMBER;
+  v_message       VARCHAR2(2000) := '';
+BEGIN
+
+
+
+
+  RETURN v_message;
+END M_ADD_RESERVED_STOCK]]></body>
+    </function>
+  </database>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/functions/M_CREATE_RESERVE_FROM_SOL.xml	Wed Oct 17 10:51:07 2012 +0200
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+  <database name="FUNCTION M_CREATE_RESERVE_FROM_SOL">
+    <function name="M_CREATE_RESERVE_FROM_SOL" type="VARCHAR">
+      <parameter name="p_orderline_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_process_reserve" type="CHAR" mode="in">
+        <default/>
+      </parameter>
+      <body><![CDATA[/*************************************************************************
+* The contents of this file are subject to the Openbravo  Public  License
+* Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+* Version 1.1  with a permitted attribution clause; you may not  use this
+* file except in compliance with the License. You  may  obtain  a copy of
+* the License at http://www.openbravo.com/legal/license.html
+* Software distributed under the License  is  distributed  on  an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+* License for the specific  language  governing  rights  and  limitations
+* under the License.
+* The Original Code is Openbravo ERP.
+* The Initial Developer of the Original Code is Openbravo SLU
+* All portions are Copyright (C) 2012 Openbravo SLU
+* All Rights Reserved.
+* Contributor(s):  ______________________________________.
+************************************************************************/
+/*************
+* Function to create reservations for the given Sales Order Line.
+**************/
+  v_product_id    VARCHAR2(32);
+  v_uom_id        VARCHAR2(32);
+  v_qty           NUMBER;
+  v_reserve_id    VARCHAR2(32) := get_uuid();
+BEGIN
+  SELECT m_product_id, c_uom_id, qtyordered - qtydelivered
+    INTO v_product_id, v_uom_id, v_qty
+  FROM c_orderline
+  WHERE c_orderline_id = p_orderline_id;
+
+
+
+
+  RETURN v_reserve_id;
+END M_CREATE_RESERVE_FROM_SOL]]></body>
+    </function>
+  </database>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/functions/M_CREATE_RESERVE_STOCK.xml	Wed Oct 17 10:51:07 2012 +0200
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+  <database name="FUNCTION M_CREATE_RESERVE_STOCK">
+    <function name="M_CREATE_RESERVE_STOCK" type="VARCHAR">
+      <parameter name="p_reserve_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <body><![CDATA[/*************************************************************************
+* The contents of this file are subject to the Openbravo  Public  License
+* Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+* Version 1.1  with a permitted attribution clause; you may not  use this
+* file except in compliance with the License. You  may  obtain  a copy of
+* the License at http://www.openbravo.com/legal/license.html
+* Software distributed under the License  is  distributed  on  an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+* License for the specific  language  governing  rights  and  limitations
+* under the License.
+* The Original Code is Openbravo ERP.
+* The Initial Developer of the Original Code is Openbravo SLU
+* All portions are Copyright (C) 2012 Openbravo SLU
+* All Rights Reserved.
+* Contributor(s):  ______________________________________.
+************************************************************************/
+/*************
+* Function to reserve stock using the get stock function.
+**************/
+  v_product_id    VARCHAR2(32);
+  v_uom_id        VARCHAR2(32);
+  v_qty           NUMBER;
+  v_message       VARCHAR2(2000) := '';
+BEGIN
+
+
+
+
+  RETURN v_message;
+END M_CREATE_RESERVE_STOCK]]></body>
+    </function>
+  </database>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/functions/M_RESERVE_POST.xml	Wed Oct 17 10:51:07 2012 +0200
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+  <database name="FUNCTION M_RESERVE_POST">
+    <function name="M_RESERVE_POST" type="NULL">
+      <parameter name="p_pinstance_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <body><![CDATA[/*************************************************************************
+* The contents of this file are subject to the Openbravo  Public  License
+* Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+* Version 1.1  with a permitted attribution clause; you may not  use this
+* file except in compliance with the License. You  may  obtain  a copy of
+* the License at http://www.openbravo.com/legal/license.html
+* Software distributed under the License  is  distributed  on  an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+* License for the specific  language  governing  rights  and  limitations
+* under the License.
+* The Original Code is Openbravo ERP.
+* The Initial Developer of the Original Code is Openbravo SLU
+* All portions are Copyright (C) 2012 Openbravo SLU
+* All Rights Reserved.
+* Contributor(s):  ______________________________________.
+************************************************************************/
+  v_ResultStr VARCHAR2(2000):='';
+  v_Message VARCHAR2(2000):='';
+  v_Record_ID VARCHAR2(32);
+  v_Result NUMBER:=1; --  Success
+
+
+TYPE RECORD IS REF CURSOR;
+  Cur_Parameter RECORD;
+
+BEGIN
+  IF (p_PInstance_ID IS NOT NULL) THEN
+    --  Update AD_PInstance
+    DBMS_OUTPUT.PUT_LINE('Updating PInstance - Processing ' || p_PInstance_ID) ;
+    v_ResultStr:='PInstanceNotFound';
+    AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'Y', NULL, NULL) ;
+    --  Get Parameters
+    v_ResultStr:='ReadingParameters';
+    FOR Cur_Parameter IN
+      (SELECT i.Record_ID, i.AD_User_ID, p.ParameterName, p.P_String, p.P_Number, p.P_Date
+      FROM AD_PInstance i
+      LEFT JOIN AD_PInstance_Para p
+        ON i.AD_PInstance_ID=p.AD_PInstance_ID
+      WHERE i.AD_PInstance_ID=p_PInstance_ID
+      ORDER BY p.SeqNo
+      )
+    LOOP
+      v_Record_ID:=Cur_Parameter.Record_ID;
+    END LOOP; --  Get Parameter
+    DBMS_OUTPUT.PUT_LINE('  v_Record_ID=' || v_Record_ID) ;
+  END IF;
+
+END M_RESERVE_POST
+]]></body>
+    </function>
+  </database>