1. 新增药品的ERP抓取数量倍数
This commit is contained in:
@@ -219,11 +219,18 @@ class ErpController extends Controller
|
||||
$factor = $drugFactorMap[$drugId] ?? 1;
|
||||
$originQty = (int) ($item['number'] ?? 0);
|
||||
$erpQty = (int) round($originQty * $factor);
|
||||
$scale = 2; // 金额一般保留 2 位小数
|
||||
$buyPrice = $item['buy_price'];
|
||||
if (bccomp($factor, '1', $scale) === 1) {
|
||||
$erpPaymentPrice = bcdiv($buyPrice, $factor, $scale);
|
||||
} else {
|
||||
$erpPaymentPrice = $buyPrice;
|
||||
}
|
||||
return [
|
||||
'detailId' => $item['id'],
|
||||
'productSku' => $item['drug_no'],
|
||||
'quantity' => $erpQty,
|
||||
'paymentPrice' => $item['buy_price'],
|
||||
'paymentPrice' => $erpPaymentPrice,
|
||||
'price' => round($originQty * $item['buy_price'], 2),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user