Kaynağa Gözat

update joborderstatus

master
CANCERYS\kw093 3 hafta önce
ebeveyn
işleme
6daea70c21
7 değiştirilmiş dosya ile 53 ekleme ve 40 silme
  1. +3
    -0
      src/app/api/jo/actions.ts
  2. +14
    -19
      src/components/ProductionProcess/JobProcessStatus.tsx
  3. +1
    -1
      src/components/ProductionProcess/ProductionProcessList.tsx
  4. +19
    -17
      src/components/StockIn/FgStockInForm.tsx
  5. +7
    -2
      src/config/authConfig.ts
  6. +6
    -1
      src/i18n/zh/common.json
  7. +3
    -0
      src/i18n/zh/jo.json

+ 3
- 0
src/app/api/jo/actions.ts Dosyayı Görüntüle

@@ -1208,6 +1208,9 @@ export interface JobProcessStatusResponse {
jobOrderCode: string;
itemCode: string;
itemName: string;
processingTime: number | null;
setupTime: number | null;
changeoverTime: number | null;
planEndTime?: string | null;
processes: ProcessStatusInfo[];
}


+ 14
- 19
src/components/ProductionProcess/JobProcessStatus.tsx Dosyayı Görüntüle

@@ -99,18 +99,16 @@ const JobProcessStatus: React.FC = () => {
return '-';
};

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

{calculateRemainingTime(row.planEndTime)}
{calculateRemainingTime(row.planEndTime, row.processingTime, row.setupTime, row.changeoverTime)}
</TableCell>
{row.processes.map((process, index) => {
const isLastProcess = index === row.processes.length - 1 ||


+ 1
- 1
src/components/ProductionProcess/ProductionProcessList.tsx Dosyayı Görüntüle

@@ -142,7 +142,7 @@ const ProductProcessList: React.FC<ProductProcessListProps> = ({ onSelectProcess
}
// 3) 更新 JO 状态
await updateJo({ id: process.jobOrderId, status: "completed" });
// await updateJo({ id: process.jobOrderId, status: "completed" });
// 4) 刷新列表
await fetchProcesses();


+ 19
- 17
src/components/StockIn/FgStockInForm.tsx Dosyayı Görüntüle

@@ -365,26 +365,28 @@ return (
</Grid></>
)} */}
<Grid item xs={6}>
<Controller
control={control}
name="expiryDate"
// rules={{ required: !Boolean(productionDate) }}
render={({ field }) => {
return (
<LocalizationProvider
dateAdapter={AdapterDayjs}
adapterLocale={`${language}-hk`}
>
<Controller
control={control}
name="expiryDate"
render={({ field }) => {
const expiryDateValue = watch("expiryDate");
return (
<LocalizationProvider
dateAdapter={AdapterDayjs}
adapterLocale={`${language}-hk`}
>
<DatePicker
{...field}
sx={textfieldSx}
label={t("expiryDate")}
value={expiryDate ? dayjs(expiryDate) : undefined}
value={expiryDateValue ? dayjs(expiryDateValue) : null} // Use null instead of undefined
format={OUTPUT_DATE_FORMAT}
disabled={disabled}
onChange={(date) => {
if (!date) return;
console.log(date.format(INPUT_DATE_FORMAT));
if (!date) {
setValue("expiryDate", "");
return;
}
setValue("expiryDate", date.format(INPUT_DATE_FORMAT));
}}
inputRef={field.ref}
@@ -416,10 +418,10 @@ return (
},
}}
/>
</LocalizationProvider>
);
}}
/>
</LocalizationProvider>
);
}}
/>
</Grid>
{/* <Grid item xs={6}>
{putawayMode ? (


+ 7
- 2
src/config/authConfig.ts Dosyayı Görüntüle

@@ -2,7 +2,7 @@
import { AuthOptions } from "next-auth";
import CredentialsProvider from "next-auth/providers/credentials";
import { LOGIN_API_PATH } from "./api";
import { Session } from "next-auth";
// Extend the built-in types
declare module "next-auth" {
interface Session {
@@ -98,5 +98,10 @@ export const authOptions: AuthOptions = {
},
},
};

export type SessionWithTokens = Session & {
accessToken: string | null;
refreshToken?: string;
abilities: string[];
id?: string;
};
export default authOptions;

+ 6
- 1
src/i18n/zh/common.json Dosyayı Görüntüle

@@ -49,7 +49,12 @@
"Assignment failed: ": "分配失敗: ",
"Unknown error": "未知錯誤",
"Job Process Status": "工單流程狀態",
"FG / WIP Item": "成品/半成品",
"Total Time": "總時間",
"Remaining Time": "剩餘時間",
"Wait Time": "等待時間",
"Wait Time [minutes]": "等待時間(分鐘)",
"End Time": "完成時間",
"WIP": "半成品",
"R&D": "研發",
"STF": "樣品",


+ 3
- 0
src/i18n/zh/jo.json Dosyayı Görüntüle

@@ -4,11 +4,14 @@
"Edit Job Order Detail": "工單詳情",
"Details": "細節",
"Actions": "操作",
"Process": "工序",
"Create Job Order": "建立工單",
"Code": "工單編號",
"Name": "成品/半成品名稱",
"Picked Qty": "已提料數量",
"Confirm All": "確認所有提料",
"Wait Time [minutes]": "等待時間(分鐘)",
"Job Process Status": "工單流程狀態",
"Search Job Order/ Create Job Order":"搜尋工單/建立工單",
"UoM": "銷售單位",
"Select Another Bag Lot":"選擇另一個包裝袋",


Yükleniyor…
İptal
Kaydet