fix: [작업일지] 재공품은 절곡 레이아웃 유지하되 수주 관련 필드 숨김

This commit is contained in:
김보곤
2026-03-22 09:13:21 +09:00
parent 59763a7a6e
commit f477707200
2 changed files with 56 additions and 31 deletions

View File

@@ -33,9 +33,10 @@ interface BendingWorkLogContentProps {
lotNoMap?: Record<string, string>; // BD-{prefix}-{lengthCode} → LOT NO
bendingImages?: Record<string, string>; // R2 presigned URL 맵
rawMaterialLotNo?: string; // STOCK: 원자재 투입 LOT 번호
isWip?: boolean; // 재공품 여부 (수주 관련 필드 숨김)
}
export function BendingWorkLogContent({ data: order, lotNoMap, bendingImages, rawMaterialLotNo }: BendingWorkLogContentProps) {
export function BendingWorkLogContent({ data: order, lotNoMap, bendingImages, rawMaterialLotNo, isWip }: BendingWorkLogContentProps) {
const today = new Date().toLocaleDateString('ko-KR', {
year: 'numeric',
month: '2-digit',
@@ -125,40 +126,62 @@ export function BendingWorkLogContent({ data: order, lotNoMap, bendingImages, ra
<table className="w-full border-collapse text-xs mb-6">
<thead>
<tr>
<th className="border border-gray-400 bg-gray-100 px-3 py-2 text-center" colSpan={2}></th>
<th className="border border-gray-400 bg-gray-100 px-3 py-2 text-center" colSpan={2}></th>
{!isWip && <th className="border border-gray-400 bg-gray-100 px-3 py-2 text-center" colSpan={2}></th>}
<th className="border border-gray-400 bg-gray-100 px-3 py-2 text-center" colSpan={2}>
{isWip ? '생산정보' : '신청내용'}
</th>
</tr>
</thead>
<tbody>
{!isWip && (
<tr>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium w-24"></td>
<td className="border border-gray-400 px-3 py-2">{order.salesOrderDate || '-'}</td>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium w-24"></td>
<td className="border border-gray-400 px-3 py-2">{order.projectName}</td>
</tr>
)}
{!isWip && (
<tr>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium"></td>
<td className="border border-gray-400 px-3 py-2">{order.client}</td>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium"></td>
<td className="border border-gray-400 px-3 py-2">{today}</td>
</tr>
)}
{isWip && (
<tr>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium w-24"></td>
<td className="border border-gray-400 px-3 py-2">{today}</td>
</tr>
)}
<tr>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium w-24"></td>
<td className="border border-gray-400 px-3 py-2">{order.salesOrderDate || '-'}</td>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium w-24"></td>
<td className="border border-gray-400 px-3 py-2">{order.projectName}</td>
</tr>
<tr>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium"></td>
<td className="border border-gray-400 px-3 py-2">{order.client}</td>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium"></td>
<td className="border border-gray-400 px-3 py-2">{today}</td>
</tr>
<tr>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium"></td>
<td className="border border-gray-400 px-3 py-2">{order.salesOrderWriter || '-'}</td>
{!isWip && (
<>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium"></td>
<td className="border border-gray-400 px-3 py-2">{order.salesOrderWriter || '-'}</td>
</>
)}
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium"> LOT NO</td>
<td className="border border-gray-400 px-3 py-2">{order.lotNo}</td>
</tr>
<tr>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium"></td>
<td className="border border-gray-400 px-3 py-2">{order.clientContact || '-'}</td>
{!isWip && (
<>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium"></td>
<td className="border border-gray-400 px-3 py-2">{order.clientContact || '-'}</td>
</>
)}
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium"></td>
<td className="border border-gray-400 px-3 py-2">{primaryAssignee}</td>
</tr>
<tr>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium" colSpan={2}></td>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium"></td>
<td className="border border-gray-400 px-3 py-2">{formattedDueDate}</td>
</tr>
{!isWip && (
<tr>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium" colSpan={2}></td>
<td className="border border-gray-400 bg-gray-50 px-3 py-2 font-medium"></td>
<td className="border border-gray-400 px-3 py-2">{formattedDueDate}</td>
</tr>
)}
</tbody>
</table>

View File

@@ -235,16 +235,16 @@ export function WorkLogModal({
const renderContent = () => {
if (!order) return null;
// 1순위: 작업지시 공정명에서 판별 (재공품 자식 공정은 전용 양식 사용)
const orderProcessType = order.processName?.includes('재공품')
? 'template' as const
: undefined;
// 2순위: 공정관리에서 매핑된 양식명으로 결정
// 1순위: 공정관리에서 매핑된 양식명으로 결정
const templateType = resolveProcessTypeFromTemplate(workLogTemplateName);
// 2순위: 작업지시 공정명에서 판별 (process_id가 자식 공정인 경우)
const orderProcessType = order.processName?.includes('재공품')
? 'bending' as const // 재공품도 절곡 레이아웃 유지 (기본필드만 다름)
: undefined;
// 3순위: processType 폴백 (양식 미매핑 시)
const type = orderProcessType || templateType || processType || order.processType;
const type = templateType || orderProcessType || processType || order.processType;
// 양식이 매핑되어 있지 않은 경우 안내
if (!workLogTemplateId && !processType && !orderProcessType) {
@@ -265,12 +265,14 @@ export function WorkLogModal({
}
// STOCK 단일부품: 원자재 LOT 번호를 직접 전달
const rawMaterialLotNo = materialLots.find(lot => !lot.item_code.startsWith('BD-'))?.lot_no;
const isWipOrder = order.processName?.includes('재공품') || order.projectName === '재고생산';
return (
<BendingWorkLogContent
data={order}
lotNoMap={lotNoMap}
bendingImages={bendingImages}
rawMaterialLotNo={rawMaterialLotNo}
isWip={isWipOrder}
/>
);
}