施肥計画の「利用可能」表示を修正: 在庫の実残数を正しく表示
- getPlanAvailableStock: 自計画の引当を足し戻す計算を廃止し、 サーバー側available_stock + 初期引当 - 現在計画量でリアルタイム算出 - getPlanShortage: available_stockベースの不足判定に変更 - 編集中の計画変更が即座に利用可能数に反映されるように Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user