implement bop for expedition must recheck and qty in staff purchase need info

This commit is contained in:
ragilap
2025-12-05 14:08:54 +07:00
parent c064fb1765
commit ee2db748ea
15 changed files with 1062 additions and 292 deletions
@@ -151,7 +151,7 @@ func (r *ProductWarehouseRepositoryImpl) AdjustQuantities(ctx context.Context, d
}
if err := base.Model(&entity.ProductWarehouse{}).
Where("id = ?", id).
Update("quantity", gorm.Expr("COALESCE(quantity,0) + ?", delta)).Error; err != nil {
Update("qty", gorm.Expr("COALESCE(qty,0) + ?", delta)).Error; err != nil {
return err
}
}
@@ -171,7 +171,7 @@ func (r *ProductWarehouseRepositoryImpl) CleanupEmpty(ctx context.Context, affec
var emptyIDs []uint
if err := r.DB().WithContext(ctx).
Model(&entity.ProductWarehouse{}).
Where("id IN ? AND COALESCE(quantity,0) <= 0", ids).
Where("id IN ? AND COALESCE(qty,0) <= 0", ids).
Pluck("id", &emptyIDs).Error; err != nil {
return err
}