Merge branch 'Four-Way-Rack' of http://47.97.1.152:5880/r/zy-asrs-master into Four-Way-Rack
| | |
| | | import { exportDataToServer, getFlowList, deleteFlowById, updateFlowStatus, mockRun } from "../../services/flow/api"; |
| | | import './css/GraphTools.less' |
| | | import { flow, remove } from "lodash"; |
| | | import { find } from "lodash"; |
| | | |
| | | export const GraphTools = ({ graphRef, isReady }) => { |
| | | |
| | |
| | | } |
| | | |
| | | let result = sortNodes(rootNode, nodes, graph); |
| | | let targetResult = setResult(edges, result) |
| | | console.log(targetResult); |
| | | exportDataToServer({ |
| | | originData: JSON.stringify(data), |
| | | data: result, |
| | |
| | | return cpValues; |
| | | } |
| | | |
| | | const setResult = (edges, result) => { |
| | | console.log(edges, result); |
| | | result.forEach((item) => { |
| | | let find = findEdge(edges, item.id) |
| | | |
| | | item.nextTrue = ""; |
| | | item.nextFalse = ""; |
| | | |
| | | find.forEach((edge) => { |
| | | if (edge.data.logicBool == true) { |
| | | item.nextTrue = edge.target.cell; |
| | | } else { |
| | | item.nextFalse = edge.target.cell; |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | return result; |
| | | } |
| | | |
| | | const findEdge = (edges, parentId) => { |
| | | let list = []; |
| | | edges.forEach((edge) => { |
| | | if (edge.source.cell == parentId) { |
| | | list.push(edge); |
| | | } |
| | | }) |
| | | |
| | | return list; |
| | | } |
| | | |
| | | const transCode = (rootNode, nodes, graph) => { |
| | | let codeContent = ""; |
| | | |
New file |
| | |
| | | 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> |
| | | <ProFormSelect |
| | | name="deviceId" |
| | | label="设备id" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | showSearch |
| | | debounceTime={300} |
| | | request={async ({ keyWords }) => { |
| | | const resp = await Http.doPostForm('api/device/query', { condition: keyWords }); |
| | | return resp.data; |
| | | }} |
| | | /> |
| | | <ProFormDigit |
| | | name="liftNo" |
| | | label="提升机号" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | rules={[{ required: true }]} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormDigit |
| | | name="status" |
| | | label="当前任务状态" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | /> |
| | | <ProFormDigit |
| | | name="taskNo" |
| | | label="任务号" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <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; |
| | | }} |
| | | /> |
| | | <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()} |
| | | /> |
| | | <ProFormDateTimePicker |
| | | name="updateTime" |
| | | label="修改时间" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | transform={(value) => moment(value).toISOString()} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormText |
| | | name="memo" |
| | | label="备注" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | <ProFormDigit |
| | | name="pakMk" |
| | | label="作业标记" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormText |
| | | name="protocol" |
| | | label="设备状态" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | <ProFormSelect |
| | | name="transfer" |
| | | label="小车是否可换层" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | options={[ |
| | | { label: '否', value: 0 }, |
| | | { label: '是', value: 1 }, |
| | | ]} |
| | | /> |
| | | </ProForm.Group> |
| | | |
| | | </ProForm> |
| | | </Modal> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | export default Edit; |
New file |
| | |
| | | |
| | | 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-basLift'; |
| | | |
| | | const handleSave = async (val, intl) => { |
| | | const hide = message.loading(intl.formatMessage({ id: 'page.adding', defaultMessage: '正在添加' })); |
| | | try { |
| | | const resp = await Http.doPost('api/basLift/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/basLift/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/basLift/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/basLift/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: '设备id', |
| | | dataIndex: 'deviceId$', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <LinkFilter |
| | | name='deviceId' |
| | | major='device' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '提升机号', |
| | | dataIndex: 'liftNo', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | copyable: true, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='liftNo' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '当前任务状态', |
| | | dataIndex: 'status', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='status' |
| | | {...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: 'updateBy$', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <LinkFilter |
| | | name='updateBy' |
| | | major='user' |
| | | {...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: 'createTime$', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <DatetimeRangeFilter |
| | | name='createTime' |
| | | {...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: 'pakMk', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='pakMk' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '设备状态', |
| | | dataIndex: 'protocol', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='protocol' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '小车是否可换层', |
| | | dataIndex: 'transfer$', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <SelectFilter |
| | | name='transfer' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | data={[ |
| | | { label: '否', value: 0 }, |
| | | { label: '是', value: 1 }, |
| | | ]} |
| | | />, |
| | | }, |
| | | |
| | | { |
| | | 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="basLift" |
| | | 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/basLift/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; |
New file |
| | |
| | | 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="deviceId" |
| | | label="设备号" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormDigit |
| | | name="deviceLev" |
| | | label="设备楼层楼层" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | /> |
| | | <ProFormText |
| | | name="deviceLoc" |
| | | label="设备库位号" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormText |
| | | name="deviceStandbyLoc" |
| | | label="设备待机位库位号" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | <ProFormText |
| | | name="standbyLoc" |
| | | label="待机位库位号" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | </ProForm.Group> |
| | | |
| | | </ProForm> |
| | | </Modal> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | export default Edit; |
New file |
| | |
| | | |
| | | 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-shuttleStandby'; |
| | | |
| | | const handleSave = async (val, intl) => { |
| | | const hide = message.loading(intl.formatMessage({ id: 'page.adding', defaultMessage: '正在添加' })); |
| | | try { |
| | | const resp = await Http.doPost('api/shuttleStandby/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/shuttleStandby/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/shuttleStandby/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/shuttleStandby/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: 'deviceId', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='deviceId' |
| | | {...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: 'deviceStandbyLoc', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='deviceStandbyLoc' |
| | | {...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="shuttleStandby" |
| | | 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/shuttleStandby/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; |
New file |
| | |
| | | -- save basLift record |
| | | -- mysql |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `host_id`, `status`) values ( '提升机列表管理', '0', '/core/basLift', '/core/basLift', '0' , '0', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '查询提升机列表', '', '1', 'core:basLift:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '添加提升机列表', '', '1', 'core:basLift:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '修改提升机列表', '', '1', 'core:basLift:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '删除提升机列表', '', '1', 'core:basLift:remove', '3', '1', '1'); |
| | | |
| | |
| | | package com.zy.asrs.wcs.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wcs.asrs.entity.FlowGraph; |
| | | import com.zy.asrs.wcs.asrs.entity.param.FlowLogicCodeParam; |
| | |
| | | flowGraph.setStatus(0); |
| | | } |
| | | flowGraph.setName(param.get("name").toString()); |
| | | flowGraph.setMemo(param.get("memo").toString()); |
| | | flowGraph.setMemo(param.get("memo") == null ? "" : param.get("memo").toString()); |
| | | flowGraph.setOriginData(param.get("originData").toString()); |
| | | flowGraph.setProcessData(JSON.toJSONString(list)); |
| | | flowGraph.setProcessData(JSON.toJSONString(param.get("data"))); |
| | | flowGraph.setUpdateTime(new Date()); |
| | | flowGraph.setHostId(getHostId()); |
| | | flowGraphService.saveOrUpdate(flowGraph); |
| | | |
| | | return R.ok(); |
| | |
| | | |
| | | //开始模拟执行 |
| | | String processData = flowGraph.getProcessData(); |
| | | List<FlowLogicCodeParam> list = JSON.parseArray(processData, FlowLogicCodeParam.class); |
| | | // List<FlowLogicCodeParam> list = JSON.parseArray(processData, FlowLogicCodeParam.class); |
| | | List<JSONObject> list = JSON.parseArray(processData, JSONObject.class); |
| | | boolean execute = flowExecute.execute(list); |
| | | return R.ok().add(execute); |
| | | } |
New file |
| | |
| | | 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.BasLift; |
| | | import com.zy.asrs.wcs.core.service.BasLiftService; |
| | | 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 BasLiftController extends BaseController { |
| | | |
| | | @Autowired |
| | | private BasLiftService basLiftService; |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:list')") |
| | | @PostMapping("/basLift/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<BasLift, BaseParam> pageParam = new PageParam<>(baseParam, BasLift.class); |
| | | return R.ok().add(basLiftService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:list')") |
| | | @PostMapping("/basLift/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(basLiftService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:list')") |
| | | @GetMapping("/basLift/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(basLiftService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:save')") |
| | | @OperationLog("添加提升机列表") |
| | | @PostMapping("/basLift/save") |
| | | public R save(@RequestBody BasLift basLift) { |
| | | if (!basLiftService.save(basLift)) { |
| | | return R.error("添加失败"); |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:update')") |
| | | @OperationLog("修改提升机列表") |
| | | @PostMapping("/basLift/update") |
| | | public R update(@RequestBody BasLift basLift) { |
| | | if (!basLiftService.updateById(basLift)) { |
| | | return R.error("修改失败"); |
| | | } |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:remove')") |
| | | @OperationLog("删除提升机列表") |
| | | @PostMapping("/basLift/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!basLiftService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("删除失败"); |
| | | } |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:list')") |
| | | @PostMapping("/basLift/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<BasLift> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(BasLift::getLiftNo, condition); |
| | | } |
| | | basLiftService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getLiftNo())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLift:list')") |
| | | @PostMapping("/basLift/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(basLiftService.list(), BasLift.class), response); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | 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.ShuttleStandby; |
| | | import com.zy.asrs.wcs.core.service.ShuttleStandbyService; |
| | | 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 ShuttleStandbyController extends BaseController { |
| | | |
| | | @Autowired |
| | | private ShuttleStandbyService shuttleStandbyService; |
| | | |
| | | @PreAuthorize("hasAuthority('core:shuttleStandby:list')") |
| | | @PostMapping("/shuttleStandby/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<ShuttleStandby, BaseParam> pageParam = new PageParam<>(baseParam, ShuttleStandby.class); |
| | | return R.ok().add(shuttleStandbyService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:shuttleStandby:list')") |
| | | @PostMapping("/shuttleStandby/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(shuttleStandbyService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:shuttleStandby:list')") |
| | | @GetMapping("/shuttleStandby/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(shuttleStandbyService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:shuttleStandby:save')") |
| | | @OperationLog("添加穿梭车待机位") |
| | | @PostMapping("/shuttleStandby/save") |
| | | public R save(@RequestBody ShuttleStandby shuttleStandby) { |
| | | if (!shuttleStandbyService.save(shuttleStandby)) { |
| | | return R.error("添加失败"); |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:shuttleStandby:update')") |
| | | @OperationLog("修改穿梭车待机位") |
| | | @PostMapping("/shuttleStandby/update") |
| | | public R update(@RequestBody ShuttleStandby shuttleStandby) { |
| | | if (!shuttleStandbyService.updateById(shuttleStandby)) { |
| | | return R.error("修改失败"); |
| | | } |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:shuttleStandby:remove')") |
| | | @OperationLog("删除穿梭车待机位") |
| | | @PostMapping("/shuttleStandby/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!shuttleStandbyService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("删除失败"); |
| | | } |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:shuttleStandby:list')") |
| | | @PostMapping("/shuttleStandby/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<ShuttleStandby> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(ShuttleStandby::getName, condition); |
| | | } |
| | | shuttleStandbyService.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:shuttleStandby:list')") |
| | | @PostMapping("/shuttleStandby/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(shuttleStandbyService.list(), ShuttleStandby.class), response); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.entity; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.zy.asrs.wcs.rcs.entity.Device; |
| | | import com.zy.asrs.wcs.rcs.service.DeviceService; |
| | | 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.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("wcs_bas_lift") |
| | | public class BasLift implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | @ApiModelProperty(value= "设备id") |
| | | private Long deviceId; |
| | | |
| | | /** |
| | | * 提升机号 |
| | | */ |
| | | @ApiModelProperty(value= "提升机号") |
| | | private Integer liftNo; |
| | | |
| | | /** |
| | | * 当前任务状态 |
| | | */ |
| | | @ApiModelProperty(value= "当前任务状态") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 任务号 |
| | | */ |
| | | @ApiModelProperty(value= "任务号") |
| | | private Integer taskNo; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value= "修改人员") |
| | | private Long updateBy; |
| | | |
| | | /** |
| | | * 创建人员 |
| | | */ |
| | | @ApiModelProperty(value= "创建人员") |
| | | private Long createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @ApiModelProperty(value= "创建时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | /** |
| | | * 作业标记 |
| | | */ |
| | | @ApiModelProperty(value= "作业标记") |
| | | private Integer pakMk; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | | * 所属机构 |
| | | */ |
| | | @ApiModelProperty(value= "所属机构") |
| | | private Long hostId; |
| | | |
| | | /** |
| | | * 设备状态 |
| | | */ |
| | | @ApiModelProperty(value= "设备状态") |
| | | private String protocol; |
| | | |
| | | /** |
| | | * 小车是否可换层 0: 否 1: 是 |
| | | */ |
| | | @ApiModelProperty(value= "小车是否可换层 0: 否 1: 是 ") |
| | | private Integer transfer; |
| | | |
| | | /** |
| | | * 排 |
| | | */ |
| | | @ApiModelProperty(value= "排") |
| | | private Integer row; |
| | | |
| | | /** |
| | | * 列 |
| | | */ |
| | | @ApiModelProperty(value= "列") |
| | | private Integer bay; |
| | | |
| | | public BasLift() {} |
| | | |
| | | public BasLift(Long deviceId,Integer liftNo,Integer status,Integer taskNo,Long updateBy,Long createBy,Date createTime,Date updateTime,String memo,Integer pakMk,Integer deleted,Long hostId,String protocol,Integer transfer) { |
| | | this.deviceId = deviceId; |
| | | this.liftNo = liftNo; |
| | | this.status = status; |
| | | this.taskNo = taskNo; |
| | | this.updateBy = updateBy; |
| | | this.createBy = createBy; |
| | | this.createTime = createTime; |
| | | this.updateTime = updateTime; |
| | | this.memo = memo; |
| | | this.pakMk = pakMk; |
| | | this.deleted = deleted; |
| | | this.hostId = hostId; |
| | | this.protocol = protocol; |
| | | this.transfer = transfer; |
| | | } |
| | | |
| | | // BasLift basLift = new BasLift( |
| | | // null, // 设备id |
| | | // null, // 提升机号[非空] |
| | | // null, // 当前任务状态 |
| | | // null, // 任务号 |
| | | // null, // 修改人员 |
| | | // null, // 创建人员 |
| | | // null, // 创建时间 |
| | | // null, // 修改时间 |
| | | // null, // 备注 |
| | | // null, // 作业标记 |
| | | // null, // 是否删除 |
| | | // null, // 所属机构 |
| | | // null, // 设备状态 |
| | | // null // 小车是否可换层 |
| | | // ); |
| | | |
| | | public String getDeviceId$(){ |
| | | DeviceService service = SpringUtils.getBean(DeviceService.class); |
| | | Device device = service.getById(this.deviceId); |
| | | if (!Cools.isEmpty(device)){ |
| | | return String.valueOf(device.getDeviceNo()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | 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 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 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; |
| | | } |
| | | |
| | | public String getTransfer$(){ |
| | | if (null == this.transfer){ return null; } |
| | | switch (this.transfer){ |
| | | case 0: |
| | | return "否"; |
| | | case 1: |
| | | return "是"; |
| | | default: |
| | | return String.valueOf(this.transfer); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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_standby") |
| | | public class ShuttleStandby 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 Long deviceId; |
| | | |
| | | /** |
| | | * 设备楼层楼层 |
| | | */ |
| | | @ApiModelProperty(value= "设备楼层楼层") |
| | | private Integer deviceLev; |
| | | |
| | | /** |
| | | * 设备库位号 |
| | | */ |
| | | @ApiModelProperty(value= "设备库位号") |
| | | private String deviceLoc; |
| | | |
| | | /** |
| | | * 设备待机位库位号 |
| | | */ |
| | | @ApiModelProperty(value= "设备待机位库位号") |
| | | private String deviceStandbyLoc; |
| | | |
| | | /** |
| | | * 待机位库位号 |
| | | */ |
| | | @ApiModelProperty(value= "待机位库位号") |
| | | private String standbyLoc; |
| | | |
| | | public ShuttleStandby() {} |
| | | |
| | | public ShuttleStandby(String uuid,String name,String flag,Long hostId,Integer status,Integer deleted,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo,Long deviceId,Integer deviceLev,String deviceLoc,String deviceStandbyLoc,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.deviceId = deviceId; |
| | | this.deviceLev = deviceLev; |
| | | this.deviceLoc = deviceLoc; |
| | | this.deviceStandbyLoc = deviceStandbyLoc; |
| | | this.standbyLoc = standbyLoc; |
| | | } |
| | | |
| | | // ShuttleStandby shuttleStandby = new ShuttleStandby( |
| | | // null, // 编号 |
| | | // null, // 名称 |
| | | // 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; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.wcs.core.domain.dto.MotionDto; |
| | | import com.zy.asrs.wcs.core.entity.ShuttleStandby; |
| | | import com.zy.asrs.wcs.core.entity.Task; |
| | | import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.MotionCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.TaskStsType; |
| | | import com.zy.asrs.wcs.core.model.enums.WorkZoneType; |
| | | import com.zy.asrs.wcs.core.service.ShuttleStandbyService; |
| | | import com.zy.asrs.wcs.core.service.TaskService; |
| | | import com.zy.asrs.wcs.core.utils.ConveyorDispatcher; |
| | | import com.zy.asrs.wcs.core.utils.LiftDispatcher; |
| | | import com.zy.asrs.wcs.core.utils.ShuttleDispatcher; |
| | | import com.zy.asrs.wcs.core.utils.Utils; |
| | |
| | | import com.zy.asrs.wcs.core.entity.Motion; |
| | | import com.zy.asrs.wcs.rcs.entity.Device; |
| | | import com.zy.asrs.wcs.rcs.model.enums.SlaveType; |
| | | import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol; |
| | | import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol; |
| | | import com.zy.asrs.wcs.core.service.MotionService; |
| | | import com.zy.asrs.wcs.rcs.service.DeviceService; |
| | | import com.zy.asrs.wcs.rcs.thread.LiftThread; |
| | | import com.zy.asrs.wcs.rcs.thread.ShuttleThread; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private ShuttleDispatcher shuttleDispatcher; |
| | | @Autowired |
| | | private LiftDispatcher liftDispatcher; |
| | | // @Autowired |
| | | // private ConveyorDispatcher conveyorDispatcher; |
| | | @Autowired |
| | | private ConveyorDispatcher conveyorDispatcher; |
| | | @Autowired |
| | | private DeviceService deviceService; |
| | | @Autowired |
| | | private ShuttleStandbyService shuttleStandbyService; |
| | | |
| | | public List<Motion> generateMotion(Task task) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | | switch (Objects.requireNonNull(WorkZoneType.query(task.getTaskSts() == TaskStsType.NEW_INBOUND.sts ? task.getOriginSite() : task.getDestSite()))) { |
| | | case FIRST_ZONE: |
| | | motionList = this.generateFirstZoneMotion(task); |
| | | break; |
| | | default: |
| | | } |
| | | // switch (Objects.requireNonNull(WorkZoneType.query(task.getTaskSts() == TaskStsType.NEW_INBOUND.sts ? task.getOriginSite() : task.getDestSite()))) { |
| | | // case FIRST_ZONE: |
| | | // motionList = this.generateFirstZoneMotion(task); |
| | | // break; |
| | | // default: |
| | | // } |
| | | motionList = this.generateFirstZoneMotion(task); |
| | | return motionList; |
| | | } |
| | | |
| | |
| | | */ |
| | | public List<Motion> generateChargeMotion(Task task) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | | // if (wrkCharge.getWrkSts() != WrkMastStsType.NEW_CHARGE.sts || wrkCharge.getIoType() != WrkIoTypeType.CHARGE.sts) { |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // // locNo |
| | | // String chargeLocNo = wrkCharge.getLocNo(); |
| | | // |
| | | // // lift |
| | | // Integer transferLiftNo = 2; |
| | | // SiemensLiftThread liftThread = (SiemensLiftThread) SlaveConnection.get(SlaveType.Lift, transferLiftNo); |
| | | // LiftProtocol liftProtocol = liftThread.getLiftProtocol(); |
| | | // if (liftProtocol == null || liftProtocol.getLiftNo() == null) { |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // // shuttle |
| | | // Integer shuttleNo = wrkCharge.getShuttleNo(); |
| | | // ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo); |
| | | // ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | // if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { |
| | | // return motionList; |
| | | // } |
| | | // if (!shuttleProtocol.isIdle()) { |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // //检测穿梭车是否有任务绑定 |
| | | // boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleProtocol.getShuttleNo().intValue()); |
| | | // if (shuttleResult) { |
| | | // //存在任务,禁止解析 |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // //检测提升机是否有任务绑定 |
| | | // boolean liftResult = Utils.checkLiftHasBinding(transferLiftNo); |
| | | // if (liftResult) { |
| | | // //存在任务,禁止解析 |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | // |
| | | // //穿梭车到提升机库位号 |
| | | // String liftLocNoTo = LiftCodeType.getLocNo(transferLiftNo, Utils.getLev(shuttleLocNo)); |
| | | // |
| | | // //穿梭车出提升机库位号 |
| | | // String liftLocNoFrom = LiftCodeType.getLocNo(transferLiftNo, Utils.getLev(wrkCharge.getLocNo())); |
| | | // |
| | | // //穿梭车到提升机待机位库位号 |
| | | // String standbyLocNoTo = LiftCodeType.getStandbyLocNo(transferLiftNo, Utils.getLev(shuttleLocNo)); |
| | | // |
| | | // //穿梭车出提升机待机位库位号 |
| | | // String standbyLocNoFrom = LiftCodeType.getStandbyLocNo(transferLiftNo, Utils.getLev(wrkCharge.getLocNo())); |
| | | // |
| | | // // 判断穿梭车是否在充电层 |
| | | // if (Utils.getLev(shuttleLocNo) == Utils.getLev(chargeLocNo)) { |
| | | // |
| | | // // 穿梭车走行至充电桩库位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(shuttleLocNo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(chargeLocNo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // } else { |
| | | // |
| | | // // 穿梭车走行至提升机待机位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(shuttleLocNo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoTo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // // 提升机空载移动到穿梭车层 |
| | | // motionList.addAll(kernelService.liftMove( |
| | | // null |
| | | // , MotionDto.build((dto -> { |
| | | // dto.setLiftNo(transferLiftNo); |
| | | // dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | // })) |
| | | // )); |
| | | // |
| | | // // 穿梭车提升机待机位至提升机库位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoTo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(transferLiftNo); |
| | | // dto.setLocNo(liftLocNoTo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | // )); |
| | | // |
| | | // // 提升机搬车 至 输送线层 |
| | | // motionList.addAll(kernelService.liftMoveShuttle( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(transferLiftNo); |
| | | // dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(transferLiftNo); |
| | | // dto.setLev(Utils.getLev(chargeLocNo)); |
| | | // })) |
| | | // )); |
| | | // |
| | | // // 穿梭车提升机至提升机待机位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(transferLiftNo); |
| | | // dto.setLocNo(liftLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | // )); |
| | | // |
| | | // // 穿梭车提升机待机位至充电位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(chargeLocNo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // wrkCharge.setLiftNo(transferLiftNo); |
| | | // wrkChargeMapper.updateById(wrkCharge); |
| | | // } |
| | | // |
| | | // // 穿梭车开始充电 |
| | | // motionList.addAll(kernelService.shuttleCharge( |
| | | // null, |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // })) |
| | | // )); |
| | | if (task.getTaskSts() != TaskStsType.NEW_CHARGE.sts) { |
| | | return motionList; |
| | | } |
| | | |
| | | // locNo |
| | | String chargeLocNo = task.getDestLoc(); |
| | | |
| | | // shuttle |
| | | Device shuttleDevice = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceNo, task.getShuttleNo()) |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | | .eq(Device::getHostId, task.getHostId()) |
| | | .eq(Device::getStatus, 1)); |
| | | if (shuttleDevice == null) { |
| | | return motionList; |
| | | } |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleDevice.getId().intValue()); |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); |
| | | if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { |
| | | return motionList; |
| | | } |
| | | if (!shuttleThread.isIdle()) { |
| | | return motionList; |
| | | } |
| | | |
| | | String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | |
| | | // lift |
| | | Device transferLiftDevice = Utils.getRecentTransferLift(shuttleLocNo, shuttleProtocol.getShuttleNo()); |
| | | if (transferLiftDevice == null) { |
| | | return motionList; |
| | | } |
| | | LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, transferLiftDevice.getId().intValue()); |
| | | LiftProtocol liftProtocol = liftThread.getStatus(); |
| | | if (liftProtocol == null || liftProtocol.getLiftNo() == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | //检测穿梭车是否有任务绑定 |
| | | boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice); |
| | | if (shuttleResult) { |
| | | //存在任务,禁止解析 |
| | | return motionList; |
| | | } |
| | | |
| | | //检测提升机是否有任务绑定 |
| | | boolean liftResult = Utils.checkLiftHasBinding(Integer.parseInt(transferLiftDevice.getDeviceNo())); |
| | | if (liftResult) { |
| | | //存在任务,禁止解析 |
| | | return motionList; |
| | | } |
| | | |
| | | //获取小车待机库位 ==> 进提升机 |
| | | ShuttleStandby shuttleStandbyTo = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>() |
| | | .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId()) |
| | | .eq(ShuttleStandby::getDeviceLev, Utils.getLev(shuttleLocNo)) |
| | | .eq(ShuttleStandby::getStatus, 1)); |
| | | |
| | | //获取小车待机库位 ==> 出提升机 |
| | | ShuttleStandby shuttleStandbyFrom = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>() |
| | | .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId()) |
| | | .eq(ShuttleStandby::getDeviceLev, Utils.getLev(chargeLocNo)) |
| | | .eq(ShuttleStandby::getStatus, 1)); |
| | | if (shuttleStandbyTo == null || shuttleStandbyFrom == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | //穿梭车进提升机库位号 |
| | | String liftLocNoTo = shuttleStandbyTo.getDeviceLoc(); |
| | | |
| | | //穿梭车出提升机库位号 |
| | | String liftLocNoFrom = shuttleStandbyFrom.getDeviceLoc(); |
| | | |
| | | //穿梭车进提升机待机位库位号 |
| | | String standbyLocNoTo = shuttleStandbyTo.getDeviceStandbyLoc(); |
| | | |
| | | //穿梭车出提升机待机位库位号 |
| | | String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc(); |
| | | |
| | | // 判断穿梭车是否在充电层 |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(chargeLocNo)) { |
| | | |
| | | // 穿梭车走行至充电桩库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(chargeLocNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | } else { |
| | | |
| | | // 穿梭车走行至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | | motionList.addAll(kernelService.liftMove( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位至提升机库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | )); |
| | | |
| | | // 提升机搬车 至 输送线层 |
| | | motionList.addAll(kernelService.liftMoveShuttle( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(chargeLocNo)); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车提升机至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位至充电位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(chargeLocNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | task.setLiftNo(Integer.parseInt(transferLiftDevice.getDeviceNo())); |
| | | taskService.updateById(task); |
| | | } |
| | | |
| | | // 穿梭车开始充电 |
| | | motionList.addAll(kernelService.shuttleCharge( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | return motionList; |
| | | } |
| | |
| | | */ |
| | | public List<Motion> generateShuttleChargeWrkComplete(Task task) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | | // if (wrkCharge.getWrkSts() != WrkMastStsType.NEW_MOVE.sts || wrkCharge.getIoType() != WrkIoTypeType.MOVE.sts) { |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // // locNo |
| | | // String locNo = wrkCharge.getLocNo(); |
| | | // |
| | | // // shuttle |
| | | // Integer shuttleNo = wrkCharge.getShuttleNo(); |
| | | // ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo); |
| | | // ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | // if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | // |
| | | // // 判断穿梭车是否在目标层 |
| | | // if (Utils.getLev(shuttleLocNo) == Utils.getLev(locNo)) { |
| | | // |
| | | // // 穿梭车走行至目标库位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(shuttleLocNo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(locNo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // } |
| | | if (task.getTaskSts() != TaskStsType.NEW_MOVE.sts) { |
| | | return motionList; |
| | | } |
| | | |
| | | // locNo |
| | | String locNo = task.getDestLoc(); |
| | | |
| | | // shuttle |
| | | Device shuttleDevice = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceNo, task.getShuttleNo()) |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | | .eq(Device::getHostId, task.getHostId()) |
| | | .eq(Device::getStatus, 1)); |
| | | if (shuttleDevice == null) { |
| | | return motionList; |
| | | } |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleDevice.getId().intValue()); |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); |
| | | if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | |
| | | // 判断穿梭车是否在目标层 |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(locNo)) { |
| | | |
| | | // 穿梭车走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(locNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | } |
| | | return motionList; |
| | | } |
| | | |
| | |
| | | // 穿梭车走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setLocNo(locNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
New file |
| | |
| | | package com.zy.asrs.wcs.core.mapper; |
| | | |
| | | import com.zy.asrs.wcs.core.entity.BasLift; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface BasLiftMapper extends BaseMapper<BasLift> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.mapper; |
| | | |
| | | import com.zy.asrs.wcs.core.entity.ShuttleStandby; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface ShuttleStandbyMapper extends BaseMapper<ShuttleStandby> { |
| | | |
| | | } |
| | |
| | | |
| | | List<Task> selectWorkingByShuttle(Integer shuttleNo); |
| | | |
| | | List<Task> selectWorkingByLift(Integer liftNo); |
| | | |
| | | Task selectChargeWorking(Integer shuttleNo); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wcs.core.entity.BasLift; |
| | | |
| | | public interface BasLiftService extends IService<BasLift> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wcs.core.entity.ShuttleStandby; |
| | | |
| | | public interface ShuttleStandbyService extends IService<ShuttleStandby> { |
| | | |
| | | } |
| | |
| | | |
| | | List<Task> selectWorkingByShuttle(Integer shuttleNo); |
| | | |
| | | List<Task> selectWorkingByLift(Integer liftNo); |
| | | |
| | | Task selectChargeWorking(Integer shuttleNo); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.service.impl; |
| | | |
| | | import com.zy.asrs.wcs.core.mapper.BasLiftMapper; |
| | | import com.zy.asrs.wcs.core.entity.BasLift; |
| | | import com.zy.asrs.wcs.core.service.BasLiftService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("basLiftService") |
| | | public class BasLiftServiceImpl extends ServiceImpl<BasLiftMapper, BasLift> implements BasLiftService { |
| | | |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); |
| | | if (shuttleProtocol == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (!shuttleThread.isCharging()) { |
| | | continue; |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.service.impl; |
| | | |
| | | import com.zy.asrs.wcs.core.mapper.ShuttleStandbyMapper; |
| | | import com.zy.asrs.wcs.core.entity.ShuttleStandby; |
| | | import com.zy.asrs.wcs.core.service.ShuttleStandbyService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("shuttleStandbyService") |
| | | public class ShuttleStandbyServiceImpl extends ServiceImpl<ShuttleStandbyMapper, ShuttleStandby> implements ShuttleStandbyService { |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Task> selectWorkingByLift(Integer liftNo) { |
| | | return this.baseMapper.selectWorkingByLift(liftNo); |
| | | } |
| | | |
| | | @Override |
| | | public Task selectChargeWorking(Integer shuttleNo) { |
| | | return this.baseMapper.selectChargeWorking(shuttleNo); |
| | | } |
| | |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.SpringUtils; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wcs.core.entity.BasLift; |
| | | import com.zy.asrs.wcs.core.entity.Task; |
| | | import com.zy.asrs.wcs.core.entity.TaskSerialNo; |
| | | import com.zy.asrs.wcs.core.model.NavigateNode; |
| | | import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.NavigationMapType; |
| | | import com.zy.asrs.wcs.core.service.BasLiftService; |
| | | import com.zy.asrs.wcs.core.service.TaskSerialNoService; |
| | | import com.zy.asrs.wcs.core.service.TaskService; |
| | | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; |
| | |
| | | |
| | | //获取除白名单外的指定楼层全部穿梭车xy坐标点 |
| | | public static List<int[]> getShuttlePoints(Integer whiteShuttle, Integer lev) { |
| | | // SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class); |
| | | DeviceService deviceService = SpringUtils.getBean(DeviceService.class); |
| | | ArrayList<int[]> list = new ArrayList<>(); |
| | | // for (ShuttleSlave slave : slaveProperties.getShuttle()) { |
| | | // if (slave.getId().intValue() == whiteShuttle) { |
| | | // continue;//跳过白名单 |
| | | // } |
| | | // |
| | | // //获取穿梭车所在节点位置 |
| | | // ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId()); |
| | | // if (shuttleThread == null) { |
| | | // continue; |
| | | // } |
| | | // ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | // if (shuttleProtocol == null) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // if (shuttleProtocol.getCurrentLocNo() == null) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // if (lev != Utils.getLev(shuttleProtocol.getCurrentLocNo())) { |
| | | // continue;//楼层不同 |
| | | // } |
| | | // |
| | | // int[] xyPosition = NavigatePositionConvert.positionToXY(shuttleProtocol.getCurrentLocNo());//通过库位号获取xy坐标 |
| | | // list.add(xyPosition); |
| | | // } |
| | | |
| | | List<Device> devices = deviceService.list(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | | .eq(Device::getStatus, 1)); |
| | | for (Device device : devices) { |
| | | if (Integer.parseInt(device.getDeviceNo()) == whiteShuttle) { |
| | | continue;//跳过白名单 |
| | | } |
| | | |
| | | //获取穿梭车所在节点位置 |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue()); |
| | | if (shuttleThread == null) { |
| | | continue; |
| | | } |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); |
| | | if (shuttleProtocol == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (shuttleProtocol.getCurrentLocNo() == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (lev != Utils.getLev(shuttleProtocol.getCurrentLocNo())) { |
| | | continue;//楼层不同 |
| | | } |
| | | |
| | | int[] xyPosition = NavigatePositionConvert.positionToXY(shuttleProtocol.getCurrentLocNo());//通过库位号获取xy坐标 |
| | | list.add(xyPosition); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | |
| | | throw new CoolException("工作号生成失败"); |
| | | } |
| | | |
| | | /** |
| | | * 检测穿梭车是否有任务绑定 |
| | | */ |
| | | public static boolean checkShuttleHasBinding(Device device) { |
| | | TaskService taskService = SpringUtils.getBean(TaskService.class); |
| | | List<Task> tasks = taskService.selectWorkingByShuttle(Integer.parseInt(device.getDeviceNo())); |
| | | if (tasks.isEmpty()) { |
| | | return false;//无任务绑定 |
| | | } |
| | | return true;//有任务绑定 |
| | | } |
| | | |
| | | /** |
| | | * 检测提升机是否有任务绑定 |
| | | */ |
| | | public static boolean checkLiftHasBinding(Integer liftNo) { |
| | | TaskService taskService = SpringUtils.getBean(TaskService.class); |
| | | List<Task> tasks = taskService.selectWorkingByLift(liftNo); |
| | | if (tasks.isEmpty()) { |
| | | return false;//无任务绑定 |
| | | } |
| | | return true;//有任务绑定 |
| | | } |
| | | |
| | | /** |
| | | * 获取距离目标库位最近的提升机 |
| | | */ |
| | | public static Device getRecentTransferLift(String locNo, Integer shuttleNo) { |
| | | BasLiftService basLiftService = SpringUtils.getBean(BasLiftService.class); |
| | | DeviceService deviceService = SpringUtils.getBean(DeviceService.class); |
| | | if (basLiftService == null) { |
| | | return null; |
| | | } |
| | | |
| | | Integer distance = Integer.MAX_VALUE; |
| | | Long liftDeviceId = null; |
| | | for (BasLift basLift : basLiftService.list(new LambdaQueryWrapper<BasLift>() |
| | | .eq(BasLift::getStatus, 1) |
| | | .eq(BasLift::getTransfer, 1))) { |
| | | int lev = Utils.getLev(locNo); |
| | | String liftLocNo = Utils.getLocNo(basLift.getRow(), basLift.getBay(), lev); |
| | | List<NavigateNode> nodeList = NavigateUtils.calc(locNo, liftLocNo, NavigationMapType.NONE.id, Utils.getShuttlePoints(shuttleNo, Utils.getLev(locNo))); |
| | | Integer originPathAllDistance = NavigateUtils.getOriginPathAllDistance(nodeList);//总距离 |
| | | if (originPathAllDistance < distance) { |
| | | distance = originPathAllDistance; |
| | | liftDeviceId = basLift.getDeviceId(); |
| | | } |
| | | } |
| | | |
| | | if (liftDeviceId == null) { |
| | | return null; |
| | | } |
| | | |
| | | Device device = deviceService.getById(liftDeviceId); |
| | | if (device == null) { |
| | | return null; |
| | | } |
| | | return device; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.wcs.rcs.thread; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.wcs.asrs.entity.param.FlowLogicCodeParam; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.apache.commons.codec.digest.Md5Crypt; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | |
| | | public class FlowExecute { |
| | | |
| | | //执行流程图 |
| | | public boolean execute(List<FlowLogicCodeParam> list) { |
| | | for (FlowLogicCodeParam param : list) { |
| | | if (param.getId().equals("1")) { |
| | | return executeFlow(param.getLogicTrue()); |
| | | public boolean execute(List<JSONObject> list) { |
| | | String currentId = list.get(0).getString("id"); |
| | | |
| | | String listId = DigestUtils.md5Hex(JSON.toJSONString(list)); |
| | | |
| | | while (currentId != null) { |
| | | //获取流程图 |
| | | JSONObject flow = findFLow(list, currentId); |
| | | if (flow == null) { |
| | | break; |
| | | } |
| | | } |
| | | System.out.println(list); |
| | | return false; |
| | | } |
| | | |
| | | private boolean executeFlow(List<Map<String, Object>> list) { |
| | | for (Map<String, Object> map : list) { |
| | | JSONObject data = (JSONObject) map.get("data"); |
| | | if (data.getString("type").equals("devp")) { |
| | | JSONObject devp = data.getJSONObject("devpType"); |
| | | String devpNo = devp.getString("devpNo");//输送线PLC |
| | | String staNo = devp.getString("staNo");//站号 |
| | | Boolean enableStaStatus = devp.getBoolean("enableStaStatus");//判断站点状态 |
| | | JSONArray staStatus = devp.getJSONArray("staStatus");//站点状态列表 |
| | | String staJudgementFailExecute = devp.getString("staJudgementFailExecute");//判断失败后是否继续执行流程 |
| | | Boolean writeWorkNoStatus = devp.getBoolean("writeWorkNoStatus");//是否写入工作号 |
| | | Boolean writeStaNoStatus = devp.getBoolean("writeStaNoStatus");//是否写入目标站 |
| | | String writeWorkNo = devp.getString("writeWorkNo");//写入工作号数据 |
| | | String writeStaNo = devp.getString("writeStaNo");//写入目标站数据 |
| | | if (enableStaStatus) { |
| | | //判断站点状态 |
| | | boolean statusFlag = true;//默认判断通过 |
| | | for (Object status : staStatus) { |
| | | System.out.println(status); |
| | | } |
| | | //执行 |
| | | boolean result = executeFlow(flow, listId); |
| | | |
| | | if (!statusFlag) { |
| | | //判断不通过 |
| | | if (staJudgementFailExecute.equals("stop")) { |
| | | //判断失败后不继续执行 |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | if (writeWorkNoStatus) { |
| | | //写入工作号 |
| | | } |
| | | |
| | | if (writeStaNoStatus) { |
| | | //写入目标站 |
| | | } |
| | | System.out.println(devp); |
| | | //执行后续流程 |
| | | if (Cools.isEmpty(flow.get("nextTrue")) && Cools.isEmpty(flow.get("nextFalse"))) { |
| | | break;//无后续流程 |
| | | } |
| | | System.out.println(data); |
| | | |
| | | //更新id |
| | | currentId = result ? flow.getString("nextTrue") : flow.getString("nextFalse"); |
| | | } |
| | | |
| | | System.out.println(list); |
| | | return false; |
| | | System.out.println("执行完成"); |
| | | return true; |
| | | } |
| | | |
| | | private boolean executeFlow(JSONObject flow, String listId) { |
| | | System.out.println(flow.getString("id") + "被执行"); |
| | | String type = flow.getString("type"); |
| | | if (type.equals("devp")) { |
| | | |
| | | } else if (type.equals("shuttle")) { |
| | | |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | private JSONObject findFLow(List<JSONObject> list, String id) { |
| | | for (JSONObject flow : list) { |
| | | if (flow.getString("id").equals(id)) { |
| | | return flow; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | // private boolean executeFlow(List<Map<String, Object>> list) { |
| | | // for (Map<String, Object> map : list) { |
| | | // JSONObject data = (JSONObject) map.get("data"); |
| | | // if (data.getString("type").equals("devp")) { |
| | | // JSONObject devp = data.getJSONObject("devpType"); |
| | | // String devpNo = devp.getString("devpNo");//输送线PLC |
| | | // String staNo = devp.getString("staNo");//站号 |
| | | // Boolean enableStaStatus = devp.getBoolean("enableStaStatus");//判断站点状态 |
| | | // JSONArray staStatus = devp.getJSONArray("staStatus");//站点状态列表 |
| | | // String staJudgementFailExecute = devp.getString("staJudgementFailExecute");//判断失败后是否继续执行流程 |
| | | // Boolean writeWorkNoStatus = devp.getBoolean("writeWorkNoStatus");//是否写入工作号 |
| | | // Boolean writeStaNoStatus = devp.getBoolean("writeStaNoStatus");//是否写入目标站 |
| | | // String writeWorkNo = devp.getString("writeWorkNo");//写入工作号数据 |
| | | // String writeStaNo = devp.getString("writeStaNo");//写入目标站数据 |
| | | // if (enableStaStatus) { |
| | | // //判断站点状态 |
| | | // boolean statusFlag = true;//默认判断通过 |
| | | // for (Object status : staStatus) { |
| | | // System.out.println(status); |
| | | // } |
| | | // |
| | | // if (!statusFlag) { |
| | | // //判断不通过 |
| | | // if (staJudgementFailExecute.equals("stop")) { |
| | | // //判断失败后不继续执行 |
| | | // return false; |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | // |
| | | // if (writeWorkNoStatus) { |
| | | // //写入工作号 |
| | | // } |
| | | // |
| | | // if (writeStaNoStatus) { |
| | | // //写入目标站 |
| | | // } |
| | | // System.out.println(devp); |
| | | // } |
| | | // System.out.println(data); |
| | | // } |
| | | // |
| | | // System.out.println(list); |
| | | // return false; |
| | | // } |
| | | |
| | | } |
New file |
| | |
| | | -- save shuttleStandby record |
| | | -- mysql |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `host_id`, `status`) values ( '穿梭车待机位管理', '0', '/core/shuttleStandby', '/core/shuttleStandby', '0' , '0', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '查询穿梭车待机位', '', '1', 'core:shuttleStandby:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '添加穿梭车待机位', '', '1', 'core:shuttleStandby:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '修改穿梭车待机位', '', '1', 'core:shuttleStandby:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '删除穿梭车待机位', '', '1', 'core:shuttleStandby:remove', '3', '1', '1'); |
| | | |
New file |
| | |
| | | <?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.BasLiftMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?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.ShuttleStandbyMapper"> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | <select id="selectWorkingByShuttle" resultType="com.zy.asrs.wcs.core.entity.Task"> |
| | | select * from wcs_task |
| | | where task_sts in (1,2,3,101,102,103,201,202,203,204,301,302,303,401,402,403) |
| | | where task_sts in (1,2,3,101,102,103,301,302,303,401,402,403) |
| | | and shuttle_no = #{shuttleNo} |
| | | order by priority desc,start_time,task_no asc |
| | | </select> |
| | | |
| | | <select id="selectWorkingByLift" resultType="com.zy.asrs.wcs.core.entity.Task"> |
| | | select * from wcs_task |
| | | where task_sts in (1,2,3,101,102,103,301,302,303,401,402,403) |
| | | and lift_no = #{liftNo} |
| | | order by priority desc,start_time,task_no asc |
| | | </select> |
| | | |
| | | <select id="selectChargeWorking" resultType="com.zy.asrs.wcs.core.entity.Task"> |
| | | select * from wcs_task |
| | | where task_sts in (201,202,203,204) |