fix: sync columns and data counts in slaughter bars

This commit is contained in:
2026-02-02 10:05:02 +03:30
parent 88392f378d
commit 52fab173c8

View File

@@ -5,7 +5,7 @@ import {
Tabs, Tabs,
TextField, TextField,
Tooltip, Tooltip,
Typography, Typography
} from "@mui/material"; } from "@mui/material";
import { format } from "date-fns-jalali"; import { format } from "date-fns-jalali";
import { useContext, useEffect, useState } from "react"; import { useContext, useEffect, useState } from "react";
@@ -23,7 +23,7 @@ import { RiFileExcel2Fill, RiSearchLine } from "react-icons/ri";
import { import {
LOADING_END, LOADING_END,
LOADING_START, LOADING_START,
OPEN_MODAL, OPEN_MODAL
} from "../../../../lib/redux/slices/appSlice"; } from "../../../../lib/redux/slices/appSlice";
import { getRoleFromUrl } from "../../../../utils/getRoleFromUrl"; import { getRoleFromUrl } from "../../../../utils/getRoleFromUrl";
// import { getFaUserRole } from "../../../../utils/getFaUserRole"; // import { getFaUserRole } from "../../../../utils/getFaUserRole";
@@ -132,7 +132,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "100px", width: "100px"
}, },
{ {
name: "خریدار", name: "خریدار",
@@ -143,7 +143,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "80px", width: "80px"
}, },
{ {
name: "کشتارکن اختصاصی", name: "کشتارکن اختصاصی",
@@ -156,7 +156,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "80px", width: "80px"
}, },
{ {
name: "ماشین", name: "ماشین",
@@ -167,7 +167,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "100px", width: "100px"
}, },
{ {
name: "راننده", name: "راننده",
@@ -178,7 +178,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "80px", width: "80px"
}, },
{ {
name: "کد بهداشتی حمل و نقل", name: "کد بهداشتی حمل و نقل",
@@ -188,7 +188,7 @@ export const SlaughterBars = () => {
sortable: false, sortable: false,
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true
// width: "80px", // width: "80px",
}, },
{ {
@@ -199,7 +199,7 @@ export const SlaughterBars = () => {
sortable: false, sortable: false,
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true
// width: "80px", // width: "80px",
}, },
{ {
@@ -211,7 +211,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "50px", width: "50px"
}, },
{ {
name: "تعداد اولیه", name: "تعداد اولیه",
@@ -222,7 +222,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "50px", width: "50px"
}, },
{ {
name: "وزن اولیه بار (کیلوگرم)", name: "وزن اولیه بار (کیلوگرم)",
@@ -233,7 +233,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "70px", width: "70px"
}, },
{ {
name: "میانگین وزن اولیه (کیلوگرم)", name: "میانگین وزن اولیه (کیلوگرم)",
@@ -244,7 +244,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "70px", width: "70px"
}, },
{ {
name: "قیمت مرغدار", name: "قیمت مرغدار",
@@ -255,7 +255,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "80px", width: "80px"
}, },
{ {
name: "قیمت کشتارگاه", name: "قیمت کشتارگاه",
@@ -266,7 +266,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "80px", width: "80px"
}, },
{ {
name: "مرغدار", name: "مرغدار",
@@ -277,7 +277,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "80px", width: "80px"
}, },
{ {
name: "دامپزشک فارم", name: "دامپزشک فارم",
@@ -291,7 +291,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "100px", width: "100px"
}, },
{ {
name: "کدرهگیری سامانه قرنطینه", name: "کدرهگیری سامانه قرنطینه",
@@ -324,7 +324,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "200px", width: "200px"
}, },
{ {
name: "محل کشتار", name: "محل کشتار",
@@ -335,7 +335,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "80px", width: "80px"
}, },
{ {
name: "شهر", name: "شهر",
@@ -346,7 +346,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "80px", width: "80px"
}, },
{ {
name: "تاریخ کشتار", name: "تاریخ کشتار",
@@ -359,7 +359,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "80px", width: "80px"
}, },
{ {
name: "کدسفارش کشتار", name: "کدسفارش کشتار",
@@ -370,7 +370,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "70px", width: "70px"
}, },
{ {
name: "تعداد نهایی", name: "تعداد نهایی",
@@ -381,7 +381,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "50px", width: "50px"
}, },
{ {
name: "وزن نهایی بار (کیلوگرم)", name: "وزن نهایی بار (کیلوگرم)",
@@ -392,7 +392,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "70px", width: "70px"
}, },
{ {
name: "میانگین وزن نهایی (کیلوگرم)", name: "میانگین وزن نهایی (کیلوگرم)",
@@ -403,7 +403,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "70px", width: "70px"
}, },
{ {
name: "وضعیت", name: "وضعیت",
@@ -420,7 +420,7 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "90px", width: "90px"
}, },
{ {
name: "عملیات", name: "عملیات",
@@ -440,7 +440,7 @@ export const SlaughterBars = () => {
updateTable={updateTable} updateTable={updateTable}
killHouseRequestKey={item.key} killHouseRequestKey={item.key}
/> />
), )
}) })
); );
}} }}
@@ -455,8 +455,8 @@ export const SlaughterBars = () => {
wrap: true, wrap: true,
allowOverflow: true, allowOverflow: true,
center: true, center: true,
width: "70px", width: "70px"
}, }
]; ];
const handleDateChange1 = (date) => { const handleDateChange1 = (date) => {
@@ -486,7 +486,7 @@ export const SlaughterBars = () => {
textValue, textValue,
role_key: checkPathStartsWith("slaughter") role_key: checkPathStartsWith("slaughter")
? selectedSubUser?.key || "" ? selectedSubUser?.key || ""
: "", : ""
}) })
).then((r) => { ).then((r) => {
setDashboardData(r.payload.data); setDashboardData(r.payload.data);
@@ -514,7 +514,7 @@ export const SlaughterBars = () => {
textValue, textValue,
role_key: checkPathStartsWith("slaughter") role_key: checkPathStartsWith("slaughter")
? selectedSubUser?.key || "" ? selectedSubUser?.key || ""
: "", : ""
}) })
).then((r) => { ).then((r) => {
setDashboardData(r.payload.data); setDashboardData(r.payload.data);
@@ -619,6 +619,9 @@ export const SlaughterBars = () => {
return [ return [
item.barCode, item.barCode,
`${item.killhouseUser?.name} (${item.killhouseUser?.killHouseOperator?.user?.mobile})`, `${item.killhouseUser?.name} (${item.killhouseUser?.killHouseOperator?.user?.mobile})`,
item?.killer
? `${item?.killer?.name} (${item?.killer?.killHouseOperator?.user?.mobile})`
: "-",
`${item.addCar.driver.typeCar} ${item.addCar.driver.pelak}`, `${item.addCar.driver.typeCar} ${item.addCar.driver.pelak}`,
`${item.addCar.driver.driverName} (${item.addCar.driver.driverMobile})`, `${item.addCar.driver.driverName} (${item.addCar.driver.driverMobile})`,
<VetFarmEditTrafficCode <VetFarmEditTrafficCode
@@ -635,10 +638,21 @@ export const SlaughterBars = () => {
getRoleFromUrl() === "VetSupervisor" getRoleFromUrl() === "VetSupervisor"
} }
/>, />,
item?.amount !== undefined && item?.amount !== null
? item?.amount?.toLocaleString() + " ﷼"
: "-",
item.poultryRequest.chickenBreed, item.poultryRequest.chickenBreed,
item.quantity?.toLocaleString(), item.quantity?.toLocaleString(),
item?.weightInfo?.weight?.toLocaleString(), item?.weightInfo?.weight?.toLocaleString(),
item?.weightInfo?.indexWeight?.toLocaleString(), item?.weightInfo?.indexWeight?.toLocaleString(),
item?.poultryRequest?.amount !== undefined &&
item?.poultryRequest?.amount !== null
? item?.poultryRequest?.amount?.toLocaleString() + " ﷼"
: "-",
item?.weightInfo?.killHousePrice !== undefined &&
item?.weightInfo?.killHousePrice !== null
? item?.weightInfo?.killHousePrice?.toLocaleString() + " ﷼"
: "-",
`${item.poultryRequest?.poultry?.unitName} (${item.poultryRequest.poultry?.user?.mobile})`, `${item.poultryRequest?.poultry?.unitName} (${item.poultryRequest.poultry?.user?.mobile})`,
item?.vetFarm?.vet?.user?.fullname item?.vetFarm?.vet?.user?.fullname
? item?.vetFarm?.vet?.user?.fullname + ? item?.vetFarm?.vet?.user?.fullname +
@@ -668,6 +682,9 @@ export const SlaughterBars = () => {
? format(new Date(item?.poultryRequest.sendDate), "yyyy/MM/dd") ? format(new Date(item?.poultryRequest.sendDate), "yyyy/MM/dd")
: "-", : "-",
item?.poultryRequest.orderCode, item?.poultryRequest.orderCode,
item.acceptedRealQuantity?.toLocaleString(),
item?.acceptedRealWeight?.toLocaleString(),
item?.weightInfo?.finalIndexWeight?.toLocaleString(),
getItemState(item), getItemState(item),
<Grid key={item.barCode}> <Grid key={item.barCode}>
<Tooltip title="لغو بار"> <Tooltip title="لغو بار">
@@ -683,7 +700,7 @@ export const SlaughterBars = () => {
updateTable={updateTable} updateTable={updateTable}
killHouseRequestKey={item.key} killHouseRequestKey={item.key}
/> />
), )
}) })
); );
}} }}
@@ -691,7 +708,7 @@ export const SlaughterBars = () => {
<CancelIcon /> <CancelIcon />
</IconButton> </IconButton>
</Tooltip> </Tooltip>
</Grid>, </Grid>
]; ];
}); });
@@ -738,7 +755,7 @@ export const SlaughterBars = () => {
"تعداد بار های دارای کد قرنطینه", "تعداد بار های دارای کد قرنطینه",
"تعداد نهایی بار", "تعداد نهایی بار",
"وزن نهایی بار", "وزن نهایی بار",
"میانگین وزن نهایی ", "میانگین وزن نهایی "
]} ]}
data={[ data={[
[ [
@@ -749,8 +766,8 @@ export const SlaughterBars = () => {
dashboardData?.clearanceCodeCount?.toLocaleString(), dashboardData?.clearanceCodeCount?.toLocaleString(),
dashboardData?.acceptedRealQuantity?.toLocaleString(), dashboardData?.acceptedRealQuantity?.toLocaleString(),
dashboardData?.acceptedRealWeight?.toLocaleString(), dashboardData?.acceptedRealWeight?.toLocaleString(),
dashboardData?.finalIndexWeight?.toLocaleString(), dashboardData?.finalIndexWeight?.toLocaleString()
], ]
]} ]}
title={"خلاصه اطلاعات"} title={"خلاصه اطلاعات"}
/> />