瀏覽代碼

update po

master
kelvinsuen 1 月之前
父節點
當前提交
0628de768b
共有 1 個檔案被更改,包括 6 行新增4 行删除
  1. +6
    -4
      src/components/PoDetail/PoDetail.tsx

+ 6
- 4
src/components/PoDetail/PoDetail.tsx 查看文件

@@ -63,7 +63,6 @@ import { useRouter, useSearchParams, usePathname } from "next/navigation";
import { WarehouseResult } from "@/app/api/warehouse"; import { WarehouseResult } from "@/app/api/warehouse";
import { calculateWeight, dateStringToDayjs, dayjsToDateString, OUTPUT_DATE_FORMAT, outputDateStringToInputDateString, returnWeightUnit } from "@/app/utils/formatUtil"; import { calculateWeight, dateStringToDayjs, dayjsToDateString, OUTPUT_DATE_FORMAT, outputDateStringToInputDateString, returnWeightUnit } from "@/app/utils/formatUtil";
import { CameraContext } from "../Cameras/CameraProvider"; import { CameraContext } from "../Cameras/CameraProvider";
import PoQcStockInModal from "./PoQcStockInModal";
import QrModal from "./QrModal"; import QrModal from "./QrModal";
import { PlayArrow } from "@mui/icons-material"; import { PlayArrow } from "@mui/icons-material";
import DoneIcon from "@mui/icons-material/Done"; import DoneIcon from "@mui/icons-material/Done";
@@ -480,6 +479,8 @@ const PoDetail: React.FC<Props> = ({ po, warehouse, printerCombo }) => {
// const [focusField, setFocusField] = useState<HTMLInputElement>(); // const [focusField, setFocusField] = useState<HTMLInputElement>();


const purchaseToStockRatio = (row.stockUom.purchaseRatioN ?? 1) / (row.stockUom.purchaseRatioD ?? 1) * (row.stockUom.stockRatioD ?? 1) / (row.stockUom.stockRatioN ?? 1) const purchaseToStockRatio = (row.stockUom.purchaseRatioN ?? 1) / (row.stockUom.purchaseRatioD ?? 1) * (row.stockUom.stockRatioD ?? 1) / (row.stockUom.stockRatioN ?? 1)
const receivedTotal = decimalFormatter.format(row.stockInLine.filter((sil) => sil.purchaseOrderLineId === row.id).reduce((acc, cur) => acc + (cur.acceptedQty ?? 0),0) * purchaseToStockRatio);
const highlightColor = (Number(receivedTotal.replace(/,/g, '')) <= 0) ? "red" : "inherit";
return ( return (
<> <>
<TableRow <TableRow
@@ -511,15 +512,16 @@ const PoDetail: React.FC<Props> = ({ po, warehouse, printerCombo }) => {
<TableCell align="right">{integerFormatter.format(row.processed)}</TableCell> <TableCell align="right">{integerFormatter.format(row.processed)}</TableCell>
<TableCell align="left">{row.uom?.udfudesc}</TableCell> <TableCell align="left">{row.uom?.udfudesc}</TableCell>
{/* <TableCell align="right">{decimalFormatter.format(row.stockUom.stockQty)}</TableCell> */} {/* <TableCell align="right">{decimalFormatter.format(row.stockUom.stockQty)}</TableCell> */}
<TableCell align="right">{decimalFormatter.format(row.stockInLine.filter((sil) => sil.purchaseOrderLineId === row.id).reduce((acc, cur) => acc + (cur.acceptedQty ?? 0),0) * purchaseToStockRatio)}</TableCell>
<TableCell align="left">{row.stockUom.stockUomDesc}</TableCell>
<TableCell sx={{ color: highlightColor}} align="right">{receivedTotal}</TableCell>
<TableCell sx={{ color: highlightColor}} align="left">{row.stockUom.stockUomDesc}</TableCell>
{/* <TableCell align="right"> {/* <TableCell align="right">
{decimalFormatter.format(totalWeight)} {weightUnit} {decimalFormatter.format(totalWeight)} {weightUnit}
</TableCell> */} </TableCell> */}
{/* <TableCell align="left">{weightUnit}</TableCell> */} {/* <TableCell align="left">{weightUnit}</TableCell> */}
{/* <TableCell align="right">{decimalFormatter.format(row.price)}</TableCell> */} {/* <TableCell align="right">{decimalFormatter.format(row.price)}</TableCell> */}
{/* <TableCell align="left">{row.expiryDate}</TableCell> */} {/* <TableCell align="left">{row.expiryDate}</TableCell> */}
<TableCell align="left">{t(`${currStatus.toLowerCase()}`)}</TableCell>
<TableCell sx={{ color: highlightColor}} align="left">{t(`${row.status.toLowerCase()}`)}</TableCell>
{/* <TableCell sx={{ color: highlightColor}} align="left">{t(`${currStatus.toLowerCase()}`)}</TableCell> */}
{/* <TableCell align="right">{integerFormatter.format(row.receivedQty)}</TableCell> */} {/* <TableCell align="right">{integerFormatter.format(row.receivedQty)}</TableCell> */}
<TableCell align="center"> <TableCell align="center">
<TextField <TextField


Loading…
取消
儲存