details:   https://code.openbravo.com/erp/devel/pi/rev/2e659cd9b4e5
changeset: 22640:2e659cd9b4e5
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Thu Mar 06 14:11:47 2014 +0100
summary:   related to issue 25732: attr set instance val serial and lot 
contention

  Created methods for getting serial and lots numbers so they can be overwritten
  to behave in a different way, ie. in making them as autonomous transactions, 
this
  is not implemented in core as it would change current transactionality: the 
whole
  attribute set is created within a transaction.

diffstat:

 src/org/openbravo/erpCommon/utility/AttributeSetInstanceValue.java |  28 
+++++++--
 1 files changed, 22 insertions(+), 6 deletions(-)

diffs (52 lines):

diff -r ea70861b5474 -r 2e659cd9b4e5 
src/org/openbravo/erpCommon/utility/AttributeSetInstanceValue.java
--- a/src/org/openbravo/erpCommon/utility/AttributeSetInstanceValue.java        
Thu Mar 06 17:53:50 2014 +0530
+++ b/src/org/openbravo/erpCommon/utility/AttributeSetInstanceValue.java        
Thu Mar 06 14:11:47 2014 +0100
@@ -168,9 +168,7 @@
       String description = "", description_first = "";
       if (data[0].islot.equals("Y")) {
         if (!data[0].mLotctlId.equals("") && (strIsSOTrx.equals("N") || 
strWindow.equals("191"))) {
-          lot = AttributeSetInstanceValueData.selectNextLot(conProv, 
data[0].mLotctlId);
-          AttributeSetInstanceValueData.updateLotSequence(conn, conProv, 
vars.getUser(),
-              data[0].mLotctlId);
+          lot = getNextLotNumber(conProv, vars, data[0].mLotctlId, conn);
           description_first += (description_first.equals("") ? "" : "_") + lot;
         } else {
           description_first += (description_first.equals("") ? "" : "_") + "L" 
+ lot;
@@ -178,9 +176,7 @@
       }
       if (data[0].isserno.equals("Y")) {
         if (!data[0].mSernoctlId.equals("") && (strIsSOTrx.equals("N") || 
strWindow.equals("191"))) {
-          serno = AttributeSetInstanceValueData.selectNextSerNo(conn, conProv, 
data[0].mSernoctlId);
-          AttributeSetInstanceValueData.updateSerNoSequence(conn, conProv, 
vars.getUser(),
-              data[0].mSernoctlId);
+          serno = getNextSerialNumber(conProv, vars, data[0].mSernoctlId, 
conn);
           description_first += (description_first.equals("") ? "" : "_") + 
serno;
         } else {
           description_first += (description_first.equals("") ? "" : "_") + "#" 
+ serno;
@@ -270,6 +266,26 @@
   }
 
   /**
+   * Obtains next serial number and updates its sequence
+   */
+  protected String getNextSerialNumber(ConnectionProvider conProv, 
VariablesSecureApp vars,
+      String mSernoctlId, Connection conn) throws ServletException {
+    String localSerNo = AttributeSetInstanceValueData.selectNextSerNo(conn, 
conProv, mSernoctlId);
+    AttributeSetInstanceValueData.updateSerNoSequence(conn, conProv, 
vars.getUser(), mSernoctlId);
+    return localSerNo;
+  }
+
+  /**
+   * Obtains next lot number and updates its sequence
+   */
+  protected String getNextLotNumber(ConnectionProvider conProv, 
VariablesSecureApp vars,
+      String lotControlId, Connection conn) throws ServletException {
+    String localLotNo = AttributeSetInstanceValueData.selectNextLot(conProv, 
lotControlId);
+    AttributeSetInstanceValueData.updateLotSequence(conn, conProv, 
vars.getUser(), lotControlId);
+    return localLotNo;
+  }
+
+  /**
    * Checks if the record has attachments associated.
    * 
    * @param conProv

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to