mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-25 07:45:44 +00:00
fix: chickin include stock allocation, fix calculation hpp
This commit is contained in:
@@ -157,6 +157,7 @@ func (s *fifoStockV2Service) allocateInternal(ctx context.Context, tx *gorm.DB,
|
||||
"usable_id": req.Usable.ID,
|
||||
"qty": portion,
|
||||
"status": activeAllocationStatus(),
|
||||
"allocation_purpose": defaultAllocationPurpose(),
|
||||
"created_at": now,
|
||||
"updated_at": now,
|
||||
"engine_version": "v2",
|
||||
@@ -591,7 +592,7 @@ func (s *fifoStockV2Service) loadActiveAllocations(
|
||||
) ([]allocationRow, error) {
|
||||
query := tx.Table("stock_allocations").
|
||||
Select("id, product_warehouse_id, stockable_type, stockable_id, usable_type, usable_id, qty, status, created_at").
|
||||
Where("usable_type = ? AND usable_id = ? AND status = ?", usableType, usableID, activeAllocationStatus())
|
||||
Where("usable_type = ? AND usable_id = ? AND status = ? AND allocation_purpose = ?", usableType, usableID, activeAllocationStatus(), defaultAllocationPurpose())
|
||||
if productWarehouseID > 0 {
|
||||
query = query.Where("product_warehouse_id = ?", productWarehouseID)
|
||||
}
|
||||
@@ -690,6 +691,7 @@ func (s *fifoStockV2Service) resolveRollbackFlagGroup(ctx context.Context, tx *g
|
||||
Select("flag_group_code").
|
||||
Where("usable_type = ? AND usable_id = ?", req.Usable.LegacyTypeKey, req.Usable.ID).
|
||||
Where("engine_version = 'v2'").
|
||||
Where("allocation_purpose = ?", defaultAllocationPurpose()).
|
||||
Where("flag_group_code IS NOT NULL AND flag_group_code <> ''").
|
||||
Order("id DESC").
|
||||
Limit(1).
|
||||
|
||||
Reference in New Issue
Block a user