14个文件已修改
29个文件已添加
1 文件已重命名
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="conveyorNo" |
| | | label="输送线号" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | rules={[{ required: true }]} |
| | | /> |
| | | </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 }} |
| | | /> |
| | | <ProFormText |
| | | name="inSta" |
| | | label="入库站点列表" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormText |
| | | name="emptyInSta" |
| | | label="空板入库站点列表" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | <ProFormText |
| | | name="pickInSta" |
| | | label="拣料入库站点列表" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormText |
| | | name="outSta" |
| | | label="出库站点列表" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | <ProFormText |
| | | name="emptyOutSta" |
| | | label="空板出库站点列表" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormText |
| | | name="pickOutSta" |
| | | 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-basConveyor'; |
| | | |
| | | const handleSave = async (val, intl) => { |
| | | const hide = message.loading(intl.formatMessage({ id: 'page.adding', defaultMessage: '正在添加' })); |
| | | try { |
| | | const resp = await Http.doPost('api/basConveyor/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/basConveyor/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/basConveyor/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/basConveyor/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: 'conveyorNo', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | copyable: true, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='conveyorNo' |
| | | {...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: 'inSta', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='inSta' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '空板入库站点列表', |
| | | dataIndex: 'emptyInSta', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='emptyInSta' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '拣料入库站点列表', |
| | | dataIndex: 'pickInSta', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='pickInSta' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '出库站点列表', |
| | | dataIndex: 'outSta', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='outSta' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '空板出库站点列表', |
| | | dataIndex: 'emptyOutSta', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='emptyOutSta' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '拣料出库站点列表', |
| | | dataIndex: 'pickOutSta', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='pickOutSta' |
| | | {...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="basConveyor" |
| | | 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/basConveyor/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> |
| | | <ProFormSelect |
| | | name="conveyorId" |
| | | label="输送线id" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | showSearch |
| | | debounceTime={300} |
| | | request={async ({ keyWords }) => { |
| | | const resp = await Http.doPostForm('api/basConveyor/query', { condition: keyWords }); |
| | | return resp.data; |
| | | }} |
| | | /> |
| | | <ProFormDigit |
| | | name="conveyorNo" |
| | | label="输送线号" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | rules={[{ required: true }]} |
| | | /> |
| | | </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="siteNo" |
| | | label="输送站号" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormText |
| | | name="inEnable" |
| | | label="可入(checkBox)" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | <ProFormText |
| | | name="outEnable" |
| | | label="可出(checkBox)" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormText |
| | | name="autoing" |
| | | label="自动(checkBox)" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | <ProFormText |
| | | name="loading" |
| | | label="有物(checkBox)" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormText |
| | | name="canining" |
| | | label="能入(checkBox)" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | <ProFormText |
| | | name="canouting" |
| | | label="能出(checkBox)" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormSelect |
| | | name="locType1" |
| | | label="高低类型" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | options={[ |
| | | { label: '未知', value: 0 }, |
| | | { label: '低库位', value: 1 }, |
| | | { label: '高库位', value: 2 }, |
| | | ]} |
| | | /> |
| | | <ProFormSelect |
| | | name="locType2" |
| | | label="宽窄类型" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | options={[ |
| | | { label: '未知', value: 0 }, |
| | | { label: '窄库位', value: 1 }, |
| | | { label: '宽库位', value: 2 }, |
| | | ]} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormSelect |
| | | name="locType3" |
| | | label="轻重类型" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | options={[ |
| | | { label: '未知', value: 0 }, |
| | | { label: '轻库位', value: 1 }, |
| | | { label: '重库位', value: 2 }, |
| | | ]} |
| | | /> |
| | | <ProFormText |
| | | name="locNo" |
| | | label="库位号" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormText |
| | | name="qrCodeValue" |
| | | 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-basConveyorSta'; |
| | | |
| | | const handleSave = async (val, intl) => { |
| | | const hide = message.loading(intl.formatMessage({ id: 'page.adding', defaultMessage: '正在添加' })); |
| | | try { |
| | | const resp = await Http.doPost('api/basConveyorSta/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/basConveyorSta/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/basConveyorSta/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/basConveyorSta/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: 'conveyorId$', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <LinkFilter |
| | | name='conveyorId' |
| | | major='basConveyor' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '输送线号', |
| | | dataIndex: 'conveyorNo', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | copyable: true, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='conveyorNo' |
| | | {...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: 'siteNo', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='siteNo' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '可入(checkBox)', |
| | | dataIndex: 'inEnable', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='inEnable' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '可出(checkBox)', |
| | | dataIndex: 'outEnable', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='outEnable' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '自动(checkBox)', |
| | | dataIndex: 'autoing', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='autoing' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '有物(checkBox)', |
| | | dataIndex: 'loading', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='loading' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '能入(checkBox)', |
| | | dataIndex: 'canining', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='canining' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '能出(checkBox)', |
| | | dataIndex: 'canouting', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='canouting' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '高低类型', |
| | | dataIndex: 'locType1$', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <SelectFilter |
| | | name='locType1' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | data={[ |
| | | { label: '未知', value: 0 }, |
| | | { label: '低库位', value: 1 }, |
| | | { label: '高库位', value: 2 }, |
| | | ]} |
| | | />, |
| | | }, |
| | | { |
| | | title: '宽窄类型', |
| | | dataIndex: 'locType2$', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <SelectFilter |
| | | name='locType2' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | data={[ |
| | | { label: '未知', value: 0 }, |
| | | { label: '窄库位', value: 1 }, |
| | | { label: '宽库位', value: 2 }, |
| | | ]} |
| | | />, |
| | | }, |
| | | { |
| | | title: '轻重类型', |
| | | dataIndex: 'locType3$', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <SelectFilter |
| | | name='locType3' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | data={[ |
| | | { label: '未知', value: 0 }, |
| | | { label: '轻库位', value: 1 }, |
| | | { label: '重库位', value: 2 }, |
| | | ]} |
| | | />, |
| | | }, |
| | | { |
| | | title: '库位号', |
| | | dataIndex: 'locNo', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='locNo' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '四向穿梭车所识别的二维码', |
| | | dataIndex: 'qrCodeValue', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='qrCodeValue' |
| | | {...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="basConveyorSta" |
| | | 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/basConveyorSta/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> |
| | | <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="ledNo" |
| | | label="LED显示屏号" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | rules={[{ required: true }]} |
| | | /> |
| | | </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 }} |
| | | /> |
| | | <ProFormText |
| | | name="sta" |
| | | label="显示屏站点号" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormSelect |
| | | name="conveyorId" |
| | | label="输送线id" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | showSearch |
| | | debounceTime={300} |
| | | request={async ({ keyWords }) => { |
| | | const resp = await Http.doPostForm('api/basConveyor/query', { condition: keyWords }); |
| | | return resp.data; |
| | | }} |
| | | /> |
| | | </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-basLed'; |
| | | |
| | | const handleSave = async (val, intl) => { |
| | | const hide = message.loading(intl.formatMessage({ id: 'page.adding', defaultMessage: '正在添加' })); |
| | | try { |
| | | const resp = await Http.doPost('api/basLed/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/basLed/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/basLed/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/basLed/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: 'LED显示屏号', |
| | | dataIndex: 'ledNo', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | copyable: true, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='ledNo' |
| | | {...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: 'sta', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='sta' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '输送线id', |
| | | dataIndex: 'conveyorId$', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <LinkFilter |
| | | name='conveyorId' |
| | | major='basConveyor' |
| | | {...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="basLed" |
| | | 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/basLed/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; |
| | |
| | | } |
| | | } |
| | | |
| | | const shuttleMoveLocClose = async () => { |
| | | try { |
| | | const resp = await Http.doPost('api/basShuttle/moveLocClose', { |
| | | shuttleNo: currentData.shuttleNo, |
| | | }); |
| | | if (resp.code === 200) { |
| | | message.success("请求成功"); |
| | | return true; |
| | | } else { |
| | | message.warning(resp.msg); |
| | | return false; |
| | | } |
| | | } catch (error) { |
| | | message.warning("请求失败"); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | const xStartChange = (e) => { |
| | | setXStart(e.target.value) |
| | | } |
| | |
| | | /> |
| | | </div> |
| | | <Button onClick={() => shuttleMoveLoc()}>跑库</Button> |
| | | <Button onClick={() => shuttleMoveLocClose()}>跑库关闭</Button> |
| | | </div> |
| | | </Card> |
| | | </div> |
| | |
| | | } |
| | | } |
| | | |
| | | const shuttleMoveLocClose = async () => { |
| | | try { |
| | | const resp = await Http.doPost('api/basShuttle/moveLocClose', { |
| | | shuttleNo: currentData.shuttleNo, |
| | | }); |
| | | if (resp.code === 200) { |
| | | message.success("请求成功"); |
| | | return true; |
| | | } else { |
| | | message.warning(resp.msg); |
| | | return false; |
| | | } |
| | | } catch (error) { |
| | | message.warning("请求失败"); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <> |
| | | <Drawer |
| | |
| | | /> |
| | | </div> |
| | | <Button onClick={() => shuttleMoveLoc()}>跑库</Button> |
| | | <Button onClick={() => shuttleMoveLocClose()}>跑库关闭</Button> |
| | | </div> |
| | | </Card> |
| | | </div> |
| | |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | ellipsis: true, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='value' |
| | | {...props} |
| | |
| | | } |
| | | |
| | | // 入库 ===>> 入库站到堆垛机站,根据条码扫描生成入库工作档 |
| | | // mainService.generateInboundWrk(); // 组托 |
| | | mainService.generateInboundWrk(); // 组托 |
| | | |
| | | // 间隔 |
| | | Thread.sleep(500); |
| | |
| | | // mainService.recErr(); |
| | | // // 入库 ===>> 空栈板初始化入库,叉车入库站放货 |
| | | // mainService.storeEmptyPlt(); |
| | | // // 出库 ===>> 工作档信息写入led显示器 |
| | | // mainService.ledExecute(); |
| | | // // 其他 ===>> LED显示器复位,显示默认信息 |
| | | // mainService.ledReset(); |
| | | // 出库 ===>> 工作档信息写入led显示器 |
| | | mainService.ledExecute(); |
| | | // 其他 ===>> LED显示器复位,显示默认信息 |
| | | mainService.ledReset(); |
| | | // 穿梭车 ===>> 小车电量检测充电 |
| | | mainService.loopShuttleCharge(); |
| | | // 穿梭车 ===>> 小车电量满电后回待机位 |
| | |
| | | import com.zy.asrs.wcs.core.model.enums.ShuttleTaskModeType; |
| | | import com.zy.asrs.wcs.core.service.BasShuttleService; |
| | | import com.zy.asrs.wcs.core.service.LocService; |
| | | import com.zy.asrs.wcs.core.utils.NavigateMapUtils; |
| | | import com.zy.asrs.wcs.core.utils.RedisUtil; |
| | | import com.zy.asrs.wcs.core.utils.ShuttleDispatcher; |
| | | import com.zy.asrs.wcs.core.utils.Utils; |
| | | import com.zy.asrs.wcs.core.utils.*; |
| | | import com.zy.asrs.wcs.rcs.News; |
| | | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; |
| | | import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant; |
| | |
| | | import com.zy.asrs.wcs.rcs.model.enums.SlaveType; |
| | | import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol; |
| | | import com.zy.asrs.wcs.rcs.thread.ShuttleThread; |
| | | import com.zy.asrs.wcs.system.entity.Dict; |
| | | import com.zy.asrs.wcs.system.service.DictService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | private ShuttleDispatcher shuttleDispatcher; |
| | | @Autowired |
| | | private ObjectMapper objectMapper; |
| | | @Autowired |
| | | private DictService dictService; |
| | | @Autowired |
| | | private ConveyorDispatcher conveyorDispatcher; |
| | | |
| | | public synchronized boolean assignWork(Device device, ShuttleAssignCommand assignCommand) { |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue()); |
| | |
| | | } |
| | | |
| | | int lev = Utils.getLev(shuttleProtocol.getCurrentLocNo());//小车当前楼层 |
| | | if (shuttleProtocol.getYCurrent() > shuttleProtocol.getYTarget()) { |
| | | //跑库结束 |
| | | shuttleProtocol.setMoveLoc(false); |
| | | shuttleProtocol.setMoveType(0); |
| | | shuttleProtocol.setXStart(0); |
| | | shuttleProtocol.setXTarget(0); |
| | | shuttleProtocol.setXCurrent(0); |
| | | shuttleProtocol.setYStart(0); |
| | | shuttleProtocol.setYTarget(0); |
| | | shuttleProtocol.setYCurrent(0); |
| | | return; |
| | | } |
| | | |
| | | if (shuttleProtocol.getMoveType() == 0) {//跑轨道 |
| | | Integer xCurrent = shuttleProtocol.getXCurrent(); |
| | | if (xCurrent > shuttleProtocol.getXTarget()) {//当X值大于X目标值,进行归零且Y方向+1 |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXStart()); |
| | | shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1); |
| | | //根据地图方向决定跑x或y |
| | | Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>() |
| | | .eq(Dict::getFlag, "direction_map") |
| | | .eq(Dict::getStatus, 1)); |
| | | if (dict == null) { |
| | | //跑库结束 |
| | | shuttleProtocol.setMoveLoc(false); |
| | | shuttleProtocol.setMoveType(0); |
| | | shuttleProtocol.setXStart(0); |
| | | shuttleProtocol.setXTarget(0); |
| | | shuttleProtocol.setXCurrent(0); |
| | | shuttleProtocol.setYStart(0); |
| | | shuttleProtocol.setYTarget(0); |
| | | shuttleProtocol.setYCurrent(0); |
| | | return; |
| | | } |
| | | String direction = dict.getValue(); |
| | | |
| | | Integer yCurrent = shuttleProtocol.getYCurrent(); |
| | | String locNo = Utils.getLocNo(xCurrent, yCurrent, lev); |
| | | Loc target = locService.getOne(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getLocNo, locNo) |
| | | .eq(Loc::getHostId, device.getHostId())); |
| | | if (target == null) { |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1); |
| | | return; |
| | | } |
| | | |
| | | // if (!target.getLocSts().equals("O")) { |
| | | // shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1); |
| | | // return; |
| | | // } |
| | | |
| | | //调度去目标位置 |
| | | if (shuttleProtocol.getCurrentLocNo().equals(target.getLocNo())) { |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1);//小车和目标位置一致,跳过 |
| | | } else { |
| | | shuttleDispatcher.generateMoveTask(device, target.getLocNo()); |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1); |
| | | } |
| | | } else if (shuttleProtocol.getMoveType() == 1) {//跑库位 |
| | | ArrayList<String> locs = new ArrayList<>(); |
| | | for (int i = shuttleProtocol.getXCurrent(); i <= shuttleProtocol.getXTarget(); i++) { |
| | | String locNo = Utils.getLocNo(i, shuttleProtocol.getYCurrent(), lev); |
| | | locs.add(locNo); |
| | | } |
| | | |
| | | List<Loc> locList = locService.list(new LambdaQueryWrapper<Loc>() |
| | | .in(Loc::getLocNo, locs)); |
| | | if (locList.isEmpty()) { |
| | | //空库位 |
| | | shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1); |
| | | return; |
| | | } |
| | | |
| | | Loc start = locList.get(0); |
| | | Loc target = locList.get(locList.size() - 1); |
| | | //判断小车是否在起点位置 |
| | | if (!shuttleProtocol.getCurrentLocNo().equals(start.getLocNo())) {//不在起点位置,调度去起点位置 |
| | | shuttleDispatcher.generateMoveTask(device, start.getLocNo()); |
| | | }else { |
| | | //在起点位置,调度去目标位置 |
| | | if (shuttleProtocol.getCurrentLocNo().equals(target.getLocNo())) { |
| | | shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1);//小车和目标位置一致,跳过 |
| | | }else { |
| | | shuttleDispatcher.generateMoveTask(device, start.getLocNo()); |
| | | shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1); |
| | | if (direction.equals("y")) {//跑x轴方向,跑完x轴再切换y轴 |
| | | ArrayList<String> locs = new ArrayList<>(); |
| | | for (int i = shuttleProtocol.getXCurrent(); i <= shuttleProtocol.getXTarget(); i++) { |
| | | String locNo = Utils.getLocNo(i, shuttleProtocol.getYCurrent(), lev); |
| | | locs.add(locNo); |
| | | } |
| | | |
| | | List<Loc> locList = locService.list(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getLocSts, LocStsType.O.val()) |
| | | .in(Loc::getLocNo, locs)); |
| | | if (locList.isEmpty()) { |
| | | //空库位 |
| | | shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1); |
| | | return; |
| | | } |
| | | |
| | | Loc start = locList.get(0); |
| | | Loc target = locList.get(locList.size() - 1); |
| | | //判断小车是否在起点位置 |
| | | if (!shuttleProtocol.getCurrentLocNo().equals(start.getLocNo())) {//不在起点位置,调度去起点位置 |
| | | shuttleDispatcher.generateMoveTask(device, start.getLocNo()); |
| | | }else { |
| | | //在起点位置,调度去目标位置 |
| | | shuttleDispatcher.generateMoveTask(device, target.getLocNo()); |
| | | shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1);//切换y轴 |
| | | |
| | | if(shuttleProtocol.getYCurrent() > shuttleProtocol.getYTarget()) { |
| | | //y轴也跑完了,结束跑库 |
| | | shuttleProtocol.setMoveLoc(false); |
| | | shuttleProtocol.setMoveType(0); |
| | | shuttleProtocol.setXStart(0); |
| | | shuttleProtocol.setXTarget(0); |
| | | shuttleProtocol.setXCurrent(0); |
| | | shuttleProtocol.setYStart(0); |
| | | shuttleProtocol.setYTarget(0); |
| | | shuttleProtocol.setYCurrent(0); |
| | | return; |
| | | } |
| | | } |
| | | }else {//跑y轴方向,跑完y轴再切换x轴 |
| | | ArrayList<String> locs = new ArrayList<>(); |
| | | for (int i = shuttleProtocol.getYCurrent(); i <= shuttleProtocol.getYTarget(); i++) { |
| | | String locNo = Utils.getLocNo(shuttleProtocol.getXCurrent(), i, lev); |
| | | locs.add(locNo); |
| | | } |
| | | |
| | | List<Loc> locList = locService.list(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getLocSts, LocStsType.O.val()) |
| | | .in(Loc::getLocNo, locs)); |
| | | if (locList.isEmpty()) { |
| | | //空库位 |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1); |
| | | return; |
| | | } |
| | | |
| | | Loc start = locList.get(0); |
| | | Loc target = locList.get(locList.size() - 1); |
| | | //判断小车是否在起点位置 |
| | | if (!shuttleProtocol.getCurrentLocNo().equals(start.getLocNo())) {//不在起点位置,调度去起点位置 |
| | | shuttleDispatcher.generateMoveTask(device, start.getLocNo()); |
| | | }else { |
| | | //在起点位置,调度去目标位置 |
| | | shuttleDispatcher.generateMoveTask(device, target.getLocNo()); |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1);//切换x轴 |
| | | |
| | | if(shuttleProtocol.getXCurrent() > shuttleProtocol.getXTarget()) { |
| | | //y轴也跑完了,结束跑库 |
| | | shuttleProtocol.setMoveLoc(false); |
| | | shuttleProtocol.setMoveType(0); |
| | | shuttleProtocol.setXStart(0); |
| | | shuttleProtocol.setXTarget(0); |
| | | shuttleProtocol.setXCurrent(0); |
| | | shuttleProtocol.setYStart(0); |
| | | shuttleProtocol.setYTarget(0); |
| | | shuttleProtocol.setYCurrent(0); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } else if (shuttleProtocol.getMoveType() == 1) {//跑库位 |
| | | //根据地图方向决定跑x或y |
| | | Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>() |
| | | .eq(Dict::getFlag, "direction_map") |
| | | .eq(Dict::getStatus, 1)); |
| | | if (dict == null) { |
| | | //跑库结束 |
| | | shuttleProtocol.setMoveLoc(false); |
| | | shuttleProtocol.setMoveType(0); |
| | | shuttleProtocol.setXStart(0); |
| | | shuttleProtocol.setXTarget(0); |
| | | shuttleProtocol.setXCurrent(0); |
| | | shuttleProtocol.setYStart(0); |
| | | shuttleProtocol.setYTarget(0); |
| | | shuttleProtocol.setYCurrent(0); |
| | | return; |
| | | } |
| | | String direction = dict.getValue(); |
| | | |
| | | if (direction.equals("y")) {//跑x轴方向,跑完x轴再切换y轴 |
| | | Integer xCurrent = shuttleProtocol.getXCurrent(); |
| | | |
| | | //获取待跑库位号 |
| | | String locNo = Utils.getLocNo(xCurrent, shuttleProtocol.getYCurrent(), lev); |
| | | Loc target = locService.getOne(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getLocNo, locNo) |
| | | .eq(Loc::getLocSts, LocStsType.O.val()) |
| | | .eq(Loc::getHostId, device.getHostId())); |
| | | if (target == null || shuttleProtocol.getCurrentLocNo().equals(locNo)) {//库位不存在或小车已在当前位置 |
| | | shuttleProtocol.setXCurrent(xCurrent + 1); |
| | | if (shuttleProtocol.getXCurrent() > shuttleProtocol.getXTarget()) { |
| | | //x轴跑完,切换y轴 |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXStart()); |
| | | shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1); |
| | | |
| | | if(shuttleProtocol.getYCurrent() > shuttleProtocol.getYTarget()) { |
| | | //y轴也跑完了,结束跑库 |
| | | shuttleProtocol.setMoveLoc(false); |
| | | shuttleProtocol.setMoveType(0); |
| | | shuttleProtocol.setXStart(0); |
| | | shuttleProtocol.setXTarget(0); |
| | | shuttleProtocol.setXCurrent(0); |
| | | shuttleProtocol.setYStart(0); |
| | | shuttleProtocol.setYTarget(0); |
| | | shuttleProtocol.setYCurrent(0); |
| | | return; |
| | | } |
| | | } |
| | | return; |
| | | } |
| | | |
| | | //调度去库位 |
| | | Task task = shuttleDispatcher.generateMoveTask(device, locNo); |
| | | if (task == null) { |
| | | return;//调度失败 |
| | | } |
| | | |
| | | shuttleProtocol.setXCurrent(xCurrent + 1); |
| | | if (shuttleProtocol.getXCurrent() > shuttleProtocol.getXTarget()) { |
| | | //x轴跑完,切换y轴 |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXStart()); |
| | | shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1); |
| | | |
| | | if(shuttleProtocol.getYCurrent() > shuttleProtocol.getYTarget()) { |
| | | //y轴也跑完了,结束跑库 |
| | | shuttleProtocol.setMoveLoc(false); |
| | | shuttleProtocol.setMoveType(0); |
| | | shuttleProtocol.setXStart(0); |
| | | shuttleProtocol.setXTarget(0); |
| | | shuttleProtocol.setXCurrent(0); |
| | | shuttleProtocol.setYStart(0); |
| | | shuttleProtocol.setYTarget(0); |
| | | shuttleProtocol.setYCurrent(0); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | }else {//跑y轴方向,跑完y轴再切换x轴 |
| | | Integer yCurrent = shuttleProtocol.getYCurrent(); |
| | | |
| | | //获取待跑库位号 |
| | | String locNo = Utils.getLocNo(shuttleProtocol.getXCurrent(), yCurrent, lev); |
| | | Loc target = locService.getOne(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getLocNo, locNo) |
| | | .eq(Loc::getLocSts, LocStsType.O.val()) |
| | | .eq(Loc::getHostId, device.getHostId())); |
| | | if (target == null || shuttleProtocol.getCurrentLocNo().equals(locNo)) {//库位不存在或小车已在当前位置 |
| | | shuttleProtocol.setYCurrent(yCurrent + 1); |
| | | if (shuttleProtocol.getYCurrent() > shuttleProtocol.getYTarget()) { |
| | | //y轴跑完,切换x轴 |
| | | shuttleProtocol.setYCurrent(shuttleProtocol.getYStart()); |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1); |
| | | |
| | | if(shuttleProtocol.getXCurrent() > shuttleProtocol.getXTarget()) { |
| | | //x轴也跑完了,结束跑库 |
| | | shuttleProtocol.setMoveLoc(false); |
| | | shuttleProtocol.setMoveType(0); |
| | | shuttleProtocol.setXStart(0); |
| | | shuttleProtocol.setXTarget(0); |
| | | shuttleProtocol.setXCurrent(0); |
| | | shuttleProtocol.setYStart(0); |
| | | shuttleProtocol.setYTarget(0); |
| | | shuttleProtocol.setYCurrent(0); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //调度去库位 |
| | | Task task = shuttleDispatcher.generateMoveTask(device, locNo); |
| | | if (task == null) { |
| | | return;//调度失败 |
| | | } |
| | | |
| | | shuttleProtocol.setYCurrent(yCurrent + 1); |
| | | if (shuttleProtocol.getYCurrent() > shuttleProtocol.getYTarget()) { |
| | | //y轴跑完,切换x轴 |
| | | shuttleProtocol.setYCurrent(shuttleProtocol.getYStart()); |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1); |
| | | |
| | | if(shuttleProtocol.getXCurrent() > shuttleProtocol.getXTarget()) { |
| | | //x轴也跑完了,结束跑库 |
| | | shuttleProtocol.setMoveLoc(false); |
| | | shuttleProtocol.setMoveType(0); |
| | | shuttleProtocol.setXStart(0); |
| | | shuttleProtocol.setXTarget(0); |
| | | shuttleProtocol.setXCurrent(0); |
| | | shuttleProtocol.setYStart(0); |
| | | shuttleProtocol.setYTarget(0); |
| | | shuttleProtocol.setYCurrent(0); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } else if (shuttleProtocol.getMoveType() == 2) {//母轨道循环跑 |
| | | Integer xCurrent = shuttleProtocol.getXCurrent(); |
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.BasConveyor; |
| | | import com.zy.asrs.wcs.core.service.BasConveyorService; |
| | | 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 BasConveyorController extends BaseController { |
| | | |
| | | @Autowired |
| | | private BasConveyorService basConveyorService; |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyor:list')") |
| | | @PostMapping("/basConveyor/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<BasConveyor, BaseParam> pageParam = new PageParam<>(baseParam, BasConveyor.class); |
| | | return R.ok().add(basConveyorService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyor:list')") |
| | | @PostMapping("/basConveyor/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(basConveyorService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyor:list')") |
| | | @GetMapping("/basConveyor/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(basConveyorService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyor:save')") |
| | | @OperationLog("添加输送线配置") |
| | | @PostMapping("/basConveyor/save") |
| | | public R save(@RequestBody BasConveyor basConveyor) { |
| | | if (!basConveyorService.save(basConveyor)) { |
| | | return R.error("添加失败"); |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyor:update')") |
| | | @OperationLog("修改输送线配置") |
| | | @PostMapping("/basConveyor/update") |
| | | public R update(@RequestBody BasConveyor basConveyor) { |
| | | if (!basConveyorService.updateById(basConveyor)) { |
| | | return R.error("修改失败"); |
| | | } |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyor:remove')") |
| | | @OperationLog("删除输送线配置") |
| | | @PostMapping("/basConveyor/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!basConveyorService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("删除失败"); |
| | | } |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyor:list')") |
| | | @PostMapping("/basConveyor/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<BasConveyor> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(BasConveyor::getConveyorNo, condition); |
| | | } |
| | | basConveyorService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getDeviceId(), item.getConveyorNo() + "输送线[id:" + item.getDeviceId() + "]")) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyor:list')") |
| | | @PostMapping("/basConveyor/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(basConveyorService.list(), BasConveyor.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.BasConveyorSta; |
| | | import com.zy.asrs.wcs.core.service.BasConveyorStaService; |
| | | 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 BasConveyorStaController extends BaseController { |
| | | |
| | | @Autowired |
| | | private BasConveyorStaService basConveyorStaService; |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyorSta:list')") |
| | | @PostMapping("/basConveyorSta/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<BasConveyorSta, BaseParam> pageParam = new PageParam<>(baseParam, BasConveyorSta.class); |
| | | return R.ok().add(basConveyorStaService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyorSta:list')") |
| | | @PostMapping("/basConveyorSta/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(basConveyorStaService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyorSta:list')") |
| | | @GetMapping("/basConveyorSta/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(basConveyorStaService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyorSta:save')") |
| | | @OperationLog("添加输送站点配置") |
| | | @PostMapping("/basConveyorSta/save") |
| | | public R save(@RequestBody BasConveyorSta basConveyorSta) { |
| | | if (!basConveyorStaService.save(basConveyorSta)) { |
| | | return R.error("添加失败"); |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyorSta:update')") |
| | | @OperationLog("修改输送站点配置") |
| | | @PostMapping("/basConveyorSta/update") |
| | | public R update(@RequestBody BasConveyorSta basConveyorSta) { |
| | | if (!basConveyorStaService.updateById(basConveyorSta)) { |
| | | return R.error("修改失败"); |
| | | } |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyorSta:remove')") |
| | | @OperationLog("删除输送站点配置") |
| | | @PostMapping("/basConveyorSta/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!basConveyorStaService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("删除失败"); |
| | | } |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyorSta:list')") |
| | | @PostMapping("/basConveyorSta/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<BasConveyorSta> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(BasConveyorSta::getConveyorNo, condition); |
| | | } |
| | | basConveyorStaService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getConveyorNo())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basConveyorSta:list')") |
| | | @PostMapping("/basConveyorSta/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(basConveyorStaService.list(), BasConveyorSta.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.BasLed; |
| | | import com.zy.asrs.wcs.core.service.BasLedService; |
| | | 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 BasLedController extends BaseController { |
| | | |
| | | @Autowired |
| | | private BasLedService basLedService; |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLed:list')") |
| | | @PostMapping("/basLed/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<BasLed, BaseParam> pageParam = new PageParam<>(baseParam, BasLed.class); |
| | | return R.ok().add(basLedService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLed:list')") |
| | | @PostMapping("/basLed/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(basLedService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLed:list')") |
| | | @GetMapping("/basLed/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(basLedService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLed:save')") |
| | | @OperationLog("添加LED显示屏配置") |
| | | @PostMapping("/basLed/save") |
| | | public R save(@RequestBody BasLed basLed) { |
| | | if (!basLedService.save(basLed)) { |
| | | return R.error("添加失败"); |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLed:update')") |
| | | @OperationLog("修改LED显示屏配置") |
| | | @PostMapping("/basLed/update") |
| | | public R update(@RequestBody BasLed basLed) { |
| | | if (!basLedService.updateById(basLed)) { |
| | | return R.error("修改失败"); |
| | | } |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLed:remove')") |
| | | @OperationLog("删除LED显示屏配置") |
| | | @PostMapping("/basLed/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!basLedService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("删除失败"); |
| | | } |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLed:list')") |
| | | @PostMapping("/basLed/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<BasLed> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(BasLed::getLedNo, condition); |
| | | } |
| | | basLedService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getLedNo())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('core:basLed:list')") |
| | | @PostMapping("/basLed/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(basLedService.list(), BasLed.class), response); |
| | | } |
| | | |
| | | } |
| | |
| | | //跑库系统 |
| | | @PreAuthorize("hasAuthority('core:basShuttle:operator')") |
| | | @PostMapping("/basShuttle/moveLoc") |
| | | @Transactional |
| | | public synchronized R shuttleMoveLoc(@RequestBody ShuttleMoveLocParam param) { |
| | | Device device = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | //跑库系统关闭 |
| | | @PreAuthorize("hasAuthority('core:basShuttle:operator')") |
| | | @PostMapping("/basShuttle/moveLocClose") |
| | | public synchronized R shuttleMoveLocClose(@RequestBody ShuttleMoveLocParam param) { |
| | | Device device = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | | .eq(Device::getStatus, 1) |
| | | .eq(Device::getHostId, getHostId()) |
| | | .eq(Device::getDeviceNo, param.getShuttleNo())); |
| | | if (device == null) { |
| | | return R.error(); |
| | | } |
| | | |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue()); |
| | | if (shuttleThread == null) { |
| | | return R.error(); |
| | | } |
| | | |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); |
| | | if (shuttleProtocol == null) { |
| | | return R.error(); |
| | | } |
| | | |
| | | shuttleThread.enableMoveLoc(null, false); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.domain.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/8/6 |
| | | */ |
| | | @Data |
| | | public class MatDto { |
| | | |
| | | // 物料编号 |
| | | private String matNo; |
| | | |
| | | // 物料名称 |
| | | private String maknx; |
| | | |
| | | // 库位规格 |
| | | private String specs; |
| | | |
| | | // 物料数量 |
| | | private Double count; |
| | | |
| | | // 库位数量 |
| | | private Double total; |
| | | |
| | | // 物料名称 |
| | | private String model; |
| | | |
| | | // 箱码 |
| | | private String containerCode; |
| | | |
| | | // 条码 |
| | | private String batch; |
| | | |
| | | // 订单编号 |
| | | private String orderNo; |
| | | |
| | | public MatDto() { |
| | | } |
| | | |
| | | public MatDto(String matNo, String maknx, Double count) { |
| | | this.matNo = matNo; |
| | | this.maknx = maknx; |
| | | this.count = count; |
| | | } |
| | | public MatDto(String matNo, String maknx, Double count, String specs) { |
| | | this.specs = specs; |
| | | this.matNo = matNo; |
| | | this.maknx = maknx; |
| | | this.count = count; |
| | | } |
| | | public MatDto(String matNo, String maknx, Double count, Double total, String specs) { |
| | | this.specs = specs; |
| | | this.matNo = matNo; |
| | | this.maknx = maknx; |
| | | this.count = count; |
| | | this.total = total; |
| | | } |
| | | public MatDto(String matNo, String maknx, Double count, Double total, String specs, String containerCode) { |
| | | this.containerCode = containerCode; |
| | | this.specs = specs; |
| | | this.matNo = matNo; |
| | | this.maknx = maknx; |
| | | this.count = count; |
| | | this.total = total; |
| | | } |
| | | public MatDto(String matNo, String maknx, Double count, Double total, String specs, String containerCode, String orderNo) { |
| | | this.containerCode = containerCode; |
| | | this.specs = specs; |
| | | this.matNo = matNo; |
| | | this.maknx = maknx; |
| | | this.count = count; |
| | | this.total = total; |
| | | this.orderNo = orderNo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.domain.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class StaDto { |
| | | |
| | | private Integer staNo; |
| | | |
| | | private Integer barcode; |
| | | |
| | | private Integer backSta; |
| | | |
| | | private Integer led; |
| | | |
| | | private Integer liftNo; |
| | | |
| | | } |
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_conveyor") |
| | | public class BasConveyor 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 conveyorNo; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @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; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | | * 所属机构 |
| | | */ |
| | | @ApiModelProperty(value= "所属机构") |
| | | private Long hostId; |
| | | |
| | | /** |
| | | * 入库站点列表 |
| | | */ |
| | | @ApiModelProperty(value= "入库站点列表") |
| | | private String inSta; |
| | | |
| | | /** |
| | | * 空板入库站点列表 |
| | | */ |
| | | @ApiModelProperty(value= "空板入库站点列表") |
| | | private String emptyInSta; |
| | | |
| | | /** |
| | | * 拣料入库站点列表 |
| | | */ |
| | | @ApiModelProperty(value= "拣料入库站点列表") |
| | | private String pickInSta; |
| | | |
| | | /** |
| | | * 出库站点列表 |
| | | */ |
| | | @ApiModelProperty(value= "出库站点列表") |
| | | private String outSta; |
| | | |
| | | /** |
| | | * 空板出库站点列表 |
| | | */ |
| | | @ApiModelProperty(value= "空板出库站点列表") |
| | | private String emptyOutSta; |
| | | |
| | | /** |
| | | * 拣料出库站点列表 |
| | | */ |
| | | @ApiModelProperty(value= "拣料出库站点列表") |
| | | private String pickOutSta; |
| | | |
| | | public BasConveyor() {} |
| | | |
| | | public BasConveyor(Long deviceId,Integer conveyorNo,Long updateBy,Long createBy,Date createTime,Date updateTime,String memo,Integer deleted,Long hostId,String inSta,String emptyInSta,String pickInSta,String outSta,String emptyOutSta,String pickOutSta) { |
| | | this.deviceId = deviceId; |
| | | this.conveyorNo = conveyorNo; |
| | | this.updateBy = updateBy; |
| | | this.createBy = createBy; |
| | | this.createTime = createTime; |
| | | this.updateTime = updateTime; |
| | | this.memo = memo; |
| | | this.deleted = deleted; |
| | | this.hostId = hostId; |
| | | this.inSta = inSta; |
| | | this.emptyInSta = emptyInSta; |
| | | this.pickInSta = pickInSta; |
| | | this.outSta = outSta; |
| | | this.emptyOutSta = emptyOutSta; |
| | | this.pickOutSta = pickOutSta; |
| | | } |
| | | |
| | | // BasConveyor basConveyor = new BasConveyor( |
| | | // null, // 设备id |
| | | // null, // 输送线号[非空] |
| | | // 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; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.entity; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.zy.asrs.wcs.core.service.BasConveyorService; |
| | | 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_conveyor_sta") |
| | | public class BasConveyorSta 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 conveyorId; |
| | | |
| | | /** |
| | | * 输送线号 |
| | | */ |
| | | @ApiModelProperty(value= "输送线号") |
| | | private Integer conveyorNo; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @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; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | | * 所属机构 |
| | | */ |
| | | @ApiModelProperty(value= "所属机构") |
| | | private Long hostId; |
| | | |
| | | /** |
| | | * 输送站号 |
| | | */ |
| | | @ApiModelProperty(value= "输送站号") |
| | | private Integer siteNo; |
| | | |
| | | /** |
| | | * 可入(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "可入(checkBox)") |
| | | private String inEnable; |
| | | |
| | | /** |
| | | * 可出(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "可出(checkBox)") |
| | | private String outEnable; |
| | | |
| | | /** |
| | | * 自动(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "自动(checkBox)") |
| | | private String autoing; |
| | | |
| | | /** |
| | | * 有物(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "有物(checkBox)") |
| | | private String loading; |
| | | |
| | | /** |
| | | * 能入(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "能入(checkBox)") |
| | | private String canining; |
| | | |
| | | /** |
| | | * 能出(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "能出(checkBox)") |
| | | private String canouting; |
| | | |
| | | /** |
| | | * 高低类型 0: 未知 1: 低库位 2: 高库位 |
| | | */ |
| | | @ApiModelProperty(value= "高低类型 0: 未知 1: 低库位 2: 高库位 ") |
| | | private Integer locType1; |
| | | |
| | | /** |
| | | * 宽窄类型 0: 未知 1: 窄库位 2: 宽库位 |
| | | */ |
| | | @ApiModelProperty(value= "宽窄类型 0: 未知 1: 窄库位 2: 宽库位 ") |
| | | private Integer locType2; |
| | | |
| | | /** |
| | | * 轻重类型 0: 未知 1: 轻库位 2: 重库位 |
| | | */ |
| | | @ApiModelProperty(value= "轻重类型 0: 未知 1: 轻库位 2: 重库位 ") |
| | | private Integer locType3; |
| | | |
| | | /** |
| | | * 库位号 |
| | | */ |
| | | @ApiModelProperty(value= "库位号") |
| | | private String locNo; |
| | | |
| | | /** |
| | | * 四向穿梭车所识别的二维码 |
| | | */ |
| | | @ApiModelProperty(value= "四向穿梭车所识别的二维码") |
| | | private String qrCodeValue; |
| | | |
| | | public BasConveyorSta() {} |
| | | |
| | | public BasConveyorSta(Long conveyorId,Integer conveyorNo,Long updateBy,Long createBy,Date createTime,Date updateTime,String memo,Integer deleted,Long hostId,Integer siteNo,String inEnable,String outEnable,String autoing,String loading,String canining,String canouting,Integer locType1,Integer locType2,Integer locType3,String locNo,String qrCodeValue) { |
| | | this.conveyorId = conveyorId; |
| | | this.conveyorNo = conveyorNo; |
| | | this.updateBy = updateBy; |
| | | this.createBy = createBy; |
| | | this.createTime = createTime; |
| | | this.updateTime = updateTime; |
| | | this.memo = memo; |
| | | this.deleted = deleted; |
| | | this.hostId = hostId; |
| | | this.siteNo = siteNo; |
| | | this.inEnable = inEnable; |
| | | this.outEnable = outEnable; |
| | | this.autoing = autoing; |
| | | this.loading = loading; |
| | | this.canining = canining; |
| | | this.canouting = canouting; |
| | | this.locType1 = locType1; |
| | | this.locType2 = locType2; |
| | | this.locType3 = locType3; |
| | | this.locNo = locNo; |
| | | this.qrCodeValue = qrCodeValue; |
| | | } |
| | | |
| | | // BasConveyorSta basConveyorSta = new BasConveyorSta( |
| | | // null, // 输送线id |
| | | // null, // 输送线号[非空] |
| | | // null, // 修改人员 |
| | | // null, // 创建人员 |
| | | // null, // 创建时间 |
| | | // null, // 修改时间 |
| | | // null, // 备注 |
| | | // null, // 是否删除 |
| | | // null, // 所属机构 |
| | | // null, // 输送站号 |
| | | // null, // 可入(checkBox) |
| | | // null, // 可出(checkBox) |
| | | // null, // 自动(checkBox) |
| | | // null, // 有物(checkBox) |
| | | // null, // 能入(checkBox) |
| | | // null, // 能出(checkBox) |
| | | // null, // 高低类型 |
| | | // null, // 宽窄类型 |
| | | // null, // 轻重类型 |
| | | // null, // 库位号 |
| | | // null // 四向穿梭车所识别的二维码 |
| | | // ); |
| | | |
| | | public String getConveyorId$(){ |
| | | BasConveyorService service = SpringUtils.getBean(BasConveyorService.class); |
| | | BasConveyor basConveyor = service.getById(this.conveyorId); |
| | | if (!Cools.isEmpty(basConveyor)){ |
| | | return String.valueOf(basConveyor.getConveyorNo()); |
| | | } |
| | | 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 getLocType1$(){ |
| | | if (null == this.locType1){ return null; } |
| | | switch (this.locType1){ |
| | | case 0: |
| | | return "未知"; |
| | | case 1: |
| | | return "低库位"; |
| | | case 2: |
| | | return "高库位"; |
| | | default: |
| | | return String.valueOf(this.locType1); |
| | | } |
| | | } |
| | | |
| | | public String getLocType2$(){ |
| | | if (null == this.locType2){ return null; } |
| | | switch (this.locType2){ |
| | | case 0: |
| | | return "未知"; |
| | | case 1: |
| | | return "窄库位"; |
| | | case 2: |
| | | return "宽库位"; |
| | | default: |
| | | return String.valueOf(this.locType2); |
| | | } |
| | | } |
| | | |
| | | public String getLocType3$(){ |
| | | if (null == this.locType3){ return null; } |
| | | switch (this.locType3){ |
| | | case 0: |
| | | return "未知"; |
| | | case 1: |
| | | return "轻库位"; |
| | | case 2: |
| | | return "重库位"; |
| | | default: |
| | | return String.valueOf(this.locType3); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.entity; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.zy.asrs.wcs.core.service.BasConveyorService; |
| | | 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_led") |
| | | public class BasLed 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; |
| | | |
| | | /** |
| | | * LED显示屏号 |
| | | */ |
| | | @ApiModelProperty(value= "LED显示屏号") |
| | | private Integer ledNo; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @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; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | | * 所属机构 |
| | | */ |
| | | @ApiModelProperty(value= "所属机构") |
| | | private Long hostId; |
| | | |
| | | /** |
| | | * 显示屏站点号 |
| | | */ |
| | | @ApiModelProperty(value= "显示屏站点号") |
| | | private String sta; |
| | | |
| | | /** |
| | | * 输送线id |
| | | */ |
| | | @ApiModelProperty(value= "输送线id") |
| | | private Long conveyorId; |
| | | |
| | | public BasLed() {} |
| | | |
| | | public BasLed(Long deviceId,Integer ledNo,Long updateBy,Long createBy,Date createTime,Date updateTime,String memo,Integer deleted,Long hostId,String sta,Long conveyorId) { |
| | | this.deviceId = deviceId; |
| | | this.ledNo = ledNo; |
| | | this.updateBy = updateBy; |
| | | this.createBy = createBy; |
| | | this.createTime = createTime; |
| | | this.updateTime = updateTime; |
| | | this.memo = memo; |
| | | this.deleted = deleted; |
| | | this.hostId = hostId; |
| | | this.sta = sta; |
| | | this.conveyorId = conveyorId; |
| | | } |
| | | |
| | | // BasLed basLed = new BasLed( |
| | | // null, // 设备id |
| | | // null, // LED显示屏号[非空] |
| | | // null, // 修改人员 |
| | | // null, // 创建人员 |
| | | // null, // 创建时间 |
| | | // null, // 修改时间 |
| | | // null, // 备注 |
| | | // null, // 是否删除 |
| | | // null, // 所属机构 |
| | | // null, // 显示屏站点号 |
| | | // null // 输送线id |
| | | // ); |
| | | |
| | | 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 getConveyorId$(){ |
| | | BasConveyorService service = SpringUtils.getBean(BasConveyorService.class); |
| | | BasConveyor basConveyor = service.getById(this.conveyorId); |
| | | if (!Cools.isEmpty(basConveyor)){ |
| | | return String.valueOf(basConveyor.getConveyorNo()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.mapper; |
| | | |
| | | import com.zy.asrs.wcs.core.entity.BasConveyor; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface BasConveyorMapper extends BaseMapper<BasConveyor> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.mapper; |
| | | |
| | | import com.zy.asrs.wcs.core.entity.BasConveyorSta; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface BasConveyorStaMapper extends BaseMapper<BasConveyorSta> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.mapper; |
| | | |
| | | import com.zy.asrs.wcs.core.entity.BasLed; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface BasLedMapper extends BaseMapper<BasLed> { |
| | | |
| | | } |
| | |
| | | LIFT, |
| | | SHUTTLE, |
| | | AGV, |
| | | LED, |
| | | ; |
| | | |
| | | DeviceCtgType() { |
New file |
| | |
| | | package com.zy.asrs.wcs.core.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wcs.core.entity.BasConveyor; |
| | | |
| | | public interface BasConveyorService extends IService<BasConveyor> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wcs.core.entity.BasConveyorSta; |
| | | |
| | | public interface BasConveyorStaService extends IService<BasConveyorSta> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wcs.core.entity.BasLed; |
| | | |
| | | public interface BasLedService extends IService<BasLed> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.service.impl; |
| | | |
| | | import com.zy.asrs.wcs.core.mapper.BasConveyorMapper; |
| | | import com.zy.asrs.wcs.core.entity.BasConveyor; |
| | | import com.zy.asrs.wcs.core.service.BasConveyorService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("basConveyorService") |
| | | public class BasConveyorServiceImpl extends ServiceImpl<BasConveyorMapper, BasConveyor> implements BasConveyorService { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.service.impl; |
| | | |
| | | import com.zy.asrs.wcs.core.mapper.BasConveyorStaMapper; |
| | | import com.zy.asrs.wcs.core.entity.BasConveyorSta; |
| | | import com.zy.asrs.wcs.core.service.BasConveyorStaService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("basConveyorStaService") |
| | | public class BasConveyorStaServiceImpl extends ServiceImpl<BasConveyorStaMapper, BasConveyorSta> implements BasConveyorStaService { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.service.impl; |
| | | |
| | | import com.zy.asrs.wcs.core.mapper.BasLedMapper; |
| | | import com.zy.asrs.wcs.core.entity.BasLed; |
| | | import com.zy.asrs.wcs.core.service.BasLedService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("basLedService") |
| | | public class BasLedServiceImpl extends ServiceImpl<BasLedMapper, BasLed> implements BasLedService { |
| | | |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.common.domain.dto.StartupDto; |
| | | import com.zy.asrs.common.domain.param.SearchLocParam; |
| | | import com.zy.asrs.common.utils.HttpHandler; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.SnowflakeIdWorker; |
| | | import com.zy.asrs.wcs.core.domain.dto.MatDto; |
| | | import com.zy.asrs.wcs.core.domain.dto.RedisMapDto; |
| | | import com.zy.asrs.wcs.core.domain.dto.StaDto; |
| | | import com.zy.asrs.wcs.core.entity.*; |
| | |
| | | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; |
| | | import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant; |
| | | import com.zy.asrs.wcs.rcs.entity.Device; |
| | | import com.zy.asrs.wcs.rcs.model.command.LedCommand; |
| | | import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType; |
| | | import com.zy.asrs.wcs.rcs.model.enums.SlaveType; |
| | | import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol; |
| | |
| | | import com.zy.asrs.wcs.rcs.service.DeviceService; |
| | | import com.zy.asrs.wcs.rcs.thread.BarcodeThread; |
| | | import com.zy.asrs.wcs.rcs.thread.DevpThread; |
| | | import com.zy.asrs.wcs.rcs.thread.LedThread; |
| | | import com.zy.asrs.wcs.rcs.thread.ShuttleThread; |
| | | import com.zy.asrs.wcs.system.entity.Dict; |
| | | import com.zy.asrs.wcs.system.service.DictService; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private BasConveyorService basConveyorService; |
| | | @Autowired |
| | | private BasLedService basLedService; |
| | | |
| | | /** |
| | | * 组托 |
| | |
| | | // 遍历入库口 |
| | | for (StaDto inSta : JSON.parseArray(basConveyor.getInSta(), StaDto.class)) { |
| | | // 获取入库站信息 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId().intValue()); |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, devp.getId().intValue()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()); |
| | | if (staProtocol == null) { |
| | | continue; |
| | |
| | | } |
| | | // 退回 |
| | | if (back) { |
| | | // // led 异常显示 |
| | | // LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | // if (ledThread != null) { |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg)); |
| | | // } |
| | | // led 异常显示 |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (ledThread != null) { |
| | | ledThread.error(errMsg); |
| | | } |
| | | continue; |
| | | } |
| | | |
| | |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if (!Cools.isEmpty(barcode)) { |
| | | // News.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | News.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode) || "00000000".equals(barcode)) { |
| | | // staProtocol.setWorkNo((short) 32002); |
| | | // staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | staProtocol.setWorkNo((short) 32002); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | devpThread.writeWorkSta(staProtocol.getSiteId(), (short) 32002, inSta.getBackSta().shortValue()); |
| | | |
| | | // // led 异常显示 |
| | | // LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | // if (ledThread != null) { |
| | | // String errorMsg = "扫码失败,请重试"; |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | // } |
| | | // led 异常显示 |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (ledThread != null) { |
| | | String errorMsg = "扫码失败,请重试"; |
| | | ledThread.error(errorMsg); |
| | | } |
| | | continue; |
| | | } |
| | | } else { |
| | | // staProtocol.setWorkNo((short) 32002); |
| | | // staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | } |
| | | |
| | | // // led 异常显示 |
| | | // LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | // if (ledThread != null) { |
| | | // String errorMsg = "扫码失败,请重试"; |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | // } |
| | | //获取入库任务类型 |
| | | TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>() |
| | | .eq(TaskCtg::getFlag, "IN") |
| | | .eq(TaskCtg::getStatus, 1)); |
| | | |
| | | // 判断重复工作档 |
| | | Task task1 = taskService.getOne(new LambdaQueryWrapper<Task>() |
| | | .eq(Task::getOriginSite, inSta.getStaNo()) |
| | | .eq(Task::getTaskCtg, taskCtg.getId()) |
| | | .in(Task::getTaskSts, 1, 2, 3) |
| | | .eq(Task::getZpallet, barcode)); |
| | | if (task1 != null) { |
| | | News.error("工作档已存在,工作号={}", task1.getTaskNo()); |
| | | continue; |
| | | } |
| | | |
| | | // // 过滤盘点/拣料/并板任务 |
| | | // WrkMast wrkMast1 = wrkMastMapper.selectPickStepByBarcode(barcode); |
| | | // if (null != wrkMast1) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // // 判断重复工作档 |
| | | // WrkMast wrkMast2 = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode); |
| | | // if (wrkMast2 != null) { |
| | | // News.error("工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast2.getWrkNo()); |
| | | // continue; |
| | | // } |
| | | // |
| | | // try { |
| | | // LocTypeDto locTypeDto = new LocTypeDto(staProtocol); |
| | | // SearchLocParam param = new SearchLocParam(); |
| | | // param.setBarcode(barcode); |
| | | // param.setIoType(1); |
| | | // param.setSourceStaNo(inSta.getStaNo()); |
| | | // param.setLocType1(locTypeDto.getLocType1()); |
| | | // String response = new HttpHandler.Builder() |
| | | // .setUri(wmsUrl) |
| | | // .setPath("/rpc/pakin/loc/v2") |
| | | // .setJson(JSON.toJSONString(param)) |
| | | // .build() |
| | | // .doPost(); |
| | | // JSONObject jsonObject = JSON.parseObject(response); |
| | | // LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | // Integer code = jsonObject.getInteger("code"); |
| | | // if (code.equals(200)) { |
| | | // StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | //// staProtocol.setWorkNo(dto.getWorkNo().shortValue()); |
| | | //// staProtocol.setStaNo(dto.getStaNo().shortValue()); |
| | | //// devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | //// |
| | | //// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | //// if (!result) { |
| | | //// throw new CoolException("更新plc站点信息失败"); |
| | | //// } |
| | | // |
| | | // // 判断重复工作档 |
| | | // WrkMast wrkMast = wrkMastMapper.selectPakInStep11(inSta.getStaNo()); |
| | | // if (wrkMast == null) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // // 更新工作主档 |
| | | // wrkMast.setWrkSts(2L); // 工作状态:2.设备上走 |
| | | // wrkMast.setModiTime(new Date()); |
| | | // if (wrkMastMapper.updateById(wrkMast) == 0) { |
| | | // News.error("更新工作档失败!!! [工作号:{}]", wrkMast.getWrkNo()); |
| | | // } |
| | | // |
| | | // } else if (code == 500) { |
| | | // if (ledThread != null) { |
| | | // String errorMsg = jsonObject.getString("msg"); |
| | | // if (!Cools.isEmpty(errorMsg)) { |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | // ledThread.setLedMk(false); |
| | | // } |
| | | // } |
| | | // News.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v2", JSON.toJSONString(param), response); |
| | | // } else if (code == 700) { |
| | | //// staProtocol.setWorkNo((short) 32002); |
| | | //// staProtocol.setRollback102(1);//102站回退信号 |
| | | //// devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | //// MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(5, staProtocol)); |
| | | // |
| | | // // led 异常显示 |
| | | // if (ledThread != null) { |
| | | // String errorMsg = barcode + "托盘识别异常,请先进行组托!"; |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | // ledThread.setLedMk(false); |
| | | // } |
| | | // } |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | // } |
| | | try { |
| | | //获取WMS地址 |
| | | Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>().eq(Dict::getFlag, "WMS_URL").eq(Dict::getStatus, 1)); |
| | | if (dict == null) { |
| | | News.error("WMS地址未配置"); |
| | | continue; |
| | | } |
| | | String wmsUrl = dict.getValue(); |
| | | |
| | | SearchLocParam param = new SearchLocParam(); |
| | | param.setBarcode(barcode); |
| | | param.setIoType(1); |
| | | param.setSourceStaNo(inSta.getStaNo()); |
| | | param.setLocType1(staProtocol.getLocType1().shortValue()); |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/pakin/loc/v2") |
| | | .setJson(JSON.toJSONString(param)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | Integer code = jsonObject.getInteger("code"); |
| | | if (code.equals(200)) { |
| | | StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | devpThread.writeWorkSta(staProtocol.getSiteId(), dto.getWorkNo().shortValue(), dto.getStaNo().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | |
| | | } else if (code == 500) { |
| | | if (ledThread != null) { |
| | | String errorMsg = jsonObject.getString("msg"); |
| | | if (!Cools.isEmpty(errorMsg)) { |
| | | ledThread.error(errorMsg); |
| | | ledThread.setLedMk(false); |
| | | } |
| | | } |
| | | News.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v2", JSON.toJSONString(param), response); |
| | | } else if (code == 700) { |
| | | // staProtocol.setWorkNo((short) 32002); |
| | | // staProtocol.setRollback102(1);//102站回退信号 |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(5, staProtocol)); |
| | | |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | | String errorMsg = barcode + "托盘识别异常,请先进行组托!"; |
| | | ledThread.error(errorMsg); |
| | | ledThread.setLedMk(false); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | for (Task task : tasks) { |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, 1); |
| | | StaProtocol staProtocol = devpThread.getStation().get(Integer.parseInt(task.getOriginSite()));//源站 |
| | | StaProtocol staProtocol1 = devpThread.getStation().get(Integer.parseInt(task.getDestSite()));//目标站 |
| | | if (staProtocol == null || staProtocol1 == null) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 出库 ===>> 工作档信息写入led显示器 |
| | | */ |
| | | public void ledExecute() { |
| | | // 遍历LED |
| | | List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceType, DeviceCtgType.LED.val()) |
| | | .eq(Device::getStatus, 1)); |
| | | for (Device ledDevice : list) { |
| | | //获取led数据 |
| | | BasLed led = basLedService.getOne(new LambdaQueryWrapper<BasLed>() |
| | | .eq(BasLed::getDeviceId, ledDevice.getId())); |
| | | List<Integer> staArr = JSON.parseArray(led.getSta(), Integer.class); |
| | | |
| | | // 获取输送线plc线程 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, led.getConveyorId().intValue()); |
| | | // 命令集合 |
| | | List<LedCommand> commands = new ArrayList<>(); |
| | | // 工作档集合 |
| | | List<Task> tasks = new ArrayList<>(); |
| | | for (Integer staNo : staArr) { |
| | | // 获取叉车站点 |
| | | StaProtocol staProtocol = devpThread.getStation().get(staNo); |
| | | if (null == staProtocol || null == staProtocol.getWorkNo() || 0 == staProtocol.getWorkNo() || !staProtocol.isLoading()) { |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | // 获取工作档数据 |
| | | Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getTaskNo, staProtocol.getWorkNo())); |
| | | if (null == task) { |
| | | continue; |
| | | } |
| | | |
| | | tasks.add(task); |
| | | // 组装命令 |
| | | LedCommand ledCommand = new LedCommand(); |
| | | ledCommand.setWorkNo(task.getTaskNo()); |
| | | ledCommand.setIoType(task.getTaskCtg().intValue()); |
| | | ledCommand.setTitle(task.getTaskCtg$()); |
| | | ledCommand.setSourceLocNo(task.getOriginLoc()); |
| | | ledCommand.setLocNo(task.getDestLoc()); |
| | | ledCommand.setStaNo(Integer.parseInt(task.getDestSite())); |
| | | |
| | | try { |
| | | //获取WMS地址 |
| | | Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>().eq(Dict::getFlag, "WMS_URL").eq(Dict::getStatus, 1)); |
| | | if (dict != null) { |
| | | String wmsUrl = dict.getValue(); |
| | | |
| | | HashMap<String, Object> param = new HashMap<>(); |
| | | param.put("taskNo", task.getTaskNo()); |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath("/queryTask") |
| | | .setJson(JSON.toJSONString(param)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | Integer code = jsonObject.getInteger("code"); |
| | | if (code.equals(200)) { |
| | | List<MatDto> matDtos = JSON.parseArray(jsonObject.getString("data"), MatDto.class); |
| | | ledCommand.setMatDtos(matDtos); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | commands.add(ledCommand); |
| | | } |
| | | // 获取LED线程 |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, ledDevice.getId().intValue()); |
| | | // 命令下发 ------------------------------------------------------------------------------- |
| | | if (!commands.isEmpty()) { |
| | | ledThread.write(commands); |
| | | ledThread.setLedMk(false); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 其他 ===>> LED显示器复位,显示默认信息 |
| | | */ |
| | | public void ledReset() { |
| | | // 根据输送线plc遍历 |
| | | List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceType, DeviceCtgType.LED.val()) |
| | | .eq(Device::getStatus, 1)); |
| | | for (Device ledDevice : list) { |
| | | //获取led数据 |
| | | BasLed led = basLedService.getOne(new LambdaQueryWrapper<BasLed>() |
| | | .eq(BasLed::getDeviceId, ledDevice.getId())); |
| | | List<Integer> staArr = JSON.parseArray(led.getSta(), Integer.class); |
| | | |
| | | // 获取输送线plc线程 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, led.getConveyorId().intValue()); |
| | | // 命令集合 |
| | | boolean reset = true; |
| | | for (Integer staNo : staArr) { |
| | | // 获取叉车站点 |
| | | StaProtocol staProtocol = devpThread.getStation().get(staNo); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } |
| | | if (staProtocol.getWorkNo() != 0 && staProtocol.isLoading()) { |
| | | reset = false; |
| | | break; |
| | | } |
| | | } |
| | | // 获取led线程 |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, ledDevice.getId().intValue()); |
| | | // led显示默认内容 |
| | | if (reset && !ledThread.isLedMk()) { |
| | | ledThread.errorReset(); |
| | | ledThread.setLedMk(true); |
| | | } |
| | | } |
| | | |
| | | for (Device ledDevice : list) { |
| | | //获取led数据 |
| | | BasLed led = basLedService.getOne(new LambdaQueryWrapper<BasLed>() |
| | | .eq(BasLed::getDeviceId, ledDevice.getId())); |
| | | List<Integer> staArr = JSON.parseArray(led.getSta(), Integer.class); |
| | | |
| | | // 获取输送线plc线程 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, led.getConveyorId().intValue()); |
| | | // 命令集合 |
| | | boolean reset = true; |
| | | for (Integer staNo : staArr) { |
| | | // 获取叉车站点 |
| | | StaProtocol staProtocol = devpThread.getStation().get(staNo); |
| | | if (staProtocol == null) { continue; } |
| | | if (staProtocol.getWorkNo() != 0) { |
| | | reset = false; |
| | | break; |
| | | } |
| | | } |
| | | // 获取led线程 |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, ledDevice.getId().intValue()); |
| | | // led显示默认内容 |
| | | if (reset && !ledThread.isLedMk()) { |
| | | ledThread.reset(); |
| | | ledThread.setLedMk(true); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.wcs.rcs.cache; |
| | | |
| | | import com.zy.asrs.wcs.rcs.model.Task; |
| | | import com.zy.asrs.wcs.rcs.model.MessageTask; |
| | | import com.zy.asrs.wcs.rcs.model.enums.SlaveType; |
| | | |
| | | import java.util.Map; |
| | |
| | | public class MessageQueue { |
| | | |
| | | // 输送线mq交换机 |
| | | private static final Map<Integer, ConcurrentLinkedQueue<Task>> DEVP_EXCHANGE = new ConcurrentHashMap<>(); |
| | | private static final Map<Integer, ConcurrentLinkedQueue<MessageTask>> CONVEYOR_EXCHANGE = new ConcurrentHashMap<>(); |
| | | // 条码扫描仪mq交换机 |
| | | private static final Map<Integer, ConcurrentLinkedQueue<Task>> BARCODE_EXCHANGE = new ConcurrentHashMap<>(); |
| | | private static final Map<Integer, ConcurrentLinkedQueue<MessageTask>> BARCODE_EXCHANGE = new ConcurrentHashMap<>(); |
| | | // Led灯 mq交换机 |
| | | private static final Map<Integer, LinkedBlockingQueue<Task>> LED_EXCHANGE = new ConcurrentHashMap<>(); |
| | | private static final Map<Integer, LinkedBlockingQueue<MessageTask>> LED_EXCHANGE = new ConcurrentHashMap<>(); |
| | | // 磅称mq交换机 |
| | | private static final Map<Integer, ConcurrentLinkedQueue<Task>> SCALE_EXCHANGE = new ConcurrentHashMap<>(); |
| | | private static final Map<Integer, ConcurrentLinkedQueue<MessageTask>> SCALE_EXCHANGE = new ConcurrentHashMap<>(); |
| | | // 台车mq交换机 |
| | | private static final Map<Integer, ConcurrentLinkedQueue<Task>> CAR_EXCHANGE = new ConcurrentHashMap<>(); |
| | | private static final Map<Integer, ConcurrentLinkedQueue<MessageTask>> CAR_EXCHANGE = new ConcurrentHashMap<>(); |
| | | //四向穿梭车mq交换机 |
| | | private static final Map<Integer, ConcurrentLinkedQueue<Task>> SHUTTLE_EXCHANGE = new ConcurrentHashMap<>(); |
| | | private static final Map<Integer, ConcurrentLinkedQueue<MessageTask>> SHUTTLE_EXCHANGE = new ConcurrentHashMap<>(); |
| | | //提升机mq交换机 |
| | | private static final Map<Integer, ConcurrentLinkedQueue<Task>> LIFT_EXCHANGE = new ConcurrentHashMap<>(); |
| | | private static final Map<Integer, ConcurrentLinkedQueue<MessageTask>> LIFT_EXCHANGE = new ConcurrentHashMap<>(); |
| | | |
| | | /** |
| | | * mq 交换机初始化 |
| | | */ |
| | | public static void init(SlaveType type, Integer id) { |
| | | switch (type) { |
| | | case Devp: |
| | | DEVP_EXCHANGE.put(id, new ConcurrentLinkedQueue<>()); |
| | | case Conveyor: |
| | | CONVEYOR_EXCHANGE.put(id, new ConcurrentLinkedQueue<>()); |
| | | break; |
| | | case Barcode: |
| | | BARCODE_EXCHANGE.put(id, new ConcurrentLinkedQueue<>()); |
| | |
| | | * 添加元素 |
| | | * 如果发现队列已满无法添加的话,会直接返回false。 |
| | | */ |
| | | public static boolean offer(SlaveType type, Integer id, Task task) { |
| | | public static boolean offer(SlaveType type, Integer id, MessageTask task) { |
| | | switch (type) { |
| | | case Devp: |
| | | return DEVP_EXCHANGE.get(id).offer(task); |
| | | case Conveyor: |
| | | return CONVEYOR_EXCHANGE.get(id).offer(task); |
| | | case Barcode: |
| | | return BARCODE_EXCHANGE.get(id).offer(task); |
| | | case Led: |
| | |
| | | * 移除元素 |
| | | * 若队列为空,返回null。 |
| | | */ |
| | | public static Task poll(SlaveType type, Integer id) { |
| | | public static MessageTask poll(SlaveType type, Integer id) { |
| | | switch (type) { |
| | | case Devp: |
| | | return DEVP_EXCHANGE.get(id).poll(); |
| | | case Conveyor: |
| | | return CONVEYOR_EXCHANGE.get(id).poll(); |
| | | case Barcode: |
| | | return BARCODE_EXCHANGE.get(id).poll(); |
| | | case Led: |
| | |
| | | /** |
| | | * 取出元素,并不删除. |
| | | */ |
| | | public static Task peek(SlaveType type, Integer id) { |
| | | public static MessageTask peek(SlaveType type, Integer id) { |
| | | switch (type) { |
| | | case Devp: |
| | | return DEVP_EXCHANGE.get(id).peek(); |
| | | case Conveyor: |
| | | return CONVEYOR_EXCHANGE.get(id).peek(); |
| | | case Barcode: |
| | | return BARCODE_EXCHANGE.get(id).peek(); |
| | | case Led: |
| | |
| | | |
| | | public static void clear(SlaveType type, Integer id){ |
| | | switch (type) { |
| | | case Devp: |
| | | DEVP_EXCHANGE.get(id).clear(); |
| | | case Conveyor: |
| | | CONVEYOR_EXCHANGE.get(id).clear(); |
| | | break; |
| | | case Barcode: |
| | | BARCODE_EXCHANGE.get(id).clear(); |
File was renamed from zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/Task.java |
| | |
| | | * Created by vincent on 2020/8/5 |
| | | */ |
| | | @Data |
| | | public class Task { |
| | | public class MessageTask { |
| | | |
| | | private Integer step; |
| | | |
| | | private Object data; |
| | | |
| | | public Task() { |
| | | public MessageTask() { |
| | | } |
| | | |
| | | public Task(Integer step, Object data) { |
| | | public MessageTask(Integer step, Object data) { |
| | | this.step = step; |
| | | this.data = data; |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.rcs.model.command; |
| | | |
| | | import com.zy.asrs.wcs.core.domain.dto.MatDto; |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * led命令报文 |
| | | * Created by vincent on 2020/8/11 |
| | | */ |
| | | @Data |
| | | public class LedCommand extends Object { |
| | | |
| | | private String title; |
| | | |
| | | private String workNo; |
| | | |
| | | private Integer staNo; |
| | | |
| | | private Integer sourceStaNo; |
| | | |
| | | private String locNo; |
| | | |
| | | private String sourceLocNo; |
| | | |
| | | private List<MatDto> matDtos = new ArrayList<>(); |
| | | |
| | | private boolean emptyMk = false; |
| | | |
| | | private Integer ioType; |
| | | |
| | | private String barcode; |
| | | |
| | | } |
| | |
| | | public enum SlaveType { |
| | | |
| | | Crn, |
| | | Devp, |
| | | Barcode, |
| | | Led, |
| | | Scale, |
| | | Ste, |
| | | Shuttle, |
| | | Lift, |
| | | Conveyor, |
| | | ; |
| | | |
| | | public static SlaveType findInstance(String s){ |
| | |
| | | return station; |
| | | } |
| | | |
| | | public Integer getLocType1() { |
| | | if (!this.high && !this.low) { |
| | | return 0;//未知 |
| | | } |
| | | |
| | | if (this.low) { |
| | | return 1;//低 |
| | | }else { |
| | | return 2;//高 |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | boolean writeStaNo(int siteId,short staNo);//写入目标站 |
| | | |
| | | boolean writeWorkSta(int siteId, short workNo, short staNo);//写入工作号和目标站 |
| | | |
| | | void setPakMk(Integer siteId, boolean pakMk); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.rcs.thread; |
| | | |
| | | import com.zy.asrs.wcs.rcs.model.command.LedCommand; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface LedThread extends ThreadHandler{ |
| | | |
| | | void write(List<LedCommand> commands); |
| | | |
| | | void reset(); |
| | | |
| | | void error(String error); |
| | | |
| | | void errorReset(); |
| | | |
| | | void setLedMk(boolean mk); |
| | | |
| | | boolean isLedMk(); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.rcs.thread.impl; |
| | | |
| | | import com.zy.asrs.wcs.core.domain.dto.MatDto; |
| | | import com.zy.asrs.wcs.core.utils.RedisUtil; |
| | | import com.zy.asrs.wcs.rcs.entity.Device; |
| | | import com.zy.asrs.wcs.rcs.model.command.LedCommand; |
| | | import com.zy.asrs.wcs.rcs.thread.LedThread; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | @Slf4j |
| | | @SuppressWarnings("all") |
| | | public class NormalLedThread implements LedThread, Runnable { |
| | | |
| | | private Device device; |
| | | private RedisUtil redisUtil; |
| | | private Set<Integer> workNos = new HashSet<>(); |
| | | private boolean ledMk = false; |
| | | private boolean resetStatus = false; // 复位状态 |
| | | |
| | | // 显示器 |
| | | private StringBuffer stringBuffer = new StringBuffer(); |
| | | private List<LedCommand> commandList; |
| | | |
| | | private StringBuffer errorMsg = new StringBuffer(); |
| | | |
| | | public NormalLedThread(Device device, RedisUtil redisUtil) { |
| | | this.device = device; |
| | | this.redisUtil = redisUtil; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | } |
| | | |
| | | public void write(List<LedCommand> list) { |
| | | commandList = list; |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (LedCommand command : list) { |
| | | sb.append(command.getTitle()).append("(").append(command.getWorkNo()).append(")").append("\n"); |
| | | sb.append("源库位:").append(command.getSourceLocNo()).append("\n"); |
| | | sb.append("目标站:").append(command.getStaNo()).append("\n"); |
| | | if (!command.isEmptyMk()) { |
| | | for (MatDto matDto : command.getMatDtos()) { |
| | | sb.append("物料编码:").append(matDto.getMatNo()).append("\n"); |
| | | sb.append("名称:").append(matDto.getMaknx()).append("\n"); |
| | | sb.append("数量:").append(matDto.getCount()).append("\n"); |
| | | sb.append("规格:").append(matDto.getSpecs()).append("\n"); |
| | | } |
| | | } |
| | | sb.append("\n"); |
| | | } |
| | | stringBuffer.delete(0, stringBuffer.length()); |
| | | stringBuffer.append(sb.toString()); |
| | | |
| | | errorReset(); |
| | | } |
| | | |
| | | public void reset() { |
| | | commandList = null; |
| | | stringBuffer.delete(0, stringBuffer.length()); |
| | | errorMsg.delete(0, errorMsg.length()); |
| | | } |
| | | |
| | | public void error(String msg) { |
| | | errorMsg.delete(0, errorMsg.length()); |
| | | errorMsg.append(msg); |
| | | } |
| | | |
| | | public void errorReset() { |
| | | this.errorMsg.delete(0, errorMsg.length()); |
| | | } |
| | | |
| | | @Override |
| | | public boolean connect() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public void close() { |
| | | } |
| | | |
| | | @Override |
| | | public void setLedMk(boolean mk) { |
| | | this.ledMk = mk; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isLedMk() { |
| | | return this.ledMk; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean writeWorkSta(int siteId, short staNo, short workNo) { |
| | | int index = findStaNosIndex(siteId); |
| | | |
| | | OperateResult write1 = siemensS7Net.Write("DB100." + index*6, workNo); // 工作号 |
| | | OperateResult write2 = siemensS7Net.Write("DB100." + (index*6+4), staNo); // 目标站 |
| | | |
| | | if (!(write1.IsSuccess && write2.IsSuccess)) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() ==0) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线站点数据失败。输送线plc编号={1},站点数据={2}", device.getId(), JSON.toJSON(staProtocol))); |
| | | log.error("写入输送线站点数据失败。输送线plc编号={},站点数据={}", device.getId(), JSON.toJSON(staProtocol)); |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】 输送线命令下发 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), device.getId(), JSON.toJSON(staNo))); |
| | | log.info("输送线命令下发 [id:{}] >>>>> 命令下发: {}", device.getId(), JSON.toJSON(staNo)); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public Map<Integer, StaProtocol> getStation() { |
| | | return this.station; |
| | | } |
| | |
| | | } |
| | | return index; |
| | | } |
| | | |
| | | /** |
| | | * 设置入库标记 |
| | | */ |
| | | @Override |
| | | public void setPakMk(Integer siteId, boolean pakMk) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null != staProtocol) { |
| | | staProtocol.setPakMk(pakMk); |
| | | } |
| | | } |
| | | } |
| | |
| | | generator.frontendPrefixPath = "zy-asrs-flow/"; |
| | | |
| | | generator.sqlOsType = SqlOsType.MYSQL; |
| | | generator.url="192.168.4.15:3306/asrs"; |
| | | generator.url="127.0.0.1:3306/asrs"; |
| | | generator.username="root"; |
| | | generator.password="xltys1995"; |
| | | generator.password="root"; |
| | | // generator.url="47.97.1.152:51433;databasename=jkasrs"; |
| | | // generator.username="sa"; |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table="wcs_task_log"; |
| | | generator.tableName="任务历史记录"; |
| | | generator.table="wcs_bas_led"; |
| | | generator.tableName="LED显示屏配置"; |
| | | generator.packagePath="com.zy.asrs.wcs.core"; |
| | | |
| | | generator.build(); |
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.BasConveyorMapper"> |
| | | |
| | | </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.BasConveyorStaMapper"> |
| | | |
| | | </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.BasLedMapper"> |
| | | |
| | | </mapper> |