| @@ -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")} | |||
| </Button> */} | |||
| </Stack> | |||
| <I18nProvider namespaces={[ "common", "project"]}> | |||
| <Suspense fallback={<RoughScheduleLoading.Loading />}> | |||
| <RoughScheduleSetting /> | |||
| </Suspense> | |||
| <Suspense fallback={<RoughScheduleSettingWrapper.Loading />}> | |||
| <I18nProvider namespaces={[ "common", "project",]}> | |||
| <RoughScheduleSetting items={[]} /> | |||
| </I18nProvider> | |||
| </Suspense> | |||
| </> | |||
| ); | |||
| }; | |||
| @@ -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 | |||
| @@ -42,4 +42,4 @@ export const saveItem = async (data: CreateItemInputs) => { | |||
| }); | |||
| revalidateTag("items"); | |||
| return item | |||
| }; | |||
| }; | |||
| @@ -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; | |||
| @@ -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 = {}; | |||
| @@ -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<Props> = ({ | |||
| {/* </Typography>*/} | |||
| {/*</Grid>*/} | |||
| <DetailInfoCard | |||
| recordDetails={formProps.formState.defaultValues} | |||
| recordDetails={formProps.formState.defaultValues as SaveDetailSchedule} | |||
| isEditing={isEdit} | |||
| /> | |||
| <Stack | |||
| @@ -24,6 +24,7 @@ import { GridRenderCellParams } from "@mui/x-data-grid"; | |||
| type Props = { | |||
| apiRef: MutableRefObject<GridApiCommunity> | |||
| isEdit: boolean | |||
| }; | |||
| type EntryError = | |||
| | { | |||
| @@ -214,43 +215,81 @@ const ViewByBomDetails: React.FC<Props> = ({ 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<Props> = ({ 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){ | |||
| @@ -77,11 +77,17 @@ const EquipmentSearch: React.FC<Props> = ({ equipments }) => { | |||
| [filteredEquipments] | |||
| ); | |||
| interface ApiResponse<T> { | |||
| 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<Props> = ({ equipments }) => { | |||
| ...filterObj, | |||
| }; | |||
| try { | |||
| const response = await axiosInstance.get<EquipmentResult[]>( | |||
| const response = await axiosInstance.get<ApiResponse<EquipmentResult>>( | |||
| `${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] | |||
| @@ -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<Props> = ({ equipmentTypes }) => { | |||
| ...filterObj, | |||
| }; | |||
| try { | |||
| const response = await axiosInstance.get<EquipmentTypeResult[]>( | |||
| const response = await axiosInstance.get<EquipmentTypeResultResponse>( | |||
| `${NEXT_PUBLIC_API_URL}/EquipmentType/getRecordByPage`, | |||
| { params } | |||
| ); | |||
| @@ -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; | |||
| @@ -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"; | |||
| @@ -37,7 +37,7 @@ type SearchParamNames = keyof SearchQuery; | |||
| const RSOverview: React.FC<Props> = ({ type, defaultInputs }) => { | |||
| const [filteredSchedules, setFilteredSchedules] = useState<ProdScheduleResult[]>([]); | |||
| const { t } = useTranslation("scheduling"); | |||
| const { t } = useTranslation("schedule"); | |||
| const router = useRouter(); | |||
| // const [filterObj, setFilterObj] = useState({}); | |||
| // const [tempSelectedValue, setTempSelectedValue] = useState({}); | |||
| @@ -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<Props> = ({ items }) => { | |||
| const searchCriteria: Criterion<SearchParamNames>[] = useMemo( | |||
| () => { | |||
| var searchCriteria: Criterion<SearchParamNames>[] = [ | |||
| { 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<Props> = ({ items }) => { | |||
| // }, | |||
| { | |||
| field: "name", | |||
| label: "Finished Goods Name", | |||
| label: t("Finished Goods Name"), | |||
| type: 'input', | |||
| }, | |||
| { | |||
| @@ -153,7 +153,7 @@ const RSSOverview: React.FC<Props> = ({ items }) => { | |||
| } | |||
| try { | |||
| const response = await axiosInstance.get<ItemsResult[]>(`${NEXT_PUBLIC_API_URL}/items/getRecordByPage`, { | |||
| const response = await axiosInstance.get<ItemsResultResponse>(`${NEXT_PUBLIC_API_URL}/items/getRecordByPage`, { | |||
| params, | |||
| paramsSerializer: (params) => { | |||
| return Qs.stringify(params, { arrayFormat: 'repeat' }); | |||
| @@ -175,7 +175,7 @@ const RSSOverview: React.FC<Props> = ({ items }) => { | |||
| //setFilteredItems(items ?? []); | |||
| setFilterObj({}); | |||
| setTempSelectedValue({}); | |||
| refetchData(); | |||
| refetchData(filterObj); | |||
| }, [items]); | |||
| return ( | |||
| @@ -10,7 +10,7 @@ type Props = { | |||
| // type: TypeEnum; | |||
| }; | |||
| const RoughScheduleSettingWrapper: ({}: {}) => Promise<JSX.Element> = async ({ | |||
| const RoughScheduleSettingWrapper: React.FC & SubComponents = async ({ | |||
| // type, | |||
| }) => { | |||
| // console.log(type) | |||
| @@ -66,5 +66,8 @@ | |||
| "Equipment Type Details":"設備類型詳情", | |||
| "Save":"儲存", | |||
| "Cancel":"取消", | |||
| "Equipment Details":"設備詳情" | |||
| "Equipment Details":"設備詳情", | |||
| "Exclude Date":"排除日期", | |||
| "Finished Goods Name":"成品名稱" | |||
| } | |||
| @@ -78,5 +78,7 @@ | |||
| "Job Priority": "工單優先順序", | |||
| "Job Date": "工單日期", | |||
| "Job Qty": "工單數量", | |||
| "mat": "物料" | |||
| "mat": "物料", | |||
| "Product Count(s)": "產品數量", | |||
| "Schedule Period To": "排程期間至" | |||
| } | |||