mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 05:21:57 +00:00
Merge branch 'fix/adjustment-population-chickin' into 'development'
fix asof chickin adjustment See merge request mbugroup/lti-api!377
This commit is contained in:
@@ -37,6 +37,7 @@ import (
|
||||
const (
|
||||
chickinDeletePopulationGuardMessage = "Chickin tidak dapat dihapus karena masih memiliki population aktif"
|
||||
chickinDeleteDownstreamGuardMessage = "Chickin tidak bisa dihapus karena masih dipakai oleh transaksi turunan. Hapus/unexecute Marketing, Recording, Transfer, Adjustment, dan Transfer to Laying terlebih dahulu."
|
||||
chickinAdjustmentSourceTable = "adjustment_stocks"
|
||||
)
|
||||
|
||||
type ChickinService interface {
|
||||
@@ -577,7 +578,7 @@ func (s *chickinService) resolveLayingSourceAvailableQty(ctx context.Context, tx
|
||||
Lane: commonSvc.FifoStockV2Lane("STOCKABLE"),
|
||||
AllocationPurpose: entity.StockAllocationPurposeConsume,
|
||||
ProductWarehouseID: productWarehouseID,
|
||||
AsOf: asOf,
|
||||
AsOf: nil,
|
||||
Limit: 10000,
|
||||
Tx: tx,
|
||||
})
|
||||
@@ -586,10 +587,16 @@ func (s *chickinService) resolveLayingSourceAvailableQty(ctx context.Context, tx
|
||||
}
|
||||
|
||||
available := 0.0
|
||||
hasAsOf := asOf != nil && !asOf.IsZero()
|
||||
for _, row := range gatherRows {
|
||||
if row.AvailableQuantity <= 0 {
|
||||
continue
|
||||
}
|
||||
if hasAsOf &&
|
||||
!strings.EqualFold(strings.TrimSpace(row.SourceTable), chickinAdjustmentSourceTable) &&
|
||||
row.SortAt.After(*asOf) {
|
||||
continue
|
||||
}
|
||||
available += row.AvailableQuantity
|
||||
}
|
||||
return available, nil
|
||||
|
||||
Reference in New Issue
Block a user