blueeye-3184 Cursor commited on
Commit ยท
058a945
1
Parent(s): 5ea98bb
feat: add risky items top 5 card below overstock status (API + table UI)
Browse files
model-server/05.Inventory Optimization/Inventory Optimization.py
CHANGED
|
@@ -40,6 +40,7 @@ UI: ๋ฉ์ธ ๋์๋ณด๋(3000) โ "์์ ์ฌ๊ณ " ์ง์
์ ์ค๋ฒ๋ ์ด "Invent
|
|
| 40 |
GET /api/safety-stock-kpi | get_kpi_summary() | [Action Center] KPI: ๋๊ฒฐ์๊ธ, Danger/Overstock, ์์ ๋งค์ถ
|
| 41 |
GET /api/safety-stock-inventory-list | get_inventory_list(status_filter) | [Action Center] ์ฌ๊ณ ๋ฆฌ์คํธ(๋งค์ฅยท์ ํ๋ณ, Frozen_Money ๋ด๋ฆผ์ฐจ์)
|
| 42 |
GET /api/safety-stock-overstock-status | get_overstock_status_by_region() | [Action Center] ๊ณผ์ ์ฌ๊ณ ํํฉ ์นด๋(๋๋ฅยท๊ตญ๊ฐยท์์ ๊ตฌ๋ถ, ์นดํ
๊ณ ๋ฆฌ๋ณ ์)
|
|
|
|
| 43 |
GET /api/inventory-critical-alerts | get_inventory_critical_alerts() | [3.4.4] ์ค์๊ฐ ์ฌ๊ณ ยท์์ธก ์ ๋ขฐ๋ ๊ฒฝ๊ณ (Health_Index < 70)
|
| 44 |
|
| 45 |
๋ฐ์ดํฐ ์์ค: SQL ์ ์ฉ โ load_sales_dataframe() (load_sales_data.py โ 01.data/*.sql).
|
|
@@ -54,6 +55,7 @@ UI: ๋ฉ์ธ ๋์๋ณด๋(3000) โ "์์ ์ฌ๊ณ " ์ง์
์ ์ค๋ฒ๋ ์ด "Invent
|
|
| 54 |
- [Inventory Action Center] ์ ์ฉ ๋ก์ง์ ๋ณธ ํ์ผ์๋ง ๋๊ณ , UIโAPIโํจ์ ๋งคํ ๋ฌธ์ํ.
|
| 55 |
- ๊ณผ์ ์ฌ๊ณ ํํฉ ์นด๋: get_overstock_status_by_region() ์ถ๊ฐ (๋๋ฅยท๊ตญ๊ฐยท์์ ๊ตฌ๋ถ, ์นดํ
๊ณ ๋ฆฌ๋ณ ์ ์ ๋ ฌ).
|
| 56 |
- ๊ณผ์ ์ฌ๊ณ ํ๊ฒ: ์ํ๋ณ ๊ณผ์ ๋ฐฐ์ 100%~320% โ 300%~450% (np.random.uniform 1.0~3.2 โ 3.0~4.5).
|
|
|
|
| 57 |
----------------------------------------------------------------------
|
| 58 |
|
| 59 |
[๋ชจ๋ํ] ๋ณธ ํ์ผ์ load_sales_data.py ์ load_sales_dataframe() ๋ง ์ฐธ์กฐํ์ฌ ๋ฐ์ดํฐ๋ฅผ ์ฝ์ต๋๋ค.
|
|
@@ -571,6 +573,63 @@ def get_overstock_top5_by_quantity():
|
|
| 571 |
return out
|
| 572 |
|
| 573 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 574 |
def get_inventory_critical_alerts(limit: int = 50):
|
| 575 |
"""
|
| 576 |
[3.4.4 ์ค์๊ฐ ์ฌ๊ณ ๋ฐ ์์ธก ์ ๋ขฐ๋ ๊ฒฝ๊ณ ]
|
|
|
|
| 40 |
GET /api/safety-stock-kpi | get_kpi_summary() | [Action Center] KPI: ๋๊ฒฐ์๊ธ, Danger/Overstock, ์์ ๋งค์ถ
|
| 41 |
GET /api/safety-stock-inventory-list | get_inventory_list(status_filter) | [Action Center] ์ฌ๊ณ ๋ฆฌ์คํธ(๋งค์ฅยท์ ํ๋ณ, Frozen_Money ๋ด๋ฆผ์ฐจ์)
|
| 42 |
GET /api/safety-stock-overstock-status | get_overstock_status_by_region() | [Action Center] ๊ณผ์ ์ฌ๊ณ ํํฉ ์นด๋(๋๋ฅยท๊ตญ๊ฐยท์์ ๊ตฌ๋ถ, ์นดํ
๊ณ ๋ฆฌ๋ณ ์)
|
| 43 |
+
GET /api/safety-stock-risky-items-top5 | get_risky_items_top5() | [Action Center] ์ํ ํ๋ชฉ top 5 (๋ฐ์ฃผ๋ยท์ง์ถ ๊ธ์ก ๊ธฐ์ค)
|
| 44 |
GET /api/inventory-critical-alerts | get_inventory_critical_alerts() | [3.4.4] ์ค์๊ฐ ์ฌ๊ณ ยท์์ธก ์ ๋ขฐ๋ ๊ฒฝ๊ณ (Health_Index < 70)
|
| 45 |
|
| 46 |
๋ฐ์ดํฐ ์์ค: SQL ์ ์ฉ โ load_sales_dataframe() (load_sales_data.py โ 01.data/*.sql).
|
|
|
|
| 55 |
- [Inventory Action Center] ์ ์ฉ ๋ก์ง์ ๋ณธ ํ์ผ์๋ง ๋๊ณ , UIโAPIโํจ์ ๋งคํ ๋ฌธ์ํ.
|
| 56 |
- ๊ณผ์ ์ฌ๊ณ ํํฉ ์นด๋: get_overstock_status_by_region() ์ถ๊ฐ (๋๋ฅยท๊ตญ๊ฐยท์์ ๊ตฌ๋ถ, ์นดํ
๊ณ ๋ฆฌ๋ณ ์ ์ ๋ ฌ).
|
| 57 |
- ๊ณผ์ ์ฌ๊ณ ํ๊ฒ: ์ํ๋ณ ๊ณผ์ ๋ฐฐ์ 100%~320% โ 300%~450% (np.random.uniform 1.0~3.2 โ 3.0~4.5).
|
| 58 |
+
- ์ํ ํ๋ชฉ top 5 ์นด๋: get_risky_items_top5() ์ถ๊ฐ (๋ฐ์ฃผ๋=๋ชฉํ์ฌ๊ณ โํ์ฌ์ฌ๊ณ , ์ง์ถ=๋ฐ์ฃผ๋ร๊ฐ๊ฒฉ, ์ง์ถ ๊ธฐ์ค ์์ 5).
|
| 59 |
----------------------------------------------------------------------
|
| 60 |
|
| 61 |
[๋ชจ๋ํ] ๋ณธ ํ์ผ์ load_sales_data.py ์ load_sales_dataframe() ๋ง ์ฐธ์กฐํ์ฌ ๋ฐ์ดํฐ๋ฅผ ์ฝ์ต๋๋ค.
|
|
|
|
| 573 |
return out
|
| 574 |
|
| 575 |
|
| 576 |
+
def get_risky_items_top5():
|
| 577 |
+
"""
|
| 578 |
+
[Inventory Action Center] ์ํ ํ๋ชฉ top 5 ์นด๋์ฉ.
|
| 579 |
+
ํ์ฌ ์ฌ๊ณ < ๋ชฉํ ์ฌ๊ณ (์์ ์ฌ๊ณ )์ธ ์ํ๋ณ๋ก ๋ฐ์ฃผ๋ยท์ง์ถ ๊ธ์ก์ ์ฐ์ถํ์ฌ ์ง์ถ ๊ธ์ก ๊ธฐ์ค ์์ 5๊ฐ ๋ฐํ.
|
| 580 |
+
- ๋ฐ์ฃผ๋ = max(0, ๋ชฉํ ์ฌ๊ณ - ํ์ฌ ์ฌ๊ณ )
|
| 581 |
+
- ์ง์ถ ๊ธ์ก = ๋ฐ์ฃผ๋ ร ํด๋น ์ํ ๋จ๊ฐ(price)
|
| 582 |
+
๋ฐํ: [{"rank", "product_name", "current_inventory", "target_inventory", "order_quantity", "expenditure"}, ...]
|
| 583 |
+
"""
|
| 584 |
+
df = load_sales_dataframe()
|
| 585 |
+
if df is None or df.empty:
|
| 586 |
+
return []
|
| 587 |
+
df = run_inventory_pipeline(df)
|
| 588 |
+
if df is None or df.empty or "Product_Name" not in df.columns:
|
| 589 |
+
return []
|
| 590 |
+
need = ["Product_Name", "Inventory", "Safety_Stock"]
|
| 591 |
+
if not all(c in df.columns for c in need):
|
| 592 |
+
return []
|
| 593 |
+
|
| 594 |
+
inv = pd.to_numeric(df["Inventory"], errors="coerce").fillna(0)
|
| 595 |
+
safety = pd.to_numeric(df["Safety_Stock"], errors="coerce").fillna(0)
|
| 596 |
+
df = df.copy()
|
| 597 |
+
df["_inv"] = inv
|
| 598 |
+
df["_safety"] = safety
|
| 599 |
+
|
| 600 |
+
agg = df.groupby("Product_Name", as_index=False).agg(
|
| 601 |
+
current_inventory=("_inv", "sum"),
|
| 602 |
+
target_inventory=("_safety", "sum"),
|
| 603 |
+
)
|
| 604 |
+
agg["current_inventory"] = agg["current_inventory"].round(0).astype(int)
|
| 605 |
+
agg["target_inventory"] = agg["target_inventory"].round(0).astype(int)
|
| 606 |
+
agg["order_quantity"] = (agg["target_inventory"] - agg["current_inventory"]).clip(lower=0)
|
| 607 |
+
agg = agg[agg["order_quantity"] > 0].copy()
|
| 608 |
+
if agg.empty:
|
| 609 |
+
return []
|
| 610 |
+
|
| 611 |
+
if "price" in df.columns:
|
| 612 |
+
price_map = df.groupby("Product_Name")["price"].first()
|
| 613 |
+
agg["price"] = agg["Product_Name"].map(price_map)
|
| 614 |
+
else:
|
| 615 |
+
agg["price"] = 0.0
|
| 616 |
+
agg["price"] = pd.to_numeric(agg["price"], errors="coerce").fillna(0)
|
| 617 |
+
agg["expenditure"] = (agg["order_quantity"] * agg["price"]).round(0)
|
| 618 |
+
agg = agg.sort_values(by="expenditure", ascending=False).head(5).reset_index(drop=True)
|
| 619 |
+
|
| 620 |
+
out = []
|
| 621 |
+
for i, (_, row) in enumerate(agg.iterrows(), start=1):
|
| 622 |
+
out.append({
|
| 623 |
+
"rank": i,
|
| 624 |
+
"product_name": str(row["Product_Name"]).strip() or "",
|
| 625 |
+
"current_inventory": int(row["current_inventory"]),
|
| 626 |
+
"target_inventory": int(row["target_inventory"]),
|
| 627 |
+
"order_quantity": int(row["order_quantity"]),
|
| 628 |
+
"expenditure": float(row["expenditure"]),
|
| 629 |
+
})
|
| 630 |
+
return out
|
| 631 |
+
|
| 632 |
+
|
| 633 |
def get_inventory_critical_alerts(limit: int = 50):
|
| 634 |
"""
|
| 635 |
[3.4.4 ์ค์๊ฐ ์ฌ๊ณ ๋ฐ ์์ธก ์ ๋ขฐ๋ ๊ฒฝ๊ณ ]
|
web-development/backend/main.py
CHANGED
|
@@ -1006,9 +1006,10 @@ if _realtime_file.exists():
|
|
| 1006 |
except Exception as e:
|
| 1007 |
print(f"[Apple Retail API] Real-time execution and performance dashboard.py ๋ก๋ ์คํจ: {e}")
|
| 1008 |
|
| 1009 |
-
# Inventory Optimization ๋ชจ๋: ๊ณผ์ ์ฌ๊ณ ํํฉ(๋๋ฅยท๊ตญ๊ฐยท์์ ยท์นดํ
๊ณ ๋ฆฌ ์)
|
| 1010 |
get_overstock_status_by_region = None
|
| 1011 |
get_overstock_top5_by_quantity = None
|
|
|
|
| 1012 |
_inv_opt_file = _model_path("05.Inventory Optimization", "Inventory Optimization") / "Inventory Optimization.py"
|
| 1013 |
if _inv_opt_file.exists() and load_sales_dataframe is not None:
|
| 1014 |
try:
|
|
@@ -1018,6 +1019,7 @@ if _inv_opt_file.exists() and load_sales_dataframe is not None:
|
|
| 1018 |
_inv_opt_spec.loader.exec_module(_inv_opt_module)
|
| 1019 |
get_overstock_status_by_region = getattr(_inv_opt_module, "get_overstock_status_by_region", None)
|
| 1020 |
get_overstock_top5_by_quantity = getattr(_inv_opt_module, "get_overstock_top5_by_quantity", None)
|
|
|
|
| 1021 |
except Exception as e:
|
| 1022 |
print(f"[Apple Retail API] Inventory Optimization (get_overstock_status_by_region) ๋ก๋ ์คํจ: {e}")
|
| 1023 |
|
|
@@ -1970,6 +1972,18 @@ def api_safety_stock_overstock_top5():
|
|
| 1970 |
return []
|
| 1971 |
|
| 1972 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1973 |
@app.get("/api/inventory-frozen-money")
|
| 1974 |
def api_inventory_frozen_money():
|
| 1975 |
"""
|
|
|
|
| 1006 |
except Exception as e:
|
| 1007 |
print(f"[Apple Retail API] Real-time execution and performance dashboard.py ๋ก๋ ์คํจ: {e}")
|
| 1008 |
|
| 1009 |
+
# Inventory Optimization ๋ชจ๋: ๊ณผ์ ์ฌ๊ณ ํํฉ(๋๋ฅยท๊ตญ๊ฐยท์์ ยท์นดํ
๊ณ ๋ฆฌ ์), TOP5 ์๋ ๊ธฐ์ค, ์ํ ํ๋ชฉ top 5
|
| 1010 |
get_overstock_status_by_region = None
|
| 1011 |
get_overstock_top5_by_quantity = None
|
| 1012 |
+
get_risky_items_top5 = None
|
| 1013 |
_inv_opt_file = _model_path("05.Inventory Optimization", "Inventory Optimization") / "Inventory Optimization.py"
|
| 1014 |
if _inv_opt_file.exists() and load_sales_dataframe is not None:
|
| 1015 |
try:
|
|
|
|
| 1019 |
_inv_opt_spec.loader.exec_module(_inv_opt_module)
|
| 1020 |
get_overstock_status_by_region = getattr(_inv_opt_module, "get_overstock_status_by_region", None)
|
| 1021 |
get_overstock_top5_by_quantity = getattr(_inv_opt_module, "get_overstock_top5_by_quantity", None)
|
| 1022 |
+
get_risky_items_top5 = getattr(_inv_opt_module, "get_risky_items_top5", None)
|
| 1023 |
except Exception as e:
|
| 1024 |
print(f"[Apple Retail API] Inventory Optimization (get_overstock_status_by_region) ๋ก๋ ์คํจ: {e}")
|
| 1025 |
|
|
|
|
| 1972 |
return []
|
| 1973 |
|
| 1974 |
|
| 1975 |
+
@app.get("/api/safety-stock-risky-items-top5")
|
| 1976 |
+
def api_safety_stock_risky_items_top5():
|
| 1977 |
+
"""Inventory Action Center: ์ํ ํ๋ชฉ top 5. ๋ฐ์ฃผ๋(๋ชฉํ์ฌ๊ณ โํ์ฌ์ฌ๊ณ )ยท์ง์ถ ๊ธ์ก(๋ฐ์ฃผ๋ร๊ฐ๊ฒฉ) ๊ธฐ์ค ์์ 5๊ฐ."""
|
| 1978 |
+
if get_risky_items_top5 is None:
|
| 1979 |
+
return []
|
| 1980 |
+
try:
|
| 1981 |
+
return get_risky_items_top5()
|
| 1982 |
+
except Exception as e:
|
| 1983 |
+
print(f"[Apple Retail API] api_safety_stock_risky_items_top5 ์ค๋ฅ: {e}")
|
| 1984 |
+
return []
|
| 1985 |
+
|
| 1986 |
+
|
| 1987 |
@app.get("/api/inventory-frozen-money")
|
| 1988 |
def api_inventory_frozen_money():
|
| 1989 |
"""
|
web-development/frontend/app/page.tsx
CHANGED
|
@@ -505,6 +505,10 @@ export default function Home() {
|
|
| 505 |
const [overstockTop5ByQty, setOverstockTop5ByQty] = useState<
|
| 506 |
{ product_name: string; current_inventory: number; target_inventory: number; overstock_qty: number; overstock_pct: number; savings_amount: number }[]
|
| 507 |
>([]);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 508 |
/** ์ํ ํํฐ: '' | '์ํ' | '๊ณผ์' (ํ๊ธ) */
|
| 509 |
const [inventoryStatusFilter, setInventoryStatusFilter] = useState<string>('');
|
| 510 |
/** ๊ด๋ฆฌ์ ์ฝ๋ฉํธ: ์ ํ๋ ๋งค์ฅ๋ช
*/
|
|
@@ -853,6 +857,13 @@ export default function Home() {
|
|
| 853 |
if (Array.isArray(json)) setOverstockTop5ByQty(json);
|
| 854 |
else setOverstockTop5ByQty([]);
|
| 855 |
}).catch(() => setOverstockTop5ByQty([]));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 856 |
}, [showSafetyStockDashboard, inventoryStatusFilter]);
|
| 857 |
|
| 858 |
// ๋งค์ฅ๋ณ ์ฌ๊ณ ๋ชฉ๋ก/ํํฐ ๋ณ๊ฒฝ ์, ์ ํ ๋งค์ฅ์ด ๋ชฉ๋ก์ ์์ผ๋ฉด ์ ํ ํด์ (๋๊ธฐํ)
|
|
@@ -1913,6 +1924,44 @@ export default function Home() {
|
|
| 1913 |
</div>
|
| 1914 |
)}
|
| 1915 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1916 |
{/* ์ํ ํ๋ชฉ: ์ฐจํธ & ๊ด๋ฆฌ์ ์ฝ๋ฉํธ */}
|
| 1917 |
{dangerTop5.length > 0 && (
|
| 1918 |
<div className="mb-6 grid grid-cols-1 lg:grid-cols-2 gap-6">
|
|
|
|
| 505 |
const [overstockTop5ByQty, setOverstockTop5ByQty] = useState<
|
| 506 |
{ product_name: string; current_inventory: number; target_inventory: number; overstock_qty: number; overstock_pct: number; savings_amount: number }[]
|
| 507 |
>([]);
|
| 508 |
+
/** ์ํ ํ๋ชฉ top 5: ์์ยท์ํ๋ช
ยทํ์ฌ์ฌ๊ณ ยท๋ชฉํ์ฌ๊ณ ยท๋ฐ์ฃผ๋ยท์ง์ถ ๊ธ์ก (DB ๊ธฐ์ค) */
|
| 509 |
+
const [riskyItemsTop5, setRiskyItemsTop5] = useState<
|
| 510 |
+
{ rank: number; product_name: string; current_inventory: number; target_inventory: number; order_quantity: number; expenditure: number }[]
|
| 511 |
+
>([]);
|
| 512 |
/** ์ํ ํํฐ: '' | '์ํ' | '๊ณผ์' (ํ๊ธ) */
|
| 513 |
const [inventoryStatusFilter, setInventoryStatusFilter] = useState<string>('');
|
| 514 |
/** ๊ด๋ฆฌ์ ์ฝ๋ฉํธ: ์ ํ๋ ๋งค์ฅ๋ช
*/
|
|
|
|
| 857 |
if (Array.isArray(json)) setOverstockTop5ByQty(json);
|
| 858 |
else setOverstockTop5ByQty([]);
|
| 859 |
}).catch(() => setOverstockTop5ByQty([]));
|
| 860 |
+
// ์ํ ํ๋ชฉ top 5 (๋ฐ์ฃผ๋ยท์ง์ถ ๊ธ์ก ๊ธฐ์ค, DB)
|
| 861 |
+
apiGet<{ rank: number; product_name: string; current_inventory: number; target_inventory: number; order_quantity: number; expenditure: number }[]>(
|
| 862 |
+
'/api/safety-stock-risky-items-top5'
|
| 863 |
+
).then((json) => {
|
| 864 |
+
if (Array.isArray(json)) setRiskyItemsTop5(json);
|
| 865 |
+
else setRiskyItemsTop5([]);
|
| 866 |
+
}).catch(() => setRiskyItemsTop5([]));
|
| 867 |
}, [showSafetyStockDashboard, inventoryStatusFilter]);
|
| 868 |
|
| 869 |
// ๋งค์ฅ๋ณ ์ฌ๊ณ ๋ชฉ๋ก/ํํฐ ๋ณ๊ฒฝ ์, ์ ํ ๋งค์ฅ์ด ๋ชฉ๋ก์ ์์ผ๋ฉด ์ ํ ํด์ (๋๊ธฐํ)
|
|
|
|
| 1924 |
</div>
|
| 1925 |
)}
|
| 1926 |
|
| 1927 |
+
{/* ์ํ ํ๋ชฉ top 5: DB ๊ธฐ์ค ํ
์ด๋ธ (์์ยท์ํ๋ช
ยทํ์ฌ์ฌ๊ณ ยท๋ชฉํ์ฌ๊ณ ยท๋ฐ์ฃผ๋ยท์ง์ถ ๊ธ์ก) */}
|
| 1928 |
+
{riskyItemsTop5.length > 0 && (
|
| 1929 |
+
<div className="mb-6">
|
| 1930 |
+
<div className="rounded-xl border border-gray-700 bg-[#2d2d2f] p-4">
|
| 1931 |
+
<h3 className="text-sm font-semibold text-white mb-1">์ํ ํ๋ชฉ top 5</h3>
|
| 1932 |
+
<p className="text-xs text-[#a1a1a6] mb-3">
|
| 1933 |
+
ํ์ฌ ์ฌ๊ณ ๊ฐ ๋ชฉํ ์ฌ๊ณ (์์ ์ฌ๊ณ )๋ณด๋ค ๋ฎ์ ์ํ ์ค, ๋ฐ์ฃผ ํ์๋ยท์์ ์ง์ถ ๊ธ์ก ๊ธฐ์ค ์์ 5๊ฐ์
๋๋ค.
|
| 1934 |
+
</p>
|
| 1935 |
+
<div className="overflow-x-auto">
|
| 1936 |
+
<table className="w-full text-left border-collapse">
|
| 1937 |
+
<thead>
|
| 1938 |
+
<tr className="border-b border-gray-600">
|
| 1939 |
+
<th className="text-xs font-medium text-[#a1a1a6] py-2 pr-3">์์</th>
|
| 1940 |
+
<th className="text-xs font-medium text-[#a1a1a6] py-2 pr-3">์ํ๋ช
</th>
|
| 1941 |
+
<th className="text-xs font-medium text-[#a1a1a6] py-2 pr-3">ํ์ฌ ์ฌ๊ณ </th>
|
| 1942 |
+
<th className="text-xs font-medium text-[#a1a1a6] py-2 pr-3">๋ชฉํ ์ฌ๊ณ </th>
|
| 1943 |
+
<th className="text-xs font-medium text-[#a1a1a6] py-2 pr-3">๋ฐ์ฃผ๋</th>
|
| 1944 |
+
<th className="text-xs font-medium text-[#a1a1a6] py-2 pr-3">์ง์ถ ๊ธ์ก</th>
|
| 1945 |
+
</tr>
|
| 1946 |
+
</thead>
|
| 1947 |
+
<tbody>
|
| 1948 |
+
{riskyItemsTop5.map((row) => (
|
| 1949 |
+
<tr key={row.rank} className="border-b border-gray-600/80">
|
| 1950 |
+
<td className="text-sm text-white py-2 pr-3">{row.rank}</td>
|
| 1951 |
+
<td className="text-sm text-white py-2 pr-3">{row.product_name || 'โ'}</td>
|
| 1952 |
+
<td className="text-sm text-white py-2 pr-3">{(row.current_inventory ?? 0).toLocaleString()}๋</td>
|
| 1953 |
+
<td className="text-sm text-white py-2 pr-3">{(row.target_inventory ?? 0).toLocaleString()}๋</td>
|
| 1954 |
+
<td className="text-sm text-white py-2 pr-3">{(row.order_quantity ?? 0).toLocaleString()}๋</td>
|
| 1955 |
+
<td className="text-sm text-white py-2 pr-3">โฉ{(row.expenditure ?? 0).toLocaleString()}</td>
|
| 1956 |
+
</tr>
|
| 1957 |
+
))}
|
| 1958 |
+
</tbody>
|
| 1959 |
+
</table>
|
| 1960 |
+
</div>
|
| 1961 |
+
</div>
|
| 1962 |
+
</div>
|
| 1963 |
+
)}
|
| 1964 |
+
|
| 1965 |
{/* ์ํ ํ๋ชฉ: ์ฐจํธ & ๊ด๋ฆฌ์ ์ฝ๋ฉํธ */}
|
| 1966 |
{dangerTop5.length > 0 && (
|
| 1967 |
<div className="mb-6 grid grid-cols-1 lg:grid-cols-2 gap-6">
|