Related to issue 28909
authorEduardo Argal Guibert <eduardo.argal@openbravo.com>
Fri, 06 Mar 2015 11:31:38 +0100
changeset 26137 ab393536c4bc
parent 26136 95f9c5ce6207
child 26139 9e1c26ee24ab
Related to issue 28909
can't create orders in Oracle. Created StockUtils class to enable calls to M_GET_STOCK_PARAM procedure
getting out params

H : Enter commit message. Lines beginning with 'HG:' are removed.
src/org/openbravo/materialmgmt/CSResponseGetStockParam.java
src/org/openbravo/materialmgmt/StockUtils.java
src/org/openbravo/materialmgmt/StockUtils_data.xsql
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/materialmgmt/CSResponseGetStockParam.java	Fri Mar 06 11:31:38 2015 +0100
@@ -0,0 +1,24 @@
+/*
+ *************************************************************************
+ * 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) 2015 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.materialmgmt;
+
+public class CSResponseGetStockParam {
+  String p_result;
+  String p_message;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/materialmgmt/StockUtils.java	Fri Mar 06 11:31:38 2015 +0100
@@ -0,0 +1,47 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (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) 2015 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ *************************************************************************
+ */
+package org.openbravo.materialmgmt;
+
+import java.math.BigDecimal;
+
+import javax.servlet.ServletException;
+
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.exception.NoConnectionAvailableException;
+import org.openbravo.service.db.DalConnectionProvider;
+
+public class StockUtils {
+  /*
+   * Calls M_GET_STOCK_PARAM and retrieves result in a CSResponseGetStockParam object. Records will
+   * be created in M_STOCK_PROPOSAL with AD_PINSTASNCE_ID = uuid (parameter).
+   */
+  public static CSResponseGetStockParam getStock(String uuid, String recordId, BigDecimal quantity,
+      String mProductId, String mLocatorId, String mWarehouseId, String priorityWarehouseId,
+      String adOrgId, String mAttributeSetInstanceId, String adUserId, String adClientId,
+      String warehouseRuleId, String cUomId, String productUomId, String adTableId, String auxId,
+      Long lineNo, String processId, String mReservationId, String calledFromApp)
+      throws ServletException, NoConnectionAvailableException {
+    return StockUtilsData.getStock(OBDal.getInstance().getConnection(true),
+        new DalConnectionProvider(true), uuid, recordId, quantity != null ? quantity.toString()
+            : null, mProductId, mLocatorId, mWarehouseId, priorityWarehouseId, adOrgId,
+        mAttributeSetInstanceId, adUserId, adClientId, warehouseRuleId, cUomId, productUomId,
+        adTableId, auxId, lineNo != null ? lineNo.toString() : null, processId, mReservationId,
+        calledFromApp);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/materialmgmt/StockUtils_data.xsql	Fri Mar 06 11:31:38 2015 +0100
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ *************************************************************************
+ * 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):  ______________________________________.
+ ************************************************************************
+-->
+
+
+<SqlClass name="StockUtilsData" package="org.openbravo.materialmgmt">
+   <SqlClassComment></SqlClassComment>
+   <SqlMethod name="select" type="preparedStatement" return="multiple">
+     <Sql>
+       select 1 as a from dual
+     </Sql>
+   </SqlMethod>
+   <SqlMethod name="getStock" type="callableStatement" connection="true" return="object" object="CSResponseGetStockParam">
+      <SqlMethodComment></SqlMethodComment>
+      <Sql><![CDATA[
+        CALL M_GET_STOCK_PARAM(?, ?, to_number(?), 
+        ?, ?, ?, 
+        ?, ?, ?, 
+        ?, ?, ?, 
+        ?, ?, ?, ?,
+        to_number(?), ?, ?, 
+        ?, ?, ?)
+      ]]></Sql>
+      <Parameter name="p_uuid"/>
+      <Parameter name="p_recordid"/>
+      <Parameter name="p_quantity"/>
+      
+      <Parameter name="p_productid"/>
+      <Parameter name="p_locatorid"/>
+      <Parameter name="p_warehouseid"/>
+      
+      <Parameter name="p_prioritywarehouseid"/>
+      <Parameter name="p_orgid"/>
+      <Parameter name="p_attributesetinstanceid"/>
+      
+      <Parameter name="p_ad_user_id"/>
+      <Parameter name="p_clientid"/>
+      <Parameter name="p_warehouse_rule_id"/>
+      
+      <Parameter name="p_uomid"/>
+      <Parameter name="p_productuomid"/>
+      <Parameter name="p_table"/>
+      <Parameter name="p_auxid"/>
+
+      <Parameter name="p_lineno"/>
+      <Parameter name="p_processid"/>
+      <Parameter name="p_reservation_id"/>
+      
+      <Parameter name="p_calledfromapp"/>
+
+      <Parameter name="p_result" type="out"/>
+      <Parameter name="p_message" type="out"/>
+   </SqlMethod>
+   
+</SqlClass>