mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
[FEAT/BE] fix status closed project flock, closing perhitungan sapronak
This commit is contained in:
@@ -560,11 +560,17 @@ func (s deliveryOrdersService) consumeDeliveryStock(ctx context.Context, tx *gor
|
||||
if deliveryProduct == nil || deliveryProduct.Id == 0 {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, "Delivery product not found")
|
||||
}
|
||||
if deliveryProduct.ProductWarehouseId == 0 {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, "Delivery product warehouse not found")
|
||||
}
|
||||
if deliveryProduct.ProductWarehouseId != marketingProduct.ProductWarehouseId {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "Delivery product warehouse mismatch with marketing product")
|
||||
}
|
||||
|
||||
result, err := s.FifoSvc.Consume(ctx, commonSvc.StockConsumeRequest{
|
||||
UsableKey: fifo.UsableKeyMarketingDelivery,
|
||||
UsableID: deliveryProduct.Id,
|
||||
ProductWarehouseID: marketingProduct.ProductWarehouseId,
|
||||
ProductWarehouseID: deliveryProduct.ProductWarehouseId,
|
||||
Quantity: requestedQty,
|
||||
AllowPending: false,
|
||||
Tx: tx,
|
||||
@@ -585,12 +591,12 @@ func (s deliveryOrdersService) consumeDeliveryStock(ctx context.Context, tx *gor
|
||||
Decrease: result.UsageQuantity,
|
||||
LoggableType: string(utils.StockLogTypeMarketing),
|
||||
LoggableId: deliveryProduct.Id,
|
||||
ProductWarehouseId: marketingProduct.ProductWarehouseId,
|
||||
ProductWarehouseId: deliveryProduct.ProductWarehouseId,
|
||||
CreatedBy: actorID,
|
||||
Notes: fmt.Sprintf("FIFO consume (%.2f)", result.UsageQuantity),
|
||||
}
|
||||
|
||||
stockLogs, err := s.StockLogRepo.GetByProductWarehouse(ctx, marketingProduct.ProductWarehouseId, 1)
|
||||
stockLogs, err := s.StockLogRepo.GetByProductWarehouse(ctx, deliveryProduct.ProductWarehouseId, 1)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, "Failed to get stock logs")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user