| @@ -31,6 +31,7 @@ export interface RoughProdScheduleLineResultByFg { | |||
| type: string; | |||
| availableQty: number; | |||
| prodQty: number; | |||
| uomName: string; | |||
| lastMonthAvgSales: number; | |||
| estCloseBal: number; | |||
| priority: number; | |||
| @@ -94,6 +95,7 @@ export interface DetailedProdScheduleLineResult { | |||
| type: string; | |||
| demandQty: number; | |||
| bomOutputQty: number; | |||
| uomName: string; | |||
| prodTimeInMinute: DetailedProdScheduleLineProdTimeResult[]; | |||
| priority: number; | |||
| approved: boolean; | |||
| @@ -107,6 +109,7 @@ export interface DetailedProdScheduleLineBomMaterialResult { | |||
| type: string; | |||
| availableQty: number; | |||
| demandQty: number; | |||
| uomName: string; | |||
| } | |||
| export interface DetailedProdScheduleLineProdTimeResult { | |||
| @@ -19,6 +19,7 @@ import dayjs from "dayjs"; | |||
| import { orderBy, uniqBy } from "lodash"; | |||
| import { Button, Stack } from "@mui/material"; | |||
| import isToday from 'dayjs/plugin/isToday'; | |||
| import useUploadContext from "../UploadProvider/useUploadContext"; | |||
| dayjs.extend(isToday); | |||
| // may need move to "index" or "actions" | |||
| @@ -45,6 +46,7 @@ const DSOverview: React.FC<Props> = ({ type, defaultInputs }) => { | |||
| ProdScheduleResult[] | |||
| >([]); | |||
| const { t } = useTranslation("schedule"); | |||
| const { setIsUploading } = useUploadContext(); | |||
| const router = useRouter(); | |||
| // const [filterObj, setFilterObj] = useState({}); | |||
| @@ -282,11 +284,16 @@ const DSOverview: React.FC<Props> = ({ type, defaultInputs }) => { | |||
| }, []); | |||
| const testDetailedScheduleClick = useCallback(async () => { | |||
| console.log(inputs.scheduleAt) | |||
| const response = await testDetailedSchedule(inputs.scheduleAt) | |||
| if (response) { | |||
| refetchData(inputs, "paging"); | |||
| try { | |||
| setIsUploading(true) | |||
| const response = await testDetailedSchedule(inputs.scheduleAt) | |||
| if (response) { | |||
| refetchData(inputs, "paging"); | |||
| } | |||
| } catch(e) { | |||
| console.log(e) | |||
| } finally { | |||
| setIsUploading(false) | |||
| } | |||
| }, [inputs]) | |||
| @@ -168,6 +168,17 @@ const ViewByFGDetails: React.FC<Props> = ({ apiRef, isEdit, type, onReleaseClick | |||
| return row.demandQty; | |||
| }, | |||
| }, | |||
| { | |||
| field: "uomName", | |||
| label: t("UoM Name"), | |||
| type: "read-only", | |||
| style: { | |||
| textAlign: "left", | |||
| }, | |||
| renderCell: (row) => { | |||
| return row.uomName; | |||
| }, | |||
| }, | |||
| { | |||
| field: "prodTimeInMinute", | |||
| label: t("Estimated Production Time"), | |||
| @@ -28,6 +28,7 @@ import dayjs from "dayjs"; | |||
| import { defaultPagingController } from "../SearchResults/SearchResults"; | |||
| import { ScheduleType } from "@/app/api/scheduling"; | |||
| import { Button, Stack } from "@mui/material"; | |||
| import useUploadContext from "../UploadProvider/useUploadContext"; | |||
| // type RecordStructure ={ | |||
| // id: number, | |||
| @@ -59,6 +60,7 @@ const RSOverview: React.FC<Props> = ({ type, defaultInputs }) => { | |||
| ); | |||
| const [totalCount, setTotalCount] = useState(0); | |||
| const [inputs, setInputs] = useState(defaultInputs); | |||
| const { setIsUploading } = useUploadContext(); | |||
| const searchCriteria: Criterion<SearchParamNames>[] = useMemo(() => { | |||
| const searchCriteria: Criterion<SearchParamNames>[] = [ | |||
| @@ -254,10 +256,16 @@ const RSOverview: React.FC<Props> = ({ type, defaultInputs }) => { | |||
| }, []); | |||
| const testRoughScheduleClick = useCallback(async () => { | |||
| const response = await testRoughSchedule() | |||
| if (response) { | |||
| refetchData(inputs, "paging"); | |||
| try { | |||
| setIsUploading(true) | |||
| const response = await testRoughSchedule() | |||
| if (response) { | |||
| refetchData(inputs, "paging"); | |||
| } | |||
| } catch(e) { | |||
| console.log(e) | |||
| } finally { | |||
| setIsUploading(false) | |||
| } | |||
| }, []); | |||
| @@ -302,6 +302,17 @@ const ViewByBomDetails: React.FC<Props> = ({ | |||
| return row.demandQty7; | |||
| }, | |||
| }, | |||
| { | |||
| field: "uomName", | |||
| label: t("UoM Name"), | |||
| type: "read-only", | |||
| style: { | |||
| textAlign: "left", | |||
| }, | |||
| renderCell: (row) => { | |||
| return row.uomName; | |||
| }, | |||
| }, | |||
| ], | |||
| [t], | |||
| ); | |||
| @@ -356,6 +367,17 @@ const ViewByBomDetails: React.FC<Props> = ({ | |||
| return row.demandQty; | |||
| }, | |||
| }, | |||
| { | |||
| field: "uomName", | |||
| label: t("UoM Name"), | |||
| type: "read-only", | |||
| style: { | |||
| textAlign: "left", | |||
| }, | |||
| renderCell: (row) => { | |||
| return row.uomName; | |||
| }, | |||
| }, | |||
| ], | |||
| [], | |||
| ); | |||
| @@ -184,6 +184,18 @@ const ViewByFGDetails: React.FC<Props> = ({ | |||
| return row.prodQty; | |||
| }, | |||
| }, | |||
| { | |||
| field: "uomName", | |||
| label: t("UoM Name"), | |||
| type: "read-only", | |||
| style: { | |||
| textAlign: "left", | |||
| }, | |||
| // editable: true, | |||
| renderCell: (row) => { | |||
| return row.uomName; | |||
| }, | |||
| }, | |||
| ], | |||
| [], | |||
| ); | |||
| @@ -269,12 +281,21 @@ const ViewByFGDetails: React.FC<Props> = ({ | |||
| return row.prodQty; | |||
| }, | |||
| }, | |||
| { | |||
| field: "uomName", | |||
| label: t("UoM Name"), | |||
| type: "read-only", | |||
| style: { | |||
| textAlign: "left", | |||
| }, | |||
| renderCell: (row) => { | |||
| return row.uomName; | |||
| }, | |||
| }, | |||
| ], | |||
| [], | |||
| ); | |||
| console.log(getValues("prodScheduleLinesByFg")); | |||
| return ( | |||
| <Grid container spacing={2}> | |||
| <Grid item xs={12} key={"all"}> | |||
| @@ -133,6 +133,16 @@ function BomMaterialTable({ bomMaterial }: Props) { | |||
| return decimalFormatter.format(row.value); | |||
| }, | |||
| }, | |||
| { | |||
| field: "uomName", | |||
| headerName: t("UoM Name"), | |||
| flex: 0.5, | |||
| align: "left", | |||
| headerAlign: "left", | |||
| renderCell: (row) => { | |||
| return row.value; | |||
| }, | |||
| }, | |||
| { | |||
| field: "status", | |||
| headerName: t("status"), | |||