From 3131dce1f0c90d960f53bd384045b41023064bc4 Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Wed, 26 Nov 2025 14:15:23 +0900
Subject: (김준회) dolce: b4 일괄업로드건 요구사항대로 수정,
 DrawingUsage-Comment 건들도 상세도면 생성 가능하도록 변경
 (MatchBatchFileDwg/Edit 사용하도록 변경, 호출시 Category 및 status 값
 하드코딩해 넣어주도록 변경)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../add-and-modify-detail-drawing-dialog.tsx       | 77 +++++++++++-----------
 1 file changed, 40 insertions(+), 37 deletions(-)

(limited to 'lib/dolce/dialogs/add-and-modify-detail-drawing-dialog.tsx')

diff --git a/lib/dolce/dialogs/add-and-modify-detail-drawing-dialog.tsx b/lib/dolce/dialogs/add-and-modify-detail-drawing-dialog.tsx
index 87819693..673d48d6 100644
--- a/lib/dolce/dialogs/add-and-modify-detail-drawing-dialog.tsx
+++ b/lib/dolce/dialogs/add-and-modify-detail-drawing-dialog.tsx
@@ -164,18 +164,21 @@ export function AddAndModifyDetailDrawingDialog({
       toast.error(t("addDetailDialog.selectRegisterKindError"));
       return;
     }
-    if (!revision.trim()) {
-      toast.error(t("addDetailDialog.selectRevisionError"));
-      setRevisionError(t("addDetailDialog.revisionRequired"));
-      return;
-    }
     
-    // Revision 형식 검증
-    const revisionValidationError = validateRevision(revision);
-    if (revisionValidationError) {
-      toast.error(revisionValidationError);
-      setRevisionError(revisionValidationError);
-      return;
+    if (drawingUsage !== "CMT") {
+      if (!revision.trim()) {
+        toast.error(t("addDetailDialog.selectRevisionError"));
+        setRevisionError(t("addDetailDialog.revisionRequired"));
+        return;
+      }
+      
+      // Revision 형식 검증
+      const revisionValidationError = validateRevision(revision);
+      if (revisionValidationError) {
+        toast.error(revisionValidationError);
+        setRevisionError(revisionValidationError);
+        return;
+      }
     }
     
     // Add 모드일 때만 파일 필수
@@ -219,7 +222,7 @@ export function AddAndModifyDetailDrawingDialog({
               RegisterGroupId: drawing.RegisterGroupId,
               RegisterSerialNo: 0, // 자동 증가
               RegisterKind: registerKind,
-              DrawingRevNo: revision,
+              DrawingRevNo: drawingUsage === "CMT" ? null : revision,
               Category: "TS", // To SHI (벤더가 SHI에게 제출)
               Receiver: null,
               Manager: "",
@@ -293,7 +296,7 @@ export function AddAndModifyDetailDrawingDialog({
               RegisterGroupId: detailDrawing.RegisterGroupId,
               RegisterSerialNo: detailDrawing.RegisterSerialNo,
               RegisterKind: registerKind,
-              DrawingRevNo: revision,
+              DrawingRevNo: drawingUsage === "CMT" ? null : revision,
               Category: detailDrawing.Category,
               Receiver: detailDrawing.Receiver,
               Manager: detailDrawing.Manager,
@@ -345,12 +348,10 @@ export function AddAndModifyDetailDrawingDialog({
   const isFormValid = mode === "add"
     ? drawingUsage.trim() !== "" &&
       registerKind.trim() !== "" &&
-      revision.trim() !== "" &&
-      !revisionError &&
+      (drawingUsage === "CMT" || (revision.trim() !== "" && !revisionError)) &&
       files.length > 0
     : registerKind.trim() !== "" &&
-      revision.trim() !== "" &&
-      !revisionError;
+      (drawingUsage === "CMT" || (revision.trim() !== "" && !revisionError));
 
   return (
     <Dialog open={open} onOpenChange={onOpenChange}>
@@ -429,26 +430,28 @@ export function AddAndModifyDetailDrawingDialog({
           </div>
 
           {/* Revision 입력 */}
-          <div className="space-y-2">
-            <Label>{t("addDetailDialog.revisionLabel")}</Label>
-            <Input
-              value={revision}
-              onChange={(e) => handleRevisionChange(e.target.value)}
-              placeholder={t("addDetailDialog.revisionPlaceholder")}
-              disabled={!registerKind}
-              className={revisionError ? "border-red-500 focus-visible:ring-red-500" : ""}
-            />
-            {revisionError && (
-              <p className="text-sm text-red-500 flex items-center gap-1">
-                {revisionError}
-              </p>
-            )}
-            {!revisionError && revision && (
-              <p className="text-sm text-green-600 flex items-center gap-1">
-                {t("addDetailDialog.revisionValid")}
-              </p>
-            )}
-          </div>
+          {drawingUsage !== "CMT" && (
+            <div className="space-y-2">
+              <Label>{t("addDetailDialog.revisionLabel")}</Label>
+              <Input
+                value={revision}
+                onChange={(e) => handleRevisionChange(e.target.value)}
+                placeholder={t("addDetailDialog.revisionPlaceholder")}
+                disabled={!registerKind}
+                className={revisionError ? "border-red-500 focus-visible:ring-red-500" : ""}
+              />
+              {revisionError && (
+                <p className="text-sm text-red-500 flex items-center gap-1">
+                  {revisionError}
+                </p>
+              )}
+              {!revisionError && revision && (
+                <p className="text-sm text-green-600 flex items-center gap-1">
+                  {t("addDetailDialog.revisionValid")}
+                </p>
+              )}
+            </div>
+          )}
 
           {/* Comment 입력 */}
           <div className="space-y-2">
-- 
cgit v1.2.3

