#
vincentlu
9 天以前 e7a3bd564e86027df0accd73e6adcd99c95bdb18
#
3个文件已修改
177 ■■■■■ 已修改文件
zy-acs-flow/src/i18n/en.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/i18n/zh.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/page/sta/StaPanel.jsx 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/i18n/en.js
@@ -596,6 +596,21 @@
            levOffset: 'lev offset',
            bottomOffset: 'bottom offset',
        },
        sta: {
            enums: {
                type: {
                    in: 'UNLOAD',
                    out: 'LOAD',
                },
                state: {
                    reserved: 'RESERVED',
                    waiting: 'WAITING',
                    confirmed: 'CONFIRMED',
                    canceled: 'CANCELLED',
                    timeout: 'TIMEOUT',
                },
            },
        },
        funcSta: {
            enums: {
                type: {
zy-acs-flow/src/i18n/zh.js
@@ -596,6 +596,21 @@
            levOffset: '每层高度',
            bottomOffset: '底部偏移量',
        },
        sta: {
            enums: {
                type: {
                    in: '放货',
                    out: '取货',
                },
                state: {
                    reserved: '已预约',
                    waiting: '等待执行',
                    confirmed: '已确认',
                    canceled: '已取消',
                    timeout: '超时',
                },
            },
        },
        funcSta: {
            enums: {
                type: {
zy-acs-flow/src/page/sta/StaPanel.jsx
@@ -20,7 +20,6 @@
    useDataProvider,
} from 'react-admin';
import { format } from 'date-fns';
import PanelTypography from "../components/PanelTypography";
import * as Common from '@/utils/common'
const STATUS_FIELDS = [
@@ -30,6 +29,18 @@
    { key: 'outEnable', labelKey: 'table.field.sta.outEnable' },
];
const INFO_FIELDS = [
    { labelKey: 'table.field.sta.uuid', valueKey: 'uuid' },
    { labelKey: 'table.field.sta.zoneId', valueKey: 'zoneId$' },
    { labelKey: 'table.field.sta.staType', valueKey: 'staType$' },
    { labelKey: 'table.field.sta.code', valueKey: 'code$' },
    { labelKey: 'table.field.sta.capacity', valueKey: 'capacity' },
    { labelKey: 'table.field.sta.offset', valueKey: 'offset' },
    { labelKey: 'table.field.sta.rsvInCnt', valueKey: 'rsvInCnt' },
    { labelKey: 'table.field.sta.rsvOutCnt', valueKey: 'rsvOutCnt' },
    { labelKey: 'table.field.sta.staSts', valueKey: 'staSts$' },
    { labelKey: 'table.field.sta.zpallet', valueKey: 'zpallet' },
];
const StaPanel = () => {
    const record = useRecordContext();
    const translate = useTranslate();
@@ -99,66 +110,14 @@
                    </Grid>
                    <Box height={16}>&nbsp;</Box>
                    <Grid container spacing={2}>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.sta.uuid"
                                property={record.uuid}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.sta.zoneId"
                                property={record.zoneId$}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.sta.staType"
                                property={record.staType$}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.sta.code"
                                property={record.code$}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.sta.capacity"
                                property={record.capacity}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.sta.offset"
                                property={record.offset}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.sta.rsvInCnt"
                                property={record.rsvInCnt}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.sta.rsvOutCnt"
                                property={record.rsvOutCnt}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.sta.staSts"
                                property={record.staSts$}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.sta.zpallet"
                                property={record.zpallet}
                            />
                        </Grid>
                        {INFO_FIELDS.map(({ labelKey, valueKey }) => (
                            <Grid item xs={12} sm={6} md={4} key={labelKey}>
                                <InfoItem
                                    labelKey={labelKey}
                                    value={getRecordValue(record, valueKey)}
                                />
                            </Grid>
                        ))}
                    </Grid>
                    <Divider sx={{ my: 2 }} />
@@ -209,7 +168,7 @@
                                    <TableRow>
                                        <TableCell colSpan={7}>
                                            <Typography variant="body2" color="textSecondary">
                                                No reservations
                                                {translate('ra.navigation.no_results')}
                                            </Typography>
                                        </TableCell>
                                    </TableRow>
@@ -217,9 +176,9 @@
                                {reserves.map((reserve) => (
                                    <TableRow key={reserve.id}>
                                        <TableCell>{reserve.name || '-'}</TableCell>
                                        <TableCell>{reserve.type || '-'}</TableCell>
                                        <TableCell>{formatReserveType(reserve.type, translate)}</TableCell>
                                        <TableCellRight>{reserve.qty ?? '-'}</TableCellRight>
                                        <TableCell>{reserve.state || '-'}</TableCell>
                                        <TableCell>{formatReserveState(reserve.state, translate)}</TableCell>
                                        <TableCell>{reserve.agvId$ || reserve.agvId || '-'}</TableCell>
                                        <TableCell>{formatDateTime(reserve.waitingAt)}</TableCell>
                                        <TableCell>{formatDateTime(reserve.confirmedAt)}</TableCell>
@@ -232,6 +191,39 @@
            </Card >
        </>
    );
};
const InfoItem = ({ labelKey, value }) => {
    const translate = useTranslate();
    return (
        <Stack spacing={0.5}>
            <Typography variant="caption" color="textSecondary">
                {Common.camelToPascalWithSpaces(translate(labelKey))}
            </Typography>
            <Typography variant="body2" fontWeight={600}>
                {formatInfoValue(value)}
            </Typography>
        </Stack>
    );
};
const getRecordValue = (record, key) => {
    if (!record) return undefined;
    if (record[key] !== undefined && record[key] !== null) {
        return record[key];
    }
    if (key.endsWith('$')) {
        const fallbackKey = key.slice(0, -1);
        return record[fallbackKey];
    }
    return record[key];
};
const formatInfoValue = (value) => {
    if (value === null || value === undefined || value === '') {
        return '-';
    }
    return value;
};
const StatusIndicator = ({ labelKey, value }) => {
@@ -296,6 +288,33 @@
    return String(value);
};
const formatReserveType = (value, translate) =>
    formatReserveEnum(value, translate, 'type');
const formatReserveState = (value, translate) =>
    formatReserveEnum(value, translate, 'state', {
        cancelled: 'canceled',
    });
const formatReserveEnum = (value, translate, enumType, overrides = {}) => {
    const normalized = normalizeValueKey(value);
    if (!normalized) {
        return '-';
    }
    const translationKey = overrides[normalized] || normalized;
    return translate(`page.sta.enums.${enumType}.${translationKey}`, { _: value });
};
const normalizeValueKey = (value) => {
    if (typeof value === 'string') {
        return value.trim().toLowerCase();
    }
    if (value === undefined || value === null) {
        return '';
    }
    return String(value).trim().toLowerCase();
};
const formatDateTime = (value) => {
    if (!value) return '-';
    try {