Merge branch 'main' of http://39.117.244.52:3000/kjs/ERP-node into lhj
; Please enter a commit message to explain why this merge is necessary, ; especially if it merges an updated upstream into a topic branch. ; ; Lines starting with ';' will be ignored, and an empty message aborts ; the commit.
This commit is contained in:
@@ -207,11 +207,12 @@ export class AutoGenerationUtils {
|
||||
* 자동생성 타입별 설명 가져오기
|
||||
*/
|
||||
static getTypeDescription(type: AutoGenerationType): string {
|
||||
const descriptions: Record<AutoGenerationType, string> = {
|
||||
const descriptions: Record<string, string> = {
|
||||
uuid: "고유 식별자 (UUID) 생성",
|
||||
current_user: "현재 로그인한 사용자 ID",
|
||||
current_time: "현재 날짜/시간",
|
||||
sequence: "순차적 번호 생성",
|
||||
numbering_rule: "채번 규칙 기반 코드 생성",
|
||||
random_string: "랜덤 문자열 생성",
|
||||
random_number: "랜덤 숫자 생성",
|
||||
company_code: "현재 회사 코드",
|
||||
@@ -246,6 +247,9 @@ export class AutoGenerationUtils {
|
||||
case "sequence":
|
||||
return `${options.prefix || ""}1${options.suffix || ""}`;
|
||||
|
||||
case "numbering_rule":
|
||||
return "CODE-20251104-001"; // 채번 규칙 미리보기
|
||||
|
||||
case "random_string":
|
||||
return `${options.prefix || ""}ABC123${options.suffix || ""}`;
|
||||
|
||||
|
||||
@@ -257,6 +257,50 @@ export class ButtonActionExecutor {
|
||||
companyCodeValue, // ✅ 최종 회사 코드 값
|
||||
});
|
||||
|
||||
// 🎯 채번 규칙 할당 처리 (저장 시점에 실제 순번 증가)
|
||||
console.log("🔍 채번 규칙 할당 체크 시작");
|
||||
console.log("📦 현재 formData:", JSON.stringify(formData, null, 2));
|
||||
|
||||
const fieldsWithNumbering: Record<string, string> = {};
|
||||
|
||||
// formData에서 채번 규칙이 설정된 필드 찾기
|
||||
for (const [key, value] of Object.entries(formData)) {
|
||||
if (key.endsWith("_numberingRuleId") && value) {
|
||||
const fieldName = key.replace("_numberingRuleId", "");
|
||||
fieldsWithNumbering[fieldName] = value as string;
|
||||
console.log(`🎯 발견: ${fieldName} → 규칙 ${value}`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log("📋 채번 규칙이 설정된 필드:", fieldsWithNumbering);
|
||||
console.log("📊 필드 개수:", Object.keys(fieldsWithNumbering).length);
|
||||
|
||||
// 각 필드에 대해 실제 코드 할당
|
||||
for (const [fieldName, ruleId] of Object.entries(fieldsWithNumbering)) {
|
||||
try {
|
||||
console.log(`🎫 ${fieldName} 필드에 채번 규칙 ${ruleId} 할당 시작`);
|
||||
const { allocateNumberingCode } = await import("@/lib/api/numberingRule");
|
||||
const response = await allocateNumberingCode(ruleId);
|
||||
|
||||
console.log(`📡 API 응답 (${fieldName}):`, response);
|
||||
|
||||
if (response.success && response.data) {
|
||||
const generatedCode = response.data.generatedCode;
|
||||
formData[fieldName] = generatedCode;
|
||||
console.log(`✅ ${fieldName} = ${generatedCode} (할당 완료)`);
|
||||
} else {
|
||||
console.error(`❌ 채번 규칙 할당 실패 (${fieldName}):`, response.error);
|
||||
toast.error(`${fieldName} 채번 규칙 할당 실패: ${response.error}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`❌ 채번 규칙 할당 오류 (${fieldName}):`, error);
|
||||
toast.error(`${fieldName} 채번 규칙 할당 오류`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log("✅ 채번 규칙 할당 완료");
|
||||
console.log("📦 최종 formData:", JSON.stringify(formData, null, 2));
|
||||
|
||||
const dataWithUserInfo = {
|
||||
...formData,
|
||||
writer: formData.writer || writerValue, // ✅ 입력값 우선, 없으면 userId
|
||||
@@ -265,6 +309,13 @@ export class ButtonActionExecutor {
|
||||
company_code: formData.company_code || companyCodeValue, // ✅ 입력값 우선, 없으면 user.companyCode
|
||||
};
|
||||
|
||||
// _numberingRuleId 필드 제거 (실제 저장하지 않음)
|
||||
for (const key of Object.keys(dataWithUserInfo)) {
|
||||
if (key.endsWith("_numberingRuleId")) {
|
||||
delete dataWithUserInfo[key];
|
||||
}
|
||||
}
|
||||
|
||||
saveResult = await DynamicFormApi.saveFormData({
|
||||
screenId,
|
||||
tableName,
|
||||
|
||||
@@ -44,7 +44,7 @@ export function snapToGrid(position: Position, gridInfo: GridInfo, gridSettings:
|
||||
|
||||
// 격자 셀 크기 (컬럼 너비 + 간격을 하나의 격자 단위로 계산)
|
||||
const cellWidth = columnWidth + gap;
|
||||
const cellHeight = Math.max(40, gap * 2); // 행 높이를 더 크게 설정
|
||||
const cellHeight = 10; // 행 높이 10px 단위로 고정
|
||||
|
||||
// 패딩을 제외한 상대 위치
|
||||
const relativeX = position.x - padding;
|
||||
@@ -92,9 +92,9 @@ export function snapSizeToGrid(size: Size, gridInfo: GridInfo, gridSettings: Gri
|
||||
|
||||
const snappedWidth = gridColumns * columnWidth + (gridColumns - 1) * gap;
|
||||
|
||||
// 높이는 동적 행 높이 단위로 스냅
|
||||
const rowHeight = Math.max(20, gap);
|
||||
const snappedHeight = Math.max(40, Math.round(size.height / rowHeight) * rowHeight);
|
||||
// 높이는 10px 단위로 스냅
|
||||
const rowHeight = 10;
|
||||
const snappedHeight = Math.max(10, Math.round(size.height / rowHeight) * rowHeight);
|
||||
|
||||
console.log(
|
||||
`📏 크기 스냅: ${size.width}px → ${snappedWidth}px (${gridColumns}컬럼, 컬럼너비:${columnWidth}px, 간격:${gap}px)`,
|
||||
@@ -175,7 +175,7 @@ export function generateGridLines(
|
||||
|
||||
// 격자 셀 크기 (스냅 로직과 동일하게)
|
||||
const cellWidth = columnWidth + gap;
|
||||
const cellHeight = Math.max(40, gap * 2);
|
||||
const cellHeight = 10; // 행 높이 10px 단위로 고정
|
||||
|
||||
// 세로 격자선
|
||||
const verticalLines: number[] = [];
|
||||
@@ -254,8 +254,8 @@ export function alignGroupChildrenToGrid(
|
||||
const columnIndex = Math.round(effectiveX / (columnWidth + gap));
|
||||
const snappedX = padding + columnIndex * (columnWidth + gap);
|
||||
|
||||
// Y 좌표는 동적 행 높이 단위로 스냅
|
||||
const rowHeight = Math.max(20, gap);
|
||||
// Y 좌표는 10px 단위로 스냅
|
||||
const rowHeight = 10;
|
||||
const effectiveY = child.position.y - padding;
|
||||
const rowIndex = Math.round(effectiveY / rowHeight);
|
||||
const snappedY = padding + rowIndex * rowHeight;
|
||||
@@ -264,7 +264,7 @@ export function alignGroupChildrenToGrid(
|
||||
const fullColumnWidth = columnWidth + gap; // 외부 격자와 동일한 크기
|
||||
const widthInColumns = Math.max(1, Math.round(child.size.width / fullColumnWidth));
|
||||
const snappedWidth = widthInColumns * fullColumnWidth - gap; // gap 제거하여 실제 컴포넌트 크기
|
||||
const snappedHeight = Math.max(40, Math.round(child.size.height / rowHeight) * rowHeight);
|
||||
const snappedHeight = Math.max(10, Math.round(child.size.height / rowHeight) * rowHeight);
|
||||
|
||||
const snappedChild = {
|
||||
...child,
|
||||
@@ -310,7 +310,7 @@ export function calculateOptimalGroupSize(
|
||||
gridSettings: GridSettings,
|
||||
): Size {
|
||||
if (children.length === 0) {
|
||||
return { width: gridInfo.columnWidth * 2, height: 40 * 2 };
|
||||
return { width: gridInfo.columnWidth * 2, height: 10 * 4 };
|
||||
}
|
||||
|
||||
console.log("📏 calculateOptimalGroupSize 시작:", {
|
||||
|
||||
Reference in New Issue
Block a user