diff --git a/internal/modules/production/transfer_layings/services/transfer_laying.service.go b/internal/modules/production/transfer_layings/services/transfer_laying.service.go index bf2c2ae3..3d291b6d 100644 --- a/internal/modules/production/transfer_layings/services/transfer_laying.service.go +++ b/internal/modules/production/transfer_layings/services/transfer_laying.service.go @@ -699,6 +699,7 @@ func (s transferLayingService) Approval(c *fiber.Ctx, req *validation.Approve) ( targetWarehouse.Id, target.Qty, actorID, + &target.TargetProjectFlockKandangId, // Set flock ID agar bisa di-chickin di target flock ); err != nil { return fiber.NewError(fiber.StatusInternalServerError, "Failed to create or update product warehouse") } @@ -758,7 +759,7 @@ func createApprovalTransferLaying(ctx context.Context, tx *gorm.DB, transferLayi return err } -func (s *transferLayingService) getOrCreateProductWarehouse(ctx context.Context, tx *gorm.DB, productID uint, warehouseID uint, quantity float64, actorID uint) (*entity.ProductWarehouse, error) { +func (s *transferLayingService) getOrCreateProductWarehouse(ctx context.Context, tx *gorm.DB, productID uint, warehouseID uint, quantity float64, actorID uint, projectFlockKandangId *uint) (*entity.ProductWarehouse, error) { productWarehouseRepoTx := rInventory.NewProductWarehouseRepository(tx) @@ -775,9 +776,10 @@ func (s *transferLayingService) getOrCreateProductWarehouse(ctx context.Context, } newWarehouse := &entity.ProductWarehouse{ - ProductId: productID, - WarehouseId: warehouseID, - Quantity: quantity, + ProductId: productID, + WarehouseId: warehouseID, + ProjectFlockKandangId: projectFlockKandangId, // Set flock ID agar bisa di-chickin di target flock + Quantity: quantity, // CreatedBy: actorID, }