默认重量
This commit is contained in:
@@ -22,6 +22,7 @@ use App\Services\BillGenerateService;
|
||||
use App\Services\ItemImageResolver;
|
||||
use App\Services\PurchaseGenerateService;
|
||||
use App\Services\PurchaseItemService;
|
||||
use App\Services\WeightEstimator;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -481,7 +482,10 @@ class PurchaseOrderController extends BaseController
|
||||
'content' => (string) $product->content,
|
||||
'shelf_life' => (int) $product->shelf_life,
|
||||
'quantity' => $quantity,
|
||||
'weight' => bcadd((string) ($validated['weight'] ?? 0), '0', 3),
|
||||
// 未传称重时按订货量 × 规格预填参考重量
|
||||
'weight' => isset($validated['weight'])
|
||||
? bcadd((string) $validated['weight'], '0', 3)
|
||||
: WeightEstimator::estimate((string) $product->spec, (string) $product->unit, (string) $quantity),
|
||||
'amount' => bcmul($price, (string) $quantity, 2),
|
||||
'cost_price' => (string) $product->cost_price,
|
||||
'remark' => '',
|
||||
|
||||
Reference in New Issue
Block a user