From e8eeef1e5360b6a5ffa2de8aba6b090413a09582 Mon Sep 17 00:00:00 2001 From: kjs Date: Sun, 12 Apr 2026 21:16:09 +0900 Subject: [PATCH] fix: Update error handling and warehouse code rendering in inventory and outbound pages - Enhanced error handling in the OutboundPage component to capture and display error messages from API responses, improving user feedback during operations. - Updated the InventoryStatusPage to render warehouse names instead of codes, providing clearer information to users. - These changes aim to enhance the user experience by ensuring better error visibility and more informative data representation across multiple company implementations. --- .../COMPANY_10/logistics/inventory/page.tsx | 9 +++++-- .../COMPANY_10/logistics/outbound/page.tsx | 15 ++++++----- .../COMPANY_10/logistics/receiving/page.tsx | 2 +- .../COMPANY_16/logistics/inventory/page.tsx | 9 +++++-- .../COMPANY_16/logistics/outbound/page.tsx | 26 ++++++++++++------- .../COMPANY_16/logistics/receiving/page.tsx | 2 +- .../COMPANY_29/logistics/inventory/page.tsx | 9 +++++-- .../COMPANY_29/logistics/outbound/page.tsx | 15 ++++++----- .../COMPANY_29/logistics/receiving/page.tsx | 2 +- .../COMPANY_30/logistics/inventory/page.tsx | 9 +++++-- .../COMPANY_30/logistics/outbound/page.tsx | 15 ++++++----- .../COMPANY_30/logistics/receiving/page.tsx | 2 +- .../COMPANY_7/logistics/inventory/page.tsx | 9 +++++-- .../COMPANY_7/logistics/outbound/page.tsx | 8 +++--- .../COMPANY_7/logistics/receiving/page.tsx | 2 +- .../COMPANY_8/logistics/inventory/page.tsx | 9 +++++-- .../COMPANY_8/logistics/outbound/page.tsx | 15 ++++++----- .../COMPANY_8/logistics/receiving/page.tsx | 2 +- .../COMPANY_9/logistics/inventory/page.tsx | 9 +++++-- .../COMPANY_9/logistics/outbound/page.tsx | 15 ++++++----- .../COMPANY_9/logistics/receiving/page.tsx | 2 +- 21 files changed, 117 insertions(+), 69 deletions(-) diff --git a/frontend/app/(main)/COMPANY_10/logistics/inventory/page.tsx b/frontend/app/(main)/COMPANY_10/logistics/inventory/page.tsx index 87909e6f..1e9a52db 100644 --- a/frontend/app/(main)/COMPANY_10/logistics/inventory/page.tsx +++ b/frontend/app/(main)/COMPANY_10/logistics/inventory/page.tsx @@ -164,7 +164,7 @@ export default function InventoryStatusPage() { } // item_info 단위 카테고리 try { - const res = await apiClient.get("/table-categories/item_info/unit/values"); + const res = await apiClient.get("/table-categories/item_info/unit/values?filterCompanyCode=COMPANY_10"); if (res.data?.success) optMap["item_unit"] = flatten(res.data.data || []); } catch { /* skip */ } setCategoryOptions(optMap); @@ -214,7 +214,6 @@ export default function InventoryStatusPage() { ...r, item_name: itemInfo?.name || "", unit: resolve("item_unit", rawUnit) || rawUnit, - warehouse_code: whMap.get(r.warehouse_code) || r.warehouse_code || "", warehouse_name: whMap.get(r.warehouse_code) || r.warehouse_code || "", status: resolve("status", r.status), _isLow: r.safety_qty && Number(r.current_qty) < Number(r.safety_qty), @@ -350,6 +349,12 @@ export default function InventoryStatusPage() { ), }; } + if (col.key === "warehouse_code") { + return { + ...base, + render: (_val: any, row: any) => row.warehouse_name || row.warehouse_code || "", + }; + } if (col.key === "safety_qty") { return { ...base, diff --git a/frontend/app/(main)/COMPANY_10/logistics/outbound/page.tsx b/frontend/app/(main)/COMPANY_10/logistics/outbound/page.tsx index f3bafd20..651ce234 100644 --- a/frontend/app/(main)/COMPANY_10/logistics/outbound/page.tsx +++ b/frontend/app/(main)/COMPANY_10/logistics/outbound/page.tsx @@ -1,6 +1,7 @@ "use client"; import React, { useState, useEffect, useCallback, useMemo } from "react"; +import { apiClient } from "@/lib/api/client"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { @@ -326,7 +327,7 @@ export default function OutboundPage() { Promise.all( ["material", "unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_10`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; @@ -371,7 +372,7 @@ export default function OutboundPage() { } const res = await getOutboundList(params); if (res.success) setData(res.data); - } catch { + } catch (err: any) { // ignore } finally { setLoading(false); @@ -388,7 +389,7 @@ export default function OutboundPage() { try { const res = await getOutboundWarehouses(); if (res.success) setWarehouses(res.data); - } catch { + } catch (err: any) { // ignore } })(); @@ -564,7 +565,7 @@ export default function OutboundPage() { const res = await getItemSources(keyword || undefined); if (res.success) setItems(res.data); } - } catch { + } catch (err: any) { // ignore } finally { setSourceLoading(false); @@ -596,7 +597,7 @@ export default function OutboundPage() { loadSourceData(defaultType), ]); if (numRes.success) setModalOutboundNo(numRes.data); - } catch { + } catch (err: any) { setModalOutboundNo(""); } }; @@ -899,8 +900,8 @@ export default function OutboundPage() { fetchList(); } } - } catch { - toast.error(editMode ? "수정에 실패했어요" : "출고 등록 중 오류가 발생했습니다."); + } catch (err: any) { + const msg = err?.response?.data?.message || (editMode ? "수정에 실패했어요" : "출고 등록 중 오류가 발생했습니다."); toast.error(msg); } finally { setSaving(false); } diff --git a/frontend/app/(main)/COMPANY_10/logistics/receiving/page.tsx b/frontend/app/(main)/COMPANY_10/logistics/receiving/page.tsx index 9351d06f..ac25af56 100644 --- a/frontend/app/(main)/COMPANY_10/logistics/receiving/page.tsx +++ b/frontend/app/(main)/COMPANY_10/logistics/receiving/page.tsx @@ -377,7 +377,7 @@ export default function ReceivingPage() { Promise.all( ["material", "unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_10`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; diff --git a/frontend/app/(main)/COMPANY_16/logistics/inventory/page.tsx b/frontend/app/(main)/COMPANY_16/logistics/inventory/page.tsx index 87909e6f..eb8bc811 100644 --- a/frontend/app/(main)/COMPANY_16/logistics/inventory/page.tsx +++ b/frontend/app/(main)/COMPANY_16/logistics/inventory/page.tsx @@ -164,7 +164,7 @@ export default function InventoryStatusPage() { } // item_info 단위 카테고리 try { - const res = await apiClient.get("/table-categories/item_info/unit/values"); + const res = await apiClient.get("/table-categories/item_info/unit/values?filterCompanyCode=COMPANY_16"); if (res.data?.success) optMap["item_unit"] = flatten(res.data.data || []); } catch { /* skip */ } setCategoryOptions(optMap); @@ -214,7 +214,6 @@ export default function InventoryStatusPage() { ...r, item_name: itemInfo?.name || "", unit: resolve("item_unit", rawUnit) || rawUnit, - warehouse_code: whMap.get(r.warehouse_code) || r.warehouse_code || "", warehouse_name: whMap.get(r.warehouse_code) || r.warehouse_code || "", status: resolve("status", r.status), _isLow: r.safety_qty && Number(r.current_qty) < Number(r.safety_qty), @@ -350,6 +349,12 @@ export default function InventoryStatusPage() { ), }; } + if (col.key === "warehouse_code") { + return { + ...base, + render: (_val: any, row: any) => row.warehouse_name || row.warehouse_code || "", + }; + } if (col.key === "safety_qty") { return { ...base, diff --git a/frontend/app/(main)/COMPANY_16/logistics/outbound/page.tsx b/frontend/app/(main)/COMPANY_16/logistics/outbound/page.tsx index f3bafd20..96ce95f8 100644 --- a/frontend/app/(main)/COMPANY_16/logistics/outbound/page.tsx +++ b/frontend/app/(main)/COMPANY_16/logistics/outbound/page.tsx @@ -1,6 +1,7 @@ "use client"; import React, { useState, useEffect, useCallback, useMemo } from "react"; +import { apiClient } from "@/lib/api/client"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { @@ -326,17 +327,22 @@ export default function OutboundPage() { Promise.all( ["material", "unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_16`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; - } catch { /* skip */ } + } catch (e: any) { console.error("[outbound] cat load error:", col, e?.message, e?.response?.status, e?.response?.data); } }) - ).then(() => setCatMap(map)); + ).then(() => { + console.log("[outbound] catMap loaded:", JSON.stringify(map).slice(0, 200)); + setCatMap(map); + }); }, []); const resolveCat = useCallback((col: string, code: string) => { if (!code) return ""; - return catMap[col]?.[code] || code; + const result = catMap[col]?.[code] || code; + if (code.startsWith("CAT_")) console.log("[outbound] resolveCat:", col, code, "->", result, "catMap keys:", Object.keys(catMap)); + return result; }, [catMap]); // 소스 데이터 @@ -371,7 +377,7 @@ export default function OutboundPage() { } const res = await getOutboundList(params); if (res.success) setData(res.data); - } catch { + } catch (err: any) { // ignore } finally { setLoading(false); @@ -388,7 +394,7 @@ export default function OutboundPage() { try { const res = await getOutboundWarehouses(); if (res.success) setWarehouses(res.data); - } catch { + } catch (err: any) { // ignore } })(); @@ -564,7 +570,7 @@ export default function OutboundPage() { const res = await getItemSources(keyword || undefined); if (res.success) setItems(res.data); } - } catch { + } catch (err: any) { // ignore } finally { setSourceLoading(false); @@ -596,7 +602,7 @@ export default function OutboundPage() { loadSourceData(defaultType), ]); if (numRes.success) setModalOutboundNo(numRes.data); - } catch { + } catch (err: any) { setModalOutboundNo(""); } }; @@ -899,8 +905,8 @@ export default function OutboundPage() { fetchList(); } } - } catch { - toast.error(editMode ? "수정에 실패했어요" : "출고 등록 중 오류가 발생했습니다."); + } catch (err: any) { + const msg = err?.response?.data?.message || (editMode ? "수정에 실패했어요" : "출고 등록 중 오류가 발생했습니다."); toast.error(msg); } finally { setSaving(false); } diff --git a/frontend/app/(main)/COMPANY_16/logistics/receiving/page.tsx b/frontend/app/(main)/COMPANY_16/logistics/receiving/page.tsx index 9351d06f..2933d64b 100644 --- a/frontend/app/(main)/COMPANY_16/logistics/receiving/page.tsx +++ b/frontend/app/(main)/COMPANY_16/logistics/receiving/page.tsx @@ -377,7 +377,7 @@ export default function ReceivingPage() { Promise.all( ["material", "unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_16`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; diff --git a/frontend/app/(main)/COMPANY_29/logistics/inventory/page.tsx b/frontend/app/(main)/COMPANY_29/logistics/inventory/page.tsx index 87909e6f..bd2dd8b5 100644 --- a/frontend/app/(main)/COMPANY_29/logistics/inventory/page.tsx +++ b/frontend/app/(main)/COMPANY_29/logistics/inventory/page.tsx @@ -164,7 +164,7 @@ export default function InventoryStatusPage() { } // item_info 단위 카테고리 try { - const res = await apiClient.get("/table-categories/item_info/unit/values"); + const res = await apiClient.get("/table-categories/item_info/unit/values?filterCompanyCode=COMPANY_29"); if (res.data?.success) optMap["item_unit"] = flatten(res.data.data || []); } catch { /* skip */ } setCategoryOptions(optMap); @@ -214,7 +214,6 @@ export default function InventoryStatusPage() { ...r, item_name: itemInfo?.name || "", unit: resolve("item_unit", rawUnit) || rawUnit, - warehouse_code: whMap.get(r.warehouse_code) || r.warehouse_code || "", warehouse_name: whMap.get(r.warehouse_code) || r.warehouse_code || "", status: resolve("status", r.status), _isLow: r.safety_qty && Number(r.current_qty) < Number(r.safety_qty), @@ -350,6 +349,12 @@ export default function InventoryStatusPage() { ), }; } + if (col.key === "warehouse_code") { + return { + ...base, + render: (_val: any, row: any) => row.warehouse_name || row.warehouse_code || "", + }; + } if (col.key === "safety_qty") { return { ...base, diff --git a/frontend/app/(main)/COMPANY_29/logistics/outbound/page.tsx b/frontend/app/(main)/COMPANY_29/logistics/outbound/page.tsx index f3bafd20..8cf96e1e 100644 --- a/frontend/app/(main)/COMPANY_29/logistics/outbound/page.tsx +++ b/frontend/app/(main)/COMPANY_29/logistics/outbound/page.tsx @@ -1,6 +1,7 @@ "use client"; import React, { useState, useEffect, useCallback, useMemo } from "react"; +import { apiClient } from "@/lib/api/client"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { @@ -326,7 +327,7 @@ export default function OutboundPage() { Promise.all( ["material", "unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_29`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; @@ -371,7 +372,7 @@ export default function OutboundPage() { } const res = await getOutboundList(params); if (res.success) setData(res.data); - } catch { + } catch (err: any) { // ignore } finally { setLoading(false); @@ -388,7 +389,7 @@ export default function OutboundPage() { try { const res = await getOutboundWarehouses(); if (res.success) setWarehouses(res.data); - } catch { + } catch (err: any) { // ignore } })(); @@ -564,7 +565,7 @@ export default function OutboundPage() { const res = await getItemSources(keyword || undefined); if (res.success) setItems(res.data); } - } catch { + } catch (err: any) { // ignore } finally { setSourceLoading(false); @@ -596,7 +597,7 @@ export default function OutboundPage() { loadSourceData(defaultType), ]); if (numRes.success) setModalOutboundNo(numRes.data); - } catch { + } catch (err: any) { setModalOutboundNo(""); } }; @@ -899,8 +900,8 @@ export default function OutboundPage() { fetchList(); } } - } catch { - toast.error(editMode ? "수정에 실패했어요" : "출고 등록 중 오류가 발생했습니다."); + } catch (err: any) { + const msg = err?.response?.data?.message || (editMode ? "수정에 실패했어요" : "출고 등록 중 오류가 발생했습니다."); toast.error(msg); } finally { setSaving(false); } diff --git a/frontend/app/(main)/COMPANY_29/logistics/receiving/page.tsx b/frontend/app/(main)/COMPANY_29/logistics/receiving/page.tsx index 9351d06f..4ec40482 100644 --- a/frontend/app/(main)/COMPANY_29/logistics/receiving/page.tsx +++ b/frontend/app/(main)/COMPANY_29/logistics/receiving/page.tsx @@ -377,7 +377,7 @@ export default function ReceivingPage() { Promise.all( ["material", "unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_29`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; diff --git a/frontend/app/(main)/COMPANY_30/logistics/inventory/page.tsx b/frontend/app/(main)/COMPANY_30/logistics/inventory/page.tsx index 87909e6f..64cd7213 100644 --- a/frontend/app/(main)/COMPANY_30/logistics/inventory/page.tsx +++ b/frontend/app/(main)/COMPANY_30/logistics/inventory/page.tsx @@ -164,7 +164,7 @@ export default function InventoryStatusPage() { } // item_info 단위 카테고리 try { - const res = await apiClient.get("/table-categories/item_info/unit/values"); + const res = await apiClient.get("/table-categories/item_info/unit/values?filterCompanyCode=COMPANY_30"); if (res.data?.success) optMap["item_unit"] = flatten(res.data.data || []); } catch { /* skip */ } setCategoryOptions(optMap); @@ -214,7 +214,6 @@ export default function InventoryStatusPage() { ...r, item_name: itemInfo?.name || "", unit: resolve("item_unit", rawUnit) || rawUnit, - warehouse_code: whMap.get(r.warehouse_code) || r.warehouse_code || "", warehouse_name: whMap.get(r.warehouse_code) || r.warehouse_code || "", status: resolve("status", r.status), _isLow: r.safety_qty && Number(r.current_qty) < Number(r.safety_qty), @@ -350,6 +349,12 @@ export default function InventoryStatusPage() { ), }; } + if (col.key === "warehouse_code") { + return { + ...base, + render: (_val: any, row: any) => row.warehouse_name || row.warehouse_code || "", + }; + } if (col.key === "safety_qty") { return { ...base, diff --git a/frontend/app/(main)/COMPANY_30/logistics/outbound/page.tsx b/frontend/app/(main)/COMPANY_30/logistics/outbound/page.tsx index f3bafd20..9c7eafcb 100644 --- a/frontend/app/(main)/COMPANY_30/logistics/outbound/page.tsx +++ b/frontend/app/(main)/COMPANY_30/logistics/outbound/page.tsx @@ -1,6 +1,7 @@ "use client"; import React, { useState, useEffect, useCallback, useMemo } from "react"; +import { apiClient } from "@/lib/api/client"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { @@ -326,7 +327,7 @@ export default function OutboundPage() { Promise.all( ["material", "unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_30`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; @@ -371,7 +372,7 @@ export default function OutboundPage() { } const res = await getOutboundList(params); if (res.success) setData(res.data); - } catch { + } catch (err: any) { // ignore } finally { setLoading(false); @@ -388,7 +389,7 @@ export default function OutboundPage() { try { const res = await getOutboundWarehouses(); if (res.success) setWarehouses(res.data); - } catch { + } catch (err: any) { // ignore } })(); @@ -564,7 +565,7 @@ export default function OutboundPage() { const res = await getItemSources(keyword || undefined); if (res.success) setItems(res.data); } - } catch { + } catch (err: any) { // ignore } finally { setSourceLoading(false); @@ -596,7 +597,7 @@ export default function OutboundPage() { loadSourceData(defaultType), ]); if (numRes.success) setModalOutboundNo(numRes.data); - } catch { + } catch (err: any) { setModalOutboundNo(""); } }; @@ -899,8 +900,8 @@ export default function OutboundPage() { fetchList(); } } - } catch { - toast.error(editMode ? "수정에 실패했어요" : "출고 등록 중 오류가 발생했습니다."); + } catch (err: any) { + const msg = err?.response?.data?.message || (editMode ? "수정에 실패했어요" : "출고 등록 중 오류가 발생했습니다."); toast.error(msg); } finally { setSaving(false); } diff --git a/frontend/app/(main)/COMPANY_30/logistics/receiving/page.tsx b/frontend/app/(main)/COMPANY_30/logistics/receiving/page.tsx index 9351d06f..701ae489 100644 --- a/frontend/app/(main)/COMPANY_30/logistics/receiving/page.tsx +++ b/frontend/app/(main)/COMPANY_30/logistics/receiving/page.tsx @@ -377,7 +377,7 @@ export default function ReceivingPage() { Promise.all( ["material", "unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_30`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; diff --git a/frontend/app/(main)/COMPANY_7/logistics/inventory/page.tsx b/frontend/app/(main)/COMPANY_7/logistics/inventory/page.tsx index 87909e6f..8c99e060 100644 --- a/frontend/app/(main)/COMPANY_7/logistics/inventory/page.tsx +++ b/frontend/app/(main)/COMPANY_7/logistics/inventory/page.tsx @@ -164,7 +164,7 @@ export default function InventoryStatusPage() { } // item_info 단위 카테고리 try { - const res = await apiClient.get("/table-categories/item_info/unit/values"); + const res = await apiClient.get("/table-categories/item_info/unit/values?filterCompanyCode=COMPANY_7"); if (res.data?.success) optMap["item_unit"] = flatten(res.data.data || []); } catch { /* skip */ } setCategoryOptions(optMap); @@ -214,7 +214,6 @@ export default function InventoryStatusPage() { ...r, item_name: itemInfo?.name || "", unit: resolve("item_unit", rawUnit) || rawUnit, - warehouse_code: whMap.get(r.warehouse_code) || r.warehouse_code || "", warehouse_name: whMap.get(r.warehouse_code) || r.warehouse_code || "", status: resolve("status", r.status), _isLow: r.safety_qty && Number(r.current_qty) < Number(r.safety_qty), @@ -350,6 +349,12 @@ export default function InventoryStatusPage() { ), }; } + if (col.key === "warehouse_code") { + return { + ...base, + render: (_val: any, row: any) => row.warehouse_name || row.warehouse_code || "", + }; + } if (col.key === "safety_qty") { return { ...base, diff --git a/frontend/app/(main)/COMPANY_7/logistics/outbound/page.tsx b/frontend/app/(main)/COMPANY_7/logistics/outbound/page.tsx index f3bafd20..ae9fdf27 100644 --- a/frontend/app/(main)/COMPANY_7/logistics/outbound/page.tsx +++ b/frontend/app/(main)/COMPANY_7/logistics/outbound/page.tsx @@ -1,6 +1,7 @@ "use client"; import React, { useState, useEffect, useCallback, useMemo } from "react"; +import { apiClient } from "@/lib/api/client"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { @@ -326,7 +327,7 @@ export default function OutboundPage() { Promise.all( ["material", "unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_7`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; @@ -899,8 +900,9 @@ export default function OutboundPage() { fetchList(); } } - } catch { - toast.error(editMode ? "수정에 실패했어요" : "출고 등록 중 오류가 발생했습니다."); + } catch (err: any) { + const msg = err?.response?.data?.message || (editMode ? "수정에 실패했어요" : "출고 등록 중 오류가 발생했습니다."); + toast.error(msg); } finally { setSaving(false); } diff --git a/frontend/app/(main)/COMPANY_7/logistics/receiving/page.tsx b/frontend/app/(main)/COMPANY_7/logistics/receiving/page.tsx index 9351d06f..d3d1e955 100644 --- a/frontend/app/(main)/COMPANY_7/logistics/receiving/page.tsx +++ b/frontend/app/(main)/COMPANY_7/logistics/receiving/page.tsx @@ -377,7 +377,7 @@ export default function ReceivingPage() { Promise.all( ["material", "unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_7`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; diff --git a/frontend/app/(main)/COMPANY_8/logistics/inventory/page.tsx b/frontend/app/(main)/COMPANY_8/logistics/inventory/page.tsx index 87909e6f..fa7eba06 100644 --- a/frontend/app/(main)/COMPANY_8/logistics/inventory/page.tsx +++ b/frontend/app/(main)/COMPANY_8/logistics/inventory/page.tsx @@ -164,7 +164,7 @@ export default function InventoryStatusPage() { } // item_info 단위 카테고리 try { - const res = await apiClient.get("/table-categories/item_info/unit/values"); + const res = await apiClient.get("/table-categories/item_info/unit/values?filterCompanyCode=COMPANY_8"); if (res.data?.success) optMap["item_unit"] = flatten(res.data.data || []); } catch { /* skip */ } setCategoryOptions(optMap); @@ -214,7 +214,6 @@ export default function InventoryStatusPage() { ...r, item_name: itemInfo?.name || "", unit: resolve("item_unit", rawUnit) || rawUnit, - warehouse_code: whMap.get(r.warehouse_code) || r.warehouse_code || "", warehouse_name: whMap.get(r.warehouse_code) || r.warehouse_code || "", status: resolve("status", r.status), _isLow: r.safety_qty && Number(r.current_qty) < Number(r.safety_qty), @@ -350,6 +349,12 @@ export default function InventoryStatusPage() { ), }; } + if (col.key === "warehouse_code") { + return { + ...base, + render: (_val: any, row: any) => row.warehouse_name || row.warehouse_code || "", + }; + } if (col.key === "safety_qty") { return { ...base, diff --git a/frontend/app/(main)/COMPANY_8/logistics/outbound/page.tsx b/frontend/app/(main)/COMPANY_8/logistics/outbound/page.tsx index f3bafd20..86c425dd 100644 --- a/frontend/app/(main)/COMPANY_8/logistics/outbound/page.tsx +++ b/frontend/app/(main)/COMPANY_8/logistics/outbound/page.tsx @@ -1,6 +1,7 @@ "use client"; import React, { useState, useEffect, useCallback, useMemo } from "react"; +import { apiClient } from "@/lib/api/client"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { @@ -326,7 +327,7 @@ export default function OutboundPage() { Promise.all( ["material", "unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_8`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; @@ -371,7 +372,7 @@ export default function OutboundPage() { } const res = await getOutboundList(params); if (res.success) setData(res.data); - } catch { + } catch (err: any) { // ignore } finally { setLoading(false); @@ -388,7 +389,7 @@ export default function OutboundPage() { try { const res = await getOutboundWarehouses(); if (res.success) setWarehouses(res.data); - } catch { + } catch (err: any) { // ignore } })(); @@ -564,7 +565,7 @@ export default function OutboundPage() { const res = await getItemSources(keyword || undefined); if (res.success) setItems(res.data); } - } catch { + } catch (err: any) { // ignore } finally { setSourceLoading(false); @@ -596,7 +597,7 @@ export default function OutboundPage() { loadSourceData(defaultType), ]); if (numRes.success) setModalOutboundNo(numRes.data); - } catch { + } catch (err: any) { setModalOutboundNo(""); } }; @@ -899,8 +900,8 @@ export default function OutboundPage() { fetchList(); } } - } catch { - toast.error(editMode ? "수정에 실패했어요" : "출고 등록 중 오류가 발생했습니다."); + } catch (err: any) { + const msg = err?.response?.data?.message || (editMode ? "수정에 실패했어요" : "출고 등록 중 오류가 발생했습니다."); toast.error(msg); } finally { setSaving(false); } diff --git a/frontend/app/(main)/COMPANY_8/logistics/receiving/page.tsx b/frontend/app/(main)/COMPANY_8/logistics/receiving/page.tsx index 9351d06f..5e692c46 100644 --- a/frontend/app/(main)/COMPANY_8/logistics/receiving/page.tsx +++ b/frontend/app/(main)/COMPANY_8/logistics/receiving/page.tsx @@ -377,7 +377,7 @@ export default function ReceivingPage() { Promise.all( ["material", "unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_8`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; diff --git a/frontend/app/(main)/COMPANY_9/logistics/inventory/page.tsx b/frontend/app/(main)/COMPANY_9/logistics/inventory/page.tsx index 87909e6f..5c993072 100644 --- a/frontend/app/(main)/COMPANY_9/logistics/inventory/page.tsx +++ b/frontend/app/(main)/COMPANY_9/logistics/inventory/page.tsx @@ -164,7 +164,7 @@ export default function InventoryStatusPage() { } // item_info 단위 카테고리 try { - const res = await apiClient.get("/table-categories/item_info/unit/values"); + const res = await apiClient.get("/table-categories/item_info/unit/values?filterCompanyCode=COMPANY_9"); if (res.data?.success) optMap["item_unit"] = flatten(res.data.data || []); } catch { /* skip */ } setCategoryOptions(optMap); @@ -214,7 +214,6 @@ export default function InventoryStatusPage() { ...r, item_name: itemInfo?.name || "", unit: resolve("item_unit", rawUnit) || rawUnit, - warehouse_code: whMap.get(r.warehouse_code) || r.warehouse_code || "", warehouse_name: whMap.get(r.warehouse_code) || r.warehouse_code || "", status: resolve("status", r.status), _isLow: r.safety_qty && Number(r.current_qty) < Number(r.safety_qty), @@ -350,6 +349,12 @@ export default function InventoryStatusPage() { ), }; } + if (col.key === "warehouse_code") { + return { + ...base, + render: (_val: any, row: any) => row.warehouse_name || row.warehouse_code || "", + }; + } if (col.key === "safety_qty") { return { ...base, diff --git a/frontend/app/(main)/COMPANY_9/logistics/outbound/page.tsx b/frontend/app/(main)/COMPANY_9/logistics/outbound/page.tsx index f3bafd20..e8f603db 100644 --- a/frontend/app/(main)/COMPANY_9/logistics/outbound/page.tsx +++ b/frontend/app/(main)/COMPANY_9/logistics/outbound/page.tsx @@ -1,6 +1,7 @@ "use client"; import React, { useState, useEffect, useCallback, useMemo } from "react"; +import { apiClient } from "@/lib/api/client"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { @@ -326,7 +327,7 @@ export default function OutboundPage() { Promise.all( ["material", "unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_9`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; @@ -371,7 +372,7 @@ export default function OutboundPage() { } const res = await getOutboundList(params); if (res.success) setData(res.data); - } catch { + } catch (err: any) { // ignore } finally { setLoading(false); @@ -388,7 +389,7 @@ export default function OutboundPage() { try { const res = await getOutboundWarehouses(); if (res.success) setWarehouses(res.data); - } catch { + } catch (err: any) { // ignore } })(); @@ -564,7 +565,7 @@ export default function OutboundPage() { const res = await getItemSources(keyword || undefined); if (res.success) setItems(res.data); } - } catch { + } catch (err: any) { // ignore } finally { setSourceLoading(false); @@ -596,7 +597,7 @@ export default function OutboundPage() { loadSourceData(defaultType), ]); if (numRes.success) setModalOutboundNo(numRes.data); - } catch { + } catch (err: any) { setModalOutboundNo(""); } }; @@ -899,8 +900,8 @@ export default function OutboundPage() { fetchList(); } } - } catch { - toast.error(editMode ? "수정에 실패했어요" : "출고 등록 중 오류가 발생했습니다."); + } catch (err: any) { + const msg = err?.response?.data?.message || (editMode ? "수정에 실패했어요" : "출고 등록 중 오류가 발생했습니다."); toast.error(msg); } finally { setSaving(false); } diff --git a/frontend/app/(main)/COMPANY_9/logistics/receiving/page.tsx b/frontend/app/(main)/COMPANY_9/logistics/receiving/page.tsx index 9351d06f..4c357120 100644 --- a/frontend/app/(main)/COMPANY_9/logistics/receiving/page.tsx +++ b/frontend/app/(main)/COMPANY_9/logistics/receiving/page.tsx @@ -377,7 +377,7 @@ export default function ReceivingPage() { Promise.all( ["material", "unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_9`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label;