瀏覽代碼

update

master
cyril.tsui 2 週之前
父節點
當前提交
fd34051aa6
共有 3 個文件被更改,包括 48 次插入8 次删除
  1. +1
    -0
      src/app/api/po/index.ts
  2. +44
    -6
      src/app/api/scheduling/actions.ts
  3. +3
    -2
      src/components/DetailedSchedule/DetailedScheduleSearchView.tsx

+ 1
- 0
src/app/api/po/index.ts 查看文件

@@ -14,6 +14,7 @@ export interface PoResult {
supplier: string;
estimatedArrivalDate: string;
completedDate: string;
itemDetail?: String;
escalated: boolean;
status: string;
pol?: PurchaseOrderLine[];


+ 44
- 6
src/app/api/scheduling/actions.ts 查看文件

@@ -11,6 +11,7 @@ export interface SearchProdSchedule {
scheduleAt?: string;
schedulePeriod?: string;
schedulePeriodTo?: string;
produceAt?: string;
totalEstProdCount?: number;
types?: ScheduleType[];
pageSize?: number;
@@ -20,8 +21,9 @@ export interface SearchProdSchedule {
export interface ProdScheduleResult {
id: number;
scheduleAt: number[];
schedulePeriod: number[];
schedulePeriodTo: number[];
schedulePeriod?: number[];
schedulePeriodTo?: number[];
produceAt: string;
totalEstProdCount: number;
totalFGType: number;
type: string;
@@ -72,6 +74,40 @@ export const fetchProdSchedules = cache(
},
);

export const fetchRoughProdSchedules = cache(
async (data: SearchProdSchedule | null) => {
const params = convertObjToURLSearchParams<SearchProdSchedule>(data);
// console.log(params)
return serverFetchJson<ProdScheduleResultByPage>(
`${BASE_API_URL}/productionSchedule/getRecordByPage/rough?${params}`,
{
method: "GET",
headers: { "Content-Type": "application/json" },
next: {
tags: ["roughProdSchedules"],
},
},
);
},
);

export const fetchDetailedProdSchedules = cache(
async (data: SearchProdSchedule | null) => {
const params = convertObjToURLSearchParams<SearchProdSchedule>(data);
// console.log(params)
return serverFetchJson<ProdScheduleResultByPage>(
`${BASE_API_URL}/productionSchedule/getRecordByPage/detailed?${params}`,
{
method: "GET",
headers: { "Content-Type": "application/json" },
next: {
tags: ["detailedProdSchedules"],
},
},
);
},
);

export const testRoughSchedule = cache(async () => {
return serverFetchJson(
`${BASE_API_URL}/productionSchedule/testRoughSchedule`,
@@ -79,7 +115,7 @@ export const testRoughSchedule = cache(async () => {
method: "GET",
headers: { "Content-Type": "application/json" },
next: {
tags: ["prodSchedules"],
tags: ["roughProdSchedules"],
},
},
);
@@ -93,7 +129,7 @@ export const testDetailedSchedule = cache(async (date?: string) => {
method: "GET",
headers: { "Content-Type": "application/json" },
next: {
tags: ["prodSchedules"],
tags: ["detailedProdSchedules"],
},
},
);
@@ -109,7 +145,8 @@ export const releaseProdScheduleLine = cache(async (data: ReleaseProdScheduleInp
}
);

revalidateTag("prodSchedules");
revalidateTag("detailedProdSchedules");
revalidateTag("prodSchedule");

return response;
})
@@ -124,7 +161,8 @@ export const saveProdScheduleLine = cache(async (data: ReleaseProdScheduleInputs
}
);

revalidateTag("prodSchedules");
revalidateTag("detailedProdSchedules");
revalidateTag("prodSchedule");

return response;
})

+ 3
- 2
src/components/DetailedSchedule/DetailedScheduleSearchView.tsx 查看文件

@@ -10,6 +10,7 @@ import { ScheduleType } from "@/app/api/scheduling";
import {
ProdScheduleResult,
SearchProdSchedule,
fetchDetailedProdSchedules,
fetchProdSchedules,
testDetailedSchedule,
} from "@/app/api/scheduling/actions";
@@ -192,7 +193,7 @@ const DSOverview: React.FC<Props> = ({ type, defaultInputs }) => {
pageNum: pagingController.pageNum - 1,
pageSize: pagingController.pageSize,
};
const response = await fetchProdSchedules(params);
const response = await fetchDetailedProdSchedules(params);

// console.log(response)
if (response) {
@@ -308,7 +309,7 @@ const DSOverview: React.FC<Props> = ({ type, defaultInputs }) => {
<Button
variant="contained"
onClick={testDetailedScheduleClick}
disabled={filteredSchedules.some(ele => arrayToDayjs(ele.scheduleAt).isToday())}
// disabled={filteredSchedules.some(ele => arrayToDayjs(ele.scheduleAt).isToday())}
>
{t("Test Detailed Schedule")}
</Button>


Loading…
取消
儲存