|
|
@@ -99,18 +99,16 @@ const JobProcessStatus: React.FC = () => { |
|
|
return '-'; |
|
|
return '-'; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const calculateRemainingTime = (planEndTime: any): string => { |
|
|
|
|
|
|
|
|
const calculateRemainingTime = (planEndTime: any, processingTime: number | null, setupTime: number | null, changeoverTime: number | null): string => { |
|
|
if (!planEndTime) return '-'; |
|
|
if (!planEndTime) return '-'; |
|
|
|
|
|
|
|
|
let endTime: dayjs.Dayjs; |
|
|
let endTime: dayjs.Dayjs; |
|
|
|
|
|
|
|
|
// Handle array format [year, month, day, hour, minute, second] |
|
|
// Handle array format [year, month, day, hour, minute, second] |
|
|
// 使用与 OverallTimeRemainingCard 相同的方式处理 |
|
|
|
|
|
|
|
|
// Use arrayToDayjs for consistency with other parts of the codebase |
|
|
if (Array.isArray(planEndTime)) { |
|
|
if (Array.isArray(planEndTime)) { |
|
|
try { |
|
|
try { |
|
|
const [year, month, day, hour = 0, minute = 0, second = 0] = planEndTime; |
|
|
|
|
|
// 注意:JavaScript Date 构造函数中月份是 0-based,所以需要 month - 1 |
|
|
|
|
|
endTime = dayjs(new Date(year, month - 1, day, hour, minute, second)); |
|
|
|
|
|
|
|
|
endTime = arrayToDayjs(planEndTime, true); |
|
|
console.log('Parsed planEndTime array:', { |
|
|
console.log('Parsed planEndTime array:', { |
|
|
array: planEndTime, |
|
|
array: planEndTime, |
|
|
parsed: endTime.format('YYYY-MM-DD HH:mm:ss'), |
|
|
parsed: endTime.format('YYYY-MM-DD HH:mm:ss'), |
|
|
@@ -143,6 +141,7 @@ const JobProcessStatus: React.FC = () => { |
|
|
diffMinutes: diff |
|
|
diffMinutes: diff |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// If the planned end time is in the past, show 0 (or you could show negative time) |
|
|
if (diff < 0) return '0'; |
|
|
if (diff < 0) return '0'; |
|
|
|
|
|
|
|
|
const hours = Math.floor(diff / 60); |
|
|
const hours = Math.floor(diff / 60); |
|
|
@@ -186,7 +185,7 @@ const JobProcessStatus: React.FC = () => { |
|
|
<CardContent> |
|
|
<CardContent> |
|
|
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 3 }}> |
|
|
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 3 }}> |
|
|
<Typography variant="h5" sx={{ fontWeight: 600 }}> |
|
|
<Typography variant="h5" sx={{ fontWeight: 600 }}> |
|
|
{t("Job Process Status", { ns: "jobProcessStatus" })} |
|
|
|
|
|
|
|
|
{t("Job Process Status", )} |
|
|
</Typography> |
|
|
</Typography> |
|
|
|
|
|
|
|
|
</Box> |
|
|
</Box> |
|
|
@@ -203,30 +202,26 @@ const JobProcessStatus: React.FC = () => { |
|
|
<TableRow> |
|
|
<TableRow> |
|
|
<TableCell rowSpan={3}> |
|
|
<TableCell rowSpan={3}> |
|
|
<Typography variant="subtitle2" sx={{ fontWeight: 600 }}> |
|
|
<Typography variant="subtitle2" sx={{ fontWeight: 600 }}> |
|
|
{t("Job Order No.", { ns: "jobProcessStatus" })} |
|
|
|
|
|
|
|
|
{t("Job Order No.")} |
|
|
</Typography> |
|
|
</Typography> |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
<TableCell rowSpan={3}> |
|
|
<TableCell rowSpan={3}> |
|
|
<Typography variant="subtitle2" sx={{ fontWeight: 600 }}> |
|
|
<Typography variant="subtitle2" sx={{ fontWeight: 600 }}> |
|
|
{t("FG / WIP Item", { ns: "jobProcessStatus" })} |
|
|
|
|
|
|
|
|
{t("FG / WIP Item")} |
|
|
</Typography> |
|
|
</Typography> |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
<TableCell rowSpan={3}> |
|
|
<TableCell rowSpan={3}> |
|
|
<Typography variant="subtitle2" sx={{ fontWeight: 600 }}> |
|
|
<Typography variant="subtitle2" sx={{ fontWeight: 600 }}> |
|
|
{t("Production Time Remaining", { ns: "jobProcessStatus" })} |
|
|
|
|
|
</Typography> |
|
|
|
|
|
</TableCell> |
|
|
|
|
|
<TableCell colSpan={6} align="center"> |
|
|
|
|
|
<Typography variant="subtitle2" sx={{ fontWeight: 600 }}> |
|
|
|
|
|
{t("Process Status / Time [hh:mm]", { ns: "jobProcessStatus" })} |
|
|
|
|
|
|
|
|
{t("Production Time Remaining")} |
|
|
</Typography> |
|
|
</Typography> |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
|
|
|
|
|
|
</TableRow> |
|
|
</TableRow> |
|
|
<TableRow> |
|
|
<TableRow> |
|
|
{[1, 2, 3, 4, 5, 6].map((num) => ( |
|
|
{[1, 2, 3, 4, 5, 6].map((num) => ( |
|
|
<TableCell key={num} align="center"> |
|
|
<TableCell key={num} align="center"> |
|
|
<Typography variant="subtitle2" sx={{ fontWeight: 600 }}> |
|
|
<Typography variant="subtitle2" sx={{ fontWeight: 600 }}> |
|
|
{t("Process", { ns: "jobProcessStatus" })} {num} |
|
|
|
|
|
|
|
|
{t("Process")} {num} |
|
|
</Typography> |
|
|
</Typography> |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
))} |
|
|
))} |
|
|
@@ -236,13 +231,13 @@ const JobProcessStatus: React.FC = () => { |
|
|
<TableCell key={num} align="center"> |
|
|
<TableCell key={num} align="center"> |
|
|
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 0.5 }}> |
|
|
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 0.5 }}> |
|
|
<Typography variant="caption" sx={{ fontWeight: 600 }}> |
|
|
<Typography variant="caption" sx={{ fontWeight: 600 }}> |
|
|
{t("Start", { ns: "jobProcessStatus" })} |
|
|
|
|
|
|
|
|
{t("Start")} |
|
|
</Typography> |
|
|
</Typography> |
|
|
<Typography variant="caption" sx={{ fontWeight: 600 }}> |
|
|
<Typography variant="caption" sx={{ fontWeight: 600 }}> |
|
|
{t("Finish", { ns: "jobProcessStatus" })} |
|
|
|
|
|
|
|
|
{t("Finish")} |
|
|
</Typography> |
|
|
</Typography> |
|
|
<Typography variant="caption" sx={{ fontWeight: 600 }}> |
|
|
<Typography variant="caption" sx={{ fontWeight: 600 }}> |
|
|
{t("Wait Time [minutes]", { ns: "jobProcessStatus" })} |
|
|
|
|
|
|
|
|
{t("Wait Time [minutes]")} |
|
|
</Typography> |
|
|
</Typography> |
|
|
</Box> |
|
|
</Box> |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
@@ -268,7 +263,7 @@ const JobProcessStatus: React.FC = () => { |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
<TableCell> |
|
|
<TableCell> |
|
|
|
|
|
|
|
|
{calculateRemainingTime(row.planEndTime)} |
|
|
|
|
|
|
|
|
{calculateRemainingTime(row.planEndTime, row.processingTime, row.setupTime, row.changeoverTime)} |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
{row.processes.map((process, index) => { |
|
|
{row.processes.map((process, index) => { |
|
|
const isLastProcess = index === row.processes.length - 1 || |
|
|
const isLastProcess = index === row.processes.length - 1 || |
|
|
|