mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-25 07:45:44 +00:00
Fix adjusment stock chickin, transfer to laying and chickin
This commit is contained in:
+7
-3
@@ -166,6 +166,9 @@ func (r *TransferLayingRepositoryImpl) GetAllWithFilters(ctx context.Context, of
|
||||
q = q.Offset(offset).Limit(limit).
|
||||
Preload("FromProjectFlock").
|
||||
Preload("ToProjectFlock").
|
||||
Preload("SourceProjectFlockKandang").
|
||||
Preload("SourceProjectFlockKandang.Kandang").
|
||||
Preload("SourceProductWarehouse").
|
||||
Preload("CreatedUser").
|
||||
Preload("ExecutedUser").
|
||||
Preload("Sources").
|
||||
@@ -193,11 +196,12 @@ func (r *TransferLayingRepositoryImpl) GetLatestApprovedBySourceKandang(ctx cont
|
||||
var transfer entity.LayingTransfer
|
||||
err := r.db.WithContext(ctx).
|
||||
Model(&entity.LayingTransfer{}).
|
||||
Joins("JOIN laying_transfer_sources lts ON lts.laying_transfer_id = laying_transfers.id AND lts.deleted_at IS NULL").
|
||||
Where("lts.source_project_flock_kandang_id = ?", sourceProjectFlockKandangID).
|
||||
Distinct("laying_transfers.*").
|
||||
Joins("LEFT JOIN laying_transfer_sources lts ON lts.laying_transfer_id = laying_transfers.id AND lts.deleted_at IS NULL").
|
||||
Where("(laying_transfers.source_project_flock_kandang_id = ? OR lts.source_project_flock_kandang_id = ?)", sourceProjectFlockKandangID, sourceProjectFlockKandangID).
|
||||
Where("laying_transfers.deleted_at IS NULL").
|
||||
Where(`(
|
||||
SELECT a.action
|
||||
SELECT a.action
|
||||
FROM approvals a
|
||||
WHERE a.approvable_type = ?
|
||||
AND a.approvable_id = laying_transfers.id
|
||||
|
||||
Reference in New Issue
Block a user