feat: [생산] 제품코드(productCode) 표시 추가
- ProductionDashboard, WorkerScreen 타입/변환에 productCode 필드 추가 - WorkOrderListPanel 목록에 제품코드 - 제품명 형태로 표시 - WorkerScreen 검사 항목에 제품코드 포함
This commit is contained in:
@@ -23,10 +23,11 @@ interface WorkOrderApiItem {
|
||||
created_at: string;
|
||||
sales_order?: {
|
||||
id: number; order_no: string; client_id?: number; client_name?: string;
|
||||
item?: { id: number; code: string; name: string } | null;
|
||||
client?: { id: number; name: string }; root_nodes_count?: number;
|
||||
};
|
||||
assignee?: { id: number; name: string };
|
||||
items?: { id: number; item_name: string; quantity: number }[];
|
||||
items?: { id: number; item_name: string; item_id?: number | null; item?: { id: number; code: string; name: string } | null; quantity: number }[];
|
||||
}
|
||||
|
||||
// ===== 상태 변환 =====
|
||||
@@ -41,6 +42,7 @@ function mapApiStatus(status: WorkOrderApiItem['status']): 'waiting' | 'inProgre
|
||||
// ===== API → WorkOrder 변환 =====
|
||||
function transformToProductionFormat(api: WorkOrderApiItem): WorkOrder {
|
||||
const totalQuantity = (api.items || []).reduce((sum, item) => sum + Number(item.quantity), 0);
|
||||
const productCode = api.sales_order?.item?.code || '-';
|
||||
const productName = api.items?.[0]?.item_name || '-';
|
||||
const dueDate = api.scheduled_date || '';
|
||||
const today = new Date();
|
||||
@@ -57,6 +59,7 @@ function transformToProductionFormat(api: WorkOrderApiItem): WorkOrder {
|
||||
return {
|
||||
id: String(api.id),
|
||||
orderNo: api.work_order_no,
|
||||
productCode,
|
||||
productName,
|
||||
processCode: api.process?.process_code || '-',
|
||||
processName: api.process?.process_name || '-',
|
||||
|
||||
@@ -14,6 +14,7 @@ export interface ProcessOption {
|
||||
export interface WorkOrder {
|
||||
id: string;
|
||||
orderNo: string; // KD-WO-251216-01
|
||||
productCode: string; // 제품코드 (KQTS01 등)
|
||||
productName: string; // 스크린 서터 (표준형) - 추가
|
||||
processCode: string; // 공정 코드 (P-001, P-002, ...)
|
||||
processName: string; // 공정명 (슬랫, 스크린, 절곡, ...)
|
||||
|
||||
@@ -74,8 +74,8 @@ export function WorkOrderListPanel({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 품목명 */}
|
||||
<p className="text-sm text-gray-600 truncate ml-8">{order.productName}</p>
|
||||
{/* 제품코드 - 제품명 */}
|
||||
<p className="text-sm text-gray-600 truncate ml-8">{order.productCode} - {order.productName}</p>
|
||||
|
||||
{/* 현장명 + 수량 */}
|
||||
<div className="flex items-center justify-between mt-1.5 ml-8">
|
||||
|
||||
@@ -38,6 +38,7 @@ interface WorkOrderApiItem {
|
||||
sales_order?: {
|
||||
id: number;
|
||||
order_no: string;
|
||||
item?: { id: number; code: string; name: string } | null;
|
||||
client?: { id: number; name: string };
|
||||
client_contact?: string;
|
||||
options?: { manager_name?: string; [key: string]: unknown };
|
||||
@@ -50,6 +51,8 @@ interface WorkOrderApiItem {
|
||||
items?: {
|
||||
id: number;
|
||||
item_name: string;
|
||||
item_id?: number | null;
|
||||
item?: { id: number; code: string; name: string } | null;
|
||||
quantity: number;
|
||||
specification?: string | null;
|
||||
options?: Record<string, unknown> | null;
|
||||
@@ -89,6 +92,7 @@ function mapApiStatus(status: WorkOrderApiItem['status']): WorkOrderStatus {
|
||||
// ===== API → WorkOrder 변환 =====
|
||||
function transformToWorkerScreenFormat(api: WorkOrderApiItem): WorkOrder {
|
||||
const totalQuantity = (api.items || []).reduce((sum, item) => sum + Number(item.quantity), 0);
|
||||
const productCode = api.sales_order?.item?.code || '-';
|
||||
const productName = api.items?.[0]?.item_name || '-';
|
||||
|
||||
// 납기일 계산 (지연 여부)
|
||||
@@ -173,6 +177,7 @@ function transformToWorkerScreenFormat(api: WorkOrderApiItem): WorkOrder {
|
||||
return {
|
||||
id: String(api.id),
|
||||
orderNo: api.work_order_no,
|
||||
productCode,
|
||||
productName,
|
||||
processCode: processInfo.code,
|
||||
processName: processInfo.name,
|
||||
|
||||
@@ -714,7 +714,7 @@ export default function WorkerScreen() {
|
||||
workOrderId: selectedOrder.id,
|
||||
itemNo: index + 1,
|
||||
itemCode: selectedOrder.orderNo || '-',
|
||||
itemName: itemSummary,
|
||||
itemName: `${selectedOrder.productCode !== '-' ? selectedOrder.productCode + ' - ' : ''}${itemSummary}`,
|
||||
floor: (opts.floor as string) || '-',
|
||||
code: (opts.code as string) || '-',
|
||||
width: (opts.width as number) || 0,
|
||||
@@ -774,7 +774,7 @@ export default function WorkerScreen() {
|
||||
workOrderId: selectedOrder.id,
|
||||
itemNo: 1,
|
||||
itemCode: selectedOrder.orderNo || '-',
|
||||
itemName: selectedOrder.productName || '-',
|
||||
itemName: `${selectedOrder.productCode !== '-' ? selectedOrder.productCode + ' - ' : ''}${selectedOrder.productName || '-'}`,
|
||||
floor: '-',
|
||||
code: '-',
|
||||
width: 0,
|
||||
@@ -940,6 +940,7 @@ export default function WorkerScreen() {
|
||||
const syntheticOrder: WorkOrder = {
|
||||
id: item.id,
|
||||
orderNo: item.itemCode,
|
||||
productCode: item.itemCode,
|
||||
productName: item.itemName,
|
||||
processCode: item.processType,
|
||||
processName: PROCESS_TAB_LABELS[item.processType],
|
||||
@@ -999,6 +1000,7 @@ export default function WorkerScreen() {
|
||||
const syntheticOrder: WorkOrder = {
|
||||
id: mockItem.id,
|
||||
orderNo: mockItem.itemCode,
|
||||
productCode: mockItem.itemCode,
|
||||
productName: mockItem.itemName,
|
||||
processCode: mockItem.processType,
|
||||
processName: PROCESS_TAB_LABELS[mockItem.processType],
|
||||
@@ -1239,6 +1241,7 @@ export default function WorkerScreen() {
|
||||
return {
|
||||
id: mockItem.id,
|
||||
orderNo: mockItem.itemCode,
|
||||
productCode: mockItem.itemCode,
|
||||
productName: mockItem.itemName,
|
||||
processCode: mockItem.processType,
|
||||
processName: PROCESS_TAB_LABELS[mockItem.processType],
|
||||
|
||||
Reference in New Issue
Block a user