默认重量
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user