diff --git a/src/app/(main)/settings/rss/page.tsx b/src/app/(main)/settings/rss/page.tsx index a5d77e8..8efbc1f 100644 --- a/src/app/(main)/settings/rss/page.tsx +++ b/src/app/(main)/settings/rss/page.tsx @@ -10,13 +10,15 @@ import Link from "next/link"; import { Suspense } from "react"; import RoughScheduleLoading from "@/components/RoughScheduleSetting/RoughScheduleLoading"; import RoughScheduleSetting from "@/components/RoughScheduleSetting/RoughScheduleSetting"; +import RoughScheduleSettingWrapper from "@/components/RoughScheduleSetting/RoughScheduleSettingWrapper"; import { I18nProvider } from "@/i18n"; export const metadata: Metadata = { title: "Demand Forecast Setting", }; const roughScheduleSetting: React.FC = async () => { - const project = TypeEnum.PRODUCT + //const project = TypeEnum.PRODUCT + const project = "common" const { t } = await getServerI18n(project); // preloadClaims(); @@ -40,11 +42,11 @@ const roughScheduleSetting: React.FC = async () => { {t("Create product")} */} - - }> - - + }> + + + ); }; diff --git a/src/app/api/settings/equipmentType/index.ts b/src/app/api/settings/equipmentType/index.ts index 5ed7d75..f24f3de 100644 --- a/src/app/api/settings/equipmentType/index.ts +++ b/src/app/api/settings/equipmentType/index.ts @@ -7,6 +7,10 @@ import { BASE_API_URL } from "../../../../config/api"; export { default } from "../../../../components/CreateEquipmentType/CreateEquipmentType"; // import { TypeInputs, UomInputs, WeightUnitInputs } from "./actions"; +export type EquipmentTypeResultResponse = { + records: EquipmentTypeResult[]; + total: number; +} export type EquipmentTypeResult = { id: string | number diff --git a/src/app/api/settings/item/actions.ts b/src/app/api/settings/item/actions.ts index 8449009..339d7c5 100644 --- a/src/app/api/settings/item/actions.ts +++ b/src/app/api/settings/item/actions.ts @@ -42,4 +42,4 @@ export const saveItem = async (data: CreateItemInputs) => { }); revalidateTag("items"); return item - }; \ No newline at end of file + }; diff --git a/src/app/api/settings/item/index.ts b/src/app/api/settings/item/index.ts index b9893a5..280bf3d 100644 --- a/src/app/api/settings/item/index.ts +++ b/src/app/api/settings/item/index.ts @@ -18,6 +18,11 @@ export type ItemQc = { isActive: boolean | undefined; } +export type ItemsResultResponse = { + records: ItemsResult[]; + total: number; +} + export type ItemsResult = { id: string | number code: string; diff --git a/src/components/DashboardPage/DashboardPage.tsx b/src/components/DashboardPage/DashboardPage.tsx index b2f06fd..deac818 100644 --- a/src/components/DashboardPage/DashboardPage.tsx +++ b/src/components/DashboardPage/DashboardPage.tsx @@ -12,7 +12,7 @@ import PendingInspectionChart from "./chart/PendingInspectionChart"; import PendingStorageChart from "./chart/PendingStorageChart"; import ApplicationCompletionChart from "./chart/ApplicationCompletionChart"; import OrderCompletionChart from "./chart/OrderCompletionChart"; -import DashboardBox from "./DashboardBox"; +import DashboardBox from "./Dashboardbox"; import CollapsibleCard from "./CollapsibleCard"; type Props = {}; diff --git a/src/components/DetailScheduleDetail/DetailScheudleDetailView.tsx b/src/components/DetailScheduleDetail/DetailScheudleDetailView.tsx index 9728f45..559bbad 100644 --- a/src/components/DetailScheduleDetail/DetailScheudleDetailView.tsx +++ b/src/components/DetailScheduleDetail/DetailScheudleDetailView.tsx @@ -4,7 +4,7 @@ import { useCallback, useEffect, useMemo, useState } from "react"; import { useRouter, useSearchParams } from "next/navigation"; import { useTranslation } from "react-i18next"; import { - SaveDetailSchedule, + //SaveDetailSchedule, saveItem, } from "@/app/api/settings/item/actions"; import { @@ -157,7 +157,7 @@ const DetailScheduleDetailView: React.FC = ({ {/* */} {/**/} + isEdit: boolean }; type EntryError = | { @@ -214,43 +215,81 @@ const ViewByBomDetails: React.FC = ({ apiRef, isEdit }) => { { id: 1, code: "MH0040", type: "Material", name: "大豆油(1噸/桶)", inStockQty: 54.44 , purchaseQty1: 972.12, purchaseQty2: 972.12, purchaseQty3: 972.12, purchaseQty4: 972.12, purchaseQty5: 972.12, purchaseQty6: 972.12, - purchaseQty7: 972.12, overallPurchaseQty: 6804.84 + purchaseQty7: 972.12, overallPurchaseQty: 6804.84, + purchaseQty: 972.12 }, { id: 2, code: "GI3236", type: "Material", name: "清水(煮過牛腩)", inStockQty: 317.52 , purchaseQty1: 3175.2, purchaseQty2: 3175.2, purchaseQty3: 3175.2, purchaseQty4: 3175.2, purchaseQty5: 3175.2, purchaseQty6: 3175.2, - purchaseQty7: 3175.2, overallPurchaseQty: 22226.4 + purchaseQty7: 3175.2, overallPurchaseQty: 22226.4, + purchaseQty: 3175.2 }, { id: 3, code: "MG1700", type: "Material", name: "STERILTOM 意大利茄粒", inStockQty: 9.00 , purchaseQty1: 90, purchaseQty2: 90, purchaseQty3: 90, purchaseQty4: 90, purchaseQty5: 90, purchaseQty6: 90, - purchaseQty7: 90, overallPurchaseQty: 630 + purchaseQty7: 90, overallPurchaseQty: 630, + purchaseQty: 90 }, { id: 4, code: "FA0533", type: "Material", name: "乾蔥茸", inStockQty: 6.04 , purchaseQty1: 60.4, purchaseQty2: 60.4, purchaseQty3: 60.4, purchaseQty4: 60.4, purchaseQty5: 60.4, purchaseQty6: 60.4, - purchaseQty7: 60.4, overallPurchaseQty: 422.8 + purchaseQty7: 60.4, overallPurchaseQty: 422.8, + purchaseQty: 60.4 }, { id: 5, code: "FA0210", type: "Material", name: "薑茸", inStockQty: 6.04 , purchaseQty1: 66.45, purchaseQty2: 66.45, purchaseQty3: 66.45, purchaseQty4: 66.45, purchaseQty5: 66.45, purchaseQty6: 66.45, - purchaseQty7: 66.45, overallPurchaseQty: 465.15 + purchaseQty7: 66.45, overallPurchaseQty: 465.15, + purchaseQty: 66.45 }, { id: 6, code: "FA0608", type: "Material", name: "粗蒜茸", inStockQty: 6.04 , purchaseQty1: 78.55, purchaseQty2: 78.55, purchaseQty3: 78.55, purchaseQty4: 78.55, purchaseQty5: 78.55, purchaseQty6: 78.55, - purchaseQty7: 78.55, overallPurchaseQty: 549.85 + purchaseQty7: 78.55, overallPurchaseQty: 549.85, + purchaseQty: 78.55 + }, + { id: 7, code: "FA0056", type: "Material", name: "洋蔥肉", inStockQty: 241.98 , + purchaseQty1: 2419.8, purchaseQty2: 2419.8, purchaseQty3: 2419.8, + purchaseQty4: 2419.8, purchaseQty5: 2419.8, purchaseQty6: 2419.8, + purchaseQty7: 2419.8, overallPurchaseQty: 17038.4, + purchaseQty: 2419.8 + }, + { id: 8, code: "PP1188", type: "Material", name: "咖喱膽", inStockQty: 36.00 , + purchaseQty1: 0, purchaseQty2: 0, purchaseQty3: 0, + purchaseQty4: 0, purchaseQty5: 0, purchaseQty6: 0, + purchaseQty7: 0, overallPurchaseQty: 0, + purchaseQty: 0 + }, + { id: 11, code: "NA0476", type: "Material", name: "2磅份量三邊覆合袋 (0.1x225x260mm)個計", inStockQty: 600.00 , + purchaseQty1: 6000, purchaseQty2: 6000, purchaseQty3: 6000, + purchaseQty4: 6000, purchaseQty5: 6000, purchaseQty6: 6000, + purchaseQty7: 6000, overallPurchaseQty: 42000, + purchaseQty: 6000 + }, + { id: 12, code: "MH0040",type: "Material", name: "大豆油(1噸/桶)", inStockQty: 0, + purchaseQty1: 0, purchaseQty2: 0, purchaseQty3: 0, + purchaseQty4: 0, purchaseQty5: 0, purchaseQty6: 0, + purchaseQty7: 0, overallPurchaseQty: 0, + purchaseQty: 0 + }, + { id: 13, code: "FA0161",type: "Material", name: "洋蔥粒", inStockQty: 0, + purchaseQty1: 28.15, purchaseQty2: 28.15, purchaseQty3: 28.15, + purchaseQty4: 28.15, purchaseQty5: 28.15, purchaseQty6: 28.15, + purchaseQty7: 28.15, overallPurchaseQty: 197.05, + purchaseQty: 28.15 + }, + { id: 14, code: "MG1288", type: "Material",name: "炸紅蔥頭", inStockQty: 0, + purchaseQty1: 0, purchaseQty2: 0, purchaseQty3: 0, + purchaseQty4: 0, purchaseQty5: 0, purchaseQty6: 0, + purchaseQty7: 0, overallPurchaseQty: 0, + purchaseQty: 0 + }, + { id: 15, code: "MG0066", type: "Material",name: "咖哩料(5斤x16包+2斤/包)", inStockQty: 0, + purchaseQty1: 241.98, purchaseQty2: 241.98, purchaseQty3: 241.98, + purchaseQty4: 241.98, purchaseQty5: 241.98, purchaseQty6: 241.98, + purchaseQty7: 241.98, overallPurchaseQty: 17038.4, + purchaseQty: 241.98 }, - { id: 7, code: "FA0056", type: "Material", name: "洋蔥肉", inStockQty: 241.98 , purchaseQty: 2419.8 }, - { id: 8, code: "PP1188", type: "Material", name: "咖喱膽", inStockQty: 36.00 , purchaseQty: 0 }, - { id: 9, code: "PP8001", type: "Material", name: "咖哩汁箱料粉", inStockQty: 77.42 , purchaseQty: 774.2 }, - { id: 10, code: "PP1096", type: "Material", name: "白麵撈", inStockQty: 60.00 , purchaseQty: 0 }, - { id: 11, code: "NA0476", type: "Material", name: "2磅份量三邊覆合袋 (0.1x225x260mm)個計", inStockQty: 600.00 , purchaseQty: 6000 }, - { id: 12, code: "MH0040",type: "Material", name: "大豆油(1噸/桶)", inStockQty: 0, purchaseQty: 972.12 }, - { id: 13, code: "FA0161",type: "Material", name: "洋蔥粒", inStockQty: 0, purchaseQty: 28.15 }, - { id: 14, code: "MG1288", type: "Material",name: "炸紅蔥頭", inStockQty: 0, purchaseQty: 6.05 }, - { id: 15, code: "MG0066", type: "Material",name: "咖哩料(5斤x16包+2斤/包)", inStockQty: 0, purchaseQty: 241.98 }, - { id: 16, code: "MH0040", type: "Material",name: "星加坡綠富貴花牌幼白麵粉 (50磅/包)", inStockQty: 0, purchaseQty: 250.00 }, ], [] ); @@ -298,7 +337,7 @@ const ViewByBomDetails: React.FC = ({ apiRef, isEdit }) => { }, ]) - const updatePagingController = (updatedObj) => { + const updatePagingController = (updatedObj: { index: number, pageNum: number, pageSize: number, totalCount: number }) => { setPagingController((prevState) => { return prevState.map((item, index) => { if (index === updatedObj?.index){ diff --git a/src/components/EquipmentSearch/EquipmentSearch.tsx b/src/components/EquipmentSearch/EquipmentSearch.tsx index 7d7da91..031c7c3 100644 --- a/src/components/EquipmentSearch/EquipmentSearch.tsx +++ b/src/components/EquipmentSearch/EquipmentSearch.tsx @@ -77,11 +77,17 @@ const EquipmentSearch: React.FC = ({ equipments }) => { [filteredEquipments] ); + + interface ApiResponse { + records: T[]; + total: number; + } + const refetchData = useCallback( async (filterObj: SearchQuery) => { const authHeader = axiosInstance.defaults.headers["Authorization"]; if (!authHeader) { - return; // Exit the function if the token is not set + return; } const params = { pageNum: pagingController.pageNum, @@ -89,21 +95,21 @@ const EquipmentSearch: React.FC = ({ equipments }) => { ...filterObj, }; try { - const response = await axiosInstance.get( + const response = await axiosInstance.get>( `${NEXT_PUBLIC_API_URL}/Equipment/getRecordByPage`, { params } ); console.log(response); if (response.status == 200) { setFilteredEquipments(response.data.records); - setTotalCount(response.data.total) - return response; // Return the data from the response + setTotalCount(response.data.total); + return response; } else { throw "400"; } } catch (error) { console.error("Error fetching equipment types:", error); - throw error; // Rethrow the error for further handling + throw error; } }, [axiosInstance, pagingController.pageNum, pagingController.pageSize] diff --git a/src/components/EquipmentTypeSearch/EquipmentTypeSearch.tsx b/src/components/EquipmentTypeSearch/EquipmentTypeSearch.tsx index 5edd672..1cdb44a 100644 --- a/src/components/EquipmentTypeSearch/EquipmentTypeSearch.tsx +++ b/src/components/EquipmentTypeSearch/EquipmentTypeSearch.tsx @@ -12,7 +12,7 @@ import { TypeEnum } from "@/app/utils/typeEnum"; import axios from "axios"; import { BASE_API_URL, NEXT_PUBLIC_API_URL } from "@/config/api"; import axiosInstance from "@/app/(main)/axios/axiosInstance"; - +import { EquipmentTypeResultResponse } from "@/app/api/settings/equipmentType"; type Props = { equipmentTypes: EquipmentTypeResult[]; }; @@ -85,7 +85,7 @@ const EquipmentTypeSearch: React.FC = ({ equipmentTypes }) => { ...filterObj, }; try { - const response = await axiosInstance.get( + const response = await axiosInstance.get( `${NEXT_PUBLIC_API_URL}/EquipmentType/getRecordByPage`, { params } ); diff --git a/src/components/PickOrderDetail/ApprovalContent.tsx b/src/components/PickOrderDetail/ApprovalContent.tsx index 18a5e9f..9a78109 100644 --- a/src/components/PickOrderDetail/ApprovalContent.tsx +++ b/src/components/PickOrderDetail/ApprovalContent.tsx @@ -29,8 +29,8 @@ import { QcItemWithChecks } from "@/app/api/qc"; import { GridEditInputCell } from "@mui/x-data-grid"; import { StockInLine } from "@/app/api/po"; import { stockInLineStatusMap } from "@/app/utils/formatUtil"; -import { PickOrderApprovalInput } from "@/app/api/pickorder/actions"; -import { StockOutLine } from "@/app/api/pickorder"; +import { PickOrderApprovalInput } from "@/app/api/pickOrder/actions"; +import { StockOutLine } from "@/app/api/pickOrder"; interface Props { // approvalDefaultValues: StockInLine; diff --git a/src/components/PickOrderDetail/PickOrderDetail.tsx b/src/components/PickOrderDetail/PickOrderDetail.tsx index 9e7a814..1a05b12 100644 --- a/src/components/PickOrderDetail/PickOrderDetail.tsx +++ b/src/components/PickOrderDetail/PickOrderDetail.tsx @@ -40,11 +40,11 @@ import { fetchStockOutLineClient, PickOrderApprovalInput, PickOrderQcInput, -} from "@/app/api/pickorder/actions"; +} from "@/app/api/pickOrder/actions"; import { PickOrderLineWithSuggestedLot, StockOutLine, -} from "@/app/api/pickorder"; +} from "@/app/api/pickOrder"; import { Pageable } from "@/app/utils/fetchUtil"; import { QrCodeInfo } from "@/app/api/qrcode"; import { QrCode } from "../QrCode"; diff --git a/src/components/RoughSchedule/RoughSchedileSearchView.tsx b/src/components/RoughSchedule/RoughSchedileSearchView.tsx index 7a175a0..cb22ee5 100644 --- a/src/components/RoughSchedule/RoughSchedileSearchView.tsx +++ b/src/components/RoughSchedule/RoughSchedileSearchView.tsx @@ -37,7 +37,7 @@ type SearchParamNames = keyof SearchQuery; const RSOverview: React.FC = ({ type, defaultInputs }) => { const [filteredSchedules, setFilteredSchedules] = useState([]); - const { t } = useTranslation("scheduling"); + const { t } = useTranslation("schedule"); const router = useRouter(); // const [filterObj, setFilterObj] = useState({}); // const [tempSelectedValue, setTempSelectedValue] = useState({}); diff --git a/src/components/RoughScheduleSetting/RoughScheduleSetting.tsx b/src/components/RoughScheduleSetting/RoughScheduleSetting.tsx index e078ee4..5ae1aa7 100644 --- a/src/components/RoughScheduleSetting/RoughScheduleSetting.tsx +++ b/src/components/RoughScheduleSetting/RoughScheduleSetting.tsx @@ -14,7 +14,7 @@ import { useTranslation } from "react-i18next"; import axiosInstance from "@/app/(main)/axios/axiosInstance"; import Qs from 'qs'; import EditableSearchResults from "@/components/SearchResults/EditableSearchResults"; // Make sure to import Qs - +import { ItemsResultResponse } from "@/app/api/settings/item"; type Props = { items: ItemsResult[]; }; @@ -63,7 +63,7 @@ const RSSOverview: React.FC = ({ items }) => { const searchCriteria: Criterion[] = useMemo( () => { var searchCriteria: Criterion[] = [ - { label: t("Finished Goods Name"), paramName: "fgName", type: "text" }, + { label: t("Finished Goods Name"), paramName: "name", type: "text" }, { label: t("Exclude Date"), paramName: "excludeDate", @@ -100,7 +100,7 @@ const RSSOverview: React.FC = ({ items }) => { // }, { field: "name", - label: "Finished Goods Name", + label: t("Finished Goods Name"), type: 'input', }, { @@ -153,7 +153,7 @@ const RSSOverview: React.FC = ({ items }) => { } try { - const response = await axiosInstance.get(`${NEXT_PUBLIC_API_URL}/items/getRecordByPage`, { + const response = await axiosInstance.get(`${NEXT_PUBLIC_API_URL}/items/getRecordByPage`, { params, paramsSerializer: (params) => { return Qs.stringify(params, { arrayFormat: 'repeat' }); @@ -175,7 +175,7 @@ const RSSOverview: React.FC = ({ items }) => { //setFilteredItems(items ?? []); setFilterObj({}); setTempSelectedValue({}); - refetchData(); + refetchData(filterObj); }, [items]); return ( diff --git a/src/components/RoughScheduleSetting/RoughScheduleSettingWrapper.tsx b/src/components/RoughScheduleSetting/RoughScheduleSettingWrapper.tsx index 2dd5145..21ff196 100644 --- a/src/components/RoughScheduleSetting/RoughScheduleSettingWrapper.tsx +++ b/src/components/RoughScheduleSetting/RoughScheduleSettingWrapper.tsx @@ -10,7 +10,7 @@ type Props = { // type: TypeEnum; }; -const RoughScheduleSettingWrapper: ({}: {}) => Promise = async ({ +const RoughScheduleSettingWrapper: React.FC & SubComponents = async ({ // type, }) => { // console.log(type) diff --git a/src/i18n/zh/common.json b/src/i18n/zh/common.json index f6b6f7f..087db9d 100644 --- a/src/i18n/zh/common.json +++ b/src/i18n/zh/common.json @@ -66,5 +66,8 @@ "Equipment Type Details":"設備類型詳情", "Save":"儲存", "Cancel":"取消", - "Equipment Details":"設備詳情" + "Equipment Details":"設備詳情", + "Exclude Date":"排除日期", + "Finished Goods Name":"成品名稱" + } diff --git a/src/i18n/zh/schedule.json b/src/i18n/zh/schedule.json index 4760321..da93d77 100644 --- a/src/i18n/zh/schedule.json +++ b/src/i18n/zh/schedule.json @@ -78,5 +78,7 @@ "Job Priority": "工單優先順序", "Job Date": "工單日期", "Job Qty": "工單數量", - "mat": "物料" + "mat": "物料", + "Product Count(s)": "產品數量", + "Schedule Period To": "排程期間至" }