| @@ -68,6 +68,7 @@ import PoInfoCard from "./PoInfoCard"; | |||||
| import { decimalFormatter, integerFormatter } from "@/app/utils/formatUtil"; | import { decimalFormatter, integerFormatter } from "@/app/utils/formatUtil"; | ||||
| import { fetchPoListClient } from "@/app/api/po/actions"; | import { fetchPoListClient } from "@/app/api/po/actions"; | ||||
| import { List, ListItem, ListItemButton, ListItemText, Divider } from "@mui/material"; | import { List, ListItem, ListItemButton, ListItemText, Divider } from "@mui/material"; | ||||
| import { createStockInLine } from "@/app/api/dashboard/actions"; | |||||
| //import { useRouter } from "next/navigation"; | //import { useRouter } from "next/navigation"; | ||||
| @@ -340,6 +341,27 @@ const PoDetail: React.FC<Props> = ({ po, qc, warehouse }) => { | |||||
| [] | [] | ||||
| ); | ); | ||||
| const handleStart = useCallback( | |||||
| () => { | |||||
| setTimeout(async () => { | |||||
| // post stock in line | |||||
| const oldId = row.id; | |||||
| const postData = { | |||||
| itemId: row.itemId, | |||||
| itemNo: row.itemNo, | |||||
| itemName: row.itemName, | |||||
| purchaseOrderId: row.purchaseOrderId, | |||||
| purchaseOrderLineId: row.id, | |||||
| acceptedQty: secondReceiveQty || 0, | |||||
| // acceptedQty: row.acceptedQty, | |||||
| }; | |||||
| if (postData.acceptedQty === 0) return | |||||
| const res = await createStockInLine(postData); | |||||
| console.log(res); | |||||
| }, 200); | |||||
| }, | |||||
| [], | |||||
| ); | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| <TableRow | <TableRow | ||||
| @@ -389,7 +411,12 @@ const PoDetail: React.FC<Props> = ({ po, qc, warehouse }) => { | |||||
| /> | /> | ||||
| </TableCell> | </TableCell> | ||||
| <TableCell align="center"> | <TableCell align="center"> | ||||
| <Button variant="contained"> | |||||
| <Button | |||||
| variant="contained" | |||||
| onClick={() => | |||||
| handleStart() | |||||
| } | |||||
| > | |||||
| 提交 | 提交 | ||||
| </Button> | </Button> | ||||
| </TableCell> | </TableCell> | ||||