feat: API調整訂單與販賣機訂單同步強制使用warehouse_code,更新API對接文件,及優化生產與配方模組UI顯示
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 55s
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 55s
This commit is contained in:
@@ -93,14 +93,16 @@ class SyncOrderAction
|
||||
'source_label' => $data['source_label'] ?? null,
|
||||
]);
|
||||
|
||||
// 2. 查找或建立倉庫
|
||||
$warehouseId = $data['warehouse_id'] ?? null;
|
||||
|
||||
if (empty($warehouseId)) {
|
||||
$warehouseName = $data['warehouse'] ?? '銷售倉庫';
|
||||
$warehouse = $this->inventoryService->findOrCreateWarehouseByName($warehouseName);
|
||||
$warehouseId = $warehouse->id;
|
||||
// 2. 查找倉庫
|
||||
$warehouseCode = $data['warehouse_code'];
|
||||
$warehouses = $this->inventoryService->getWarehousesByCodes([$warehouseCode]);
|
||||
|
||||
if ($warehouses->isEmpty()) {
|
||||
throw ValidationException::withMessages([
|
||||
'warehouse_code' => ["Warehouse with code {$warehouseCode} not found."]
|
||||
]);
|
||||
}
|
||||
$warehouseId = $warehouses->first()->id;
|
||||
|
||||
$totalAmount = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user