mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-25 07:45:44 +00:00
feat(BE): add project flock ID to product warehouse creation for approval process
This commit is contained in:
@@ -699,6 +699,7 @@ func (s transferLayingService) Approval(c *fiber.Ctx, req *validation.Approve) (
|
|||||||
targetWarehouse.Id,
|
targetWarehouse.Id,
|
||||||
target.Qty,
|
target.Qty,
|
||||||
actorID,
|
actorID,
|
||||||
|
&target.TargetProjectFlockKandangId, // Set flock ID agar bisa di-chickin di target flock
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return fiber.NewError(fiber.StatusInternalServerError, "Failed to create or update product warehouse")
|
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
|
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)
|
productWarehouseRepoTx := rInventory.NewProductWarehouseRepository(tx)
|
||||||
|
|
||||||
@@ -777,6 +778,7 @@ func (s *transferLayingService) getOrCreateProductWarehouse(ctx context.Context,
|
|||||||
newWarehouse := &entity.ProductWarehouse{
|
newWarehouse := &entity.ProductWarehouse{
|
||||||
ProductId: productID,
|
ProductId: productID,
|
||||||
WarehouseId: warehouseID,
|
WarehouseId: warehouseID,
|
||||||
|
ProjectFlockKandangId: projectFlockKandangId, // Set flock ID agar bisa di-chickin di target flock
|
||||||
Quantity: quantity,
|
Quantity: quantity,
|
||||||
// CreatedBy: actorID,
|
// CreatedBy: actorID,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user