Comparing version 3.0.30 to 3.0.31
@@ -21,3 +21,3 @@ (function() { | ||
almexWsUrl = process.env.ALMEX_WS_URL || "http://201.157.61.34:8989/CkIntegracionGeneral"; | ||
almexWsUrl = process.env.ALMEX_WS_URL || "http://138.128.190.226:8085/CkIntegracionGeneral"; | ||
@@ -49,2 +49,3 @@ module.exports = AlmexApi = (function() { | ||
this.getStocksPaginated = __bind(this.getStocksPaginated, this); | ||
this.getStocksCalidad = __bind(this.getStocksCalidad, this); | ||
this.getStocks = __bind(this.getStocks, this); | ||
@@ -69,2 +70,5 @@ auth = (function(_this) { | ||
}, | ||
stocksCalidad: { | ||
endpoint: "Jobs" | ||
}, | ||
stocksPaginated: { | ||
@@ -142,2 +146,38 @@ endpoint: "Jobs" | ||
AlmexApi.prototype.getStocksCalidad = function(skus) { | ||
return this._doRequest(this.requests.stocksCalidad, (function(_this) { | ||
return function() { | ||
return _this.adaptSkus(skus); | ||
}; | ||
})(this)).then((function(_this) { | ||
return function(xml) { | ||
var stocks; | ||
stocks = _this._getResult(xml, "ProductoInventarioMethodEdoCal"); | ||
return stocks.filter(function(it) { | ||
return it.descripcion !== "No existe ningun registro con la orden especificada"; | ||
}).map(function(product) { | ||
var findByCalidad, _ref, _ref1; | ||
findByCalidad = function(edo) { | ||
var _ref; | ||
return (_ref = _.find(product.calidad, function(it) { | ||
return it.edo[0] === edo; | ||
})) != null ? _ref.cantidad[0] : void 0; | ||
}; | ||
return _.assign(product, { | ||
identifier: (_ref = product.productoSku) != null ? _ref[0] : void 0, | ||
name: product.descripcion[0], | ||
stock: parseInt(findByCalidad("A") || 0) + parseInt(((_ref1 = product.cantidadSurtir) != null ? _ref1[0] : void 0) || 0), | ||
quarantine_stock: parseInt(findByCalidad("Q") || 0), | ||
damaged_stock: parseInt(findByCalidad("D") || 0) | ||
}); | ||
}); | ||
}; | ||
})(this)); | ||
}; | ||
/* | ||
Get the stocks for the given skus. | ||
*/ | ||
AlmexApi.prototype.getStocksPaginated = function(page, top) { | ||
@@ -144,0 +184,0 @@ var paginationXml; |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "3.0.30", | ||
"version": "3.0.31", | ||
"main": "build/almexApi.js", | ||
@@ -11,0 +11,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
69317
47
621