Переглянути джерело

update po

create_edit_user
MSI\derek 3 місяці тому
джерело
коміт
5d545487fc
2 змінених файлів з 56 додано та 7 видалено
  1. +55
    -6
      src/components/PoDetail/PoInputGrid.tsx
  2. +1
    -1
      src/components/PoDetail/QcForm.tsx

+ 55
- 6
src/components/PoDetail/PoInputGrid.tsx Переглянути файл

@@ -39,6 +39,13 @@ import { stockInLineStatusMap } from "@/app/utils/formatUtil";
import PoQcStockInModal from "./PoQcStockInModal";
import NotificationImportantIcon from "@mui/icons-material/NotificationImportant";
import { WarehouseResult } from "@/app/api/warehouse";
import LooksOneIcon from '@mui/icons-material/LooksOne';
import LooksTwoIcon from '@mui/icons-material/LooksTwo';
import Looks3Icon from '@mui/icons-material/Looks3';
import axiosInstance from "@/app/(main)/axios/axiosInstance";
import axios from "axios";
import { NEXT_PUBLIC_API_URL } from "@/config/api";
import QrCodeIcon from '@mui/icons-material/QrCode';
interface ResultWithId {
id: number;
}
@@ -158,13 +165,23 @@ function PoInputGrid({
},
[]
);
const fetchQcDefaultValue = useCallback(async () => {
const authHeader = axiosInstance.defaults.headers['Authorization'];
if (!authHeader) {
return; // Exit the function if the token is not set
}
const res = await axios.get<QcItemWithChecks[]>(`${NEXT_PUBLIC_API_URL}/qcResult/${itemDetail.id}`)
console.log(res)
}, [axiosInstance, axios])

const handleQC = useCallback(
(id: GridRowId, params: any) => () => {
(id: GridRowId, params: any) => async () => {
setRowModesModel((prev) => ({
...prev,
[id]: { mode: GridRowModes.View },
}));
setModalInfo(params.row);
// await fetchQcDefaultValue()
setTimeout(() => {
// open qc modal
console.log("delayed");
@@ -224,6 +241,24 @@ function PoInputGrid({
[]
);

const handleQrCode = useCallback(
(id: GridRowId, params: any) => () => {
setRowModesModel((prev) => ({
...prev,
[id]: { mode: GridRowModes.View },
}));
setModalInfo(params.row);
setTimeout(() => {
// open stock in modal
// openPutAwayModal();
// return the record with its status as pending
// update layout
console.log("delayed");
}, 200);
},
[]
);

const closeQcModal = useCallback(() => {
setQcOpen(false);
}, []);
@@ -290,7 +325,7 @@ function PoInputGrid({
label="start"
sx={{
color: "primary.main",
marginRight: 2,
// marginRight: 1,
}}
disabled={!(stockInLineStatusMap[status] === 0)}
// set _isNew to false after posting
@@ -304,7 +339,7 @@ function PoInputGrid({
label="qc"
sx={{
color: "primary.main",
marginRight: 2,
// marginRight: 1,
}}
disabled={
// stockInLineStatusMap[status] <= 0 ||
@@ -322,7 +357,7 @@ function PoInputGrid({
label="escalation"
sx={{
color: "primary.main",
marginRight: 2,
// marginRight: 1,
}}
disabled={
stockInLineStatusMap[status] <= 0 ||
@@ -339,7 +374,7 @@ function PoInputGrid({
label="stockin"
sx={{
color: "primary.main",
marginRight: 2,
// marginRight: 1,
}}
disabled={stockInLineStatusMap[status] !== 6}
// set _isNew to false after posting
@@ -353,7 +388,7 @@ function PoInputGrid({
label="putaway"
sx={{
color: "primary.main",
marginRight: 2,
// marginRight: 1,
}}
disabled={stockInLineStatusMap[status] !== 7}
// set _isNew to false after posting
@@ -362,6 +397,20 @@ function PoInputGrid({
color="inherit"
key="edit"
/>,
<GridActionsCellItem
icon={<QrCodeIcon />}
label="putaway"
sx={{
color: "primary.main",
// marginRight: 1,
}}
disabled={stockInLineStatusMap[status] !== 8}
// set _isNew to false after posting
// or check status
onClick={handleQrCode(params.row.id, params)}
color="inherit"
key="edit"
/>,
<GridActionsCellItem
icon={<DeleteIcon />}
label="Delete"


+ 1
- 1
src/components/PoDetail/QcForm.tsx Переглянути файл

@@ -65,7 +65,7 @@ const QcForm: React.FC<Props> = ({ qc, itemDetail }) => {
clearErrors,
} = useFormContext<PurchaseQCInput>();
console.log(itemDetail);
// const [qc, setQc] = useState<QcItemWithChecks[]>([])
// const fetchQcCheck = useCallback(async () => {
// const authHeader = axiosInstance.defaults.headers['Authorization'];


Завантаження…
Відмінити
Зберегти