#
Junjie
2024-10-15 f43b508dda7334487a1640b0bbd908d7b3aa3cb6
#
8个文件已添加
6个文件已修改
1133 ■■■■■ 已修改文件
zy-asrs-flow/src/pages/deviceConfig/shuttleChargeSta/components/edit.jsx 165 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/deviceConfig/shuttleChargeSta/index.jsx 467 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/deviceManage/basShuttle/components/edit.jsx 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/deviceManage/basShuttle/index.jsx 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/ShuttleChargeStaController.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/BasShuttle.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/ShuttleChargeSta.java 230 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/ShuttleChargeStaMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/ShuttleChargeStaService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/ShuttleChargeStaServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/CodeBuilder.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/resources/mapper/core/ShuttleChargeStaMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/deviceConfig/shuttleChargeSta/components/edit.jsx
New file
@@ -0,0 +1,165 @@
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 }}
                        />
                        <ProFormText
                            name="name"
                            label="名称"
                            colProps={{ md: 12, xl: 12 }}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormText
                            name="flag"
                            label="标识"
                            colProps={{ md: 12, xl: 12 }}
                        />
                        <ProFormSelect
                            name="status"
                            label="状态"
                            colProps={{ md: 12, xl: 12 }}
                            options={[
                                { label: '正常', value: 1 },
                                { label: '禁用', value: 0 },
                            ]}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormDateTimePicker
                            name="createTime"
                            label="添加时间"
                            colProps={{ md: 12, xl: 12 }}
                            transform={(value) => moment(value).toISOString()}
                        />
                        <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="updateTime"
                            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>
                        <ProFormText
                            name="memo"
                            label="备注"
                            colProps={{ md: 12, xl: 12 }}
                        />
                        <ProFormDigit
                            name="deviceLev"
                            label="充电桩楼层"
                            colProps={{ md: 12, xl: 12 }}
                            fieldProps={{ precision: 0 }}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormText
                            name="deviceLoc"
                            label="充电桩库位号"
                            colProps={{ md: 12, xl: 12 }}
                        />
                        <ProFormText
                            name="standbyLoc"
                            label="待机位库位号"
                            colProps={{ md: 12, xl: 12 }}
                        />
                    </ProForm.Group>
                </ProForm>
            </Modal>
        </>
    )
}
export default Edit;
zy-asrs-flow/src/pages/deviceConfig/shuttleChargeSta/index.jsx
New file
@@ -0,0 +1,467 @@
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-shuttleChargeSta';
const handleSave = async (val, intl) => {
    const hide = message.loading(intl.formatMessage({ id: 'page.adding', defaultMessage: '正在添加' }));
    try {
        const resp = await Http.doPost('api/shuttleChargeSta/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/shuttleChargeSta/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/shuttleChargeSta/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/shuttleChargeSta/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: 'name',
            valueType: 'text',
            hidden: false,
            width: 140,
            copyable: true,
            filterDropdown: (props) => <TextFilter
                name='name'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '标识',
            dataIndex: 'flag',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='flag'
                {...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: 'createTime$',
        //     valueType: 'text',
        //     hidden: false,
        //     width: 140,
        //     filterDropdown: (props) => <DatetimeRangeFilter
        //         name='createTime'
        //         {...props}
        //         actionRef={actionRef}
        //         setSearchParam={setSearchParam}
        //     />,
        // },
        // {
        //     title: '添加人员',
        //     dataIndex: 'createBy$',
        //     valueType: 'text',
        //     hidden: false,
        //     width: 140,
        //     filterDropdown: (props) => <LinkFilter
        //         name='createBy'
        //         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: 'updateBy$',
        //     valueType: 'text',
        //     hidden: false,
        //     width: 140,
        //     filterDropdown: (props) => <LinkFilter
        //         name='updateBy'
        //         major='user'
        //         {...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: 'deviceLev',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='deviceLev'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '充电桩库位号',
            dataIndex: 'deviceLoc',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='deviceLoc'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '待机位库位号',
            dataIndex: 'standbyLoc',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='standbyLoc'
                {...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="shuttleChargeSta"
                    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/shuttleChargeSta/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-flow/src/pages/deviceManage/basShuttle/components/edit.jsx
@@ -87,9 +87,10 @@
                            fieldProps={{ precision: 0 }}
                        />
                        <ProFormText
                            name="idleLoc"
                            label="暂存库位"
                            name="disableLev"
                            label="小车禁用楼层"
                            colProps={{ md: 12, xl: 12 }}
                            fieldProps={{ precision: 0 }}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
@@ -155,14 +156,6 @@
                        <ProFormDigit
                            name="runSpeed"
                            label="小车运行速度"
                            colProps={{ md: 12, xl: 12 }}
                            fieldProps={{ precision: 0 }}
                        />
                    </ProForm.Group>
                    <ProForm.Group>
                        <ProFormText
                            name="disableLev"
                            label="小车禁用楼层"
                            colProps={{ md: 12, xl: 12 }}
                            fieldProps={{ precision: 0 }}
                        />
zy-asrs-flow/src/pages/deviceManage/basShuttle/index.jsx
@@ -159,19 +159,6 @@
            />,
        },
        {
            title: '暂存库位',
            dataIndex: 'idleLoc',
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
                name='idleLoc'
                {...props}
                actionRef={actionRef}
                setSearchParam={setSearchParam}
            />,
        },
        {
            title: '自动充电',
            dataIndex: 'autoCharge',
            valueType: 'text',
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/ShuttleChargeStaController.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.ShuttleChargeSta;
import com.zy.asrs.wcs.core.service.ShuttleChargeStaService;
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 ShuttleChargeStaController extends BaseController {
    @Autowired
    private ShuttleChargeStaService shuttleChargeStaService;
    @PreAuthorize("hasAuthority('core:shuttleChargeSta:list')")
    @PostMapping("/shuttleChargeSta/page")
    public R page(@RequestBody Map<String, Object> map) {
        BaseParam baseParam = buildParam(map, BaseParam.class);
        PageParam<ShuttleChargeSta, BaseParam> pageParam = new PageParam<>(baseParam, ShuttleChargeSta.class);
        return R.ok().add(shuttleChargeStaService.page(pageParam, pageParam.buildWrapper(true)));
    }
    @PreAuthorize("hasAuthority('core:shuttleChargeSta:list')")
    @PostMapping("/shuttleChargeSta/list")
    public R list(@RequestBody Map<String, Object> map) {
        return R.ok().add(shuttleChargeStaService.list());
    }
    @PreAuthorize("hasAuthority('core:shuttleChargeSta:list')")
    @GetMapping("/shuttleChargeSta/{id}")
    public R get(@PathVariable("id") Long id) {
        return R.ok().add(shuttleChargeStaService.getById(id));
    }
    @PreAuthorize("hasAuthority('core:shuttleChargeSta:save')")
    @OperationLog("添加穿梭车充电桩")
    @PostMapping("/shuttleChargeSta/save")
    public R save(@RequestBody ShuttleChargeSta shuttleChargeSta) {
        if (!shuttleChargeStaService.save(shuttleChargeSta)) {
            return R.error("添加失败");
        }
        return R.ok("添加成功");
    }
    @PreAuthorize("hasAuthority('core:shuttleChargeSta:update')")
    @OperationLog("修改穿梭车充电桩")
    @PostMapping("/shuttleChargeSta/update")
    public R update(@RequestBody ShuttleChargeSta shuttleChargeSta) {
        if (!shuttleChargeStaService.updateById(shuttleChargeSta)) {
            return R.error("修改失败");
        }
        return R.ok("修改成功");
    }
    @PreAuthorize("hasAuthority('core:shuttleChargeSta:remove')")
    @OperationLog("删除穿梭车充电桩")
    @PostMapping("/shuttleChargeSta/remove/{ids}")
    public R remove(@PathVariable Long[] ids) {
        if (!shuttleChargeStaService.removeByIds(Arrays.asList(ids))) {
            return R.error("删除失败");
        }
        return R.ok("删除成功");
    }
    @PreAuthorize("hasAuthority('core:shuttleChargeSta:list')")
    @PostMapping("/shuttleChargeSta/query")
    public R query(@RequestParam(required = false) String condition) {
        List<KeyValVo> vos = new ArrayList<>();
        LambdaQueryWrapper<ShuttleChargeSta> wrapper = new LambdaQueryWrapper<>();
        if (!Cools.isEmpty(condition)) {
            wrapper.like(ShuttleChargeSta::getName, condition);
        }
        shuttleChargeStaService.page(new Page<>(1, 30), wrapper).getRecords().forEach(
                item -> vos.add(new KeyValVo(item.getId(), item.getName()))
        );
        return R.ok().add(vos);
    }
    @PreAuthorize("hasAuthority('core:shuttleChargeSta:list')")
    @PostMapping("/shuttleChargeSta/export")
    public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
        ExcelUtil.build(ExcelUtil.create(shuttleChargeStaService.list(), ShuttleChargeSta.class), response);
    }
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/BasShuttle.java
@@ -69,12 +69,6 @@
    private Integer taskNo;
    /**
     * 暂存库位
     */
    @ApiModelProperty(value= "暂存库位")
    private String idleLoc;
    /**
     * 自动充电
     */
    @ApiModelProperty(value= "自动充电")
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/ShuttleChargeSta.java
New file
@@ -0,0 +1,230 @@
package com.zy.asrs.wcs.core.entity;
import com.baomidou.mybatisplus.annotation.TableLogic;
import java.text.SimpleDateFormat;
import java.util.Date;
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 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("wcs_shuttle_charge_sta")
public class ShuttleChargeSta 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 String name;
    /**
     * 标识
     */
    @ApiModelProperty(value= "标识")
    private String flag;
    /**
     * 所属机构
     */
    @ApiModelProperty(value= "所属机构")
    private Long hostId;
    /**
     * 状态 1: 正常  0: 禁用
     */
    @ApiModelProperty(value= "状态 1: 正常  0: 禁用  ")
    private Integer status;
    /**
     * 是否删除 1: 是  0: 否
     */
    @ApiModelProperty(value= "是否删除 1: 是  0: 否  ")
    @TableLogic
    private Integer deleted;
    /**
     * 添加时间
     */
    @ApiModelProperty(value= "添加时间")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 添加人员
     */
    @ApiModelProperty(value= "添加人员")
    private Long createBy;
    /**
     * 修改时间
     */
    @ApiModelProperty(value= "修改时间")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    /**
     * 修改人员
     */
    @ApiModelProperty(value= "修改人员")
    private Long updateBy;
    /**
     * 备注
     */
    @ApiModelProperty(value= "备注")
    private String memo;
    /**
     * 充电桩楼层
     */
    @ApiModelProperty(value= "充电桩楼层")
    private Integer deviceLev;
    /**
     * 充电桩库位号
     */
    @ApiModelProperty(value= "充电桩库位号")
    private String deviceLoc;
    /**
     * 待机位库位号
     */
    @ApiModelProperty(value= "待机位库位号")
    private String standbyLoc;
    public ShuttleChargeSta() {}
    public ShuttleChargeSta(String uuid,String name,String flag,Long hostId,Integer status,Integer deleted,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo,Integer deviceLev,String deviceLoc,String standbyLoc) {
        this.uuid = uuid;
        this.name = name;
        this.flag = flag;
        this.hostId = hostId;
        this.status = status;
        this.deleted = deleted;
        this.createTime = createTime;
        this.createBy = createBy;
        this.updateTime = updateTime;
        this.updateBy = updateBy;
        this.memo = memo;
        this.deviceLev = deviceLev;
        this.deviceLoc = deviceLoc;
        this.standbyLoc = standbyLoc;
    }
//    ShuttleChargeSta shuttleChargeSta = new ShuttleChargeSta(
//            null,    // 编号
//            null,    // 名称
//            null,    // 标识
//            null,    // 所属机构
//            null,    // 状态
//            null,    // 是否删除
//            null,    // 添加时间
//            null,    // 添加人员
//            null,    // 修改时间
//            null,    // 修改人员
//            null,    // 备注
//            null,    // 充电桩楼层
//            null,    // 充电桩库位号
//            null    // 待机位库位号
//    );
    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;
    }
    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 getDeleted$(){
        if (null == this.deleted){ return null; }
        switch (this.deleted){
            case 1:
                return "是";
            case 0:
                return "否";
            default:
                return String.valueOf(this.deleted);
        }
    }
    public String getCreateTime$(){
        if (Cools.isEmpty(this.createTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
    }
    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 getUpdateTime$(){
        if (Cools.isEmpty(this.updateTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
    }
    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;
    }
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/ShuttleChargeStaMapper.java
New file
@@ -0,0 +1,12 @@
package com.zy.asrs.wcs.core.mapper;
import com.zy.asrs.wcs.core.entity.ShuttleChargeSta;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface ShuttleChargeStaMapper extends BaseMapper<ShuttleChargeSta> {
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/ShuttleChargeStaService.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.ShuttleChargeSta;
public interface ShuttleChargeStaService extends IService<ShuttleChargeSta> {
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
@@ -84,6 +84,8 @@
    private BasLedService basLedService;
    @Autowired
    private DeviceBarcodeService deviceBarcodeService;
    @Autowired
    private ShuttleChargeStaService shuttleChargeStaService;
    /**
     * 组托
@@ -668,20 +670,19 @@
            String currentLocNo = shuttleProtocol.getCurrentLocNo();
            int lev = Utils.getLev(currentLocNo);//获取小车楼层
            //搜索小车当前楼层充电桩
            ArrayList<Loc> allChargeLoc = new ArrayList<>();
            List<Loc> list1 = locService.list(new LambdaQueryWrapper<Loc>()
                    .eq(Loc::getLocSts, LocStsType.C.val())
                    .eq(Loc::getStatus, 1)
                    .eq(Loc::getLev, lev));
            ArrayList<ShuttleChargeSta> allChargeLoc = new ArrayList<>();
            List<ShuttleChargeSta> list1 = shuttleChargeStaService.list(new LambdaQueryWrapper<ShuttleChargeSta>()
                    .eq(ShuttleChargeSta::getDeviceLev, lev)
                    .eq(ShuttleChargeSta::getStatus, 1));
            if (!list1.isEmpty()) {
                allChargeLoc.addAll(list1);
            }
            //搜索其他楼层充电桩
            List<Loc> list2 = locService.list(new LambdaQueryWrapper<Loc>()
                    .eq(Loc::getLocSts, LocStsType.C.val())
                    .eq(Loc::getStatus, 1)
                    .notIn(Loc::getLev, lev));
            List<ShuttleChargeSta> list2 = shuttleChargeStaService.list(new LambdaQueryWrapper<ShuttleChargeSta>()
                    .notIn(ShuttleChargeSta::getDeviceLev, lev)
                    .eq(ShuttleChargeSta::getStatus, 1));
            if (!list2.isEmpty()) {
                allChargeLoc.addAll(list2);
            }
@@ -692,24 +693,34 @@
            }
            //选择空闲充电桩
            Loc chargeLoc = null;
            for (Loc loc : allChargeLoc) {
            ShuttleChargeSta chargeSta = null;
            for (ShuttleChargeSta shuttleChargeSta : allChargeLoc) {
                // 判断充电位是否被占用(车辆位置)
                if (Utils.hasShuttleInLoc(loc.getLocNo(), device.getId())) {
                if (Utils.hasShuttleInLoc(shuttleChargeSta.getDeviceLoc(), device.getId())) {
                    continue;
                }
                // 盘点充电位是否存在任务档
                List<Task> tasks = taskService.hasChargeInLoc(loc.getLocNo());
                List<Task> tasks = taskService.hasChargeInLoc(shuttleChargeSta.getDeviceLoc());
                if (!tasks.isEmpty()) {
                    continue;
                }
                chargeLoc = loc;
                Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>()
                        .eq(Loc::getLocNo, shuttleChargeSta.getDeviceLoc()));
                if (loc == null) {
                    continue;
                }
                if (!loc.getLocSts().equals(LocStsType.C.val())) {
                    continue;//库位不是充电桩
                }
                chargeSta = shuttleChargeSta;
                break;
            }
            if (chargeLoc == null) {
            if (chargeSta == null) {
                continue;//未找到充电桩
            }
@@ -730,7 +741,7 @@
                continue;
            }
            String chargeLocNo = chargeLoc.getLocNo();
            String chargeLocNo = chargeSta.getDeviceLoc();
            Task task = new Task();
            task.setUuid(String.valueOf(snowflakeIdWorker.nextId()));
            task.setTaskNo(String.valueOf(Utils.getTaskNo("CHARGE")));
@@ -770,14 +781,6 @@
     * 四向穿梭车电量检测 ===>> 满电后回到待机位
     */
    public synchronized void loopShuttleToStandbyCauseCharge() {
        Integer enoughPower = 90;
        Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>()
                .eq(Dict::getFlag, "chargeMaxValue")
                .eq(Dict::getStatus, 1));
        if (dict != null) {
            enoughPower = Integer.parseInt(dict.getValue());
        }
        //获取迁移任务类型
        TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>()
                .eq(TaskCtg::getFlag, String.valueOf(TaskCtgType.MOVE))
@@ -823,8 +826,21 @@
                continue;
            }
            ShuttleChargeSta chargeSta = shuttleChargeStaService.getOne(new LambdaQueryWrapper<ShuttleChargeSta>()
                    .eq(ShuttleChargeSta::getDeviceLoc, chargeTask.getDestLoc())
                    .eq(ShuttleChargeSta::getStatus, 1));
            if (chargeSta == null) {
                continue;//充电桩不存在,异常
            }
            String standbyLoc = chargeSta.getStandbyLoc();
            if (standbyLoc == null) {
                continue;//避让位置数据不存在
            }
            List<String> availableLoc = JSON.parseArray(standbyLoc, String.class);
            //获取避让位置
            String standByLocNo = shuttleDispatcher.searchStandByLocNo(Integer.valueOf(device.getDeviceNo()), device.getHostId(), shuttleThread.getStatus().getCurrentLocNo());
            String standByLocNo = shuttleDispatcher.searchAvailableLocNo(Integer.valueOf(device.getDeviceNo()), device.getHostId(), shuttleThread.getStatus().getCurrentLocNo(), availableLoc);
            Task task = new Task();
            task.setUuid(String.valueOf(snowflakeIdWorker.nextId()));
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/ShuttleChargeStaServiceImpl.java
New file
@@ -0,0 +1,12 @@
package com.zy.asrs.wcs.core.service.impl;
import com.zy.asrs.wcs.core.mapper.ShuttleChargeStaMapper;
import com.zy.asrs.wcs.core.entity.ShuttleChargeSta;
import com.zy.asrs.wcs.core.service.ShuttleChargeStaService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service("shuttleChargeStaService")
public class ShuttleChargeStaServiceImpl extends ServiceImpl<ShuttleChargeStaMapper, ShuttleChargeSta> implements ShuttleChargeStaService {
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
@@ -284,9 +284,9 @@
    }
    /**
     * 搜索避让库位,通过小车号和目标库位
     * 搜索可用库位,通过小车号和目标库位
     */
    public String searchStandByLocNo(Integer shuttleNo, Long hostId, String locNo) {
    public String searchAvailableLocNo(Integer shuttleNo, Long hostId, String currentLocNo, List<String> locNos) {
        BasShuttle basShuttle = basShuttleService.getOne(new LambdaQueryWrapper<BasShuttle>()
                .eq(BasShuttle::getShuttleNo, shuttleNo)
                .eq(BasShuttle::getHostId, hostId));
@@ -294,33 +294,18 @@
            throw new CoolException("小车基础数据不存在");
        }
        String idleLoc = basShuttle.getIdleLoc();
        if (Cools.isEmpty(idleLoc)) {
            throw new CoolException("小车避让数据不存在");
        }
        int lev = Utils.getLev(locNo);//当前楼层
        List<String> standbyLoc = JSON.parseArray(idleLoc, String.class);
        if (standbyLoc.isEmpty()) {
            throw new CoolException("避让数据异常");
        }
        //获取当前层避让位置
        List<String> currentLevStandByLoc = new ArrayList<>();
        for (String loc : standbyLoc) {
            if (Utils.getLev(loc) == lev) {
                currentLevStandByLoc.add(loc);
            }
        }
        if (currentLevStandByLoc.isEmpty()) {
        if (locNos.isEmpty()) {
            throw new CoolException("当前层无避让位置");
        }
        int lev = Utils.getLev(currentLocNo);
        Integer finalDistance = ShuttleDispatcher.INF;
        String recentLoc = null;
        for (String loc : currentLevStandByLoc) {
        for (String loc : locNos) {
            //当前穿梭车到避让位计算
            List<NavigateNode> currentShuttlePath = NavigateUtils.calc(
                    locNo
                    currentLocNo
                    , loc
                    , NavigationMapType.NORMAL.id
                    , Utils.getShuttlePoints(shuttleNo, lev)
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/CodeBuilder.java
@@ -15,15 +15,15 @@
        generator.frontendPrefixPath = "zy-asrs-flow/";
        generator.sqlOsType = SqlOsType.MYSQL;
        generator.url="127.0.0.1:3306/asrs";
        generator.url="127.0.0.1:3306/jxgtasrs";
        generator.username="root";
        generator.password="root";
//        generator.url="47.97.1.152:51433;databasename=jkasrs";
//        generator.username="sa";
//        generator.password="Zoneyung@zy56$";
        generator.table="wcs_bas_conveyor_path";
        generator.tableName = "输送路径配置";
        generator.table="wcs_shuttle_charge_sta";
        generator.tableName = "穿梭车充电桩";
        generator.packagePath="com.zy.asrs.wcs.core";
        generator.build();
zy-asrs-wcs/src/main/resources/mapper/core/ShuttleChargeStaMapper.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.ShuttleChargeStaMapper">
</mapper>