merge: feature/pop-outbound-cart-settings → pop-dev
- 출고 장바구니 설정 추가 (screen_id 7010) - 채번규칙 장바구니 화면에서만 표시 - iframe 매칭 URL 우선순위 수정 - 입고/출고 상태값 PC와 동일하게 수정
This commit is contained in:
@@ -121,6 +121,7 @@ const SCREEN_GROUPS: ScreenGroup[] = [
|
||||
screens: [
|
||||
{ id: "sales-outbound", name: "판매출고", url: "/pop/outbound/sales", settingsKey: "outbound", screenId: 5 },
|
||||
{ id: "outbound-type", name: "출고유형선택", url: "/pop/outbound", settingsKey: "outbound", screenId: 6 },
|
||||
{ id: "outbound-cart", name: "출고 장바구니", url: "/pop/outbound/cart", settingsKey: "outbound", screenId: 7010 },
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -170,11 +171,12 @@ interface SettingField {
|
||||
options?: { value: string; label: string }[];
|
||||
fields?: { key: string; label: string; type: string }[];
|
||||
tableFilter?: string; // numbering-rule용: inbound/outbound 등
|
||||
showOnlyForScreens?: string[]; // 특정 화면 ID에서만 표시 (예: ["inbound-cart"])
|
||||
}
|
||||
|
||||
const SETTINGS_SCHEMA: Record<string, SettingField[]> = {
|
||||
inbound: [
|
||||
{ key: "numberingRuleId", label: "📋 입고번호 채번규칙", description: "입고 확정 시 사용할 채번규칙을 선택합니다", type: "numbering-rule", tableFilter: "inbound" },
|
||||
{ key: "numberingRuleId", label: "📋 입고번호 채번규칙", description: "입고 확정 시 사용할 채번규칙을 선택합니다", type: "numbering-rule", tableFilter: "inbound", showOnlyForScreens: ["inbound-cart"] },
|
||||
{ key: "barcodeEnabled", label: "바코드 스캔 (미구현)", description: "바코드/QR 스캔 기능을 사용합니다", type: "toggle" },
|
||||
{ key: "inspectionRequired", label: "검사 필수 (미구현)", description: "입고 시 검사 항목을 필수로 표시합니다", type: "toggle" },
|
||||
{ key: "photoUpload", label: "사진 첨부 (미구현)", description: "입고 확정 시 사진 첨부를 허용합니다", type: "toggle" },
|
||||
@@ -182,7 +184,7 @@ const SETTINGS_SCHEMA: Record<string, SettingField[]> = {
|
||||
{ key: "defectSeparation", label: "불량 분리 (미구현)", description: "양품/불량 수량을 분리 입력합니다", type: "toggle" },
|
||||
],
|
||||
outbound: [
|
||||
{ key: "numberingRuleId", label: "📋 출고번호 채번규칙", description: "출고 확정 시 사용할 채번규칙을 선택합니다", type: "numbering-rule", tableFilter: "outbound" },
|
||||
{ key: "numberingRuleId", label: "📋 출고번호 채번규칙", description: "출고 확정 시 사용할 채번규칙을 선택합니다", type: "numbering-rule", tableFilter: "outbound", showOnlyForScreens: ["outbound-cart"] },
|
||||
{ key: "barcodeEnabled", label: "바코드 스캔 (미구현)", description: "바코드/QR 스캔 기능을 사용합니다", type: "toggle" },
|
||||
{ key: "photoUpload", label: "사진 첨부 (미구현)", description: "출고 시 사진 첨부를 허용합니다", type: "toggle" },
|
||||
],
|
||||
@@ -829,13 +831,24 @@ export default function PopSettingsMngPage() {
|
||||
const path = iframeRef.current?.contentWindow?.location.pathname;
|
||||
if (path && path !== lastPath) {
|
||||
setLastPath(path);
|
||||
// 1순위: 정확 일치, 2순위: 길이 긴 url부터 startsWith 매칭 (구체적 경로 우선)
|
||||
let bestMatch: ScreenItem | null = null;
|
||||
let bestUrlLength = -1;
|
||||
for (const group of SCREEN_GROUPS) {
|
||||
const found = group.screens.find((s) => path === s.url || path.startsWith(s.url + "/"));
|
||||
if (found) {
|
||||
setSelectedScreen(found);
|
||||
break;
|
||||
for (const s of group.screens) {
|
||||
if (path === s.url) {
|
||||
bestMatch = s;
|
||||
bestUrlLength = Infinity;
|
||||
break;
|
||||
}
|
||||
if (path.startsWith(s.url + "/") && s.url.length > bestUrlLength) {
|
||||
bestMatch = s;
|
||||
bestUrlLength = s.url.length;
|
||||
}
|
||||
}
|
||||
if (bestUrlLength === Infinity) break;
|
||||
}
|
||||
if (bestMatch) setSelectedScreen(bestMatch);
|
||||
}
|
||||
} catch {
|
||||
// cross-origin: silently ignore
|
||||
@@ -932,7 +945,12 @@ export default function PopSettingsMngPage() {
|
||||
|
||||
// ---- Current screen schema values ----
|
||||
const currentSettingsKey = selectedScreen?.settingsKey || "inbound";
|
||||
const currentFields = SETTINGS_SCHEMA[currentSettingsKey] || [];
|
||||
const allFields = SETTINGS_SCHEMA[currentSettingsKey] || [];
|
||||
// showOnlyForScreens 옵션이 있으면 현재 화면 ID와 일치할 때만 표시
|
||||
const currentFields = allFields.filter((f) => {
|
||||
if (!f.showOnlyForScreens) return true;
|
||||
return selectedScreen?.id ? f.showOnlyForScreens.includes(selectedScreen.id) : false;
|
||||
});
|
||||
const currentValues = (settings.screens as Record<string, Record<string, unknown>>)[currentSettingsKey] || {};
|
||||
|
||||
return (
|
||||
|
||||
@@ -350,6 +350,7 @@ export function InboundCartPage() {
|
||||
reference_number: item.purchase_no,
|
||||
supplier_code: item.supplier_code,
|
||||
supplier_name: item.supplier_name,
|
||||
inbound_status: "입고완료",
|
||||
inspection_status: inspResult?.completed
|
||||
? "검사완료"
|
||||
: item.inspection_required
|
||||
|
||||
@@ -306,9 +306,10 @@ export function OutboundCartPage() {
|
||||
try {
|
||||
// Generate outbound number at confirm time
|
||||
// POP 화면설정에서 선택한 채번규칙 사용 (없으면 기본)
|
||||
// 출고 장바구니 전용 screen_id 7010
|
||||
let finalNumber = "";
|
||||
try {
|
||||
const settingsRes: any = await apiClient.get("/screen-management/screens/5/layout-pop").catch(() => null);
|
||||
const settingsRes: any = await apiClient.get("/screen-management/screens/7010/layout-pop").catch(() => null);
|
||||
const ruleId = settingsRes?.data?.data?.settings?.popConfig?.outbound?.numberingRuleId;
|
||||
const url = ruleId && ruleId !== "__none__"
|
||||
? `/outbound/generate-number?ruleId=${encodeURIComponent(ruleId)}`
|
||||
@@ -343,7 +344,7 @@ export function OutboundCartPage() {
|
||||
customer_name: item.customer_name,
|
||||
source_type: "shipment_instruction_detail",
|
||||
source_id: item.source_id || item.id,
|
||||
outbound_status: "대기",
|
||||
outbound_status: "출고완료",
|
||||
})),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user