e8dc97a32f
Deploy momo-erp / deploy (push) Successful in 46s
- src/app/(main), admin, admin-panel, common, api/{admin,common,menu} 복원
- /api/auth/login: FITO 인증 다시 활성화 (plm_admin 등 FITO 사용자 로그인 가능)
- 미들웨어: 옛 경로 강제 리다이렉트 제거
- /m/layout.tsx: FITO 슈퍼관리자(isAdmin)도 ADMIN 으로 받아 모모 페이지 진입 허용
- DB 005: menu_info 에 모모유통 루트(9000000) + 자식 19개(/m/* URL 직접 연결)
→ plm_admin 로그인 후 사이드바 [모모유통] 그룹에서 클릭 시 동작
→ 메뉴 관리 UI 에서 추가/수정/삭제 가능
138 lines
6.0 KiB
TypeScript
138 lines
6.0 KiB
TypeScript
"use client";
|
|
|
|
import { useState, useCallback, useEffect } from "react";
|
|
import { DataGrid, type GridColumn } from "@/components/grid/data-grid";
|
|
import { SearchForm, SearchField } from "@/components/layout/search-form";
|
|
import { Input } from "@/components/ui/input";
|
|
import { Button } from "@/components/ui/button";
|
|
import { CodeSelect } from "@/components/ui/code-select";
|
|
|
|
// productionplanning/planningdashboard.jsp 대응 - 생산관리_현황
|
|
function openPopup(url: string, name: string, w: number, h: number) {
|
|
const left = (window.screen.width - w) / 2;
|
|
const top = (window.screen.height - h) / 2;
|
|
window.open(url, name, `width=${w},height=${h},left=${left},top=${top},scrollbars=yes,resizable=yes`);
|
|
}
|
|
|
|
export default function ProductionStatusPage() {
|
|
const [year, setYear] = useState(new Date().getFullYear().toString());
|
|
const [projectNo, setProjectNo] = useState("");
|
|
const [customerObjid, setCustomerObjid] = useState("");
|
|
const [product, setProduct] = useState("");
|
|
const [pmUserId, setPmUserId] = useState("");
|
|
const [data, setData] = useState<Record<string, unknown>[]>([]);
|
|
|
|
const openProjectForm = (objId: string) =>
|
|
openPopup(`/project/modify?objId=${encodeURIComponent(objId)}`, "projectForm", 520, 650);
|
|
const openAssemblyWbs = (objId: string) =>
|
|
openPopup(`/project/wbs-task?objId=${encodeURIComponent(objId)}`, "wbsTask", 900, 800);
|
|
const openSetupWbs = (objId: string) =>
|
|
openPopup(`/project/wbs-setup?objId=${encodeURIComponent(objId)}`, "wbsSetup", 1100, 750);
|
|
const openIssueList = (objId: string, status: string) =>
|
|
openPopup(
|
|
`/production/issue-popup?status=${encodeURIComponent(status)}&project_no=${encodeURIComponent(objId)}`,
|
|
"issueList", 1720, 900
|
|
);
|
|
|
|
const columns: GridColumn[] = [
|
|
{
|
|
title: "프로젝트정보",
|
|
columns: [
|
|
{ title: "프로젝트번호", field: "PROJECT_NO", width: 120, hozAlign: "center", frozen: true,
|
|
cellClick: (row) => openProjectForm(String(row.OBJID)) },
|
|
{ title: "고객사", field: "CUSTOMER_NAME", width: 130, hozAlign: "left" },
|
|
{ title: "당사프로젝트명", field: "PROJECT_NAME", width: 260, hozAlign: "left" },
|
|
{ title: "요청납기일", field: "REQ_DEL_DATE", width: 100, hozAlign: "center" },
|
|
{ title: "셋업지", field: "SETUP", width: 130, hozAlign: "center" },
|
|
{ title: "PM", field: "PM_USER_NAME", width: 90, hozAlign: "center" },
|
|
],
|
|
},
|
|
{
|
|
title: "진척관리",
|
|
columns: [
|
|
{
|
|
title: "조립(제작)",
|
|
columns: [
|
|
{ title: "공정율(%)", field: "ASSEMBLY_RATE", width: 90, hozAlign: "center",
|
|
cellClick: (row) => openAssemblyWbs(String(row.OBJID)) },
|
|
{ title: "종료일", field: "ASSEMBLY_DATE_END", width: 100, hozAlign: "center" },
|
|
{ title: "투입공수(H)", field: "ASSEMBLY_EMPLOYEES_TOTAL", width: 100, hozAlign: "right", formatter: "money" },
|
|
],
|
|
},
|
|
{
|
|
title: "셋업",
|
|
columns: [
|
|
{ title: "공정율(%)", field: "SETUP_RATE", width: 90, hozAlign: "center",
|
|
cellClick: (row) => openSetupWbs(String(row.OBJID)) },
|
|
{ title: "종료일", field: "SETUP_ACT_END", width: 100, hozAlign: "center" },
|
|
{ title: "투입공수(H)", field: "EMPLOYEES_TOTAL", width: 100, hozAlign: "right", formatter: "money" },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: "이슈관리",
|
|
columns: [
|
|
{ title: "조치율(%)", field: "ISSUE_RATE", width: 90, hozAlign: "center" },
|
|
{ title: "발생", field: "ISSUE_CNT", width: 80, hozAlign: "center",
|
|
cellClick: (row) => openIssueList(String(row.OBJID), "all") },
|
|
{ title: "조치", field: "COMP_CNT", width: 80, hozAlign: "center",
|
|
cellClick: (row) => openIssueList(String(row.OBJID), "complete") },
|
|
{ title: "미결", field: "MISS_CNT", width: 80, hozAlign: "center",
|
|
cellClick: (row) => openIssueList(String(row.OBJID), "late") },
|
|
],
|
|
},
|
|
];
|
|
|
|
const fetchData = useCallback(async () => {
|
|
const res = await fetch("/api/production/status", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ year, project_no: projectNo, customer_objid: customerObjid, product, pm_user_id: pmUserId }),
|
|
});
|
|
if (res.ok) {
|
|
const json = await res.json();
|
|
setData(json.RESULTLIST || []);
|
|
}
|
|
}, [year, projectNo, customerObjid, product, pmUserId]);
|
|
|
|
useEffect(() => { fetchData(); }, [fetchData]);
|
|
|
|
return (
|
|
<div>
|
|
<div className="flex items-center justify-between mb-4">
|
|
<h2 className="text-lg font-bold text-gray-800">생산관리_현황</h2>
|
|
<div className="flex gap-2">
|
|
<Button size="sm" variant="secondary" onClick={fetchData}>조회</Button>
|
|
</div>
|
|
</div>
|
|
|
|
<SearchForm onSearch={fetchData}>
|
|
<SearchField label="년도">
|
|
<select value={year} onChange={(e) => setYear(e.target.value)}
|
|
className="h-9 w-[100px] rounded border border-gray-300 bg-white px-3 text-sm">
|
|
<option value="">선택</option>
|
|
{Array.from({ length: 5 }, (_, i) => new Date().getFullYear() - i).map((y) => (
|
|
<option key={y} value={y}>{y}</option>
|
|
))}
|
|
</select>
|
|
</SearchField>
|
|
<SearchField label="프로젝트번호">
|
|
<Input value={projectNo} onChange={(e) => setProjectNo(e.target.value)} className="w-[180px]" />
|
|
</SearchField>
|
|
<SearchField label="고객사">
|
|
<CodeSelect codeId="CUSTOMER" value={customerObjid} onChange={setCustomerObjid} className="w-[160px]" />
|
|
</SearchField>
|
|
<SearchField label="제품구분">
|
|
<CodeSelect codeId="PRODUCT_TYPE" value={product} onChange={setProduct} className="w-[130px]" />
|
|
</SearchField>
|
|
<SearchField label="PM">
|
|
<CodeSelect codeId="PM_USER" value={pmUserId} onChange={setPmUserId} className="w-[130px]" />
|
|
</SearchField>
|
|
</SearchForm>
|
|
|
|
<DataGrid columns={columns} data={data} />
|
|
</div>
|
|
);
|
|
}
|