From ecf8ba7c1bd6fc6a719c62a888327109795a3fda Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期日, 05 五月 2024 14:13:11 +0800
Subject: [PATCH] #
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/DeviceController.java | 2
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/StationService.java | 8
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/CodeBuilder.java | 10
zy-asrs-wcs/src/main/resources/mapper/core/StationMapper.xml | 5
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/StationServiceImpl.java | 12
zy-asrs-flow/src/pages/device/station/index.jsx | 640 ++++++++++++++++++++++++
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/StaProtocol.java | 14
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/DeviceDataLogController.java | 3
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/TaskSerialNoController.java | 3
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/StationController.java | 102 +++
zy-asrs-flow/src/pages/device/station/components/edit.jsx | 266 ++++++++++
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Station.java | 382 ++++++++++++++
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/StationMapper.java | 12
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/ShuttleStandbyController.java | 3
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SiemensDevpThread.java | 92 ++-
15 files changed, 1,513 insertions(+), 41 deletions(-)
diff --git a/zy-asrs-flow/src/pages/device/station/components/edit.jsx b/zy-asrs-flow/src/pages/device/station/components/edit.jsx
new file mode 100644
index 0000000..4589e07
--- /dev/null
+++ b/zy-asrs-flow/src/pages/device/station/components/edit.jsx
@@ -0,0 +1,266 @@
+import React, { useState, useRef, useEffect } from 'react';
+import {
+ ProForm,
+ ProFormDigit,
+ ProFormText,
+ ProFormSelect,
+ ProFormDateTimePicker
+} from '@ant-design/pro-components';
+import { Form, Modal } from 'antd';
+import { FormattedMessage, useIntl } from '@umijs/max';
+import moment from 'moment';
+import Http from '@/utils/http';
+
+const Edit = (props) => {
+ const intl = useIntl();
+ const [form] = Form.useForm();
+ const { } = props;
+
+ useEffect(() => {
+ form.resetFields();
+ form.setFieldsValue({
+ ...props.values
+ })
+ }, [form, props])
+
+ const handleCancel = () => {
+ props.onCancel();
+ };
+
+ const handleOk = () => {
+ form.submit();
+ }
+
+ const handleFinish = async (values) => {
+ props.onSubmit({ ...values });
+ }
+
+ return (
+ <>
+ <Modal
+ title={
+ Object.keys(props.values).length > 0
+ ? intl.formatMessage({ id: 'page.edit', defaultMessage: '缂栬緫' })
+ : intl.formatMessage({ id: 'page.add', defaultMessage: '娣诲姞' })
+ }
+ width={640}
+ forceRender
+ destroyOnClose
+ open={props.open}
+ onCancel={handleCancel}
+ onOk={handleOk}
+ >
+ <ProForm
+ form={form}
+ submitter={false}
+ onFinish={handleFinish}
+ layout="horizontal"
+ grid={true}
+ >
+ <ProFormDigit
+ name="id"
+ disabled
+ hidden={true}
+ />
+ <ProForm.Group>
+ <ProFormText
+ name="uuid"
+ label="缂栧彿"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ <ProFormText
+ name="staNo"
+ label="绔欑偣鍙�"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormText
+ name="taskNo"
+ label="宸ヤ綔鍙�"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ <ProFormText
+ name="inEnable"
+ label="鍙叆"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormText
+ name="outEnable"
+ label="鍙嚭"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ <ProFormText
+ name="autoing"
+ label="鑷姩"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormText
+ name="loading"
+ label="鏈夌墿"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ <ProFormText
+ name="canining"
+ label="鑳藉叆"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormText
+ name="canouting"
+ label="鑳藉嚭"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ <ProFormSelect
+ name="locType1"
+ label="楂樹綆绫诲瀷"
+ colProps={{ md: 12, xl: 12 }}
+ options={[
+ { label: '鏈煡', value: 0 },
+ { label: '浣庡簱浣�', value: 1 },
+ { label: '楂樺簱浣�', value: 2 },
+ ]}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormSelect
+ name="locType2"
+ label="瀹界獎绫诲瀷"
+ colProps={{ md: 12, xl: 12 }}
+ options={[
+ { label: '鏈煡', value: 0 },
+ { label: '绐勫簱浣�', value: 1 },
+ { label: '瀹藉簱浣�', value: 2 },
+ ]}
+ />
+ <ProFormSelect
+ name="locType3"
+ label="杞婚噸绫诲瀷"
+ colProps={{ md: 12, xl: 12 }}
+ options={[
+ { label: '鏈煡', value: 0 },
+ { label: '杞诲簱浣�', value: 1 },
+ { label: '閲嶅簱浣�', value: 2 },
+ ]}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormText
+ name="shuttleCode"
+ label="鍥涘悜绌挎杞︽墍璇嗗埆鐨勪簩缁寸爜"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ <ProFormText
+ name="locNo"
+ label="搴撲綅鍙�"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormDigit
+ name="lev"
+ label="杈撻�佺嚎妤煎眰"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ />
+ <ProFormSelect
+ name="deviceId"
+ label="璁惧鍙�"
+ 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;
+ }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormSelect
+ name="deviceOtherId"
+ label="杈撻�佺嚎缁戝畾鐨勫叾浠栬澶囧彿"
+ 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;
+ }}
+ />
+ <ProFormText
+ name="flag"
+ label="鏍囪瘑"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormSelect
+ name="status"
+ label="鐘舵��"
+ colProps={{ md: 12, xl: 12 }}
+ options={[
+ { label: '姝e父', value: 1 },
+ { label: '绂佺敤', value: 0 },
+ ]}
+ />
+ <ProFormDateTimePicker
+ name="createTime"
+ label="娣诲姞鏃堕棿"
+ colProps={{ md: 12, xl: 12 }}
+ transform={(value) => moment(value).toISOString()}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <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;
+ }}
+ />
+ <ProFormDateTimePicker
+ name="updateTime"
+ label="淇敼鏃堕棿"
+ colProps={{ md: 12, xl: 12 }}
+ transform={(value) => moment(value).toISOString()}
+ />
+ </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;
+ }}
+ />
+ <ProFormText
+ name="memo"
+ label="澶囨敞"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+
+ </ProForm>
+ </Modal>
+ </>
+ )
+}
+
+export default Edit;
diff --git a/zy-asrs-flow/src/pages/device/station/index.jsx b/zy-asrs-flow/src/pages/device/station/index.jsx
new file mode 100644
index 0000000..b27c290
--- /dev/null
+++ b/zy-asrs-flow/src/pages/device/station/index.jsx
@@ -0,0 +1,640 @@
+
+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-station';
+
+const handleSave = async (val, intl) => {
+ const hide = message.loading(intl.formatMessage({ id: 'page.adding', defaultMessage: '姝e湪娣诲姞' }));
+ try {
+ const resp = await Http.doPost('api/station/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: '姝e湪鏇存柊' }));
+ try {
+ const resp = await Http.doPost('api/station/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: '姝e湪鍒犻櫎' }));
+ try {
+ const resp = await Http.doPost('api/station/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: '姝e湪瀵煎嚭' }));
+ try {
+ const resp = await Http.doPostBlob('api/station/export');
+ const blob = new Blob([resp], { type: 'application/vnd.ms-excel' });
+ window.location.href = window.URL.createObjectURL(blob);
+ message.success(intl.formatMessage({ id: 'page.export.success', defaultMessage: '瀵煎嚭鎴愬姛' }));
+ return true;
+ } catch (error) {
+ message.error(intl.formatMessage({ id: 'page.export.fail', defaultMessage: '瀵煎嚭澶辫触锛岃閲嶈瘯' }));
+ return false;
+ } finally {
+ hide();
+ }
+};
+
+
+const Main = () => {
+ const intl = useIntl();
+ const formTableRef = useRef();
+ const actionRef = useRef();
+ const [selectedRows, setSelectedRows] = useState([]);
+ const [modalVisible, setModalVisible] = useState(false);
+ const [currentRow, setCurrentRow] = useState();
+ const [searchParam, setSearchParam] = useState({});
+
+ useEffect(() => {
+
+ }, []);
+
+ const columns = [
+ {
+ title: intl.formatMessage({
+ id: 'page.table.no',
+ defaultMessage: 'No'
+ }),
+ dataIndex: 'index',
+ valueType: 'indexBorder',
+ width: 48,
+ },
+ {
+ title: '缂栧彿',
+ dataIndex: 'uuid',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='uuid'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '绔欑偣鍙�',
+ dataIndex: 'staNo',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ copyable: true,
+ filterDropdown: (props) => <TextFilter
+ name='staNo'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '宸ヤ綔鍙�',
+ dataIndex: 'taskNo',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='taskNo'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鍙叆',
+ dataIndex: 'inEnable',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='inEnable'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鍙嚭',
+ dataIndex: 'outEnable',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='outEnable'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鑷姩',
+ dataIndex: 'autoing',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='autoing'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鏈夌墿',
+ dataIndex: 'loading',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='loading'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鑳藉叆',
+ dataIndex: 'canining',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='canining'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鑳藉嚭',
+ 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: 'shuttleCode',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='shuttleCode'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '搴撲綅鍙�',
+ dataIndex: 'locNo',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='locNo'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '杈撻�佺嚎妤煎眰',
+ dataIndex: 'lev',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='lev'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '璁惧鍙�',
+ dataIndex: 'deviceId$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <LinkFilter
+ name='deviceId'
+ major='device'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '杈撻�佺嚎缁戝畾鐨勫叾浠栬澶囧彿',
+ dataIndex: 'deviceOtherId$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <LinkFilter
+ name='deviceOtherId'
+ major='device'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鏍囪瘑',
+ dataIndex: 'flag',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='flag'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鐘舵��',
+ dataIndex: 'status$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <SelectFilter
+ name='status'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ data={[
+ { label: '姝e父', value: 1 },
+ { label: '绂佺敤', value: 0 },
+ ]}
+ />,
+ },
+ {
+ title: '娣诲姞鏃堕棿',
+ dataIndex: 'createTime$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <DatetimeRangeFilter
+ name='createTime'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '娣诲姞浜哄憳',
+ dataIndex: 'createBy$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <LinkFilter
+ name='createBy'
+ major='user'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '淇敼鏃堕棿',
+ dataIndex: 'updateTime$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <DatetimeRangeFilter
+ name='updateTime'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '淇敼浜哄憳',
+ dataIndex: 'updateBy$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <LinkFilter
+ name='updateBy'
+ major='user'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '澶囨敞',
+ dataIndex: 'memo',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='memo'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+
+ {
+ title: '鎿嶄綔',
+ dataIndex: '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="station"
+ 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/station/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;
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/ShuttleStandbyController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/ShuttleStandbyController.java
index bb7e8da..d21899e 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/ShuttleStandbyController.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/ShuttleStandbyController.java
@@ -1,4 +1,4 @@
-package com.zy.asrs.wcs.system.controller;
+package com.zy.asrs.wcs.core.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,6 +10,7 @@
import com.zy.asrs.wcs.common.domain.PageParam;
import com.zy.asrs.wcs.core.entity.ShuttleStandby;
import com.zy.asrs.wcs.core.service.ShuttleStandbyService;
+import com.zy.asrs.wcs.system.controller.BaseController;
import com.zy.asrs.wcs.utils.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/StationController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/StationController.java
new file mode 100644
index 0000000..7897c46
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/StationController.java
@@ -0,0 +1,102 @@
+package com.zy.asrs.wcs.core.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.Station;
+import com.zy.asrs.wcs.core.service.StationService;
+import com.zy.asrs.wcs.system.controller.BaseController;
+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 StationController extends BaseController {
+
+ @Autowired
+ private StationService stationService;
+
+ @PreAuthorize("hasAuthority('core:station:list')")
+ @PostMapping("/station/page")
+ public R page(@RequestBody Map<String, Object> map) {
+ BaseParam baseParam = buildParam(map, BaseParam.class);
+ PageParam<Station, BaseParam> pageParam = new PageParam<>(baseParam, Station.class);
+ return R.ok().add(stationService.page(pageParam, pageParam.buildWrapper(true)));
+ }
+
+ @PreAuthorize("hasAuthority('core:station:list')")
+ @PostMapping("/station/list")
+ public R list(@RequestBody Map<String, Object> map) {
+ return R.ok().add(stationService.list());
+ }
+
+ @PreAuthorize("hasAuthority('core:station:list')")
+ @GetMapping("/station/{id}")
+ public R get(@PathVariable("id") Long id) {
+ return R.ok().add(stationService.getById(id));
+ }
+
+ @PreAuthorize("hasAuthority('core:station:save')")
+ @OperationLog("娣诲姞绔欑偣鍒楄〃")
+ @PostMapping("/station/save")
+ public R save(@RequestBody Station station) {
+ if (!stationService.save(station)) {
+ return R.error("娣诲姞澶辫触");
+ }
+ return R.ok("娣诲姞鎴愬姛");
+ }
+
+ @PreAuthorize("hasAuthority('core:station:update')")
+ @OperationLog("淇敼绔欑偣鍒楄〃")
+ @PostMapping("/station/update")
+ public R update(@RequestBody Station station) {
+ if (!stationService.updateById(station)) {
+ return R.error("淇敼澶辫触");
+ }
+ return R.ok("淇敼鎴愬姛");
+ }
+
+ @PreAuthorize("hasAuthority('core:station:remove')")
+ @OperationLog("鍒犻櫎绔欑偣鍒楄〃")
+ @PostMapping("/station/remove/{ids}")
+ public R remove(@PathVariable Long[] ids) {
+ if (!stationService.removeByIds(Arrays.asList(ids))) {
+ return R.error("鍒犻櫎澶辫触");
+ }
+ return R.ok("鍒犻櫎鎴愬姛");
+ }
+
+ @PreAuthorize("hasAuthority('core:station:list')")
+ @PostMapping("/station/query")
+ public R query(@RequestParam(required = false) String condition) {
+ List<KeyValVo> vos = new ArrayList<>();
+ LambdaQueryWrapper<Station> wrapper = new LambdaQueryWrapper<>();
+ if (!Cools.isEmpty(condition)) {
+ wrapper.like(Station::getStaNo, condition);
+ }
+ stationService.page(new Page<>(1, 30), wrapper).getRecords().forEach(
+ item -> vos.add(new KeyValVo(item.getId(), item.getStaNo()))
+ );
+ return R.ok().add(vos);
+ }
+
+ @PreAuthorize("hasAuthority('core:station:list')")
+ @PostMapping("/station/export")
+ public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
+ ExcelUtil.build(ExcelUtil.create(stationService.list(), Station.class), response);
+ }
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/TaskSerialNoController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/TaskSerialNoController.java
index cda1803..e8410dd 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/TaskSerialNoController.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/TaskSerialNoController.java
@@ -1,4 +1,4 @@
-package com.zy.asrs.wcs.system.controller;
+package com.zy.asrs.wcs.core.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,6 +10,7 @@
import com.zy.asrs.wcs.common.domain.PageParam;
import com.zy.asrs.wcs.core.entity.TaskSerialNo;
import com.zy.asrs.wcs.core.service.TaskSerialNoService;
+import com.zy.asrs.wcs.system.controller.BaseController;
import com.zy.asrs.wcs.utils.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Station.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Station.java
new file mode 100644
index 0000000..7d0cce0
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Station.java
@@ -0,0 +1,382 @@
+package com.zy.asrs.wcs.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import com.zy.asrs.wcs.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 com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+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;
+
+@Data
+@TableName("wcs_station")
+public class Station implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * ID
+ */
+ @ApiModelProperty(value= "ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 缂栧彿
+ */
+ @ApiModelProperty(value= "缂栧彿")
+ private String uuid;
+
+ /**
+ * 绔欑偣鍙�
+ */
+ @ApiModelProperty(value= "绔欑偣鍙�")
+ private String staNo;
+
+ /**
+ * 宸ヤ綔鍙�
+ */
+ @ApiModelProperty(value= "宸ヤ綔鍙�")
+ private String taskNo;
+
+ /**
+ * 鍙叆
+ */
+ @ApiModelProperty(value= "鍙叆")
+ private String inEnable;
+
+ /**
+ * 鍙嚭
+ */
+ @ApiModelProperty(value= "鍙嚭")
+ private String outEnable;
+
+ /**
+ * 鑷姩
+ */
+ @ApiModelProperty(value= "鑷姩")
+ private String autoing;
+
+ /**
+ * 鏈夌墿
+ */
+ @ApiModelProperty(value= "鏈夌墿")
+ private String loading;
+
+ /**
+ * 鑳藉叆
+ */
+ @ApiModelProperty(value= "鑳藉叆")
+ private String canining;
+
+ /**
+ * 鑳藉嚭
+ */
+ @ApiModelProperty(value= "鑳藉嚭")
+ 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 shuttleCode;
+
+ /**
+ * 搴撲綅鍙�
+ */
+ @ApiModelProperty(value= "搴撲綅鍙�")
+ private String locNo;
+
+ /**
+ * 杈撻�佺嚎妤煎眰
+ */
+ @ApiModelProperty(value= "杈撻�佺嚎妤煎眰")
+ private Integer lev;
+
+ /**
+ * 璁惧鍙�
+ */
+ @ApiModelProperty(value= "璁惧鍙�")
+ private Integer deviceId;
+
+ /**
+ * 杈撻�佺嚎缁戝畾鐨勫叾浠栬澶囧彿
+ */
+ @ApiModelProperty(value= "杈撻�佺嚎缁戝畾鐨勫叾浠栬澶囧彿")
+ private Integer deviceOtherId;
+
+ /**
+ * 鏍囪瘑
+ */
+ @ApiModelProperty(value= "鏍囪瘑")
+ private String flag;
+
+ /**
+ * 鎵�灞炴満鏋�
+ */
+ @ApiModelProperty(value= "鎵�灞炴満鏋�")
+ private Long hostId;
+
+ /**
+ * 鐘舵�� 1: 姝e父 0: 绂佺敤
+ */
+ @ApiModelProperty(value= "鐘舵�� 1: 姝e父 0: 绂佺敤 ")
+ private Integer status;
+
+ /**
+ * 鏄惁鍒犻櫎 1: 鏄� 0: 鍚�
+ */
+ @ApiModelProperty(value= "鏄惁鍒犻櫎 1: 鏄� 0: 鍚� ")
+ @TableLogic
+ private Integer deleted;
+
+ /**
+ * 娣诲姞鏃堕棿
+ */
+ @ApiModelProperty(value= "娣诲姞鏃堕棿")
+ @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+ private Date createTime;
+
+ /**
+ * 娣诲姞浜哄憳
+ */
+ @ApiModelProperty(value= "娣诲姞浜哄憳")
+ private Long createBy;
+
+ /**
+ * 淇敼鏃堕棿
+ */
+ @ApiModelProperty(value= "淇敼鏃堕棿")
+ @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+ private Date updateTime;
+
+ /**
+ * 淇敼浜哄憳
+ */
+ @ApiModelProperty(value= "淇敼浜哄憳")
+ private Long updateBy;
+
+ /**
+ * 澶囨敞
+ */
+ @ApiModelProperty(value= "澶囨敞")
+ private String memo;
+
+ public Station() {}
+
+ public Station(String uuid,String staNo,String taskNo,String inEnable,String outEnable,String autoing,String loading,String canining,String canouting,Integer locType1,Integer locType2,Integer locType3,String shuttleCode,String locNo,Integer lev,Integer deviceId,Integer deviceOtherId,String flag,Long hostId,Integer status,Integer deleted,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) {
+ this.uuid = uuid;
+ this.staNo = staNo;
+ this.taskNo = taskNo;
+ 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.shuttleCode = shuttleCode;
+ this.locNo = locNo;
+ this.lev = lev;
+ this.deviceId = deviceId;
+ this.deviceOtherId = deviceOtherId;
+ this.flag = flag;
+ this.hostId = hostId;
+ this.status = status;
+ this.deleted = deleted;
+ this.createTime = createTime;
+ this.createBy = createBy;
+ this.updateTime = updateTime;
+ this.updateBy = updateBy;
+ this.memo = memo;
+ }
+
+// Station station = new Station(
+// null, // 缂栧彿
+// null, // 绔欑偣鍙�
+// null, // 宸ヤ綔鍙�
+// null, // 鍙叆
+// null, // 鍙嚭
+// null, // 鑷姩
+// null, // 鏈夌墿
+// null, // 鑳藉叆
+// null, // 鑳藉嚭
+// null, // 楂樹綆绫诲瀷
+// null, // 瀹界獎绫诲瀷
+// null, // 杞婚噸绫诲瀷
+// null, // 鍥涘悜绌挎杞︽墍璇嗗埆鐨勪簩缁寸爜
+// null, // 搴撲綅鍙�
+// null, // 杈撻�佺嚎妤煎眰
+// null, // 璁惧鍙�
+// null, // 杈撻�佺嚎缁戝畾鐨勫叾浠栬澶囧彿
+// null, // 鏍囪瘑
+// null, // 鎵�灞炴満鏋�
+// null, // 鐘舵��
+// null, // 鏄惁鍒犻櫎
+// null, // 娣诲姞鏃堕棿
+// null, // 娣诲姞浜哄憳
+// null, // 淇敼鏃堕棿
+// null, // 淇敼浜哄憳
+// null // 澶囨敞
+// );
+
+ public String 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);
+ }
+ }
+
+ public String getDeviceId$(){
+ DeviceService service = SpringUtils.getBean(DeviceService.class);
+ Device device = service.getById(this.deviceId);
+ if (!Cools.isEmpty(device)){
+ return String.valueOf(device.getDeviceNo() + "-" + device.getDevicePlc$());
+ }
+ return null;
+ }
+
+ public String getDeviceOtherId$(){
+ DeviceService service = SpringUtils.getBean(DeviceService.class);
+ Device device = service.getById(this.deviceOtherId);
+ if (!Cools.isEmpty(device)){
+ return String.valueOf(device.getDeviceNo());
+ }
+ return null;
+ }
+
+ public String getHostId$(){
+ HostService service = SpringUtils.getBean(HostService.class);
+ Host host = service.getById(this.hostId);
+ if (!Cools.isEmpty(host)){
+ return String.valueOf(host.getName());
+ }
+ return null;
+ }
+
+ public String getStatus$(){
+ if (null == this.status){ return null; }
+ switch (this.status){
+ case 1:
+ return "姝e父";
+ case 0:
+ return "绂佺敤";
+ default:
+ return String.valueOf(this.status);
+ }
+ }
+
+ public String getDeleted$(){
+ if (null == this.deleted){ return null; }
+ switch (this.deleted){
+ case 1:
+ return "鏄�";
+ case 0:
+ return "鍚�";
+ default:
+ return String.valueOf(this.deleted);
+ }
+ }
+
+ public String getCreateTime$(){
+ if (Cools.isEmpty(this.createTime)){
+ return "";
+ }
+ return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
+ }
+
+ public String getCreateBy$(){
+ UserService service = SpringUtils.getBean(UserService.class);
+ User user = service.getById(this.createBy);
+ if (!Cools.isEmpty(user)){
+ return String.valueOf(user.getNickname());
+ }
+ return null;
+ }
+
+ public String getUpdateTime$(){
+ if (Cools.isEmpty(this.updateTime)){
+ return "";
+ }
+ return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
+ }
+
+ public String getUpdateBy$(){
+ UserService service = SpringUtils.getBean(UserService.class);
+ User user = service.getById(this.updateBy);
+ if (!Cools.isEmpty(user)){
+ return String.valueOf(user.getNickname());
+ }
+ return null;
+ }
+
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/StationMapper.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/StationMapper.java
new file mode 100644
index 0000000..5731a39
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/StationMapper.java
@@ -0,0 +1,12 @@
+package com.zy.asrs.wcs.core.mapper;
+
+import com.zy.asrs.wcs.core.entity.Station;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+@Mapper
+@Repository
+public interface StationMapper extends BaseMapper<Station> {
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/StationService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/StationService.java
new file mode 100644
index 0000000..5c385df
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/StationService.java
@@ -0,0 +1,8 @@
+package com.zy.asrs.wcs.core.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zy.asrs.wcs.core.entity.Station;
+
+public interface StationService extends IService<Station> {
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/StationServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/StationServiceImpl.java
new file mode 100644
index 0000000..22c99ae
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/StationServiceImpl.java
@@ -0,0 +1,12 @@
+package com.zy.asrs.wcs.core.service.impl;
+
+import com.zy.asrs.wcs.core.mapper.StationMapper;
+import com.zy.asrs.wcs.core.entity.Station;
+import com.zy.asrs.wcs.core.service.StationService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+@Service("stationService")
+public class StationServiceImpl extends ServiceImpl<StationMapper, Station> implements StationService {
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/DeviceController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/DeviceController.java
index 03ed55f..ada87b1 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/DeviceController.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/DeviceController.java
@@ -92,7 +92,7 @@
wrapper.like(Device::getDeviceNo, condition);
}
deviceService.page(new Page<>(1, 30), wrapper).getRecords().forEach(
- item -> vos.add(new KeyValVo(item.getId(), item.getDeviceNo()))
+ item -> vos.add(new KeyValVo(item.getId(), item.getDeviceNo() + "-" + item.getDevicePlc$()))
);
return R.ok().add(vos);
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/DeviceDataLogController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/DeviceDataLogController.java
index 9253578..73e67fc 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/DeviceDataLogController.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/DeviceDataLogController.java
@@ -1,4 +1,4 @@
-package com.zy.asrs.wcs.system.controller;
+package com.zy.asrs.wcs.rcs.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -10,6 +10,7 @@
import com.zy.asrs.wcs.common.domain.PageParam;
import com.zy.asrs.wcs.rcs.entity.DeviceDataLog;
import com.zy.asrs.wcs.rcs.service.DeviceDataLogService;
+import com.zy.asrs.wcs.system.controller.BaseController;
import com.zy.asrs.wcs.utils.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/StaProtocol.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/StaProtocol.java
index 26eeb64..da95667 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/StaProtocol.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/StaProtocol.java
@@ -1,5 +1,6 @@
package com.zy.asrs.wcs.rcs.model.protocol;
+import com.zy.asrs.wcs.core.entity.Station;
import lombok.Data;
/**
@@ -80,4 +81,17 @@
return null;
}
+ public Station toSqlModel(Station station){
+ station.setStaNo(String.valueOf(siteId));
+ station.setTaskNo(String.valueOf(workNo));
+ station.setAutoing(autoing?"Y":"N");
+ station.setLoading(loading?"Y":"N");
+ station.setInEnable(inEnable?"Y":"N");
+ station.setOutEnable(outEnable?"Y":"N");
+ station.setLocType1(0); // 楂樹綆绫诲瀷{0:鏈煡,1:浣庡簱浣�,2:楂樺簱浣峿
+ station.setLocType2(0); // 瀹界獎绫诲瀷{0:鏈煡,1:绐勫簱浣�,2:瀹藉簱浣峿
+ station.setLocType3(0); // 杞婚噸绫诲瀷{0:鏈煡,1:杞诲簱浣�,2:閲嶅簱浣峿
+ return station;
+ }
+
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SiemensDevpThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SiemensDevpThread.java
index c611ee6..07a7218 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SiemensDevpThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SiemensDevpThread.java
@@ -5,9 +5,12 @@
import HslCommunication.Profinet.Siemens.SiemensPLCS;
import HslCommunication.Profinet.Siemens.SiemensS7Net;
import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.common.DateUtils;
-import com.zy.asrs.framework.exception.CoolException;
+import com.zy.asrs.framework.common.SpringUtils;
+import com.zy.asrs.wcs.core.entity.Station;
+import com.zy.asrs.wcs.core.service.StationService;
import com.zy.asrs.wcs.core.utils.RedisUtil;
import com.zy.asrs.wcs.rcs.News;
import com.zy.asrs.wcs.rcs.cache.MessageQueue;
@@ -22,6 +25,7 @@
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -34,10 +38,7 @@
private Map<Integer, StaProtocol> station = new ConcurrentHashMap<>();
- public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{
- add(100);add(101);add(102);add(103);add(104);add(105);
- add(200);add(201);add(202);add(203);add(204);add(205);add(206);
- }};
+ public static ArrayList<Station> stationList = new ArrayList<>();
/**
* 鏉$爜鏁伴噺
@@ -49,12 +50,19 @@
this.redisUtil = redisUtil;
}
- private ArrayList<Integer> getStaNo() {
- switch (Integer.parseInt(device.getDeviceNo())) {
- case 1:
- return staNos1;
- default:
- throw new CoolException("鑾峰彇绔欑偣澶辫触锛�");
+ private ArrayList<Station> getStaNo() {
+ try {
+ if (stationList.isEmpty()) {
+ StationService stationService = SpringUtils.getBean(StationService.class);
+ List<Station> stations = stationService.list(new LambdaQueryWrapper<Station>()
+ .eq(Station::getDeviceId, device.getId())
+ .eq(Station::getStatus, 1)
+ .eq(Station::getHostId, device.getHostId()));
+ stationList.addAll(stations);
+ }
+ return stationList;
+ } catch (Exception e) {
+ return stationList;
}
}
@@ -88,12 +96,16 @@
}
private void read() throws InterruptedException {
- ArrayList<Integer> staNos = getStaNo();
+ ArrayList<Station> staNos = getStaNo();
int staNoSize = staNos.size();
+ if (station.isEmpty()) {
+ return;
+ }
OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNoSize*8));
if (result.IsSuccess) {
for (int i = 0; i < staNoSize; i++) {
- Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
+ Station siteStation = staNos.get(i);
+ int siteId = Integer.parseInt(siteStation.getStaNo());// 绔欑偣缂栧彿
StaProtocol staProtocol = station.get(siteId);
if (null == staProtocol) {
staProtocol = new StaProtocol();
@@ -135,13 +147,13 @@
}
Thread.sleep(200);
- ArrayList<Integer> errorStaNo = getStaNo();
+ ArrayList<Station> errorStaNo = getStaNo();
OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB101.800.0", (short) (errorStaNo.size() * 4));
if (result3.IsSuccess) {
for (int i = 0; i < errorStaNo.size(); i++) {
- Integer siteId = errorStaNo.get(i); // 绔欑偣缂栧彿
+ Station siteStation = errorStaNo.get(i);
+ Integer siteId = Integer.parseInt(siteStation.getStaNo()); // 绔欑偣缂栧彿
StaProtocol staProtocol = station.get(siteId);
-// staProtocol.setLocType1((short) siemensS7Net.getByteTransform().TransInt32(result3.Content, i * 4));//楂樹綆淇″彿
boolean[] status = siemensS7Net.getByteTransform().TransBool(result3.Content, (i * 4 + 2), 2);
staProtocol.setFrontErr(status[0]);//鍓嶈秴闄�
staProtocol.setBackErr(status[1]);//鍚庤秴闄�
@@ -153,24 +165,26 @@
}
}
-
-
if (result.IsSuccess && !Cools.isEmpty(result) && result.IsSuccess) {
OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), device.getId()));
// 鏍规嵁瀹炴椂淇℃伅鏇存柊鏁版嵁搴�
try {
-// List<BasDevp> basDevps = new ArrayList<>();
-// for (Integer siteId : staNos) {
-// StaProtocol staProtocol = station.get(siteId);
-// basDevps.add(staProtocol.toSqlModel());
-// }
-//
-// BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
-// if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) {
-// throw new Exception("鏇存柊鏁版嵁搴撴暟鎹け璐�");
-// }
+ List<Station> stations = new ArrayList<>();
+ for (Station sta : getStaNo()) {
+ StaProtocol staProtocol = station.get(Integer.parseInt(sta.getStaNo()));
+ Station sqlModel = staProtocol.toSqlModel(sta);
+ stations.add(sqlModel);
+ }
+
+ if (!stations.isEmpty()) {
+ StationService stationService = SpringUtils.getBean(StationService.class);
+ if (null != stationService && !stationService.updateBatchById(stations)) {
+ throw new Exception("鏇存柊鏁版嵁搴撴暟鎹け璐�");
+ }
+ }
+
} catch (Exception e) {
e.printStackTrace();
OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戞洿鏂版暟鎹簱鏁版嵁澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), device.getId(), device.getIp(), device.getPort(), device.getRack(), device.getSlot()));
@@ -209,8 +223,8 @@
@Override
public boolean writeWorkNo(int siteId, short workNo) {
- ArrayList<Integer> staNos = getStaNo();
- int index = staNos.indexOf(siteId);
+ int index = findStaNosIndex(siteId);
+
OperateResult write = siemensS7Net.Write("DB100." + index*6, workNo); // 宸ヤ綔鍙�
if (!write.IsSuccess) {
@@ -230,8 +244,8 @@
@Override
public boolean writeStaNo(int siteId,short staNo) {
- ArrayList<Integer> staNos = getStaNo();
- int index = staNos.indexOf(siteId);
+ int index = findStaNosIndex(siteId);
+
OperateResult write = siemensS7Net.Write("DB100." + (index*6+4), staNo); // 鐩爣绔�
if (!write.IsSuccess) {
@@ -253,4 +267,18 @@
public Map<Integer, StaProtocol> getStation() {
return this.station;
}
+
+ private int findStaNosIndex(int siteId) {
+ ArrayList<Station> staNos = getStaNo();
+
+ int index = -1;
+ for (int i = 0; i < staNos.size(); i++) {
+ Station sta = staNos.get(i);
+ if (Integer.parseInt(sta.getStaNo()) == siteId) {
+ index = i;
+ break;
+ }
+ }
+ return index;
+ }
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/CodeBuilder.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/CodeBuilder.java
index a5c8d29..21e6d98 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/CodeBuilder.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/CodeBuilder.java
@@ -15,16 +15,16 @@
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_shuttle_device_status";
- generator.tableName="鍥涘悜杞﹁澶囩姸鎬佸垪琛�";
- generator.packagePath="com.zy.asrs.wcs.rcs";
+ generator.table="wcs_station";
+ generator.tableName="绔欑偣鍒楄〃";
+ generator.packagePath="com.zy.asrs.wcs.core";
generator.build();
}
diff --git a/zy-asrs-wcs/src/main/resources/mapper/core/StationMapper.xml b/zy-asrs-wcs/src/main/resources/mapper/core/StationMapper.xml
new file mode 100644
index 0000000..d3e5b6d
--- /dev/null
+++ b/zy-asrs-wcs/src/main/resources/mapper/core/StationMapper.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zy.asrs.wcs.core.mapper.StationMapper">
+
+</mapper>
--
Gitblit v1.9.1