Browse Source

update

master
cyril.tsui 1 month ago
parent
commit
000ece986d
7 changed files with 93 additions and 11 deletions
  1. +3
    -0
      src/app/api/scheduling/index.ts
  2. +12
    -5
      src/components/DetailedSchedule/DetailedScheduleSearchView.tsx
  3. +11
    -0
      src/components/DetailedScheduleDetail/ViewByFGDetails.tsx
  4. +12
    -4
      src/components/RoughSchedule/RoughSchedileSearchView.tsx
  5. +22
    -0
      src/components/RoughScheduleDetail/ViewByBomDetails.tsx
  6. +23
    -2
      src/components/RoughScheduleDetail/ViewByFGDetails.tsx
  7. +10
    -0
      src/components/ScheduleTable/BomMaterialTable.tsx

+ 3
- 0
src/app/api/scheduling/index.ts View File

@@ -31,6 +31,7 @@ export interface RoughProdScheduleLineResultByFg {
type: string; type: string;
availableQty: number; availableQty: number;
prodQty: number; prodQty: number;
uomName: string;
lastMonthAvgSales: number; lastMonthAvgSales: number;
estCloseBal: number; estCloseBal: number;
priority: number; priority: number;
@@ -94,6 +95,7 @@ export interface DetailedProdScheduleLineResult {
type: string; type: string;
demandQty: number; demandQty: number;
bomOutputQty: number; bomOutputQty: number;
uomName: string;
prodTimeInMinute: DetailedProdScheduleLineProdTimeResult[]; prodTimeInMinute: DetailedProdScheduleLineProdTimeResult[];
priority: number; priority: number;
approved: boolean; approved: boolean;
@@ -107,6 +109,7 @@ export interface DetailedProdScheduleLineBomMaterialResult {
type: string; type: string;
availableQty: number; availableQty: number;
demandQty: number; demandQty: number;
uomName: string;
} }


export interface DetailedProdScheduleLineProdTimeResult { export interface DetailedProdScheduleLineProdTimeResult {


+ 12
- 5
src/components/DetailedSchedule/DetailedScheduleSearchView.tsx View File

@@ -19,6 +19,7 @@ import dayjs from "dayjs";
import { orderBy, uniqBy } from "lodash"; import { orderBy, uniqBy } from "lodash";
import { Button, Stack } from "@mui/material"; import { Button, Stack } from "@mui/material";
import isToday from 'dayjs/plugin/isToday'; import isToday from 'dayjs/plugin/isToday';
import useUploadContext from "../UploadProvider/useUploadContext";
dayjs.extend(isToday); dayjs.extend(isToday);


// may need move to "index" or "actions" // may need move to "index" or "actions"
@@ -45,6 +46,7 @@ const DSOverview: React.FC<Props> = ({ type, defaultInputs }) => {
ProdScheduleResult[] ProdScheduleResult[]
>([]); >([]);
const { t } = useTranslation("schedule"); const { t } = useTranslation("schedule");
const { setIsUploading } = useUploadContext();


const router = useRouter(); const router = useRouter();
// const [filterObj, setFilterObj] = useState({}); // const [filterObj, setFilterObj] = useState({});
@@ -282,11 +284,16 @@ const DSOverview: React.FC<Props> = ({ type, defaultInputs }) => {
}, []); }, []);


const testDetailedScheduleClick = useCallback(async () => { 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]) }, [inputs])




+ 11
- 0
src/components/DetailedScheduleDetail/ViewByFGDetails.tsx View File

@@ -168,6 +168,17 @@ const ViewByFGDetails: React.FC<Props> = ({ apiRef, isEdit, type, onReleaseClick
return row.demandQty; return row.demandQty;
}, },
}, },
{
field: "uomName",
label: t("UoM Name"),
type: "read-only",
style: {
textAlign: "left",
},
renderCell: (row) => {
return row.uomName;
},
},
{ {
field: "prodTimeInMinute", field: "prodTimeInMinute",
label: t("Estimated Production Time"), label: t("Estimated Production Time"),


+ 12
- 4
src/components/RoughSchedule/RoughSchedileSearchView.tsx View File

@@ -28,6 +28,7 @@ import dayjs from "dayjs";
import { defaultPagingController } from "../SearchResults/SearchResults"; import { defaultPagingController } from "../SearchResults/SearchResults";
import { ScheduleType } from "@/app/api/scheduling"; import { ScheduleType } from "@/app/api/scheduling";
import { Button, Stack } from "@mui/material"; import { Button, Stack } from "@mui/material";
import useUploadContext from "../UploadProvider/useUploadContext";


// type RecordStructure ={ // type RecordStructure ={
// id: number, // id: number,
@@ -59,6 +60,7 @@ const RSOverview: React.FC<Props> = ({ type, defaultInputs }) => {
); );
const [totalCount, setTotalCount] = useState(0); const [totalCount, setTotalCount] = useState(0);
const [inputs, setInputs] = useState(defaultInputs); const [inputs, setInputs] = useState(defaultInputs);
const { setIsUploading } = useUploadContext();


const searchCriteria: Criterion<SearchParamNames>[] = useMemo(() => { const searchCriteria: Criterion<SearchParamNames>[] = useMemo(() => {
const searchCriteria: Criterion<SearchParamNames>[] = [ const searchCriteria: Criterion<SearchParamNames>[] = [
@@ -254,10 +256,16 @@ const RSOverview: React.FC<Props> = ({ type, defaultInputs }) => {
}, []); }, []);


const testRoughScheduleClick = useCallback(async () => { 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)
} }
}, []); }, []);




+ 22
- 0
src/components/RoughScheduleDetail/ViewByBomDetails.tsx View File

@@ -302,6 +302,17 @@ const ViewByBomDetails: React.FC<Props> = ({
return row.demandQty7; return row.demandQty7;
}, },
}, },
{
field: "uomName",
label: t("UoM Name"),
type: "read-only",
style: {
textAlign: "left",
},
renderCell: (row) => {
return row.uomName;
},
},
], ],
[t], [t],
); );
@@ -356,6 +367,17 @@ const ViewByBomDetails: React.FC<Props> = ({
return row.demandQty; return row.demandQty;
}, },
}, },
{
field: "uomName",
label: t("UoM Name"),
type: "read-only",
style: {
textAlign: "left",
},
renderCell: (row) => {
return row.uomName;
},
},
], ],
[], [],
); );


+ 23
- 2
src/components/RoughScheduleDetail/ViewByFGDetails.tsx View File

@@ -184,6 +184,18 @@ const ViewByFGDetails: React.FC<Props> = ({
return row.prodQty; 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; 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 ( return (
<Grid container spacing={2}> <Grid container spacing={2}>
<Grid item xs={12} key={"all"}> <Grid item xs={12} key={"all"}>


+ 10
- 0
src/components/ScheduleTable/BomMaterialTable.tsx View File

@@ -133,6 +133,16 @@ function BomMaterialTable({ bomMaterial }: Props) {
return decimalFormatter.format(row.value); 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", field: "status",
headerName: t("status"), headerName: t("status"),


Loading…
Cancel
Save