feat: 實作出貨單模組並暫時導向通用製作中頁面,同步優化盤點與調撥功能的活動日誌顯示
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Successful in 1m11s
Koori-ERP-Deploy-System / deploy-production (push) Has been skipped

This commit is contained in:
2026-02-05 09:33:36 +08:00
parent 4299e985e9
commit 04f3891275
23 changed files with 1410 additions and 30 deletions

View File

@@ -127,7 +127,7 @@ class TransferOrderController extends Controller
'batch_number' => $item->batch_number,
'unit' => $item->product->baseUnit?->name,
'quantity' => (float) $item->quantity,
'max_quantity' => $stock ? (float) $stock->quantity : 0.0,
'max_quantity' => $item->snapshot_quantity ? (float) $item->snapshot_quantity : ($stock ? (float) $stock->quantity : 0.0),
'notes' => $item->notes,
];
}),
@@ -154,14 +154,22 @@ class TransferOrderController extends Controller
]);
// 1. 先更新資料
$itemsChanged = false;
if ($request->has('items')) {
$this->transferService->updateItems($order, $validated['items']);
$itemsChanged = $this->transferService->updateItems($order, $validated['items']);
}
$order->fill($request->only(['remarks']));
$remarksChanged = $order->remarks !== ($validated['remarks'] ?? null);
// [IMPORTANT] 使用 touch() 確保即便只有品項異動,也會因為 updated_at 變更而觸發自動日誌
$order->touch();
if ($itemsChanged || $remarksChanged) {
$order->remarks = $validated['remarks'] ?? null;
// [IMPORTANT] 使用 touch() 確保即便只有品項異動,也會因為 updated_at 變更而觸發自動日誌
$order->touch();
$message = '儲存成功';
} else {
$message = '資料未變更';
// 如果沒變更,就不執行 touch(),也不會產生 Activity Log
}
// 2. 判斷是否需要過帳
if ($request->input('action') === 'post') {
@@ -174,7 +182,7 @@ class TransferOrderController extends Controller
}
}
return redirect()->back()->with('success', '儲存成功');
return redirect()->back()->with('success', $message);
}
public function destroy(InventoryTransferOrder $order)