Author: bleny Date: 2013-03-29 10:49:13 +0100 (Fri, 29 Mar 2013) New Revision: 56 Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revisions... Log: suggest quantity to withdraw when on extra site Modified: trunk/magalie-web/src/main/webapp/js/withdraw-item-input.js Modified: trunk/magalie-web/src/main/webapp/js/withdraw-item-input.js =================================================================== --- trunk/magalie-web/src/main/webapp/js/withdraw-item-input.js 2013-03-28 15:22:04 UTC (rev 55) +++ trunk/magalie-web/src/main/webapp/js/withdraw-item-input.js 2013-03-29 09:49:13 UTC (rev 56) @@ -91,7 +91,9 @@ } var storageMovement = this.getStorageMovement(barcode); storageMovement.used = true; - storageMovement.defect = quantity != storageMovement.expectedQuantity; + storageMovement.defect = + storageMovement.expectedQuantity != 0. // don't mark a site in error just because we wasn't supposed to withdraw item from it in the order + && quantity != storageMovement.expectedQuantity; storageMovement.withdrawn = quantity; }; @@ -106,6 +108,16 @@ this.storageMovementsIndex += 1; if (this.storageMovementsIndex >= this.storageMovements.length) { this.storageMovementsIndex = null; + } else { + var storageMovement = this.storageMovements[this.storageMovementsIndex]; + if (storageMovement.expectedQuantity == 0.) { + console.debug("will use extra site " + storageMovement.originSite.locationCode); + var remainingQuantity = this.quantity - this.withdrawn(); + storageMovement.expectedQuantity = remainingQuantity; +// var availableQuantityInSite = storageMovement.availableQuantity; +// storageMovement.expectedQuantity = Math.min(remainingQuantity, availableQuantityInSite); + console.debug("pushing new value to withdraw: " + storageMovement.expectedQuantity); + } } }; @@ -204,7 +216,7 @@ } else { var barcode = $('#withdraw-item_siteBarcode').val(); - var quantity = parseInt($('#withdraw-item_quantity').val()); + var quantity = parseFloat($('#withdraw-item_quantity').val()); model.withdraw(barcode, quantity);
participants (1)
-
bleny@users.forge.codelutin.com