feat: Enhance receiving update functionality and clean up imports
- Updated the receiving controller to allow for the update of inbound records, including both header and item fields (inbound_qty, unit_price, total_amount). - Cleaned up the import statements in the receiving page by removing a duplicate toast import, improving code clarity and maintainability.
This commit is contained in:
@@ -472,7 +472,7 @@ export async function update(req: AuthenticatedRequest, res: Response) {
|
||||
|
||||
await client.query("BEGIN");
|
||||
|
||||
// 헤더 업데이트 (inbound_mng) — 헤더 레벨 필드만
|
||||
// 입고 레코드 업데이트 (헤더 + 품목 필드 모두)
|
||||
const headerResult = await client.query(
|
||||
`UPDATE inbound_mng SET
|
||||
inbound_date = COALESCE($1::date, inbound_date),
|
||||
@@ -482,6 +482,9 @@ export async function update(req: AuthenticatedRequest, res: Response) {
|
||||
inspector = COALESCE($5, inspector),
|
||||
manager = COALESCE($6, manager),
|
||||
memo = COALESCE($7, memo),
|
||||
inbound_qty = COALESCE($11::numeric, inbound_qty),
|
||||
unit_price = COALESCE($12::numeric, unit_price),
|
||||
total_amount = COALESCE($13::numeric, total_amount),
|
||||
updated_date = NOW(),
|
||||
updated_by = $8
|
||||
WHERE id = $9 AND company_code = $10
|
||||
@@ -497,6 +500,9 @@ export async function update(req: AuthenticatedRequest, res: Response) {
|
||||
userId,
|
||||
id,
|
||||
companyCode,
|
||||
inbound_qty || null,
|
||||
unit_price || null,
|
||||
total_amount || null,
|
||||
],
|
||||
);
|
||||
|
||||
|
||||
@@ -56,7 +56,6 @@ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover
|
||||
import { cn } from "@/lib/utils";
|
||||
import { toast } from "sonner";
|
||||
import { apiClient } from "@/lib/api/client";
|
||||
import { toast } from "sonner";
|
||||
import { useTableSettings } from "@/hooks/useTableSettings";
|
||||
import { TableSettingsModal } from "@/components/common/TableSettingsModal";
|
||||
import { DynamicSearchFilter, FilterValue } from "@/components/common/DynamicSearchFilter";
|
||||
|
||||
Reference in New Issue
Block a user