fix the bug of Tracking Number Available Qty

fix the bug of Tracking Number Available Qty ( stock moves =>  move lines => Tracking Number)
This commit is contained in:
walid seghier
2022-11-22 11:31:02 +01:00
parent 07c02a7f53
commit 1151b1d015
3 changed files with 28 additions and 3 deletions

View File

@@ -47,8 +47,8 @@ public class TrackingNumberManagementRepository extends TrackingNumberRepository
if (stockLocation != null) { if (stockLocation != null) {
BigDecimal availableQty = BigDecimal availableQty =
stockLocationLineService.getAvailableQty( stockLocationLineService.getTrackingNumberAvailableQty(
stockLocation, trackingNumber.getProduct()); stockLocation, trackingNumber);
json.put("$availableQty", availableQty); json.put("$availableQty", availableQty);
} }

View File

@@ -246,4 +246,15 @@ public interface StockLocationLineService {
* @param stockMoveLine the move line responsible for the WAP change. * @param stockMoveLine the move line responsible for the WAP change.
*/ */
void updateWap(StockLocationLine stockLocationLine, BigDecimal wap, StockMoveLine stockMoveLine); void updateWap(StockLocationLine stockLocationLine, BigDecimal wap, StockMoveLine stockMoveLine);
/**
* Allow to get the available qty of product for a given Tracking Number.
*
* @param stockLocation
* @param trackingNumber
* @return
*/
public BigDecimal getTrackingNumberAvailableQty(
StockLocation stockLocation, TrackingNumber trackingNumber);
} }

View File

@@ -741,4 +741,18 @@ public class StockLocationLineServiceImpl implements StockLocationLineService {
stockLocationLine.getUnit(), stockLocationLine.getUnit(),
stockMoveLine)); stockMoveLine));
} }
@Override
public BigDecimal getTrackingNumberAvailableQty(
StockLocation stockLocation, TrackingNumber trackingNumber) {
StockLocationLine detailStockLocationLine =
getDetailLocationLine(stockLocation, trackingNumber.getProduct(), trackingNumber);
BigDecimal availableQty = BigDecimal.ZERO;
if (detailStockLocationLine != null) {
availableQty = detailStockLocationLine.getCurrentQty();
}
return availableQty;
}
} }