| | |
| | | inStockQty: '', |
| | | outStockQty: '', |
| | | taskWorkQty: '', |
| | | planQty: 'Plan', |
| | | realQty: 'Real Qty', |
| | | waitQty: 'Wait Qty', |
| | | waitOutQty: 'Wait Out Qty', |
| | | stockUsage: 'Stock Usage', |
| | | }, |
| | | chart: { |
| | | histories: 'Orders Echart', |
| | |
| | | realQty: '实际', |
| | | waitQty: '待入', |
| | | waitOutQty: '待出', |
| | | |
| | | stockUsage: '库存使用率', |
| | | }, |
| | | chart: { |
| | | histories: '出入库趋势图', |
| | |
| | | <Card |
| | | sx={{ |
| | | width: '100%', |
| | | maxHeight: 1025, |
| | | minHeight: 52, |
| | | flexDirection: 'column', |
| | | flex: '1', |
| | |
| | | const NbList = ({ deadStock }) => { |
| | | const translate = useTranslate(); |
| | | return ( |
| | | <Card sx={{ flex: 1 }}> |
| | | <Card sx={{ |
| | | flex: 1, |
| | | }}> |
| | | <CardHeader title={translate('page.dashboard.list.stock')} /> |
| | | <Box sx={{ maxHeight: 500, overflowY: 'auto',}}> |
| | | <List dense={true}> |
| | | {deadStock.map(record => ( |
| | | <PendingOrder key={`record?.id + ${Math.random().toString(36).substr(2, 9)} `} order={record} /> |
| | | ))} |
| | | </List> |
| | | </Box> |
| | | </Card> |
| | | ); |
| | | }; |
| | | |
| | | export const PendingOrder = (props) => { |
| | | const { order } = props; |
| | | console.log(order); |
| | | const translate = useTranslate(); |
| | | // const { referenceRecord: customer, isPending } = useReference({ |
| | | // reference: 'customers', |
| | |
| | | |
| | | import * as React from 'react'; |
| | | import { Pie, PieChart, ResponsiveContainer, Tooltip } from 'recharts'; |
| | | import { Card } from "@mui/material"; |
| | | import { Card, CardHeader } from "@mui/material"; |
| | | import { useTranslate } from "react-admin"; |
| | | |
| | | |
| | | const NbPie = ({ deadStock }) => { |
| | | const NbPie = ({ deadStock, locUsage }) => { |
| | | const translate = useTranslate(); |
| | | |
| | | const data01 = [ |
| | | { name: 'Group A', value: 400 }, |
| | | { name: 'Group B', value: 300 }, |
| | | { name: 'Group C', value: 300 }, |
| | | { name: 'Group D', value: 200 }, |
| | | { name: 'Group E', value: 278 }, |
| | | { name: 'Group F', value: 189 }, |
| | | ]; |
| | | |
| | | const data02 = [ |
| | | { name: 'Group A', value: 2400 }, |
| | | { name: 'Group B', value: 4567 }, |
| | | { name: 'Group C', value: 1398 }, |
| | | { name: 'Group D', value: 9800 }, |
| | | { name: 'Group E', value: 3908 }, |
| | | { name: 'Group F', value: 4800 }, |
| | | ]; |
| | | console.log(locUsage); |
| | | |
| | | return ( |
| | | <> |
| | | <Card> |
| | | <Card sx={{ |
| | | width: '100%', |
| | | maxHeight: 570, |
| | | flexDirection: 'column', |
| | | flex: '1', |
| | | '& a': { |
| | | textDecoration: 'none', |
| | | color: 'inherit', |
| | | }, |
| | | }}> |
| | | <CardHeader title={translate('page.dashboard.header.stockUsage')} /> |
| | | <ResponsiveContainer width="100%" height="100%"> |
| | | <PieChart width={400} height={400}> |
| | | <Pie |
| | | dataKey="value" |
| | | isAnimationActive={false} |
| | | data={data01} |
| | | data={locUsage} |
| | | cx="50%" |
| | | cy="50%" |
| | | cy="40%" |
| | | outerRadius={80} |
| | | fill="#8884d8" |
| | | label |
| | | /> |
| | | <Pie dataKey="value" data={data02} cx={500} cy={200} innerRadius={40} outerRadius={80} fill="#82ca9d" /> |
| | | <Tooltip /> |
| | | </PieChart> |
| | | </ResponsiveContainer> |
| | |
| | | import NbChart from "./NbChart"; |
| | | import NbList from "./NbList"; |
| | | import NbCard from "./NbCard"; |
| | | import { orderBy } from 'lodash'; |
| | | import NbPie from './NbPie'; |
| | | |
| | | const styles = { |
| | |
| | | const [statistic, setStatistic] = useState({}); |
| | | const [stock, setStock] = useState([]); |
| | | const [deadStock, setDeadStock] = useState([]); |
| | | const [locUsage, setLocUsages] = useState([]); |
| | | |
| | | useEffect(() => { |
| | | getDashBoardHeader() |
| | | getRecentTrands() |
| | | getRecentStocks() |
| | | getRecentUsage() |
| | | |
| | | }, []) |
| | | |
| | |
| | | const { code, msg, data } = res?.data; |
| | | if (code === 200) { |
| | | setDeadStock(data?.records); |
| | | } else { |
| | | notify(msg, { type: 'error', messageArgs: { _: msg } }); |
| | | } |
| | | }).catch((error) => { |
| | | notify(error.message, { type: 'error', messageArgs: { _: error.message } }); |
| | | }) |
| | | } |
| | | |
| | | const getRecentUsage = () => { |
| | | request.post("/loc/pie/list").then(res => { |
| | | const { code, msg, data } = res?.data; |
| | | console.log(data); |
| | | console.log(code); |
| | | if (code === 200) { |
| | | setLocUsages(data?.data) |
| | | } else { |
| | | notify(msg, { type: 'error', messageArgs: { _: msg } }); |
| | | } |
| | |
| | | <NbChart orders={stock} /> |
| | | </Box> |
| | | <Spacer /> |
| | | <Box sx={{ display: 'flex' }}> |
| | | <Box sx={{ display: 'flex', justifyContent: 'space-between' }}> |
| | | <NbList deadStock={deadStock} /> |
| | | <NbPie /> |
| | | <NbPie locUsage={locUsage} /> |
| | | </Box> |
| | | <Spacer /> |
| | | |
| | | </Grid> |
| | | <Grid item md={4}> |
| | | <Box sx={{ display: 'flex' }}> |