| | |
| | | const [ws, setWs] = useState(null); |
| | | const [openOpera, setOpenOpera] = useState(false); |
| | | const [currentData, setCurrentData] = useState(null); |
| | | const [sourceLoc, setSourceLoc] = useState(""); |
| | | const [targetLoc, setTargetLoc] = useState(""); |
| | | const [xStart, setXStart] = useState(1); |
| | | const [xTarget, setXTarget] = useState(1); |
| | |
| | | setOpenOpera(false); |
| | | }; |
| | | |
| | | const sourceLocChange = (e) => { |
| | | setSourceLoc(e.target.value) |
| | | } |
| | | |
| | | const targetLocChange = (e) => { |
| | | setTargetLoc(e.target.value) |
| | | } |
| | |
| | | message.warning('请输入目标位置'); |
| | | return; |
| | | } |
| | | }else if(type == 'takeMove') { |
| | | if (targetLoc == '') { |
| | | message.warning('请输入目标位置'); |
| | | return; |
| | | } |
| | | |
| | | if (sourceLoc == '') { |
| | | message.warning('请输入起始位置'); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | try { |
| | | const resp = await Http.doPost('api/basShuttle/operator/shuttle', { |
| | | shuttleNo: currentData.shuttleNo, |
| | | shuttleTaskMode: type, |
| | | sourceLocNo: sourceLoc, |
| | | targetLocNo: targetLoc |
| | | }); |
| | | if (resp.code === 200) { |
| | |
| | | { |
| | | key: '6', |
| | | label: '错误码', |
| | | children: '0', |
| | | children: item.errorCode$, |
| | | }, |
| | | { |
| | | key: '7', |
| | |
| | | <div style={{ marginBottom: '15px' }}> |
| | | <Card title="移动指令" style={{ width: 300 }}> |
| | | <p> |
| | | <Input addonBefore="起始位置" onChange={sourceLocChange} /> |
| | | </p> |
| | | <p> |
| | | <Input addonBefore="目标位置" onChange={targetLocChange} /> |
| | | </p> |
| | | <p> |
| | | <Button onClick={() => shuttleOperator('moveLoc')}>移动到目标位置</Button> |
| | | </p> |
| | | <p> |
| | | </p> |
| | | <div className="commandItem"> |
| | | <Button onClick={() => shuttleOperator('moveLoc')}>移动到目标位置</Button> |
| | | <Button onClick={() => shuttleOperator('takeMove')}>取放货作业</Button> |
| | | </div> |
| | | </Card> |
| | | </div> |
| | | |
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> |
| | | <ProFormDigit |
| | | name="errorCode" |
| | | label="异常码" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | rules={[{ required: true }]} |
| | | /> |
| | | <ProFormText |
| | | name="errName" |
| | | label="异常" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormSelect |
| | | name="modiUser" |
| | | 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; |
| | | }} |
| | | /> |
| | | <ProFormDateTimePicker |
| | | name="modiTime" |
| | | label="修改时间" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | transform={(value) => moment(value).toISOString()} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormSelect |
| | | name="appeUser" |
| | | 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; |
| | | }} |
| | | /> |
| | | <ProFormDateTimePicker |
| | | name="appeTime" |
| | | label="添加时间" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | transform={(value) => moment(value).toISOString()} |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | | <ProFormSelect |
| | | name="devicePlc" |
| | | label="PLC类型" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | showSearch |
| | | debounceTime={300} |
| | | request={async ({ keyWords }) => { |
| | | const resp = await Http.doPostForm('api/devicePlc/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-basShuttleErr'; |
| | | |
| | | const handleSave = async (val, intl) => { |
| | | const hide = message.loading(intl.formatMessage({ id: 'page.adding', defaultMessage: '正在添加' })); |
| | | try { |
| | | const resp = await Http.doPost('api/basShuttleErr/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/basShuttleErr/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/basShuttleErr/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/basShuttleErr/export'); |
| | | const blob = new Blob([resp], { type: 'application/vnd.ms-excel' }); |
| | | window.location.href = window.URL.createObjectURL(blob); |
| | | message.success(intl.formatMessage({ id: 'page.export.success', defaultMessage: '导出成功' })); |
| | | return true; |
| | | } catch (error) { |
| | | message.error(intl.formatMessage({ id: 'page.export.fail', defaultMessage: '导出失败,请重试' })); |
| | | return false; |
| | | } finally { |
| | | hide(); |
| | | } |
| | | }; |
| | | |
| | | |
| | | const Main = () => { |
| | | const intl = useIntl(); |
| | | const formTableRef = useRef(); |
| | | const actionRef = useRef(); |
| | | const [selectedRows, setSelectedRows] = useState([]); |
| | | const [modalVisible, setModalVisible] = useState(false); |
| | | const [currentRow, setCurrentRow] = useState(); |
| | | const [searchParam, setSearchParam] = useState({}); |
| | | |
| | | useEffect(() => { |
| | | |
| | | }, []); |
| | | |
| | | const columns = [ |
| | | { |
| | | title: intl.formatMessage({ |
| | | id: 'page.table.no', |
| | | defaultMessage: 'No' |
| | | }), |
| | | dataIndex: 'index', |
| | | valueType: 'indexBorder', |
| | | width: 48, |
| | | }, |
| | | { |
| | | title: '异常码', |
| | | dataIndex: 'errorCode', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='errorCode' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '异常', |
| | | dataIndex: 'errName', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='errName' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '修改人员', |
| | | dataIndex: 'modiUser$', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <LinkFilter |
| | | name='modiUser' |
| | | major='user' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '修改时间', |
| | | dataIndex: 'modiTime$', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <DatetimeRangeFilter |
| | | name='modiTime' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '添加人员', |
| | | dataIndex: 'appeUser$', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <LinkFilter |
| | | name='appeUser' |
| | | major='user' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '添加时间', |
| | | dataIndex: 'appeTime$', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <DatetimeRangeFilter |
| | | name='appeTime' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: 'PLC类型', |
| | | dataIndex: 'devicePlc$', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | width: 140, |
| | | filterDropdown: (props) => <LinkFilter |
| | | name='devicePlc' |
| | | major='devicePlc' |
| | | {...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="basShuttleErr" |
| | | 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/basShuttleErr/page', { ...params, ...searchParam }, (res) => { |
| | | return { |
| | | data: res.data.records, |
| | | total: res.data.total, |
| | | success: true, |
| | | } |
| | | }) |
| | | } |
| | | rowSelection={{ |
| | | onChange: (ids, rows) => { |
| | | setSelectedRows(rows); |
| | | } |
| | | }} |
| | | columnsState={{ |
| | | persistenceKey: TABLE_KEY, |
| | | persistenceType: 'localStorage', |
| | | defaultValue: { |
| | | // memo: { show: repairBug(TABLE_KEY, 'memo', false) }, |
| | | option: { fixed: 'right', disable: true }, |
| | | }, |
| | | onChange(value) { |
| | | }, |
| | | }} |
| | | /> |
| | | </div> |
| | | |
| | | {selectedRows?.length > 0 && ( |
| | | <FooterToolbar |
| | | extra={ |
| | | <div> |
| | | <a style={{ fontWeight: 600 }}>{selectedRows.length}</a> |
| | | <FormattedMessage id='page.selected' defaultMessage=' 项已选择' /> |
| | | </div> |
| | | } |
| | | > |
| | | <Button |
| | | key="remove" |
| | | danger |
| | | onClick={async () => { |
| | | Modal.confirm({ |
| | | title: intl.formatMessage({ id: 'page.delete', defaultMessage: '删除' }), |
| | | content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '确定删除该项吗?' }), |
| | | onOk: async () => { |
| | | const success = await handleRemove(selectedRows, intl); |
| | | if (success) { |
| | | setSelectedRows([]); |
| | | actionRef.current?.reloadAndRest?.(); |
| | | } |
| | | }, |
| | | }); |
| | | }} |
| | | > |
| | | <FormattedMessage id='page.delete.batch' defaultMessage='批量删除' /> |
| | | </Button> |
| | | </FooterToolbar> |
| | | )} |
| | | |
| | | <Edit |
| | | open={modalVisible} |
| | | values={currentRow || {}} |
| | | onCancel={ |
| | | () => { |
| | | setModalVisible(false); |
| | | setCurrentRow(undefined); |
| | | } |
| | | } |
| | | onSubmit={async (values) => { |
| | | let ok = false; |
| | | if (values.id) { |
| | | ok = await handleUpdate({ ...values }, intl) |
| | | } else { |
| | | ok = await handleSave({ ...values }, intl) |
| | | } |
| | | if (ok) { |
| | | setModalVisible(false); |
| | | setCurrentRow(undefined); |
| | | if (actionRef.current) { |
| | | actionRef.current.reload(); |
| | | } |
| | | } |
| | | }} |
| | | /> |
| | | </PageContainer> |
| | | ); |
| | | }; |
| | | |
| | | export default Main; |
New file |
| | |
| | | -- save basShuttleErr record |
| | | -- mysql |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `host_id`, `status`) values ( '四向车异常码管理', '0', '/rcs/basShuttleErr', '/rcs/basShuttleErr', '0' , '0', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '查询四向车异常码', '', '1', 'rcs:basShuttleErr:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '添加四向车异常码', '', '1', 'rcs:basShuttleErr:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '修改四向车异常码', '', '1', 'rcs:basShuttleErr:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '删除四向车异常码', '', '1', 'rcs:basShuttleErr:remove', '3', '1', '1'); |
| | | |
| | |
| | | return R.error("小车忙碌中"); |
| | | } |
| | | |
| | | shuttleThread.enableMoveLoc(param); |
| | | shuttleThread.enableMoveLoc(param, true); |
| | | return R.ok(); |
| | | } |
| | | |
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.rcs.entity.BasShuttleErr; |
| | | import com.zy.asrs.wcs.rcs.service.BasShuttleErrService; |
| | | 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 BasShuttleErrController extends BaseController { |
| | | |
| | | @Autowired |
| | | private BasShuttleErrService basShuttleErrService; |
| | | |
| | | @PreAuthorize("hasAuthority('rcs:basShuttleErr:list')") |
| | | @PostMapping("/basShuttleErr/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<BasShuttleErr, BaseParam> pageParam = new PageParam<>(baseParam, BasShuttleErr.class); |
| | | return R.ok().add(basShuttleErrService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('rcs:basShuttleErr:list')") |
| | | @PostMapping("/basShuttleErr/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(basShuttleErrService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('rcs:basShuttleErr:list')") |
| | | @GetMapping("/basShuttleErr/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(basShuttleErrService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('rcs:basShuttleErr:save')") |
| | | @OperationLog("添加四向车异常码") |
| | | @PostMapping("/basShuttleErr/save") |
| | | public R save(@RequestBody BasShuttleErr basShuttleErr) { |
| | | if (!basShuttleErrService.save(basShuttleErr)) { |
| | | return R.error("添加失败"); |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('rcs:basShuttleErr:update')") |
| | | @OperationLog("修改四向车异常码") |
| | | @PostMapping("/basShuttleErr/update") |
| | | public R update(@RequestBody BasShuttleErr basShuttleErr) { |
| | | if (!basShuttleErrService.updateById(basShuttleErr)) { |
| | | return R.error("修改失败"); |
| | | } |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('rcs:basShuttleErr:remove')") |
| | | @OperationLog("删除四向车异常码") |
| | | @PostMapping("/basShuttleErr/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!basShuttleErrService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("删除失败"); |
| | | } |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('rcs:basShuttleErr:list')") |
| | | @PostMapping("/basShuttleErr/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<BasShuttleErr> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(BasShuttleErr::getId, condition); |
| | | } |
| | | basShuttleErrService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getId())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('rcs:basShuttleErr:list')") |
| | | @PostMapping("/basShuttleErr/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(basShuttleErrService.list(), BasShuttleErr.class), response); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.rcs.entity; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.zy.asrs.wcs.rcs.service.DevicePlcService; |
| | | 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_shuttle_err") |
| | | public class BasShuttleErr implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 异常码 |
| | | */ |
| | | @ApiModelProperty(value= "异常码") |
| | | private Long errorCode; |
| | | |
| | | /** |
| | | * 异常 |
| | | */ |
| | | @ApiModelProperty(value= "异常") |
| | | private String errName; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value= "修改人员") |
| | | private Long modiUser; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date modiTime; |
| | | |
| | | /** |
| | | * 添加人员 |
| | | */ |
| | | @ApiModelProperty(value= "添加人员") |
| | | private Long appeUser; |
| | | |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty(value= "添加时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date appeTime; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | | * 所属机构 |
| | | */ |
| | | @ApiModelProperty(value= "所属机构") |
| | | private Long hostId; |
| | | |
| | | /** |
| | | * PLC类型 |
| | | */ |
| | | @ApiModelProperty(value= "PLC类型") |
| | | private Long devicePlc; |
| | | |
| | | public BasShuttleErr() {} |
| | | |
| | | public BasShuttleErr(Long errorCode,String errName,Long modiUser,Date modiTime,Long appeUser,Date appeTime,Integer deleted,Long hostId,Long devicePlc) { |
| | | this.errorCode = errorCode; |
| | | this.errName = errName; |
| | | this.modiUser = modiUser; |
| | | this.modiTime = modiTime; |
| | | this.appeUser = appeUser; |
| | | this.appeTime = appeTime; |
| | | this.deleted = deleted; |
| | | this.hostId = hostId; |
| | | this.devicePlc = devicePlc; |
| | | } |
| | | |
| | | // BasShuttleErr basShuttleErr = new BasShuttleErr( |
| | | // null, // 异常码[非空] |
| | | // null, // 异常 |
| | | // null, // 修改人员 |
| | | // null, // 修改时间 |
| | | // null, // 添加人员 |
| | | // null, // 添加时间 |
| | | // null, // 是否删除 |
| | | // null, // 所属机构 |
| | | // null // PLC类型 |
| | | // ); |
| | | |
| | | public String getModiUser$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.modiUser); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getModiTime$(){ |
| | | if (Cools.isEmpty(this.modiTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.modiTime); |
| | | } |
| | | |
| | | public String getAppeUser$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.appeUser); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getAppeTime$(){ |
| | | if (Cools.isEmpty(this.appeTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.appeTime); |
| | | } |
| | | |
| | | 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 getDevicePlc$(){ |
| | | DevicePlcService service = SpringUtils.getBean(DevicePlcService.class); |
| | | DevicePlc devicePlc = service.getById(this.devicePlc); |
| | | if (!Cools.isEmpty(devicePlc)){ |
| | | return String.valueOf(devicePlc.getName()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.rcs.mapper; |
| | | |
| | | import com.zy.asrs.wcs.rcs.entity.BasShuttleErr; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface BasShuttleErrMapper extends BaseMapper<BasShuttleErr> { |
| | | |
| | | } |
| | |
| | | import com.zy.asrs.wcs.core.service.LocService; |
| | | import com.zy.asrs.wcs.core.utils.RedisUtil; |
| | | import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant; |
| | | import com.zy.asrs.wcs.rcs.entity.BasShuttleErr; |
| | | import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType; |
| | | import com.zy.asrs.wcs.rcs.entity.Device; |
| | | import com.zy.asrs.wcs.rcs.entity.ShuttleDeviceStatus; |
| | | import com.zy.asrs.wcs.rcs.service.BasShuttleErrService; |
| | | import com.zy.asrs.wcs.rcs.service.ShuttleDeviceStatusService; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | return ""; |
| | | } |
| | | |
| | | public String getErrorCode$() { |
| | | if (this.errorCode == null) { |
| | | return ""; |
| | | } |
| | | BasShuttleErrService basShuttleErrService = SpringUtils.getBean(BasShuttleErrService.class); |
| | | BasShuttleErr shuttleErr = basShuttleErrService.getOne(new LambdaQueryWrapper<BasShuttleErr>() |
| | | .eq(BasShuttleErr::getErrorCode, this.errorCode) |
| | | .eq(BasShuttleErr::getHostId, this.device.getHostId()) |
| | | .eq(BasShuttleErr::getDevicePlc, this.device.getDevicePlc())); |
| | | if (shuttleErr != null) { |
| | | return this.errorCode + "-" + shuttleErr.getErrName(); |
| | | } |
| | | return errorCode; |
| | | } |
| | | |
| | | public Integer getTaskNo() { |
| | | RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); |
| | | if (null != redisUtil) { |
New file |
| | |
| | | package com.zy.asrs.wcs.rcs.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wcs.rcs.entity.BasShuttleErr; |
| | | |
| | | public interface BasShuttleErrService extends IService<BasShuttleErr> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.rcs.service.impl; |
| | | |
| | | import com.zy.asrs.wcs.rcs.mapper.BasShuttleErrMapper; |
| | | import com.zy.asrs.wcs.rcs.entity.BasShuttleErr; |
| | | import com.zy.asrs.wcs.rcs.service.BasShuttleErrService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("basShuttleErrService") |
| | | public class BasShuttleErrServiceImpl extends ServiceImpl<BasShuttleErrMapper, BasShuttleErr> implements BasShuttleErrService { |
| | | |
| | | } |
| | |
| | | |
| | | boolean setPakMk(boolean pakMk);//设置标记 |
| | | |
| | | boolean enableMoveLoc(ShuttleMoveLocParam param); |
| | | boolean enableMoveLoc(ShuttleMoveLocParam param, boolean enable); |
| | | |
| | | //***************获取命令***************** |
| | | |
| | |
| | | //电池电压 |
| | | shuttleProtocol.setBatteryVoltage(data.getInteger("voltage")); |
| | | //故障 |
| | | shuttleProtocol.setErrorCode(data.getString("errState")); |
| | | shuttleProtocol.setErrorCode(data.getJSONArray("errCode").getString(0)); |
| | | |
| | | //是否顶升 |
| | | shuttleProtocol.setHasLift(data.getInteger("liftPosition") == 1 ? true : false); |
| | |
| | | basShuttle.setStatus(1); |
| | | basShuttle.setDeleted(0); |
| | | basShuttle.setHostId(device.getHostId()); |
| | | basShuttle.setDeviceId(device.getId().intValue()); |
| | | shuttleService.save(basShuttle); |
| | | } |
| | | //任务号 |
| | |
| | | public boolean reset(ShuttleCommand command) { |
| | | setSyncTaskNo(0); |
| | | setProtocolStatus(ShuttleProtocolStatusType.IDLE); |
| | | enableMoveLoc(null, false); |
| | | return true; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean enableMoveLoc(ShuttleMoveLocParam param) { |
| | | shuttleProtocol.setMoveLoc(true);//开启跑库 |
| | | shuttleProtocol.setMoveType(param.getMoveType()); |
| | | shuttleProtocol.setXStart(param.getStartX()); |
| | | shuttleProtocol.setXTarget(param.getTargetX()); |
| | | shuttleProtocol.setXCurrent(param.getStartX()); |
| | | shuttleProtocol.setYStart(param.getStartY()); |
| | | shuttleProtocol.setYTarget(param.getTargetY()); |
| | | shuttleProtocol.setYCurrent(param.getStartY()); |
| | | public boolean enableMoveLoc(ShuttleMoveLocParam param, boolean enable) { |
| | | if (enable) { |
| | | shuttleProtocol.setMoveLoc(true);//开启跑库 |
| | | shuttleProtocol.setMoveType(param.getMoveType()); |
| | | shuttleProtocol.setXStart(param.getStartX()); |
| | | shuttleProtocol.setXTarget(param.getTargetX()); |
| | | shuttleProtocol.setXCurrent(param.getStartX()); |
| | | shuttleProtocol.setYStart(param.getStartY()); |
| | | shuttleProtocol.setYTarget(param.getTargetY()); |
| | | shuttleProtocol.setYCurrent(param.getStartY()); |
| | | }else { |
| | | 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 true; |
| | | } |
| | | |
| | |
| | | HashMap<String, Object> data = new HashMap<>(); |
| | | String codeNum = NavigatePositionConvert.xyToPosition(node.getX(), node.getY(), node.getZ(), device.getHostId()); |
| | | Map<String, Object> nyNode = navigateNodeToNyPointNode(NavigatePositionConvert.codeToNode(codeNum, device.getHostId())); |
| | | int xp = Integer.parseInt(String.valueOf(nyNode.get("x"))); |
| | | int yp = Integer.parseInt(String.valueOf(nyNode.get("y"))); |
| | | int xp = Integer.parseInt(String.valueOf(nyNode.get("y"))); |
| | | int yp = Integer.parseInt(String.valueOf(nyNode.get("x"))); |
| | | int z = Integer.parseInt(String.valueOf(nyNode.get("z"))); |
| | | |
| | | List<List<MapNode>> mapData = navigateMapData.getJsonData(NavigationMapType.NONE.id, null, null); |
| | |
| | | data.put("xp", xp); |
| | | data.put("yp", yp); |
| | | data.put("z", z); |
| | | data.put("x", mapNode.getXBase()); |
| | | data.put("y", mapNode.getYBase()); |
| | | data.put("x", mapNode.getYBase()); |
| | | data.put("y", mapNode.getXBase()); |
| | | path.add(data); |
| | | } |
| | | |
| | |
| | | location.put("xp", row); |
| | | location.put("yp", bay); |
| | | location.put("z", lev); |
| | | location.put("x", mapNode.getXBase()); |
| | | location.put("y", mapNode.getYBase()); |
| | | location.put("x", mapNode.getYBase()); |
| | | location.put("y", mapNode.getXBase()); |
| | | |
| | | HashMap<String, Object> body = new HashMap<>(); |
| | | body.put("responseType", "init");//复位 |
| | |
| | | public synchronized boolean reset(ShuttleCommand command) { |
| | | setSyncTaskNo(0); |
| | | setProtocolStatus(ShuttleProtocolStatusType.IDLE); |
| | | enableMoveLoc(null, false); |
| | | return true; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean enableMoveLoc(ShuttleMoveLocParam param) { |
| | | shuttleProtocol.setMoveLoc(true);//开启跑库 |
| | | shuttleProtocol.setMoveType(param.getMoveType()); |
| | | shuttleProtocol.setXStart(param.getStartX()); |
| | | shuttleProtocol.setXTarget(param.getTargetX()); |
| | | shuttleProtocol.setXCurrent(param.getStartX()); |
| | | shuttleProtocol.setYStart(param.getStartY()); |
| | | shuttleProtocol.setYTarget(param.getTargetY()); |
| | | shuttleProtocol.setYCurrent(param.getStartY()); |
| | | public boolean enableMoveLoc(ShuttleMoveLocParam param, boolean enable) { |
| | | if (enable) { |
| | | shuttleProtocol.setMoveLoc(true);//开启跑库 |
| | | shuttleProtocol.setMoveType(param.getMoveType()); |
| | | shuttleProtocol.setXStart(param.getStartX()); |
| | | shuttleProtocol.setXTarget(param.getTargetX()); |
| | | shuttleProtocol.setXCurrent(param.getStartX()); |
| | | shuttleProtocol.setYStart(param.getStartY()); |
| | | shuttleProtocol.setYTarget(param.getTargetY()); |
| | | shuttleProtocol.setYCurrent(param.getStartY()); |
| | | }else { |
| | | 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 true; |
| | | } |
| | | |
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.rcs.mapper.BasShuttleErrMapper"> |
| | | |
| | | </mapper> |