默认重量

This commit is contained in:
liu
2026-09-05 14:37:22 +08:00
parent 364471a086
commit 12cbed411b
10 changed files with 205 additions and 8 deletions
+6 -1
View File
@@ -63,13 +63,18 @@ readonly class PurchaseGenerateService
static fn (string $carry, $item): string => bcadd($carry, bcmul($item->quantity, $item->cost_price, 2), 2),
'0'
);
// 参考总重量 = Σ 明细参考重量(下单时按订货量 × 规格预填)
$totalWeight = $items->reduce(
static fn (string $carry, $item): string => bcadd($carry, (string) $item->weight, 3),
'0'
);
$purchase = PurchaseOrderModel::create([
'purchase_no' => $this->billNumberService->make('PO'),
'purchase_date' => $date,
'status' => PurchaseOrderModel::STATUS_PENDING,
'total_quantity' => $totalQuantity,
'total_weight' => 0,
'total_weight' => $totalWeight,
'estimate_amount' => $estimateAmount,
'actual_amount' => 0,
'operator_id' => $operatorId,