[FEAT] 優化庫存分析邏輯,增加銷售 Reference Type 追蹤並修正 InventoryService 閉包變數問題
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 1m20s

This commit is contained in:
2026-03-10 11:15:55 +08:00
parent 197df3bec4
commit d52a215916
7 changed files with 57 additions and 8 deletions

View File

@@ -175,6 +175,9 @@ class PosApiTest extends TestCase
'Accept' => 'application/json',
])->postJson('/api/v1/integration/orders', $payload);
$response->assertStatus(201)
->assertJsonPath('message', 'Order synced and stock deducted successfully');
$response->assertStatus(201)
->assertJsonPath('message', 'Order synced and stock deducted successfully');
@@ -196,6 +199,14 @@ class PosApiTest extends TestCase
'warehouse_id' => $warehouseId,
'quantity' => 95,
]);
$order = \App\Modules\Integration\Models\SalesOrder::where('external_order_id', 'ORD-001')->first();
$this->assertDatabaseHas('inventory_transactions', [
'reference_type' => \App\Modules\Integration\Models\SalesOrder::class,
'reference_id' => $order->id,
'quantity' => -5,
'type' => '出庫',
]);
tenancy()->end();
}