|
|
@@ -65,13 +65,14 @@ type ApprovedSortKey = |
|
|
| "stockTakerName" |
|
|
| "stockTakerName" |
|
|
| "variance"; |
|
|
| "variance"; |
|
|
|
|
|
|
|
|
type ApproverSearchKey = "sectionDescription" | "stockTakeSession" | "itemKeyword" | "warehouseKeyword"; |
|
|
|
|
|
|
|
|
type ApproverSearchKey = "sectionDescription" | "stockTakeSession" | "itemKeyword" | "warehouseKeyword"|"status"; |
|
|
|
|
|
|
|
|
type ApproverSearchFilters = { |
|
|
type ApproverSearchFilters = { |
|
|
sectionDescription: string; |
|
|
sectionDescription: string; |
|
|
stockTakeSession: string; |
|
|
stockTakeSession: string; |
|
|
itemKeyword: string; |
|
|
itemKeyword: string; |
|
|
warehouseKeyword: string; |
|
|
warehouseKeyword: string; |
|
|
|
|
|
status: string; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
function buildApproverInventoryQuery(filters: ApproverSearchFilters): ApproverInventoryLotDetailsQuery { |
|
|
function buildApproverInventoryQuery(filters: ApproverSearchFilters): ApproverInventoryLotDetailsQuery { |
|
|
@@ -232,6 +233,7 @@ const ApproverStockTakeAll: React.FC<ApproverStockTakeAllProps> = ({ |
|
|
stockTakeSession: inputs.stockTakeSession || "", |
|
|
stockTakeSession: inputs.stockTakeSession || "", |
|
|
itemKeyword: inputs.itemKeyword || "", |
|
|
itemKeyword: inputs.itemKeyword || "", |
|
|
warehouseKeyword: inputs.warehouseKeyword || "", |
|
|
warehouseKeyword: inputs.warehouseKeyword || "", |
|
|
|
|
|
status: inputs.status || "All", |
|
|
}; |
|
|
}; |
|
|
/* |
|
|
/* |
|
|
if (!hasAnyApproverSearchCriterion(next)) { |
|
|
if (!hasAnyApproverSearchCriterion(next)) { |
|
|
@@ -280,6 +282,17 @@ const ApproverStockTakeAll: React.FC<ApproverStockTakeAllProps> = ({ |
|
|
paramName: "warehouseKeyword", |
|
|
paramName: "warehouseKeyword", |
|
|
placeholder: "", |
|
|
placeholder: "", |
|
|
}, |
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
type: "select-labelled", |
|
|
|
|
|
label: t("Record Status"), |
|
|
|
|
|
paramName: "status", |
|
|
|
|
|
options: [ |
|
|
|
|
|
{ label: t("All"), value: "All" }, |
|
|
|
|
|
{ label: t("Pending"), value: "pending" }, |
|
|
|
|
|
{ label: t("Not Match"), value: "notMatch" }, |
|
|
|
|
|
{ label: t("Pass"), value: "pass" }, // UI=Pass,值=completed |
|
|
|
|
|
], |
|
|
|
|
|
} |
|
|
], |
|
|
], |
|
|
[t, sectionDescriptionAutocompleteOptions] |
|
|
[t, sectionDescriptionAutocompleteOptions] |
|
|
); |
|
|
); |
|
|
@@ -468,12 +481,22 @@ const ApproverStockTakeAll: React.FC<ApproverStockTakeAllProps> = ({ |
|
|
}, |
|
|
}, |
|
|
[approverQty, approverBadQty] |
|
|
[approverQty, approverBadQty] |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const normalizeStatus = (v: unknown) => |
|
|
|
|
|
String(v ?? "") |
|
|
|
|
|
.trim() |
|
|
|
|
|
.toLowerCase() |
|
|
|
|
|
.replaceAll("_", ""); |
|
|
const filteredDetails = useMemo(() => { |
|
|
const filteredDetails = useMemo(() => { |
|
|
const percent = parseFloat(variancePercentTolerance || "0"); |
|
|
const percent = parseFloat(variancePercentTolerance || "0"); |
|
|
const thresholdPercent = isNaN(percent) || percent < 0 ? 0 : percent; |
|
|
const thresholdPercent = isNaN(percent) || percent < 0 ? 0 : percent; |
|
|
|
|
|
|
|
|
return inventoryLotDetails.filter((detail) => { |
|
|
|
|
|
|
|
|
const statusFilter = appliedFilters?.status ?? "All"; |
|
|
|
|
|
return inventoryLotDetails.filter((detail) => { |
|
|
|
|
|
if (statusFilter !== "All") { |
|
|
|
|
|
const rowStatus = normalizeStatus(detail.stockTakeRecordStatus); |
|
|
|
|
|
const wanted = normalizeStatus(statusFilter); |
|
|
|
|
|
if (rowStatus !== wanted) return false; |
|
|
|
|
|
} |
|
|
/* |
|
|
/* |
|
|
if (detail.finalQty != null || detail.stockTakeRecordStatus === "completed") { |
|
|
if (detail.finalQty != null || detail.stockTakeRecordStatus === "completed") { |
|
|
return true; |
|
|
return true; |
|
|
@@ -1110,20 +1133,26 @@ const ApproverStockTakeAll: React.FC<ApproverStockTakeAllProps> = ({ |
|
|
minWidth: 130, |
|
|
minWidth: 130, |
|
|
flex: 0.6, |
|
|
flex: 0.6, |
|
|
sortable: false, |
|
|
sortable: false, |
|
|
renderCell: (params) => ( |
|
|
|
|
|
<Chip |
|
|
|
|
|
size="small" |
|
|
|
|
|
label={ t(`${params.row.stockTakeRecordStatus}`) || "-"} |
|
|
|
|
|
color={ |
|
|
|
|
|
params.row.stockTakeRecordStatus === "completed" |
|
|
|
|
|
? "success" |
|
|
|
|
|
: params.row.stockTakeRecordStatus === "notMatch" |
|
|
|
|
|
? "warning" |
|
|
|
|
|
: "default" |
|
|
|
|
|
} |
|
|
|
|
|
variant="outlined" |
|
|
|
|
|
/> |
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
renderCell: (params) => { |
|
|
|
|
|
const raw = params.row.stockTakeRecordStatus; |
|
|
|
|
|
const status = String(raw ?? "").trim().toLowerCase(); |
|
|
|
|
|
|
|
|
|
|
|
const colorMap: Record<string, "success" | "warning" | "info" | "default" | "error"> = { |
|
|
|
|
|
completed: "success", |
|
|
|
|
|
notmatch: "warning", |
|
|
|
|
|
pending: "info", |
|
|
|
|
|
"not_match": "warning", |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
<Chip |
|
|
|
|
|
size="small" |
|
|
|
|
|
label={t(`${status}`) || "-"} |
|
|
|
|
|
color={colorMap[status] ?? "default"} |
|
|
|
|
|
variant="outlined" |
|
|
|
|
|
/> |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
field: "stockTakerName", |
|
|
field: "stockTakerName", |
|
|
@@ -1306,6 +1335,8 @@ const ApproverStockTakeAll: React.FC<ApproverStockTakeAllProps> = ({ |
|
|
pageSizeOptions={[50, 100, 200, 500]} |
|
|
pageSizeOptions={[50, 100, 200, 500]} |
|
|
getRowHeight={() => "auto"} |
|
|
getRowHeight={() => "auto"} |
|
|
sx={{ |
|
|
sx={{ |
|
|
|
|
|
backgroundColor: "transparent", |
|
|
|
|
|
"& .MuiDataGrid-columnHeaders": { backgroundColor: "#fff" }, |
|
|
"& .MuiDataGrid-cell": { py: 1, alignItems: "flex-start" }, |
|
|
"& .MuiDataGrid-cell": { py: 1, alignItems: "flex-start" }, |
|
|
"& .MuiDataGrid-row": { minHeight: 80 }, |
|
|
"& .MuiDataGrid-row": { minHeight: 80 }, |
|
|
}} |
|
|
}} |
|
|
|