From 1c1c1019b6af72771358d387a2ae70ca965cd9f9 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Mon, 26 May 2025 04:25:47 +0000
Subject: (김준회) 아이템 리스트를 자재그룹으로 변경하고 PLM 인터페이스 처리
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/items/table/add-items-dialog.tsx | 203 +++++++++++++++++++++++++++++++++--
 1 file changed, 194 insertions(+), 9 deletions(-)

(limited to 'lib/items/table/add-items-dialog.tsx')

diff --git a/lib/items/table/add-items-dialog.tsx b/lib/items/table/add-items-dialog.tsx
index 2224444c..3f71b437 100644
--- a/lib/items/table/add-items-dialog.tsx
+++ b/lib/items/table/add-items-dialog.tsx
@@ -20,7 +20,6 @@ import {
 import {
   Select,
   SelectContent,
-  SelectGroup,
   SelectItem,
   SelectTrigger,
   SelectValue,
@@ -41,11 +40,31 @@ export function AddItemDialog() {
       itemCode: "",
       itemName: "",
       description: "",
+      parentItemCode: "",
+      itemLevel: 5, // 기본값 5
+      deleteFlag: "N", // 기본값 N
+      unitOfMeasure: "",
+      steelType: "",
+      gradeMaterial: "",
+      changeDate: "",
+      baseUnitOfMeasure: "",
     },
   })
 
   async function onSubmit(data: CreateItemSchema) {
-    const result = await createItem(data)
+    const result = await createItem({
+      itemCode: data.itemCode,
+      itemName: data.itemName,
+      description: data.description ?? null,
+      parentItemCode: data.parentItemCode ?? null,
+      itemLevel: data.itemLevel ?? null,
+      deleteFlag: data.deleteFlag ?? null,
+      unitOfMeasure: data.unitOfMeasure ?? null,
+      steelType: data.steelType ?? null,
+      gradeMaterial: data.gradeMaterial ?? null,
+      changeDate: data.changeDate ?? null,
+      baseUnitOfMeasure: data.baseUnitOfMeasure ?? null,
+    })
     if (result.error) {
       alert(`에러: ${result.error}`)
       return
@@ -83,16 +102,16 @@ export function AddItemDialog() {
         <Form {...form}>
           <form onSubmit={form.handleSubmit(onSubmit)}>
             <div className="space-y-4 py-4">
-
+              <p className="text-red-500 font-bold text-center">※ MDG에서 수신만 하기에 비활성화할 기능입니다. <br />직접 업로드는 기술영업만 가능</p>
               <FormField
                 control={form.control}
                 name="itemCode"
                 render={({ field }) => (
                   <FormItem>
-                    <FormLabel>Item Code</FormLabel>
+                    <FormLabel>자재그룹코드 *</FormLabel>
                     <FormControl>
                       <Input
-                        placeholder="e.g."
+                        placeholder="예: BOLT001"
                         {...field}
                       />
                     </FormControl>
@@ -105,10 +124,10 @@ export function AddItemDialog() {
                 name="itemName"
                 render={({ field }) => (
                   <FormItem>
-                    <FormLabel>Item Name</FormLabel>
+                    <FormLabel>자재그룹명 *</FormLabel>
                     <FormControl>
                       <Input
-                        placeholder="e.g."
+                        placeholder="예: 육각볼트 M8x20"
                         {...field}
                       />
                     </FormControl>
@@ -122,11 +141,12 @@ export function AddItemDialog() {
                 name="description"
                 render={({ field }) => (
                   <FormItem>
-                    <FormLabel>Description</FormLabel>
+                    <FormLabel>상세</FormLabel>
                     <FormControl>
                       <Textarea
-                        placeholder="e.g."
+                        placeholder="예: 표준 육각 볼트 스테인리스 스틸"
                         {...field}
+                        value={field.value || ""}
                       />
                     </FormControl>
                     <FormMessage />
@@ -134,6 +154,171 @@ export function AddItemDialog() {
                 )}
               />
 
+              {/* 2열 레이아웃 */}
+              <div className="grid grid-cols-2 gap-4">
+                <FormField
+                  control={form.control}
+                  name="itemLevel"
+                  render={({ field }) => (
+                    <FormItem>
+                      <FormLabel>레벨</FormLabel>
+                      <FormControl>
+                        <Input
+                          type="number"
+                          min="1"
+                          max="5"
+                          placeholder="1-5"
+                          {...field}
+                          value={field.value || ""}
+                          onChange={(e) => field.onChange(e.target.value ? parseInt(e.target.value) : null)}
+                        />
+                      </FormControl>
+                      <FormMessage />
+                    </FormItem>
+                  )}
+                />
+
+                <FormField
+                  control={form.control}
+                  name="deleteFlag"
+                  render={({ field }) => (
+                    <FormItem>
+                      <FormLabel>삭제 플래그</FormLabel>
+                      <FormControl>
+                        <Select onValueChange={field.onChange} defaultValue={field.value || "N"}>
+                          <SelectTrigger>
+                            <SelectValue placeholder="선택" />
+                          </SelectTrigger>
+                          <SelectContent>
+                            <SelectItem value="N">N (사용)</SelectItem>
+                            <SelectItem value="Y">Y (삭제)</SelectItem>
+                          </SelectContent>
+                        </Select>
+                      </FormControl>
+                      <FormMessage />
+                    </FormItem>
+                  )}
+                />
+              </div>
+
+              <div className="grid grid-cols-2 gap-4">
+                <FormField
+                  control={form.control}
+                  name="parentItemCode"
+                  render={({ field }) => (
+                    <FormItem>
+                      <FormLabel>부모 아이템 코드</FormLabel>
+                      <FormControl>
+                        <Input
+                          placeholder="예: BOLT001"
+                          {...field}
+                          value={field.value || ""}
+                        />
+                      </FormControl>
+                      <FormMessage />
+                    </FormItem>
+                  )}
+                />
+
+                <FormField
+                  control={form.control}
+                  name="steelType"
+                  render={({ field }) => (
+                    <FormItem>
+                      <FormLabel>강종</FormLabel>
+                      <FormControl>
+                        <Input
+                          placeholder="예: SS, CS, AL"
+                          maxLength={2}
+                          {...field}
+                          value={field.value || ""}
+                        />
+                      </FormControl>
+                      <FormMessage />
+                    </FormItem>
+                  )}
+                />
+              </div>
+
+              <div className="grid grid-cols-2 gap-4">
+                <FormField
+                  control={form.control}
+                  name="unitOfMeasure"
+                  render={({ field }) => (
+                    <FormItem>
+                      <FormLabel>단위</FormLabel>
+                      <FormControl>
+                        <Input
+                          placeholder="예: EA, SET, KG"
+                          maxLength={3}
+                          {...field}
+                          value={field.value || ""}
+                        />
+                      </FormControl>
+                      <FormMessage />
+                    </FormItem>
+                  )}
+                />
+
+                <FormField
+                  control={form.control}
+                  name="baseUnitOfMeasure"
+                  render={({ field }) => (
+                    <FormItem>
+                      <FormLabel>기본단위</FormLabel>
+                      <FormControl>
+                        <Input
+                          placeholder="예: EA, SET, KG"
+                          maxLength={3}
+                          {...field}
+                          value={field.value || ""}
+                        />
+                      </FormControl>
+                      <FormMessage />
+                    </FormItem>
+                  )}
+                />
+              </div>
+
+              <div className="grid grid-cols-2 gap-4">
+                <FormField
+                  control={form.control}
+                  name="gradeMaterial"
+                  render={({ field }) => (
+                    <FormItem>
+                      <FormLabel>등급 재질</FormLabel>
+                      <FormControl>
+                        <Input
+                          placeholder="예: Marine Grade A"
+                          {...field}
+                          value={field.value || ""}
+                        />
+                      </FormControl>
+                      <FormMessage />
+                    </FormItem>
+                  )}
+                />
+
+                <FormField
+                  control={form.control}
+                  name="changeDate"
+                  render={({ field }) => (
+                    <FormItem>
+                      <FormLabel>변경일자</FormLabel>
+                      <FormControl>
+                        <Input
+                          placeholder="YYYYMMDD"
+                          maxLength={8}
+                          {...field}
+                          value={field.value || ""}
+                        />
+                      </FormControl>
+                      <FormMessage />
+                    </FormItem>
+                  )}
+                />
+              </div>
+
             </div>
 
             <DialogFooter>
-- 
cgit v1.2.3

