From d9a4bd19ebdd96e0900e4f935da3105f6f7e535c Mon Sep 17 00:00:00 2001 From: Akira Date: Mon, 16 Mar 2026 10:13:41 +0900 Subject: [PATCH] =?UTF-8?q?=E6=96=BD=E8=82=A5=E8=A8=88=E7=94=BB=E3=81=AE?= =?UTF-8?q?=E3=80=8C=E5=88=A9=E7=94=A8=E5=8F=AF=E8=83=BD=E3=80=8D=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=82=92=E4=BF=AE=E6=AD=A3:=20=E5=9C=A8=E5=BA=AB?= =?UTF-8?q?=E3=81=AE=E5=AE=9F=E6=AE=8B=E6=95=B0=E3=82=92=E6=AD=A3=E3=81=97?= =?UTF-8?q?=E3=81=8F=E8=A1=A8=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - getPlanAvailableStock: 自計画の引当を足し戻す計算を廃止し、 サーバー側available_stock + 初期引当 - 現在計画量でリアルタイム算出 - getPlanShortage: available_stockベースの不足判定に変更 - 編集中の計画変更が即座に利用可能数に反映されるように Co-Authored-By: Claude Opus 4.6 --- .../src/app/fertilizer/_components/FertilizerEditPage.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/fertilizer/_components/FertilizerEditPage.tsx b/frontend/src/app/fertilizer/_components/FertilizerEditPage.tsx index 69dfdf3..3366777 100644 --- a/frontend/src/app/fertilizer/_components/FertilizerEditPage.tsx +++ b/frontend/src/app/fertilizer/_components/FertilizerEditPage.tsx @@ -369,7 +369,10 @@ export default function FertilizerEditPage({ planId }: { planId?: number }) { const getPlanAvailableStock = (fertilizer: Fertilizer) => { const stock = getStockInfo(fertilizer); if (!stock) return null; - return getNumericValue(stock.available_stock); + const serverAvailable = getNumericValue(stock.available_stock); + const initialReserve = initialPlanTotals[fertilizer.id] ?? 0; + const currentPlanTotal = colTotal(fertilizer.id); + return serverAvailable + initialReserve - currentPlanTotal; }; const getPlanShortage = (fertilizer: Fertilizer) => { const available = getPlanAvailableStock(fertilizer);