#
Junjie
2024-06-12 8d8a9f82e1fb979b44425d23c8b53f89a96f5266
#
8个文件已添加
1587 ■■■■■ 已修改文件
zy-asrs-flow/src/pages/task/motionLog/components/edit.jsx 305 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/task/motionLog/index.jsx 695 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/MotionLogController.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/MotionLog.java 449 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/MotionLogMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/MotionLogService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionLogServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/resources/mapper/core/MotionLogMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/task/motionLog/components/edit.jsx
New file
@@ -0,0 +1,305 @@
import React, { useState, useRef, useEffect } from 'react';
import {
    ProForm,
    ProFormDigit,
    ProFormText,
    ProFormSelect,
    ProFormDateTimePicker
} from '@ant-design/pro-components';
import { Form, Modal } from 'antd';
import { FormattedMessage, useIntl } from '@umijs/max';
import moment from 'moment';
import Http from '@/utils/http';
const Edit = (props) => {
    const intl = useIntl();
    const [form] = Form.useForm();
    const { } = props;
    useEffect(() => {
        form.resetFields();
        form.setFieldsValue({
            ...props.values
        })
    }, [form, props])
    const handleCancel = () => {
        props.onCancel();
    };
    const handleOk = () => {
        form.submit();
    }
    const handleFinish = async (values) => {
        props.onSubmit({ ...values });
    }
    return (
        <>
            <Modal
                title={
                    Object.keys(props.values).length > 0
                        ? intl.formatMessage({ id: 'page.edit', defaultMessage: '编辑' })
                        : intl.formatMessage({ id: 'page.add', defaultMessage: '添加' })
                }
                width={640}
                forceRender
                destroyOnClose
                open={props.open}
                onCancel={handleCancel}
                onOk={handleOk}
            >
                <ProForm
                    form={form}
                    submitter={false}
                    onFinish={handleFinish}
                    layout="horizontal"
                    grid={true}
                >
                    <ProFormDigit
                        name="id"
                        disabled
                        hidden={true}
                    />
                    <ProForm.Group>
                        <ProFormText
                            name="uuid"
                            label="编号"
                            colProps={{ md: 12, xl: 12 }}
                        />
                        <ProFormDigit
                            name="taskNo"
                            label="任务号"
                            colProps={{ md: 12, xl: 12 }}
                            fieldProps={{ precision: 0 }}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormText
                            name="serialNo"
                            label="序列号"
                            colProps={{ md: 12, xl: 12 }}
                        />
                        <ProFormText
                            name="title"
                            label="描述"
                            colProps={{ md: 12, xl: 12 }}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormDigit
                            name="priority"
                            label="优先级"
                            colProps={{ md: 12, xl: 12 }}
                            fieldProps={{ precision: 0 }}
                        />
                        <ProFormSelect
                            name="sync"
                            label="同步"
                            colProps={{ md: 12, xl: 12 }}
                            rules={[{ required: true }]}
                            options={[
                                { label: '是', value: 1 },
                                { label: '否', value: 0 },
                            ]}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormSelect
                            name="motionCtg"
                            label="任务类型"
                            colProps={{ md: 12, xl: 12 }}
                            fieldProps={{ precision: 0 }}
                            rules={[{ required: true }]}
                            showSearch
                            debounceTime={300}
                            request={async ({ keyWords }) => {
                                const resp = await Http.doPostForm('api/motionCtg/query', { condition: keyWords });
                                return resp.data;
                            }}
                        />
                        <ProFormSelect
                            name="motionSts"
                            label="任务状态"
                            colProps={{ md: 12, xl: 12 }}
                            fieldProps={{ precision: 0 }}
                            rules={[{ required: true }]}
                            showSearch
                            debounceTime={300}
                            request={async ({ keyWords }) => {
                                const resp = await Http.doPostForm('api/motionSts/query', { condition: keyWords });
                                return resp.data;
                            }}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormSelect
                            name="deviceCtg"
                            label="设备类型"
                            colProps={{ md: 12, xl: 12 }}
                            fieldProps={{ precision: 0 }}
                            showSearch
                            debounceTime={300}
                            request={async ({ keyWords }) => {
                                const resp = await Http.doPostForm('api/deviceType/query', { condition: keyWords });
                                return resp.data;
                            }}
                        />
                        <ProFormText
                            name="device"
                            label="设备"
                            colProps={{ md: 12, xl: 12 }}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormText
                            name="origin"
                            label="来源"
                            colProps={{ md: 12, xl: 12 }}
                        />
                        <ProFormDigit
                            name="oriDrt"
                            label="来源方向"
                            colProps={{ md: 12, xl: 12 }}
                            fieldProps={{ precision: 0 }}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormText
                            name="target"
                            label="目标"
                            colProps={{ md: 12, xl: 12 }}
                        />
                        <ProFormDigit
                            name="tarDrt"
                            label="目标方向"
                            colProps={{ md: 12, xl: 12 }}
                            fieldProps={{ precision: 0 }}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormText
                            name="dockNo"
                            label="对接设备"
                            colProps={{ md: 12, xl: 12 }}
                        />
                        <ProFormDateTimePicker
                            name="ioTime"
                            label="工作时间"
                            colProps={{ md: 12, xl: 12 }}
                            transform={(value) => moment(value).toISOString()}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormDateTimePicker
                            name="startTime"
                            label="开始时间"
                            colProps={{ md: 12, xl: 12 }}
                            transform={(value) => moment(value).toISOString()}
                        />
                        <ProFormDateTimePicker
                            name="endTime"
                            label="结束时间"
                            colProps={{ md: 12, xl: 12 }}
                            transform={(value) => moment(value).toISOString()}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormDateTimePicker
                            name="errTime"
                            label="异常时间"
                            colProps={{ md: 12, xl: 12 }}
                            transform={(value) => moment(value).toISOString()}
                        />
                        <ProFormDigit
                            name="errCode"
                            label="异常代码"
                            colProps={{ md: 12, xl: 12 }}
                            fieldProps={{ precision: 0 }}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormText
                            name="errDesc"
                            label="异常描述"
                            colProps={{ md: 12, xl: 12 }}
                        />
                        <ProFormText
                            name="temp"
                            label="预留"
                            colProps={{ md: 12, xl: 12 }}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormSelect
                            name="status"
                            label="状态"
                            colProps={{ md: 12, xl: 12 }}
                            options={[
                                { label: '正常', value: 1 },
                                { label: '禁用', value: 0 },
                            ]}
                        />
                        <ProFormSelect
                            name="createBy"
                            label="添加人员"
                            colProps={{ md: 12, xl: 12 }}
                            fieldProps={{ precision: 0 }}
                            showSearch
                            debounceTime={300}
                            request={async ({ keyWords }) => {
                                const resp = await Http.doPostForm('api/user/query', { condition: keyWords });
                                return resp.data;
                            }}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormDateTimePicker
                            name="createTime"
                            label="添加时间"
                            colProps={{ md: 12, xl: 12 }}
                            transform={(value) => moment(value).toISOString()}
                        />
                        <ProFormSelect
                            name="updateBy"
                            label="修改人员"
                            colProps={{ md: 12, xl: 12 }}
                            fieldProps={{ precision: 0 }}
                            showSearch
                            debounceTime={300}
                            request={async ({ keyWords }) => {
                                const resp = await Http.doPostForm('api/user/query', { condition: keyWords });
                                return resp.data;
                            }}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormDateTimePicker
                            name="updateTime"
                            label="修改时间"
                            colProps={{ md: 12, xl: 12 }}
                            transform={(value) => moment(value).toISOString()}
                        />
                        <ProFormText
                            name="memo"
                            label="备注"
                            colProps={{ md: 12, xl: 12 }}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormDigit
                            name="deviceTaskNo"
                            label="设备工作号"
                            colProps={{ md: 12, xl: 12 }}
                            fieldProps={{ precision: 0 }}
                        />
                    </ProForm.Group>
                </ProForm>
            </Modal>
        </>
    )
}
export default Edit;
zy-asrs-flow/src/pages/task/motionLog/index.jsx
New file
@@ -0,0 +1,695 @@
import React, { useState, useRef, useEffect } from 'react';
import { Button, message, Modal, Tag  } from 'antd';
import {
    FooterToolbar,
    PageContainer,
    ProTable,
    LightFilter,
} from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max';
import { PlusOutlined, ExportOutlined } from '@ant-design/icons';
import Http from '@/utils/http';
import Edit from './components/edit'
import { TextFilter, SelectFilter, DatetimeRangeFilter, LinkFilter } from '@/components/TableSearch'
import { statusMap } from '@/utils/enum-util'
import { repairBug } from '@/utils/common-util';
const TABLE_KEY = 'pro-table-motionLog';
const handleSave = async (val, intl) => {
    const hide = message.loading(intl.formatMessage({ id: 'page.adding', defaultMessage: '正在添加' }));
    try {
        const resp = await Http.doPost('api/motionLog/save', val);
        if (resp.code === 200) {
            message.success(intl.formatMessage({ id: 'page.add.success', defaultMessage: '添加成功' }));
            return true;
        } else {
            message.error(resp.msg);
            return false;
        }
    } catch (error) {
        message.error(intl.formatMessage({ id: 'page.add.fail', defaultMessage: '添加失败请重试!' }));
        return false;
    } finally {
        hide();
    }
};
const handleUpdate = async (val, intl) => {
    const hide = message.loading(intl.formatMessage({ id: 'page.updating', defaultMessage: '正在更新' }));
    try {
        const resp = await Http.doPost('api/motionLog/update', val);
        if (resp.code === 200) {
            message.success(intl.formatMessage({ id: 'page.update.success', defaultMessage: '更新成功' }));
            return true;
        } else {
            message.error(resp.msg);
            return false;
        }
    } catch (error) {
        message.error(intl.formatMessage({ id: 'page.update.fail', defaultMessage: '更新失败请重试!' }));
        return false;
    } finally {
        hide();
    }
};
const handleRemove = async (rows, intl) => {
    if (!rows) return true;
    const hide = message.loading(intl.formatMessage({ id: 'page.deleting', defaultMessage: '正在删除' }));
    try {
        const resp = await Http.doPost('api/motionLog/remove/' + rows.map((row) => row.id).join(','));
        if (resp.code === 200) {
            message.success(intl.formatMessage({ id: 'page.delete.success', defaultMessage: '删除成功' }));
            return true;
        } else {
            message.error(resp.msg);
            return false;
        }
    } catch (error) {
        message.error(intl.formatMessage({ id: 'page.delete.fail', defaultMessage: '删除失败,请重试!' }));
        return false;
    } finally {
        hide();
    }
};
const handleExport = async (intl) => {
    const hide = message.loading(intl.formatMessage({ id: 'page.exporting', defaultMessage: '正在导出' }));
    try {
        const resp = await Http.doPostBlob('api/motionLog/export');
        const blob = new Blob([resp], { type: 'application/vnd.ms-excel' });
        window.location.href = window.URL.createObjectURL(blob);
        message.success(intl.formatMessage({ id: 'page.export.success', defaultMessage: '导出成功' }));
        return true;
    } catch (error) {
        message.error(intl.formatMessage({ id: 'page.export.fail', defaultMessage: '导出失败,请重试' }));
        return false;
    } finally {
        hide();
    }
};
const Main = () => {
    const intl = useIntl();
    const formTableRef = useRef();
    const actionRef = useRef();
    const [selectedRows, setSelectedRows] = useState([]);
    const [modalVisible, setModalVisible] = useState(false);
    const [currentRow, setCurrentRow] = useState();
    const [searchParam, setSearchParam] = useState({});
    useEffect(() => {
    }, []);
    const columns = [
        {
            title: intl.formatMessage({
                id: 'page.table.no',
                defaultMessage: 'No'
            }),
            dataIndex: 'index',
            valueType: 'indexBorder',
            width: 48,
        },
        {
            title: '编号',
            dataIndex: 'uuid',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='uuid'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '任务号',
            dataIndex: 'taskNo',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='taskNo'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '序列号',
            dataIndex: 'serialNo',
            valueType: 'text',
            hidden: false,
            width: 140,
            copyable: true,
            filterDropdown: (props) => <TextFilter
                name='serialNo'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '描述',
            dataIndex: 'title',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='title'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '优先级',
            dataIndex: 'priority',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='priority'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '同步',
            dataIndex: 'sync$',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <SelectFilter
                name='sync'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
                data={[
                    { label: '是', value: 1 },
                    { label: '否', value: 0 },
                ]}
            />,
        },
        {
            title: '任务类型',
            dataIndex: 'motionCtg$',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <LinkFilter
                name='motionCtg'
                major='motionCtg'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '任务状态',
            dataIndex: 'motionSts$',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <LinkFilter
                name='motionSts'
                major='motionSts'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '设备类型',
            dataIndex: 'deviceCtg$',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <LinkFilter
                name='deviceCtg'
                major='deviceType'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '设备',
            dataIndex: 'device',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='device'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '来源',
            dataIndex: 'origin',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='origin'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '来源方向',
            dataIndex: 'oriDrt',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='oriDrt'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '目标',
            dataIndex: 'target',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='target'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '目标方向',
            dataIndex: 'tarDrt',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='tarDrt'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '对接设备',
            dataIndex: 'dockNo',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='dockNo'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '工作时间',
            dataIndex: 'ioTime$',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <DatetimeRangeFilter
                name='ioTime'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '开始时间',
            dataIndex: 'startTime$',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <DatetimeRangeFilter
                name='startTime'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '结束时间',
            dataIndex: 'endTime$',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <DatetimeRangeFilter
                name='endTime'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '异常时间',
            dataIndex: 'errTime$',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <DatetimeRangeFilter
                name='errTime'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '异常代码',
            dataIndex: 'errCode',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='errCode'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '异常描述',
            dataIndex: 'errDesc',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='errDesc'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '预留',
            dataIndex: 'temp',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='temp'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '状态',
            dataIndex: 'status$',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <SelectFilter
                name='status'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
                data={[
                    { label: '正常', value: 1 },
                    { label: '禁用', value: 0 },
                ]}
            />,
        },
        {
            title: '添加人员',
            dataIndex: 'createBy$',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <LinkFilter
                name='createBy'
                major='user'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '添加时间',
            dataIndex: 'createTime$',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <DatetimeRangeFilter
                name='createTime'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '修改人员',
            dataIndex: 'updateBy$',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <LinkFilter
                name='updateBy'
                major='user'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '修改时间',
            dataIndex: 'updateTime$',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <DatetimeRangeFilter
                name='updateTime'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '备注',
            dataIndex: 'memo',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='memo'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '设备工作号',
            dataIndex: 'deviceTaskNo',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='deviceTaskNo'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '操作',
            dataIndex: 'option',
            width: 140,
            valueType: 'option',
            render: (_, record) => [
                <Button
                    type="link"
                    key="edit"
                    onClick={() => {
                        setModalVisible(true);
                        setCurrentRow(record);
                    }}
                >
                    <FormattedMessage id='page.edit' defaultMessage='编辑' />
                </Button>,
                <Button
                    type="link"
                    danger
                    key="batchRemove"
                    onClick={async () => {
                        Modal.confirm({
                            title: intl.formatMessage({ id: 'page.delete', defaultMessage: '删除' }),
                            content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '确定删除该项吗?' }),
                            onOk: async () => {
                                const success = await handleRemove([record], intl);
                                if (success) {
                                    if (actionRef.current) {
                                        actionRef.current.reload();
                                    }
                                }
                            },
                        });
                    }}
                >
                    <FormattedMessage id='page.delete' defaultMessage='删除' />
                </Button>,
            ],
        },
    ];
    return (
        <PageContainer
            header={{
                breadcrumb: {},
            }}
        >
            <div style={{ width: '100%', float: 'right' }}>
                <ProTable
                    key="motionLog"
                    rowKey="id"
                    actionRef={actionRef}
                    formRef={formTableRef}
                    columns={columns}
                    cardBordered
                    scroll={{ x: 1300 }}
                    dateFormatter="string"
                    pagination={{ pageSize: 16 }}
                    search={false}
                    toolbar={{
                        search: {
                            onSearch: (value) => {
                                setSearchParam(prevState => ({
                                    ...prevState,
                                    condition: value
                                }));
                                actionRef.current?.reload();
                            },
                        },
                        filter: (
                            <LightFilter
                                onValuesChange={(val) => {
                                }}
                            >
                            </LightFilter>
                        ),
                        actions: [
                            <Button
                                type="primary"
                                key="save"
                                onClick={async () => {
                                    setModalVisible(true)
                                }}
                            >
                                <PlusOutlined />
                                <FormattedMessage id='page.add' defaultMessage='添加' />
                            </Button>,
                            <Button
                                key="export"
                                onClick={async () => {
                                    handleExport(intl);
                                }}
                            >
                                <ExportOutlined />
                                <FormattedMessage id='page.export' defaultMessage='导出' />
                            </Button>,
                        ],
                    }}
                    request={(params, sorter, filter) =>
                        Http.doPostPromise('/api/motionLog/page', { ...params, ...searchParam }, (res) => {
                            return {
                                data: res.data.records,
                                total: res.data.total,
                                success: true,
                            }
                        })
                    }
                    rowSelection={{
                        onChange: (ids, rows) => {
                            setSelectedRows(rows);
                        }
                    }}
                    columnsState={{
                        persistenceKey: TABLE_KEY,
                        persistenceType: 'localStorage',
                        defaultValue: {
                            // memo: { show: repairBug(TABLE_KEY, 'memo', false) },
                            option: { fixed: 'right', disable: true },
                        },
                        onChange(value) {
                        },
                    }}
                />
            </div>
            {selectedRows?.length > 0 && (
                <FooterToolbar
                    extra={
                        <div>
                            <a style={{ fontWeight: 600 }}>{selectedRows.length}</a>
                            <FormattedMessage id='page.selected' defaultMessage=' 项已选择' />
                        </div>
                    }
                >
                    <Button
                        key="remove"
                        danger
                        onClick={async () => {
                            Modal.confirm({
                                title: intl.formatMessage({ id: 'page.delete', defaultMessage: '删除' }),
                                content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '确定删除该项吗?' }),
                                onOk: async () => {
                                    const success = await handleRemove(selectedRows, intl);
                                    if (success) {
                                        setSelectedRows([]);
                                        actionRef.current?.reloadAndRest?.();
                                    }
                                },
                            });
                        }}
                    >
                        <FormattedMessage id='page.delete.batch' defaultMessage='批量删除' />
                    </Button>
                </FooterToolbar>
            )}
            <Edit
                open={modalVisible}
                values={currentRow || {}}
                onCancel={
                    () => {
                        setModalVisible(false);
                        setCurrentRow(undefined);
                    }
                }
                onSubmit={async (values) => {
                    let ok = false;
                    if (values.id) {
                        ok = await handleUpdate({ ...values }, intl)
                    } else {
                        ok = await handleSave({ ...values }, intl)
                    }
                    if (ok) {
                        setModalVisible(false);
                        setCurrentRow(undefined);
                        if (actionRef.current) {
                            actionRef.current.reload();
                        }
                    }
                }}
            />
        </PageContainer>
    );
};
export default Main;
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/MotionLogController.java
New file
@@ -0,0 +1,101 @@
package com.zy.asrs.wcs.system.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.common.R;
import com.zy.asrs.wcs.common.annotation.OperationLog;
import com.zy.asrs.wcs.common.domain.BaseParam;
import com.zy.asrs.wcs.common.domain.KeyValVo;
import com.zy.asrs.wcs.common.domain.PageParam;
import com.zy.asrs.wcs.core.entity.MotionLog;
import com.zy.asrs.wcs.core.service.MotionLogService;
import com.zy.asrs.wcs.utils.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/api")
public class MotionLogController extends BaseController {
    @Autowired
    private MotionLogService motionLogService;
    @PreAuthorize("hasAuthority('core:motionLog:list')")
    @PostMapping("/motionLog/page")
    public R page(@RequestBody Map<String, Object> map) {
        BaseParam baseParam = buildParam(map, BaseParam.class);
        PageParam<MotionLog, BaseParam> pageParam = new PageParam<>(baseParam, MotionLog.class);
        return R.ok().add(motionLogService.page(pageParam, pageParam.buildWrapper(true)));
    }
    @PreAuthorize("hasAuthority('core:motionLog:list')")
    @PostMapping("/motionLog/list")
    public R list(@RequestBody Map<String, Object> map) {
        return R.ok().add(motionLogService.list());
    }
    @PreAuthorize("hasAuthority('core:motionLog:list')")
    @GetMapping("/motionLog/{id}")
    public R get(@PathVariable("id") Long id) {
        return R.ok().add(motionLogService.getById(id));
    }
    @PreAuthorize("hasAuthority('core:motionLog:save')")
    @OperationLog("添加动作历史列表")
    @PostMapping("/motionLog/save")
    public R save(@RequestBody MotionLog motionLog) {
        if (!motionLogService.save(motionLog)) {
            return R.error("添加失败");
        }
        return R.ok("添加成功");
    }
    @PreAuthorize("hasAuthority('core:motionLog:update')")
    @OperationLog("修改动作历史列表")
    @PostMapping("/motionLog/update")
    public R update(@RequestBody MotionLog motionLog) {
        if (!motionLogService.updateById(motionLog)) {
            return R.error("修改失败");
        }
        return R.ok("修改成功");
    }
    @PreAuthorize("hasAuthority('core:motionLog:remove')")
    @OperationLog("删除动作历史列表")
    @PostMapping("/motionLog/remove/{ids}")
    public R remove(@PathVariable Long[] ids) {
        if (!motionLogService.removeByIds(Arrays.asList(ids))) {
            return R.error("删除失败");
        }
        return R.ok("删除成功");
    }
    @PreAuthorize("hasAuthority('core:motionLog:list')")
    @PostMapping("/motionLog/query")
    public R query(@RequestParam(required = false) String condition) {
        List<KeyValVo> vos = new ArrayList<>();
        LambdaQueryWrapper<MotionLog> wrapper = new LambdaQueryWrapper<>();
        if (!Cools.isEmpty(condition)) {
            wrapper.like(MotionLog::getSerialNo, condition);
        }
        motionLogService.page(new Page<>(1, 30), wrapper).getRecords().forEach(
                item -> vos.add(new KeyValVo(item.getId(), item.getSerialNo()))
        );
        return R.ok().add(vos);
    }
    @PreAuthorize("hasAuthority('core:motionLog:list')")
    @PostMapping("/motionLog/export")
    public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
        ExcelUtil.build(ExcelUtil.create(motionLogService.list(), MotionLog.class), response);
    }
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/MotionLog.java
New file
@@ -0,0 +1,449 @@
package com.zy.asrs.wcs.core.entity;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.zy.asrs.wcs.core.service.MotionCtgService;
import com.zy.asrs.wcs.core.service.MotionStsService;
import com.zy.asrs.wcs.rcs.entity.DeviceType;
import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
import com.zy.asrs.wcs.system.entity.Host;
import com.zy.asrs.wcs.system.entity.User;
import org.springframework.format.annotation.DateTimeFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.common.SpringUtils;
import com.zy.asrs.wcs.system.service.UserService;
import com.zy.asrs.wcs.system.service.HostService;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("rcs_motion_log")
public class MotionLog implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @ApiModelProperty(value= "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 编号
     */
    @ApiModelProperty(value= "编号")
    private String uuid;
    /**
     * 任务号
     */
    @ApiModelProperty(value= "任务号")
    private Integer taskNo;
    /**
     * 序列号
     */
    @ApiModelProperty(value= "序列号")
    private String serialNo;
    /**
     * 描述
     */
    @ApiModelProperty(value= "描述")
    private String title;
    /**
     * 优先级
     */
    @ApiModelProperty(value= "优先级")
    private Integer priority;
    /**
     * 同步 1: 是  0: 否
     */
    @ApiModelProperty(value= "同步 1: 是  0: 否  ")
    private Integer sync;
    /**
     * 任务类型
     */
    @ApiModelProperty(value= "任务类型")
    private Long motionCtg;
    /**
     * 任务状态
     */
    @ApiModelProperty(value= "任务状态")
    private Long motionSts;
    /**
     * 设备类型
     */
    @ApiModelProperty(value= "设备类型")
    private Long deviceCtg;
    /**
     * 设备
     */
    @ApiModelProperty(value= "设备")
    private String device;
    /**
     * 来源
     */
    @ApiModelProperty(value= "来源")
    private String origin;
    /**
     * 来源方向
     */
    @ApiModelProperty(value= "来源方向")
    private Integer oriDrt;
    /**
     * 目标
     */
    @ApiModelProperty(value= "目标")
    private String target;
    /**
     * 目标方向
     */
    @ApiModelProperty(value= "目标方向")
    private Integer tarDrt;
    /**
     * 对接设备
     */
    @ApiModelProperty(value= "对接设备")
    private String dockNo;
    /**
     * 工作时间
     */
    @ApiModelProperty(value= "工作时间")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date ioTime;
    /**
     * 开始时间
     */
    @ApiModelProperty(value= "开始时间")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date startTime;
    /**
     * 结束时间
     */
    @ApiModelProperty(value= "结束时间")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date endTime;
    /**
     * 异常时间
     */
    @ApiModelProperty(value= "异常时间")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date errTime;
    /**
     * 异常代码
     */
    @ApiModelProperty(value= "异常代码")
    private Long errCode;
    /**
     * 异常描述
     */
    @ApiModelProperty(value= "异常描述")
    private String errDesc;
    /**
     * 预留
     */
    @ApiModelProperty(value= "预留")
    private String temp;
    /**
     * 状态 1: 正常  0: 禁用
     */
    @ApiModelProperty(value= "状态 1: 正常  0: 禁用  ")
    private Integer status;
    /**
     * 添加人员
     */
    @ApiModelProperty(value= "添加人员")
    private Long createBy;
    /**
     * 添加时间
     */
    @ApiModelProperty(value= "添加时间")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 修改人员
     */
    @ApiModelProperty(value= "修改人员")
    private Long updateBy;
    /**
     * 修改时间
     */
    @ApiModelProperty(value= "修改时间")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    /**
     * 备注
     */
    @ApiModelProperty(value= "备注")
    private String memo;
    /**
     * 是否删除 1: 是  0: 否
     */
    @ApiModelProperty(value= "是否删除 1: 是  0: 否  ")
    @TableLogic
    private Integer deleted;
    /**
     * 所属机构
     */
    @ApiModelProperty(value= "所属机构")
    private Long hostId;
    /**
     * 设备工作号
     */
    @ApiModelProperty(value= "设备工作号")
    private Integer deviceTaskNo;
    public MotionLog() {}
    public MotionLog(String uuid,Integer taskNo,String serialNo,String title,Integer priority,Integer sync,Long motionCtg,Long motionSts,Long deviceCtg,String device,String origin,Integer oriDrt,String target,Integer tarDrt,String dockNo,Date ioTime,Date startTime,Date endTime,Date errTime,Long errCode,String errDesc,String temp,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,Integer deleted,Long hostId,Integer deviceTaskNo) {
        this.uuid = uuid;
        this.taskNo = taskNo;
        this.serialNo = serialNo;
        this.title = title;
        this.priority = priority;
        this.sync = sync;
        this.motionCtg = motionCtg;
        this.motionSts = motionSts;
        this.deviceCtg = deviceCtg;
        this.device = device;
        this.origin = origin;
        this.oriDrt = oriDrt;
        this.target = target;
        this.tarDrt = tarDrt;
        this.dockNo = dockNo;
        this.ioTime = ioTime;
        this.startTime = startTime;
        this.endTime = endTime;
        this.errTime = errTime;
        this.errCode = errCode;
        this.errDesc = errDesc;
        this.temp = temp;
        this.status = status;
        this.createBy = createBy;
        this.createTime = createTime;
        this.updateBy = updateBy;
        this.updateTime = updateTime;
        this.memo = memo;
        this.deleted = deleted;
        this.hostId = hostId;
        this.deviceTaskNo = deviceTaskNo;
    }
//    MotionLog motionLog = new MotionLog(
//            null,    // 编号
//            null,    // 任务号
//            null,    // 序列号
//            null,    // 描述
//            null,    // 优先级
//            null,    // 同步[非空]
//            null,    // 任务类型[非空]
//            null,    // 任务状态[非空]
//            null,    // 设备类型
//            null,    // 设备
//            null,    // 来源
//            null,    // 来源方向
//            null,    // 目标
//            null,    // 目标方向
//            null,    // 对接设备
//            null,    // 工作时间
//            null,    // 开始时间
//            null,    // 结束时间
//            null,    // 异常时间
//            null,    // 异常代码
//            null,    // 异常描述
//            null,    // 预留
//            null,    // 状态
//            null,    // 添加人员
//            null,    // 添加时间
//            null,    // 修改人员
//            null,    // 修改时间
//            null,    // 备注
//            null,    // 是否删除
//            null,    // 所属机构
//            null    // 设备工作号
//    );
    public String getSync$(){
        if (null == this.sync){ return null; }
        switch (this.sync){
            case 1:
                return "是";
            case 0:
                return "否";
            default:
                return String.valueOf(this.sync);
        }
    }
    public String getMotionCtg$(){
        MotionCtgService service = SpringUtils.getBean(MotionCtgService.class);
        MotionCtg motionCtg = service.getById(this.motionCtg);
        if (!Cools.isEmpty(motionCtg)){
            return String.valueOf(motionCtg.getName());
        }
        return null;
    }
    public String getMotionSts$(){
        MotionStsService service = SpringUtils.getBean(MotionStsService.class);
        MotionSts motionSts = service.getById(this.motionSts);
        if (!Cools.isEmpty(motionSts)){
            return String.valueOf(motionSts.getName());
        }
        return null;
    }
    public String getDeviceCtg$(){
        DeviceTypeService service = SpringUtils.getBean(DeviceTypeService.class);
        DeviceType deviceType = service.getById(this.deviceCtg);
        if (!Cools.isEmpty(deviceType)){
            return String.valueOf(deviceType.getName());
        }
        return null;
    }
    public String getIoTime$(){
        if (Cools.isEmpty(this.ioTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.ioTime);
    }
    public String getStartTime$(){
        if (Cools.isEmpty(this.startTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.startTime);
    }
    public String getEndTime$(){
        if (Cools.isEmpty(this.endTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.endTime);
    }
    public String getErrTime$(){
        if (Cools.isEmpty(this.errTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.errTime);
    }
    public String getStatus$(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return "正常";
            case 0:
                return "禁用";
            default:
                return String.valueOf(this.status);
        }
    }
    public String getCreateBy$(){
        UserService service = SpringUtils.getBean(UserService.class);
        User user = service.getById(this.createBy);
        if (!Cools.isEmpty(user)){
            return String.valueOf(user.getNickname());
        }
        return null;
    }
    public String getCreateTime$(){
        if (Cools.isEmpty(this.createTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
    }
    public String getUpdateBy$(){
        UserService service = SpringUtils.getBean(UserService.class);
        User user = service.getById(this.updateBy);
        if (!Cools.isEmpty(user)){
            return String.valueOf(user.getNickname());
        }
        return null;
    }
    public String getUpdateTime$(){
        if (Cools.isEmpty(this.updateTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
    }
    public String getDeleted$(){
        if (null == this.deleted){ return null; }
        switch (this.deleted){
            case 1:
                return "是";
            case 0:
                return "否";
            default:
                return String.valueOf(this.deleted);
        }
    }
    public String getHostId$(){
        HostService service = SpringUtils.getBean(HostService.class);
        Host host = service.getById(this.hostId);
        if (!Cools.isEmpty(host)){
            return String.valueOf(host.getName());
        }
        return null;
    }
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/MotionLogMapper.java
New file
@@ -0,0 +1,12 @@
package com.zy.asrs.wcs.core.mapper;
import com.zy.asrs.wcs.core.entity.MotionLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface MotionLogMapper extends BaseMapper<MotionLog> {
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/MotionLogService.java
New file
@@ -0,0 +1,8 @@
package com.zy.asrs.wcs.core.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zy.asrs.wcs.core.entity.MotionLog;
public interface MotionLogService extends IService<MotionLog> {
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionLogServiceImpl.java
New file
@@ -0,0 +1,12 @@
package com.zy.asrs.wcs.core.service.impl;
import com.zy.asrs.wcs.core.mapper.MotionLogMapper;
import com.zy.asrs.wcs.core.entity.MotionLog;
import com.zy.asrs.wcs.core.service.MotionLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service("motionLogService")
public class MotionLogServiceImpl extends ServiceImpl<MotionLogMapper, MotionLog> implements MotionLogService {
}
zy-asrs-wcs/src/main/resources/mapper/core/MotionLogMapper.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zy.asrs.wcs.core.mapper.MotionLogMapper">
</mapper>