From 80148a0593843bcc81cb38d61d56d42c29d0fb5d Mon Sep 17 00:00:00 2001 From: kjs Date: Fri, 8 May 2026 11:19:34 +0900 Subject: [PATCH] Update Receiving Page to Include Inventory Unit Field - Modified the receiving controller to include the `inventory_unit` field in the item selection query. - Updated the frontend components across multiple company pages to reference the new `inventory_unit` field instead of the previous `unit` field, ensuring consistency in data handling. - Removed hardcoded company code from API calls to allow for dynamic fetching of item information. (TASK: ERP-030) --- backend-node/src/controllers/receivingController.ts | 2 +- frontend/app/(main)/COMPANY_10/logistics/receiving/page.tsx | 4 ++-- frontend/app/(main)/COMPANY_16/logistics/receiving/page.tsx | 4 ++-- frontend/app/(main)/COMPANY_28/logistics/receiving/page.tsx | 4 ++-- frontend/app/(main)/COMPANY_29/logistics/receiving/page.tsx | 4 ++-- frontend/app/(main)/COMPANY_7/logistics/receiving/page.tsx | 4 ++-- frontend/app/(main)/COMPANY_8/logistics/receiving/page.tsx | 4 ++-- frontend/app/(main)/COMPANY_9/logistics/receiving/page.tsx | 4 ++-- frontend/lib/api/receiving.ts | 1 + 9 files changed, 16 insertions(+), 15 deletions(-) diff --git a/backend-node/src/controllers/receivingController.ts b/backend-node/src/controllers/receivingController.ts index 1867eb1c..c7592305 100644 --- a/backend-node/src/controllers/receivingController.ts +++ b/backend-node/src/controllers/receivingController.ts @@ -1262,7 +1262,7 @@ export async function getItems(req: AuthenticatedRequest, res: Response) { const dataResult = await pool.query( `SELECT - id, item_number, item_name, size AS spec, material, unit, + id, item_number, item_name, size AS spec, material, unit, inventory_unit, COALESCE(width::text, '') AS width, COALESCE(height::text, '') AS height, COALESCE(thickness::text, '') AS thickness, diff --git a/frontend/app/(main)/COMPANY_10/logistics/receiving/page.tsx b/frontend/app/(main)/COMPANY_10/logistics/receiving/page.tsx index 6d8249e6..fd4e1e2d 100644 --- a/frontend/app/(main)/COMPANY_10/logistics/receiving/page.tsx +++ b/frontend/app/(main)/COMPANY_10/logistics/receiving/page.tsx @@ -329,7 +329,7 @@ export default function ReceivingPage() { Promise.all( ["material", "inventory_unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_16`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; @@ -1770,7 +1770,7 @@ function SourceItemTable({ {item.spec || "-"} {resolveCat("material", item.material) || "-"} - {resolveCat("inventory_unit", item.unit) || "-"} + {resolveCat("inventory_unit", item.inventory_unit) || "-"} {Number(item.standard_price).toLocaleString()} diff --git a/frontend/app/(main)/COMPANY_16/logistics/receiving/page.tsx b/frontend/app/(main)/COMPANY_16/logistics/receiving/page.tsx index 6d8249e6..fd4e1e2d 100644 --- a/frontend/app/(main)/COMPANY_16/logistics/receiving/page.tsx +++ b/frontend/app/(main)/COMPANY_16/logistics/receiving/page.tsx @@ -329,7 +329,7 @@ export default function ReceivingPage() { Promise.all( ["material", "inventory_unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_16`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; @@ -1770,7 +1770,7 @@ function SourceItemTable({ {item.spec || "-"} {resolveCat("material", item.material) || "-"} - {resolveCat("inventory_unit", item.unit) || "-"} + {resolveCat("inventory_unit", item.inventory_unit) || "-"} {Number(item.standard_price).toLocaleString()} diff --git a/frontend/app/(main)/COMPANY_28/logistics/receiving/page.tsx b/frontend/app/(main)/COMPANY_28/logistics/receiving/page.tsx index 0401bbc0..608e2267 100644 --- a/frontend/app/(main)/COMPANY_28/logistics/receiving/page.tsx +++ b/frontend/app/(main)/COMPANY_28/logistics/receiving/page.tsx @@ -328,7 +328,7 @@ export default function ReceivingPage() { Promise.all( ["material", "inventory_unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_16`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; @@ -1765,7 +1765,7 @@ function SourceItemTable({ {item.spec || "-"} {resolveCat("material", item.material) || "-"} - {resolveCat("inventory_unit", item.unit) || "-"} + {resolveCat("inventory_unit", item.inventory_unit) || "-"} {Number(item.standard_price).toLocaleString()} diff --git a/frontend/app/(main)/COMPANY_29/logistics/receiving/page.tsx b/frontend/app/(main)/COMPANY_29/logistics/receiving/page.tsx index 6d8249e6..fd4e1e2d 100644 --- a/frontend/app/(main)/COMPANY_29/logistics/receiving/page.tsx +++ b/frontend/app/(main)/COMPANY_29/logistics/receiving/page.tsx @@ -329,7 +329,7 @@ export default function ReceivingPage() { Promise.all( ["material", "inventory_unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_16`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; @@ -1770,7 +1770,7 @@ function SourceItemTable({ {item.spec || "-"} {resolveCat("material", item.material) || "-"} - {resolveCat("inventory_unit", item.unit) || "-"} + {resolveCat("inventory_unit", item.inventory_unit) || "-"} {Number(item.standard_price).toLocaleString()} diff --git a/frontend/app/(main)/COMPANY_7/logistics/receiving/page.tsx b/frontend/app/(main)/COMPANY_7/logistics/receiving/page.tsx index 6d8249e6..fd4e1e2d 100644 --- a/frontend/app/(main)/COMPANY_7/logistics/receiving/page.tsx +++ b/frontend/app/(main)/COMPANY_7/logistics/receiving/page.tsx @@ -329,7 +329,7 @@ export default function ReceivingPage() { Promise.all( ["material", "inventory_unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_16`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; @@ -1770,7 +1770,7 @@ function SourceItemTable({ {item.spec || "-"} {resolveCat("material", item.material) || "-"} - {resolveCat("inventory_unit", item.unit) || "-"} + {resolveCat("inventory_unit", item.inventory_unit) || "-"} {Number(item.standard_price).toLocaleString()} diff --git a/frontend/app/(main)/COMPANY_8/logistics/receiving/page.tsx b/frontend/app/(main)/COMPANY_8/logistics/receiving/page.tsx index dffcd9e9..c86bcc90 100644 --- a/frontend/app/(main)/COMPANY_8/logistics/receiving/page.tsx +++ b/frontend/app/(main)/COMPANY_8/logistics/receiving/page.tsx @@ -329,7 +329,7 @@ export default function ReceivingPage() { Promise.all( ["material", "inventory_unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_16`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; @@ -1765,7 +1765,7 @@ function SourceItemTable({ {item.spec || "-"} {resolveCat("material", item.material) || "-"} - {resolveCat("inventory_unit", item.unit) || "-"} + {resolveCat("inventory_unit", item.inventory_unit) || "-"} {Number(item.standard_price).toLocaleString()} diff --git a/frontend/app/(main)/COMPANY_9/logistics/receiving/page.tsx b/frontend/app/(main)/COMPANY_9/logistics/receiving/page.tsx index 6d8249e6..fd4e1e2d 100644 --- a/frontend/app/(main)/COMPANY_9/logistics/receiving/page.tsx +++ b/frontend/app/(main)/COMPANY_9/logistics/receiving/page.tsx @@ -329,7 +329,7 @@ export default function ReceivingPage() { Promise.all( ["material", "inventory_unit"].map(async (col) => { try { - const res = await apiClient.get(`/table-categories/item_info/${col}/values?filterCompanyCode=COMPANY_16`); + const res = await apiClient.get(`/table-categories/item_info/${col}/values`); const items = flatten(res.data?.data || []); map[col] = {}; for (const item of items) map[col][item.code] = item.label; @@ -1770,7 +1770,7 @@ function SourceItemTable({ {item.spec || "-"} {resolveCat("material", item.material) || "-"} - {resolveCat("inventory_unit", item.unit) || "-"} + {resolveCat("inventory_unit", item.inventory_unit) || "-"} {Number(item.standard_price).toLocaleString()} diff --git a/frontend/lib/api/receiving.ts b/frontend/lib/api/receiving.ts index d9c97002..e2aee36f 100644 --- a/frontend/lib/api/receiving.ts +++ b/frontend/lib/api/receiving.ts @@ -76,6 +76,7 @@ export interface ItemSource { spec: string | null; material: string | null; unit: string | null; + inventory_unit: string | null; standard_price: number; }