Browse Source

update stock in

master
kelvinsuen 2 months ago
parent
commit
33e7d5ea0b
3 changed files with 9 additions and 10 deletions
  1. +6
    -3
      src/components/JoSearch/JoSearch.tsx
  2. +2
    -5
      src/components/PoDetail/PutAwayForm.tsx
  3. +1
    -2
      src/components/PoDetail/QcStockInModal.tsx

+ 6
- 3
src/components/JoSearch/JoSearch.tsx View File

@@ -89,8 +89,10 @@ const JoSearch: React.FC<Props> = ({ defaultInputs, bomCombo }) => {
{ {
name: "status", name: "status",
label: t("Status"), label: t("Status"),
renderCell: (row) => {
return t(upperFirst(row.status))
renderCell: (row) => { // TODO improve
return <span style={{color: row.stockInLineStatus == "escalated" ? "red" : "inherit"}}>
{t(upperFirst(row.status))}
</span>
} }
}, },
{ {
@@ -195,7 +197,7 @@ const JoSearch: React.FC<Props> = ({ defaultInputs, bomCombo }) => {
// case "storing": btnSx = {label: t("view putaway"), color:"secondary.main"}; break; // case "storing": btnSx = {label: t("view putaway"), color:"secondary.main"}; break;
case "storing": case "storing":
switch (silStatus) { switch (silStatus) {
case "pending": btnSx = {label: t("process epqc"), color:"primary.main"}; break;
case "pending": btnSx = {label: t("process epqc"), color:"success.main"}; break;
case "received": btnSx = {label: t("view putaway"), color:"secondary.main"}; break; case "received": btnSx = {label: t("view putaway"), color:"secondary.main"}; break;
case "escalated": case "escalated":
if (sessionToken?.id == jo.silHandlerId) { if (sessionToken?.id == jo.silHandlerId) {
@@ -225,6 +227,7 @@ const JoSearch: React.FC<Props> = ({ defaultInputs, bomCombo }) => {
if (record.stockInLineId != null) { if (record.stockInLineId != null) {
const data = { const data = {
id: record.stockInLineId, id: record.stockInLineId,
expiryDate: arrayToDateString(dayjs().add(1, "month"), "input"),
} }
setModalInfo(data); setModalInfo(data);
setOpenModal(true); setOpenModal(true);


+ 2
- 5
src/components/PoDetail/PutAwayForm.tsx View File

@@ -39,6 +39,7 @@ import { GridEditInputCell } from "@mui/x-data-grid";
import { StockInLine } from "@/app/api/stockIn"; import { StockInLine } from "@/app/api/stockIn";
import { WarehouseResult } from "@/app/api/warehouse"; import { WarehouseResult } from "@/app/api/warehouse";
import { import {
arrayToDateString,
arrayToDateTimeString, arrayToDateTimeString,
OUTPUT_DATE_FORMAT, OUTPUT_DATE_FORMAT,
stockInLineStatusMap, stockInLineStatusMap,
@@ -382,11 +383,7 @@ const PutAwayForm: React.FC<Props> = ({ itemDetail, warehouse=[], disabled, setR
<TextField <TextField
label={t("expiryDate")} label={t("expiryDate")}
fullWidth fullWidth
value={
// dayjs(itemDetail.expiryDate)
dayjs()
.add(20, "day")
.format(OUTPUT_DATE_FORMAT)}
value={arrayToDateString(itemDetail.expiryDate, "output")}
disabled disabled
/> />
</Grid> </Grid>


+ 1
- 2
src/components/PoDetail/QcStockInModal.tsx View File

@@ -21,7 +21,6 @@ import { StockInLineRow } from "./PoInputGrid";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import StockInForm from "./StockInForm"; import StockInForm from "./StockInForm";
import QcComponent from "./QcComponent"; import QcComponent from "./QcComponent";
import { dummyPutAwayLine, dummyQCData } from "./dummyQcTemplate";
import PutAwayForm from "./PutAwayForm"; import PutAwayForm from "./PutAwayForm";
import { GridRowModes, GridRowSelectionModel, useGridApiRef } from "@mui/x-data-grid"; import { GridRowModes, GridRowSelectionModel, useGridApiRef } from "@mui/x-data-grid";
import {msg, submitDialogWithWarning} from "../Swal/CustomAlerts"; import {msg, submitDialogWithWarning} from "../Swal/CustomAlerts";
@@ -108,7 +107,7 @@ const PoQcStockInModalVer2: React.FC<Props> = ({
const res = await fetchStockInLineInfo(stockInLineId); const res = await fetchStockInLineInfo(stockInLineId);
if (res) { if (res) {
console.log("%c Fetched Stock In Line: ", "color:orange", res); console.log("%c Fetched Stock In Line: ", "color:orange", res);
setStockInLineInfo({...inputDetail, ...res});
setStockInLineInfo({...inputDetail, ...res, expiryDate: inputDetail?.expiryDate}); // TODO review to overwrite res with inputDetail instead (revise PO fetching data)
fetchQcResultData(stockInLineId); fetchQcResultData(stockInLineId);
} else throw("Result is undefined"); } else throw("Result is undefined");


Loading…
Cancel
Save