23个文件已修改
15个文件已添加
5个文件已删除
| | |
| | | </div> |
| | | |
| | | <!--输出操作和FPS--> |
| | | <div style="position: absolute;bottom: 0px;left: 0px;user-select: none;"> |
| | | <div style="position: absolute;bottom: 20px;left: 20px;user-select: none;"> |
| | | <a-button type="dashed" @click="containerAppViewCenter"> |
| | | <CompressOutlined /> |
| | | </a-button> |
New file |
| | |
| | | <script setup> |
| | | import { getCurrentInstance, ref, watch, reactive } from 'vue'; |
| | | import { useRouter } from "vue-router"; |
| | | import { get, post, postForm } from '@/utils/request.js' |
| | | import { message, Modal } from 'ant-design-vue'; |
| | | import { logout } from '@/config.js'; |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import useTableSearch from '@/utils/tableUtils.jsx'; |
| | | const context = getCurrentInstance()?.appContext.config.globalProperties; |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const emit = defineEmits(['handleOk']) |
| | | |
| | | const TABLE_KEY = 'table-mat'; |
| | | let currentPage = 1; |
| | | let pageSize = 10; |
| | | let tableData = ref([]); |
| | | let selectedData = ref([]); |
| | | const open = ref(false); |
| | | const reload = ref(false); |
| | | const searchInput = ref("") |
| | | |
| | | const showWidth = ref("60%") |
| | | |
| | | const { |
| | | getColumnSearchProps, |
| | | } = useTableSearch(); |
| | | |
| | | const state = reactive({ |
| | | selectedRowKeys: [], |
| | | loading: false, |
| | | columns: [], |
| | | }); |
| | | const onSelectChange = (selectedRowKeys) => { |
| | | // console.log('selectedRowKeys changed: ', selectedRowKeys); |
| | | state.selectedRowKeys = selectedRowKeys; |
| | | selectedData.value = selectedRowKeys; |
| | | }; |
| | | |
| | | getColumns(); |
| | | getPage(); |
| | | |
| | | state.columns = [ |
| | | { |
| | | title: formatMessage('db.man_loc_detl.loc_no', '库位号'), |
| | | dataIndex: 'locNo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('locNo'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.mat_id', '商品'), |
| | | dataIndex: 'matId$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('matId$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.matnr', '商品编号'), |
| | | dataIndex: 'matnr', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('matnr'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.order_no', '订单号'), |
| | | dataIndex: 'orderNo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('orderNo'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.batch', '批号'), |
| | | dataIndex: 'batch', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('batch'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.anfme', '数量'), |
| | | dataIndex: 'anfme', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('anfme'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.status', '状态'), |
| | | dataIndex: 'status$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('status$'), |
| | | }, |
| | | // { |
| | | // title: formatMessage('db.man_loc_detl.create_time', '添加时间'), |
| | | // dataIndex: 'createTime$', |
| | | // width: 140, |
| | | // ellipsis: true, |
| | | // ...getColumnSearchProps('createTime$'), |
| | | // }, |
| | | // { |
| | | // title: formatMessage('db.man_loc_detl.create_by', '添加人员'), |
| | | // dataIndex: 'createBy$', |
| | | // width: 140, |
| | | // ellipsis: true, |
| | | // ...getColumnSearchProps('createBy$'), |
| | | // }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.update_time', '修改时间'), |
| | | dataIndex: 'updateTime$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateTime$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.update_by', '修改人员'), |
| | | dataIndex: 'updateBy$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateBy$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.memo', '备注'), |
| | | dataIndex: 'memo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('memo'), |
| | | }, |
| | | ]; |
| | | |
| | | //加载扩展字段 |
| | | async function getColumns() { |
| | | let fieldResp = await post('/api/matField/list', { |
| | | fieldType: 1 |
| | | }) |
| | | let fieldResult = fieldResp.data; |
| | | let tmp = state.columns; |
| | | if (fieldResult.code == 200) { |
| | | let data = fieldResult.data; |
| | | |
| | | data.forEach((item) => { |
| | | tmp.push({ |
| | | title: formatMessage(item.language, item.describe), |
| | | name: item.name, |
| | | dataIndex: item.name, |
| | | key: item.name, |
| | | width: 140, |
| | | editable: true, |
| | | }) |
| | | }) |
| | | |
| | | // tmp.push({ |
| | | // title: formatMessage('common.operation', '操作'), |
| | | // name: 'oper', |
| | | // dataIndex: 'oper', |
| | | // key: 'oper', |
| | | // width: 140, |
| | | // }) |
| | | |
| | | state.columns = tmp; |
| | | } else if (result.code === 401) { |
| | | message.error(result.msg); |
| | | logout() |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | } |
| | | |
| | | function getPage() { |
| | | post('/api/locDetl/outPage', { |
| | | current: currentPage, |
| | | pageSize: pageSize, |
| | | condition: searchInput.value |
| | | }).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | let data = result.data; |
| | | tableData.value = data.records; |
| | | } else if (result.code === 401) { |
| | | message.error(result.msg); |
| | | logout() |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleOk = () => { |
| | | open.value = false; |
| | | let tmpKeys = selectedData.value; |
| | | |
| | | post('/api/locDetl/listByIds', tmpKeys).then(resp => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | let tmp = result.data; |
| | | tmp.forEach((item) => { |
| | | item.workQty = item.anfme; |
| | | }) |
| | | emit('handleOk', tmp) |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | }) |
| | | |
| | | state.selectedRowKeys = [] |
| | | selectedData.value = [] |
| | | } |
| | | |
| | | const handleCancel = () => { |
| | | open.value = false; |
| | | } |
| | | |
| | | const onSearch = () => { |
| | | getPage() |
| | | } |
| | | |
| | | const reloadPage = () => { |
| | | currentPage = 1; |
| | | searchInput.value = ""; |
| | | getPage() |
| | | } |
| | | |
| | | watch(reload,(newVal,oldVal) => { |
| | | if(reload.value) { |
| | | reloadPage() |
| | | } |
| | | }) |
| | | |
| | | defineExpose({ |
| | | tableData, |
| | | open, |
| | | showWidth, |
| | | reload |
| | | }) |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: 'selectLocDetlComponent' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <a-modal v-model:open="open" :width="showWidth" @ok="handleOk" @cancel="handleCancel"> |
| | | <div class="table-header"> |
| | | <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '请输入')" |
| | | style="width: 200px;" @search="onSearch" /> |
| | | </div> |
| | | <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }" |
| | | :data-source="tableData" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id" :scroll="{ y: 768 }" |
| | | :columns="state.columns"> |
| | | </a-table> |
| | | </a-modal> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
New file |
| | |
| | | <script setup> |
| | | import { ref, nextTick } from 'vue'; |
| | | import { get, post, postBlob, postForm } from '@/utils/request.js' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | const formTable = ref(null); |
| | | const submitButton = ref(null); |
| | | const isSave = ref(true); |
| | | const open = ref(false); |
| | | const initFormData = {} |
| | | let formData = ref(initFormData); |
| | | |
| | | const emit = defineEmits(['tableReload']) |
| | | |
| | | const handleOk = (e) => { |
| | | nextTick(() => { |
| | | setTimeout(() => { |
| | | submitButton.value.$el.click(); |
| | | }, 100); |
| | | }); |
| | | }; |
| | | |
| | | const onFinish = values => { |
| | | // console.log('Success:', values); |
| | | open.value = false; |
| | | post(isSave.value ? '/api/operationPort/save' : '/api/operationPort/update', formData.value).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(isSave.value ? formatMessage('page.add.success', '新增成功') : formatMessage('page.update.success', '更新成功')); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | emit('tableReload', 'reload') |
| | | nextTick(() => { |
| | | formTable.value.resetFields() |
| | | }) |
| | | }) |
| | | }; |
| | | const onFinishFailed = errorInfo => { |
| | | console.log('Failed:', errorInfo); |
| | | }; |
| | | |
| | | const userQueryList = ref(null); |
| | | userQuery(); |
| | | function userQuery() { |
| | | postForm('/api/user/query', {}).then(resp => { |
| | | let result = resp.data; |
| | | userQueryList.value = result.data; |
| | | }) |
| | | } |
| | | |
| | | |
| | | defineExpose({ |
| | | open, |
| | | formData, |
| | | initFormData, |
| | | isSave, |
| | | }) |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '作业口管理-edit' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <a-modal v-model:open="open" |
| | | :title="isSave ? formatMessage('page.add', '添加') : formatMessage('page.edit', '编辑')" @ok="handleOk" |
| | | style="width: 600px;"> |
| | | <a-form :model="formData" ref="formTable" name="formTable" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" |
| | | style="display: flex;justify-content: space-between;flex-wrap: wrap;" autocomplete="off" |
| | | @finish="onFinish" @finishFailed="onFinishFailed"> |
| | | <a-form-item |
| | | :label="formatMessage('db.man_operation_port.flag', '作业口') " |
| | | name="flag" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.flag" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.man_operation_port.status', '状态') " |
| | | name="status" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.status" |
| | | :options="[ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 }, |
| | | ]" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.man_operation_port.create_time', '添加时间') " |
| | | name="createTime" |
| | | style="width: 250px;" |
| | | > |
| | | <a-date-picker |
| | | v-model:value="formData.createTime" |
| | | show-time |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.man_operation_port.create_by', '添加人员') " |
| | | name="createBy" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.createBy" |
| | | :placeholder="formatMessage('common.select', '请选择')" |
| | | style="width: 100%" |
| | | show-search |
| | | :options="userQueryList" |
| | | optionFilterProp="label" |
| | | optionLabelProp="label" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.man_operation_port.update_time', '修改时间') " |
| | | name="updateTime" |
| | | style="width: 250px;" |
| | | > |
| | | <a-date-picker |
| | | v-model:value="formData.updateTime" |
| | | show-time |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.man_operation_port.update_by', '修改人员') " |
| | | name="updateBy" |
| | | style="width: 250px;" |
| | | > |
| | | <a-select |
| | | v-model:value="formData.updateBy" |
| | | :placeholder="formatMessage('common.select', '请选择')" |
| | | style="width: 100%" |
| | | show-search |
| | | :options="userQueryList" |
| | | optionFilterProp="label" |
| | | optionLabelProp="label" |
| | | > |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item |
| | | :label="formatMessage('db.man_operation_port.memo', '备注') " |
| | | name="memo" |
| | | style="width: 250px;" |
| | | > |
| | | <a-input |
| | | v-model:value="formData.memo" |
| | | /> |
| | | </a-form-item> |
| | | |
| | | <a-form-item> |
| | | <a-button type="primary" html-type="submit" ref="submitButton" |
| | | style="visibility: hidden;">Submit</a-button> |
| | | </a-form-item> |
| | | </a-form> |
| | | </a-modal> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
New file |
| | |
| | | <script setup> |
| | | import { getCurrentInstance, ref, computed, reactive } from 'vue'; |
| | | import { useRouter } from "vue-router"; |
| | | import { get, post, postBlob } from '@/utils/request.js' |
| | | import { message, Modal } from 'ant-design-vue'; |
| | | import { logout } from '@/config.js'; |
| | | import EditView from './edit.vue' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import useTableSearch from '@/utils/tableUtils.jsx'; |
| | | const context = getCurrentInstance()?.appContext.config.globalProperties; |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const TABLE_KEY = 'table-operationPort'; |
| | | let currentPage = 1; |
| | | let pageSize = 10; |
| | | const searchInput = ref("") |
| | | const editChild = ref(null) |
| | | |
| | | let tableData = ref([]); |
| | | getPage(); |
| | | |
| | | const { |
| | | getColumnSearchProps, |
| | | handleResizeColumn, |
| | | } = useTableSearch(); |
| | | |
| | | const columns = [ |
| | | { |
| | | title: formatMessage('db.man_operation_port.flag', '作业口'), |
| | | dataIndex: 'flag', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('flag'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_operation_port.status', '状态'), |
| | | dataIndex: 'status$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('status$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_operation_port.create_time', '添加时间'), |
| | | dataIndex: 'createTime$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('createTime$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_operation_port.create_by', '添加人员'), |
| | | dataIndex: 'createBy$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('createBy$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_operation_port.update_time', '修改时间'), |
| | | dataIndex: 'updateTime$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateTime$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_operation_port.update_by', '修改人员'), |
| | | dataIndex: 'updateBy$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateBy$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_operation_port.memo', '备注'), |
| | | dataIndex: 'memo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('memo'), |
| | | }, |
| | | |
| | | { |
| | | title: formatMessage('common.operation', '操作'), |
| | | name: 'oper', |
| | | dataIndex: 'oper', |
| | | key: 'oper', |
| | | width: 140, |
| | | fixed: 'right', |
| | | }, |
| | | ]; |
| | | |
| | | const state = reactive({ |
| | | selectedRowKeys: [], |
| | | loading: false, |
| | | }); |
| | | const hasSelected = computed(() => state.selectedRowKeys.length > 0); |
| | | const start = () => { |
| | | state.loading = true; |
| | | // ajax request after empty completing |
| | | setTimeout(() => { |
| | | state.loading = false; |
| | | state.selectedRowKeys = []; |
| | | }, 1000); |
| | | }; |
| | | const onSelectChange = selectedRowKeys => { |
| | | // console.log('selectedRowKeys changed: ', selectedRowKeys); |
| | | state.selectedRowKeys = selectedRowKeys; |
| | | }; |
| | | |
| | | function getPage() { |
| | | post('/api/operationPort/page', { |
| | | current: currentPage, |
| | | pageSize: pageSize, |
| | | condition: searchInput.value |
| | | }).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | let data = result.data; |
| | | tableData.value = data; |
| | | } else if (result.code === 401) { |
| | | message.error(result.msg); |
| | | logout() |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleEdit = (item) => { |
| | | editChild.value.open = true; |
| | | editChild.value.formData = item == null ? editChild.value.initFormData : JSON.parse(JSON.stringify(item)); |
| | | editChild.value.isSave = item == null; |
| | | } |
| | | |
| | | const handleDel = (rows) => { |
| | | Modal.confirm({ |
| | | title: formatMessage('page.delete', '删除'), |
| | | content: formatMessage('page.delete.confirm', '确定删除该项吗?'), |
| | | maskClosable: true, |
| | | onOk: async () => { |
| | | const hide = message.loading(formatMessage('common.loading', '请求中')); |
| | | try { |
| | | post('/api/operationPort/remove/' + rows.map((row) => row.id).join(','), {}).then(resp => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(result.msg); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | getPage() |
| | | hide() |
| | | }) |
| | | } catch (error) { |
| | | message.error(formatMessage('common.fail', '请求失败')); |
| | | } |
| | | }, |
| | | }); |
| | | } |
| | | |
| | | const handleExport = async (intl) => { |
| | | postBlob('/api/operationPort/export', {}).then(result => { |
| | | const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' }); |
| | | window.location.href = window.URL.createObjectURL(blob); |
| | | return true; |
| | | }) |
| | | }; |
| | | |
| | | const onSearch = () => { |
| | | // console.log('search'); |
| | | getPage() |
| | | } |
| | | |
| | | const onPageChange = (page, size) => { |
| | | currentPage = page; |
| | | pageSize = size; |
| | | getPage(); |
| | | } |
| | | |
| | | function handleTableReload(value) { |
| | | getPage() |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '作业口管理' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <EditView ref="editChild" @tableReload="handleTableReload" /> |
| | | <div class="table-header"> |
| | | <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '请输入')" |
| | | style="width: 200px;" @search="onSearch" /> |
| | | <div class="table-header-right"> |
| | | <a-button @click="handleEdit(null)" type="primary">{{ formatMessage('page.add', '添加') }}</a-button> |
| | | <a-button @click="handleExport">{{ formatMessage('page.export', '导出') }}</a-button> |
| | | </div> |
| | | </div> |
| | | <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }" |
| | | :data-source="tableData.records" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id" |
| | | :pagination="{ total: tableData.total, onChange: onPageChange }" |
| | | :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns" @resizeColumn="handleResizeColumn"> |
| | | <template #bodyCell="{ column, text, record }"> |
| | | <template v-if="column.dataIndex === 'oper'"> |
| | | <div style="display: flex;justify-content: space-evenly;"> |
| | | <a-button type="link" primary @click="handleEdit(record)">{{ formatMessage('page.edit', '编辑') }}</a-button> |
| | | <a-button type="link" danger @click="handleDel([record])">{{ formatMessage('page.delete', '删除') |
| | | }}</a-button> |
| | | </div> |
| | | </template> |
| | | </template> |
| | | </a-table> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
| | |
| | | <a-form-item :label="formatMessage('db.man_loc_detl.anfme', '数量')" name="anfme" style="width: 250px;"> |
| | | <a-input v-model:value="formData.anfme" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_loc_detl.status', '状态')" name="status" |
| | | style="width: 250px;"> |
| | | <a-form-item :label="formatMessage('db.man_loc_detl.status', '状态')" name="status" style="width: 250px;"> |
| | | <a-select v-model:value="formData.status" :options="[ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 }, |
| | |
| | | <a-input v-model:value="formData.memo" /> |
| | | </a-form-item> |
| | | |
| | | <a-form-item v-for="(item, index) in extendField" :key="index" :label="formatMessage(item.language, item.describe)" :name="item.name" style="width: 250px;"> |
| | | <a-form-item v-for="(item, index) in extendField" :key="index" |
| | | :label="formatMessage(item.language, item.describe)" :name="item.name" style="width: 250px;"> |
| | | <a-input v-model:value="formData[item.name]" /> |
| | | </a-form-item> |
| | | |
New file |
| | |
| | | <script setup> |
| | | import { ref, reactive } from 'vue'; |
| | | import { useRouter } from "vue-router"; |
| | | import { get, post, postForm } from '@/utils/request.js' |
| | | import { message, Modal } from 'ant-design-vue'; |
| | | import { logout } from '@/config.js'; |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import useTableSearch from '@/utils/tableUtils.jsx'; |
| | | import SelectLocDetlView from '@/components/locDetl/selectLocDetl/index.vue' |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const TABLE_KEY = 'table-locDetl'; |
| | | const selectLocDetlChild = ref(null) |
| | | const selectLocDetlViewShow = ref(false) |
| | | |
| | | let tableData = ref([]); |
| | | getColumns(); |
| | | |
| | | const { |
| | | getColumnSearchProps, |
| | | handleResizeColumn, |
| | | } = useTableSearch(); |
| | | |
| | | const state = reactive({ |
| | | selectedRowKeys: [], |
| | | loading: false, |
| | | columns: [], |
| | | }); |
| | | const onSelectChange = selectedRowKeys => { |
| | | // console.log('selectedRowKeys changed: ', selectedRowKeys); |
| | | state.selectedRowKeys = selectedRowKeys; |
| | | }; |
| | | |
| | | state.columns = [ |
| | | { |
| | | title: formatMessage('db.man_loc_detl.anfme', '出库数量'), |
| | | dataIndex: 'workQty', |
| | | width: 140, |
| | | ellipsis: true, |
| | | editable: true, |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.anfme', '库存数量'), |
| | | dataIndex: 'anfme', |
| | | width: 140, |
| | | ellipsis: true, |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.loc_id', '库位'), |
| | | dataIndex: 'locId$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('locId$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.loc_no', '库位号'), |
| | | dataIndex: 'locNo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('locNo'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.mat_id', '商品'), |
| | | dataIndex: 'matId$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('matId$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.matnr', '商品编号'), |
| | | dataIndex: 'matnr', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('matnr'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.order_no', '订单号'), |
| | | dataIndex: 'orderNo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('orderNo'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.batch', '批号'), |
| | | dataIndex: 'batch', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('batch'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.anfme', '数量'), |
| | | dataIndex: 'anfme', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('anfme'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.status', '状态'), |
| | | dataIndex: 'status$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('status$'), |
| | | }, |
| | | // { |
| | | // title: formatMessage('db.man_loc_detl.create_time', '添加时间'), |
| | | // dataIndex: 'createTime$', |
| | | // width: 140, |
| | | // ellipsis: true, |
| | | // ...getColumnSearchProps('createTime$'), |
| | | // }, |
| | | // { |
| | | // title: formatMessage('db.man_loc_detl.create_by', '添加人员'), |
| | | // dataIndex: 'createBy$', |
| | | // width: 140, |
| | | // ellipsis: true, |
| | | // ...getColumnSearchProps('createBy$'), |
| | | // }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.update_time', '修改时间'), |
| | | dataIndex: 'updateTime$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateTime$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.update_by', '修改人员'), |
| | | dataIndex: 'updateBy$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateBy$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_loc_detl.memo', '备注'), |
| | | dataIndex: 'memo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('memo'), |
| | | }, |
| | | ]; |
| | | |
| | | //加载扩展字段 |
| | | async function getColumns() { |
| | | let fieldResp = await post('/api/matField/list', { |
| | | unique: 1, |
| | | fieldType: 1 |
| | | }) |
| | | let fieldResult = fieldResp.data; |
| | | let tmp = state.columns; |
| | | if (fieldResult.code == 200) { |
| | | let data = fieldResult.data; |
| | | |
| | | data.forEach((item) => { |
| | | tmp.push({ |
| | | title: formatMessage(item.language, item.describe), |
| | | name: item.name, |
| | | dataIndex: item.name, |
| | | key: item.name, |
| | | width: 140, |
| | | }) |
| | | }) |
| | | |
| | | tmp.push({ |
| | | title: formatMessage('common.operation', '操作'), |
| | | name: 'oper', |
| | | dataIndex: 'oper', |
| | | key: 'oper', |
| | | width: 140, |
| | | fixed: 'right', |
| | | }) |
| | | |
| | | state.columns = tmp; |
| | | } else if (result.code === 401) { |
| | | message.error(result.msg); |
| | | logout() |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | } |
| | | |
| | | const openSelect = () => { |
| | | selectLocDetlChild.value.open = true; |
| | | } |
| | | |
| | | const handleSelectLocDetlOk = (result) => { |
| | | let tmp = []; |
| | | |
| | | if (tableData.value != undefined) { |
| | | tmp = [...tableData.value] |
| | | } |
| | | |
| | | for (let i = 0; i < result.length; i++) { |
| | | let item = result[i] |
| | | let flag = false; |
| | | for (let j = 0; j < tmp.length; j++) { |
| | | let tmpItem = tmp[j] |
| | | if (item.id == tmpItem.id) { |
| | | flag = true; |
| | | break |
| | | } |
| | | } |
| | | |
| | | if (flag) { |
| | | continue |
| | | } |
| | | |
| | | tmp.push(item) |
| | | } |
| | | |
| | | tableData.value = tmp; |
| | | } |
| | | |
| | | const handleDel = (record) => { |
| | | let data = tableData.value; |
| | | let tmp = [] |
| | | |
| | | for (let i = 0; i < data.length; i++) { |
| | | let item = data[i] |
| | | if (item.id == record.id) { |
| | | continue |
| | | } |
| | | tmp.push(item) |
| | | } |
| | | tableData.value = tmp |
| | | } |
| | | |
| | | const operationPort = ref(null); |
| | | const operationPortQueryList = ref(null); |
| | | operationPortQuery(); |
| | | function operationPortQuery() { |
| | | postForm('/api/operationPort/query', {}).then(resp => { |
| | | let result = resp.data; |
| | | operationPortQueryList.value = result.data; |
| | | }) |
| | | } |
| | | |
| | | const startOut = () => { |
| | | let detls = [] |
| | | tableData.value.forEach((item) => { |
| | | let tmp = { |
| | | detlId: item.id, |
| | | anfme: item.workQty |
| | | } |
| | | detls.push(tmp) |
| | | }) |
| | | |
| | | let param = { |
| | | operationPort: operationPort.value, |
| | | detls: detls |
| | | } |
| | | |
| | | post('/api/out/start', param).then(resp => { |
| | | let result = resp.data; |
| | | if(result.code == 200) { |
| | | message.success(formatMessage('page.out.success', '出库成功')); |
| | | operationPort.value = null; |
| | | tableData.value = []; |
| | | selectLocDetlChild.value.reload = true; |
| | | }else { |
| | | message.error(result.msg); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '手动出库' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <div class="table-header"> |
| | | <div> |
| | | <a-button type="primary" @click="openSelect">提取库存</a-button> |
| | | |
| | | <a-select v-model:value="operationPort" :placeholder="formatMessage('common.select', '请选择')" |
| | | style="width: 120px;margin-left: 30px;" :options="operationPortQueryList" optionFilterProp="label" |
| | | optionLabelProp="label"> |
| | | </a-select> |
| | | |
| | | <a-button type="primary" style="margin-left: 5px;" @click="startOut">启动出库</a-button> |
| | | </div> |
| | | </div> |
| | | <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }" |
| | | :data-source="tableData" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id" |
| | | :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="state.columns" |
| | | @resizeColumn="handleResizeColumn"> |
| | | <template #bodyCell="{ column, text, record }"> |
| | | <template v-if="column.dataIndex === 'oper'"> |
| | | <div style="display: flex;justify-content: space-evenly;"> |
| | | <a-button type="link" danger @click="handleDel(record)">{{ formatMessage('page.delete', '删除') |
| | | }}</a-button> |
| | | </div> |
| | | </template> |
| | | |
| | | <template v-if="column.dataIndex === 'workQty'"> |
| | | <div> |
| | | <a-input-number v-model:value="record[column.dataIndex]" :min="1" :max="record.anfme" /> |
| | | </div> |
| | | </template> |
| | | </template> |
| | | </a-table> |
| | | |
| | | <SelectLocDetlView ref="selectLocDetlChild" @handle-ok="handleSelectLocDetlOk" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
| | |
| | | dataIndex: 'oper', |
| | | key: 'oper', |
| | | fixed: 'right', |
| | | width: 240, |
| | | width: 300, |
| | | }, |
| | | ]; |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | const handlePick = (record) => { |
| | | Modal.confirm({ |
| | | title: formatMessage('page.pick', '拣料'), |
| | | content: formatMessage('page.pick.confirm', '确定拣料该项吗?'), |
| | | maskClosable: true, |
| | | onOk: async () => { |
| | | const hide = message.loading(formatMessage('common.loading', '请求中')); |
| | | try { |
| | | post('/api/task/pick', record).then(resp => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(result.msg); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | getPage() |
| | | hide() |
| | | }) |
| | | } catch (error) { |
| | | message.error(formatMessage('common.fail', '请求失败')); |
| | | } |
| | | }, |
| | | }); |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | |
| | | <div style="display: flex;justify-content: space-evenly;"> |
| | | <a-button type="link" primary @click="showDetl(record)">{{ formatMessage('page.task.orderDetl', '任务明细') |
| | | }}</a-button> |
| | | <a-button type="link" primary @click="handleComplete(record)">{{ formatMessage('page.complete', '完成') }}</a-button> |
| | | <a-button v-if="record.taskType == 103" type="link" primary @click="handlePick(record)">{{ |
| | | formatMessage('page.pick', '拣料') |
| | | }}</a-button> |
| | | <a-button type="link" primary @click="handleComplete(record)">{{ formatMessage('page.complete', '完成') |
| | | }}</a-button> |
| | | <a-button type="link" danger @click="handleCancel(record)">{{ formatMessage('page.cancel', '取消') |
| | | }}</a-button> |
| | | </div> |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.parser.Feature; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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.wms.asrs.entity.*; |
| | | import com.zy.asrs.wms.asrs.entity.enums.LocStsType; |
| | | import com.zy.asrs.wms.asrs.mapper.LocDetlMapper; |
| | | import com.zy.asrs.wms.asrs.service.LocDetlFieldService; |
| | | import com.zy.asrs.wms.asrs.service.LocService; |
| | |
| | | @Autowired |
| | | private LocDetlFieldService locDetlFieldService; |
| | | |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locDetl:list')") |
| | | @PostMapping("/locDetl/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | // BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | // PageParam<LocDetl, BaseParam> pageParam = new PageParam<>(baseParam, LocDetl.class); |
| | | // |
| | | // PageParam<LocDetl, BaseParam> page = locDetlService.page(pageParam, pageParam.buildWrapper(true)); |
| | | // JSONObject data = JSON.parseObject(JSON.toJSONString(page)); |
| | | // |
| | | // List<LocDetl> records = page.getRecords(); |
| | | // data.put("records", records); |
| | | // for (LocDetl locDetl : records) { |
| | | // List<LocDetlField> list = locDetlFieldService.list(new LambdaQueryWrapper<LocDetlField>().eq(LocDetlField::getDetlId, locDetl.getId())); |
| | | // locDetl.syncField(list); |
| | | // } |
| | | |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<ViewLocDetl, BaseParam> pageParam = new PageParam<>(baseParam, ViewLocDetl.class); |
| | | PageParam<ViewLocDetl, BaseParam> data = locDetlService.getPage(pageParam, pageParam.buildWrapper(true)); |
| | | return R.ok().add(data); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locDetl:list')") |
| | | @PostMapping("/locDetl/outPage") |
| | | public R outPage(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<ViewLocDetl, BaseParam> pageParam = new PageParam<>(baseParam, ViewLocDetl.class); |
| | | |
| | | QueryWrapper<ViewLocDetl> queryWrapper = pageParam.buildWrapper(true); |
| | | List<Long> locIds = locService.listBySts(LocStsType.F.val()); |
| | | if (locIds.isEmpty()) { |
| | | locIds.add(-1L); |
| | | } |
| | | queryWrapper.in("loc_id", locIds); |
| | | PageParam<ViewLocDetl, BaseParam> data = locDetlService.getPage(pageParam, queryWrapper); |
| | | return R.ok().add(data); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locDetl:list')") |
| | | @PostMapping("/locDetl/listByIds") |
| | | public R listByIds(@RequestBody List<Long> ids) { |
| | | List<LocDetl> list = locDetlService.listByIds(ids); |
| | | List<LocDetl> locDetls = locDetlService.parseLocDetl(list); |
| | | return R.ok().add(locDetls); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:locDetl:list')") |
| | | @GetMapping("/locDetl/locId/{locId}") |
| | | public R list(@PathVariable("locId") Long locId) { |
| | | List<LocDetl> list = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, locId)); |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.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.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | | import com.zy.asrs.wms.common.domain.PageParam; |
| | | import com.zy.asrs.wms.asrs.entity.OperationPort; |
| | | import com.zy.asrs.wms.asrs.service.OperationPortService; |
| | | import com.zy.asrs.wms.system.controller.BaseController; |
| | | import com.zy.asrs.wms.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 OperationPortController extends BaseController { |
| | | |
| | | @Autowired |
| | | private OperationPortService operationPortService; |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:operationPort:list')") |
| | | @PostMapping("/operationPort/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<OperationPort, BaseParam> pageParam = new PageParam<>(baseParam, OperationPort.class); |
| | | return R.ok().add(operationPortService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:operationPort:list')") |
| | | @PostMapping("/operationPort/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(operationPortService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:operationPort:list')") |
| | | @GetMapping("/operationPort/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(operationPortService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:operationPort:save')") |
| | | @OperationLog("添加作业口管理") |
| | | @PostMapping("/operationPort/save") |
| | | public R save(@RequestBody OperationPort operationPort) { |
| | | if (!operationPortService.save(operationPort)) { |
| | | return R.error("添加失败"); |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:operationPort:update')") |
| | | @OperationLog("修改作业口管理") |
| | | @PostMapping("/operationPort/update") |
| | | public R update(@RequestBody OperationPort operationPort) { |
| | | if (!operationPortService.updateById(operationPort)) { |
| | | return R.error("修改失败"); |
| | | } |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:operationPort:remove')") |
| | | @OperationLog("删除作业口管理") |
| | | @PostMapping("/operationPort/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!operationPortService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("删除失败"); |
| | | } |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:operationPort:list')") |
| | | @PostMapping("/operationPort/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<OperationPort> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(OperationPort::getId, condition); |
| | | } |
| | | operationPortService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getFlag(), item.getFlag())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:operationPort:list')") |
| | | @PostMapping("/operationPort/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(operationPortService.list(), OperationPort.class), response); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.wms.asrs.controller; |
| | | |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.asrs.controller.req.IdReq; |
| | | import com.zy.asrs.wms.asrs.controller.req.OutReq; |
| | | import com.zy.asrs.wms.asrs.entity.LocDetl; |
| | | import com.zy.asrs.wms.asrs.entity.param.OutParam; |
| | | import com.zy.asrs.wms.asrs.manage.OutManage; |
| | | import com.zy.asrs.wms.system.controller.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 这里处理所有的出库流程的接口 |
| | | * 出库逻辑主要在查询匹配的库存信息, |
| | | * 1. 获取库存,根据条件(灵活配置)查询库存,返回给前端供用户选择(返回时,每条库存记录要携带loc_detl表的主键id,这样立即出库,只要传递loc_detl表id+数量,就可以明确出库出哪些数据了,不需要二次匹配) |
| | | * 2. 出库(只需要一个接口(即/out/start接口),只要库位详情的id和出库数量以及出库到哪个站点)(以及涉及到移库) |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | public class OutController extends BaseController { |
| | |
| | | @Autowired |
| | | private OutManage outManage; |
| | | |
| | | |
| | | /** |
| | | * 获取库存 |
| | | * |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @PostMapping("/out/getStock") |
| | | public R getStock(@RequestBody Map<String, Object> map) { |
| | | List<LocDetl> suitableMat = outManage.listSuitableMat(map); |
| | | return R.ok(suitableMat); |
| | | } |
| | | |
| | | /** |
| | | * 获取库存 |
| | | * |
| | | * @param order |
| | | * @return |
| | | */ |
| | | @PostMapping("/out/getStockByOrder") |
| | | public R getStockByOrder(@RequestBody IdReq order) { |
| | | List<LocDetl> suitableMat = outManage.listSuitableMatByOrder(order.getId()); |
| | | return R.ok(suitableMat); |
| | | } |
| | | |
| | | /** |
| | | * 获取库存 |
| | | * |
| | | * @param wave |
| | | * @return |
| | | */ |
| | | @PostMapping("/out/getStockByWave") |
| | | public R getStockByWave(@RequestBody IdReq wave) { |
| | | List<LocDetl> suitableMat = outManage.listSuitableMatByWave(wave.getId()); |
| | | return R.ok(suitableMat); |
| | | } |
| | | |
| | | /** |
| | | * 出库 |
| | | * 出库只需要一个接口,只要出到哪个站点,库位出多少数量,即OutReq对象 |
| | | * |
| | | * @param outReq 出库列表 |
| | | * @return |
| | | */ |
| | | @PostMapping("/out/start") |
| | | public R start(@RequestBody OutReq outReq) { |
| | | outManage.out(outReq); |
| | | public R start(@RequestBody OutParam param) { |
| | | outManage.out(param); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:task:update')") |
| | | @OperationLog("拣料任务") |
| | | @PostMapping("/task/pick") |
| | | public R pick(@RequestBody Task task) { |
| | | try { |
| | | boolean result = workService.pickTask(task.getId()); |
| | | return R.ok("拣料成功"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return R.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.zy.asrs.wms.system.entity.Host; |
| | | import com.zy.asrs.wms.system.entity.User; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.SpringUtils; |
| | | import com.zy.asrs.wms.system.service.UserService; |
| | | import com.zy.asrs.wms.system.service.HostService; |
| | | import com.zy.asrs.common.utils.Synchro; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("man_operation_port") |
| | | public class OperationPort 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 flag; |
| | | |
| | | /** |
| | | * 所属机构 |
| | | */ |
| | | @ApiModelProperty(value= "所属机构") |
| | | private Long hostId; |
| | | |
| | | /** |
| | | * 状态 1: 正常 0: 禁用 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 正常 0: 禁用 ") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty(value= "添加时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 添加人员 |
| | | */ |
| | | @ApiModelProperty(value= "添加人员") |
| | | private Long createBy; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value= "修改人员") |
| | | private Long updateBy; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | public OperationPort() {} |
| | | |
| | | public OperationPort(String flag,Long hostId,Integer status,Integer deleted,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) { |
| | | 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; |
| | | } |
| | | |
| | | // OperationPort operationPort = new OperationPort( |
| | | // null, // 作业口 |
| | | // null, // 所属机构 |
| | | // null, // 状态 |
| | | // null, // 是否删除 |
| | | // null, // 添加时间 |
| | | // null, // 添加人员 |
| | | // null, // 修改时间 |
| | | // null, // 修改人员 |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | public String getHostId$(){ |
| | | HostService service = SpringUtils.getBean(HostService.class); |
| | | Host host = service.getById(this.hostId); |
| | | if (!Cools.isEmpty(host)){ |
| | | return String.valueOf(host.getName()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return "正常"; |
| | | case 0: |
| | | return "禁用"; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | } |
| | | } |
| | | |
| | | public String getDeleted$(){ |
| | | if (null == this.deleted){ return null; } |
| | | switch (this.deleted){ |
| | | case 1: |
| | | return "是"; |
| | | case 0: |
| | | return "否"; |
| | | default: |
| | | return String.valueOf(this.deleted); |
| | | } |
| | | } |
| | | |
| | | public String getCreateTime$(){ |
| | | if (Cools.isEmpty(this.createTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); |
| | | } |
| | | |
| | | public String getCreateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.createBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getUpdateTime$(){ |
| | | if (Cools.isEmpty(this.updateTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); |
| | | } |
| | | |
| | | public String getUpdateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.updateBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | public void sync(Object source) { |
| | | Synchro.Copy(source, this); |
| | | } |
| | | } |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.fasterxml.jackson.annotation.JsonAnyGetter; |
| | | import com.zy.asrs.common.utils.Synchro; |
| | | import com.zy.asrs.wms.asrs.service.MatService; |
| | | import com.zy.asrs.wms.asrs.service.OrderDetlService; |
| | | import com.zy.asrs.wms.asrs.service.OrderService; |
| | | import com.zy.asrs.wms.asrs.service.TaskService; |
| | | import com.zy.asrs.wms.asrs.entity.param.FieldParam; |
| | | import com.zy.asrs.wms.asrs.service.*; |
| | | import com.zy.asrs.wms.system.entity.Host; |
| | | import com.zy.asrs.wms.system.entity.User; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | |
| | | dynamicFields.put(key, value); |
| | | } |
| | | |
| | | //获取索引字段 |
| | | public List<FieldParam> getUniqueField() { |
| | | MatFieldService service = SpringUtils.getBean(MatFieldService.class); |
| | | |
| | | List<FieldParam> list = new ArrayList<>(); |
| | | for (MatField matField : service.list(new LambdaQueryWrapper<MatField>().eq(MatField::getUnique, 1))) { |
| | | FieldParam param = new FieldParam(); |
| | | param.setName(matField.getName()); |
| | | param.setValue(dynamicFields.get(matField.getName())); |
| | | list.add(param); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class OutDetlDto { |
| | | |
| | | /** |
| | | * 库存明细ID |
| | | */ |
| | | private Long detlId; |
| | | |
| | | /** |
| | | * 数量 |
| | | */ |
| | | private Double anfme; |
| | | |
| | | /** |
| | | * 库存数量 |
| | | */ |
| | | private Double stock; |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class OutLocDto { |
| | | |
| | | private Long locId; |
| | | |
| | | private List<OutDetlDto> detls; |
| | | |
| | | private Boolean all; |
| | | |
| | | private String operationPort; |
| | | |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | public static LocTypeHeightType get(String flag) { |
| | | for (LocTypeHeightType value : LocTypeHeightType.values()) { |
| | | if (value.flag.equals(flag)) { |
| | | return value; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.entity.param; |
| | | |
| | | import com.zy.asrs.wms.asrs.entity.dto.OutDetlDto; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class OutParam implements Serializable { |
| | | |
| | | /** |
| | | * 库位明细 |
| | | */ |
| | | private List<OutDetlDto> detls; |
| | | |
| | | /** |
| | | * 作业口 |
| | | */ |
| | | private String operationPort; |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.wms.asrs.manage; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wms.asrs.controller.req.OutReq; |
| | | import com.zy.asrs.wms.asrs.entity.dto.OutDetlDto; |
| | | import com.zy.asrs.wms.asrs.entity.dto.OutLocDto; |
| | | import com.zy.asrs.wms.asrs.entity.enums.LocStsType; |
| | | import com.zy.asrs.wms.asrs.entity.param.OutParam; |
| | | import com.zy.asrs.wms.asrs.entity.*; |
| | | import com.zy.asrs.wms.asrs.entity.param.FieldParam; |
| | | import com.zy.asrs.wms.asrs.service.*; |
| | | import com.zy.asrs.wms.utils.OutUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 出库管理 |
| | |
| | | |
| | | @Autowired |
| | | private TaskService taskService; |
| | | |
| | | |
| | | @Autowired |
| | | private TaskDetlService taskDetlService; |
| | | |
| | | @Autowired |
| | | private TaskDetlFieldService taskDetlFieldService; |
| | | @Autowired |
| | | private LocService locService; |
| | | |
| | | |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | |
| | | |
| | | @Autowired |
| | | private LocDetlFieldService locDetlFieldService; |
| | | @Autowired |
| | | private WorkService workService; |
| | | |
| | | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private OutUtils outUtils; |
| | | |
| | | |
| | | /** |
| | | * 获取库存 |
| | | * |
| | | * @param map |
| | | */ |
| | | public List<LocDetl> listSuitableMat(Map<String, Object> map) { |
| | | List<FieldParam> param = new ArrayList<>(); |
| | | map.entrySet().stream().filter(entry -> entry.getValue() != null).forEach(entry -> { |
| | | FieldParam fieldParam = new FieldParam(); |
| | | fieldParam.setName(entry.getKey()); |
| | | fieldParam.setValue(entry.getValue()); |
| | | param.add(fieldParam); |
| | | }); |
| | | //TODO 这里加上出库规则 |
| | | |
| | | List<LocDetl> stock = locDetlService.listSuitableMat(param, null); |
| | | return stock; |
| | | } |
| | | |
| | | /** |
| | | * 根据订单id获取库存 |
| | | * |
| | | * @param orderId 订单ID |
| | | */ |
| | | public List<LocDetl> listSuitableMatByOrder(Long orderId) { |
| | | Order order = orderService.getById(orderId); |
| | | List<OrderDetl> orderDetls = orderDetlService.getOrderDetlByOrderId(orderId); |
| | | //TODO 这里加上出库规则 |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | |
| | | } |
| | | List<FieldParam> param = new ArrayList<>(); |
| | | |
| | | |
| | | List<LocDetl> stock = locDetlService.listSuitableMat(param, null); |
| | | return stock; |
| | | } |
| | | |
| | | /** |
| | | * 根据订单id获取库存 |
| | | * |
| | | * @param waveId 订单ID |
| | | */ |
| | | public List<LocDetl> listSuitableMatByWave(Long waveId) { |
| | | |
| | | List<FieldParam> param = new ArrayList<>(); |
| | | |
| | | |
| | | List<LocDetl> stock = locDetlService.listSuitableMat(param, null); |
| | | return stock; |
| | | } |
| | | |
| | | /** |
| | | * 出库 |
| | | * |
| | | * @param outReq |
| | | */ |
| | | public void out(OutReq outReq) { |
| | | Map<Long, List<OutReq.Detl>> map = outReq.getDetls().stream().collect(Collectors.groupingBy(OutReq.Detl::getLocDetlId)); |
| | | map.forEach((k, v) -> { |
| | | Loc loc = locService.getById(k); |
| | | processTask(loc, v, outReq.getTargetSite()); |
| | | }); |
| | | @Transactional |
| | | public void out(OutParam outParam) { |
| | | if (outParam.getOperationPort() == null) { |
| | | throw new CoolException("作业口不存在"); |
| | | } |
| | | |
| | | List<OutLocDto> list = outUtils.merge(outParam); |
| | | processTask(list); |
| | | } |
| | | |
| | | private void processTask(Loc loc, List<OutReq.Detl> detls, String targetSite) { |
| | | // 保存工作档 |
| | | private void processTask(List<OutLocDto> list) { |
| | | for (OutLocDto locDto : list) { |
| | | long taskType = locDto.getAll() ? 101L : 103L; |
| | | |
| | | Loc loc = locService.getById(locDto.getLocId()); |
| | | if(loc == null) { |
| | | throw new CoolException("库位不存在"); |
| | | } |
| | | |
| | | if (!loc.getLocStsId().equals(LocStsType.F.val())) { |
| | | throw new CoolException("库位状态不在库"); |
| | | } |
| | | |
| | | Task task = new Task(); |
| | | task.setTaskNo(workService.generateTaskNo(1L)); |
| | | // 任务状态 |
| | | task.setTaskSts(101L); |
| | | // 任务类型 |
| | | task.setTaskType(101L); |
| | | // 优先级 |
| | | task.setIoPri(1); |
| | | // 源库位 |
| | | task.setTaskType(taskType); |
| | | task.setIoPri(workService.generateIoPri(taskType)); |
| | | task.setOriginLoc(loc.getLocNo()); |
| | | // 目标站点 |
| | | task.setTargetSite(targetSite); |
| | | // 托盘码 |
| | | task.setTargetSite(locDto.getOperationPort()); |
| | | task.setBarcode(loc.getBarcode()); |
| | | boolean res = taskService.save(task); |
| | | if (!res) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | // 工作档明细保存 |
| | | for (OutReq.Detl detl : detls) { |
| | | LocDetl locDetl = locDetlService.getById(detl.getLocDetlId()); |
| | | for (OutDetlDto detl : locDto.getDetls()) { |
| | | LocDetl locDetl = locDetlService.getById(detl.getDetlId()); |
| | | if(locDetl == null) { |
| | | throw new CoolException("明细不存在"); |
| | | } |
| | | |
| | | TaskDetl taskDetl = new TaskDetl(); |
| | | taskDetl.sync(locDetl); |
| | | taskDetl.setTaskId(task.getId()); |
| | | taskDetl.setAnfme(detl.getAnfme()); |
| | | taskDetl.setStock(detl.getStock()); |
| | | if (!taskDetlService.save(taskDetl)) { |
| | | throw new CoolException("保存工作档明细失败"); |
| | | } |
| | | |
| | | List<LocDetlField> locDetlFields = locDetlFieldService.list(new LambdaQueryWrapper<LocDetlField>().eq(LocDetlField::getDetlId, locDetl.getId())); |
| | | for (LocDetlField locDetlField : locDetlFields) { |
| | | TaskDetlField taskDetlField = new TaskDetlField(); |
| | | taskDetlField.sync(locDetlField); |
| | | taskDetlField.setDetlId(taskDetl.getId()); |
| | | boolean taskDetlFieldSave = taskDetlFieldService.save(taskDetlField); |
| | | if(!taskDetlFieldSave){ |
| | | throw new CoolException("明细扩展生成失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //库位F => R |
| | | loc.setLocStsId(LocStsType.R.val()); |
| | | loc.setUpdateTime(new Date()); |
| | | boolean locUpdate = locService.updateById(loc); |
| | | if(!locUpdate){ |
| | | throw new CoolException("库位状态更新失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface LocMapper extends BaseMapper<Loc> { |
| | | |
| | | List<Long> listBySts(Long sts); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.mapper; |
| | | |
| | | import com.zy.asrs.wms.asrs.entity.OperationPort; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface OperationPortMapper extends BaseMapper<OperationPort> { |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wms.asrs.entity.Loc; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface LocService extends IService<Loc> { |
| | | |
| | | List<Long> listBySts(Long sts); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wms.asrs.entity.OperationPort; |
| | | |
| | | public interface OperationPortService extends IService<OperationPort> { |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.wms.asrs.service; |
| | | |
| | | import com.zy.asrs.wms.asrs.entity.Loc; |
| | | import com.zy.asrs.wms.asrs.entity.param.FieldParam; |
| | | import com.zy.asrs.wms.asrs.entity.param.GeneratePakInParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface WorkService { |
| | | |
| | |
| | | //生成可用库位号 |
| | | Loc generateLoc(Long taskType, String barcode, Integer locTypeHeight); |
| | | |
| | | //生成可用库位号 |
| | | Loc generateLoc(Long taskType, Long matId, String batch, List<FieldParam> uniqueFields, Integer locTypeHeight); |
| | | |
| | | //生成入库任务(满托盘) |
| | | boolean generatePakIn(GeneratePakInParam param); |
| | | |
| | |
| | | //取消任务 |
| | | boolean cancelTask(Long taskId); |
| | | |
| | | //拣料任务 |
| | | boolean pickTask(Long taskId); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | @Service("locService") |
| | | public class LocServiceImpl extends ServiceImpl<LocMapper, Loc> implements LocService { |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<Long> listBySts(Long sts) { |
| | | return this.baseMapper.listBySts(sts); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.service.impl; |
| | | |
| | | import com.zy.asrs.wms.asrs.mapper.OperationPortMapper; |
| | | import com.zy.asrs.wms.asrs.entity.OperationPort; |
| | | import com.zy.asrs.wms.asrs.service.OperationPortService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("operationPortService") |
| | | public class OperationPortServiceImpl extends ServiceImpl<OperationPortMapper, OperationPort> implements OperationPortService { |
| | | |
| | | } |
| | |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wms.asrs.entity.*; |
| | | import com.zy.asrs.wms.asrs.entity.enums.*; |
| | | import com.zy.asrs.wms.asrs.entity.param.FieldParam; |
| | | import com.zy.asrs.wms.asrs.entity.param.GeneratePakInParam; |
| | | import com.zy.asrs.wms.asrs.service.*; |
| | | import com.zy.asrs.wms.utils.LocUtils; |
| | |
| | | private LanewayRuleService lanewayRuleService; |
| | | @Autowired |
| | | private CircleRuleService circleRuleService; |
| | | @Autowired |
| | | private LocTypeBindService locTypeBindService; |
| | | @Autowired |
| | | private LocTypeService locTypeService; |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | @Override |
| | | public String generateTaskNo(Long taskType) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Loc generateLoc(Long taskType, String barcode, Integer locTypeHeight) { |
| | | public synchronized Loc generateLoc(Long taskType, String barcode, Integer locTypeHeight) { |
| | | List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, barcode)); |
| | | if (taskType != 10 && waitPakins.isEmpty()) { |
| | | throw new CoolException("托盘未组托"); |
| | |
| | | if (detl == null) { |
| | | throw new CoolException("订单明细不存在"); |
| | | } |
| | | String batch = detl.getBatch(); |
| | | List<FieldParam> uniqueFields = detl.getUniqueField(); |
| | | |
| | | Mat mat = detl.getMat$(); |
| | | if (mat == null) { |
| | | throw new CoolException("商品不存在"); |
| | | } |
| | | |
| | | return generateLoc(taskType, mat.getId(), batch, uniqueFields, locTypeHeight); |
| | | } |
| | | |
| | | @Override |
| | | public synchronized Loc generateLoc(Long taskType, Long matId, String batch, List<FieldParam> uniqueFields, Integer locTypeHeight) { |
| | | Mat mat = matService.getById(matId); |
| | | if (mat == null) { |
| | | throw new CoolException("商品不存在"); |
| | | } |
| | |
| | | for (ShelvesRuleDetl ruleDetl : ruleDetls) { |
| | | if (ruleDetl.getDetlType().equals(ShelvesRuleDetlType.TASK_OR_LOC.id)) { |
| | | //从库存或任务中匹配相邻库位 |
| | | defaultLoc = locUtils.getNeighborLoc(taskType, detl, locTypeHeight); |
| | | defaultLoc = locUtils.getNeighborLoc(taskType, mat.getId(), batch, uniqueFields, locTypeHeight); |
| | | if (defaultLoc != null) { |
| | | return defaultLoc; |
| | | } |
| | |
| | | |
| | | if (ruleDetl.getDetlType().equals(ShelvesRuleDetlType.SUGGEST.id)) { |
| | | //获取推荐库位 |
| | | List<Loc> suggestLoc = locUtils.getSuggestLoc(taskType, mat.getId(), detl.getBatch(), locTypeHeight, laneRowList, currentLev); |
| | | List<Loc> suggestLoc = locUtils.getSuggestLoc(taskType, mat.getId(), batch, locTypeHeight, laneRowList, currentLev); |
| | | //获取库位 |
| | | if (!suggestLoc.isEmpty()) { |
| | | defaultLoc = locUtils.filterLoc(taskType, suggestLoc); |
| | |
| | | break; |
| | | } |
| | | |
| | | //数据保存至历史档 |
| | | TaskLog taskLog = new TaskLog(); |
| | | taskLog.sync(task); |
| | | taskLog.setId(null); |
| | | if (!taskLogService.save(taskLog)) { |
| | | throw new CoolException("任务档案转历史档案失败"); |
| | | } |
| | | |
| | | //删除任务 |
| | | boolean removeTask = taskService.removeById(taskId); |
| | | if(!removeTask){ |
| | | throw new CoolException("回滚任务失败"); |
| | | } |
| | | |
| | | if (task.getTaskType() != 10) { |
| | | List<TaskDetl> taskDetls = taskDetlService.getTaskDetlByTaskId(taskId); |
| | | if (taskDetls.isEmpty()) { |
| | |
| | | |
| | | //回滚订单 |
| | | for (TaskDetl taskDetl : taskDetls) { |
| | | if (taskDetl.getDetlId() != null) { |
| | | OrderDetl orderDetl = orderDetlService.getById(taskDetl.getDetlId()); |
| | | if(orderDetl == null){ |
| | | throw new CoolException("订单明细不存在"); |
| | |
| | | boolean orderDetlUpdate = orderDetlService.updateById(orderDetl); |
| | | if(!orderDetlUpdate){ |
| | | throw new CoolException("工作数量回滚失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | //入库回滚组托通知档 |
| | |
| | | } |
| | | } |
| | | |
| | | //明细数据保存至历史档 |
| | | TaskDetlLog taskDetlLog = new TaskDetlLog(); |
| | | taskDetlLog.sync(taskDetl); |
| | | taskDetlLog.setId(null); |
| | | taskDetlLog.setTaskId(taskLog.getId()); |
| | | if (!taskDetlLogService.save(taskDetlLog)) { |
| | | throw new CoolException("明细数据转历史档案失败"); |
| | | } |
| | | |
| | | //删除明细 |
| | | boolean removeDetl = taskDetlService.removeById(taskDetl.getId()); |
| | | if(!removeDetl){ |
| | | throw new CoolException("回滚明细失败"); |
| | | } |
| | | |
| | | List<TaskDetlField> detlFields = taskDetlFieldService.list(new LambdaQueryWrapper<TaskDetlField>().eq(TaskDetlField::getDetlId, taskDetl.getId())); |
| | | for (TaskDetlField detlField : detlFields) { |
| | | //明细扩展字段数据保存至历史档 |
| | | TaskDetlFieldLog taskDetlFieldLog = new TaskDetlFieldLog(); |
| | | taskDetlFieldLog.sync(detlField); |
| | | taskDetlFieldLog.setId(null); |
| | | taskDetlFieldLog.setDetlId(taskDetlLog.getId()); |
| | | if (!taskDetlFieldLogService.save(taskDetlFieldLog)) { |
| | | throw new CoolException("明细扩展字段转历史档案失败"); |
| | | } |
| | |
| | | throw new CoolException("回滚扩展明细失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | //明细数据保存至历史档 |
| | | TaskDetlLog taskDetlLog = new TaskDetlLog(); |
| | | taskDetlLog.sync(taskDetl); |
| | | if (!taskDetlLogService.save(taskDetlLog)) { |
| | | throw new CoolException("明细数据转历史档案失败"); |
| | | } |
| | | |
| | | //删除明细 |
| | | boolean removeDetl = taskDetlService.removeById(taskDetl.getId()); |
| | | if(!removeDetl){ |
| | | throw new CoolException("回滚明细失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //数据保存至历史档 |
| | | TaskLog taskLog = new TaskLog(); |
| | | taskLog.sync(task); |
| | | if (!taskLogService.save(taskLog)) { |
| | | throw new CoolException("任务档案转历史档案失败"); |
| | | return true; |
| | | } |
| | | |
| | | //删除任务 |
| | | boolean removeTask = taskService.removeById(taskId); |
| | | if(!removeTask){ |
| | | throw new CoolException("回滚任务失败"); |
| | | @Override |
| | | public boolean pickTask(Long taskId) { |
| | | Task task = taskService.getById(taskId); |
| | | if(task == null){ |
| | | throw new CoolException("任务不存在"); |
| | | } |
| | | |
| | | if (task.getTaskType() != 103) { |
| | | throw new CoolException("任务类型不可拣料"); |
| | | } |
| | | |
| | | if (task.getTaskSts() != 200) { |
| | | throw new CoolException("当前状态不可拣料"); |
| | | } |
| | | |
| | | //获取源库位 |
| | | Loc originLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc())); |
| | | if(originLoc == null){ |
| | | throw new CoolException("源库位不存在"); |
| | | } |
| | | |
| | | //获取源库位高度 |
| | | LocTypeBind locTypeBind = locTypeBindService.getOne(new LambdaQueryWrapper<LocTypeBind>().eq(LocTypeBind::getLocId, originLoc.getId())); |
| | | if(locTypeBind == null){ |
| | | throw new CoolException("库位类型不存在"); |
| | | } |
| | | LocType locType = locTypeService.getById(locTypeBind.getTypeId()); |
| | | if(locType == null){ |
| | | throw new CoolException("库位类型不存在"); |
| | | } |
| | | LocTypeHeightType locTypeHeightType = LocTypeHeightType.get(locType.getFlag()); |
| | | if(locTypeHeightType == null){ |
| | | throw new CoolException("高低库位类型不存在"); |
| | | } |
| | | |
| | | Long taskType = task.getTaskType() - 50; |
| | | |
| | | List<TaskDetl> taskDetls = taskDetlService.list(new LambdaQueryWrapper<TaskDetl>().eq(TaskDetl::getTaskId, taskId).gt(TaskDetl::getAnfme, 0)); |
| | | if (taskDetls.isEmpty()) { |
| | | throw new CoolException("任务明细不存在"); |
| | | } |
| | | TaskDetl taskDetl = taskDetls.get(0); |
| | | |
| | | //生成库位 |
| | | Loc loc = this.generateLoc(taskType, taskDetl.getMatId(), taskDetl.getBatch(), taskDetl.getUniqueField(), locTypeHeightType.id); |
| | | if(loc == null) { |
| | | throw new CoolException("没有空库位"); |
| | | } |
| | | |
| | | task.setTaskSts(1L);//1.生成入库任务 |
| | | task.setTaskType(taskType); |
| | | task.setTargetLoc(loc.getLocNo()); |
| | | task.setUpdateTime(new Date()); |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("拣料失败"); |
| | | } |
| | | |
| | | //库位O => S |
| | | loc.setLocStsId(LocStsType.S.val()); |
| | | loc.setUpdateTime(new Date()); |
| | | boolean locUpdate = locService.updateById(loc); |
| | | if(!locUpdate){ |
| | | throw new CoolException("库位状态更新失败"); |
| | | } |
| | | |
| | | return true; |
| | |
| | | //保存任务历史档 |
| | | TaskLog taskLog = new TaskLog(); |
| | | taskLog.sync(task); |
| | | taskLog.setId(null); |
| | | if (!taskLogService.save(taskLog)) { |
| | | throw new CoolException("保存任务历史档失败"); |
| | | } |
| | |
| | | for (TaskDetl taskDetl : taskDetls) { |
| | | TaskDetlLog taskDetlLog = new TaskDetlLog(); |
| | | taskDetlLog.sync(taskDetl); |
| | | taskDetlLog.setId(null); |
| | | taskDetlLog.setTaskId(taskLog.getId()); |
| | | if (!taskDetlLogService.save(taskDetlLog)) { |
| | | throw new CoolException("保存任务明细历史档失败"); |
| | | } |
| | |
| | | //明细扩展字段数据保存至历史档 |
| | | TaskDetlFieldLog taskDetlFieldLog = new TaskDetlFieldLog(); |
| | | taskDetlFieldLog.sync(detlField); |
| | | taskDetlFieldLog.setId(null); |
| | | taskDetlFieldLog.setDetlId(taskDetlLog.getId()); |
| | | if (!taskDetlFieldLogService.save(taskDetlFieldLog)) { |
| | | throw new CoolException("明细扩展字段转历史档案失败"); |
| | | } |
| | |
| | | |
| | | //更新订单信息 |
| | | for (TaskDetl taskDetl : taskDetls) { |
| | | if (taskDetl.getDetlId() == null) { |
| | | continue; |
| | | } |
| | | |
| | | OrderDetl orderDetl = orderDetlService.getById(taskDetl.getDetlId()); |
| | | if (orderDetl == null) { |
| | | throw new CoolException("订单明细不存在"); |
| | |
| | | InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build()); |
| | | try { |
| | | //获取入库完成任务 |
| | | List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, 200)); |
| | | List<Task> list = taskService.list(new LambdaQueryWrapper<Task>() |
| | | .eq(Task::getTaskSts, 200) |
| | | .in(Task::getTaskType, 101, 53, 57)); |
| | | if (list.isEmpty()) { |
| | | return; |
| | | } |
| | |
| | | //保存任务历史档 |
| | | TaskLog taskLog = new TaskLog(); |
| | | taskLog.sync(task); |
| | | taskLog.setId(null); |
| | | if (!taskLogService.save(taskLog)) { |
| | | throw new CoolException("保存任务历史档失败"); |
| | | } |
| | |
| | | for (TaskDetl taskDetl : taskDetls) { |
| | | TaskDetlLog taskDetlLog = new TaskDetlLog(); |
| | | taskDetlLog.sync(taskDetl); |
| | | taskDetlLog.setId(null); |
| | | taskDetlLog.setTaskId(taskLog.getId()); |
| | | if (!taskDetlLogService.save(taskDetlLog)) { |
| | | throw new CoolException("保存任务明细历史档失败"); |
| | | } |
| | |
| | | //明细扩展字段数据保存至历史档 |
| | | TaskDetlFieldLog taskDetlFieldLog = new TaskDetlFieldLog(); |
| | | taskDetlFieldLog.sync(detlField); |
| | | taskDetlFieldLog.setId(null); |
| | | taskDetlFieldLog.setDetlId(taskDetlLog.getId()); |
| | | if (!taskDetlFieldLogService.save(taskDetlFieldLog)) { |
| | | throw new CoolException("明细扩展字段转历史档案失败"); |
| | | } |
| | |
| | | |
| | | //更新订单信息 |
| | | for (TaskDetl taskDetl : taskDetls) { |
| | | if (taskDetl.getDetlId() == null) { |
| | | continue; |
| | | } |
| | | |
| | | OrderDetl orderDetl = orderDetlService.getById(taskDetl.getDetlId()); |
| | | if (orderDetl == null) { |
| | | throw new CoolException("订单明细不存在"); |
| | |
| | | |
| | | for (Task task : list) { |
| | | //同步数据 |
| | | Long hostId = task.getHostId(); |
| | | switch (task.getTaskType().intValue()) { |
| | | case 1://入库 |
| | | executeTask1(task); |
| | | break; |
| | | case 53://拣料再入库 |
| | | executeTask53(task); |
| | | break; |
| | | default: |
| | | throw new CoolException("未知任务类型"); |
| | | } |
| | | |
| | | task.setTaskSts(100L);//100.库存更新完成 |
| | | task.setUpdateTime(new Date()); |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("库存更新失败"); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } finally { |
| | | InterceptorIgnoreHelper.clearIgnoreStrategy(); |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | @Transactional |
| | | public void outExecute() { |
| | | InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build()); |
| | | try { |
| | | //获取出库完成任务 |
| | | List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, 199)); |
| | | if (list.isEmpty()) { |
| | | return; |
| | | } |
| | | for (Task task : list) { |
| | | //同步数据 |
| | | switch (task.getTaskType().intValue()) { |
| | | case 101://出库 |
| | | executeTask101(task); |
| | | break; |
| | | case 103://拣料 |
| | | executeTask103(task); |
| | | break; |
| | | default: |
| | | throw new CoolException("未知任务类型"); |
| | | } |
| | | |
| | | task.setTaskSts(200L);//200.库存更新完成 |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("库存更新失败"); |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } finally { |
| | | InterceptorIgnoreHelper.clearIgnoreStrategy(); |
| | | } |
| | | } |
| | | |
| | | //入库 |
| | | private void executeTask1(Task task) { |
| | | Long hostId = task.getHostId(); |
| | | |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()).eq(Loc::getHostId, hostId)); |
| | | if (loc == null) { |
| | | throw new CoolException("库位不存在"); |
| | |
| | | if (!locService.updateById(loc)) { |
| | | throw new CoolException("库位状态更新失败"); |
| | | } |
| | | |
| | | |
| | | List<TaskDetl> taskDetls = taskDetlService.getTaskDetlByTaskId(task.getId()); |
| | | if (taskDetls.isEmpty()) { |
| | |
| | | //删除组托通知档 |
| | | waitPakinService.removeById(waitPakin.getId()); |
| | | } |
| | | |
| | | break; |
| | | } |
| | | |
| | | task.setTaskSts(100L);//100.库存更新完成 |
| | | task.setUpdateTime(new Date()); |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("库存更新失败"); |
| | | //拣料再入库 |
| | | private void executeTask53(Task task) { |
| | | Long hostId = task.getHostId(); |
| | | |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()).eq(Loc::getHostId, hostId)); |
| | | if (loc == null) { |
| | | throw new CoolException("库位不存在"); |
| | | } |
| | | |
| | | if (loc.getLocStsId() != LocStsType.S.val()) { |
| | | throw new CoolException("库位状态不处于S.入库预约"); |
| | | } |
| | | |
| | | loc.setLocStsId(LocStsType.F.val()); |
| | | loc.setUpdateTime(new Date()); |
| | | loc.setBarcode(task.getBarcode()); |
| | | if (!locService.updateById(loc)) { |
| | | throw new CoolException("库位状态更新失败"); |
| | | } |
| | | |
| | | List<TaskDetl> taskDetls = taskDetlService.getTaskDetlByTaskId(task.getId()); |
| | | if (taskDetls.isEmpty()) { |
| | | throw new CoolException("任务明细不存在"); |
| | | } |
| | | |
| | | //添加库存明细 |
| | | for (TaskDetl taskDetl : taskDetls) { |
| | | LocDetl locDetl = new LocDetl(); |
| | | locDetl.setLocId(loc.getId()); |
| | | locDetl.setLocNo(loc.getLocNo()); |
| | | locDetl.setMatId(taskDetl.getMatId()); |
| | | locDetl.setMatnr(taskDetl.getMat$().getMatnr()); |
| | | locDetl.setOrderNo(taskDetl.getOrderNo()); |
| | | locDetl.setBatch(taskDetl.getBatch()); |
| | | locDetl.setAnfme(taskDetl.getStock() - taskDetl.getAnfme()); |
| | | locDetl.setHostId(hostId); |
| | | if (!locDetlService.save(locDetl)) { |
| | | throw new CoolException("插入库存明细失败"); |
| | | } |
| | | |
| | | //添加库存明细扩展字段 |
| | | List<TaskDetlField> detlFields = taskDetlFieldService.list(new LambdaQueryWrapper<TaskDetlField>().eq(TaskDetlField::getDetlId, taskDetl.getId()).eq(TaskDetlField::getHostId, hostId)); |
| | | for (TaskDetlField detlField : detlFields) { |
| | | LocDetlField locDetlField = new LocDetlField(); |
| | | locDetlField.setDetlId(locDetl.getId()); |
| | | locDetlField.setFieldId(detlField.getFieldId()); |
| | | locDetlField.setName(detlField.getName()); |
| | | locDetlField.setValue(detlField.getValue()); |
| | | locDetlField.setHostId(hostId); |
| | | if (!locDetlFieldService.save(locDetlField)) { |
| | | throw new CoolException("插入明细扩展字段失败"); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } finally { |
| | | InterceptorIgnoreHelper.clearIgnoreStrategy(); |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | @Transactional |
| | | public void outExecute() { |
| | | InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build()); |
| | | try { |
| | | //获取出库完成任务 |
| | | List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, 199)); |
| | | if (list.isEmpty()) { |
| | | return; |
| | | } |
| | | for (Task task : list) { |
| | | //同步数据 |
| | | //出库 |
| | | private void executeTask101(Task task) { |
| | | Long hostId = task.getHostId(); |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc()).eq(Loc::getHostId, hostId)); |
| | | if (loc == null) { |
| | |
| | | if (taskDetls.isEmpty()) { |
| | | throw new CoolException("任务明细不存在"); |
| | | } |
| | | switch (task.getTaskType().intValue()) { |
| | | //出库 |
| | | case 101: |
| | | |
| | | loc.setLocStsId(LocStsType.O.val()); |
| | | loc.setBarcode(""); |
| | | if (!locService.updateById(loc)) { |
| | | throw new CoolException("库位状态更新失败"); |
| | | } |
| | | List<LocDetl> detlList = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocNo, loc.getId()).eq(LocDetl::getHostId, hostId)); |
| | | List<LocDetl> detlList = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, loc.getId()).eq(LocDetl::getHostId, hostId)); |
| | | //删除库存明细 |
| | | for (LocDetl locDetl : detlList) { |
| | | if (!locDetlService.removeById(locDetl)) { |
| | |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | |
| | | } |
| | | |
| | | task.setTaskSts(200L);//200.库存更新完成 |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("库存更新失败"); |
| | | //拣料出库 |
| | | private void executeTask103(Task task) { |
| | | Long hostId = task.getHostId(); |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc()).eq(Loc::getHostId, hostId)); |
| | | if (loc == null) { |
| | | throw new CoolException("库位不存在"); |
| | | } |
| | | if (loc.getLocStsId() != LocStsType.R.val()) { |
| | | throw new CoolException("库位状态不处于R.出库预约"); |
| | | } |
| | | List<TaskDetl> taskDetls = taskDetlService.getTaskDetlByTaskId(task.getId()); |
| | | if (taskDetls.isEmpty()) { |
| | | throw new CoolException("任务明细不存在"); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } finally { |
| | | InterceptorIgnoreHelper.clearIgnoreStrategy(); |
| | | loc.setLocStsId(LocStsType.O.val()); |
| | | loc.setBarcode(""); |
| | | if (!locService.updateById(loc)) { |
| | | throw new CoolException("库位状态更新失败"); |
| | | } |
| | | List<LocDetl> detlList = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, loc.getId()).eq(LocDetl::getHostId, hostId)); |
| | | //删除库存明细 |
| | | for (LocDetl locDetl : detlList) { |
| | | if (!locDetlService.removeById(locDetl)) { |
| | | throw new CoolException("删除库存明细失败"); |
| | | } |
| | | List<LocDetlField> detlFields = locDetlFieldService.list(new LambdaQueryWrapper<LocDetlField>().eq(LocDetlField::getDetlId, locDetl.getId()).eq(LocDetlField::getHostId, hostId)); |
| | | for (LocDetlField detlField : detlFields) { |
| | | if (!locDetlFieldService.removeById(detlField)) { |
| | | throw new CoolException("删除明细扩展字段失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | // generator.username="sa"; |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table="man_loc_map"; |
| | | generator.tableName="库位地图"; |
| | | generator.table="man_operation_port"; |
| | | generator.tableName="作业口管理"; |
| | | generator.rootPackagePath="com.zy.asrs.wms"; |
| | | generator.packagePath="com.zy.asrs.wms.asrs"; |
| | | |
| | |
| | | import com.zy.asrs.wms.asrs.entity.enums.LocStsType; |
| | | import com.zy.asrs.wms.asrs.entity.enums.LocTypeHeightType; |
| | | import com.zy.asrs.wms.asrs.entity.enums.ShelvesRuleType; |
| | | import com.zy.asrs.wms.asrs.entity.param.FieldParam; |
| | | import com.zy.asrs.wms.asrs.mapper.ViewLocDetlMapper; |
| | | import com.zy.asrs.wms.asrs.mapper.ViewTaskDetlMapper; |
| | | import com.zy.asrs.wms.asrs.service.*; |
| | |
| | | private ViewLocDetlMapper viewLocDetlMapper; |
| | | @Autowired |
| | | private ViewTaskDetlMapper viewTaskDetlMapper; |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | //从库存或任务中匹配相邻库位(满托盘) |
| | | public Loc getNeighborLoc(Long taskType, OrderDetl orderDetl, Integer locTypeHeight) { |
| | | public Loc getNeighborLoc(Long taskType, Long matId, String batch, List<FieldParam> uniqueFields, Integer locTypeHeight) { |
| | | //满托盘 |
| | | Mat mat = matService.getById(matId); |
| | | if (mat == null) { |
| | | return null; |
| | | } |
| | | |
| | | //从任务中进行匹配 |
| | | List<Loc> locs = new ArrayList<>(); |
| | | List<Map<String, Object>> list = viewTaskDetlMapper.getList(orderDetl.getMat$().getMatnr(), orderDetl.getBatch(), orderDetl.getUniqueField()); |
| | | List<Map<String, Object>> list = viewTaskDetlMapper.getList(mat.getMatnr(), batch, uniqueFields); |
| | | for (Map<String, Object> map : list) { |
| | | Task task = taskService.getById(map.get("taskId").toString()); |
| | | if(task == null) { |
| | |
| | | |
| | | //从库存中进行匹配 |
| | | List<Loc> locs2 = new ArrayList<>(); |
| | | List<Map<String, Object>> list2 = viewLocDetlMapper.getList(orderDetl.getMat$().getMatnr(), orderDetl.getBatch(), orderDetl.getUniqueField()); |
| | | List<Map<String, Object>> list2 = viewLocDetlMapper.getList(mat.getMatnr(), batch, uniqueFields); |
| | | for (Map<String, Object> map : list2) { |
| | | Loc one = locService.getById(map.get("locId").toString()); |
| | | if(one == null) { |
New file |
| | |
| | | package com.zy.asrs.wms.utils; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.wms.asrs.entity.LocDetl; |
| | | import com.zy.asrs.wms.asrs.entity.dto.OutDetlDto; |
| | | import com.zy.asrs.wms.asrs.entity.dto.OutLocDto; |
| | | import com.zy.asrs.wms.asrs.entity.param.OutParam; |
| | | import com.zy.asrs.wms.asrs.service.LocDetlService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Component |
| | | public class OutUtils { |
| | | |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | |
| | | public List<OutLocDto> merge(OutParam outParam) { |
| | | HashMap<Long, OutLocDto> map = new HashMap<>(); |
| | | |
| | | for (OutDetlDto detl : outParam.getDetls()) { |
| | | LocDetl locDetl = locDetlService.getById(detl.getDetlId()); |
| | | if (locDetl == null) { |
| | | continue; |
| | | } |
| | | detl.setStock(locDetl.getAnfme()); |
| | | |
| | | if (map.containsKey(locDetl.getLocId())) { |
| | | OutLocDto locDto = map.get(locDetl.getLocId()); |
| | | List<OutDetlDto> detlDtos = locDto.getDetls(); |
| | | detlDtos.add(detl); |
| | | |
| | | locDto.setDetls(detlDtos); |
| | | }else { |
| | | OutLocDto locDto = new OutLocDto(); |
| | | map.put(locDetl.getLocId(), locDto); |
| | | |
| | | List<OutDetlDto> detlDtos = new ArrayList<>(); |
| | | detlDtos.add(detl); |
| | | |
| | | locDto.setLocId(locDetl.getLocId()); |
| | | locDto.setDetls(detlDtos); |
| | | } |
| | | } |
| | | |
| | | List<OutLocDto> locDtos = new ArrayList<>(); |
| | | for (Map.Entry<Long, OutLocDto> entry : map.entrySet()) { |
| | | OutLocDto locDto = entry.getValue(); |
| | | locDtos.add(locDto); |
| | | |
| | | List<LocDetl> list = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, locDto.getLocId())); |
| | | |
| | | Double sum = 0D; |
| | | for (LocDetl locDetl : list) { |
| | | sum += locDetl.getAnfme(); |
| | | } |
| | | |
| | | for (OutDetlDto detl : locDto.getDetls()) { |
| | | sum -= detl.getAnfme(); |
| | | } |
| | | |
| | | locDto.setAll(sum == 0); |
| | | locDto.setOperationPort(outParam.getOperationPort()); |
| | | } |
| | | |
| | | //add zero stock |
| | | for (OutLocDto locDto : locDtos) { |
| | | List<OutDetlDto> detls = locDto.getDetls(); |
| | | List<Long> detlIds = new ArrayList<>(); |
| | | for (OutDetlDto detl : detls) { |
| | | detlIds.add(detl.getDetlId()); |
| | | } |
| | | |
| | | List<LocDetl> list = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, locDto.getLocId()).notIn(LocDetl::getId, detlIds)); |
| | | if (!list.isEmpty()) { |
| | | List<OutDetlDto> detlDtos = locDto.getDetls(); |
| | | for (LocDetl locDetl : list) { |
| | | OutDetlDto outDetlDto = new OutDetlDto(); |
| | | outDetlDto.setDetlId(locDetl.getId()); |
| | | outDetlDto.setAnfme(0D); |
| | | outDetlDto.setStock(locDetl.getAnfme()); |
| | | detlDtos.add(outDetlDto); |
| | | } |
| | | locDto.setDetls(detlDtos); |
| | | } |
| | | } |
| | | |
| | | return locDtos; |
| | | } |
| | | |
| | | } |
| | |
| | | validation-timeout: 3000 |
| | | connection-test-query: select 1 |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://192.168.4.61:3306/wms_dev?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | url: jdbc:mysql://127.0.0.1:3306/wms_dev?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: root |
| | | # driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zy.asrs.wms.asrs.mapper.LocMapper"> |
| | | |
| | | <select id="listBySts" resultType="long"> |
| | | select * from man_loc |
| | | where loc_sts_id = #{sts} |
| | | </select> |
| | | |
| | | </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.wms.asrs.mapper.OperationPortMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | -- save operationPort record |
| | | -- mysql |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `host_id`, `status`) values ( '作业口管理管理', '0', '/asrs/operationPort', '/asrs/operationPort', '0' , '0', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '查询作业口管理', '', '1', 'asrs:operationPort:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '添加作业口管理', '', '1', 'asrs:operationPort:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '修改作业口管理', '', '1', 'asrs:operationPort:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '删除作业口管理', '', '1', 'asrs:operationPort:remove', '3', '1', '1'); |
| | | |